Request & Response Headers
This page documents all HTTP headers accepted and returned by the Chuizi.AI API gateway. Headers apply across all three protocols (/v1, /anthropic, /gemini) unless otherwise noted.
Request Headers
Authentication
You must include exactly one of the following authentication headers with every request.
| Header | Format | Protocols | Description |
|---|---|---|---|
Authorization | Bearer ck-xxxxx | All | Standard Bearer token authentication. Used by OpenAI SDKs and most HTTP clients. |
x-api-key | ck-xxxxx | All | Alternative authentication header. Follows the Anthropic SDK convention. |
If both headers are present, Authorization takes precedence.
terminal
bash
# OpenAI convention curl https://api.chuizi.ai/v1/chat/completions \ -H "Authorization: Bearer ck-your-key-here" \ -H "Content-Type: application/json" \ -d '...' # Anthropic convention curl https://api.chuizi.ai/anthropic/v1/messages \ -H "x-api-key: ck-your-key-here" \ -H "Content-Type: application/json" \ -d '...'
Content Type
| Header | Value | Required | Description |
|---|---|---|---|
Content-Type | application/json | Yes (POST) | All request bodies must be JSON. |
Protocol-Specific Headers
These headers are relevant only when using specific protocol paths.
| Header | Value | Protocol | Required | Description |
|---|---|---|---|---|
anthropic-version | 2023-06-01 | /anthropic | Recommended | Passed through to the upstream Anthropic API. If omitted, the gateway uses a default version. |
anthropic-beta | Feature string | /anthropic | No | Enables Anthropic beta features (e.g., prompt-caching-2024-07-31). Passed through to upstream. |
Optional Headers
| Header | Value | Description |
|---|---|---|
X-Request-Id | UUID string | Client-generated request ID. If provided, the gateway echoes it back in the response. If omitted, the gateway generates one. |
Accept | application/json or text/event-stream | Hint for response format. Not required; the gateway determines format from the stream parameter in the request body. |
Next Steps
- Error Codes — What each error status code means and how to fix it
- Streaming Guide — Working with SSE streaming responses
- Rate Limits — How rate limit headers relate to the three-tier system