Skip to content

ORBDocumentation

Orbit API reference.

A REST API under /v1. Chat completions follow the OpenAI protocol; everything else is Orbit-specific and documented here and in the OpenAPI document.

Authentication

Send your key as a bearer token: Authorization: Bearer orb_live_…. Keys are created in the app or with POST /v1/keys, shown once, and stored only as an HMAC-SHA256 hash with a server-side pepper. Each key has scopes (inference, balance:read, usage:read, agents:read, agents:write, keys:write, tools, payments) and may be bound to an agent, capped in spend, restricted to models, or given an expiry.

Chat completions

POST /v1/chat/completions accepts the OpenAI request body. Use model: "orbit/auto" for routing or any catalog id. stream: true returns server-sent events. Responses add an orbit object:

cURL
curl https://<your-orbit-host>/v1/chat/completions \
  -H "Authorization: Bearer $ORBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "orbit/auto",
    "messages": [{ "role": "user", "content": "Summarise this incident report." }],
    "max_tokens": 800
  }'
Response with orbit metadata
{
  "id": "chatcmpl-…",
  "object": "chat.completion",
  "model": "anthropic/claude-sonnet-5.5",
  "choices": [ … ],
  "usage": { "prompt_tokens": 412, "completion_tokens": 288, "total_tokens": 700 },
  "orbit": {
    "request_id": "req_…",
    "model": "anthropic/claude-sonnet-5.5",
    "routing": { "mode": "coding", "tier": 3, "explanation": "auto → coding · …", "fallback_used": false },
    "cost": { "estimated_usd": "…", "charged_usd": "…", "provider_cost_usd": "…", "fee_usd": "…" }
  }
}
  • orbit.request_id, orbit.model
  • orbit.routing — mode, tier, explanation, fallback_used
  • orbit.cost — estimated_usd, charged_usd, provider_cost_usd, fee_usd

Endpoint reference

Inference

EndpointDescriptionScope
POST/v1/chat/completionsOpenAI-compatible chat completion. Supports stream: true. Returns an orbit metadata object.inference
GET/v1/modelsModel catalog with prices, capabilities and availability.public
POST/v1/route/previewPreview Orbit Auto's choice and cost for a prompt. Never calls a model.public, rate-limited
GET/v1/requests/:idA past request: model, tokens, routing decision and cost.usage:read

Balance & usage

EndpointDescriptionScope
GET/v1/balanceAvailable and reserved credits by funding source.balance:read
GET/v1/usageRecent usage and spend.usage:read

Keys

EndpointDescriptionScope
POST/v1/keysCreate a key (optionally agent-bound, spend-capped, model-restricted). The secret is returned once.keys:write
GET/v1/keysList keys (prefix and metadata only).any key
DELETE/v1/keys/:idRevoke a key.keys:write

Agents

EndpointDescriptionScope
GET/v1/agentsAgents visible to the caller.agents:read
POST/v1/agentsCreate an agent with a policy template or custom limits and an initial allocation.agents:write
GET/v1/agents/:idOne agent with its policy and balances.agents:read
PATCH/v1/agents/:idUpdate name, status or (owners only) policy.agents:write

Payments

EndpointDescriptionScope
POST/v1/payments/authorizeAuthorize (and optionally capture) a payment. Requires an Idempotency-Key header.payments
GET/v1/paymentsList payments.payments

Tools

EndpointDescriptionScope
GET/v1/toolsBuilt-in and approved marketplace tools with availability.public
POST/v1/tools/:id/executeExecute a tool; paid tools are charged via Orbit Pay.tools
Create an agent
curl https://<your-orbit-host>/v1/agents \
  -H "Authorization: Bearer $ORBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "research-agent",
    "initial_allocation_usd": "10",
    "policy": { "template": "research" }
  }'
Authorize a payment
curl https://<your-orbit-host>/v1/payments/authorize \
  -H "Authorization: Bearer $ORBIT_API_KEY" \
  -H "Idempotency-Key: 8f1c2d4e-run-42-step-3" \
  -H "Content-Type: application/json" \
  -d '{ "payee": { "type": "tool", "id": "<tool-id>" }, "amount_usd": "0.02", "memo": "search call" }'

Errors

Errors share one shape. Include the request_id when contacting support.

Error body
{
  "error": {
    "type": "billing_error",
    "code": "daily_limit",
    "message": "agent daily spending limit reached",
    "request_id": "req_…"
  }
}
CodeHTTPMeaning
validation_error400The request body or parameters are invalid.
invalid_api_key401Missing, malformed or unknown API key.
key_revoked401The key was revoked or has expired.
insufficient_balance402Available balance cannot cover the worst-case reservation.
daily_limit402The agent (or an ancestor) would exceed its daily cap.
monthly_limit402The agent (or an ancestor) would exceed its monthly cap.
per_request_limit402The request's worst-case cost exceeds the per-request maximum.
key_spend_cap402The API key's spend cap is reached.
forbidden403The key lacks the required scope or ownership.
model_not_allowed403The model is outside the key's or agent's allowlist.
agent_paused403The agent or one of its ancestors is paused.
no_eligible_model422Orbit Auto found no model satisfying every hard constraint.
rate_limited429Too many requests (or the loop breaker is throttling).
loop_detected429The loop breaker paused the agent.
provider_error502The upstream provider failed and no cheaper-or-equal fallback succeeded.

Billing behaviour

  1. Reserve the worst case. Before calling a provider, Orbit reserves the prompt-token estimate plus max_tokens at the model's prices, plus the platform fee. If max_tokens is omitted, a default of 4,096 (capped by the model's output limit) is used.
  2. Settle on reported usage. The charge is computed from the provider-reported token counts, not Orbit's estimate.
  3. Release the remainder. The unused part of the reservation returns to your available balance immediately. Stale reservations expire.
  4. Streaming disconnects. If the client disconnects mid-stream, only the tokens actually generated are billed.
  5. Failures. If a request fails before any output, the reservation is released and nothing is charged.

All amounts are integers in nano-USD internally and rounded up to the nearest nano-dollar. See pricing for fees.

Rate limits

  • POST /v1/route/preview without a key: about 20 requests per minute per IP (operator-configurable).
  • Authenticated endpoints are limited per key; agents are additionally protected by the loop breaker (120 requests, 10 identical requests or 20 errors per minute by default).
  • Exceeding a limit returns 429 with code rate_limited (or loop_detected when an agent is paused).

OpenAPI

The machine-readable description is served by the API at /api/openapi.json (or https://<your-orbit-host>/openapi.json on the API host). It is the source of truth for request and response schemas.

Looking for MCP or SDK setup? See the developer hub.