[Bugfix][Responses API] Complete cache-write token accounting (#60973)

Signed-off-by: Kay Yan <kay.yan@daocloud.io>
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Kay Yan
2026-10-10 09:08:36 +00:00
committed by GitHub
co-authored by Codex
parent a98247ab4d
commit c41b2639e2
4 changed files with 34 additions and 2 deletions
+1 -1
View File
@@ -881,7 +881,7 @@ class OpenAIServingResponses(GenerateBaseServing):
output_tokens=num_generated_tokens,
total_tokens=num_prompt_tokens + num_generated_tokens,
input_tokens_details=InputTokensDetails(
cache_write_tokens=getattr(context, "num_cache_creation_tokens", 0),
cache_write_tokens=context.num_cache_creation_tokens,
cached_tokens=num_cached_tokens,
input_tokens_per_turn=[
turn.input_tokens for turn in context.all_turn_metrics