Prerequisites
- An Auriko API key
- Python 3.10+ with the OpenAI SDK (
pip install openai) or the auriko SDK (pip install auriko)- OR Node.js 18+ with the OpenAI SDK (
npm install openai) or@auriko/sdk(npm install @auriko/sdk)
- OR Node.js 18+ with the OpenAI SDK (
- Familiarity with Routing options
How routing works
When you send a request, Auriko’s router:- Enumerates candidates — finds all providers offering the requested model(s)
- Filters by constraints — removes providers that violate your routing options (data policy, Bring Your Own Key (BYOK) requirement, performance constraints, excluded providers)
- Scores by strategy — ranks remaining candidates using your
optimizestrategy:cost: Cost-optimized, well-roundedcost-focus: Aggressively minimize cost (default)ttft: TTFT-optimized, well-roundedttft-focus: Aggressively minimize time to first tokentps: Throughput-optimized, well-roundedtps-focus: Aggressively maximize tokens per secondbalanced: All dimensions weighted evenly
- Selects and routes — selects from the ranked list, favoring higher-scored providers
- Falls back if needed — if the provider fails and
allow_fallbacksis true, retries with the next candidate (up tomax_fallback_attempts)
Use suffix shortcuts
Append a suffix to any model name for quick routing configuration:| Suffix | Strategy | Description |
|---|---|---|
:cost-focus | cost-focus | Aggressively minimize cost |
:cost | cost | Cost-optimized, well-rounded |
:ttft-focus | ttft-focus | Aggressively minimize time to first token |
:ttft | ttft | TTFT-optimized, well-rounded |
:tps-focus | tps-focus | Aggressively maximize tokens per second |
:tps | tps | Throughput-optimized, well-rounded |
:balanced | balanced | All dimensions weighted evenly |
ft:gpt-4o:org:custom) pass through unchanged.
Route across models
Passgateway.models instead of model to route across multiple models (mutually exclusive with model, max 10):
| Mode | Behavior |
|---|---|
pool (default) | Select the best-scoring provider across all requested models |
fallback | Try all providers for the first model, then the second model, and so on |
Set quality constraints
Filter providers by performance requirements. Pass constraint ceilings undergateway.routing:
| Field | Type | Description |
|---|---|---|
max_cost_per_1m | number | Maximum cost per 1 million tokens (USD) |
max_ttft_ms | integer | Maximum time to first token in milliseconds |
min_throughput_tps | number | Minimum throughput in tokens per second |
max_ttft_ms, min_throughput_tps, max_cost_per_1m) evaluate against median (p50) metrics. To rank providers by worst-case (p95) TTFT or throughput for scoring, set ttft_percentile or throughput_percentile — see Choose metric percentile.
Filter by parameter support
Not all providers support every optional parameter. By default, Auriko drops unsupported parameters and adds a warning to the response. Setrequire_parameters to true to only route to providers that accept the optional parameters you sent:
require_parameters to true, Auriko checks that your provider supports each one you sent: temperature, top_p, seed, logit_bias, logprobs, top_logprobs, n, presence_penalty, frequency_penalty, user, parallel_tool_calls, web_search_options, verbosity, prompt_cache_key, safety_identifier.
require_parameters composes with other constraints. A provider must pass all filters to be eligible. You can check which parameters each provider supports via the model directory endpoint, where each provider entry includes accepted_params and supported_parameters fields.
Set custom weights
You can override preset strategies with custom weights across three dimensions.| Dimension | Field | What it controls |
|---|---|---|
| Cost | cost | Favor lower-cost providers |
| Latency | ttft | Favor lower time-to-first-token |
| Throughput | throughput | Favor higher tokens-per-second |
routing.weights with your desired dimensions:
- The server accepts any non-negative numbers and normalizes them proportionally.
- Omitted dimensions default to 0.
- At least one dimension must be greater than 0.
weightsoverrides theoptimizepreset, and the response metadata containsrouting_strategy: "custom".- To score using worst-case metrics, set
ttft_percentileand/orthroughput_percentileto"p95". See Choose metric percentile.
Choose metric percentile
By default, Auriko scores providers using median (p50) metrics. You can switch to 95th-percentile (worst-case) independently for TTFT and throughput:| Field | Controls | Default |
|---|---|---|
ttft_percentile | TTFT scoring (which providers rank higher) | p50 |
throughput_percentile | Throughput scoring (which providers rank higher) | p50 |
"p50" (median) or "p95" (worst-case). They work with presets and custom weights — no weights required.
Example — rank providers by worst-case (p95) TTFT instead of median:
Data policy
Control how providers handle your data: Auriko doesn’t store prompts or responses. Setdata_policy: "zdr" to route only to providers that satisfy zero data retention.
| Policy | Description |
|---|---|
none (default) | No restrictions |
no_training | Provider must not use data for training |
zdr | Zero data retention — strictest policy |
zdr > no_training > none. When a per-request policy intersects with an account-level policy, the most restrictive one wins.
Opt in to premium tiers
Premium-tier offerings are excluded from routing by default. Settier to opt in:
| Value | Effect |
|---|---|
"priority" | Includes Anthropic Fast Mode offerings (2.5x speed, 6x cost) |
| omitted (default) | Excludes premium-tier offerings |
Provider alias normalization
Provider names inproviders and exclude_providers are case-insensitive and support aliases:
| Alias | Canonical name |
|---|---|
google, google_ai, googleai, gemini | google_ai_studio |
fireworks | fireworks_ai |
together | together_ai |
Configure fallbacks
By default, Auriko retries with alternative providers on 429 (rate limit), 5xx (server error), and timeout responses.| Setting | Default | Description |
|---|---|---|
allow_fallbacks | true | Enable automatic fallback to alternative providers |
max_fallback_attempts | 19 | Safety ceiling on fallback attempts beyond the primary, range 1-19 (chain length 20 total) |
timeout_ms | 120000 (streaming) / 300000 (non-streaming) | Per-attempt timeout in milliseconds. For streaming: time to first byte. For non-streaming: time to complete response |
deadline_ms | None (streaming) / 1080000 (non-streaming) | Hard wall-clock cap across all fallback attempts. Non-streaming requests default to 18 minutes; streaming has no default (connections are long-lived). Set explicitly to override |
timeout_ms. To set a hard wall-clock cap across all fallback attempts, use deadline_ms. Non-streaming requests have an 18-minute default deadline; streaming requests have no deadline (opt-in only). If the deadline is exceeded, the request fails with a timeout error.