Add Vercel AI Gateway provider support (#1183)
This commit is contained in:
@@ -239,6 +239,7 @@ const PROVIDER_MODELS_CONFIG = {
|
||||
chutes: createOpenAIModelsConfig("https://llm.chutes.ai/v1/models"),
|
||||
nvidia: createOpenAIModelsConfig("https://integrate.api.nvidia.com/v1/models"),
|
||||
assemblyai: createOpenAIModelsConfig("https://api.assemblyai.com/v1/models"),
|
||||
"vercel-ai-gateway": createOpenAIModelsConfig("https://ai-gateway.vercel.sh/v1/models"),
|
||||
|
||||
// Custom resolvers (non-OpenAI-shaped APIs / token-refresh flows)
|
||||
kiro: {
|
||||
|
||||
@@ -399,6 +399,10 @@ async function testApiKeyConnection(connection, effectiveProxy = null) {
|
||||
const res = await fetchWithConnectionProxy("https://api.openai.com/v1/models", { headers: { Authorization: `Bearer ${connection.apiKey}` } }, effectiveProxy);
|
||||
return { valid: res.ok, error: res.ok ? null : "Invalid API key" };
|
||||
}
|
||||
case "vercel-ai-gateway": {
|
||||
const res = await fetchWithConnectionProxy("https://ai-gateway.vercel.sh/v1/models", { headers: { Authorization: `Bearer ${connection.apiKey}` } }, effectiveProxy);
|
||||
return { valid: res.ok, error: res.ok ? null : "Invalid API key" };
|
||||
}
|
||||
case "anthropic": {
|
||||
const res = await fetchWithConnectionProxy("https://api.anthropic.com/v1/messages", {
|
||||
method: "POST",
|
||||
|
||||
@@ -251,6 +251,13 @@ export async function POST(request) {
|
||||
isValid = openaiRes.ok;
|
||||
break;
|
||||
|
||||
case "vercel-ai-gateway":
|
||||
const vercelAiGatewayRes = await fetch("https://ai-gateway.vercel.sh/v1/models", {
|
||||
headers: { "Authorization": `Bearer ${apiKey}` },
|
||||
});
|
||||
isValid = vercelAiGatewayRes.ok;
|
||||
break;
|
||||
|
||||
case "anthropic":
|
||||
const anthropicRes = await fetch("https://api.anthropic.com/v1/messages", {
|
||||
method: "POST",
|
||||
|
||||
Reference in New Issue
Block a user