EN ▾
Try with trial credit

OpenAI Price per Token Explained With Real Examples

Any openai price per token you see on a pricing page is a tiny number quoted per 1M tokens, split into one rate for input and one for output. Multiply tokens by the rate, divide by a million, add the two parts, and you have the cost of a request.

Last updated

Coins flowing through a glass pipeline and two gauges into a meter, picturing per-token pricing

Key takeaways

  • Cost = (input tokens x input rate + output tokens x output rate) / 1,000,000.
  • At $0.15 per 1M input and $0.50 per 1M output, a 2,000-token prompt with a 500-token reply costs $0.00055.
  • Chats get more expensive per turn because the whole history is sent as input again.
  • Failed or refused requests are not charged on this API, and credit never expires.

The formula in one line

Providers quote prices per million tokens because a single token costs a tiny fraction of a cent. The calculation is always the same:

cost = (input tokens x input price + output tokens x output price) / 1,000,000

Input tokens are everything you send: the system message, the conversation history and the new user message. Output tokens are what the model writes back. The two have separate prices, and output is usually the higher of the two.

We use this API's rates for every example below: $0.15 per 1M input tokens and $0.50 per 1M output tokens. For the rates of any other service, open its current pricing page and drop the numbers into the same formula. We do not quote other vendors' prices here, because they change.

Per token, per 1K and per 1M: the conversion table

People quote the same price in different units, which causes confusion. Here is the conversion at $0.15 and $0.50 per 1M:

UnitInputOutput
Per 1M tokens$0.15$0.50
Per 1,000 tokens$0.00015$0.0005
Per single token$0.00000015$0.0000005

To go from per-1M to per-1K, divide by 1,000. To go to per token, divide by 1,000,000. The ratio here is 0.50 / 0.15, so one output token costs about 3.3 times as much as one input token. That ratio decides where your money goes: a task that writes long answers from short prompts is output-heavy, and a task that reads long documents and replies in a line is input-heavy.

What counts as a token

A token is a chunk of text that the model reads as one unit. It can be a whole short word, part of a longer word, a number or a punctuation mark. English prose typically runs a bit above one token per word, while code, rare words and many non-English languages need more tokens for the same meaning. The exact count depends on the tokenizer, so a word count gives only a rough estimate.

The reliable number comes from the response itself. Every reply includes a usage object with prompt tokens and completion tokens. That is what you are billed on, and you can read it in code:

from openai import OpenAI

client = OpenAI(base_url="https://api.openaipriceapi.com/v1", api_key="YOUR_KEY")
reply = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Explain tokens in two sentences."}],
)
u = reply.usage
cost = (u.prompt_tokens * 0.15 + u.completion_tokens * 0.50) / 1_000_000
print(u.prompt_tokens, u.completion_tokens, f"${cost:.6f}")

Run it a few times with your own prompts. After ten or twenty calls you will know your typical token counts better than any rule of thumb.

Worked examples, from tiny to huge

Each line shows the arithmetic, so you can adapt it.

A normal chat message

2,000 input tokens and 500 output tokens. Input: 2,000 x $0.15 / 1,000,000 = $0.0003. Output: 500 x $0.50 / 1,000,000 = $0.00025. Total: $0.00055. A thousand of these cost $0.55.

A classifier call

300 input tokens and a 5-token label. Input: $0.000045. Output: $0.0000025. Total: $0.0000475, so 10,000 classifications cost $0.475.

Summarizing a long document

60,000 input tokens and 1,000 output tokens. Input: 60,000 x $0.15 / 1,000,000 = $0.009. Output: 1,000 x $0.50 / 1,000,000 = $0.0005. Total: $0.0095, under a cent.

The whole context window

The window is 100,000 tokens, prompt plus completion. A prompt of 90,000 tokens with a 10,000-token reply costs 90,000 x $0.15 / 1,000,000 = $0.0135 for input and 10,000 x $0.50 / 1,000,000 = $0.005 for output, which is $0.0185. That is the practical ceiling for one call: about two cents.

Why chats cost more per turn than you expect

The server remembers nothing between calls. To continue a conversation, your app sends the full history again, and every earlier message counts as input once more. So input grows with every turn, even if each message is short.

Take a 10-turn chat with a 500-token system message, where each user message is 200 tokens and each reply is 300 tokens. Turn 1 sends 700 input tokens. Each later turn sends 500 more than the one before, because the previous user message and reply are added. The inputs are 700, 1,200, 1,700 and so on up to 5,200 on turn 10. They sum to 29,500 input tokens. Output adds up to 10 x 300 = 3,000 tokens.

Cost: 29,500 x $0.15 / 1,000,000 = $0.004425 for input, plus 3,000 x $0.50 / 1,000,000 = $0.0015 for output, a total of $0.005925, about six tenths of a cent for the full conversation. The visible text is only 5,000 tokens, but the input bill is nearly six times that, which is the history effect at work. Trimming old turns or summarizing them is the main lever for long roleplay and companion chats.

From a price to a budget

Credit is prepaid. You top up any whole amount from $20 to $500 and spend it down by the token. With request A above at $0.00055, $1 of credit covers about 1,818 requests, and $20 covers about 36,000.

Bonuses add credit on larger top-ups: +5% from $50, +10% from $100, +15% from $200. A $50 top-up gives $52.50 of credit, $100 gives $110, and $200 gives $230. Payment is crypto only, with USDT on TRC20 or USDC on Base. Credit never expires, there is no subscription, and failed or refused requests are not charged. The pricing page shows the current tiers.

To watch spending, read the X-Balance-USD header on any response, or call GET /v1/balance. The header makes it simple to log the balance after each call and see the real cost per request. The docs cover the endpoints and request fields if you want to automate this.

Reading any provider's price table

Price tables look alike but hide differences that change the total. Before you compare two numbers, check these:

  • The unit. Per 1M tokens and per 1K tokens differ by a factor of 1,000. Convert both to the same unit first.
  • Input and output separately. A low input price can sit next to a high output price. Weigh both by your own ratio of input to output tokens. In the chat example above that ratio was nearly 10 to 1.
  • Extra rates. Some providers list separate prices for things like cached input or batch jobs. Check whether they apply to your usage rather than assuming.
  • Minimums and expiry. Look at the smallest top-up, whether credit expires, and what happens to the balance if you stop using the service. Here the minimum top-up is $20 and credit never expires.
  • What a failed call costs. On this API, failed or refused requests are not charged. Confirm the rule for any provider you compare.

Finally, compare on the same task. A model that needs fewer retries or shorter prompts for your use case can cost less in practice than one with a lower headline rate. Price per token is half of the picture. Tokens per task is the other half.

Quick checks before you trust an estimate

  • Count history. Estimate input for the average turn, not for the first message.
  • Count the system message. A 1,500-token character card or instruction block is paid for on every call.
  • Cap output when it matters. max_tokens is optional here. Without it, a reply can use the rest of the window, so set a cap when you need a hard limit on cost.
  • Use real usage numbers. A week of logged usage values beats any guess.

New to the service? The key page lets you claim $0.50 of trial credit with one click, with no card. At $0.00055 a request, that covers about 909 chat messages of the size in the first example, which is plenty for a real measurement.

Common questions

How do I convert a price per 1M tokens to a price per token?

Divide by 1,000,000. At $0.15 per 1M input tokens, one input token costs $0.00000015, and at $0.50 per 1M output tokens, one output token costs $0.0000005.

Why are output tokens priced higher than input tokens?

Generating text costs more compute than reading it, so most providers set a higher output rate. Here it is $0.50 against $0.15 per 1M.

Do I pay for failed requests on this API?

No. Failed or refused requests are not charged, and credit never expires.

How can I see what a single call cost?

Read usage in the response, multiply by the two rates, and divide by 1,000,000. You can also compare the X-Balance-USD header before and after a call.

Get your API key in steps

Register, copy the token, update your base URL. That is the entire configuration.

Enter email and password; receive your key instantly.