Add Vercel AI Gateway as a Provider#727
Open
285729101 wants to merge 1 commit intoMerit-Systems:masterfrom
Open
Add Vercel AI Gateway as a Provider#727285729101 wants to merge 1 commit intoMerit-Systems:masterfrom
285729101 wants to merge 1 commit intoMerit-Systems:masterfrom
Conversation
Contributor
|
@285729101 is attempting to deploy a commit to the Merit Systems Team on Vercel. A member of the Team first needs to authorize it. |
Author
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
Closes #573
Adds the Vercel AI Gateway as a new provider, enabling Echo users to route requests through Vercel's unified AI gateway to access models from multiple upstream providers (OpenAI, Anthropic, Google, xAI, Mistral, DeepSeek, etc.) through a single endpoint.
Changes
SDK (packages/sdk/ts)
packages/sdk/ts/src/supported-models/chat/vercel.tswith model definitions and per-token pricing for 25 models across 6 upstream providers (Anthropic, DeepSeek, Google, Mistral, OpenAI, xAI). Pricing is sourced from the Vercel AI Gateway API via@ai-sdk/gateway.packages/sdk/ts/src/providers/vercel.tswithcreateEchoVercelAIGateway()SDK provider function using@ai-sdk/gateway.packages/sdk/ts/scripts/update-vercel-models.tsscript to auto-update model definitions and pricing from the gateway API (matches the pattern used byupdate-openai-models.ts,update-anthropic-models.ts, etc.).@ai-sdk/gatewayfromdevDependenciestodependenciessince it is now used at runtime.update-models:vercelnpm script and included it inupdate-all-models.src/index.ts,src/providers/index.ts, andsrc/supported-models/index.tsto export the newVercelModels,VercelModeltype,createEchoVercelAIGateway, andVercelAIGatewayProvidertype.Router/Server (packages/app/server)
VERCEL_AI_GATEWAYto theProviderTypeenum.VercelAIGatewayProviderserver-side provider that routes requests tohttps://ai-gateway.vercel.sh/v1. Uses the OpenAI-compatible SSE format for streaming and non-streaming responses.ProviderFactoryto mapVercelprovider models to the newVERCEL_AI_GATEWAYprovider type and instantiateVercelAIGatewayProvider.AccountingServiceto includeVercelModelsin the supported models list for accurate cost tracking.VERCEL_API_KEYtoenv.tsfor gateway authentication.Pricing
Model pricing uses the Vercel AI Gateway pricing API (already used in
packages/sdk/ts/scripts/update-models.ts). Theupdate-vercel-models.tsscript fetches live pricing and regenerates the static model definitions. Models use the@provider/modelID format (e.g.,@openai/gpt-4o,@anthropic/claude-sonnet-4).Test plan
pnpm buildinpackages/sdk/tspnpm buildinpackages/app/serverVercelModelsare exported and accessible from the SDKcreateEchoVercelAIGateway()creates a valid gateway provider@openai/gpt-4o)pnpm update-models:vercelto confirm the update script works with the gateway API