API quickstart

Use Sage Router from any OpenAI-compatible client.

Create a hosted API key, set one base URL, and use Sage Router profiles such as sage-router/frontier without opening anonymous model traffic.

Live /v1/models requires an active generated sk_sage_* key. The public model catalog is available at https://api.sagerouter.dev/model-catalog.

1 minute

Create a key

Sign in on the hosted account page, choose a plan or trial path, then generate an sk_sage_* key. Raw keys are shown once.

Base URL

Point your client

Use OPENAI_BASE_URL=https://api.sagerouter.dev/v1 and your generated key as OPENAI_API_KEY.

Profile

Pick a route

Start with sage-router/frontier for high-quality agent work. Pro/Max users can use sage-router/fusion when a prompt benefits from a parallel model panel and judge synthesis.

Environment

Set the OpenAI-compatible endpoint.

Environment
export OPENAI_BASE_URL=https://api.sagerouter.dev/v1
export OPENAI_API_KEY=sk_sage_your_key_here
export OPENAI_MODEL=sage-router/frontier

First request

Verify the key before wiring an agent.

Curl
curl https://api.sagerouter.dev/v1/chat/completions \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sage-router/frontier",
    "messages": [
      {"role": "user", "content": "Reply with one sentence about Sage Router."}
    ]
  }'
JavaScript

OpenAI SDK

JavaScript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY,
  baseURL: "https://api.sagerouter.dev/v1",
});

await client.chat.completions.create({
  model: "sage-router/frontier",
  messages: [{ role: "user", content: "Plan one launch task." }],
});
Python

OpenAI SDK

Python
import os

from openai import OpenAI

client = OpenAI(
    api_key=os.environ["OPENAI_API_KEY"],
    base_url="https://api.sagerouter.dev/v1",
)

client.chat.completions.create(
    model="sage-router/frontier",
    messages=[{"role": "user", "content": "Plan one launch task."}],
)
Codex

Hosted profile

Codex
mkdir -p ~/.codex
cat >> ~/.codex/config.toml <<'TOML'
[model_providers.sage-router-hosted]
name = "Sage Router Hosted"
base_url = "https://api.sagerouter.dev/v1/"
env_key = "OPENAI_API_KEY"
wire_api = "responses"

[profiles.sage-router-frontier]
model_provider = "sage-router-hosted"
model = "sage-router/frontier"
TOML

export OPENAI_API_KEY=sk_sage_your_key_here
codex --profile sage-router-frontier

Read the dedicated Codex setup page for hosted, local port 8790, and Tailnet profiles.

Premium synthesis

Call Fusion when one answer is not enough.

On Pro, Max, metered, manual, or operator-enabled accounts, sage-router/fusion runs a small panel of eligible authorized routes, then asks a judge route to synthesize one final answer. OpenRouter-style clients can also attach {"type":"openrouter:fusion"} as a premium server tool. Lite keys receive 402 fusion_plan_required.

Curl
curl https://api.sagerouter.dev/v1/chat/completions \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sage-router/fusion",
    "messages": [
      {"role": "user", "content": "Compare the strongest launch risks and give one recommendation."}
    ]
  }'
Server tool
curl https://api.sagerouter.dev/v1/chat/completions \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sage-router/frontier",
    "messages": [
      {"role": "user", "content": "Survey the strongest arguments for and against this launch."}
    ],
    "tools": [{"type": "openrouter:fusion"}],
    "tool_choice": "required"
  }'
StatusLikely causeNext action
401Missing, revoked, or inactive sk_sage_* key.Create or verify a hosted API key on the account page.
402Plan, quota, or billing state blocks routing.Choose a plan, finish checkout, or review current quota.
429Request-per-minute limit or abuse control triggered.Back off, reduce concurrency, or upgrade the plan limit.
503No healthy authorized backend route is available.Check public status, provider credentials, local router health, or fallback policy.

For safe diagnostics, response headers, and support context, read the dedicated API troubleshooting page.

Boundary

Hosted routing does not bypass provider authorization.

Sage Router sells routing, account management, quotas, analytics, and reliability infrastructure. Public plans route across customer-authorized provider access, local models, subscriptions, API keys, cloud accounts, or endpoints. Sage Router does not grant unauthorized model access, pool personal accounts, or override provider terms.