Add optional ANTHROPIC_API_BASE_URL

This commit is contained in:
Thomas Mulder
2025-04-22 13:41:59 +02:00
parent ddf0947710
commit b1f3796ec7
6 changed files with 23 additions and 2 deletions

View File

@@ -35,9 +35,13 @@ export function getAnthropicClientForMCP(session, log = console) {
);
}
const baseURL =
session?.env?.ANTHROPIC_API_BASE_URL || process.env.ANTHROPIC_API_BASE_URL;
// Initialize and return a new Anthropic client
return new Anthropic({
apiKey,
baseURL: baseURL, // Will be undefined if not set, defaulting to Anthropic's standard URL
defaultHeaders: {
'anthropic-beta': 'output-128k-2025-02-19' // Include header for increased token limit
}