Developer documentation

Pandoroute developer documentation

Use one OpenAI-compatible API, route by model or automatically, and track every request through the Console.

Last updated Runtime API v1 English

OpenAI-compatible Drop-in SDK base URL
Smart routing Quality, speed, and cost
Usage ledger Tokens, credits, requests

First steps

Make your first API call

The fastest path is to use Pandoroute as the base URL for an existing OpenAI-compatible client. The public site is https://pandoroute.ai/; customer API calls should use https://api.pandoroute.ai/v1.

  1. 1
    Create an API key

    Open API Keys, create a key, and keep the raw key from the one-time creation screen. Default customer scopes include model:invoke, chat:read, and chat:write.

  2. 2
    Copy the Base URL

    Open the Console connection panel and copy the Base URL: https://api.pandoroute.ai/v1. The Console helper endpoint /api/connection-info is a session-only Console API and is not part of the public runtime API.

  3. 3
    Send one chat request

    Use model: "auto" for router-owned selection, or choose a specific model from /v1/models or the Model Plaza.

Connect

Use existing OpenAI clients

Most apps only need two changes: set baseURL to Pandoroute and replace the API key. The request body stays familiar.

export PANDOROUTE_BASE_URL="https://api.pandoroute.ai/v1"
export PANDOROUTE_API_KEY="sk_sli_your_key"

curl "$PANDOROUTE_BASE_URL/chat/completions" \
  -H "Authorization: Bearer $PANDOROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto",
    "messages": [
      { "role": "user", "content": "Explain Pandoroute in one sentence." }
    ]
  }'

API reference

Runtime API surface

Customer traffic goes through the runtime service under /v1. Start with chat completions unless you specifically need Responses, Anthropic-style Messages, or file operations.

MethodEndpointUse
GET/v1/modelsList models visible to the caller's organization.
GET/v1/models/{modelId}Fetch one enabled model. Returns not found or forbidden if unavailable.
POST/v1/chat/completionsPrimary OpenAI-compatible chat endpoint. Supports streaming SSE.
POST/v1/responsesResponses-style input mapped into Pandoroute chat routing.
POST/v1/messagesAnthropic-style Messages surface for compatible clients.
POST/v1/messages/count_tokensEstimate input tokens before sending a Messages request.
POST/v1/filesUpload files for file-aware model workflows.
Authentication

Pass Authorization: Bearer sk_sli_.... Runtime also accepts x-api-key for Anthropic-style clients.

Request IDs

Responses include a request-id header. Keep it with application logs so support can trace routing and billing events.

Streaming

OpenAI-compatible streams emit SSE chunks and terminate with data: [DONE]. Billing continues to drain provider usage even if the client disconnects.

Success and streaming

Non-streaming chat requests return an OpenAI-compatible completion object. Streaming requests return server-sent events until the final data: [DONE] marker.

Non-streaming response

{
  "id": "chatcmpl_example",
  "object": "chat.completion",
  "model": "model-id-from-response",
  "choices": [{
    "index": 0,
    "message": { "role": "assistant", "content": "Hello." },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 3,
    "total_tokens": 15
  }
}

Streaming request

curl -N "$PANDOROUTE_BASE_URL/chat/completions" \
  -H "Authorization: Bearer $PANDOROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto",
    "stream": true,
    "messages": [
      { "role": "user", "content": "Write a short status update." }
    ]
  }'

HTTP status and recovery

StatusMeaningClient action
200Request accepted and completed.Read the response and usage fields.
400Invalid JSON or an unsupported request field.Fix the request before retrying.
401The API key is missing, revoked, or invalid.Create or rotate a key in the Console.
402The balance or available quota is insufficient.Top up credits or review the key budget.
403The model or resource is not available to the organization.Enable the model or request access.
404The endpoint, model, or resource does not exist.Check the model ID from /v1/models.
429A rate or concurrency limit was reached.Wait for Retry-After, then retry with backoff.
5xxA temporary runtime or provider failure occurred.Retry with backoff and inspect fallback headers.

Models and routing

Choose a model, or let the router choose

Pandoroute separates customer-facing model codes from upstream provider details. Your organization only sees models enabled by an admin. The router then picks an eligible channel based on model access, capability requirements, priority, weight, health, and fallback availability.

Specific model requests

Call GET /v1/models or open Model Plaza, then send a known model code. This is best when your app has strict quality, context, or cost expectations.

{
  "model": "YOUR_ENABLED_MODEL_ID",
  "messages": [{ "role": "user", "content": "Hello" }]
}

Automatic model routing

Send model: "auto" when the organization wants Pandoroute to choose an eligible route. The router considers request features like streaming, tool calls, and vision before selecting a target.

{
  "model": "auto",
  "stream": true,
  "messages": [{ "role": "user", "content": "Draft release notes" }]
}
AccessOrg model enabled
AbilityTools, vision, stream
RoutePriority and weight
ProtectQuota and circuit state

Billing and usage

Billing authorization and settlement

Pandoroute reserves estimated quota and billing capacity before the provider call, then settles against actual usage after completion. That keeps quota enforcement predictable during concurrent traffic and gives finance teams a request-level ledger.

Before request Quota reservation

Checks API key status, organization status, enabled model access, key rate limits, and estimated cost.

After response Credit settlement

Calculates billable input, output, cache, and tool dimensions from provider usage.

In console Usage analytics

View requests, tokens, credits, latency, status, model usage, and usage by key.

Console session API

These routes support the signed-in Console interface. They use the Console session rather than the public /v1 API key contract and may change with the Console UI.

MethodEndpointUse
GET/api/usage/summaryAggregate by model with optional time range and comparison.
GET/api/usage/summary/by-keyAggregate by API key and project.
GET/api/usage/recordsRequest-level rows with token, latency, credit, status, and time.
GET/api/billing/ledgerLedger entries for customer credit movement.

Errors and fallback

API failures and fallback

Runtime errors use a stable JSON shape with a request ID. Rate limits and temporary service pressure include Retry-After. Fallback responses expose degradation metadata so your app can decide whether to display, retry, or audit the result.

Error response body

{
  "type": "error",
  "error": {
    "type": "rate_limit_error",
    "message": "API key rate limit exceeded"
  },
  "request_id": "req_..."
}

Fallback response headers

X-SKYLINE-Degraded: true
X-SKYLINE-Fallback-Reason: channel_unhealthy
X-SKYLINE-Fallback-From: MODEL_ID_BEFORE_FALLBACK
X-SKYLINE-Fallback-To: MODEL_ID_AFTER_FALLBACK

Console workflow

Operate the gateway from the customer UI

The docs map directly to the current Console navigation so operators and developers use the same terms.

User API Keys

Create, rotate, disable, and delete keys. Copy the Base URL and first cURL from the quick-connect panel.

User Model Plaza

Search enabled models by provider, capability, model code, context window, and per-token pricing.

User Usage

Review by model, by key, or at request-detail level with credits, tokens, latency, and status.

Org Admin Available Models

Enable or disable models distributed to the organization and manage member quotas.

Super Admin Provider Services

Register provider base URLs, discover models, map channels, and set pricing dimensions.

Super Admin Routing

Bind model abilities to channels, priority, weight, provider model codes, and adapter regions.

Desktop setup

Pandoroute Connector guides

These Chinese-language guides cover installing the desktop Connector, attaching supported clients, and recovering from failed attach or detach operations.

Before live traffic

Client go-live checklist

Use this as a final client-integration check before an app sends real traffic through Pandoroute. It is not a platform production runbook.