Skip to content

feat(provider): add Vercel AI Gateway support#3376

Merged
code-yeongyu merged 8 commits intocode-yeongyu:devfrom
matchai:feat/vercel-ai-gateway
Apr 13, 2026
Merged

feat(provider): add Vercel AI Gateway support#3376
code-yeongyu merged 8 commits intocode-yeongyu:devfrom
matchai:feat/vercel-ai-gateway

Conversation

@matchai
Copy link
Copy Markdown
Contributor

@matchai matchai commented Apr 13, 2026

Adds vercel as a recognized provider throughout the model resolution system, enabling users with a Vercel AI Gateway API key to use it as a universal fallback. The gateway proxies all supported providers (OpenAI, Anthropic, Google, xAI, MiniMax, Moonshot AI, Z.ai) with automatic multi-provider routing and failover.

The provider string is vercel and model IDs follow the vercel/<sub-provider>/<model> format (e.g. vercel/anthropic/claude-opus-4.6, vercel/minimax/minimax-m2.7, vercel/zai/glm-5).

Model transform

The vercel transform infers the sub-provider from canonical model name prefixes (claude- → anthropic, gpt- → openai, gemini- → google, grok- → xai, minimax- → minimax, kimi- → moonshotai, glm- → zai) and applies gateway-specific name normalization. Claude version dashes become dots via a generic regex (claude-(\w+)-(\d+)-(\d+)claude-$1-$2.$3) so new claude models need zero changes. The gateway uses gemini-3.1-pro-preview but gemini-3-flash (no -preview), which differs from the native Google API.

Fallback chains

vercel is added to every fallback entry where the model exists on the gateway catalog. Only k2p5 (kimi-for-coding specific) and big-pickle (opencode specific) are excluded. The gateway is always last in the providers list, so native providers take priority.

CLI installer

  • New --vercel-ai-gateway flag for non-TUI install
  • TUI prompt: "Do you have a Vercel AI Gateway API key?"
  • Config detection for re-installs (detects "vercel/" in existing omo config)
  • Gateway-aware defaults for all agents including librarian/explore

Tests

  • 30 unit tests for the transform (all providers including vercel sub-provider inference, minimax, moonshotai, zai)
  • 73 model-fallback tests including gateway-only snapshots validating full vercel/<sub-provider>/<model> format
  • 31 model-requirements tests updated for new provider arrays

matchai added 2 commits April 13, 2026 11:22
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.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 13, 2026

All contributors have signed the CLA. Thank you! ✅
Posted by the CLA Assistant Lite bot.

@matchai
Copy link
Copy Markdown
Contributor Author

matchai commented Apr 13, 2026

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Apr 13, 2026
@matchai
Copy link
Copy Markdown
Contributor Author

matchai commented Apr 13, 2026

recheck

@matchai matchai changed the title Add Vercel AI Gateway as a provider feat(provider): add Vercel AI Gateway support Apr 13, 2026
matchai added 4 commits April 13, 2026 12:51
The gateway uses google/gemini-3-flash (no -preview suffix) unlike the
direct Google API. Give the vercel provider its own transform instead
of delegating to sub-provider transforms blindly.
Adds vercel to every fallback entry where the model exists on the
gateway (kimi-k2.5, glm-5, glm-4.6v, minimax-m2.7, grok-code-fast-1,
gpt-5-nano). Adds inferSubProvider mappings for minimax, moonshotai,
and zai. Updates librarian/explore special cases to prefer minimax
via gateway over claude-haiku.
…c regex

Claude version transforms now use a single regex
claude-(\w+)-(\d+)-(\d+) -> claude-$1-$2.$3 instead of one
.replace() per model. New claude models need zero changes.
@matchai matchai marked this pull request as ready for review April 13, 2026 05:06
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 13 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Comprehensive implementation of Vercel AI Gateway support with extensive unit tests, snapshot updates, and correctly handled model name transformations across providers.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 5 files (changes from recent commits).

Requires human review: Changes model ID formatting for existing Anthropic provider (switching from dots to hyphens), which may cause regressions in API calls if downstream clients expect the previous format.

@matchai matchai marked this pull request as draft April 13, 2026 06:28
- Add --vercel-ai-gateway CLI option to install command
- Fix librarian/explore priority: native providers (ZAI, Copilot) now take precedence over Vercel gateway
- Add hasVercelAiGateway to installer no-provider warning conditions
- Add hasVercelAiGateway: false to all test file InstallConfig fixtures
- Fix test expectations for model ID format (claude-opus-4.6 vs claude-opus-4-6)
@code-yeongyu code-yeongyu force-pushed the feat/vercel-ai-gateway branch from ff42fe5 to e3b5c2b Compare April 13, 2026 06:31
@code-yeongyu code-yeongyu marked this pull request as ready for review April 13, 2026 06:42
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 22 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: The PR modifies existing model naming conventions for native Anthropic providers (changing 4-6 to 4.6), which could cause regressions in systems expecting the previous format.

@code-yeongyu code-yeongyu merged commit f1cd4d7 into code-yeongyu:dev Apr 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants