Documentation Index
Fetch the complete documentation index at: https://to11.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
Simple Routing
This guide shows you how to set up gateway-owned credentials for specific models. Once configured, callers send requests without an API key and the gateway injects its own.Prerequisites
- A working gateway configuration with at least one provider
- The provider’s API key available as an environment variable
Option A — bare targets
The simplest way to enable managed routing is to declare a[targets.*] block without a corresponding [routes.*] entry. The config builder auto-creates a single route for the target’s model.
gpt-4ois managed — the gateway uses the credential from[providers.openai](resolved viaenv::OPENAI_API_KEY). The caller does not need an API key.gpt-4o-miniremains passthrough — the caller must provide their own key.
credential explicitly:
Option B — explicit route
To make the routing configuration self-documenting, you can declare both the target and the route explicitly:Testing it
Start the gateway with your configuration, then send a request without anAuthorization header:
If the environment variable referenced by
credential is not set at startup, the gateway fails fast with a configuration error. Check your environment before starting.Mixed mode
Managed and passthrough routing coexist in a single configuration. Models with a matching target or route use gateway-owned credentials; everything else falls through to passthrough.| Model | Routing mode | Caller needs API key? |
|---|---|---|
gpt-4o | Managed | No |
claude-sonnet-4-6 | Managed | No |
gpt-4o-mini | Passthrough | Yes |
o3 | Passthrough | Yes |
Credential resolution order
When the gateway resolves a managed target’s credential, it checks in this order:- Target-level
credential— explicit on the[targets.*]block - Provider-level
credential— declared on the[providers.*]block - Convention-based — derived from the provider name (e.g.
env::OPENAI_API_KEYforopenai) - Error — if none of the above resolves, the gateway fails at startup
Next steps
Weighted Routing
Distribute traffic across multiple targets.
Fallback
Automatic failover between providers.
Configuration
Full TOML reference for all gateway settings.