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
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 5s
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user