Add Vercel AI Gateway provider support (#1183)

This commit is contained in:
Ngô Tấn Tài
2026-05-17 15:16:25 +07:00
committed by GitHub
parent a168313290
commit 9326589452
7 changed files with 20 additions and 0 deletions

View File

@@ -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: {

View File

@@ -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",

View File

@@ -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",