Skip to content
Documentation menu

Chat completions facade

An OpenAI-compatible endpoint for confirmed-compatible model routes, billed from your balance.

Endpoint

bash
curl https://api.uselocal.sh/v1/chat/completions \
  -H "Authorization: Bearer $LOCAL_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"model":"<route from the catalog>","messages":[{"role":"user","content":"Hello"}],"stream":false}'

model must be a route the catalog marks as chat-completion compatible (kind: chat_completion). Other values return 422 unsupported.

Streaming

With "stream": true the response is server-sent events in the native format when the route supports streaming. A ceiling is reserved before the stream starts; the final charge is captured when it ends.

Streams can bill partial work

If a stream is interrupted, the supplier may still bill tokens already generated. The receipt reflects that; do not assume an interrupted stream was free.

Using OpenAI SDKs

Point an OpenAI-compatible SDK at https://api.uselocal.sh/v1 with your local key as the API key. Set an Idempotency-Key header per request where the SDK allows default headers.