From e0129b7a8316b6e2be23d3894a94c007edbf0b36 Mon Sep 17 00:00:00 2001 From: 1e0n Date: Thu, 9 Oct 2025 15:21:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3Anthropic=E7=AB=AF=E7=82=B9?= =?UTF-8?q?=E6=8E=88=E6=9D=83=E8=BD=AC=E5=8F=91=E9=80=BB=E8=BE=91=EF=BC=9A?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E4=BD=BF=E7=94=A8authorization=20header?= =?UTF-8?q?=E8=BD=AC=E5=8F=91=E5=88=B0=E4=B8=8A=E6=B8=B8=E7=AB=AF=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- transformers/request-anthropic.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/transformers/request-anthropic.js b/transformers/request-anthropic.js index 0c88377..50b9844 100644 --- a/transformers/request-anthropic.js +++ b/transformers/request-anthropic.js @@ -163,6 +163,7 @@ export function getAnthropicHeaders(authHeader, clientHeaders = {}, isStreaming 'accept': 'application/json', 'content-type': 'application/json', 'anthropic-version': clientHeaders['anthropic-version'] || '2023-06-01', + 'authorization': authHeader || '', 'x-api-provider': 'anthropic', 'x-factory-client': 'cli', 'x-session-id': sessionId, @@ -170,14 +171,6 @@ export function getAnthropicHeaders(authHeader, clientHeaders = {}, isStreaming 'user-agent': getUserAgent(), 'x-stainless-timeout': '600', 'connection': 'keep-alive' - }; - - // Prefer client-provided x-api-key for anthropic endpoint format - if (clientHeaders['x-api-key']) { - headers['x-api-key'] = clientHeaders['x-api-key']; - } else if (authHeader) { - // If no client x-api-key, use authorization header (from FACTORY_API_KEY or refresh token) - headers['authorization'] = authHeader; } // Handle anthropic-beta header based on reasoning configuration