Skip to content

Commit a57e832

Browse files
committed
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
1 parent 1ba0150 commit a57e832

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/core/webview/ClineProvider.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,9 +1449,11 @@ export class ClineProvider
14491449
let apiKey: string
14501450

14511451
try {
1452-
const baseUrl = apiConfiguration.openRouterBaseUrl || "https://openrouter.ai/api/v1"
1452+
const defaultBaseUrl = "https://openrouter.ai/api/v1"
1453+
const baseUrl = apiConfiguration.openRouterBaseUrl || defaultBaseUrl
14531454
// Extract the base domain for the auth endpoint.
1454-
const baseUrlDomain = baseUrl.match(/^(https?:\/\/[^\/]+)/)?.[1] || "https://openrouter.ai"
1455+
const baseUrlDomain =
1456+
baseUrl.match(/^(https?:\/\/[^\/]+)/)?.[1] || defaultBaseUrl.match(/^(https?:\/\/[^\/]+)/)?.[1]
14551457
const response = await axios.post(`${baseUrlDomain}/api/v1/auth/keys`, { code })
14561458

14571459
if (response.data && response.data.key) {

0 commit comments

Comments
 (0)