Back to guides

Token Basics

Input Tokens vs Output Tokens: What Counts and What Costs

Learn what counts as input and output tokens, how each affects AI API cost, how cached input works, and how to estimate one request from current model pricing.

Quick answer

Input tokens are a model's prompt and context, while output tokens are its response; GPT-6 Luna input is $0.10 per 1M tokens and output is $0.50 per 1M tokens. Across 74 current text models with published input and output prices, output tokens cost a median 5.0× the input price (range 1.0×–10.0×); output is more expensive for 96% of them, with prices verified Jul 7, 2026 to Nov 6, 2026.

ModelInput $/1MCached input $/1MOutput $/1MSourceLast verified How we verify
GPT-6 Sol$2.00$0.20$10.00Official sourceNov 5, 2026
Claude Sonnet 5.5$2.00$0.10$10.00Official sourceOct 9, 2026
Gemini 3.8 Flash$0.75$0.075$3.75Official sourceNov 4, 2026
GPT-6 Luna$0.10$0.01$0.50Official sourceNov 5, 2026

Prices from official provider pages, verified on the date shown.

11 min read - Published Jun 16, 2026 - Updated Nov 5, 2026

Input and output token comparison

QuestionInput tokensOutput tokens
What counts?User prompts, system prompts, conversation history, retrieved or RAG context, examples, tool definitions, and other request content.Generated answers, completion text, generated JSON, code, summaries, classifications, and other returned model content.
When charged?When request content is processed under the selected model's billing rules.When the model generates billable response content under the provider's rules.
Typical cost impactCan dominate long-context, RAG, document, and multi-turn requests.Can dominate verbose chat, report, code-generation, and long-form response workflows.
Ways to reduceRemove repeated context, summarize old history, retrieve fewer relevant chunks, and use caching when supported.Set appropriate length limits, request concise formats, avoid unnecessary prose, and stop runaway retries.

Neither side is automatically the largest cost. A document-review request can be input-heavy, while a short prompt that asks for a long report can be output-heavy. Measure the request shape that your product actually sends.

Use the Token Calculator to measure prompt size, then use the AI API Cost Calculator to combine input tokens, output tokens, model prices, request volume, and active users.

The cost rule

Request cost is the input-token cost plus the output-token cost. Do not multiply all tokens by one blended rate unless the provider explicitly bills that model that way.

How much more do output tokens cost?

Across 74 current text models with published input and output prices, output tokens cost a median 5.0× the input price (range 1.0×–10.0×); output is more expensive for 96% of them, with prices verified Jul 7, 2026 to Nov 6, 2026.

ModelInput $/1MOutput $/1MOutput / inputSource
GPT-6 Sol$2.00$10.005.0×Official source
Claude Sonnet 5.5$2.00$10.005.0×Official source
Gemini 3.8 Flash$0.75$3.755.0×Official source
DeepSeek V4.1 Flash$0.30$1.204.0×Official source
Grok 4.6$2.00$6.003.0×Official source
Mistral Small 4$0.15$0.604.0×Official source

Real request-cost example from current pricing data

The example below uses a current model from AICostBudget's source-linked pricing data and recalculates whenever that data is updated. The model name, input price, output price, cached-input price when available, and arithmetic come from the data, not from hand-typed numbers.

Current canonical pricing example: Anthropic Claude Fable 5

This example uses 1,000 input tokens and 300 output tokens. The current local pricing record lists $10.00 input and $50.00 output per 1M tokens, last verified Jul 3, 2026. How we verify

Cost partCalculationEstimated cost
Input1,000 / 1,000,000 x $10.00$0.01
Output300 / 1,000,000 x $50.00$0.015
Total requestInput cost + output cost$0.025

For comparison, if all 1,000 input tokens qualified for this model's listed cached-input rate of $1.00 per 1M tokens, that input portion would be $0.0010. Eligibility is provider-specific; this example does not assume every request qualifies.

Planning estimate only. Verify the current official provider pricing and use the billing dashboard or invoice as the final source of truth.

What counts as input tokens?

  • The current user prompt or message.
  • System and developer instructions included in the API request.
  • Earlier conversation turns that are sent again with the current request.
  • Retrieved documents, help-center passages, database results, or other RAG context.
  • Few-shot examples, tool definitions, schemas, and formatting instructions sent to the model.

A short visible user message can still create a large input bill when the application attaches a long system prompt, full conversation history, several retrieved documents, and tool schemas. Inspect the complete API payload, not only the text box the user sees.

How many tokens is an Excel or CSV file?

A model can't read an .xlsx file as it sits on disk. Before it sees anything, the cells get turned into text, either by your own code or by a provider's file feature. You pay input tokens for that text, not for the file size, so the format the rows end up in decides most of the bill.

To put numbers on it, we built a 1,000-row, 9-column order export (order ID, date, city, product, quantity, unit price, total, status, and a short note on some rows) and counted it with OpenAI's open o200k_base tokenizer. The data is synthetic, and Claude and Gemini use their own tokenizers, so treat the counts as a guide rather than an exact bill.

Same 1,000 rows sent asTokensTokens per rowCompared with CSV
CSV35,290351.00×
TSV (tab-separated)34,655350.98×
Markdown table40,316401.14×
JSON, minified62,162621.76×
JSON, pretty-printed92,289922.62×

CSV and TSV come out about the same. A Markdown table adds 14% for the pipes and spaces. JSON is the expensive choice because every row repeats every column name: minified JSON costs 1.76 times as much as CSV, and pretty-printed JSON 2.62 times as much, for exactly the same data.

The 4-characters-per-token rule undercounts spreadsheets

The CSV above averaged 2.4 characters per token, not 4. Dividing its 84,694 characters by 4 predicts 21,174 tokens; the tokenizer counted 35,290, about 1.7 times as many. Numbers are the reason: a column of prices averaged 1.8 characters per token, while plain English notes averaged 5.1. For a number-heavy sheet, multiply a characters ÷ 4 estimate by about 1.7.

Format shows up in the monthly bill too. Sending that export once a day for 30 days and asking for a 1,000-token summary each time costs about $2.42 on Claude Sonnet 5.5 as CSV and $5.84 as pretty-printed JSON, using the token counts above. To count your own file row by row, upload it to the CSV Token Counter. Its estimate counts digits at their own measured rate, so it does not need the 1.7× correction.

  • Send only the columns the task needs. IDs, timestamps, and internal codes are mostly digits, and digits are the most token-hungry text in the sheet.
  • Send CSV or TSV, not JSON, unless the model has to return structured records.
  • Aggregate before sending: a pivot table or a few summary rows often answers the question that 1,000 raw rows would.
  • For classification or extraction, send rows in batches and reuse one short instruction, instead of repeating the instructions on every row.

What counts as output tokens?

Output tokens are the response content generated by the model and returned under the provider's billing rules. This can include natural-language answers, summaries, code, classifications, or structured output such as JSON.

Provider treatment of internal or reasoning-related tokens can differ by model and API. Do not assume hidden-token behavior is identical across providers; verify the documentation and billing records for the exact model you use.

Why output tokens can matter more without always costing more

Many models list different input and output prices, and some list a higher output rate. That makes generated length an important cost lever, especially for reports, code, long explanations, and agent responses. It does not mean output is universally more expensive or that output always dominates the bill.

Compare the exact price structure for candidate models on the Model Pricing Comparison page. Keep the same token assumptions when comparing models so a cheaper-looking rate is not offset by longer responses, retries, or a different workflow.

How cached input changes the calculation

Some models in the canonical pricing data expose a cached-input price. Cached input represents eligible repeated request content billed at the provider's listed cached rate instead of the normal input rate. Stable system instructions, repeated document prefixes, or other reusable context may qualify, depending on the provider and model.

Request cost with eligible cached input =
(regular input tokens / 1,000,000 x regular input price)
+ (cached input tokens / 1,000,000 x cached input price)
+ (output tokens / 1,000,000 x output price)
Caching is provider-specific

A listed cached-input price does not guarantee that every repeated prompt qualifies. Check cache eligibility, retention, write/read rules, minimum token requirements, and final billing in the provider's official documentation.

How to reduce input and output token cost

  • Remove duplicated instructions and irrelevant retrieved context.
  • Summarize or window old conversation history instead of resending everything.
  • Measure representative prompts before changing production behavior.
  • Constrain output length when a concise answer satisfies the product requirement.
  • Use cached input only where the selected provider and model support it.
  • Compare input, cached-input, and output price structures before changing model routes.
  • Track retries and fallback calls because they can repeat both input and output cost.

First measure sample text in the Token Calculator, then calculate the full request and monthly usage in the AI API Cost Calculator. Token budgeting still matters even when an offer claims access is free; review the risks behind free or unlimited OpenAI API key claims before sending real product traffic.

FAQ

What is the difference between input and output tokens?

Input tokens are the prompt, instructions, history, retrieved context, and other content sent to a model. Output tokens are the content the model generates in its response. Providers can price the two token types differently.

Are output tokens more expensive than input tokens?

Usually, yes: most current text models list a higher rate for output tokens than for input tokens. Eligible cached input can be cheaper still when the provider lists a separate cached-input rate, but cache rules vary by model and workload.

Why are output tokens usually priced higher?

Providers set input and output rates separately on their official pricing pages and do not publish one shared reason for the gap, so this answer reports observed list prices rather than a cause. Across 74 current text models with published input and output prices, output tokens cost a median 5.0× the input price (range 1.0×–10.0×); output is more expensive for 96% of them, with prices verified Jul 7, 2026 to Nov 6, 2026. A model that lists equal input and output rates has no output premium. In practice, a response of a given length costs more than a prompt of the same length on most models, so budget output tokens separately and cap response length where the product allows it.

Compare input and output cost in the AI API Cost Calculator

Is a request token or a response token more expensive?

A request token is an input token, and a response token is an output token. Response tokens usually cost more; the exact comparison depends on the selected model.

What is the difference between input, output, and cached tokens?

Input tokens are ordinary request content, output tokens are generated response content, and cached tokens are eligible repeated input billed under provider-specific cache rules. For GPT-6 Luna, input is $0.10 per 1M tokens, cached input is $0.01 per 1M tokens, and output is $0.50 per 1M tokens.

Cached input in the AI API pricing glossary

How do I calculate the token cost of one AI request?

Multiply input tokens by the model's input price per token, multiply output tokens by its output price per token, then add the two amounts. Measure text first with the Token Calculator, then enter both token counts in the AI API Cost Calculator.

Open Token Calculator · Open AI API Cost Calculator

Do system prompts and conversation history count as input tokens?

Yes. System instructions, user messages, prior conversation turns, retrieved RAG context, examples, and tool definitions are normally part of the request sent to the model and therefore contribute to input token usage.

How many tokens is a CSV or Excel file?

It depends on the text the cells become, not the file size. In our test with OpenAI's o200k_base tokenizer, a 9-column order export came to about 35 tokens per row as CSV, or 35,290 tokens for 1,000 rows. The same rows took 62,162 tokens as minified JSON and 92,289 as pretty-printed JSON, because JSON repeats every column name on every row. Number-heavy sheets average about 2.4 characters per token, so a characters ÷ 4 estimate undercounts them by roughly 40%.

Count tokens per row in the CSV Token Counter

Test your API cost assumptions.

Use the AI API Cost Calculator with your model, token counts, request volume, and active users to calculate monthly AI model costs.

Open AI API Cost Calculator