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.

HeaderFormatProtocolsDescription
AuthorizationBearer ck-xxxxxAllStandard Bearer token authentication. Used by OpenAI SDKs and most HTTP clients.
x-api-keyck-xxxxxAllAlternative 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

HeaderValueRequiredDescription
Content-Typeapplication/jsonYes (POST)All request bodies must be JSON.

Protocol-Specific Headers

These headers are relevant only when using specific protocol paths.

HeaderValueProtocolRequiredDescription
anthropic-version2023-06-01/anthropicRecommendedPassed through to the upstream Anthropic API. If omitted, the gateway uses a default version.
anthropic-betaFeature string/anthropicNoEnables Anthropic beta features (e.g., prompt-caching-2024-07-31). Passed through to upstream.

Optional Headers

HeaderValueDescription
X-Request-IdUUID stringClient-generated request ID. If provided, the gateway echoes it back in the response. If omitted, the gateway generates one.
Acceptapplication/json or text/event-streamHint 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