9router/open-sse/handlers/chatCore
omar-nahhas 41606a37a3 fix(usage): don't lose cached tokens in the forced-SSE->JSON path
handleForcedSSEToJson dropped cached prompt tokens in two ways: the
Responses branch summed only input_tokens, which excludes cache_read
and cache_creation on cache-capable upstreams (measured 2012 reported
vs ~5344 actual, 5332 from cache); and the Chat Completions branch
computed usage correctly but it didn't always reach the client (an
Anthropic response with cache_read_input_tokens: 11022 arrived with no
usage field at all). Now folds cache counters into prompt_tokens,
surfaces them via prompt_tokens_details, and re-attaches usage before
serialisation.
2026-08-05 10:45:55 +07:00
..
nonStreamingHandler.js refactor(log): unify request lifecycle logging with session-colored tags 2026-07-10 18:01:20 +07:00
requestDetail.js refactor(log): unify request lifecycle logging with session-colored tags 2026-07-10 18:01:20 +07:00
sseToJsonHandler.js fix(usage): don't lose cached tokens in the forced-SSE->JSON path 2026-08-05 10:45:55 +07:00
streamingHandler.js refactor(log): unify request lifecycle logging with session-colored tags 2026-07-10 18:01:20 +07:00