Skip to main content

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.

Targets

A target is a named entry in [targets.*] that pairs a specific model with a credential the gateway owns. Targets are the building blocks of managed routing — they let the gateway inject its own API key instead of relying on the caller to provide one.

Why targets exist

In passthrough mode, every caller supplies their own API key via the Authorization header. That works well on developer workstations but becomes limiting in shared environments — staging clusters, CI pipelines, or production deployments where a central platform team manages provider relationships and budgets. Targets solve this by shifting credential ownership to the gateway. Callers send requests without an API key for models that have targets, and the gateway injects the appropriate key from the environment. Models without targets continue to work as passthrough.

Fields

FieldTypeRequiredDescription
modelstringYesThe upstream model name. Must appear in a provider’s models list.
credentialstringNoCredential location (env::VAR_NAME). Overrides the provider-level credential.
weightintegerNoRelative weight for the weighted routing strategy. Defaults to 1.
timeout_msintegerNoPer-target timeout override in milliseconds.

Configuration example

Two targets for the same model using different API keys — useful for distributing load across accounts or separating billing:
[providers.openai]
base_url = "https://api.openai.com/v1"
models   = ["gpt-4o"]

[targets.openai-primary]
model      = "gpt-4o"
credential = "env::OPENAI_API_KEY_PRIMARY"
weight     = 70

[targets.openai-secondary]
model      = "gpt-4o"
credential = "env::OPENAI_API_KEY_SECONDARY"
weight     = 30
The gateway determines which provider serves a target’s model by looking up the model name in the provider registry. You do not need to specify the provider explicitly in the target definition.

Credential resolution chain

When the gateway resolves credentials for a target, it checks three levels. Each level has different failure behaviour:
target.credential  (strict)
  --> provider.credential  (lenient)
    --> convention default  (lenient)
  • Strict resolution — When a target declares credential = "env::VAR_NAME", the environment variable must exist at gateway startup. If it is missing, the gateway fails fast with a configuration error. This prevents silent misconfiguration in production.
  • Lenient resolution — When the target does not declare its own credential, the gateway falls back to the provider’s credential (explicit or convention-based). Lenient resolution returns an empty string if the environment variable is missing, which means the caller’s own key will be used instead.
If a target’s credential environment variable is missing, the gateway refuses to start. Always verify that the referenced environment variables are set before deploying a configuration with targets.

Bare targets shorthand

When you declare targets without any corresponding [routes.*] entries, the gateway automatically creates a route for each target’s model. If exactly one target exists for a model, it uses a single strategy. If multiple targets share the same model, it creates a fallback strategy so each target is tried in order.
[targets.openai-gpt4o]
model = "gpt-4o"

# No [routes.*] entry needed.
# The gateway auto-creates a single-strategy route for gpt-4o.
This is equivalent to writing:
[targets.openai-gpt4o]
model = "gpt-4o"

[routes.openai-gpt4o]
models   = ["gpt-4o"]
strategy = "single"
targets  = ["openai-gpt4o"]
Use bare targets when you want gateway-owned credentials for a model but do not need weighted distribution or fallback chains.

How targets relate to routes and providers

Targets sit between providers and routes in the gateway’s configuration hierarchy:
Providers (L1)       Targets (L1.5)         Routes (L2)
+--------------+     +----------------+     +-----------------+
| base_url     |     | model ----+--> |     | models          |
| models[]     |<----| credential     |<----| strategy        |
| credential   |     | weight         |     | targets[]       |
+--------------+     +----------------+     +-----------------+
  • Providers define where to reach an API and which models it serves.
  • Targets bind a model to a specific credential (and optionally a weight or timeout).
  • Routes reference targets by name, grouping them into a selection strategy.

Next steps

Routes

How routes map model names to strategies across targets.

Providers

Provider configuration and credential defaults.

Configuration Reference

Full TOML configuration reference.