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.
Function Routing
To decouple task names from model names, define functions in your gateway configuration. Your application sendsmodel: "function::summarize" instead of model: "gpt-4o", and the gateway resolves the function to the configured targets. Swapping models becomes a config change — no application code needs to change.
Prerequisites
- At least one provider configured with one or more models.
Option A — Inline models shorthand
The simplest approach references model names directly. The gateway creates internal targets for each model automatically.models list. With the fallback strategy, it tries gpt-4o first. If that fails, it falls back to claude-sonnet-4-6. No [targets.*] blocks are needed.
Option B — Named targets
When you need per-target weights, custom credentials, or specific timeout overrides, reference named targets instead.extract traffic to one API key and 30 % to another.
Calling a function
Use thefunction:: prefix in the model field to route to a function.
Unprefixed names also work — the gateway resolves unprefixed names top-down: function first, then route, then provider. If a function named
summarize exists, it matches before any route or provider model with the same name. The explicit function:: prefix is recommended to make the routing layer visible and avoid surprises.Resolution order
When the gateway receives an unprefixed model name, it resolves top-down through three layers.function::summarize goes directly to function dispatch without checking routes or providers.
Per-function retry
Override the global retry settings for a specific function.summarize function. Other functions and routes use the global [routing.retry] settings.
Validation rules
A function must use exactly one of
models, targets, or steps. The gateway rejects the configuration at load time if multiple fields are present. Each inline model name in the models list must exist in at least one provider’s models array. Functions also support multi-step fallback chains via steps — see Functions (concept) for details.No fallthrough on failure
Multi-endpoint functions
Functions work for all endpoint types. Set theendpoint field to declare which HTTP endpoint the function serves.
Embedding function
Image generation function
Audio speech function
Audio transcription function
Audio transcription functions support model routing and model rewrite, but not variant param overrides. The multipart/form-data body format makes param injection fragile with binary audio data. Operators who need different
language or response_format values should create separate functions.Endpoint mismatch
If you send a request to the wrong endpoint, the gateway returns 400:model: "function::embed" is sent to /v1/chat/completions but the function has endpoint = "embeddings". Use the correct HTTP endpoint for the function’s declared type.
Variant params
When usingstrategy = "experiment", each variant can override request parameters. Params are flat key-value pairs at the same level as model and weight:
Known fields per endpoint
| Endpoint | Validated params |
|---|---|
chat | temperature, max_tokens, top_p, frequency_penalty, presence_penalty, seed, stop, response_format, n |
embeddings | dimensions, encoding_format |
image_generation | size, quality, style, n, response_format |
audio_speech | voice, speed, response_format |
temperature on an embedding function) are rejected at startup.
Next steps
Routing Overview
Managed vs passthrough routing and the full resolution flow.
Experiment Routing
A/B test models and parameters with weighted variants.
Fallback Routing
Automatic failover between providers.
Configuration
Full TOML reference for all gateway settings.