Documentation / developers

One API. Your move.

Authenticate requests, find your models and integrate your first conversation. Examples run on the server.

Use a CONSTELLO API key and a model accessible to your account. Executed requests consume credits according to usage.

Quickstart

Create your account at gateway.constello.ch, top up your balance if needed, then create a key under API Keys. Select an identifier from AI Models or GET /v1/models. Set these variables in your terminal.

BASE URLhttps://gateway.constello.ch/v1
Shell
export GATEWAY_URL="https://gateway.constello.ch"
export GATEWAY_API_KEY="YOUR_GATEWAY_TOKEN"
export GATEWAY_MODEL="YOUR_MODEL_ID"

Bash / zsh syntax. Replace the placeholder values. Python and JavaScript examples use these same environment variables.

In an OpenAI-compatible SDK, set base_url or baseURL to https://gateway.constello.ch/v1. In the examples below, GATEWAY_URL is the root without /v1: request paths already add this prefix.

Authentication

Send your CONSTELLO API key in the Authorization header. Use an API key, never your account password.

Authorization: Bearer YOUR_GATEWAY_TOKEN

Keep the key in environment variables on your server or local tool. Never embed it in public JavaScript or commit it to Git. Always use the HTTPS Gateway address.

Models

GET/v1/models

List models accessible with your key. Copy an exact returned identifier into the model field of your request.

cURL
curl "$GATEWAY_URL/v1/models" \
  -H "Authorization: Bearer $GATEWAY_API_KEY"

Chat completions

POST/v1/chat/completions

Send an array of messages to a configured model. These examples request a complete response without streaming. Python uses its standard library; JavaScript runs with Node.js 18 or later.

Field Type Description
model string Required. Exact ID of a configured model.
messages array Required. Messages containing role and content.
stream boolean Optional. true to receive the response progressively.

Streaming

Add stream: true and use a client that can read SSE events. In cURL, -N disables output buffering.

cURL / SSE
curl -N "$GATEWAY_URL/v1/chat/completions" \
  -H "Authorization: Bearer $GATEWAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"YOUR_MODEL_ID","messages":[{"role":"user","content":"Hello"}],"stream":true}'

Replace YOUR_MODEL_ID with an identifier accessible to your account. Handle stream interruptions and errors. Streaming support depends on the model.

Troubleshoot an error

Check the HTTP status and returned message, then the Gateway logs. Do not share authentication headers in an error report.

Access denied

Check the token, its status, expiration date and restrictions.

Quota or limit reached

Check your balance, key quota and request limits. Space out requests when temporarily rate-limited.

Model unavailable

Check the model identifier and key restrictions. Check service status, then contact support if the issue persists; never send your key.

Open the console