One API. More than one option.
Keep the OpenAI SDK you already know. Change the base URL to connect your existing app to your local gateway.
One endpoint. Multiple AI providers.
Let Free Router handle routing, keys, and failover.
Keep your focus on what you’re building.
From your first request to your next idea.
The essentials are already here.
Keep the OpenAI SDK you already know. Change the base URL to connect your existing app to your local gateway.
Up to 16 keys per provider, rotated per request. Add keys, remove them, or change priorities without restarting.
Failed keys cool down while available keys take over. Switch providers before the response starts, without replaying a running stream.
A built-in Pi coding agent reads code, edits files, and runs tests, using the gateway you’ve already configured.
Your keys stay on your machine.Credentials are managed by the local Rust backend, never persisted in your browser.
LOCAL FIRSTThree steps from provider keys to your app.
Run the desktop app or start from source. The default gateway listens locally on port 8787.
Desktop / Web / CLIAdd provider API keys in Settings, choose your preferred provider, and generate a gateway key.
Bring your own API keysSet the base URL and gateway key in your app. Choose space-bunny and let the gateway handle routing.
Same SDK. Familiar workflow.No new API to learn.
Pick your language and send your first request.
import os
from openai import OpenAI
client = OpenAI(
base_url="http://127.0.0.1:8787/v1",
api_key=os.environ["GATEWAY_API_KEY"],
)
response = client.chat.completions.create(
model="space-bunny",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)curl http://127.0.0.1:8787/v1/chat/completions \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $GATEWAY_API_KEY" \
-d '{
"model": "space-bunny",
"messages": [
{"role": "user", "content": "Hello!"}
],
"stream": true
}'import OpenAI from "openai";
const client = new OpenAI({
baseURL: "http://127.0.0.1:8787/v1",
apiKey: process.env.GATEWAY_API_KEY,
});
const response = await client.chat.completions.create({
model: "space-bunny",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);About the API, your keys, and what’s next.
Join the conversation on GitHubFree Router is an AI gateway that runs on your machine. It connects OpenRouter, OpenCode Zen, and Command Code through one OpenAI-compatible API, with a settings UI, playground, and Pi coding agent.
The source is available on GitHub. Model pricing, quotas, and availability are determined by each upstream provider. You bring your own provider API keys; Free Router does not promise unlimited or universally free model access.
It supports Chat Completions and model listing, with pass-through SSE, tool calls, and multimodal parameters. Use space-bunny for automatic routing or a provider prefix to select an upstream. Command Code also accepts other Chat Completions model IDs. Responses and Anthropic Messages conversion are not currently implemented.
Provider keys are managed by the local Rust backend and saved in local configuration files with Unix permissions of 0600. Saved provider keys are not returned to the UI or persisted in browser storage.
The gateway tries other available keys in the pool. Automatic routing can also switch providers. Failed keys enter cooldown based on the error. Retries happen before response headers are sent; a stream that has started is never replayed, avoiding duplicated output.
Pi Agent uses your existing gateway configuration to read code, create and edit files, and run commands and tests in a chosen directory. Tasks can be stopped. Tools run with your local user permissions; the working directory is not a sandbox, so use it in a trusted local environment.
One local gateway. Whatever you want to build next.
Start on GitHub