chat-default, that stands for an ordered list of models.
Your apps send that name as model, and you control which models it stands for from the AI Gateway.
To move to a new model or provider, edit the list, and the next request uses it.
You don’t change, redeploy, or restart your apps.
When a request sends the name, the gateway tries the models in order until one succeeds.
This also gives failover to clients that can’t send a models fallback list, such as a proxy that can’t rewrite request bodies, or an agent that lets you set only one model name.
What you’ll need
- An ngrok.ai account with an access key.
- Access to the models you want to list, either with credits or with your own provider keys.
- An AI Gateway API key, if you want to use the API instead of the dashboard.
1. Create a virtual model
Via the dashboard
- Open Virtual Models in app.ngrok.ai and click Create virtual model.
- Enter a Name, such as
chat-default, and an optional Description. - Under Models, click Add model and pick the model to try first. Choose Any provider to let any provider that serves the model handle it, or choose a provider to pin the model to that provider.
- Add each fallback model in the order you want the gateway to try them. To change the order, open a model’s menu and move it up or down.
- Click Create virtual model.
Via the AI Gateway API
Send the name and the models to the Virtual Models API:2. Send a request with the virtual model
Use the name anywhere you’d put a model. Nothing else in the request changes.anthropic/claude-sonnet-4-6 first.
If that attempt fails with a rate limit, an auth error, a server error, or a timeout, it tries openai:gpt-5.1, then google/gemini-3.6-flash.
The gateway matches the name without regard to case, so chat-default and Chat-Default are the same virtual model.
Virtual models work on every endpoint that takes a model name: Chat Completions, Responses, Messages, Gemini generateContent and Interactions, Decisions, and System One.
On Gemini generateContent, put the name in the path, such as /v1beta/models/chat-default:generateContent.
3. See which model answered
Read theNgrok-AIG-Model response header.
It names the model that served the request, not the virtual model name:
chat-default answered.
To see each attempt, pass the request ID to GET /usage/requests/{requestId}.
Each attempt that came from a virtual model has a virtualModel field with its name.
See Why a request failed over.
How to write the models in a virtual model
Each model in a virtual model uses the same format you’d send asmodel in a request:
A virtual model has these rules:
- It has 1 to 10 models. 10 is the most attempts the gateway makes for one request.
- Each model must exist for your account when you save the virtual model: a catalog model, one of your custom models, or
provider:modelfor a built-in or custom provider. The gateway matches provider IDs exactly, so use the lowercase Provider ID from the model catalog. - A model can’t be in the list more than once.
For example,
gpt-5.1andopenai/gpt-5.1are the same model. - A model can’t be another virtual model.
- If you use
ngrok/auto, you can’t add other models to the list.
Name a virtual model
Names have these rules:- 1 to 64 characters.
- Letters, numbers,
.,_, and-only. Names can’t contain/or:, because the gateway reads those as part of a model ID. - Unique in your account, without regard to case.
- Different from every model your account can call, such as a short model ID like
gpt-4oor one of your custom models. This keeps the name from hiding a real model.
Combine a virtual model with a fallback list
A virtual model works with a request’smodels array.
The gateway replaces the virtual model with its models, in place, then tries the full list in order:
chat-default, then deepseek:deepseek-v4-flash.
A virtual model can also be an entry in models.
If you list the same virtual model more than once, the gateway adds its models each time.
The gateway still makes at most 10 attempts per request, so models past that limit don’t run.
Virtual models that use ngrok/auto
A virtual model whose only model isngrok/auto works the same as sending ngrok/auto in that position.
The rules for combining ngrok/auto with fallback models still apply:
- On Chat Completions, Responses, and Messages, if the request lists other models too, the gateway ignores
ngrok/autoand uses the other models. - On the Gemini endpoints, the request fails with
ERR_NGROK_27228. The message names your virtual model:Invalid request: virtual model "chat-auto" resolves to ngrok/auto, which cannot be combined with other models.
Failover works the same way
A virtual model doesn’t change what triggers failover. The gateway moves to the next model after a rate limit, an auth error, a server error, a timeout, or a network failure. Any other 4xx response, such as an invalid request, stops the request right away. A virtual model doesn’t route around a request that no model can serve.Access keys apply to each model
A virtual model never gives an access key access to a model the key can’t use directly. The gateway checks each model in the virtual model against the key’s access key configuration:- If the key can’t use a model, the gateway skips it and tries the next one.
The
Ngrok-AIG-Rejected-Modelsresponse header names the model it skipped, not the virtual model. - If the key can’t use any model in the list, the request fails with the error for the first model, the same as for a
modelslist. - Routing rules match the provider and model of each attempt, not the virtual model name.
Change a virtual model
To change a virtual model, edit it on the Virtual Models page, or send aPATCH request:
models value replaces the whole list.
Fields you leave out keep their current values.
New requests use the change with no change to your clients.
Requests that are already running finish with the old list.
If you rename a virtual model, clients that send the old name get an unknown model error.
Delete a virtual model
Delete a virtual model from its menu on the Virtual Models page, or send aDELETE request.
After you delete it, the gateway treats the name like any other model name.
Clients that still send it get ERR_NGROK_27224 for an unknown model.
Warnings
A virtual model can stop working the way you expect when something changes after you save it. The Virtual Models page shows a warning on the virtual model, and the API returns it in thewarnings field:
List virtual models with /v1/models
Some SDKs, agents, and chat frontends check a model name againstGET /v1/models before they send a request.
The gateway lists your virtual models there, after the other models, with owned_by set to virtual-model:
Next steps
- Configure fallback models: Set the failover order in each request instead
- Handle gateway errors: Learn which failures the gateway retries
- Restrict providers and models: Limit what an access key can call
- Virtual Models API: Manage virtual models from your code