feat: add Vercel AI Gateway as a supported model provider#3385
Merged
Conversation
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
dgageot
approved these changes
Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 withAI_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, likeopenrouter) rather than a first-party API, since it can front open-weight models with strict chat templates (issue #3344).Definition of Done
vercel(openai / base URL /AI_GATEWAY_API_KEY)pkg/model/provider/aliases.goIsCatalogProvider("vercel")is truepkg/model/provider/aliases_test.go(TestCatalogAliases)CatalogProviders()EachAlias-drivenTestCatalogProviderstask testandtask lintpassexamples/vercel.yamlAdditional wiring (matches the Moonshot precedent)
pkg/model/provider/openai/client.go,openai/system_message_merge_test.gopkg/model/provider/openai_alias_providers_test.gopkg/config/auto.go,pkg/config/auto_test.gopkg/config/examples_test.goagent-schema.json,docs/_data/nav.yml,docs/concepts/models/,docs/configuration/models/,docs/providers/overview/,docs/providers/vercel/index.md,examples/README.mdTests
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:
Validation
go build ./...pkg/model/provider/...,pkg/config/...)vercelsubtests greengolangci-lint rungo run ./lint .Design note
Auto-selection wiring and the default model (
vercel/openai/gpt-5, placedmoonshot > vercel > amazon-bedrockin 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, likerequesty) is preferred, thepkg/config/auto.goandauto_test.gochanges can be dropped.