fix: openrouter provider fallback to CUSTOM_OPENAI_API_KEY when OPENROUTER_API_KEY missing
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 5s

This commit is contained in:
Antigravity
2026-05-12 09:30:08 +00:00
parent 4c1359ee39
commit 41596c2035
2 changed files with 43 additions and 1 deletions

View File

@@ -117,7 +117,7 @@ function createDeepSeekProvider(config: Record<string, string>, modelName: strin
}
function createOpenRouterProvider(config: Record<string, string>, modelName: string, embeddingModelName: string): CustomOpenAIProvider {
const apiKey = config?.OPENROUTER_API_KEY || process.env.OPENROUTER_API_KEY || '';
const apiKey = config?.OPENROUTER_API_KEY || process.env.OPENROUTER_API_KEY || config?.CUSTOM_OPENAI_API_KEY || process.env.CUSTOM_OPENAI_API_KEY || '';
if (!apiKey) throw new Error('OPENROUTER_API_KEY is required when using OpenRouter provider');
const defaults = PROVIDER_DEFAULTS.openrouter;
return new CustomOpenAIProvider(apiKey, defaults.baseUrl, modelName || defaults.model, embeddingModelName || defaults.embeddingModel);