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

Migrate from Portkey

← All migration guides

Gatewayone-line swap

Replace one gateway with another — or keep Portkey and add BharatRouter as a target.

The change

Before — Portkey

from openai import OpenAI

client = OpenAI(
    base_url="https://api.portkey.ai/v1",
    api_key="...",
    default_headers={"x-portkey-api-key": "...", "x-portkey-config": "..."},
)

After — BharatRouter

from openai import OpenAI

client = OpenAI(
    base_url="https://api.bharatrouter.com/v1",
    api_key="br-...",
)
# no x-portkey-* headers needed

What maps to what

PortkeyBharatRouter
x-portkey-config (routing config)Saved Collections (versioned chains)
on_status_codes retry/fallbackAutomatic circuit-breaker failover (config adapter on the roadmap)
Virtual keysBYOK (encrypted provider keys) + per-key budgets
x-portkey-* headersBody extensions: optimize, provider, data_policy

What you gain

  • India data-residency and INR billing — neither is Portkey's focus.
  • Drop the extra header plumbing; routing lives in the request body or a Collection.

Watch out for

  • Portkey config JSON doesn't import yet — recreate the chain as a Collection (a paste-in adapter is on the roadmap).
  • Prefer not to switch? Add api.bharatrouter.com/v1 as an OpenAI target inside Portkey.

Stuck on a migration? Email [email protected], see the FAQ, or keep your accounts and rates with BYOK.