How are reasoning tokens, cached tokens, input tokens, and output tokens counted for billing?

Hi everyone,

I have a question about token usage and billing, especially for reasoning models.

My current understanding is:

  • The prompt I send to the model is counted as input tokens.

  • The model’s generated response is counted as output tokens.

  • Some models also support cached input tokens, where previously processed prompt content can be reused at a lower cost.

However, reasoning models add another layer: the model performs internal reasoning before producing the final answer. I would like to understand how these reasoning tokens are handled.

Specifically:

  1. Reasoning tokens

    • Are internal reasoning tokens counted as output tokens?

    • Are they billed separately from normal output tokens?

    • If the model uses thousands of reasoning tokens internally but returns a short answer, do users still pay for those reasoning tokens?

  2. Cached input tokens

    • When a prompt prefix or context is cached, how are those tokens counted?

    • Are cached input tokens billed differently from regular input tokens?

    • Does the cache only reduce input processing cost, or does it affect token limits as well?

  3. Output tokens and reasoning setup

    • If I configure a reasoning model with a specific reasoning effort or token budget, does that reserved reasoning capacity count toward my usage?

    • For example, if I set a high reasoning effort but the model only uses part of the available reasoning tokens, am I charged for the allocated amount or the actual usage?

Example scenario:

  • Input prompt: 500 tokens

  • Cached input: 2,000 tokens

  • Internal reasoning: 3,000 tokens

  • Final response: 300 tokens

How would this usage be categorized and billed?

I would appreciate clarification on the exact relationship between input tokens, cached input tokens, reasoning tokens, and output tokens.

Thanks!

Hi and welcome to the Community!

Cached input receives the cached-input price, while reasoning and visible answer tokens are both charged at the output-token price.

Reasoning tokens are counted as output tokens. Although the internal reasoning is not shown, it is included in output_tokens, itemized under output_tokens_details.reasoning_tokens, and billed at the model’s output-token rate. There is no separate reasoning-token price.

Therefore, if a model uses 3,000 reasoning tokens and returns a 300-token answer, approximately 3,300 output tokens are billed. The reported total can be slightly higher because output usage may include other non-visible generated tokens. See the official reasoning guide and token-counting guide.

Cached input tokens are part of the request’s total input tokens. The API reports the cached portion separately under input_tokens_details.cached_tokens. Cache hits are billed at the model’s discounted cached-input rate, but the tokens still occupy context-window space. Caching reduces input-processing cost and usually latency; it does not give the request a larger token limit. See the prompt-caching guide.

Reasoning effort and max_output_tokens control model behavior and establish an upper limit; they are not prepaid allocations. You are charged for the tokens actually used. The output limit includes reasoning tokens, visible answer tokens, and other generated tokens.

For the example:

  • Total input: 2,500 tokens
    • 500 regular input tokens
    • 2,000 cached input tokens
  • Total output: approximately 3,300 tokens
    • 3,000 reasoning tokens
    • 300 visible-answer tokens
  • Total usage: approximately 5,800 tokens

The billing calculation is:

500 × regular input rate
+ 2,000 × cached-input rate
+ 3,300 × output rate

Hope this helps!

Hey meharaz733, great question.

Thanks for adding that, VeitB.

I’d like to add a little more context around cache-write pricing.

For GPT-5.6 and later models, writing a prompt prefix into the cache is priced separately at 1.25× the standard uncached input rate and is reported as cache_write_tokens. Reading an existing cached prefix is reported as cached_tokens and is billed at the discounted cached-input rate.

Models before GPT-5.6 do not have an additional cache-write charge.

Therefore, for GPT-5.6 and newer models, if a request writes tokens into the cache, any reported cache_write_tokens should also be included in the billing calculation at the applicable cache-write rate.

Documentation

Avinash