The short answer: OpenAI API cost is determined by the model and the billable quantities in each request—not by whether you use Responses, Chat Completions, Realtime, Batch, or Assistants. Read the response usage object, split ordinary input, cached input, cache writes (when listed), output, and tool charges, then apply the live model rates, which are generally quoted per 1 million tokens. Rate limits are a separate capacity control measured in requests and tokens over time; they are not an additional price.
This guide shows how to read the pricing dimensions, calculate a bill, understand cached input, diagnose changes, and design around request and token limits without treating an example quota as a universal allowance.
As an Amazon Associate I earn from qualifying purchases.
What determines your OpenAI API bill?
For every API call, start with the selected model, service mode, modality, and region. The model’s current pricing entry defines which quantities are charged and at what rate. Most entries express token prices per 1 million tokens, so a quantity must be divided by 1,000,000 before multiplication.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11OpenAI’s documentation states that “Responses API, Chat Completions API, Realtime API, Batch API, and Assistants API are not priced separately.” In practice, the endpoint is an implementation choice; the model and the request’s billable inputs and outputs determine the token charge. A change from one endpoint to another can still alter the bill indirectly if it changes the prompt, response length, modality, tools, or service mode.
#1 Best Overall
The billable dimensions to look for
| Dimension | What it represents | How to treat it |
|---|---|---|
| Uncached input | Input tokens that do not qualify for the model’s cached-input rate | Multiply by the ordinary input rate in the live pricing table |
| Cached input | Previously matching context reused by the service | Multiply by the separate cached-input rate, normally lower than ordinary input |
| Cache writes | Cache-creation charges shown for models or modes that list them | Charge only when the usage and pricing entry explicitly include this dimension |
| Output | Tokens generated by the model | Multiply by the model’s output rate |
| Tool or modality usage | Web search, containers, file search, or other separately metered capabilities | Add the applicable tool charge and any token usage billed at the selected model’s rates |
Do not assume that a cheaper input rate makes a model cheaper overall. A request with short input and long output may be output-dominated, while a retrieval-heavy prompt may be input-dominated. Compare like with like: input against input, cached input against cached input, output against output, and any cache-write or tool line item against the same line item on another model.
What are tokens, and which ones are charged?
Tokens are the units reported for model input and output. The response usage object exposes input tokens, output tokens, total tokens, and cached-token details. “Total tokens” is useful for accounting and capacity planning, but it is not necessarily a single price category: you must separate the components before applying rates.
Input tokens
Input includes the material sent for the model to process: instructions, conversation history, user content, structured data, and—in supported modalities—content represented for the model. Long histories, repeated system instructions, and large retrieved documents can make input the largest part of a bill. If a request is retried with the same long context, each accepted request can create another charge unless your architecture prevents the duplicate call.
Output tokens
Output is the model-generated response. Setting a high output limit does not automatically charge you for the entire limit; usage reflects what the model actually generates. Nevertheless, a larger allowed response can increase worst-case spend and token-per-minute consumption, so production code should set a sensible ceiling and stop generation when the application has enough information.
Cached input and cache writes
Cached input is the portion of a request that OpenAI can reuse from a prior matching context. The pricing table gives cached input its own rate, normally below the ordinary input rate. Some entries also list a cache-write rate for creating reusable context. Cache writes are not universal; use the dimensions displayed for the exact model and service mode.
Rank #2
Cache eligibility is a matching problem, not a discount you can claim after sending any repeated text. Keep stable instructions and repeated prefixes byte-for-byte consistent where practical, and place changing user data after that stable section. Conversation truncation can invalidate the match: OpenAI’s Realtime documentation says, “Truncation will reduce the number of cached tokens on the next turn (busting the cache), since messages are dropped from the beginning of the context.” A conversation that appears similar to a developer can therefore have a lower cached-token count after automatic history management.
How to calculate the cost of one request
Use the following workflow for an invoice estimate, a per-feature budget, or a discrepancy investigation.
- Record request attributes. Save the model identifier, endpoint, service mode, modality, and region for each request. A model alias that later points to a different version can invalidate a historical comparison, so retain the identifier returned or configured at call time.
- Capture the usage object. Store input tokens, output tokens, total tokens, and cached-token details from the response. If a request fails before producing a response, record the error and any usage information the API returns rather than assuming it consumed nothing.
- Split the quantities. Keep separate counters for uncached input, cached input, cache writes when listed, output, and each tool or modality charge. Do not calculate by multiplying total tokens by one blended rate.
- Read the live pricing entry. Select the row for the exact model and note ordinary input, cached input, cache-write, and output rates. Check whether service mode, regional processing, latency or throughput tier, or modality changes the applicable rate.
- Convert units. If a rate is quoted per 1 million tokens, divide that token quantity by 1,000,000, then multiply by the displayed rate. Add all dimensions and tool charges.
- Reconcile. Compare your estimate with the provider usage dashboard for the same period. Investigate differences in prompt length, cache-hit rate, model selection, retries, output length, and tool calls before changing your accounting formula.
Formula
request cost = (uncached input tokens ÷ 1,000,000 × input rate) + (cached input tokens ÷ 1,000,000 × cached-input rate) + (cache-write tokens ÷ 1,000,000 × cache-write rate, when listed) + (output tokens ÷ 1,000,000 × output rate) + tool and modality charges
For a useful daily estimate, sum each category across requests rather than averaging per-request totals. This preserves the effect of a few very large prompts and makes cache performance visible.
Illustrative calculation without assuming a current price
Suppose a response reports 240,000 uncached input tokens, 760,000 cached input tokens, and 80,000 output tokens. With rates represented as I (input), C (cached input), and O (output), the estimate is 0.24 × I + 0.76 × C + 0.08 × O, plus any listed cache-write or tool charges. Replace the symbols with the rates shown for your model on the date of use; this example is a method, not a published price.
Why cached input can lower cost—and why the saving changes
Cached input is most useful when many requests share a long, stable prefix: policy instructions, a fixed schema, a tool definition set, or a reference corpus that remains unchanged. Each request can then contain a smaller uncached suffix, while the matching prefix is billed at the cached-input rate.
Recommended Free Tools
Designing for cache reuse
- Keep stable system and developer instructions identical instead of regenerating equivalent text with different spacing or ordering.
- Put volatile values—user messages, timestamps, random IDs, and per-request retrieval results—after the stable prefix.
- Use a consistent tool-definition order and schema formatting.
- Track cached and uncached token counts separately so a cache improvement is visible in cost data.
- Set conversation-history policies deliberately. Trimming from the beginning can remove the very prefix that previously matched.
What can reduce the hit rate
Changing a model, region, modality, service mode, or early part of the context can prevent a match. Automatic truncation is especially important in long-running conversations: when messages are dropped from the beginning, the next turn can lose cached tokens. A lower cache count is therefore not proof that the cache service failed; it may reflect a changed context.
Tools and modalities add charges beyond ordinary text
The pricing page lists separate charges for capabilities such as web search, containers, and file search. Built-in tool tokens are billed at the chosen model’s per-token rates, while the tool itself can have an additional usage charge. Treat these as two questions: how many model tokens did the tool interaction add, and does the tool have its own meter?
Before enabling a tool in production, identify its unit of charge, whether calls are made once or repeatedly during a response, and whether failed or retried calls are billed. Keep tool-call counts in your application logs beside token usage. A prompt that appears unchanged can cost more if the model starts making additional searches, container operations, or file queries.
Rate limits are capacity controls, not prices
Rate limits determine how quickly an organization or project may send work. They do not add a fee to each token. A request can be inexpensive yet rejected because it exceeds a requests-per-minute or tokens-per-minute allowance; conversely, a request can fit the quota and still be costly because it contains a large uncached context.
Free tools Windows power users keep installed
One-click scans. No signup required.
The axes that matter
| Axis | Why it matters |
|---|---|
| Requests per minute | Caps call frequency, including bursts of small requests. |
| Tokens per minute | Caps the amount of input and output capacity consumed, so a few large calls can exhaust it. |
| Model and endpoint | Different models or endpoint families may have separate limits. |
| Organization or project tier | Account configuration can determine available capacity and upgrade paths. |
| Service mode | Priority, batch, realtime, or other modes can have distinct constraints or processing behavior. |
| Region | Regional-processing requirements or availability can affect which limits and modes apply. |
OpenAI’s API reference describes limit metadata with named request and token limits plus remaining and reset_seconds values. Its documented example shows a 1,000-request limit and a 50,000-token limit resetting in 60 seconds. Those figures are an example payload, not a universal quota for every account, model, or endpoint.
Handling a rejected request
- Read the error and returned limit metadata, including which request or token dimension was exhausted.
- Honor the supplied reset timing instead of using a fixed assumption that every limit resets on the same schedule.
- Apply exponential backoff with jitter so concurrent workers do not retry in a synchronized burst.
- Reduce concurrency or queue work when tokens per minute, rather than requests per minute, is the bottleneck.
- Use idempotency and deduplication where a retry could otherwise repeat an expensive operation.
- Review model, endpoint, project, service-mode, and regional settings before requesting a quota change.
Comparing models without misleading yourself
A meaningful comparison uses the same workload and records all relevant dimensions. Use this checklist when evaluating alternatives:
- Ordinary input rate per 1 million tokens.
- Cached-input rate and any cache-write rate.
- Output rate per 1 million tokens.
- Context length available to the request.
- Supported modalities and the way each modality is metered.
- Service-mode pricing and throughput or latency tier.
- Any regional-processing uplift or restriction.
- Requests-per-minute and tokens-per-minute capacity for your organization or project.
Do not compare one model’s input price with another model’s output price, and do not present the example 1,000-request/50,000-token payload as a guaranteed quota. Measure a representative mix of short and long prompts, cache hits and misses, output lengths, and tool calls.
Why an API bill changes unexpectedly
The prompt became longer
Conversation history, retrieved documents, tool definitions, or serialized data may have expanded. Log input-token counts and compare the distribution—not only the average—with the previous period.
The cache-hit rate fell
A changed prefix, reordered instructions, model or mode change, or context truncation can move tokens from the cached-input category to ordinary input. Inspect cached-token details in the usage object.
Best Value
Output grew
A prompt change, model change, or higher response limit can produce longer answers. Track output tokens independently from input.
A tool was introduced or called more often
Web search, containers, file search, and other built-in tools can add their own charges and model-token usage. Compare tool-call counts and tool-related line items.
Retries multiplied usage
Timeout handling, client retries, and worker duplication can send the same request more than once. Assign a request ID, record attempts, and reconcile accepted responses with application events.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →The model, service mode, or region changed
Pricing and limits are attached to the configuration in use. Preserve those attributes in logs so a deployment change is visible when you compare invoices.
A production monitoring checklist
- Log model, endpoint, service mode, modality, region, request ID, and retry attempt.
- Store input, cached-input, cache-write (when present), output, total, and tool usage separately.
- Calculate estimated cost from the live rate card and retain the rate version or retrieval date used for the estimate.
- Alert on sudden changes in uncached input, output length, cache-hit percentage, tool-call count, or retry count.
- Record rate-limit metadata, remaining capacity, and reset timing when available.
- Set budgets for both money and throughput; a request can pass one limit while failing the other.
With these records, a pricing change, a prompt regression, a cache miss, and a capacity rejection become distinct operational events instead of one unexplained increase in the monthly total.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

