Quickstart — Migrating from a Gateway
The two changes
First, bring your current gateway's API key with you: paste it under Providers and create a FreeRouter key routed to it, with the key's API shape set to the format your client speaks — the three dashboard steps are in Getting Started. Then change two values in your code:
| You call today | Base URL before | Base URL after | Key before → after | Key shape |
|---|---|---|---|---|
| OpenAI | https://api.openai.com/v1 | https://api.freerouter.com/v1 | sk-… → fr_live_… | openai |
| OpenRouter | https://openrouter.ai/api/v1 | https://api.freerouter.com/v1 | sk-or-… → fr_live_… | openrouter (body forwarded verbatim) |
| Vercel AI Gateway | https://ai-gateway.vercel.sh/v1 | https://api.freerouter.com/v1 | your gateway's API key → fr_live_… | openai |
| Cloudflare AI Gateway | https://gateway.ai.cloudflare.com/v1/{account}/{gateway}/openai | https://api.freerouter.com/v1 | API token → fr_live_… | openai |
| Anthropic | https://api.anthropic.com | https://api.freerouter.com (no /v1) | sk-ant-… → fr_live_… (as x-api-key) | anthropic |
| Gemini | https://generativelanguage.googleapis.com/v1beta | https://api.freerouter.com/v1 — /models/{model}:generateContent only | AIza… → fr_live_… (as x-goog-api-key) | google |
The account id, gateway name or project your old URL carried is gone from your code: FreeRouter stores those with the provider key. Model ids are provider/model everywhere, e.g. openai/gpt-4o-mini.
Migration assistant — generate an agent prompt
Switching from another gateway? Use the wizard below to construct a prompt you can paste into your coding agent. The prompt asks the agent to study the FreeRouter docs and your code, then come back with a migration plan for your review — not to start rewriting code.
Step 1 — Which gateway do you use today?
Step 3 — Paste this prompt into your agent
Raw HTTP with curl
The request is byte-for-byte what you send the gateway today; only the host and the key differ. "stream": true returns server-sent events exactly as before:
curl https://api.freerouter.com/v1/chat/completions \
-H "Authorization: Bearer $FREEROUTER_API_KEY" \
-H "Content-Type: application/json" \
-N \
-d '{
"model": "openai/gpt-4o-mini",
"stream": true,
"messages": [{ "role": "user", "content": "Count to 3." }]
}'
In your SDK
OpenAI Python and Node, Anthropic Python and Node, Claude Code, Vercel AI SDK, LangChain, LiteLLM, the Responses API, Gemini, or just two environment variables — each with a before/after and a streaming variant — are in Use your SDK.
Verify
- The response carries
X-FreeRouter-Providernaming the gateway that answered;GET /v1/modelslists what the key can reach. - A 401, 402 or 404 on the first call has a one-line fix in Troubleshooting — the Anthropic SDK's
/v1-on-the-base-URL mistake and the unfunded-account 402 are the usual two.
Choosing a model
Pass a model string in the model field. FreeRouter uses provider/model style identifiers so a request is unambiguous across gateways — for example openai/gpt-4o-mini or anthropic/claude-haiku-5.5. Your routing rule then decides which gateway actually serves that model. List what's available with the /v1/models endpoint.