[Frontend] Exclude anthropic billing header to avoid prefix cache miss (#36829)

Signed-off-by: Nick Hill <nickhill123@gmail.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Nick Hill
2026-03-12 01:20:34 +00:00
committed by GitHub
co-authored by gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
parent c34ba6b961
commit 262b76a09f
3 changed files with 56 additions and 0 deletions
+4
View File
@@ -143,6 +143,10 @@ class AnthropicServingMessages(OpenAIServingChat):
system_prompt = ""
for block in anthropic_request.system:
if block.type == "text" and block.text:
# Strip Claude Code's attribution header which contains
# a per-request hash that defeats prefix caching.
if block.text.startswith("x-anthropic-billing-header"):
continue
system_prompt += block.text
openai_messages.append({"role": "system", "content": system_prompt})