Skip to content

feat: add Vercel AI Gateway as a provider#747

Open
trasnake87 wants to merge 2 commits intoMerit-Systems:masterfrom
trasnake87:feat/vercel-ai-gateway-provider
Open

feat: add Vercel AI Gateway as a provider#747
trasnake87 wants to merge 2 commits intoMerit-Systems:masterfrom
trasnake87:feat/vercel-ai-gateway-provider

Conversation

@trasnake87
Copy link

Summary

Adds the Vercel AI Gateway as a new provider for the Echo platform, enabling access to 45+ models from multiple providers (OpenAI, Anthropic, Google, Meta, Mistral, DeepSeek, Cohere, Perplexity, xAI, Amazon, Alibaba) through a single unified gateway.

SDK Changes

  • src/providers/vercel.tscreateEchoVercelAIGateway() provider function using @ai-sdk/gateway
  • src/supported-models/chat/vercel.ts — Model definitions with pricing data from the gateway API
  • scripts/update-vercel-models.ts — Automated script to fetch latest models and pricing
  • Moved @ai-sdk/gateway from devDependencies to dependencies
  • Added update-models:vercel npm script and included in update-all-models

Server Changes

  • VercelAIGatewayProvider.ts — Server-side provider using OpenAI-compatible SSE format
  • ProviderType.ts — Added VERCEL_AI_GATEWAY enum value
  • ProviderFactory.ts — Wired Vercel provider into model routing
  • AccountingService.ts — Added VercelModels to cost calculation
  • env.ts — Added VERCEL_AI_GATEWAY_API_KEY environment variable

How It Works

The Vercel AI Gateway acts as a unified proxy to multiple AI providers. Model IDs use the provider/model format (e.g., openai/gpt-4o, anthropic/claude-sonnet-4). The gateway handles provider-specific auth and formatting, returning OpenAI-compatible responses — so the server-side provider reuses the existing GPT SSE parsing logic.

Testing

  • All 27 existing SDK tests pass
  • SDK and server both build cleanly

Closes #573

Add support for the Vercel AI Gateway, enabling access to models from
multiple providers (OpenAI, Anthropic, Google, Meta, Mistral, DeepSeek,
Cohere, Perplexity, xAI, Amazon, Alibaba) through a single gateway.

SDK changes:
- Add createEchoVercelAIGateway() provider function
- Add VercelModels with pricing data from the gateway API
- Add update-vercel-models.ts script for automated model/pricing updates
- Export VercelModels, VercelModel type, and GatewayProvider type

Server changes:
- Add VERCEL_AI_GATEWAY provider type
- Add VercelAIGatewayProvider (OpenAI-compatible SSE format)
- Wire into ProviderFactory routing and AccountingService
- Add VERCEL_AI_GATEWAY_API_KEY env variable

Closes Merit-Systems#573
@vercel
Copy link
Contributor

vercel bot commented Mar 21, 2026

@trasnake87 is attempting to deploy a commit to the Merit Systems Team on Vercel.

A member of the Team first needs to authorize it.

- Regenerate vercel.ts with actual pricing from the public
  https://ai-gateway.vercel.sh/v1/models endpoint (176 models)
- Fix update script to use the public models endpoint instead of
  the SDK's getAvailableModels() which requires authentication
- Previous pricing values were approximate; now using exact values
  from the gateway API
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.

Add the Vercel AI Gateway as a Provider

1 participant