feat: anthropic cache support — preserve cache_control, forward anthropic-version header, report real usage tokens
- Add anthropicPassthrough flag to BackendConfig for native Anthropic backends - Preserve cache_control on content blocks and system prompt (keep structured) - Extract and forward anthropic-version header from client to backend - Report actual token usage from backend response (input_tokens, output_tokens) - Support native Anthropic passthrough (no translation) for compatible backends - Wire anthropic-version through all entry points: index.ts, router.ts, worker.ts
This commit is contained in:
+2
-1
@@ -478,7 +478,8 @@ export async function handleRequest(
|
||||
try {
|
||||
const body = await req.json();
|
||||
const sessionId = crypto.randomUUID();
|
||||
return handleAnthropicMessages(body, proxyPool!, sessionPool!, sessionId);
|
||||
const anthropicVersion = req.headers.get("anthropic-version") ?? undefined;
|
||||
return handleAnthropicMessages(body, proxyPool!, sessionPool!, sessionId, undefined, anthropicVersion);
|
||||
} catch {
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
|
||||
Reference in New Issue
Block a user