fix(sse): read Responses-style usage names in OpenAI to Claude streaming - #14205
Merged
diegosouzapw merged 4 commits intoSep 29, 2026
Merged
diegosouzapw merged 4 commits into
diegosouzapw merged 4 commits into
Conversation
trackUsageFromChunk only read prompt_tokens/completion_tokens, so upstreams reporting input_tokens/output_tokens left Claude clients with 0/0 usage. Fall back to the Responses names (and input_tokens_details) the way stream.ts and usageTracking.ts do. Refs diegosouzapw#14204
Owner
|
Nice catch — this brings the Claude-format streaming translator in line with what open-sse/utils/stream.ts already does for the same prompt_tokens/input_tokens ambiguity, so it's a consistency fix rather than a new pattern. The precedence test (OpenAI naming wins when both are present) is the right call for safety. Merging. One small item: please add a |
Contributor
Author
|
Added the changelog fragment. Thanks for merging. |
Moves the Chat/Responses usage-name fallback into firstNumber() and readUsageCounters() so trackUsageFromChunk stays under the complexity ratchet. Behavior unchanged; covered by the diegosouzapw#14204 tests.
diegosouzapw
merged commit Sep 29, 2026
844a342
into
diegosouzapw:release/v3.8.51
11 of 16 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The streaming translator only read prompt_tokens/completion_tokens, so upstreams reporting Responses-style input_tokens/output_tokens left Claude clients with zeroed usage. It now reads both namings like the rest of the pipeline.
Verified: 4 new tests fail before and pass after, neighbors green.
Fixes #14204