Migrate from Vercel AI Gateway
Moving from Vercel AI Gateway?Your own keys, no credits to buy.
Point the OpenAI provider at ModelRiver, call .chat() with a workflow name, and keep fallbacks, structured output and budgets in a workflow you can roll back.
- BYOK
- no token markup
- Free plan stops at 25,000 requests/month
2 lines of code + 1 workflow
Keep your OpenAI SDK. On the client line, change the base URL and key. On the request line, set model to the name of a workflow.
Step 0: create a workflow in the console with your primary model and backups. Its name is what you send as model.
Before
import os
from openai import OpenAI
client = OpenAI(
base_url="https://ai-gateway.vercel.sh/v1",
api_key=os.environ["AI_GATEWAY_API_KEY"],
)
resp = client.chat.completions.create(
model="anthropic/claude-sonnet-5",
extra_body={"providerOptions": {"gateway": {"models": ["openai/gpt-4o"]}}},
messages=[{"role": "user", "content": "Summarize this ticket."}],
)
print(resp.choices[0].message.content)After
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.modelriver.com/v1",
api_key=os.environ["MODELRIVER_API_KEY"],
)
resp = client.chat.completions.create(
model="support_bot", # workflow: claude-sonnet-5 + 2 backups
messages=[{"role": "user", "content": "Summarize this ticket."}],
)
print(resp.choices[0].message.content)Before
import { generateText } from "ai";
// AI_GATEWAY_API_KEY is read from the environment
const { text } = await generateText({
model: "anthropic/claude-sonnet-5",
prompt: "Summarize this ticket.",
providerOptions: {
gateway: { models: ["openai/gpt-4o"] },
},
});
console.log(text);After
import { generateText } from "ai";
import { createOpenAI } from "@ai-sdk/openai";
const modelriver = createOpenAI({
baseURL: "https://api.modelriver.com/v1",
apiKey: process.env.MODELRIVER_API_KEY,
});
const { text } = await generateText({
model: modelriver.chat("support_bot"), // .chat() = Chat Completions
prompt: "Summarize this ticket.",
});
console.log(text);Before
curl https://ai-gateway.vercel.sh/v1/chat/completions \
-H "Authorization: Bearer $AI_GATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-5",
"providerOptions": {"gateway": {"models": ["openai/gpt-4o"]}},
"messages": [{"role": "user", "content": "Summarize this ticket."}]
}'After
curl https://api.modelriver.com/v1/chat/completions \
-H "Authorization: Bearer $MODELRIVER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "support_bot",
"messages": [{"role": "user", "content": "Summarize this ticket."}]
}'What maps to what
Vercel AI Gateway concepts and where they live in ModelRiver.
| Vercel AI Gateway | ModelRiver |
|---|---|
model: "anthropic/claude-sonnet-5" | model: "support_bot", the name of a workflowClose to calling a vmc/ slug: the name stands for a saved setup, not a single model. |
Virtual model vmc/<slug> | A workflow, with Draft and Live releasesBoth are saved configs called by name and changed without a redeploy. A workflow keeps production on Live while you edit and test a Draft. |
providerOptions.gateway.models | Primary model plus up to 2 backup modelsBackups run on 429, 5xx, 408, 404 and connection errors, including during streaming. |
providerOptions.gateway.order / only / sort | No equivalentEach workflow slot names one provider and one model. No routing across providers that serve the same model. |
| AI Gateway credits, or BYOK credentials with purchased credits | Your provider keys, stored in the projectNo credits. Every request uses your key and your provider bills you directly. |
AI SDK string model id, such as "openai/gpt-4o" | createOpenAI({ baseURL }).chat("support_bot")Use .chat() so the AI SDK calls Chat Completions. ModelRiver has no Responses API. |
| Budgets on team, project, API key or member | USD budget per workflow modelHourly, daily, weekly or monthly caps on each model slot. |
| Trace drains (OpenTelemetry) | Request logs and request timeline in the ConsoleNo OpenTelemetry export or log export today. |
Map your config
Your fallbacks, output shape and budget move into one named workflow.
Your current Vercel AI Gateway request
{
"model": "anthropic/claude-sonnet-5",
"messages": [{ "role": "user", "content": "Summarize this ticket." }],
"providerOptions": {
"gateway": {
"order": ["anthropic", "bedrock"],
"models": ["openai/gpt-4o", "google/gemini-3.5-flash"]
}
}
}ModelRiver
The same setup as a ModelRiver workflow
- Primary
- anthropic/claude-sonnet-5
- Backup 1
- openai/gpt-4o
- Backup 2
- google/gemini-3.5-flash
- Structured output
- Optional JSON schema, saved on the workflow
- Budget
- $25 per day on the primary model
- Release
- Draft → Live, roll back any time
Try it with your keys. The Free plan stops at 25,000 requests a month instead of charging overage. Model usage is billed by your provider on your own keys.
Create a workflow freeWhen to stay where you are
Vercel AI Gateway may suit you better if any of these matter most.
You want the AI SDK's built-in gateway: plain
provider/modelstrings with no provider setup.You want one credit balance that pays for every provider.
You export OpenTelemetry traces with trace drains.
You need zero data retention routing, prompt-training blocks or regional inference.
You use image, video, speech or reranking models, the Responses API or the Anthropic Messages API.
You route one model across several providers with
order,onlyorsort.
What you gain, what you give up
What you gain
- BYOK without buying credits: every request uses your provider key, and ModelRiver bills a plan by request volume.
- Requests run only on your own provider keys, so all token usage appears on your provider bill and no gateway credits are needed.
- Draft and Live releases with revision history: test a change before production sees it, then publish or roll back.
- Test mode returns the sample data from your structured output with no provider call and no quota use, so frontends can be built before keys are live.
- Send a provider model such as
openai/gpt-4oby mistake and the 404 names the workflow in your project that runs it.
What you give up
- No unified billing or credits. You need an account and API key with each provider you use.
- Chat Completions only, so the AI SDK needs
.chat(): no Responses API, no Anthropic Messages API, no image, video or audio requests. - No routing across providers that serve the same model, and no provider ordering or sorting.
| Topic | Vercel AI Gateway | ModelRiver |
|---|---|---|
| How it bills | Prepaid credits charged at provider list price with no token markup, including BYOK. BYOK requires purchased credits. A monthly free credit covers a subset of models. Some add-ons bill separately. Source (opens in a new tab) · checked | Monthly plans by request volume, with no markup on tokens. Model usage is billed by your provider on your own keys. |
Compared, with sources
- Vercel AI Gateway requires purchased credits to use your own provider keys. ModelRiver has no credits: every request uses your key, and you pay a plan by request volume. Source (opens in a new tab) · checked
- When a BYOK request fails, Vercel AI Gateway retries it with its own system credentials and charges your credits. ModelRiver has no system credentials, so every attempt runs on your keys. Source (opens in a new tab) · checked
- Vercel virtual models can be edited without a redeploy, and edits reach new requests within minutes. ModelRiver workflows keep production on a Live version while you edit and test a Draft. Source (opens in a new tab) · checked
- The Vercel AI Gateway free tier is a monthly credit on a subset of models. The ModelRiver Free plan allows 25,000 requests a month and stops at the limit. Source (opens in a new tab) · checked
- Vercel AI Gateway credits pay for models across its catalog at provider list price. ModelRiver has no credits: you bring a key for each provider. Source (opens in a new tab) · checked
- Vercel AI Gateway can order, restrict and sort the providers that serve a model. Each ModelRiver workflow slot names one provider and one model. Source (opens in a new tab) · checked
- Vercel AI Gateway trace drains forward an OpenTelemetry trace of each request. ModelRiver has no OpenTelemetry or log export; use its request logs and timeline. Source (opens in a new tab) · checked
- Vercel AI Gateway offers zero data retention routing and regional inference. ModelRiver offers neither. Source (opens in a new tab) · checked
- Vercel AI Gateway serves Chat Completions, Messages and Responses APIs, plus image, video, speech and reranking models. ModelRiver serves chat completions, completions and embeddings only. Source (opens in a new tab) · checked
- Vercel AI Gateway takes an ordered list of model fallbacks. A ModelRiver workflow holds a primary model and up to 2 backups. Source (opens in a new tab) · checked
Steps to move over
- Step 1
Add your provider keys
Add a key for each provider your models use. ModelRiver has no credits, so every model in your workflows needs a key. Keys are encrypted at rest and masked once saved.
- Step 2
Turn each model setup or virtual model into a workflow
Primary: the model you call today, or the model behind your
vmc/slug. Backups: the first two entries of your model fallbacks. Name it with letters, digits and underscores, such assupport_bot. - Step 3
Compare the Draft with your current calls
Run a few prompts you send to AI Gateway today in the Playground against the Draft. To wire up your app without provider calls, switch the workflow to Testing mode; switch back to Production before you publish.
- Step 4
Publish the workflow Live
API requests run the Live version, so publish before you switch code. The workflow name then plays the part of your
vmc/slug. - Step 5
Swap the provider, key and model
In the AI SDK, create an OpenAI provider with
baseURL: "https://api.modelriver.com/v1"and call.chat("support_bot"). With the OpenAI SDK, change the base URL, key andmodel, and removeproviderOptions.const modelriver = createOpenAI({ baseURL: "https://api.modelriver.com/v1", apiKey: process.env.MODELRIVER_API_KEY, }); model: modelriver.chat("support_bot") - Step 6
Keep AI Gateway as a fallback for a while
Keep your current gateway configured in your code as a fallback until you're confident, then remove it. With the AI SDK, keep the old
provider/modelstring and use it if the ModelRiver call throws. - Step 7
Edit the workflow, not the virtual model
Where you used to edit a virtual model, edit the workflow Draft, test it, publish it, and roll back to an earlier revision if the change misbehaves.
Frequently asked questions
I use the AI SDK. Why .chat()?
Recent AI SDK versions call the Responses API by default with the OpenAI provider. ModelRiver serves Chat Completions, so modelriver.chat("support_bot") is required. A request to /v1/responses returns a JSON 404 that says so.
Is a workflow the same as a virtual model?
They are similar: both are saved configs that your code calls by name. A workflow also has Draft and Live releases, so edits do not reach production until you publish, and you can roll back to an earlier revision.
Do I need to buy credits to use my own keys?
No. ModelRiver has no credits. Your provider bills you for tokens on your key, and ModelRiver charges a plan by request volume: Free $0 for 25,000 requests a month, Pro $49/month, Scale $299/month.
Does streamText still work?
Yes. Chat Completions streaming over SSE works with modelriver.chat(...), including failover to a backup model. Amazon Bedrock models do not stream through ModelRiver yet.
Can I keep sending anthropic/claude-sonnet-5?
No. Plain provider/model strings are not accepted; model takes a workflow name. The 404 response names a workflow in your project that uses the model you sent, when one exists, and GET /v1/models lists the names you can send.
Where do my budgets go?
Set a USD budget on each workflow model: hourly, daily, weekly or monthly. Budgets apply per model slot, not per team member or API key.
Bring your keys. Keep your SDK.
Start on the Free plan, create a workflow and point your SDK at it.
Send us your models[] request or config.yaml (remove keys first) and we’ll reply with the matching workflow setup. Get help moving
Checked · Report an inaccuracy
Sources
Vercel and AI SDK are trademarks of their respective owners. ModelRiver is not affiliated with, endorsed or sponsored by them.