Cost per token in one table
If you searched for openai api cost per token, you probably saw prices quoted per million tokens and wanted the small number underneath. The method is the same for any provider: divide the per-million price by 1,000,000. We do not quote OpenAI's figures here because they depend on the model and change over time, so take them from their current pricing page and run them through the same steps. Below is the conversion for the rates on this site.
| Unit | Input | Output |
|---|---|---|
| Per 1M tokens | $0.15 | $0.50 |
| Per 1,000 tokens | $0.00015 | $0.0005 |
| Per single token | $0.00000015 | $0.0000005 |
A request with 1,200 input tokens and 300 output tokens therefore costs 1,200 times $0.00000015 plus 300 times $0.0000005. That is $0.00018 plus $0.00015, or $0.00033 in total. Roughly three requests of that size fit into a tenth of a cent.
How OpenAI-style token pricing is built
Most hosted LLM APIs follow the pattern that OpenAI made familiar. There are three things to know.
- Two meters. Tokens you send (the prompt, including the system message and the whole conversation history) are billed at the input rate. Tokens the model writes are billed at the output rate, which is usually higher.
- Per-model rates. Each model has its own pair of numbers. A larger model costs more per token than a small one, so the model name in your request is a pricing decision.
- Extras. Some providers add separate rates for cached prompt prefixes, batch processing or tool use. Whether any of that applies to a given model is on the vendor's page, so check their current pricing before you rely on it.
The service described here keeps it to two meters and one model. You pay $0.15 per 1M input tokens and $0.50 per 1M output tokens, from prepaid credit, and the model ID is uncensored. The price list has no further tiers to model.
What a token is, in practical terms
A token is a chunk of text, often a short word or part of a longer one. For ordinary English prose a common rule of thumb is about four characters per token, or about three quarters of a word. Code, other languages and unusual names split into more tokens per character, so the rule drifts.
That drift matters when you compare providers. Each model family has its own tokenizer, so the same text can produce different counts on different APIs. A local tokenizer library gives a close estimate only for the model it was built for. For billing, the number that counts is the one the API returns in the usage field, and that is the number you should log.
Track real cost from the response
The snippet below makes one call, prints the token counts, computes the cost, and reads the remaining balance from the response headers. It uses the official OpenAI Python SDK pointed at this API.
from openai import OpenAI
client = OpenAI(base_url="https://api.ltxnsfw.cc/v1", api_key="YOUR_KEY")
raw = client.chat.completions.with_raw_response.create(
model="uncensored",
messages=[
{"role": "system", "content": "You write short product descriptions."},
{"role": "user", "content": "Describe a pocket-sized field notebook."},
],
)
resp = raw.parse()
u = resp.usage
IN_RATE, OUT_RATE = 0.15, 0.50 # dollars per 1M tokens
cost = (u.prompt_tokens * IN_RATE + u.completion_tokens * OUT_RATE) / 1_000_000
print("input:", u.prompt_tokens, "output:", u.completion_tokens)
print("cost: $%.6f" % cost)
print("balance:", raw.headers.get("X-Balance-USD"))
The same check in Node looks like this:
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.ltxnsfw.cc/v1",
apiKey: process.env.API_KEY,
});
const r = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Describe a pocket-sized field notebook." }],
});
const cost = (r.usage.prompt_tokens * 0.15 + r.usage.completion_tokens * 0.5) / 1e6;
console.log(r.usage, cost.toFixed(6));
Write the usage numbers to your own logs per request, with the X-Request-Id header next to them. When a total looks wrong, that pair lets you find the exact call. Streaming responses report usage at the end of the stream, so log it there.
A monthly bill, worked through
Take a small product that sends 5,000 requests a day for 30 days. Each request averages 1,500 input tokens (a system prompt, some history and the user message) and 250 output tokens.
- Requests per month: 5,000 times 30 is 150,000.
- Input tokens: 150,000 times 1,500 is 225,000,000. At $0.15 per 1M that is $33.75.
- Output tokens: 150,000 times 250 is 37,500,000. At $0.50 per 1M that is $18.75.
- Total: $33.75 plus $18.75 is $52.50.
A $50 top-up includes a 5% bonus and arrives as $52.50 of credit, so one top-up at that size covers this workload for a month. The comparison with another provider is the same four steps with their rates and their reported token counts. Do the arithmetic with your own traffic, because a chat app that resends long history will look very different from a one-shot classifier.
Spend limits are easy to enforce on your side: read X-Balance-USD and alert when it drops below a threshold. Because you pay from prepaid credit, there is no invoice at the end of the month to be surprised by.
Mistakes that skew a cost estimate
Most surprises on a bill come from the same few places, and all of them are about input tokens.
- Forgetting the system prompt. A 600 token system message sent with each of 100,000 requests is 60,000,000 input tokens, or $9.00 at $0.15 per 1M, before any user text.
- Ignoring history. In a chat, turn ten carries turns one to nine. The cost per turn rises as the conversation grows, so averages taken from short test chats come out too low.
- Leaving out tool definitions. Function schemas you pass in
toolsare usually part of the prompt the model reads, so they count as input. Ten detailed schemas can add a thousand tokens or more to every call. - Counting words instead of tokens. A 750 word document is roughly 1,000 tokens of English, but not much more reliably than that. Always check the usage field.
- Setting max_tokens too low. Cutting a reply short does not make it cheaper to get a useful answer, since you may have to ask again. The parameter is optional here, and the completion can use whatever remains of the 100,000 token window.
A quick formula to keep nearby: cost equals input tokens times 0.15, plus output tokens times 0.50, all divided by 1,000,000. With 12,000 input tokens and 800 output tokens, that gives $0.0018 plus $0.0004, or $0.0022 for the call.
Moving an OpenAI-based app over
The API is OpenAI-compatible. It accepts POST /v1/chat/completions and GET /v1/models, with Authorization: Bearer authentication. For most apps built on an OpenAI SDK, the change is the base URL, the key and the model name. Streaming over SSE, tool calling and JSON mode (response_format with json_object) work the same way. Sampling settings such as temperature, top_p, stop, seed and the penalties are passed through.
The model itself is different. It is one open-weight model, run by an independent provider and tuned to answer without content refusals for lawful adult use. It is not an OpenAI model and not the official API of any vendor. Test your prompts before you trust equal quality, and keep your old provider configured while you do. The docs page covers parameters and limits, and the pricing page has the top-up tiers.
You can try it first for free. New users claim $0.50 of trial credit from the key page, valid for 7 days, one per person, no payment needed. The trial key allows 2 concurrent requests and 60 requests per minute, which is plenty for a cost test. A full key allows 8 concurrent requests and 300 requests per minute.
What this does not cover
Cost per token is only part of a decision. This is a text API. It does not do images, audio, video, embeddings or fine-tuning, and the context window is 100,000 tokens for prompt plus completion. If your product needs an embeddings endpoint or a specific vendor's model, you will need that vendor for those parts. Nothing stops you from using two providers, one for general work and one for content the first declines. Failed or refused requests are not charged here, which keeps that arrangement cheap to test.
