API reference
Chat Completions
CHUA ONE is CHUA’s AI model API platform. This documentation covers its public API endpoints and request requirements. Visit CHUA
- Endpoint
POST https://chuaone.si/v1/chat/completions- Authentication
Authorization: Bearer $CHUA_API_KEY- Idempotency
Idempotency-Key- Output limit
max_tokens- Response receipt
X-CHUA-Request-ID
if ([string]::IsNullOrWhiteSpace($env:CHUA_API_KEY)) { throw "Set CHUA_API_KEY" }
$headers = @{
Authorization = "Bearer $env:CHUA_API_KEY"
"Idempotency-Key" = [guid]::NewGuid().ToString()
}
$body = @'
{
"model": "claude-sonnet-4.6",
"messages": [
{
"role": "user",
"content": "Hello"
}
],
"max_tokens": 256,
"stream": false
}
'@
try {
$response = Invoke-WebRequest -UseBasicParsing -Method Post -Uri "https://chuaone.si/v1/chat/completions" -Headers $headers -ContentType "application/json" -Body ([Text.Encoding]::UTF8.GetBytes($body)) -TimeoutSec 180 -MaximumRedirection 0 -ErrorAction Stop
if ([int]$response.StatusCode -lt 200 -or [int]$response.StatusCode -ge 300) { throw "Unexpected HTTP status" }
$content = $response.Content
if ($response.PSObject.Properties.Name -contains "RawContentStream") {
$content = [Text.Encoding]::UTF8.GetString($response.RawContentStream.ToArray())
}
} catch {
throw "CHUA request failed; check the request record before retrying."
}
$response.Headers["X-CHUA-Request-ID"]
$contentCoding tools
Connect Codex and Claude Code directly with a project API key. Text and function tools use the same model permissions, budgets, request records and billing as Chat Completions. Unsupported input types and parameters return an explicit error.
- Codex
POST /v1/responses- Claude Code
POST /v1/messagesRequired header:anthropic-version: 2023-06-01- Key-scoped models
GET /v1/models
curl 'https://chuaone.si/v1/messages' \
-H "Authorization: Bearer $CHUA_API_KEY" \
-H 'anthropic-version: 2023-06-01' \
-H 'Idempotency-Key: YOUR_UNIQUE_REQUEST_ID' \
-H 'Content-Type: application/json' \
-d '{"model":"YOUR_ALLOWED_MODEL","max_tokens":256,"messages":[{"role":"user","content":"Hello"}]}'Request outcomes
2xx- Read the complete response and its request receipt.
409- The idempotency key was already recorded. Check the existing request; do not resend automatically.
- Timeout / disconnect
- Response delivery and billing may differ. The workspace ledger is authoritative.
Exact model failures
CHUA ONE does not silently switch to another model.
TOKEN_HUB_CROSS_MODEL_FALLBACK_DETECTED- A cross-model fallback was detected and rejected.
TOKEN_HUB_UPSTREAM_MODEL_MISMATCH- The upstream model did not match the requested model.