Introducing Virtual Models on AI Gateway
TL;DR · AI 摘要
Vercel 推出 AI Gateway 虚拟模型,通过统一 ID 管理模型配置,实现无代码变更的模型切换和零数据保留。
核心要点
- 虚拟模型通过单一 ID 管理多模型配置,支持自动回退和零数据保留策略
- AI Gateway 每周新增约10个模型,模型切换只需修改配置无需代码变更
- 使用 vercel ai-gateway 命令行工具可创建/编辑虚拟模型配置
结构提纲
按章节快速跳转。
思维导图
用一张图看清主题之间的关系。
查看大纲文本(无障碍 / 无 JS 友好)
- AI Gateway 虚拟模型
- 核心特性
- 统一 ID 管理
- 自动回退机制
- 零数据保留
- 使用流程
- 创建虚拟模型
- 配置模型参数
- 应用 ID 调用
- 优势
- 无需代码变更
- 动态更新生效
- 多模型兼容
金句 / Highlights
值得收藏与分享的关键句。
在过去的90天里,AI Gateway 上新增了125个模型,平均每周约10个
虚拟模型配置变更后,所有使用该 ID 的应用会自动生效,无需代码修改或重新部署
通过设置 zeroDataRetention: true 可实现符合 GDPR 的数据保留策略
Introducing Virtual Models on AI Gateway - Vercel
Today, we are introducing Virtual Models on AI Gateway .
Virtual Models are an abstraction of the model string and configurations your apps and developers use. With a single virtual model ID, you can change and update models, configure fallbacks and priority, and enforce Zero Data Retention centrally. The virtual model configuration applies wherever the ID is used.
Assign a virtual model ID to an agent task, and pass it as the model string wherever that task is called. You can then change the model and settings behind the virtual model ID in AI Gateway, and your apps and agents will pick up the new configuration automatically, without code changes or redeploys.
One team's virtual models in AI Gateway, each one callable by ID.
Copy link to heading New models use the same virtual model ID
In the last 90 days, 125 new models from more than 10 labs became available on AI Gateway. That adds up to about 10 a week. AI Gateway already makes switching a one-line change. You call any of those models by ID, and AI Gateway routes each request to a healthy provider and can fall back to others when one fails.
That one line still lives in your code, so switching usually means a redeploy.
Virtual Models move model selection and configuration to AI Gateway. You create an ID for a task, like vmc/coding-agent , and then configure the model and the settings it should use:
vercel ai-gateway virtual-models create coding-agent
\
--model
anthropic/claude-opus-5.5
\
--config
'{"speed":"fast","zeroDataRetention":true}'You can then use that virtual model ID as the model string wherever the task runs:
import
{
streamText
}
from
'ai'
;
const
result
=
streamText
(
{
model
:
'vmc/coding-agent'
,
prompt
:
'Remove the deprecated API calls from this module.'
,
}
)
;For coding agents like Claude Code , Codex , and others, connect them with vercel ai-gateway setup , then select your virtual model in each harness's model picker or configuration.
When a different model is available, including one from another provider, edit the virtual model . Every app and agent that calls vmc/coding-agent picks it up within a few minutes, with no code change or deployment needed:
vercel ai-gateway virtual-models edit coding-agent
--model
openai/gpt-6.1-sol$?
/$
Copy link to heading Give each task its own model
An agent task like support ticket triage can run hundreds of times an hour and needs to be cheap. Other tasks, like legal contract review, may only run a few times a day, but require a high level of reasoning.
You can now give each task a purpose-built virtual model and easily evolve that model and configuration over time:
Settings such as fallbacks, Zero Data Retention, and tags stay with the virtual model when you switch models. Provider options apply per provider, so an Anthropic-specific setting stops applying when you point the virtual model at an OpenAI model. Review your provider options whenever you switch providers.
Before you switch a virtual model that serves production traffic, point a second one, like vmc/coding-agent-candidate , at the new model and run your evals against it. If quality drops after the switch, point the original back at the previous model.
Copy link to heading Govern which models your team uses and how
Anyone on your team can call a virtual model, and team roles control who can make changes to it. Platform and security teams can centrally govern and test models and settings, while still easily giving teams access to new models as they are released.
Settings on a virtual model win over the same settings in a request, so callers can't override the provider order, fallbacks, or service tier you chose. For example, you can configure the fallback models for vmc/storefront-assistant centrally, and every app using that virtual model ID will use the same failover configuration, even if a request specifies different fallbacks.
If a virtual model requires Zero Data Retention or providers that don't train on request data, those configurations are enforced even if a request explicitly sets zeroDataRetention or disallowPromptTraining to false.
Tags on a virtual model replace any tags sent with the request, so spend lands on the task no matter how each app tags its calls. The Virtual Models page shows requests, spend, and success rate for each task.
Copy link to heading Get started
Create a virtual model from your team dashboard or with the Vercel CLI .
Copy link to heading About AI Gateway
AI Gateway provides a unified API for calling models, tracking usage and cost, and configuring retries, failover, and performance optimizations for higher-than-provider uptime. It includes built-in custom reporting , Zero Data Retention support , budgets for API keys , routing rules , and more.
AI Gateway reflects provider pricing with no markup and doesn't charge a platform fee on inference, including on Bring Your Own Key (BYOK) requests.
Virtual Models work with every model type on AI Gateway, including image, video, speech, embedding, and realtime models, and with the AI SDK and the OpenAI- and Anthropic-compatible APIs. See the Virtual Models documentation for every setting.
Contributors
Eric Dodds