
# 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

```bash
curl https://api.lowrouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $LOWROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto/mistralai/mistral-large-2512",
    "messages": [
      {"role": "user", "content": "In one sentence, what is a vector database?"}
    ]
  }'
```

The response is a standard OpenAI-shaped chat-completions object, with
a `lowrouter_metadata` block carrying the provider, region, and eco
numbers for the request.

## A streaming completion

Use `-N` to disable curl's output buffering, and set `"stream": true`
in the body:

```bash
curl -N https://api.lowrouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $LOWROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto/mistralai/mistral-large-2512",
    "stream": true,
    "messages": [{"role": "user", "content": "Count to 5 slowly"}]
  }'
```

The response is a Server-Sent Events stream, in the same format the
OpenAI streaming API uses.

## Listing models

```bash
curl https://api.lowrouter.ai/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

Pin the route yourself by sending an explicit model ID instead of an
`auto/` one. To pin a
region, append a UN/LOCODE as the fourth segment of the model ID
(`{provider}/{creator}/{model}/{locode}`); omit it to use the default
region:

```bash
curl https://api.lowrouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $LOWROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "vertex/anthropic/claude-opus-4.6/sg-sin",
    "messages": [{"role": "user", "content": "Hello"}]
  }'
```

See [routing](../models/routing) for how regions and providers are
selected.

## Looking up a generation later

Every completion is recorded on the dashboard. Open the transaction
view there to see the full record, including the eco numbers and the
routing trace.
