AI API Token Pricing: What 1M Tokens Costs
AI API token pricing explained: what a token is, how input, output, cache and reasoning tokens are billed, and what 1M tokens costs on Claude, GPT and DeepSeek.
GoiAPI · · 18 min read
Ask AI and more

A token is the small chunk of text an AI model reads and writes: a whole word, part of a word, a space plus a word, or a punctuation mark. AI APIs bill per token, quoted per million tokens, with separate prices for the input you send, the output the model writes, and tokens read from or written to the prompt cache. On GoiAPI, 1M input tokens cost from $0.0208 (GPT-6 Luna) to $0.442 (Claude Opus 5.5), and 1M output tokens cost from $0.1105 (Claude Haiku 5.5) to $2.21 (Claude Opus 5.5), checked on December 5, 2026.
This guide explains each token type, how many tokens a piece of English text really uses (with numbers we measured), why context windows and reasoning models change the bill, and how to work out the cost of a single request or a coding session yourself.
Disclosure: this article is published by GoiAPI, which offers API access to the models it covers.
What is a token in an AI API?
Language models do not read letters or words the way people do. Before a request reaches the model, a tokenizer cuts the text into pieces, and each piece maps to an ID number in the model's vocabulary. The model reads that sequence of numbers, predicts a new sequence, and the new numbers are turned back into text for you.

How many characters or words is a token?
For English, OpenAI's help article on tokens gives these rules of thumb: about 4 characters per token, or about 0.75 words per token, so 100 tokens is roughly 75 words. It calls them estimates and notes that other languages have a different ratio (OpenAI Help Center, checked on December 5, 2026).
Treat those ratios as a starting point, not a billing rule. Each model maker uses its own tokenizer, and tokenizers change between model generations. Anthropic says Claude 4.7 and later models use a newer tokenizer that produces approximately 30% more tokens for the same text, with the exact increase depending on the content (Anthropic pricing page, checked on December 5, 2026).
Same English text, three models: what we measured
On December 3, 2026 we sent one English paragraph of 112 words (607 characters) as the only user message to three models through api.goiapi.com, and read the input token count from the usage field of each response. Claude was called through /v1/messages with max_tokens: 1; GPT-6 Luna and DeepSeek V4.1 Flash through /v1/chat/completions.
| Model | Input tokens billed | Tokens per word |
|---|---|---|
| GPT-6 Luna | 144 | 1.29 |
| DeepSeek V4.1 Flash | 156 | 1.39 |
| Claude Haiku 5.5 | 329 | 2.94 |
Each cell is a single run on one short paragraph, so read it as an example rather than a fixed ratio. The counts include the message framing (role markers and formatting), which pushes tokens per word up on short texts.
Why Claude requests show more input tokens
Most of Claude's higher number in that table is a fixed block, not the paragraph itself. In our tests, every Claude request through GoiAPI was billed roughly 125 extra input tokens whatever the content: a message containing only the letter "a" was billed 134 input tokens, and the count grew steadily with longer messages from that base. GoiAPI does not add anything to what you send. This block is already inside the input_tokens figure in usage and is billed like any other input token.
Take the roughly 125 tokens away and the paragraph above comes to about 200 tokens on Claude Haiku 5.5. Asking the token-counting endpoint (covered below) for the same paragraph returned 217.
What this means for your bill:
- Short prompts: the fixed block is most of the input. A one-line question costs far more input tokens on Claude than the same question on GPT, DeepSeek or GLM models.
- Long prompts: it barely matters. On a request with 2,000 input and 500 output tokens it adds about 3% to the cost, and with prompt caching it sits inside the cached prefix.
Agents and tools add much more than this. Anthropic lists 286 extra system-prompt tokens on Claude Opus 5.5 and Haiku 5.5 whenever you pass tools with tool_choice set to auto or none (Anthropic pricing page, checked on December 5, 2026), and coding agents send their own instructions and tool definitions on every turn. There is a measured Claude Code example further down.
Input, output, cache and reasoning tokens explained
Every AI API price list splits tokens into types, each with its own rate:
- Input tokens: everything you send in one request: your message, the system prompt, the earlier conversation, file contents and tool definitions. Chat apps usually resend the whole conversation on every turn, so input tokens grow as a conversation gets longer.
- Output tokens: everything the model writes back. Output always costs more than input. On GoiAPI, output is 3 times the input price for DeepSeek and GLM models, 5 times for Claude and 6 times for GPT models.
- Reasoning tokens: reasoning models "think" before they answer, and those thinking tokens are billed as output even if you never see them. In our December 3, 2026 tests, GLM 5.3 Flash and DeepSeek V4.1 Flash both reported reasoning tokens inside their output count on a short question.
- Cache read tokens: prompt caching stores the start of a prompt you have already sent. When a later request starts with exactly the same prefix, that part is read from the cache at a much lower rate. On GoiAPI, Claude Opus 5.5 charges $0.0221 per million cache-read tokens versus $0.442 for regular input.
- Cache write tokens: the first time a prefix is stored in the cache, Claude bills it at the cache-write rate, which is higher than regular input ($0.8775 per million on Claude Opus 5.5). Caching only pays off when the same prefix is read again several times.

Claude Code turns on prompt caching by itself: in our test below it wrote more than 15,000 tokens to the cache on its very first request. In other tools or your own code, how you enable caching depends on the API format and the model, so check the tool's documentation. For the Claude-specific details, see Claude API pricing and prompt caching costs.
What is a context window?
The context window is the maximum number of tokens a model can handle in one request, counting both input and output. Go past it and the request is rejected, or your tool has to drop older parts of the conversation. In Claude Code this shows up as Prompt is too long; see how to fix Claude Code's Prompt is too long error.
A large context window is a limit, not a target. Every token you put into it is billed as input. If a coding tool loads 100,000 tokens of source code into each request, 50 requests add up to 5 million input tokens before any output.
Published limits from the model makers, checked on December 5, 2026:
- Anthropic: Claude 4.6 and later models, except Claude Haiku 5.5, include a 1M token context window at standard pricing (Anthropic pricing page). Claude Haiku 5.5 is priced by prompt length instead: on Anthropic's API, prompts over 100,000 tokens pay higher rates.
- DeepSeek: both
deepseek-flash(DeepSeek V4.1 Flash) anddeepseek-v4-prolist a 1M context length and a maximum output of 384K tokens (DeepSeek pricing page).
These are the model makers' figures for their own APIs. The GoiAPI pricing page does not list a context window for each model, so if your work depends on very long inputs, test one real request at the length you plan to use before you scale up.
How much does 1 million tokens cost?
It depends on the model and on the token type. Here is every model on GoiAPI, in USD per 1M tokens, from the GoiAPI pricing page checked on December 5, 2026:
| Model | Input | Output | Cache read | Cache write |
|---|---|---|---|---|
| GPT-6 Luna | $0.0208 | $0.1248 | $0.002106 | $0.026 |
| Claude Haiku 5.5 | $0.0221 | $0.1105 | $0.00221 | $0.043875 |
| DeepSeek V4.1 Flash | $0.0408408 | $0.1225224 | $0.0040664 | $0.051051 |
| GLM 5.3 Flash | $0.0408408 | $0.1225224 | $0.0040664 | $0.051051 |
| GPT-6.1 Sol | $0.13 | $0.78 | $0.013026 | $0.1625 |
| GPT-6.2 Sol | $0.13 | $0.78 | $0.013026 | $0.1625 |
| DeepSeek V4 Pro | $0.144144 | $0.432432 | $0.014495 | $0.18018 |
| GLM 5.3 | $0.144144 | $0.432432 | $0.014495 | $0.18018 |
| Claude Opus 5.5 | $0.442 | $2.21 | $0.0221 | $0.8775 |
Prices change; the pricing page always has the current list.
A realistic mix: 800,000 input + 200,000 output tokens
The tokens you actually use are rarely all input or all output. Assume 1 million tokens split into 800,000 input and 200,000 output, with no caching:
| Model | Input cost | Output cost | Total for 1M tokens |
|---|---|---|---|
| Claude Haiku 5.5 | $0.0177 | $0.0221 | ≈ $0.040 |
| GPT-6 Luna | $0.0166 | $0.0250 | ≈ $0.042 |
| DeepSeek V4.1 Flash / GLM 5.3 Flash | $0.0327 | $0.0245 | ≈ $0.057 |
| DeepSeek V4 Pro / GLM 5.3 | $0.1153 | $0.0865 | ≈ $0.202 |
| GPT-6.1 Sol / GPT-6.2 Sol | $0.104 | $0.156 | $0.26 |
| Claude Opus 5.5 | $0.3536 | $0.442 | ≈ $0.796 |
These are calculations from list prices, not measured requests. Remember the fixed Claude input block above: on many short requests, Claude models will use more input tokens than the same text on other models.
Compared with the model makers' own API prices
For reference, here are list prices on the model makers' own APIs, in USD per 1M tokens, checked on December 5, 2026:
| Model and source | Input | Output | Cache read | Cache write |
|---|---|---|---|---|
| Claude Opus 5.5, Anthropic | $4 | $20 | $0.20 | $5 (5-minute) / $8 (1-hour) |
| Claude Haiku 5.5, Anthropic, prompts up to 100,000 tokens | $0.10 | $0.50 | $0.01 | $0.125 / $0.20 |
| Claude Haiku 5.5, Anthropic, prompts over 100,000 tokens | $0.50 | $2.50 | $0.05 | $0.625 / $1 |
DeepSeek V4.1 Flash (deepseek-flash), DeepSeek, off-peak / peak | $0.15 / $0.30 | $0.60 / $1.20 | $0.003 / $0.006 | — |
DeepSeek V4 Pro (deepseek-v4-pro), DeepSeek, off-peak / peak | $0.66 / $1.32 | $1.98 / $3.96 | $0.022 / $0.044 | — |
DeepSeek's peak hours are 01:00 to 04:00 and 06:00 to 10:00 UTC, Monday through Friday, excluding Chinese public holidays; all other hours are off-peak. Anthropic bills in USD by credit card with a $5 minimum credit purchase, and new accounts start with no credits.
Anthropic's own API also offers things GoiAPI does not list, such as the Batch API with 50% off input and output for requests that can wait, and a direct contract with Anthropic. If you need those, use Anthropic's API. Model-specific breakdowns are in our guides to DeepSeek V4 API pricing and GLM 5.3 API pricing.
How to calculate the cost of one API request
The cost of any request is:
cost = ( input tokens × input price
+ output tokens × output price
+ cache read tokens × cache read price
+ cache write tokens × cache write price ) ÷ 1,000,000Two GoiAPI billing rules on top of the formula: each request that returns content has a small minimum charge, which only matters for very short requests, and a request that fails without returning any content is not charged, unless you cancel it yourself. The cost calculator applies the same formula to your own token counts and request volume.
Example 1: a regular chat request
Each request sends 2,000 input tokens and gets 500 output tokens back, with no caching. Costs exclude the minimum charge:
| Model | 1 request | 1,000 requests |
|---|---|---|
| Claude Haiku 5.5 | $0.000099 | $0.099 |
| GPT-6 Luna | $0.000104 | $0.104 |
| DeepSeek V4.1 Flash / GLM 5.3 Flash | $0.000143 | $0.143 |
| DeepSeek V4 Pro / GLM 5.3 | $0.000505 | $0.505 |
| GPT-6.1 Sol / GPT-6.2 Sol | $0.00065 | $0.65 |
| Claude Opus 5.5 | $0.001989 | $1.989 |
At 1,000 of these requests a day, Claude Opus 5.5 comes to about $1.99 per day and $59.67 over 30 days.
Example 2: a coding session with prompt caching
Coding tools send a lot of context with every request: source files, system instructions and the conversation so far. As an assumption, not a measurement, take requests of 60,000 input tokens, where 50,000 tokens are a repeated prefix already in the cache and 10,000 are new, with 2,000 output tokens. On Claude Opus 5.5 at GoiAPI prices:
- First request, writing the cache: (50,000 × $0.8775 + 10,000 × $0.442 + 2,000 × $2.21) ÷ 1,000,000 ≈ $0.0527
- Later requests, reading the cache: (50,000 × $0.0221 + 10,000 × $0.442 + 2,000 × $2.21) ÷ 1,000,000 ≈ $0.0099
- Without caching, every request: (60,000 × $0.442 + 2,000 × $2.21) ÷ 1,000,000 ≈ $0.0309
Over 100 such requests, caching costs about $1.04 ($0.0527 + 99 × $0.0099) against about $3.09 without it (100 × $0.0309). The same pattern on Claude Haiku 5.5 costs about $0.00055 per cached request. In practice the cache expires and only hits when the beginning of the prompt is identical, so real sessions will differ.

Does caching actually work through GoiAPI? On December 3, 2026 we sent the same Claude Haiku 5.5 request twice, two seconds apart, with a long system prompt marked "cache_control": {"type": "ephemeral"}. The first response reported the whole prompt under cache_creation_input_tokens; the second reported the same number under cache_read_input_tokens and nothing as a cache write, so the second call paid the cache-read rate.
Example 3: one Claude Code request (measured)
On December 3, 2026 we ran Claude Code non-interactively with ANTHROPIC_BASE_URL=https://api.goiapi.com and ANTHROPIC_MODEL=claude-haiku-5-5, asking a one-line arithmetic question. Claude Code reported 10,679 input tokens, 15,574 cache-write tokens and 3 output tokens, which comes to about $0.00092 at GoiAPI's Claude Haiku 5.5 prices.
That is over 26,000 tokens for a one-digit answer, because Claude Code sends its own instructions and tool definitions with every request. The same run also shows that Claude Code writes to the cache from its first request. A long working session depends heavily on how many requests it makes and how often the cache hits, so the most reliable number is your own: check the Request history page after a few sessions. For monthly estimates, see Claude Code Max vs API: which costs less per month.
How to count tokens before and after a request
Before you send: the count_tokens endpoint
GoiAPI supports token counting in the Anthropic Messages format:
POST https://api.goiapi.com/v1/messages/count_tokensThe body is the same as for /v1/messages, without max_tokens, and the response is {"input_tokens": N}. These calls are not charged (Anthropic Messages API docs, checked on December 5, 2026).
curl https://api.goiapi.com/v1/messages/count_tokens \
-H "x-api-key: sk-..." \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-haiku-5-5",
"messages": [{"role": "user", "content": "Paste the text you want to measure here"}]
}'The docs say that for some models the number is an estimate. For Claude models through GoiAPI, it can differ from the tokens you are actually billed, in either direction: in our English paragraph test it returned 217, while the real request was billed 329 input tokens including the fixed Claude block. Use count_tokens to check whether a prompt is too long, and confirm real costs from a few actual requests before you run a large batch.
After you send: the usage field and Request history
Every response includes a usage object with the token counts that were billed:
- Anthropic format (
/v1/messages):input_tokens,output_tokens,cache_creation_input_tokensandcache_read_input_tokens. - OpenAI format (
/v1/chat/completions):prompt_tokensandcompletion_tokens; reasoning tokens are part of the completion count. When you stream, GoiAPI always ends the stream with an extra chunk that containsusage(streaming docs).
In the dashboard, the Request history page shows each request as it happens, with the model, token counts, cost and response time.
How to keep AI API token costs under control
- Match the model to the job. Use Claude Haiku 5.5, GPT-6 Luna or DeepSeek V4.1 Flash for summaries, classification and short answers, and save Claude Opus 5.5 or GPT-6.1 Sol for hard problems.
- Set
max_tokensto what you need. Before each request, GoiAPI holds an estimated amount based on the input size andmax_tokens(or a default if you send none), then charges only the tokens actually used and releases the rest. A highmax_tokensdoes not cost more by itself, but when your balance is low the hold can be too large and the request fails with402and the message "Your balance is too low for this request (about ${amount} needs to be held). Please top up your balance." (limits and balance). - Leave room for reasoning. Set
max_tokenstoo low on a reasoning model and it can spend the whole budget thinking. In one of our December 3, 2026 tests, DeepSeek V4.1 Flash used all 400 allowed output tokens on reasoning and returned empty content, and the request was still billed for those tokens. - Trim conversation history. The whole history is billed again as input on every turn, so drop what the model no longer needs.
- Cache long, stable prefixes. Put fixed instructions and reference material at the start of the prompt so caching can reuse them.
- Cap spending per key. On the API Keys page you can set a daily and monthly spending limit for each key, and restrict which models and IP addresses it may use.
- Using Claude Code? Every request carries its system prompt and tool definitions, so how you run sessions matters; see how to reduce Claude Code token usage.
FAQ
How much does 1 million tokens cost?
It depends on the model and token type. On GoiAPI (checked on December 5, 2026), 1M input tokens cost $0.0208 to $0.442 and 1M output tokens cost $0.1105 to $2.21. A mix of 800,000 input and 200,000 output tokens costs about $0.04 on Claude Haiku 5.5 and about $0.80 on Claude Opus 5.5.
How many words is 1 million tokens?
Using OpenAI's English rule of thumb of about 0.75 words per token, 1 million tokens is roughly 750,000 English words. The real figure depends on the tokenizer: in our test, the same English paragraph used 144 tokens on GPT-6 Luna and 329 on Claude Haiku 5.5, including Claude's fixed block of roughly 125 tokens.
Why do output tokens cost more than input tokens?
The model reads all your input tokens together, but it generates output one token at a time, so each output token takes its own pass through the model. That extra work is the usual reason output is priced higher. On GoiAPI, output costs 3 to 6 times the input price depending on the model.
Do reasoning tokens cost money?
Yes. Reasoning, or thinking, tokens are billed as output tokens even when the API does not show you the reasoning text. They can make a short answer cost noticeably more than its visible length suggests.
Am I charged for failed requests?
On GoiAPI, a request that fails without returning any content is not charged, unless you cancel it yourself. If you disconnect after part of a response has arrived, you pay for the tokens used up to that point, subject to the minimum charge per request. Details are in the billing policy and the error codes docs.
Does a higher max_tokens cost more?
Not directly. You are billed for the tokens actually generated. max_tokens only sets the upper limit and the size of the temporary hold on your balance, which is released after the request finishes.
Is counting tokens charged?
No. On GoiAPI, POST /v1/messages/count_tokens and GET /v1/models are not charged.
What is the difference between a token and a request?
A request is one API call. A token is a unit of text inside that call. You are billed by tokens, and the number of tokens per request can range from a few dozen for a short question to tens of thousands for a coding agent.
Getting started with GoiAPI
- Create an account and open Top up in the dashboard. Pay with USDT (TRC20 or BEP20) or Binance Pay, from 5 to 4,000 USDT at a time; 1 USDT adds 1 USD to your balance once the payment is confirmed. There is no credit card and no monthly fee. Top-ups are final and non-refundable, so add only what you plan to use. Step by step: pay for the Claude API with USDT, no credit card.
- Create an API key on the API Keys page and copy it right away. Set a daily or monthly spending limit if you want a hard cap.
- Point your code or tool at GoiAPI:
https://api.goiapi.com/v1for OpenAI-format clients, orhttps://api.goiapi.com(without/v1) for Anthropic-format clients such as Claude Code. - Send a short request and check the Request history page to see exactly how many tokens it used and what it cost.
The quickstart guide has copy-ready commands for curl, the SDKs and Claude Code, and the pricing page lists every model's current rates.


