Skip to content

feat: add Vercel AI Gateway as a supported model provider#3385

Merged
Sayt-0 merged 1 commit into
mainfrom
feat/3353-vercel-ai-gateway
Jul 1, 2026
Merged

feat: add Vercel AI Gateway as a supported model provider#3385
Sayt-0 merged 1 commit into
mainfrom
feat/3353-vercel-ai-gateway

Conversation

@Sayt-0

@Sayt-0 Sayt-0 commented Jul 1, 2026

Copy link
Copy Markdown
Member

Summary

Adds first-class support for Vercel AI Gateway as an OpenAI-compatible provider via the alias map. Vercel AI Gateway exposes a single unified endpoint (https://ai-gateway.vercel.sh/v1) routing to OpenAI, Anthropic, Google, xAI and more, authenticated with AI_GATEWAY_API_KEY.

Implementation mirrors the recently merged Moonshot provider (17a6e5ec), with one deliberate difference: Vercel is classified as a multi-provider gateway (coalesces consecutive system messages, like openrouter) rather than a first-party API, since it can front open-weight models with strict chat templates (issue #3344).

Definition of Done

Item Status Where
Alias entry vercel (openai / base URL / AI_GATEWAY_API_KEY) done pkg/model/provider/aliases.go
Unit test: alias resolves and IsCatalogProvider("vercel") is true done pkg/model/provider/aliases_test.go (TestCatalogAliases)
Provider appears in CatalogProviders() done covered by existing EachAlias-driven TestCatalogProviders
task test and task lint pass done see Validation below
Example YAML config done examples/vercel.yaml

Additional wiring (matches the Moonshot precedent)

Area Files
Gateway classification (system-message merge) pkg/model/provider/openai/client.go, openai/system_message_merge_test.go
End-to-end and opt-in live API test pkg/model/provider/openai_alias_providers_test.go
Auto model selection pkg/config/auto.go, pkg/config/auto_test.go
Example parsing (skip models.dev lookup for the router) pkg/config/examples_test.go
Schema and docs agent-schema.json, docs/_data/nav.yml, docs/concepts/models/, docs/configuration/models/, docs/providers/overview/, docs/providers/vercel/index.md, examples/README.md

Tests

Coverage is added as rows in the existing table-driven harnesses rather than new bespoke files. The shared alias harness gives both a hermetic end-to-end request (auth header, endpoint, model, SSE reassembly, system-message coalescing) and an opt-in live API check:

AI_GATEWAY_API_KEY=... go test -run TestOpenAIAliasProvider_LiveAPI ./pkg/model/provider/

Validation

Check Result
go build ./... pass
targeted tests (pkg/model/provider/..., pkg/config/...) pass, all vercel subtests green
golangci-lint run 0 issues
custom go run ./lint . no offenses (1330 files)

Design note

Auto-selection wiring and the default model (vercel/openai/gpt-5, placed moonshot > vercel > amazon-bedrock in the priority order) go beyond the strict DoD, added for parity with the Moonshot provider. If keeping Vercel as an alias-only provider (resolvable but not auto-selected, like requesty) is preferred, the pkg/config/auto.go and auto_test.go changes can be dropped.

Add a built-in OpenAI-compatible alias for Vercel AI Gateway with base
URL https://ai-gateway.vercel.sh/v1 and AI_GATEWAY_API_KEY. Wire it into
auto model selection, the JSON schema, docs, an example config, and the
shared alias test harness (hermetic end-to-end plus opt-in live API).
Classified as a multi-provider gateway that coalesces consecutive system
messages (like openrouter), since it can front open-weight models.

Closes #3353
@Sayt-0 Sayt-0 requested a review from a team as a code owner July 1, 2026 15:27
@aheritier aheritier added area/config For configuration parsing, YAML, environment variables area/docs Documentation changes area/providers For features/issues/fixes related to LLM providers (Bedrock, LiteLLM, Qwen, custom, etc.) area/providers/openai For features/issues/fixes related to the usage of OpenAI models kind/feat PR adds a new feature (maps to feat:). Use on PRs only. labels Jul 1, 2026
@Sayt-0 Sayt-0 merged commit 8dd843a into main Jul 1, 2026
13 checks passed
@Sayt-0 Sayt-0 deleted the feat/3353-vercel-ai-gateway branch July 1, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config For configuration parsing, YAML, environment variables area/docs Documentation changes area/providers/openai For features/issues/fixes related to the usage of OpenAI models area/providers For features/issues/fixes related to LLM providers (Bedrock, LiteLLM, Qwen, custom, etc.) kind/feat PR adds a new feature (maps to feat:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants