API Documentation

SageRouter — OpenAI-compatible LLM API router

SageRouter is an OpenAI-compatible API router that gives you a single endpoint to access a curated selection of large language models. Swap in your SageRouter key wherever you use the OpenAI SDK — no code changes required beyond the base URL and key.

This page covers everything you need to make your first request, pick models, understand rate limits, and manage your usage and billing.

On this page
  1. Overview
  2. Quickstart
  3. Authentication
  4. Making Requests
  5. Listing & Choosing Models
  6. Pricing
  7. Rate Limits
  8. Usage & Billing
  9. Team / Invites
  10. Support

1. Overview

SageRouter sits between your application and multiple upstream LLM providers. You send a standard OpenAI-format POST /v1/chat/completions request; SageRouter authenticates your key, checks your balance, routes the request to the best available upstream for the model you chose, meters the tokens consumed, and returns the response verbatim — streaming or non-streaming, exactly as the upstream returned it.

Key design points:

2. Quickstart

  1. Log in to the portal and create an API key under API Keys.
  2. Add credit to your account under Billing.
  3. Set your base URL to https://sagerouter.ai/v1 and replace your existing OpenAI key with your new SageRouter key.
  4. Make a request — example below.
curl https://sagerouter.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-sr-your-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5.2",
    "messages": [{"role": "user", "content": "Hello, world!"}]
  }'

3. Authentication

All API requests require a bearer token in the Authorization header:

Authorization: Bearer sk-sr-your-key-here

API keys are created in the portal under API Keys. Each key:

Keep your key secret. If a key is exposed, revoke it from the portal immediately and create a new one. Never commit keys to source control.

Tags

You can attach a tag string when creating a key. Every usage record made with that key inherits the tag, letting you break down spend by project, environment, or team in the usage dashboard.

4. Making Requests

POST /v1/chat/completions

The request body is the standard OpenAI chat completions format. The model field must be a client-facing model name returned by GET /v1/models.

Non-streaming

curl https://sagerouter.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-sr-your-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kimi-k2.7-code",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user",   "content": "Explain tail recursion in one paragraph."}
    ],
    "max_tokens": 512
  }'

Streaming (server-sent events)

Add "stream": true to receive a token-by-token stream in the standard OpenAI SSE format:

curl https://sagerouter.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-sr-your-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5.2",
    "messages": [{"role": "user", "content": "Count to 5."}],
    "stream": true
  }'

OpenAI Python SDK

from openai import OpenAI

client = OpenAI(
    api_key="sk-sr-your-key-here",
    base_url="https://sagerouter.ai/v1",
)

response = client.chat.completions.create(
    model="glm-5.2",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)

OpenAI Node.js / TypeScript SDK

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "sk-sr-your-key-here",
  baseURL: "https://sagerouter.ai/v1",
});

const response = await client.chat.completions.create({
  model: "glm-5.2",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);

5. Listing & Choosing Models

GET /v1/models

Returns the list of models currently available on your account, in OpenAI-compatible format:

curl https://sagerouter.ai/v1/models \
  -H "Authorization: Bearer sk-sr-your-key-here"

Each object in the data array has an id field. Use that id as the model value in your chat completions request.

Client model names

SageRouter uses client-facing model names that may differ from the upstream provider's internal model ID. You always use the client-facing name — the router translates it to the correct upstream ID automatically. The names in GET /v1/models are always the ones you should send.

Example models

Model name Description
glm-5.2 GLM-5.2 — fast, cost-efficient general-purpose model
kimi-k2.7-code Kimi K2.7 optimised for coding tasks
claude-sonnet-5 Claude Sonnet 5 — balanced capability and speed
MiniMax-M2.5 MiniMax M2.5 — long-context multimodal model

The full live list is always authoritative — check GET /v1/models or the portal Models tab for what is currently available and priced on your account.

6. Pricing

SageRouter bills per token, with separate rates for input (prompt) tokens and output (completion) tokens. Rates vary by model and are visible in the portal on the Models tab, which shows the SageRouter price alongside the equivalent upstream rate for reference.

A few billing mechanics worth knowing:

To add credit or review current rates, visit the portal.

7. Rate Limits

Rate limits are enforced at two levels: requests per minute per API key, and requests per day per account. Limits depend on your account tier:

Tier Req / min (per key) Req / day (per account)
Trial 20 1,000
Standard 60 20,000
Burst 240 100,000

When a limit is exceeded the API returns HTTP 429 Too Many Requests with a Retry-After header indicating how many seconds to wait before retrying. The per-minute window resets on a rolling 60-second basis; the per-day window resets on a rolling 24-hour basis.

Tier upgrades are handled by the SageRouter team. Contact support@sagerouter.ai if your workload requires a higher tier.

Tip: If you have multiple API keys under the same account, the per-minute limit applies independently to each key, but the per-day ceiling is shared across all keys on the account.

8. Usage & Billing

Usage dashboard

The portal Usage tab (GET /portal/usage) shows your last 200 requests with token counts, cost, model, and tag. You can filter by tag to see usage for a specific project or key.

The summary view breaks down spend by tag and by API key, so you can see at a glance which project or key is driving costs.

CSV export

To download your full usage history as a CSV file, use:

GET /portal/usage/export

This endpoint accepts optional query parameters to filter by date range or tag. The file is offered as a download from the portal — click Export CSV in the Usage tab, or call the endpoint directly with your session cookie.

Billing history

Your deposit history, usage charges, and any balance adjustments are available at:

GET /portal/billing/history

The portal Billing tab surfaces this as a chronological ledger showing deposits, daily usage roll-ups, and any manual adjustments.

Balance alerts

SageRouter can notify you when your balance drops below a threshold. Configure low-balance alerts in the portal under Billing → Alerts. You can also set usage-spike alerts if a single day's spend exceeds a threshold you define.

9. Team / Invites

A SageRouter account can have multiple members. Account owners can invite additional team members by email:

  1. Go to the portal Team tab.
  2. Enter the invitee's email address and choose a role (owner or member).
  3. The invitee receives an email with a secure one-time link to set their password and join the account.

Roles:

Role Capabilities
Owner Full access: billing, API keys, invites, account settings
Member Can create and revoke API keys; read-only access to usage; no billing changes

Pending invites are shown in the Team tab. An invite link expires if unused; re-invite to generate a fresh link.

10. Support & Contact

For questions, billing issues, tier upgrade requests, or anything else:

SageRouter is a product of Sage AI LLC. Registered address: 30 N Gould St #55688, Sheridan, WY 82801, United States.