API Reference
CodeGate speaks two request protocols behind one host. Pick the shape that matches your existing SDK or client.
Base URL
https://codegate.devOne base URL. Every endpoint documented in this section is a path under it.
Protocols
| Protocol | Endpoint | Auth header |
|---|---|---|
| OpenAI Chat Completions | POST /v1/chat/completions | Authorization: Bearer sk-... |
| OpenAI Responses | POST /v1/responses | Authorization: Bearer sk-... |
| Anthropic Messages | POST /v1/messages | x-api-key: sk-... + anthropic-version: 2023-06-01 |
Gemini support is planned but not currently shipped. If you need Gemini through the same account, join the Discord and we will let you know when it lands.
Choosing a protocol
- Already have OpenAI SDK code? Use the OpenAI-compatible endpoints. Change the base URL and key, keep everything else. Any model you point at (Claude, GPT) is routed under the hood.
- Using Claude Code, an Anthropic SDK, or the Messages format directly? Use the Anthropic-compatible endpoint. It preserves the native Messages request shape including tool use.
The same sk-... key works for both. What changes is the auth header and the request body shape.
Common errors
| Status | Meaning | Action |
|---|---|---|
| 400 | Bad request shape or unknown model | Check the request body against the protocol reference. |
| 401 | Missing or invalid key | Confirm the sk-... value and the auth header format. |
| 402 | Balance exhausted | Top up at Console, Top Up. |
| 403 | Model not permitted for this key | Some models require higher tiers. |
| 404 | Wrong path or unknown model ID | Confirm the endpoint path. |
| 429 | Too many requests upstream | Back off and retry. See Rate Limits. |
| 5xx | Transient upstream failure | Retry once. CodeGate fails over between upstreams. |
Streaming
Both protocols support streaming. Set "stream": true on the request body. See curl for copy-paste examples.