Skip to content

Router Documentation

Build with open models through one familiar API. Explore the guides, choose your model, and make your first connection.

How the pieces fit

Your application talks only to Router. Router checks each request, selects eligible capacity, and relays the provider's output back to you.

Illustration
Exploded diagram: your application, Router, and provider computers stacked as three layers connected by request and response paths.OptimAI Router/v1 · one API key
Illustration of how the pieces relate. It does not show live traffic, providers, or capacity.

Your model, your code

Use an OpenAI client or a simple HTTP request. Choose a supported model, send a message, and receive a complete answer or stream it into your application.

Request
ROUTER_REQUEST_ID="$(uuidgen)" # Reuse this ID if you retry the same request.curl "$ROUTER_BASE_URL/chat/completions" \  -H "Authorization: Bearer $ROUTER_API_KEY" \  -H "Idempotency-Key: $ROUTER_REQUEST_ID" \  -H "X-Max-Charge-Credits: 5.000000" \  -H "Content-Type: application/json" \  -d '{    "model": "gemma3:1b",    "messages": [      { "role": "user", "content": "Hello!" }    ]  }'

Set ROUTER_BASE_URL to the endpoint shown in Developer API, including /v1. Keep ROUTER_API_KEY in your server environment.

A few useful starting points

Build a reliable integration