⚡ New — Kimi K3 is live: bring your own Moonshot key →
Documentation

Unlock more models with your own key

← Cookbook

Bring your own provider key to ride your account and rates, with BharatRouter routing on top.

upstream_key (BYOK)AccessIntermediate8 min

BYOK ("bring your own key") lets you use a provider you already have an account with — Krutrim Cloud, Sarvam, Mistral and 25+ more — through BharatRouter. You keep your negotiated rates and pay the upstream directly; BharatRouter adds routing, failover and residency on top.

You'll use: a saved BYOK key or the inline upstream_key field. Reference: BYOK.

Option A — save the key once (recommended)

On the dashboard, add the provider key under BYOK. It's encrypted at rest (AES-256-GCM), never shown again, and used only in-flight. After that, just request the model — the gateway uses your key automatically.

Option B — pass it inline per request

curl https://api.bharatrouter.com/v1/chat/completions \
  -H "Authorization: Bearer br-..." -H "Content-Type: application/json" \
  -d '{
    "model": "gemma-4-e4b-it",
    "messages": [{"role": "user", "content": "namaste"}],
    "provider": "krutrim",
    "upstream_key": "YOUR_KRUTRIM_CLOUD_KEY"
  }'

How it works

  • The upstream_key is used to authenticate to the provider for that request only — never stored, never logged.
  • Saved BYOK keys live encrypted in the gateway and are decrypted in memory at call time.
  • Usage on a BYOK route is billed by the upstream provider to you; BharatRouter does not meter the spend.

BYOK unlocks the model but routes to your provider — so a non-India upstream is offshore. Combine with india_only only for India-resident providers.

More recipes in the Cookbook, or see the fullAPI reference.