feat: add Vercel AI Gateway as a provider#747
Open
trasnake87 wants to merge 2 commits intoMerit-Systems:masterfrom
Open
feat: add Vercel AI Gateway as a provider#747trasnake87 wants to merge 2 commits intoMerit-Systems:masterfrom
trasnake87 wants to merge 2 commits intoMerit-Systems:masterfrom
Conversation
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
Contributor
|
@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
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 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.ts—createEchoVercelAIGateway()provider function using@ai-sdk/gatewaysrc/supported-models/chat/vercel.ts— Model definitions with pricing data from the gateway APIscripts/update-vercel-models.ts— Automated script to fetch latest models and pricing@ai-sdk/gatewayfrom devDependencies to dependenciesupdate-models:vercelnpm script and included inupdate-all-modelsServer Changes
VercelAIGatewayProvider.ts— Server-side provider using OpenAI-compatible SSE formatProviderType.ts— AddedVERCEL_AI_GATEWAYenum valueProviderFactory.ts— Wired Vercel provider into model routingAccountingService.ts— Added VercelModels to cost calculationenv.ts— AddedVERCEL_AI_GATEWAY_API_KEYenvironment variableHow It Works
The Vercel AI Gateway acts as a unified proxy to multiple AI providers. Model IDs use the
provider/modelformat (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
Closes #573