Chat completions API
Call GPT-5.4 through the CHUA ONE OpenAI-compatible chat completions endpoint.
POST /v1/chat/completions
Authorization: Bearer $CHUA_API_KEY— project API keyContent-Type: application/jsonIdempotency-Key— a unique value for every new request; reuse it only when retrying the same request
curl -i 'https://chuaone.si/v1/chat/completions' \
-H "Authorization: Bearer $CHUA_API_KEY" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: YOUR_UNIQUE_REQUEST_ID' \
-d '{"model":"gpt-5.4","messages":[{"role":"system","content":"Answer concisely."},{"role":"user","content":"What is an API?"}],"max_tokens":256,"stream":false}'Request fields
model- Required. Use gpt-5.4 for this guide; the key must allow it.
messages- Required, non-empty array. Each item has a role and content.
max_tokens- Required integer. It must fit the model output and context limits.
stream- Optional; defaults to false. Use only when streaming is supported by the published route.
Response fields
Read generated text from choices[].message.content and metered tokens from usage. Keep the X-CHUA-Request-ID header as the request receipt. Error responses use error.code, error.message and error.retryable.
Anthropic Messages for Claude Haiku 5.5
Claude Haiku 5.5 uses the native-compatible Messages endpoint. Send the project key as x-api-key, include anthropic-version, and keep stream set to false on this published route.
curl -i 'https://chuaone.si/v1/messages' \
-H "x-api-key: $CHUA_API_KEY" \
-H 'anthropic-version: 2023-06-01' \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: YOUR_UNIQUE_REQUEST_ID' \
-d '{"model":"claude-haiku-5.5","max_tokens":256,"stream":false,"messages":[{"role":"user","content":"Explain what an API is in one sentence."}]}'Read assistant blocks from content and metered input and output tokens from usage. Reuse an Idempotency-Key only to retry the identical request.
Common errors
KEY_INVALID- The key is invalid, expired or revoked.
MODEL_UNAVAILABLE/MODEL_NOT_ALLOWED- The model is not published, ready, or allowed for this key.
RATE_LIMIT- The key reached its request limit. Follow retryAfterSeconds when returned.
CUSTOMER_INFERENCE_DISABLED- Requests are temporarily unavailable. Check the service status before retrying.
Troubleshoot and decide when to retry · Check usage and charges