All posts

June 28, 2026

Bring your own keys — every provider behind one API

Connect the provider keys and subscriptions you already pay for, route them through one OpenAI-compatible URL with automatic failover, and — soon — earn credits back by donating idle quota to the shared pool.

Use the keys you already pay for

Bring Your Own Key (BYOK) lets you attach your own upstream provider keys — OpenAI, Anthropic, Google, and dozens more — to your AnyRouter account. When a request matches a model one of your keys can serve, AnyRouter forwards the call on your key. You keep every AnyRouter feature — one unified API, logs, analytics, presets, routing, app attribution — and pay the provider directly at their list price.

If you already hold provider accounts with credits, negotiated rates, preview access, or a flat-rate coding subscription, BYOK is the simplest way to put all of them behind a single OpenAI- and Anthropic-compatible endpoint. Point your existing client at the AnyRouter base URL, keep your model ids, and your own keys do the work.

What you get

BYOK turns a pile of separate provider accounts into one resilient endpoint:

  • No markup on your own keys. AnyRouter charges nothing for BYOK traffic — no per-request fee, no surcharge, no minimum. You only ever pay your provider.
  • Keep your own rate limits. You route on your account's quota, not a shared pool — so your limits are exactly what your provider gives you.
  • Automatic failover. Add more than one key per provider and AnyRouter spreads traffic across them, quarantining a key that returns 401 or 429 and moving to the next — a single burned key stops being a single point of failure.
  • Load-balancing strategies. Choose Fallback (priority order), Round Robin, Weighted, or Random for each provider's key pool.
  • Falls back to credits. If every BYOK key for a provider is exhausted, requests can fall through to pay-as-you-go credits — so work keeps flowing.

Providers you can connect

AnyRouter exposes BYOK for more than 60 providers. A few of the most common, with the key format each expects:

ProviderKey formatNotes
OpenAIsk-…Optional org/project headers via the Base URL field
Anthropicsk-ant-…Claude models
Google AI Studio (Gemini)AIzaSy…Free tier available for Gemini Flash and Pro
Groqgsk_…Fast inference
OpenRoutersk-or-…Pin AnyRouter catalog models to your OpenRouter key via presets
NVIDIA NIMnvapi-…NVIDIA API catalog
Z.aiAPI keyStandard or GLM Coding Plan endpoint
Ollama CloudAPI keyHosted open models

Enterprise endpoints like Azure OpenAI, Amazon Bedrock, and Vertex AI accept structured credentials — the dialog shows the expected format when you pick the provider. The full provider-by-provider setup guide, including where to generate each key, lives at /docs/features/byok-providers.

Add a key in under a minute

Adding a key is a paste-and-save flow on the BYOK page:

  1. Open the BYOK page at /byok (or Dashboard → BYOK) and click Add key on the provider you want.
  2. Paste your provider API key. The value is write-only — once saved, AnyRouter never displays it again.
  3. Optionally give it an alias, set a priority and weight for load balancing, or scope it to specific AnyRouter keys.
  4. Click Save. AnyRouter runs one live validation call against the provider; if the key is rejected, the error is surfaced and nothing is stored.

Route across your whole pool

Once you've added one or more keys, three built-in model ids route across all of them without naming a specific model — AnyRouter picks the strongest available model and falls back through the rest if a provider is busy:

Model idRoutes to
anyrouter/byokEvery model your configured keys can reach
anyrouter/codingThe coding-capable subset
anyrouter/agentThe tool / function-calling subset, built for agents

Use them anywhere you'd use a normal model id. Add a key for a new provider and its models join the pool automatically — no config change:

bash
curl https://anyrouter.dev/api/v1/chat/completions \
  -H "Authorization: Bearer $ANYROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anyrouter/coding",
    "messages": [{ "role": "user", "content": "Refactor this function" }]
  }'

Because these only ever use your own keys, they never spend AnyRouter credits. Call one with no matching key and you get a clear error telling you to add a key — never a silent charge to paid capacity.

Built to protect your keys

BYOK keys are sensitive credentials, and AnyRouter treats them that way:

  • Encrypted at rest with a per-row salt — a leak of one key's ciphertext never weakens any other.
  • Write-only in the UI — after save, only the alias and a masked identifier are shown; the full value can't be retrieved.
  • Never logged — provider keys are stripped from request and response logs, keeping only the alias and provider so you can tell which credential served a request.
  • Validated live on save, then the validation response is discarded.
  • No third-party sharing — your key is only ever sent to the upstream provider it's scoped to.

Get started

Open /byok to connect your first provider key, then point any OpenAI- or Anthropic-compatible client at https://anyrouter.dev/api/v1 and start routing on your own accounts at no extra cost.

For the full feature reference, see /docs/features/byok. For step-by-step instructions on generating a key from each provider, see /docs/features/byok-providers.

Route your first request in 2 minutes

Free $2 credit when you sign up — no card required. Use our credits, or connect your own keys.

Start free