File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -330,9 +330,14 @@ export class AIService extends EventEmitter {
330330 configWithApiKey = { ...providerConfig , apiKey : process . env . ANTHROPIC_AUTH_TOKEN } ;
331331 }
332332
333- // Normalize base URL to ensure /v1 suffix (SDK expects it)
334- const normalizedConfig = configWithApiKey . baseURL
335- ? { ...configWithApiKey , baseURL : normalizeAnthropicBaseURL ( configWithApiKey . baseURL ) }
333+ // Normalize base URL to ensure /v1 suffix (SDK expects it).
334+ // Check config first, then fall back to ANTHROPIC_BASE_URL env var.
335+ // We must explicitly pass baseURL to ensure /v1 normalization happens
336+ // (SDK reads env var but doesn't normalize it).
337+ const baseURLFromEnv = process . env . ANTHROPIC_BASE_URL ?. trim ( ) ;
338+ const effectiveBaseURL = configWithApiKey . baseURL ?? baseURLFromEnv ;
339+ const normalizedConfig = effectiveBaseURL
340+ ? { ...configWithApiKey , baseURL : normalizeAnthropicBaseURL ( effectiveBaseURL ) }
336341 : configWithApiKey ;
337342
338343 // Add 1M context beta header if requested
You can’t perform that action at this time.
0 commit comments