Gateway Quickstart
This tutorial walks you through building the gateway from source, sending your first request, and enabling security — all without Docker or the full to11 stack.Prerequisites
- Rust stable toolchain — install via rustup if you don’t have it
- One API key — an OpenAI or Anthropic API key to pass in the
Authorizationheader
1. Clone and build
target/release/gateway.
2. Define your providers
Runtime dispatch requires at least one[providers.*] entry in config.toml. The gateway treats this section as the routing table: a request can only resolve to an upstream that has an explicit record. Without a matching entry the gateway returns 404 PROVIDER_NOT_FOUND and never reaches an upstream.
The built-in provider catalog (OpenAI, Anthropic, xAI, …) is an authoring concept — it tells the gateway how to translate each upstream’s wire shape. It is not an implicit routing table. There is no “default OpenAI” or “default Anthropic” — if you want to dispatch to OpenAI, you write a [providers.openai] block.
Customers of the to11 hosted product don’t author TOML; they register providers through the API or dashboard. Both paths land on the same invariant: a defined provider record is required before the gateway will dispatch to that upstream.
Create a minimal config file at config/gateway.toml:
credential = "env::OPENAI_API_KEY" line reads from the named environment variable at gateway startup. You can omit it entirely — [providers.openai] defaults to env::OPENAI_API_KEY by convention, [providers.anthropic] to env::ANTHROPIC_API_KEY, and so on. See the full grammar in the Configuration Reference.
The gateway also supports passthrough authentication — if the
env::* variable is missing, the caller’s own Authorization header is forwarded to the upstream provider. The gateway never reads or stores provider API keys it didn’t put there itself.3. Run the gateway
127.0.0.1:4000.
4. Send a test request
5. Enable security
Add a[security] block to your config to activate inline guardrails:
400 Bad Request — the request was blocked before reaching OpenAI. PII detection (SSN, credit cards, phone numbers, emails) is also active automatically.
Next steps
Configuration
Full TOML reference — providers, telemetry, security.
API Reference
All endpoints: chat, embeddings, images, audio, files.
Telemetry
OpenTelemetry GenAI spans, metrics, and ClickHouse queries.
Streaming
Fast-path vs normalised-path streaming architecture.