Gateway API
Authentication
Authenticate Gateway requests with an Edgee API key
Create a Gateway API key in the Edgee console and send it over HTTPS. A Console personal token is a different credential and cannot replace a Gateway API key.
| Endpoint | Accepted credentials |
|---|---|
/v1/chat/completions, /v1/responses | Authorization: Bearer <key> |
/v1/messages, /v1/messages/count_tokens, /v1/count_tokens, /v1/compress | Bearer token or x-api-key: <key> |
/v1/models | Optional Bearer token or x-api-key; a valid key applies organization availability filters |
Where both headers are supported, a non-empty x-api-key takes precedence. HTTP Basic authentication is not supported by these managed endpoints. An invalid key returns 401, including on the otherwise public models endpoint.
cURL with Bearer
curl 'https://edgee.io/v1/chat/completions' \
-H "Authorization: Bearer $EDGEE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "openai/gpt-5.2",
"messages": [{"role": "user", "content": "Hello"}]
}'
cURL with x-api-key
curl 'https://edgee.io/v1/count_tokens' \
-H "x-api-key: $EDGEE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"model":"openai/gpt-5.2","messages":[{"role":"user","content":"Hello"}]}'
The CLI's subscription passthrough uses a separate authentication flow. Do not copy its x-edgee-api-key headers into ordinary Gateway requests.