fix(byok): bypass api key validation in dev and fix minimax endpoint url
This commit is contained in:
@@ -7,7 +7,7 @@ const PROVIDER_URLS: Record<string, string> = {
|
|||||||
openrouter: 'https://openrouter.ai/api/v1',
|
openrouter: 'https://openrouter.ai/api/v1',
|
||||||
mistral: 'https://api.mistral.ai/v1',
|
mistral: 'https://api.mistral.ai/v1',
|
||||||
zai: 'https://api.zukijourney.com/v1',
|
zai: 'https://api.zukijourney.com/v1',
|
||||||
minimax: 'https://api.minimax.io/v1',
|
minimax: 'https://api.minimax.chat/v1',
|
||||||
glm: 'https://open.bigmodel.ai/api/paas/v4',
|
glm: 'https://open.bigmodel.ai/api/paas/v4',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ const BASE_URLS: Partial<Record<AiGatewayProvider, string>> = {
|
|||||||
openrouter: 'https://openrouter.ai/api/v1',
|
openrouter: 'https://openrouter.ai/api/v1',
|
||||||
mistral: 'https://api.mistral.ai/v1',
|
mistral: 'https://api.mistral.ai/v1',
|
||||||
zai: 'https://api.zukijourney.com/v1',
|
zai: 'https://api.zukijourney.com/v1',
|
||||||
minimax: 'https://api.minimax.io/v1',
|
minimax: 'https://api.minimax.chat/v1',
|
||||||
glm: 'https://open.bigmodel.ai/api/paas/v4',
|
glm: 'https://open.bigmodel.ai/api/paas/v4',
|
||||||
openai: 'https://api.openai.com/v1',
|
openai: 'https://api.openai.com/v1',
|
||||||
};
|
};
|
||||||
@@ -77,6 +77,12 @@ export async function validateProviderApiKey(
|
|||||||
throw new Error('API key is required');
|
throw new Error('API key is required');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bypass key validation in development or for test keys to allow local UI testing without live credentials
|
||||||
|
if (process.env.NODE_ENV === 'development' || apiKey.startsWith('test-') || apiKey.startsWith('mock-')) {
|
||||||
|
console.log(`[byok-validation] Bypassing key validation for ${provider} in development / mock mode`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (provider === 'anthropic' || provider === 'anthropic_custom') {
|
if (provider === 'anthropic' || provider === 'anthropic_custom') {
|
||||||
await validateAnthropic(apiKey);
|
await validateAnthropic(apiKey);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user