# Virtual Models (/docs/models-routing/virtual-models)

> For AI agents, the [documentation index](https://bitrouter-docs-staging.up.railway.app/llms.txt) lists all pages. Append .md to a documentation URL to read its Markdown.

A **virtual model** is a named entry under `models` in `bitrouter.yaml`. It exposes configured provider/model endpoints through one callable name, such as `coding`, so an application can keep using that name when you change its backing endpoints.

Connect the sources first with [BYOK & Subscriptions](https://bitrouter-docs-staging.up.railway.app/docs/models-routing/byok-subscriptions) or [Local Models](https://bitrouter-docs-staging.up.railway.app/docs/models-routing/local-models). Use [Model Fallbacks](https://bitrouter-docs-staging.up.railway.app/docs/models-routing/model-fallback) for the failure conditions and replacement behavior of a multi-endpoint route.

## Define a virtual model \[#define-a-virtual-model]

```yaml
models:
  coding:
    strategy: priority
    endpoints:
      - provider: openai
        service_id: gpt-5
      - provider: anthropic
        service_id: claude-sonnet-4-6
```

`coding` is the name callers use. Each endpoint identifies a configured provider and a model id that provider serves. With `strategy: priority`, eligible endpoints are tried in the configured order; [Model Fallbacks](https://bitrouter-docs-staging.up.railway.app/docs/models-routing/model-fallback#fallback-chains) explains when another endpoint is attempted.

A virtual model defines a named route. It does not by itself evaluate answer quality or introduce an automatic cost optimizer.

## Call the name \[#call-the-name]

Use the virtual model wherever the API accepts a model selector:

```bash
curl http://127.0.0.1:4356/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "coding",
    "messages": [{"role": "user", "content": "Summarize this change."}]
  }'
```

An authenticated deployment also requires a BitRouter credential. A native harness launch can use the same name:

```bash
bro claude --model coding
bro codex --model coding
```

See [bro \[harness\]](https://bitrouter-docs-staging.up.railway.app/docs/integration/bro-harness) for launch configuration and [Responses API](https://bitrouter-docs-staging.up.railway.app/docs/usage/responses-api) for the Responses request format.

## Model selector forms \[#model-selector-forms]

For hosted Cloud model IDs, use [GET /v1/models](https://bitrouter-docs-staging.up.railway.app/docs/reference/discovery/listModels). Catalog discovery does not grant account access or guarantee that a provider can serve a particular request.

| Selector                | Meaning                                                                 |
| ----------------------- | ----------------------------------------------------------------------- |
| `coding`                | A matching virtual model defined under `models`                         |
| `openai/gpt-5.4`        | A logical model id that may be served by multiple connected providers   |
| `openai:openai/gpt-5.4` | An explicit route through one configured provider                       |
| `bitrouter/fast`        | A named local router that supplies model selection and request defaults |
| `@fast`                 | A compatible legacy preset                                              |
| `@fast:primary`         | A preset with a configured variant                                      |
| `bitrouter/auto`        | The local `auto` router with a routing-policy binding                   |

The slash in a logical model id is part of the model's identity; it does not pin the serving provider. The colon form explicitly selects a provider. Subscription sources require an explicit provider-qualified route, as described in [BYOK & Subscriptions](https://bitrouter-docs-staging.up.railway.app/docs/models-routing/byok-subscriptions#subscriptions).

## Resolution order \[#resolution-order]

The self-hosted proxy resolves a selector in this order:

1. Resolve a named `bitrouter/<name>` router or a legacy `@preset` with an optional `:variant`.
2. Treat `provider:model` as an explicit provider route.
3. Resolve a matching entry under `models` as a virtual model.
4. Otherwise, resolve the logical model id across active providers that declare it.

Choose a virtual name that does not collide with a logical model id when both should remain separately addressable.

## Presets \[#presets]

A named local router can select a virtual model and add reusable request defaults:

```yaml
routers:
  fast:
    selection:
      kind: model
      model: coding
    defaults:
      system_prompt: "Be concise."
      params:
        temperature: 0.2
```

Call `bitrouter/fast` to apply those defaults. Request fields take precedence. Existing local `@fast` selectors still address legacy presets. Use `bro config migrate-routers --candidate <path>` to preview a migration. Cloud uses catalog model IDs or enabled workspace presets addressed as `@<name>`.

`bitrouter/auto` requires a policy binding on the named local router. See the [Auto Router guide](https://bitrouter-docs-staging.up.railway.app/docs/routing/auto-router#initialize-a-policy-binding) for initializing that binding.

## Variants \[#variants]

A configured variant applies routing preferences to a selector, for example `coding:private` or `@fast:primary`. It does not create another virtual-model definition. An unknown suffix remains part of the selector instead of being silently removed.

Variants do not grant access, bypass guardrails, or supply provider credentials. Configure candidate filters in [Strategies](https://bitrouter-docs-staging.up.railway.app/docs/routing/strategies#variants).

## Protocol compatibility \[#protocol-compatibility]

Every endpoint must support the capabilities required by the request. Giving several endpoints one virtual name does not make their tools, structured outputs, or provider continuity interchangeable.

For custom endpoints, declare only verified model capabilities in [BYOK & Subscriptions](https://bitrouter-docs-staging.up.railway.app/docs/models-routing/byok-subscriptions#custom-endpoints-and-models). [Responses API](https://bitrouter-docs-staging.up.railway.app/docs/usage/responses-api#structured-outputs-across-protocols) explains response-format fields across supported protocols. Use a schema supported by every model that may serve a fallback request.

## Inspect and verify \[#inspect-and-verify]

```bash
bro config validate -c bitrouter.yaml
bro route coding -c bitrouter.yaml
bro route bitrouter/fast -c bitrouter.yaml
bro requests --limit 25
```

`bro route` previews resolution without sending an inference request. It uses the running daemon when available and otherwise resolves from the selected configuration file. [Request receipts](https://bitrouter-docs-staging.up.railway.app/docs/cli/request-receipts) identify the model and provider that actually served a call.

* [Model Fallbacks](https://bitrouter-docs-staging.up.railway.app/docs/models-routing/model-fallback) — Understand replacement order and retryable failures.

* [BYOK & Subscriptions](https://bitrouter-docs-staging.up.railway.app/docs/models-routing/byok-subscriptions) — Connect the accounts and endpoints behind a virtual model.

* [Local Models](https://bitrouter-docs-staging.up.railway.app/docs/models-routing/local-models) — Add a local inference endpoint.

* [Configuration (YAML)](https://bitrouter-docs-staging.up.railway.app/docs/routing/configuration) — Find, validate, and apply the configuration.