AlinsRan commented on PR #14028: URL: https://github.com/apache/apisix/pull/14028#issuecomment-6163655185
Thanks @membphis, good catch. Fixed in 03ccd3347. The cache-token lookups are now shared helpers in `openai-chat` (`cache_read_tokens()` / `cache_creation_tokens()`), used by both `parse_sse_event` / `extract_usage` and the Anthropic converter. Because the code is shared, the converted streaming path logs the same cache-creation value it sends to the client for every field the upstream may use: top-level `cache_creation_input_tokens`, and `prompt_tokens_details.cache_creation_tokens` / `cache_write_tokens` / `cache_creation_input_tokens`. The same applies to cache reads: the converter now also treats DeepSeek's `prompt_cache_hit_tokens` as cache reads, as the parser already did. Added `t/plugin/ai-proxy-anthropic.t` TEST 71-74 (converted streaming, one per field shape, checking both the client SSE and the access log) and TEST 75 (unit test of `extract_usage` / `parse_sse_event` across the shapes). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
