How can two 100-token answers differ by 3× in cost?

Suppose you extract an invoice number, due date, and total from two invoices. Each request sends 4,000 text tokens to GPT-5 mini. Each returns 100 tokens of JSON. In this worked example, the first request uses 400 reasoning tokens. The second uses 2,400.

At standard rates, GPT-5 mini costs $0.25 per million uncached input tokens and $2 per million output tokens. Both requests miss the cache and use no paid tools. The usage records are illustrative. Rates checked November 6, 2026. OpenAI API pricing.

Estimated token cost for one invoice extraction
What you pay forInvoice AInvoice B
Uncached input4,000 × $0.25 / 1M = $0.0014,000 × $0.25 / 1M = $0.001
Total output500 × $2 / 1M = $0.0012,500 × $2 / 1M = $0.005
Cost per request$0.002$0.006

The extra 2,000 reasoning tokens explain the entire $0.004 difference. Looking only at the returned JSON would hide it.

Which fields explain the difference in my API logs?

Open the usage object on each completed response. Compare output_tokens first. Then check how many of those tokens appear under output_tokens_details.reasoning_tokens.

Invoice A · $0.002

{
  "input_tokens": 4000,
  "input_tokens_details": {
    "cached_tokens": 0
  },
  "output_tokens": 500,
  "output_tokens_details": {
    "reasoning_tokens": 400
  },
  "total_tokens": 4500
}

Invoice B · $0.006

{
  "input_tokens": 4000,
  "input_tokens_details": {
    "cached_tokens": 0
  },
  "output_tokens": 2500,
  "output_tokens_details": {
    "reasoning_tokens": 2400
  },
  "total_tokens": 6500
}

Invoice B already includes all 2,400 reasoning tokens in its 2,500 output tokens. Charge for 2,500 once. The same idea applies to cached input. Its count is part of input_tokens. OpenAI’s guide to calculating per-run spend.

How do I calculate request cost when some input is cached?

Subtract cached tokens from total input. Price the remainder at the ordinary input rate. Price cache hits at the cached rate. Then add the output charge.

uncached = input_tokens - input_tokens_details.cached_tokens
token_cost_usd = (uncached × input_rate
                + cached_tokens × cached_rate
                + output_tokens × output_rate) / 1,000,000

For example, suppose 2,048 of Invoice A’s 4,000 input tokens hit the cache. GPT-5 mini’s cached rate is $0.025 per million. The input charge drops to $0.0005392. With the same 500 output tokens, the request costs $0.0015392. Use rates for your model and tier, including any separate cache-write or tool charges that apply. OpenAI rate tables.

Why does a later step in the same workflow cost more?

Check the input count on successive calls. If a step carries forward earlier messages or a long tool result, its input can grow even when the latest instruction is just “continue.” Compare uncached input across steps to see how much of that history gets the full input rate.

Then count responses per invoice. Three completed calls at $0.002 each also cost $0.006. That calls for a different fix. Inspect the validation failure or tool loop that triggered another call. Group unique response IDs under one invoice ID so you can separate a costly request from a task that needed several.

How do I bring down cost per successful extraction?

If reasoning drove the increase, test a lower supported reasoning effort on a set of invoices with known answers. If uncached input drove it, keep shared instructions at the start and put the invoice afterward. Check the next run for actual cache hits. OpenAI prompt caching guide.

Add up every attempt, including retries, and divide by the number of invoices that passed validation. Compare that figure alongside accuracy. A cheaper first call can still cost more per correct invoice if it needs a second pass. Compare OpenAI API rates · Compare model costs for a workflow.