feat(claude-code): spoof TLS fingerprint and stabilize headers for Anthropic

- Add claudeHeaderCache.js to intercept and cache live Claude Code client headers
- Forward cached headers dynamically to api.anthropic.com via default.js
- Strip first-party identity headers (x-app, claude-code-* beta) for non-Anthropic upstreams
- Validate and sanitize tool call IDs to match Anthropic pattern (^[a-zA-Z0-9_-]+$)
- Skip thinking blocks when applying cache_control; fix max_tokens buffer (+1024)
- Strip cache_control from thinking blocks in openai-to-claude translator
- Comment out thoughtSignature in Gemini translator (kept for reference)
- Expand .gitignore to match all deploy*.sh variants

Co-authored-by: kwanLeeFrmVi <quanle96@outlook.com>
Closes #433

Made-with: Cursor
This commit is contained in:
kwanLeeFrmVi
2026-03-30 16:27:28 +07:00
committed by decolua
parent 83354889cf
commit 1c160cc8d9
11 changed files with 667 additions and 68 deletions
+3 -3
View File
@@ -85,11 +85,11 @@ function getEnvProxyUrl(targetUrl) {
if (protocol === "https:") {
return process.env.HTTPS_PROXY || process.env.https_proxy ||
process.env.ALL_PROXY || process.env.all_proxy;
process.env.ALL_PROXY || process.env.all_proxy;
}
return process.env.HTTP_PROXY || process.env.http_proxy ||
process.env.ALL_PROXY || process.env.all_proxy;
process.env.ALL_PROXY || process.env.all_proxy;
}
/**
@@ -100,7 +100,7 @@ function normalizeProxyUrl(proxyUrl) {
if (!normalizedInput) return null;
try {
// eslint-disable-next-line no-new
new URL(normalizedInput);
return normalizedInput;
} catch {