Question about GPT-5.6 API cache read/write token billing
Hi,
I’m using the new GPT-5.6 API and I’m confused about how cache read/write tokens are reported and billed.
For one of my requests, the usage object looked like this:
{
"prompt_tokens": 4583,
"completion_tokens": 15,
"total_tokens": 4598,
"prompt_tokens_details": {
"cached_tokens": 3945,
"cache_write_tokens": 4580
}
}
My current understanding is:
prompt_tokens: total input tokens for this requestcompletion_tokens: output tokens generated by the modelcached_tokens: number of input tokens read from cachecache_write_tokens: number of tokens written to cache in this request
However, what confuses me is:
cached_tokens + cache_write_tokens = 3945 + 4580 = 8525
This is much larger than:
prompt_tokens = 4583
Intuitively, I would expect cached_tokens and cache_write_tokens to be subsets of the current request’s input tokens, so their sum should not exceed prompt_tokens. But in this API response, their sum is far greater than prompt_tokens.
So I’m not sure whether:
- This is expected behavior by design;
cached_tokensandcache_write_tokensare not mutually exclusive and can overlap;- The billing formula is not simply based on adding these two fields together;
- Or this is possibly a bug in the usage reporting.
I previously asked Codex / ChatGPT about this, and it suggested that the billing might be calculated like this:
prompt_tokens = total input tokens in this request
cached_tokens = tokens read from cache
cache_write_tokens = tokens written to cache in this request
completion_tokens = output tokens
Then the cost might be:
Cache read cost:
3945 × cached_input_price
Cache write cost:
4580 × cache_write_price
Regular uncached input cost:
3 × input_price
Output cost:
15 × output_price
If GPT-5.6 cache write pricing is 1.25× the normal input price, the formula would be:
3945 × cached_input_price
+ 4580 × input_price × 1.25
+ 3 × input_price
+ 15 × output_price
where:
3 = prompt_tokens - cache_write_tokens = 4583 - 4580
However, if this formula is correct, it seems that a large portion of the input tokens are being charged both as cached input tokens and as cache write tokens. This looks like the same tokens might be counted for both cache read and cache write billing, which feels like duplicate billing.
So I’d like to ask:
- Can
cached_tokensandcache_write_tokensoverlap? - Is it normal for
cached_tokens + cache_write_tokensto be greater thanprompt_tokens? - How exactly is cache read and cache write billing calculated for GPT-5.6?
- Is there any official documentation explaining the billing formula for these fields?
- If the formula above is not correct, what is the correct pricing formula?
What I’m mainly trying to understand is: for the usage example above, how should the actual cost be calculated?
If this is expected behavior, why does the billing appear to charge for both cache reads and cache writes on what looks like the same set of tokens?
If it is not expected behavior, could this be a bug in the usage reporting?
Thanks in advance for any clarification.