Skip to main content
Direct routing (the single strategy) sends all traffic for a model to one target. Once it is in place, callers send requests by model name and to11 uses the stored credential to reach the provider — the caller does not supply a provider key. Use it when one provider and one credential are all you need for a model.

Before you start

  • A provider connected under Project → AI Gateway → Providers, with the model you want in its model list. See Connecting a provider.
  • A stored credential for that provider, set up under Credentials.

Create a Direct routing rule

  1. Open Project → AI Gateway → Routing.
  2. In the routing list, start a new rule with the create-rule flow.
  3. Choose the Direct routing strategy.
  4. Set the model the rule applies to (for example gpt-4o).
  5. Choose the target: the provider and the stored credential to use for this model.
  6. Save the rule.
From now on, requests for that model resolve to this route, and to11 injects the stored credential. Models without a matching route still fall through to passthrough.

Send a request

Once the rule is live, call the model by name. The caller needs only its to11 credential — no provider key:
curl https://gw.to11.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "x-to11-authorization: Bearer $TO11_API_KEY" \
  -H "x-to11-project-id: $TO11_PROJECT_ID" \
  -d '{
    "model": "gpt-4o",
    "messages": [{"role": "user", "content": "Hello"}]
  }'
to11 resolves the route, uses the stored credential, and proxies the request to the provider. You receive a standard chat completion response.
The to11 credential goes in x-to11-authorization. Authorization (or x-api-key) is reserved for an upstream provider key when you bring your own — it is not used for a managed route.

Managed and passthrough together

A project can mix the two. Each Direct routing rule covers one model, and every model without a rule falls through to passthrough, where the caller supplies a provider key. For example, with a separate Direct routing rule on gpt-4o and on claude-sonnet-4-6, but none on gpt-4o-mini:
ModelRouting modeCaller supplies a provider key?
gpt-4oManaged (Direct routing)No
claude-sonnet-4-6Managed (Direct routing)No
gpt-4o-miniPassthroughYes
To confirm how a given request resolved — managed route or passthrough, and which target served it — open Projects → Traces in Observe.

Next steps

Weighted split

Split traffic across multiple targets by weight.

Fallback chain

Fail over to the next target on error.

Routing overview

The three-layer model and top-down resolution.