From a57e832c8dbae97a1b70c975766a2e1059be2762 Mon Sep 17 00:00:00 2001 From: daniel-lxs Date: Thu, 6 Nov 2025 16:53:59 -0500 Subject: [PATCH] fix: make OpenRouter base URL default consistent across codebase - Replace hardcoded 'https://openrouter.ai' fallback with derived domain from the same default base URL pattern used everywhere else - Extract domain from 'https://openrouter.ai/api/v1' for better consistency - Maintains backward compatibility and existing functionality - All tests still pass Fixes inconsistent OpenRouter base URL default in PR #8951 --- src/core/webview/ClineProvider.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index f73a36d445..13b14c930a 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -1449,9 +1449,11 @@ export class ClineProvider let apiKey: string try { - const baseUrl = apiConfiguration.openRouterBaseUrl || "https://openrouter.ai/api/v1" + const defaultBaseUrl = "https://openrouter.ai/api/v1" + const baseUrl = apiConfiguration.openRouterBaseUrl || defaultBaseUrl // Extract the base domain for the auth endpoint. - const baseUrlDomain = baseUrl.match(/^(https?:\/\/[^\/]+)/)?.[1] || "https://openrouter.ai" + const baseUrlDomain = + baseUrl.match(/^(https?:\/\/[^\/]+)/)?.[1] || defaultBaseUrl.match(/^(https?:\/\/[^\/]+)/)?.[1] const response = await axios.post(`${baseUrlDomain}/api/v1/auth/keys`, { code }) if (response.data && response.data.key) {