Skip to content
OpenSmartRoute
Documentation
Get started

Platform quickstart

Five minutes to a first routed request: workspace, API key, POST /api/v1/route, the OpenAI-compatible endpoint, feedback.

Route your first request through the hosted platform in about five minutes: create a workspace, get an API key, ask the router for a decision, let it execute the answer, and report how it went. Every call shown here is documented in full in the platform guide and in the REST API reference at /docs/api.

1. Create a workspace and an API key

Sign up at opensmartroute.ai/platform/signup with GitHub, Google, Microsoft or an email address. Signup creates a personal workspace on the free plan and issues an API key - it is shown once, so store it in a secret manager. More keys can be created, renamed, rotated and revoked on the keys page of the dashboard.

Send the key with every request in either header:

Authorization: Bearer osr_...
X-API-Key: osr_...

Prefer the terminal? Install the CLI and sign in with a browser hand-shake instead of copying keys:

curl -LsSf https://opensmartroute.ai/install.sh | sh   # Windows: irm https://opensmartroute.ai/install.ps1 | iex
osr login        # opens the browser, mints a key for this machine
osr whoami       # workspace, plan, edition behind the stored credential

2. Route a request

POST /api/v1/route returns a decision: the chosen target, the confidence, ranked alternatives, the signals the router extracted and a human-readable explanation. Nothing is executed yet.

curl -s https://api.opensmartroute.ai/api/v1/route \
  -H "Authorization: Bearer $OSR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Prove that sqrt(2) is irrational.", "top_k": 3}'
{
  "request_id": "7f3c...",
  "target": {"id": "llm-frontier", "kind": "llm", "name": "Frontier model"},
  "confidence": 0.81,
  "alternatives": [{"id": "llm-mid", "kind": "llm", "utility": 0.62}],
  "signals": {"complexity": 0.74, "domains": ["math"], "reasoning_need": 0.9, "contains_pii": false},
  "explanation": "llm-frontier: high reasoning need, math domain, quality weight dominates ..."
}

Two request fields cover most needs:

  • objective trades quality, cost and latency per request: {"objective": {"quality": 1.0, "cost": 0.5}} prefers cheaper targets whenever quality allows.
  • constraints are hard limits, never traded off: {"constraints": {"max_cost_per_1k": 0.005, "data_boundary": "private"}} removes every target that stores data less strictly or costs more, and the response's policy_rejections says which target was dropped and why.

The full field tables - history, context, tenant, kinds, plans - are in the platform guide.

3. Get the answer, not just the decision

The simplest way is the OpenAI-compatible endpoint: point any OpenAI SDK at /v1 and set model to auto. The router chooses the target per request, runs it and returns a standard chat.completion whose model field is the target that answered; set stream: true and each provider token is relayed as it arrives.

from openai import OpenAI

client = OpenAI(base_url="https://api.opensmartroute.ai/v1", api_key=OSR_API_KEY)
reply = client.chat.completions.create(
    model="auto",
    messages=[{"role": "user", "content": "Write a haiku about routing."}],
)
print(reply.model)                        # the target the router chose, e.g. "llm-small"
print(reply.choices[0].message.content)

Decision metadata (request id, confidence, alternatives, cost) rides along in an opensmartroute object that other clients ignore. A models list makes the router choose among your candidates and fall back down the list when a target fails. On the pro plan and above, POST /api/v1/route with "execute": true does the same for any target kind - agents, skills, tools - and returns the output in result.

4. Report the outcome

The learners (Bradley-Terry, IRT, LinUCB) improve on your own traffic when you tell the platform how an answer turned out (pro plan and above):

curl -s https://api.opensmartroute.ai/api/v1/feedback \
  -H "Authorization: Bearer $OSR_API_KEY" -H "Content-Type: application/json" \
  -d '{"request_id": "7f3c...", "target_id": "llm-frontier", "success": true, "quality": 0.9}'

The dashboard has the same form without curl: expand a row on the activity page and report good or poor, a quality score and, optionally, the target that would have done better.

Where next