Repository navigation
Conversation
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
WalkthroughAdds ChangesVertex Anthropic token usage
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
steebchen
added this pull request to the merge queue
Jul 27, 2026
steebchen
added a commit
that referenced
this pull request
Jul 27, 2026
#3264 taught extract-token-usage about vertex-anthropic; azure-anthropic streams the same Anthropic Messages wire format and was still falling through to the OpenAI-shaped default branch, losing cache and reasoning token accounting. Co-Authored-By: Claude <noreply@anthropic.com>
This was referenced Aug 5, 2026
steebchen
added a commit
that referenced
this pull request
Aug 22, 2026
#3264 taught extract-token-usage about vertex-anthropic; azure-anthropic streams the same Anthropic Messages wire format and was still falling through to the OpenAI-shaped default branch, losing cache and reasoning token accounting. Co-Authored-By: Claude <noreply@anthropic.com>
steebchen
added a commit
that referenced
this pull request
Aug 24, 2026
#3264 taught extract-token-usage about vertex-anthropic; azure-anthropic streams the same Anthropic Messages wire format and was still falling through to the OpenAI-shaped default branch, losing cache and reasoning token accounting. Co-Authored-By: Claude <noreply@anthropic.com>
steebchen
added a commit
that referenced
this pull request
Aug 24, 2026
#3264 taught extract-token-usage about vertex-anthropic; azure-anthropic streams the same Anthropic Messages wire format and was still falling through to the OpenAI-shaped default branch, losing cache and reasoning token accounting. Co-Authored-By: Claude <noreply@anthropic.com>
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.
Streaming usage for
vertex-anthropicwas silently coming back empty.extractTokenUsageswitches on the provider, and the Anthropic block iscase "anthropic":only — sovertex-anthropicfell through to the OpenAI-shaped default, which readsdata.usage.prompt_tokens/completion_tokens. Vertex Anthropic streams the Anthropic Messages wire format (message.usage.input_tokens,output_tokens, cache and thinking fields), so the default branch found nothing and returned all-null usage.The effect is real cost drift: with usage null the streaming path falls back to
estimateTokens, andcachedTokens,cacheCreationTokensand reasoning/thinking tokens are dropped entirely, so the cache-read discount never applies. The directanthropicprovider bills the same chunk correctly;vertex-anthropicdid not.Every sibling handler already groups the two the same way —
map-finish-reason-to-openai,extract-tool-calls,extract-reasoning, the finish-reason switch inchat.ts, and the non-streamingparse-provider-response— so this was just a missing case label on the streaming usage extractor. Added it, and added a spec that assertsvertex-anthropicextracts the streamingmessage_startshape and matchesanthropicfor an identical chunk.Summary by CodeRabbit