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