OpenAI Token Billing: How It Works and How to Estimate Costs
- Every OpenAI API call bills input tokens (prompt) and output tokens (generated response) separately, with rates varying by model.
- Output tokens are 4 to 8 times more expensive than input tokens because generation is a computationally heavier sequential process.
- Automatic prompt caching for repeated tokens (system prompts, few-shot examples) can reduce the cost of previously sent input tokens by up to 90%.
- The Batch API offers a 50% discount on both input and output for tasks that do not require an instant response.
- Depending on the model, prices range from $0.10 to $30 per million input tokens, a gap that can increase a bill by 30x for the same request volume.
OpenAI’s token billing is based on a simple principle: each API request counts the number of tokens sent in the prompt (input tokens) and the number of tokens generated in the response (output tokens), then applies a rate per million tokens based on the model used. On average, one token corresponds to 4 characters or about three-quarters of a word. In practical terms, a request to GPT-5.4 mini with 500 input tokens and 300 output tokens costs a fraction of a cent; however, this unit cost scales quickly: 10,000 daily requests with the same profile amount to approximately $518 per month. Understanding these pricing mechanisms (input/output, caching, batching) is essential for budgeting a SaaS product before moving it into production.
What is a Token and How OpenAI Counts Them
Before discussing pricing, it is important to understand the billing unit itself. A token is neither a word nor a character: it is a fragment of text produced by the OpenAI tokenizer, which breaks text into units recognized by the model. A short, common word like “cat” often forms a single token, while a long or rare word may take two or three. Spaces, punctuation, and even word fragments count toward the total. In English, the rule of thumb is that one token equals roughly 4 characters, or about 3/4 of a word. In French, the presence of accents, complex conjugations, and compound words generally increases this ratio, meaning French text typically consumes 15% to 20% more tokens than its English equivalent for the same meaning.
This detail has a direct impact on billing: translating a system prompt into English before sending it to the API can reduce the number of billed input tokens without changing the functional content. The total amount billed for a request is always the sum of the prompt tokens (system, user, conversation history, tool definitions) and the tokens generated in the response. This sum, referred to as total_tokens in the usage objects returned by the API, serves as the basis for all cost calculations. Each model also has a maximum context window (the total number of tokens it can process at once, input + output), ranging from 128,000 tokens for older models to over one million for the GPT-4.1 and GPT-5.4 families.
Input vs. Output Tokens: Why the Price Differs
The price difference between input and output is not an arbitrary business decision; it directly reflects how inference works on OpenAI’s servers. When a request arrives, the model processes all prompt tokens in a single parallel pass called “prefill”: the GPU remains fully occupied, making the processing of each input token relatively cheap. Response generation, however, happens token-by-token sequentially (each new token depends on all previous ones), which utilizes the hardware much less efficiently and justifies a significantly higher rate.
This gap is clear in the pricing tiers: on GPT-5.4, input costs $2.50 per million tokens compared to $15.00 for output—a 1:6 ratio. A concrete example illustrates the impact on the overall bill: a coding agent processing 20,000 tasks, each consuming 3,000 input tokens and generating 4,000 output tokens, spends $150 on input (60 million tokens) and $1,200 on output (80 million tokens). Output thus represents 89% of the total $1,350 bill, despite making up only slightly more than half of the total token volume. For a SaaS product that generates long responses (reports, summaries, code), this is the most critical cost driver, far outweighing raw request volume.
OpenAI Model Pricing Grid (2026)
Rates vary significantly depending on the model, with a gap that can exceed a factor of 50 between the most economical and the most powerful models. Here are the 2026 benchmarks per million tokens:
| Model | Input | Cached Input | Output |
|---|---|---|---|
| GPT-5.5 | $5.00 | $0.50 | $30.00 |
| GPT-5.4 | $2.50 | $0.25 | $15.00 |
| GPT-5.4 mini | $0.75 | $0.075 | $4.50 |
| GPT-4.1 | $2.00 | $0.50 | $8.00 |
| GPT-4.1 mini | ~$0.40 | ~$0.10 | ~$1.60 |
| GPT-4.1 nano | $0.10 | $0.025 | $0.40 |
| o3 (Reasoning) | $2.00 | $0.50 | $8.00 |
| o3-Pro | $20.00 | $5.00 | $80.00 |
This dispersion highlights a key principle for SaaS products: model choice often has a greater impact on the bill than prompt optimization. Switching from a “standard” model to its “nano” or “mini” variant can divide input costs by 10 or 12, provided the task (classification, extraction, short summaries) does not require the reasoning capabilities of more advanced models. Reasoning models in the o3 family, designed for complex tasks (math, code, planning), use internal “thought” tokens before responding, which increases the billed output tokens even if the visible response remains short.
Prompt Caching: Reducing Costs Without Changing Code
Prompt caching is the easiest optimization lever to activate because it works automatically once certain conditions are met. When a request reuses a prefix identical to a recent previous request (typically the system prompt, few-shot examples, or the start of a long conversation), OpenAI detects this common portion and applies a reduced rate to those “cached tokens.” The discount is substantial: approximately a 90% reduction compared to the standard input rate, as seen in the gap between $5.00 and $0.50 per million tokens for GPT-5.5.
This mechanism particularly benefits applications that send a large system prompt with every call (agents with long instructions, tool definitions, fixed business context), as this static part of the prompt is billed at full price only once and then benefits from the reduced rate on subsequent calls, as long as the prefix remains identical. On Azure OpenAI, the display logic differs slightly: the Realtime API exposes detailed usage metrics (cached_tokens, input_token_details), but only the Azure portal metrics (processed_prompt_tokens, generated_completion_tokens) reflect the tokens actually billed, excluding those served from the cache. A best practice for technical teams is to structure prompts with the stable part (instructions, system context) first and the variable part (user query) last to maximize the cache hit rate between calls.
Tokens and Images: The Special Case of Vision
Multimodal models also bill images in tokens, using a logic different from text. An image sent to the API is broken down into 512×512 pixel tiles, with each tile consuming a fixed number of tokens (approximately 258 tokens per tile). A high-resolution image can generate up to 9 tiles, for a maximum cost of nearly 2,322 tokens, while a standard 2:3 image averages around 1,300 tokens. This calculation explains why some developers are surprised by vision usage bills: a “high” detail image analysis can represent tens of thousands of billed tokens for a single request, far beyond what one would intuitively expect from a simple image file.
For a SaaS product processing images in bulk (OCR, content moderation, visual data extraction), the choice of detail level (“low” vs. “high”) has a direct and significant impact on the bill. “Low” mode applies a reduced fixed cost regardless of resolution, while “high” mode bills proportionally to the number of tiles. Processing 1,000 images in low detail might cost a few cents on an economical model, versus several dollars in high detail on a premium model. Therefore, it is better to reserve “high” detail for cases where fine precision is truly necessary (reading small text, critical visual details) rather than applying it by default to all streams.
Batch API: A 50% Discount for Asynchronous Processing
For workloads that do not require an instantaneous response, OpenAI offers a Batch API that applies a 50% discount to both input and output tokens in exchange for a processing delay of up to 24 hours. The principle is simple: instead of sending requests one by one in real-time, the application groups a batch of requests into a file, submits it to the API, and retrieves the results once processing is complete.
This mode is particularly suited for common SaaS use cases: regenerating embeddings for an existing content base, bulk classification of support tickets, generating summaries for a document catalog, or periodically retraining recommendation models. For a team already processing large token volumes asynchronously (e.g., a nightly data processing job), switching to the Batch API effectively halves the corresponding bill without changing the business logic—only the technical orchestration of the call. The trade-off is the lack of latency guarantees: this choice is only relevant for flows that tolerate a delay, and never for end-user real-time features like a chatbot or interactive assistant.
Calculating Your Bill: Method and Concrete Example
The cost of a request follows a direct formula: (input tokens / 1,000,000 × input price) + (output tokens / 1,000,000 × output price), potentially adding the portion of cached tokens at the reduced rate. To anticipate a monthly bill, multiply this unit cost by the expected request volume.
Let’s take a representative B2B SaaS case: a team routes 10,000 daily support requests to GPT-5.4 mini, averaging 500 input tokens and 300 output tokens per request. Over a 30-day month, this represents 150 million input tokens and 90 million output tokens. At a rate of $0.75 per million for input, the input cost reaches $112.50; at $4.50 per million for output, the output cost reaches $405. The monthly total is approximately $518, an order of magnitude consistent with 2026 workload data for this type of task. Processing this same volume with the flagship GPT-5.5 model ($5.00/$30.00 per million) would multiply the bill by nearly a factor of 6, with no perceptible improvement for a standard support task. Performing this calculation before production prevents “bill shock” and ensures the most cost-effective model is chosen for each feature.
How to Lower Your Token Bill: Concrete Levers
Several actions can reduce token costs without degrading the product experience. The first and often most profitable lever is choosing the smallest model strictly necessary for the task: a classification or tagging feature generally doesn’t need a flagship model; a “mini” or “nano” model is sufficient and costs 10 to 50 times less. The second lever is structuring prompts to maximize cache rates by placing fixed instructions before variable content and avoiding unnecessary rewording of the system prompt.
The third lever is explicitly limiting the length of the generated response via the max_tokens parameter, as output is the heaviest cost item. The fourth lever, for asynchronous processing, is switching to the Batch API whenever latency is not critical. Finally, active monitoring via the OpenAI usage dashboard allows you to spot drift quickly: a system prompt that grows over time, a poorly managed retry loop, or a model that is overkill for a high-volume feature. For a startup, setting up budget alerts upon launching an AI feature remains the simplest protection against a bill that climbs faster than expected.
How much does 1 million tokens cost with GPT-5.5?
In 2026, GPT-5.5 bills approximately $5.00 per million standard input tokens, $0.50 for cached input, and $30.00 per million output tokens.
Why are output tokens more expensive than input tokens?
Input tokens are processed in a single parallel pass (prefill), which is fast and efficient on GPUs. Output tokens are generated one by one sequentially, which is more computationally expensive and is reflected in the price.
What is a token in practice?
A token is a fragment of text, not necessarily a whole word. In English, it averages 4 characters or 3/4 of a word per token; in French, this ratio is slightly higher due to accents and conjugations.
How does OpenAI token caching work?
Caching activates automatically when a request reuses a prefix identical to a recent previous call (e.g., system prompt, fixed context), applying a discount of about 90% to those tokens.
Is the Batch API suitable for all applications?
No, it is only suitable for tasks that can tolerate a delay of up to 24 hours, such as background jobs, in exchange for a 50% discount on input and output.
How can I track my token consumption in real-time?
The OpenAI usage dashboard and the usage fields returned by each API call allow you to track input, output, and cached tokens in detail and configure budget alerts.
Do images consume tokens like text?
Yes, each image is divided into tiles that consume approximately 258 tokens each, totaling over 2,000 tokens in high detail, or a reduced fixed cost in low detail.
Sources
- OpenAI API Pricing In 2026: Every Model Compared (CloudZero)
- OpenAI API Pricing (Updated 2026) – All Models & Token Costs (PricePerToken)
- OpenAI Pricing 2026: Plans, Spend Data, and How to Pay Less (SpendHound)
- Input vs Output Token Pricing: Why Output Costs More (Amnic)
- What are tokens and how to count them? (OpenAI Help Center)