[Frontend] Add cache_salt support to Anthropic Messages API (#49498)

Signed-off-by: aeon-x <talexcao@gmail.com>
This commit is contained in:
Cao Qian
2026-08-01 07:36:42 +00:00
committed by GitHub
parent 77469c9057
commit 81a42d37b1
3 changed files with 35 additions and 0 deletions
@@ -1385,3 +1385,26 @@ class TestMessagesFullConverter:
assert len(result.content) == 1
assert result.content[0].type == "text"
assert result.content[0].text == ""
# ======================================================================
# cache_salt pass-through (Issue #46688)
# ======================================================================
class TestCacheSalt:
def test_cache_salt_passed_through(self):
"""cache_salt on the Anthropic request reaches the converted
ChatCompletionRequest so prefix-cache isolation works via /v1/messages."""
request = _make_request(
[{"role": "user", "content": "Hello"}],
cache_salt="tenant-abc-secret-salt",
)
result = _convert(request)
assert result.cache_salt == "tenant-abc-secret-salt"
def test_cache_salt_defaults_to_none(self):
"""Omitting cache_salt leaves it unset (unchanged default behavior)."""
request = _make_request([{"role": "user", "content": "Hello"}])
result = _convert(request)
assert result.cache_salt is None