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:

ProviderKey FormatModels
OpenAIsk-...GPT-4o, GPT-4o-mini, o1, o3, DALL-E, Whisper
Anthropicsk-ant-...Claude Opus, Sonnet, Haiku
Google AIAI...Gemini 2.0 Flash, Gemini 2.0 Pro
Google Vertex AIService account JSONGemini, PaLM
Azure OpenAI... + endpointGPT-4o, GPT-4o-mini (Azure-hosted)
AWS BedrockAccess key + secretClaude, Llama, Titan
Mistral...Mistral Large, Medium, Small
Cohere...Command R+, Embed
Together AI...Llama, Mixtral, open-source models
Groqgsk_...Llama, Mixtral (fast inference)
Fireworksfw_...Llama, Mixtral, custom fine-tunes
Perplexitypplx-...Sonar models with web search
DeepSeeksk-...DeepSeek V3, DeepSeek Coder
xAIxai-...Grok models

See the full list in the dashboard under Settings > Provider Keys.

Adding a Key

Via Dashboard

  1. Navigate to Settings > Provider Keys
  2. Click Add Provider Key
  3. Select the provider from the dropdown
  4. Paste your API key
  5. 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:

  1. Tests connectivity -- sends a minimal API call to the provider
  2. Checks permissions -- verifies the key can access chat completions and embeddings
  3. Discovers models -- lists all models available with the key
  4. 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:

  1. Your key is tried first -- 0% commission, direct provider pricing
  2. If your key fails (rate limit, quota exceeded, revoked), AllRoutes falls back to the shared pool
  3. 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 ValueMeaning
trueRequest served via your BYOK key (0% commission)
falseRequest served via AllRoutes shared key (platform fee)
fallbackYour 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
    }
  }'
FieldTypeDefaultDescription
enabledbooleantrueAllow fallback to AllRoutes keys
on_rate_limitbooleantrueFall back on 429 rate limit
on_errorbooleantrueFall back on 5xx provider errors
on_timeoutbooleantrueFall back on timeout
notifybooleanfalseSend 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.

GatewayBYOK Commission
AllRoutes0%
OpenRouter5%
Other gateways3-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