Bring Your Own Key (BYOK)
Connect your own provider API keys for 9 providers with 0% commission, automatic validation, and seamless fallback.
Overview
Bring Your Own Key (BYOK) lets you use your existing provider API keys through AllRoutes. Requests routed through your keys are always 0% commission -- you pay only what the provider charges. AllRoutes handles routing, fallback, caching, and observability on top of your keys at no extra cost.
Supported Providers
AllRoutes supports BYOK for 9 providers, including:
| Provider | Key Format | Models |
|---|---|---|
| OpenAI | sk-... | GPT-4o, GPT-4o-mini, o1, o3, DALL-E, Whisper |
| Anthropic | sk-ant-... | Claude Opus, Sonnet, Haiku |
| Google AI | AI... | Gemini 2.0 Flash, Gemini 2.0 Pro |
| Google Vertex AI | Service account JSON | Gemini, PaLM |
| Azure OpenAI | ... + endpoint | GPT-4o, GPT-4o-mini (Azure-hosted) |
| AWS Bedrock | Access key + secret | Claude, Llama, Titan |
| Mistral | ... | Mistral Large, Medium, Small |
| Cohere | ... | Command R+, Embed |
| Together AI | ... | Llama, Mixtral, open-source models |
| Groq | gsk_... | Llama, Mixtral (fast inference) |
| Fireworks | fw_... | Llama, Mixtral, custom fine-tunes |
| Perplexity | pplx-... | Sonar models with web search |
| DeepSeek | sk-... | DeepSeek V3, DeepSeek Coder |
| xAI | xai-... | Grok models |
See the full list in the dashboard under Settings > Provider Keys.
Adding a Key
Via Dashboard
- Navigate to Settings > Provider Keys
- Click Add Provider Key
- Select the provider from the dropdown
- Paste your API key
- Click Validate & Save
AllRoutes performs a one-click validation -- it sends a lightweight test request to verify the key is valid and has the expected permissions.
Via API
curl -X POST https://api.allroutes.ai/v1/keys/provider \
-H "Authorization: Bearer allroutes_sk_..." \
-H "Content-Type: application/json" \
-d '{
"provider": "openai",
"api_key": "sk-...",
"label": "Production OpenAI Key"
}'
Response:
{
"id": "pkey_abc123",
"provider": "openai",
"label": "Production OpenAI Key",
"is_valid": true,
"is_active": true,
"models_available": ["gpt-4o", "gpt-4o-mini", "o1-preview", "text-embedding-3-small"],
"created_at": "2026-04-05T10:00:00Z"
}
One-Click Validation
When you add or update a key, AllRoutes automatically:
- Tests connectivity -- sends a minimal API call to the provider
- Checks permissions -- verifies the key can access chat completions and embeddings
- Discovers models -- lists all models available with the key
- Reports quota -- shows remaining rate limits and usage (when the provider supports it)
Re-validate any key at any time:
curl -X POST https://api.allroutes.ai/v1/keys/provider/pkey_abc123/validate \
-H "Authorization: Bearer allroutes_sk_..."
How Routing Works with BYOK
When a BYOK key is active for a provider, AllRoutes uses it by default:
- Your key is tried first -- 0% commission, direct provider pricing
- If your key fails (rate limit, quota exceeded, revoked), AllRoutes falls back to the shared pool
- Fallback uses AllRoutes keys -- standard platform fee applies
This happens transparently. The response header X-AllRoutes-BYOK indicates whether your key or AllRoutes keys were used:
| Header Value | Meaning |
|---|---|
true | Request served via your BYOK key (0% commission) |
false | Request served via AllRoutes shared key (platform fee) |
fallback | Your key failed; fell back to AllRoutes key |
Fallback Configuration
Customize fallback behavior per provider:
curl -X PUT https://api.allroutes.ai/v1/keys/provider/pkey_abc123 \
-H "Authorization: Bearer allroutes_sk_..." \
-H "Content-Type: application/json" \
-d '{
"fallback": {
"enabled": true,
"on_rate_limit": true,
"on_error": true,
"on_timeout": true,
"notify": true
}
}'
| Field | Type | Default | Description |
|---|---|---|---|
enabled | boolean | true | Allow fallback to AllRoutes keys |
on_rate_limit | boolean | true | Fall back on 429 rate limit |
on_error | boolean | true | Fall back on 5xx provider errors |
on_timeout | boolean | true | Fall back on timeout |
notify | boolean | false | Send a webhook notification on fallback |
Managing Keys
List All Keys
curl https://api.allroutes.ai/v1/keys/provider \
-H "Authorization: Bearer allroutes_sk_..."
Update a Key
curl -X PUT https://api.allroutes.ai/v1/keys/provider/pkey_abc123 \
-H "Authorization: Bearer allroutes_sk_..." \
-H "Content-Type: application/json" \
-d '{"label": "Updated Label", "is_active": true}'
Delete a Key
curl -X DELETE https://api.allroutes.ai/v1/keys/provider/pkey_abc123 \
-H "Authorization: Bearer allroutes_sk_..."
0% Commission -- Always
Unlike other gateways that charge 5% or more on BYOK requests, AllRoutes BYOK is always 0% commission. You pay only what your provider charges. There is no markup, no hidden fee, and no volume threshold.
| Gateway | BYOK Commission |
|---|---|
| AllRoutes | 0% |
| OpenRouter | 5% |
| Other gateways | 3-10% |
Security
- Provider keys are encrypted at rest with AES-256
- Keys are never logged, cached, or included in broadcast payloads
- Keys are transmitted to providers over TLS 1.3
- You can revoke keys at any time from the dashboard or API
See Also
- Smart Routing -- how BYOK priority routing interacts with strategies
- Self-Hosted Models -- connect Ollama, vLLM, TGI alongside BYOK
- Migrating from OpenRouter -- migrate from a 5% BYOK gateway with 0%
- Cost Optimization -- combine BYOK with caching for max savings