feat: add Vercel AI Gateway as a provider

Adds 'vercel' as a recognized provider throughout the model resolution
system, enabling users with Vercel AI Gateway to use it as a universal
fallback for OpenAI, Anthropic, and Google models.

The gateway transform infers the sub-provider from canonical model names
(claude->anthropic, gpt->openai, gemini->google) and delegates to the
appropriate provider-specific transform, producing model strings like
vercel/anthropic/claude-opus-4.6.
This commit is contained in:
Matan Kushner
2026-04-13 11:22:22 +09:00
parent 42df1c3cbb
commit dac0c99e8c
10 changed files with 116 additions and 58 deletions
+11 -11
View File
@@ -35,7 +35,7 @@ describe("AGENT_MODEL_REQUIREMENTS", () => {
expect(sisyphus.requiresAnyModel).toBe(true)
const primary = sisyphus.fallbackChain[0]
expect(primary.providers).toEqual(["anthropic", "github-copilot", "opencode"])
expect(primary.providers).toEqual(["anthropic", "github-copilot", "opencode", "vercel"])
expect(primary.model).toBe("claude-opus-4-6")
expect(primary.variant).toBe("max")
@@ -132,7 +132,7 @@ describe("AGENT_MODEL_REQUIREMENTS", () => {
expect(multimodalLooker.fallbackChain).toHaveLength(4)
const primary = multimodalLooker.fallbackChain[0]
expect(primary.providers).toEqual(["openai", "opencode"])
expect(primary.providers).toEqual(["openai", "opencode", "vercel"])
expect(primary.model).toBe("gpt-5.4")
expect(primary.variant).toBe("medium")
@@ -144,7 +144,7 @@ describe("AGENT_MODEL_REQUIREMENTS", () => {
expect(tertiary.model).toBe("glm-4.6v")
const last = multimodalLooker.fallbackChain[3]
expect(last.providers).toEqual(["openai", "github-copilot", "opencode"])
expect(last.providers).toEqual(["openai", "github-copilot", "opencode", "vercel"])
expect(last.model).toBe("gpt-5-nano")
})
@@ -160,7 +160,7 @@ describe("AGENT_MODEL_REQUIREMENTS", () => {
const primary = prometheus.fallbackChain[0]
expect(primary.model).toBe("claude-opus-4-6")
expect(primary.providers).toEqual(["anthropic", "github-copilot", "opencode"])
expect(primary.providers).toEqual(["anthropic", "github-copilot", "opencode", "vercel"])
expect(primary.variant).toBe("max")
})
@@ -176,12 +176,12 @@ describe("AGENT_MODEL_REQUIREMENTS", () => {
const primary = metis.fallbackChain[0]
expect(primary.model).toBe("claude-opus-4-6")
expect(primary.providers).toEqual(["anthropic", "github-copilot", "opencode"])
expect(primary.providers).toEqual(["anthropic", "github-copilot", "opencode", "vercel"])
expect(primary.variant).toBe("max")
const openAiFallback = metis.fallbackChain.find((entry) => entry.providers.includes("openai"))
expect(openAiFallback).toEqual({
providers: ["openai", "github-copilot", "opencode"],
providers: ["openai", "github-copilot", "opencode", "vercel"],
model: "gpt-5.4",
variant: "high",
})
@@ -223,7 +223,7 @@ describe("AGENT_MODEL_REQUIREMENTS", () => {
const tertiary = atlas.fallbackChain[2]
expect(tertiary).toEqual({
providers: ["openai", "github-copilot", "opencode"],
providers: ["openai", "github-copilot", "opencode", "vercel"],
model: "gpt-5.4",
variant: "medium",
})
@@ -245,7 +245,7 @@ describe("AGENT_MODEL_REQUIREMENTS", () => {
// then
expect(openAiFallback).toEqual({
providers: ["openai", "github-copilot", "opencode"],
providers: ["openai", "github-copilot", "opencode", "vercel"],
model: "gpt-5.4",
variant: "medium",
})
@@ -261,7 +261,7 @@ describe("AGENT_MODEL_REQUIREMENTS", () => {
// #when - accessing hephaestus requirement
// #then - requiresProvider includes openai, github-copilot, venice, and opencode
expect(hephaestus).toBeDefined()
expect(hephaestus.requiresProvider).toEqual(["openai", "github-copilot", "venice", "opencode"])
expect(hephaestus.requiresProvider).toEqual(["openai", "github-copilot", "venice", "opencode", "vercel"])
expect(hephaestus.requiresModel).toBeUndefined()
})
@@ -415,12 +415,12 @@ describe("CATEGORY_MODEL_REQUIREMENTS", () => {
const primary = unspecifiedHigh.fallbackChain[0]
expect(primary.model).toBe("claude-opus-4-6")
expect(primary.variant).toBe("max")
expect(primary.providers).toEqual(["anthropic", "github-copilot", "opencode"])
expect(primary.providers).toEqual(["anthropic", "github-copilot", "opencode", "vercel"])
const secondary = unspecifiedHigh.fallbackChain[1]
expect(secondary.model).toBe("gpt-5.4")
expect(secondary.variant).toBe("high")
expect(secondary.providers).toEqual(["openai", "github-copilot", "opencode"])
expect(secondary.providers).toEqual(["openai", "github-copilot", "opencode", "vercel"])
})
test("artistry has valid fallbackChain with gemini-3.1-pro as primary", () => {