Access denied
Check the token, its status, expiration date and restrictions.
Documentation / developers
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.
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.
https://gateway.constello.ch/v1
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.
Send your CONSTELLO API key in the Authorization header. Use an API key, never your account password.
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.
/v1/models
List models accessible with your key. Copy an exact returned identifier into the model field of your request.
curl "$GATEWAY_URL/v1/models" \
-H "Authorization: Bearer $GATEWAY_API_KEY"
/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. |
Add stream: true and use a client that can read SSE events. In cURL, -N disables output buffering.
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.
Check the HTTP status and returned message, then the Gateway logs. Do not share authentication headers in an error report.
Check the token, its status, expiration date and restrictions.
Check your balance, key quota and request limits. Space out requests when temporarily rate-limited.
Check the model identifier and key restrictions. Check service status, then contact support if the issue persists; never send your key.