[Frontend] Add cache_salt support to Anthropic Messages API - #49498
Merged
DarkLight1337 merged 4 commits intoAug 1, 2026
Merged
Conversation
The OpenAI-compatible Chat/Completions APIs accept a `cache_salt` for explicit prefix-cache isolation in multi-user deployments, but the Anthropic Messages API did not expose it, forcing clients on the Anthropic schema to switch API formats to use it. Add `cache_salt` to `AnthropicMessagesRequest` and thread it through `_build_base_request` into the internal `ChatCompletionRequest` (which already owns the field and its `check_cache_salt_support` validator), mirroring the existing `kv_transfer_params` pass-through. Behavior is unchanged when the field is omitted. Fixes vllm-project#46688 Signed-off-by: aeon-x <talexcao@gmail.com>
aeon-x
requested review from
AndreasKaratzas,
DarkLight1337,
NickLucche,
aarnphm,
mgoin and
robertgshaw2-redhat
as code owners
July 23, 2026 00:57
Contributor
Author
|
Hey @DarkLight1337 @robertgshaw2-redhat @aarnphm @NickLucche @AndreasKaratzas @mgoin Can help take a look at this PR? Thanks a lot. |
Member
|
PR looks alright, but since I dont see any comments on the RFC, I will wait for @DarkLight1337 to give the go/no-go. |
Contributor
Author
Thanks a lot for your review! |
DarkLight1337
approved these changes
Aug 1, 2026
DarkLight1337
enabled auto-merge (squash)
August 1, 2026 04:33
This was referenced Aug 2, 2026
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.
Purpose
Closes #46688.
The OpenAI-compatible Chat Completions / Completions APIs accept a
cache_saltfor explicit prefix-cache isolation in multi-user deployments. The Anthropic
Messages API (
/v1/messages) did not expose it, so clients built on theAnthropic schema had to switch API formats just to get deterministic
prefix-cache isolation.
Change
cache_salt: str | NonetoAnthropicMessagesRequest, with the samedescription as the OpenAI chat field.
_build_base_requestinto the internalChatCompletionRequest, which already owns the field and itscheck_cache_salt_supportvalidator — so validation and engine behaviormatch the OpenAI routes exactly.
Only the Messages (generation) path is affected;
AnthropicCountTokensRequestis untouched (no generation, no prefix-cache isolation concern). Behavior is
unchanged when
cache_saltis omitted (defaults toNone).Test
tests/entrypoints/anthropic/test_anthropic_messages_conversion.py::TestCacheSalt:cache_salton the Anthropic request reaches the convertedChatCompletionRequest.None(unchanged default).Note: I was unable to run the suite locally (no CUDA/torch on my dev machine);
the files pass
py_compileand the change mirrors the existingkv_transfer_paramspass-through — relying on CI to execute the tests.