DEV Community

Mac
Mac

Posted on AI-assisted

Understanding Token Pricing: One Full Request

The cost of one LLM request is the sum of each billable token group times its rate. Add tool, storage, gateway, retry, and review costs after that.

Do not use one headline token price for the whole request. Input, cached input, cache writes, output, and reasoning work can have different prices. Batch is a processing tier, not a token type. Provider names and rules also differ, so use the usage fields and price page for the model you run.

Input tokens

Input tokens are the text and other content sent to the model. This can include the system rule, user message, chat history, tool results, and documents.

A long system rule may be sent again on every call. That can make input cost grow before the user writes much.

Output tokens

Output tokens are created by the model. Many providers price output above input. A short prompt can still cost more when the answer is long.

Set an output limit that fits the task. A support label may need a few words. A code review may need more.

Cached input and cache writes

A prompt cache can reuse a stable prefix, such as a long system rule or shared document. A cache read may cost less than fresh input.

Some providers also charge when content is written to the cache. The first write and later reads are different events. Do not count a token as fresh input, a cache write, and a cache read unless the provider's usage record says each charge applies.

Reasoning tokens

Some models use hidden reasoning tokens before the visible answer. The provider may report them inside output usage or in a separate field. They do not have one universal price rule.

Check the model's usage object. If reasoning tokens are already included in billed output, do not add them again.

Batch pricing

Batch is a way to process work later instead of waiting for an immediate answer. It often has a separate price table and service limit. It is useful for jobs like nightly tagging or large test runs.

Batch is not a new token group. The provider still counts input and output under the batch rate. Check the current price, wait time, file limits, and error rules before using it.

A worked request

Here is a simple example using the OpenAI Standard price shown for gpt-6.1-sol on November 3, 2026:

  • 100,000 fresh input tokens at $1.00 per million = $0.10
  • 400,000 cached input tokens at $0.05 per million = $0.02
  • 50,000 output tokens at $5.00 per million = $0.25

Total for this reuse request: $0.37.

A separate first run may write 100,000 tokens to a 30-minute cache at $1.25 per million. That cache write would add $0.125 to that first run. Do not mix the first-write cost with a later cache-read cost unless your usage record shows both.

Pricing changes. Check the official OpenAI pricing page before using these numbers.

Use one formula

Use this worksheet for each model and tier:

Fresh input × fresh input rate
+ cached input × cache read rate
+ cache writes × cache write rate
+ billed output × output rate
+ tool, storage, search, and gateway fees
= provider and platform cost
Enter fullscreen mode Exit fullscreen mode

Then add retry cost and human review time. A cheap model call can still be costly when it fails twice or creates more work for a reviewer.

Compare models with a real request mix

Do not compare models with one price column. Use a week of real traffic. Split the volume into fresh input, cache reads, cache writes, output, batch work, and retries.

Then check the quality. A lower rate can lose money if it needs more retries, longer prompts, or more review.

Track cost in one place

A gateway can join usage across providers. Axiom's LLM Gateway shows token and cost views for prompts, cache writes, cache reads, and completions.

What to do next

Take one day of usage. Price it by token group, model, tier, retry, and team review time. Save the formula beside the provider price date. Recheck it when a model, tier, or cache rule changes.

Use the worksheet above, then explore Axiom's LLM Gateway if you need one view across providers.

Top comments (0)