MiaRouter logo
MIAROUTER DOCS
Open Console ↗

Connect Your Agents

ONE BASE URL · EVERY CLIENT · NO SHIMS

Everything points at https://miarouter.online with an sk-… key from Keys. Claude-native clients hit /v1/messages, OpenAI-native clients hit /v1/chat/completions, Gemini clients hit /v1beta. The model you configure must exist in the catalog — copy names exactly.

1Claude Code

Claude Code reads its provider from ~/.claude/settings.json (global) or .claude/settings.json (per project). Set the env block:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://miarouter.online",
    "ANTHROPIC_AUTH_TOKEN": "sk-YOUR-KEY"
  }
}

Then pick a model from the catalog, either in the settings file ("model": "claude-sonnet-5") or interactively with /model. Verify inside a session:

claude
> /model        # pick a MiaRouter model
> /status       # shows the active base URL
API key vs auth token

ANTHROPIC_AUTH_TOKEN sends Authorization: Bearer …; ANTHROPIC_API_KEY sends x-api-key: …. MiaRouter accepts both on /v1/messages — use AUTH_TOKEN so proxies that strip Authorization are your only failure mode.

2Codex CLI

Codex needs two files: the key, and a provider entry that overrides OpenAI's endpoint. First, export the key where Codex can read it (or use auth.json):

export MIAROUTER_API_KEY="sk-YOUR-KEY"

~/.codex/auth.json (alternative to the env var — used by the default provider):

{
  "OPENAI_API_KEY": "sk-YOUR-KEY"
}

~/.codex/config.toml:

model = "claude-sonnet-5"
model_provider = "miarouter"

[model_providers.miarouter]
name = "MiaRouter"
base_url = "https://miarouter.online/v1"
wire_api = "chat"
env_key = "MIAROUTER_API_KEY"
FieldNotes
modelAny catalog model that speaks the OpenAI wire format. The Claude models in the catalog do — verify on the model card.
wire_api"chat" → /v1/chat/completions (broadest compatibility). "responses" → /v1/responses, which MiaRouter also serves.
env_keyThe env var Codex loads the key from for this provider.

3Cursor

  1. Open Cursor → Settings → Models.
  2. Enable the OpenAI API Key override and paste your sk-… key.
  3. Set Override OpenAI Base URL to https://miarouter.online/v1.
  4. Add the models you want to use (exact names from the pricing page, e.g. claude-sonnet-5) and press Verify.

For tab/inline completions Cursor may still use its own infrastructure — the override governs chat/cmd-K requests. Per-project, some Cursor versions also honor a .cursor/settings.json; the UI path above is the reliable one across versions.

4Gemini CLI

MiaRouter speaks the Gemini wire format on /v1beta, so the Gemini CLI needs only two env vars:

export GEMINI_API_KEY="sk-YOUR-KEY"
export GOOGLE_GEMINI_BASE_URL="https://miarouter.online"

The CLI appends the /v1beta paths itself, including the ?key= auth style, which the gateway bridges.

5Anything OpenAI-compatible

Cline, Zed, Continue, LibreChat, Roo, your own code — the recipe is identical:

FieldValue
Base URLhttps://miarouter.online/v1
API keysk-…
Modelexact name from the pricing page

Python (openai SDK):

from openai import OpenAI

client = OpenAI(
    base_url="https://miarouter.online/v1",
    api_key="sk-YOUR-KEY",
)
resp = client.chat.completions.create(
    model="claude-sonnet-5",
    messages=[{"role": "user", "content": "hello"}],
)
print(resp.choices[0].message.content)

Node (openai SDK):

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://miarouter.online/v1",
  apiKey: process.env.MIAROUTER_API_KEY,
});
const resp = await client.chat.completions.create({
  model: "claude-sonnet-5",
  messages: [{ role: "user", content: "hello" }],
});

Anthropic SDK (Claude wire format):

import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  baseURL: "https://miarouter.online",
  apiKey: process.env.MIAROUTER_API_KEY,
});

6Sanity-check any client in 5 seconds

curl https://miarouter.online/v1/models \
  -H "Authorization: Bearer sk-YOUR-KEY"

A key list in your catalog means auth, key state, and routing are all healthy. From there, every failure is client config — see Error Reference.

Env hygiene

Put keys in environment variables or your OS keychain, never in committed files. A key that appears in a public repo is burned the moment it is seen — disable it yourself before anyone else does.