Quickstart
Send your first AnyRouter request by pointing any OpenAI-compatible client at one base URL.
AnyRouter is an OpenAI- and Anthropic-compatible LLM gateway. One API key reaches hundreds of models, with automatic failover, free models, bring-your-own-key at $0 markup, and a shared key Pool. Three settings stay the same in every client:
| Setting | Value |
|---|---|
| Base URL | https://anyrouter.dev/api/v1 |
| API key | your sk-ar-v1-… inference key |
| Model id | provider/model, e.g. anyrouter/free (free models need Go) |
Make your first request
-
Create a key in the dashboard. No card required.
-
A new account starts at $0 balance. Before a paid-model call, top up, subscribe to Go ($2/mo, includes $4/mo credits), or donate a provider key to unlock Go free. See Credits & Billing.
-
Export the key and send a request:
export ANYROUTER_API_KEY="sk-ar-v1-your-key" curl https://anyrouter.dev/api/v1/chat/completions \ -H "Authorization: Bearer $ANYROUTER_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "anyrouter/free", "messages": [{"role": "user", "content": "Hello!"}] }'
Add "stream": true to get server-sent events.
Use a client
from openai import OpenAI
client = OpenAI(
base_url="https://anyrouter.dev/api/v1",
api_key="sk-ar-v1-your-key",
)
response = client.chat.completions.create(
model="anyrouter/free",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)import OpenAI from "openai"
const client = new OpenAI({
baseURL: "https://anyrouter.dev/api/v1",
apiKey: "sk-ar-v1-your-key",
})
const response = await client.chat.completions.create({
model: "anyrouter/free",
messages: [{ role: "user", content: "Hello!" }],
})
console.log(response.choices[0].message.content)npm install @anyr/sdk. The client reads ANYROUTER_API_KEY when you omit the key and sends attribution headers automatically (app attribution).
import { AnyRouter } from "@anyr/sdk"
const client = new AnyRouter()
const completion = await client.chat.completions.create({
model: "anyrouter/free",
messages: [{ role: "user", content: "Hello!" }],
})
console.log(completion.choices[0].message.content)See the SDK guide and Chat Completions API.
import { createOpenAI } from "@ai-sdk/openai"
const anyrouter = createOpenAI({
baseURL: "https://anyrouter.dev/api/v1",
apiKey: process.env.ANYROUTER_API_KEY,
})
const model = anyrouter("anyrouter/free")Launch a coding agent
curl -fsSL https://anyrouter.dev/cli.sh | bash
anyr auth login
anyr claude --install --okSee the AnyRouter CLI and Grok Bot, Herdr, and Anyr CLI.
Choose a model
Browse the models page or call GET /api/v1/models with your key.
| Model id | Notes |
|---|---|
anyrouter/free | Routes to a working free model. Needs Go ($2/mo, or free with one donated key) |
anthropic/claude-sonnet-4-6 | 1M context, strong coding |
anthropic/claude-haiku-4-5 | Fast and cheap |
google/gemini-3.1-pro | Multimodal, long context |
AnyRouter routes requests to third-party models. Models and outputs are provided as is, with no warranty; you use them at your own risk. Disclaimer