Repository navigation
Conversation
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Closes #8719.
The native Anthropic Messages path observes the upstream model and processing tier, then drops those observations when building its buffered and streaming
OpenAIForwardResult. Usage records consequently lose the declared model and mismatch flag; channels configured to bill by a trusted response model also fall back to the sent model.Carry the existing observer's model, conflict flag and response tier into both result constructors, including partial-stream results. Reuse the current normalization, conflict handling and pricing rules.
Validation on Go 1.27.4 / macOS arm64:
main(530c5e3a): 10 of 14 targeted leaf cases fail; patched: 14/14 pass. Tests the realForwardAsAnthropic→RecordUsage→ usage repository boundary, matching/mismatched/missing models, conflicting declarations, EOF/read errors, client disconnect, unchanged response bytes and billing-source behavior.go test -p=2 -tags=unit ./internal/service -count=1: 18,775 pass / 10 conditional skips (test/subtest entries).go test -p=2 -tags=integration ./internal/service -count=1: 9,321 pass / 3 conditional skips (test/subtest entries).0 issues.Usage repository writes are captured in memory; no live provider, production database or user deployment was exercised. The shared Go toolchain upgrade remains tracked by #8670.
AI disclosure: implemented and tested autonomously by an AI agent, without human review.