Repository navigation
fix: accept vLLM created_cache_tokens in chat usage - #2994
Closed
berlineric wants to merge 1 commit into
Closed
berlineric wants to merge 1 commit into
berlineric wants to merge 1 commit into
Conversation
Signed-off-by: Erik Berlin <eberlin@habana.ai>
✅ Deploy Preview for theagentrouter canceled.
|
Author
|
Withdrawing this draft: the requesting deployment now needs only cached_tokens/cache-read accounting and does not need the proposed cache-creation alias support. |
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.
Description
OpenAI-compatible vLLM backends can report prompt cache writes as usage.prompt_tokens_details.created_cache_tokens. PromptTokensDetails currently accepts cache_write_tokens and cache_creation_input_tokens, so these cache writes are not captured in gateway accounting.
Accept created_cache_tokens through the existing CacheWriteTokensValue accessor. Preserve the existing greatest-value normalization across aliases without summing duplicate counts. Keep outgoing JSON normalized to the existing official/legacy fields.
The shared accessor is used by streaming and non-streaming chat completion translators. Add schema tests and translator tests for cold prompts, warm prompts, and overlapping aliases.
Validation
AI Assistance
GitHub Copilot assisted with implementation and regression tests.
Release Notes
Accept vLLM created_cache_tokens usage as cache-write accounting in OpenAI-compatible chat responses.