Claude Haiku 5.5
Messages API
- 介面
POST https://chuaone.si/v1/messages- 認證
Authorization: Bearer $CHUA_API_KEY- 必要請求標頭
anthropic-version: 2023-06-01- 冪等鍵
Idempotency-Key- 輸出上限
max_tokens- 回應憑證
X-CHUA-Request-ID
if ([string]::IsNullOrWhiteSpace($env:CHUA_API_KEY)) { throw "Set CHUA_API_KEY" }
$headers = @{
Authorization = "Bearer $env:CHUA_API_KEY"
"anthropic-version" = "2023-06-01"
"Idempotency-Key" = [guid]::NewGuid().ToString()
}
$body = @'
{
"model": "claude-haiku-5.5",
"messages": [
{
"role": "user",
"content": "Hello"
}
],
"max_tokens": 256,
"stream": false
}
'@
try {
$response = Invoke-WebRequest -UseBasicParsing -Method Post -Uri "https://chuaone.si/v1/messages" -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"]
$content請使用範例中的準確已發佈模型識別碼。CHUA ONE 不會靜默切換到其他模型。
含圖請求會在派發前按模型完整上下文視窗保守預留預算,因此可能需要更高的可用餘額或專案預算。完成後,CHUA ONE 僅按上游確認的實際用量收費並釋放差額;圖片位元組和 URL 長度不作為 Token 計價。完整 JSON 請求內容不得超過 2 MiB。
Haiku 5.5 僅接受 Base64 嵌入圖片。請省略 detail 或設為 auto;不接受圖片 URL,也不接受 low 或 high。