API reference
Gate speaks the Anthropic Messages API and the OpenAI Chat Completions API verbatim. Your existing client and request bodies work unchanged: you point them at Gate’s base URL, and Gate runs each request through security, audit, caching, and cost tracking before forwarding it to the provider you choose.
Because the request and response schemas are the provider’s own, this section does not restate them. For field-level request and response shapes, use the provider’s documentation:
What this section covers is everything specific to Gate: the two API surfaces, the headers that control routing and billing, the response headers Gate adds, the error envelope, and the limits on your traffic.
New here? The manual setup quickstart walks through your first request.
Two API surfaces
- The gateway, at
https://gateway.constellationgate.ai, is what your LLM client talks to. It accepts the Anthropic Messages and OpenAI Chat Completions APIs, and forwards each request to the provider you choose. - The keys API, at
https://api.constellationgate.ai, lets you create and manage your gateway keys from code, so you can automate provisioning and rotation.
Endpoints
Gateway:
- Anthropic Messages API at
/v1/messages. - OpenAI Chat Completions API at
/v1/chat/completions. GET /v1/modelslists the models available to your organization. For worked examples in TypeScript, Python, and curl, see the OpenAI SDK guide.
Account:
- The keys API at
https://api.constellationgate.aicreates, lists, rotates, and revokes gateway keys from code.
Authentication
Every request carries your Gate key as a bearer token:
Authorization: Bearer sk-gw-...Keys are scoped to one organization. When you create a key you can restrict it to specific models and attach a rate limit and a security policy. For the routing and billing headers, and how each call decides who pays, see Authentication.
Errors
Gate returns standard HTTP status codes with a JSON error envelope. Every error carries a machine-readable code and a source that says which side failed, and every response carries an X-Gate-Request-Id you can look up in the dashboard:
{ "error": { "type": "invalid_request_error", "message": "max_tokens is required for pay-as-you-go requests." }}For the complete error taxonomy, per-code guidance, and a debugging checklist, see Error handling.
Versioning
Endpoints under /v1/... are stable. Breaking changes land under a new version such as /v2/.... Additive changes, like new optional fields or new endpoints, can happen at any time.
Related
- Error handling: the full error taxonomy and debugging tips.
- Limits and retention: rate limits, usage caps, request size, and data retention.
- Authentication: keys, routing headers, and who pays per request.