Skip to content
OpenSmartRoute

REST API reference

Each endpoint with parameters, request and response schemas and an example request.

API version 1.0.0

Authentication

Metered endpoints accept the workspace API key as a bearer token or in the X-API-Key header. Keys are issued at signup and managed in the dashboard. Endpoints marked "No authentication" need no key.

apiKeyX-API-Key: <api key>
bearerAuthorization: Bearer <api key>
Base URL and keybash
export OSR_URL="https://<your deployment>"   # the site you signed up on
export OSR_API_KEY="osr_..."

Conventions

  • Requests and responses are JSON. Errors are {"detail": "..."} with a conventional status code; 422 lists the offending fields.
  • Every routed call returns X-Request-Id; quote it in POST /api/v1/feedback. The chat endpoint adds X-OSR-Target and X-OSR-Confidence.
  • 429 carries Retry-After; a 403 with X-Upgrade: true means the feature exists but is not in your plan.
  • The machine-readable document is served at /openapi.json and the interactive Swagger UI at /api on the API host.

Endpoint groups

Routing5 endpointsRoute a request to a target and return the decision with its trace; optionally build a plan or execute it. Report outcomes for the learners and read statistics and the audit trail.
OpenAI-compatible2 endpointsOpenAI-compatible chat completions and model listing. Point an OpenAI SDK at the platform base URL and use model: "auto"; the router chooses the model per request.
Public endpoints12 endpointsNo API key required: deployment information, the model catalogue with live statistics, rankings and self-serve signup.
Account, keys and tenants32 endpointsThe calling workspace: profile, usage, savings, activity log, API keys and tenants.
Workspaces14 endpointsOrganization workspaces: members, roles, invitations and organization SSO (browser sessions only).
Sign-in and sessions23 endpointsSign-in with GitHub, Google or an organization identity provider; browser sessions; and CLI sign-in with device codes (osr login): the CLI requests a code, the person approves it in the browser, the CLI receives a workspace API key.
Billing2 endpointsPlan upgrades through Stripe Checkout and the webhook that confirms them.
MCP server2 endpointsModel Context Protocol server for IDEs and agents (VS Code, Cursor, Claude, Windsurf): POST /mcp speaks JSON-RPC with tools to route, quote, recommend, explain and ask; GET /mcp describes it. Authenticate like the REST API.
Marketplace16 endpointsBrowse, publish, install and rate agents, skills, personas, prompts, templates and tools. Each listing has a validated manifest the router can load; GET /registry/{slug}/manifest is what registry:// references resolve to.
Model providers1 endpointModel providers: GET /providers is the public, OpenRouter-style view of what this deployment executes on (provider, upstream model, prices, health per executable target - never credentials); the /admin/providers endpoints add, check and map OpenAI-compatible endpoints at run time, and every API replica picks the change up without a restart.