How Much Does ChatGPT API Cost? Token Math Explained
The honest answer is that the price depends on how many tokens you send and receive, and on which model you call. This page gives you the formula, three worked budgets, and a flat-rate endpoint to compare against.

Key points
- API cost is input tokens times the input rate plus output tokens times the output rate, billed per 1M tokens.
- For current OpenAI numbers, read their pricing page; this article does not quote them because they change.
- At $0.15 input and $0.50 output per 1M, a 2,000-token prompt with a 500-token reply costs $0.00055.
- Long chats cost more than they look, because every turn resends the whole history as input.
The pricing model in one paragraph
People ask how much does chatgpt api cost as if there were a single number. There is not. Hosted language model APIs charge per token, and they usually charge one rate for tokens you send (input) and a higher one for tokens the model writes back (output). The rate also depends on the model you pick. The ChatGPT app and the developer API are separate products, so a chat subscription does not tell you what an API call costs. For the current OpenAI figures, open their pricing page and check their current pricing before you build a budget on it.
What you can do today, without any vendor's price list, is learn to count tokens and apply a formula. Once that is in place, comparing providers takes two minutes: plug their two rates into the same spreadsheet.
The formula
Everything reduces to one line:
cost = (input tokens / 1,000,000 x input rate) + (output tokens / 1,000,000 x output rate)
A token is a chunk of text, often a short word or part of one. A common rule of thumb for English is that 1 token is about 4 characters, so 100 tokens is roughly 75 words. Other languages, code and JSON usually take more tokens per word. The API response includes a usage object with exact counts, and with streaming it arrives at the end, so use real numbers from your own traffic as soon as you have any.
Two details trip people up. First, the system prompt counts as input on every request, even if it never changes. Second, in a conversation you resend earlier messages each turn, so input grows as the chat gets longer. Both are covered in the examples below.
Worked examples: a support bot and a batch job
Worked example 1: a support bot
Say each message to your bot carries a 1,000-token system prompt plus a 500-token customer thread, so 1,500 input tokens, and the bot answers with 300 tokens. You handle 20,000 messages a month. Using $0.15 and $0.50 per 1M:
- Input: 1,500 x $0.15 / 1,000,000 = $0.000225 per message
- Output: 300 x $0.50 / 1,000,000 = $0.00015 per message
- Total: $0.000375 per message, so 20,000 messages cost $7.50 a month
That is a small number, and it shows why per-token pricing suits side projects. A $20 top-up would cover this bot for a bit more than two and a half months.
Worked example 2: a document batch job
Now a pipeline that classifies and summarizes 40,000 documents. Each one is about 6,000 tokens in, and you ask for a 400-token summary.
- Input tokens: 40,000 x 6,000 = 240,000,000, which is 240M. At $0.15 per 1M that is $36.
- Output tokens: 40,000 x 400 = 16,000,000, which is 16M. At $0.50 per 1M that is $8.
- Total: $44.
Batch jobs are input-heavy, so the input rate drives the bill. If you can shorten the documents before sending them, for example by stripping boilerplate or navigation text, you cut cost in direct proportion.
Worked example 3: why long chats get expensive
A roleplay or assistant chat feels cheap per message, but history is resent each turn. Assume an 800-token system prompt, a 100-token user message and a 200-token reply per turn, for 20 turns.
On turn 1 the input is 900 tokens. Each later turn adds 300 tokens of history (the previous user message plus the previous reply), so turn n sends 900 + 300 x (n - 1) tokens. Summing over 20 turns gives 20 x 900 + 300 x 190 = 18,000 + 57,000 = 75,000 input tokens. Output is 20 x 200 = 4,000 tokens.
- Input: 75,000 x $0.15 / 1,000,000 = $0.01125
- Output: 4,000 x $0.50 / 1,000,000 = $0.002
- Total: $0.01325 per 20-turn conversation, or $13.25 per 1,000 conversations
Notice that 75,000 input tokens went in to get 4,000 out. If your chats run to 100 turns, the history term grows with the square of the turn count, so trim or summarize old messages before the window fills. The context window here is 100,000 tokens, prompt plus completion, which is generous but not free to fill.
What a flat per-token endpoint looks like
For comparison, here is how this service prices its single model, uncensored. It is $0.15 per 1M input tokens and $0.50 per 1M output tokens, paid from prepaid credit with no subscription. Failed or refused requests are not charged, and credit never expires, so an idle month costs nothing.
| Request size | Input cost | Output cost | Total |
|---|---|---|---|
| 1,000 in / 1,000 out | $0.00015 | $0.0005 | $0.00065 |
| 2,000 in / 500 out | $0.0003 | $0.00025 | $0.00055 |
| 10,000 in / 1,000 out | $0.0015 | $0.0005 | $0.002 |
| 1M in / 1M out | $0.15 | $0.50 | $0.65 |
Top-ups are any whole amount from $20 to $500. A $50 top-up gets a 5% bonus, so you receive $52.50 of credit. At $100 the bonus is 10% ($110), and at $200 it is 15% ($230). You can pay by by crypto (USDT on TRC20, USDC on Base). The pricing page lists the same terms.
Measure real cost from the response
Estimates are fine for planning, but the invoice follows the usage object. With the OpenAI SDK pointed at this endpoint you can turn it into dollars right after each call. The snippet below uses the two rates from this page.
from openai import OpenAI
client = OpenAI(base_url="https://api.unrestrictedchatgpt.cc/v1", api_key="YOUR_KEY")
r = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Summarize the plot of Hamlet in 3 sentences."}],
)
u = r.usage
cost = u.prompt_tokens / 1_000_000 * 0.15 + u.completion_tokens / 1_000_000 * 0.50
print(u.prompt_tokens, u.completion_tokens, f"${cost:.6f}")
Run it over a sample of 200 real requests and average the result. That average, multiplied by your expected monthly volume, is a better budget than any back-of-envelope guess, because it includes your actual prompt lengths and your model's actual verbosity.
Hidden multipliers and budget habits
Hidden multipliers that inflate a bill
Several habits multiply token counts without anyone noticing. Retries are the first: if your client resends a request after a timeout and both complete, you pay twice, so keep timeouts generous for long completions. Tool calling is the second. Every tool definition you pass is part of the input, and a tool round trip sends the whole conversation again together with the tool result, so an agent loop with six steps can cost several times what a single call would.
Structured output is the third. If you ask for JSON and your parser rejects the result, a naive loop asks again with a longer prompt. Using JSON mode (response_format with json_object) and a short schema example in the system message usually removes most of those retries. The fourth is verbosity: a model that writes 800 tokens when 200 would do costs four times as much on the output side, where the rate is higher. A line such as "answer in at most five sentences" is the cheapest optimization there is.
When you compare vendors, compare on the same prompts and measure total dollars per completed task, not the headline rate alone. A cheaper rate with twice the retries is not cheaper.
Keeping a budget under control
Three habits keep API bills predictable on any provider. Log the usage object from every response and sum it per day, so a runaway loop shows up within hours. Set max_tokens on endpoints where long answers are a bug rather than a feature; here it is optional, and the completion can use whatever is left of the window. And read the balance header: responses from this API carry X-Balance-USD, which lets a small script warn you before the credit runs out.
If you want to try the numbers on real traffic, new accounts can claim $0.50 of trial credit with one click on the key page. At the 2,000/500 size above that covers about 900 requests. It needs no card and lasts 7 days. After sign-up you can get your API key and run the test, and the docs show the first request in a few lines. This endpoint takes text in and returns text out, so it replaces only the chat part of a stack that also uses images or embeddings.
More guides
Questions and answers
Is the ChatGPT API free?
Not as a standing plan. Hosted APIs bill per token. Check the provider's current pricing page for any free credit. On this service, new users can claim $0.50 of trial credit, valid for 7 days.
How many tokens is 1,000 words?
Roughly 1,300 tokens in plain English, using the rule of thumb that 100 tokens is about 75 words. Code and non-English text usually take more.
Do I pay for failed requests?
On this service, no. Failed or refused requests are not charged. Check the terms of any other provider you compare.
What is the cheapest way to cut my bill?
Shorten the input. Trim the system prompt, drop old chat history, and strip boilerplate from documents. Input tokens usually make up most of the total.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.