curl
The simplest way to talk to the gateway. If something works in curl
but not in your SDK, the SDK is the thing to debug.
A non-streaming completion
curl https://lowrouter.ai/api/v1/chat/completions \
-H "Authorization: Bearer $LOWROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "lowrouter/auto",
"messages": [
{"role": "user", "content": "In one sentence, what is a vector database?"}
]
}'The response shape is documented in chat completions.
A streaming completion
Use -N to disable curl’s output buffering, and set "stream": true
in the body:
curl -N https://lowrouter.ai/api/v1/chat/completions \
-H "Authorization: Bearer $LOWROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "lowrouter/auto",
"stream": true,
"messages": [{"role": "user", "content": "Count to 5 slowly"}]
}'The response is a Server-Sent Events stream; the format is in streaming.
Listing models
curl https://lowrouter.ai/api/v1/models \
-H "Authorization: Bearer $LOWROUTER_API_KEY"Returns the routable models with their per-token prices and basic metadata. Cache the result locally — it does not change between requests within a single user session.
Pinning a provider and region
Override lowrouter/auto by sending an explicit model string and a
route block:
curl https://lowrouter.ai/api/v1/chat/completions \
-H "Authorization: Bearer $LOWROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o-mini",
"messages": [{"role": "user", "content": "Hello"}],
"route": {"region": "eu-west", "provider": "openai"}
}'If no provider in the requested region is available the request returns 503 rather than falling back silently. See routing for the full set of route options.
Looking up a generation later
Every response carries a lowrouter.generation_id. Pass it to:
curl https://lowrouter.ai/api/v1/generation/$GENERATION_ID \
-H "Authorization: Bearer $LOWROUTER_API_KEY"You get the same record the dashboard shows, including the eco numbers and the routing trace.