API reference
Docs
Everything the endpoint accepts, in the order you'll actually need it. ONYX speaks the OpenAI chat-completions format — if you've called that API before, skip to Chat completions.
Overview
ONYX is a single HTTP endpoint in front of the Claude and GPT model families. You send one request shape regardless of which model answers it — routing happens on the model field, not on the URL or the client library.
- One base URL for every model on the platform.
- Request and response bodies match the OpenAI chat-completions schema.
- Streaming, tool calls, and JSON mode all pass through unchanged.
Authentication
Every request needs a bearer key in the Authorization header. Keys are scoped to your account and can carry an optional monthly spend cap, set when you create them.
Authorization: Bearer onx_live_…
Keys aren't tied to a single model or region — a key that works for Sonnet works for Opus, Haiku, and GPT without changes.
Keep keys server-side. A key embedded in a browser or mobile build can be extracted and reused. Proxy requests through your own backend if the caller isn't trusted.
Base URL
https://onyxtech.cloud/v1
All endpoints are relative to this. There is no per-model or per-region subdomain — traffic is routed internally after the request lands.
Chat completions
POST /v1/chat/completions — the only endpoint you need for text generation, across every model on the platform.
$ curl https://onyxtech.cloud/v1/chat/completions \ -H "Authorization: Bearer $ONYX_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-sonnet-5", "messages": [ {"role": "user", "content": "Draft the migration plan."} ] }'
Required fields:
Streaming
Set "stream": true to receive server-sent events instead of a single JSON body. Each event carries one incremental token; the stream ends with data: [DONE].
from openai import OpenAI client = OpenAI(base_url="https://onyxtech.cloud/v1", api_key=ONYX_KEY) for chunk in client.chat.completions.create( model="claude-opus-4.8", messages=[{"role": "user", "content": "Stream this."}], stream=True, ): print(chunk.choices[0].delta.content or "", end="")
Idle connections send a comment-only heartbeat every 15 seconds so intermediate proxies don't time out the socket mid-generation.
Models
claude-opus-4.8Anthropic1M tokensclaude-sonnet-5Anthropic200K tokensclaude-haiku-4.5Anthropic200K tokensgpt-5.6OpenAI400K tokensCurrent per-token pricing for each model lives on the pricing table — it's the same table the billing meter reads from, so it never drifts out of sync with what you're charged.
Tool calls
Pass a tools array using the standard OpenAI function-calling schema. The model returns a tool_calls array instead of plain text when it decides to call one — send the tool's result back as a role: "tool" message to continue the conversation.
{
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"parameters": { "type": "object", "properties": { "city": {"type": "string"} } }
}
}]
}
Errors
Errors are JSON with an HTTP status that matches the failure. The error.message field says what happened and, where relevant, what to change before retrying.
model value.Retry-After.Rate limits
Limits are per key, measured in requests per minute, and vary by plan — see Pricing for the current numbers. Every response includes the remaining budget:
X-RateLimit-Limit: 2000 X-RateLimit-Remaining: 1958 X-RateLimit-Reset: 1737490260
Billing & usage
Usage is metered per token, per model, and billed monthly at the rates on the pricing table. Per-key spend caps stop a key from generating further charges once its limit is hit for the period — the key starts returning 402 instead of silently continuing.