This commit is contained in:
Mario Zechner
2026-05-17 23:55:25 +02:00
parent 7f3c340dc6
commit b256ac7d77
2 changed files with 7 additions and 1 deletions

View File

@@ -863,6 +863,7 @@ function createClient(
sessionId && getAnthropicCompat(model).sendSessionAffinityHeaders ? { "x-session-affinity": sessionId } : {};
const client = new Anthropic({
apiKey,
authToken: null,
baseURL: model.baseUrl,
dangerouslyAllowBrowser: true,
defaultHeaders: mergeHeaders(

View File

@@ -74,7 +74,12 @@ export async function resolveApiKey(provider: string): Promise<string | undefine
}
}
const result = await getOAuthApiKey(provider as OAuthProvider, oauthCredentials);
let result: { newCredentials: OAuthCredentials; apiKey: string } | null = null;
try {
result = await getOAuthApiKey(provider as OAuthProvider, oauthCredentials);
} catch (e) {
console.log(JSON.stringify(e));
}
if (!result) return undefined;
// Save refreshed credentials back to auth.json