Quickstart — Starting Fresh
Step 1 — Sign up for FreeRouter
Step 2 — Pick one or more gateways
FreeRouter is bring-your-own-keys (BYOK): you hold the accounts and pay the gateways directly — FreeRouter just routes across them. You only need one gateway to start, but routing gets interesting with two (failover or a cost blend). Any of these is a solid first pick:
| Gateway | Why pick it | Get a key |
|---|---|---|
| OpenRouter | Broadest model catalog; a common default primary. Keys live under its Keys page. | openrouter.ai/keys |
| Vercel AI Gateway | Fast setup if you already deploy on Vercel; a strong failover partner. Create a key from the AI Gateway API Keys page. | vercel.com/ai-gateway |
| Cloudflare AI Gateway | Edge gateway with caching and rate limiting. You'll also note your account ID and gateway name. | Get started guide |
More options — OrcaRouter, Requesty, Concentrate, LLM Gateway, Baseten, Darkbloom — are on the Providers page. Create an account on your chosen gateway(s), generate an API key on each, and keep those keys handy for the next step.
Step 3 — Add your provider keys to FreeRouter
Step 4 — Create a FreeRouter key and set a routing rule
openai) unless your code speaks another format, attach a routing rule, and copy the key — it looks like fr_live_... and is shown only once.For your first key, either rule works — pick based on how many providers you added:
Put your provider first in a priority rule. When you add a second gateway later, append it as a backup — no code changes.
A %-split rule spreads traffic across both gateways so you can compare cost, latency, and quality from day one.
The full reference — weights, failover behavior, and canary patterns — is on the Routing Rules page.
Step 5 — Integrate with your code
Point any OpenAI-compatible client at https://api.freerouter.com/v1 with your fr_live_... key. Pass a provider/model id such as openai/gpt-4o-mini — your routing rule decides which gateway actually serves it.
curl
export FREEROUTER_API_KEY="fr_live_your_key_here"
curl https://api.freerouter.com/v1/chat/completions \
-H "Authorization: Bearer $FREEROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o-mini",
"messages": [
{ "role": "user", "content": "Hello from FreeRouter!" }
]
}'
Python (openai SDK)
# pip install openai
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.freerouter.com/v1",
api_key=os.environ["FREEROUTER_API_KEY"],
)
resp = client.chat.completions.create(
model="openai/gpt-4o-mini",
messages=[
{"role": "user", "content": "Hello from FreeRouter!"},
],
)
print(resp.choices[0].message.content)
Node (openai SDK)
// npm install openai
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.freerouter.com/v1",
apiKey: process.env.FREEROUTER_API_KEY,
});
const resp = await client.chat.completions.create({
model: "openai/gpt-4o-mini",
messages: [{ role: "user", content: "Hello from FreeRouter!" }],
});
console.log(resp.choices[0].message.content);
Step 6 — Verify and tune
- Check the
X-FreeRouter-Providerresponse header — it names the gateway that served the request, so you can confirm your rule is doing what you expect. - List what's available to your key with
GET /v1/models. - Watch volume, errors, and latency on the Usage & Spend page, then rebalance weights or reorder priorities on the Routing Rules page — changes apply to the next request, no redeploy.