-
Notifications
You must be signed in to change notification settings - Fork 320
fix: double counting for the usage in stream mode for anthropic models #2239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
dddeebd
update the usage-report
hustxiayang 8c758f4
docs: update compatibility matrix EG -> V1.8.1 (#2215)
aabchoo 8073ccd
fix: set SchemeHeaderTransformation.MatchUpstream on AI Gateway liste…
kanurag94 699c72c
fix: ensure that plaintext API key secret ref is not exposed in MCP b…
aishwaryaraimule21 91499c8
chore(deps): bump the go group across 1 directory with 8 updates (#2200)
dependabot[bot] 7f630d3
fix: status of routes when Gateway is not found (#2180)
Hritik003 c304288
fix: promote role:system messages from messages array to system param…
Killusions 5d691db
translator: handle numeric OpenAI `error.code` in Anthropic→OpenAI er…
Copilot c5b3f0d
site: fix vars for 0.7 and main (#2217)
nacx 855df94
feat: add completion tokens details for anthropic models (#2199)
hustxiayang 48f759f
chore(deps): bump the go group across 1 directory with 12 updates (#2…
dependabot[bot] 8fc95ea
chore(deps): bump docker/setup-qemu-action from 4.0.0 to 4.1.0 in the…
dependabot[bot] 2857986
docs(site): adds Stacklok to Adopters Page (#2224)
ChrisJBurns 7c254d4
fix: use camelCase JSON tags for GCP Vertex AI request fields (#2225)
ChrisJBurns 54e73be
fix: prevent empty namespace from breaking RBAC name rendering in hel…
ChrisJBurns 8e4b6d8
fix: skip empty-content assistant messages in Bedrock translator (#2191)
Killusions 3326c0a
extproc: skip CONTINUE_AND_REPLACE when no body change is needed (#2170)
ChrisJBurns 0e03257
fix: insert AI Gateway extproc after the buffer filter (#2227)
ChrisJBurns a200229
fix: allow strict function definition in anthropic (#2232)
hustxiayang 8f98b4b
docs: update release information to v0.7 (#2233)
mathetake d34a29d
Merge commit from fork
nacx fbdde20
mcp: limit request body size by default (#2238)
nacx 9719b8f
cached-tokens
hustxiayang e0ae47e
fix-gemini-review-comment
hustxiayang fc79240
Merge branch 'main' into fix-usage-report
hustxiayang 7a7e107
update-tests
hustxiayang a02e6d7
fix-the-tests
hustxiayang bbdb144
update-tests
hustxiayang 224ea22
Update internal/translator/anthropic_helper.go
hustxiayang da8daf9
update-comments
hustxiayang d0d9441
Merge branch 'main' into fix-usage-report
hustxiayang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed this PR when I was working on #2241.
After discussing offline with @hustxiayang and @yuzisun, we agreed to remove the extra cache token counting from message_start and instead rely on message_delta, which is the provider's final source of truth in streaming mode.
This keeps the logic cleaner and avoids edge cases like the one here: https://github.com/envoyproxy/ai-gateway/pull/2241/changes#diff-aa8ea9f59fc3acd18cfd4a4c571d683817274a213b6a5fad0ab6085cfe0912dfL974-L980.