AI models
Complete API reference for chat models in the OpenAI and Anthropic request formats: endpoints, payloads, token accounting and error responses.
One endpoint family for chat models, in the request shape your SDK already speaks. You are charged for the tokens the answer used, from the same balance as the rest of DraxonCloud.
Two shapes
| Endpoint | Request | Response |
|---|---|---|
POST /api/llm/v1/chat/completions |
OpenAI chat | OpenAI chat.completion |
POST /api/llm/v1/messages |
Anthropic messages | Anthropic message |
All requests accept Authorization: Bearer drx_... or X-Api-Key: drx_.... A key must have the
llm scope.
1. List the models
GET /api/llm/v1/models HTTP/1.1
Host: draxon.one
Authorization: Bearer drx_...
Response (200 OK)
{
"data": [
{
"id": "qwen3.8-flash",
"label": "Qwen 3.8 Flash",
"vendor": "alibaba",
"vendor_label": "Alibaba",
"enabled": true,
"context_tokens": 1000000,
"default_max_output_tokens": 8192,
"reasoning": false,
"capabilities": [],
"sort_order": 25,
"input_micros_per_1m": 7500
}
]
}
A model that is not in the list cannot be called. The list covers DeepSeek, Alibaba (Qwen), Google (Gemini), OpenAI (GPT), Anthropic (Claude), Zhipu (GLM), Tencent (Hunyuan), Xiaomi (MiMo), MiniMax and Meta (Gemma, Llama).
2. Chat completion (OpenAI)
POST /api/llm/v1/chat/completions HTTP/1.1
Host: draxon.one
Authorization: Bearer drx_...
Content-Type: application/json
{
"model": "qwen3.8-flash",
"messages": [
{ "role": "system", "content": "be brief" },
{ "role": "user", "content": "hello" }
],
"max_tokens": 256
}
Response (200 OK)
{
"id": "chatcmpl-2f1c...",
"object": "chat.completion",
"created": 0,
"model": "qwen3.8-flash",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "hello" },
"finish_reason": "stop"
}
],
"usage": { "prompt_tokens": 6, "completion_tokens": 2, "total_tokens": 8 }
}
Unknown body fields are accepted and ignored, so an SDK can send its usual parameters.
3. Messages (Anthropic)
POST /api/llm/v1/messages HTTP/1.1
Host: draxon.one
Authorization: Bearer drx_...
Content-Type: application/json
{
"model": "qwen3.8-flash",
"max_tokens": 256,
"system": "be brief",
"messages": [{ "role": "user", "content": "hello" }]
}
Response (200 OK)
{
"id": "msg_6b1d...",
"type": "message",
"role": "assistant",
"content": [{ "type": "text", "text": "hello" }],
"model": "qwen3.8-flash",
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": { "input_tokens": 6, "output_tokens": 2 }
}
stop_reason is end_turn, max_tokens or tool_use.
3. Streaming and tool calls
Both endpoints accept stream: true. The OpenAI path answers with data: {chunk} frames and a
final data: [DONE]; the Anthropic path answers with message_start, content_block_start,
content_block_delta, content_block_stop, message_delta and message_stop.
tools is the tool list of your SDK (OpenAI: {type: "function", function: {name, description, parameters}}; Anthropic: {name, description, input_schema}). The web-chat
upstreams have no native tool API, so the module asks the model for a tool call in XML and
reads it back: the answer then carries tool_calls (OpenAI) or a tool_use content block
(Anthropic), with finish_reason tool_calls / tool_use.
Send the tool result back in the next request as a normal message and the model continues.
4. Speech to text
POST /api/llm/v1/audio/transcriptions HTTP/1.1
Host: draxon.one
Authorization: Bearer drx_...
Content-Type: multipart/form-data; boundary=...
The body carries the audio file as file, and optionally language (default auto) and
model (default mimo-v2.5-asr).
Response (200 OK)
{
"text": "the transcribed words",
"language": "auto",
"seconds": 4.2,
"cost_micros": 30000,
"cost_usd": "0.030000"
}
The audio is charged per started minute. It runs on the MiMo upstream.
5. Usage and history
GET /api/llm/v1/usage?limit=50 HTTP/1.1
GET /api/llm/v1/stats?days=30 HTTP/1.1
/usage answers {data: [Usage], next_cursor}, newest first. One Usage row per request:
{
"id": "0b1e...",
"model_id": "qwen3.8-flash",
"endpoint": "/api/llm/v1/chat/completions",
"input_tokens": 6,
"output_tokens": 2,
"total_tokens": 8,
"cost_micros": 61,
"cost_usd": "0.000061",
"status": "completed",
"status_code": 200,
"latency_ms": 842,
"estimated": true,
"created_at": "2026-11-13T00:00:00Z"
}
/stats answers the totals over the window plus a by_model breakdown.
6. Billing
The worst case is reserved from your balance before the request starts. When the answer arrives, you are charged for the tokens it actually used and the rest goes back. A request that fails costs nothing.
Prices are per model and direction — llm.input.<model> and llm.output.<model> — in micro-USD
per million tokens. The live list is in the site config (GET /api/public/v1/site, field
prices), and per-account discounts apply.
7. Errors
| Code | Status | When |
|---|---|---|
unauthorized |
401 | no key, unknown key, revoked key |
scope_denied |
403 | the key may not use the llm scope |
insufficient_balance |
402 | not enough balance for the reservation |
spend_cap_reached |
402 | the key reached its daily spending limit |
price_missing |
400 | the model has no price, so it cannot be served |
model_not_found |
404 | unknown or disabled model |
context_length_exceeded |
400 | the request is longer than the context limit |
service_unavailable |
503 | the module is switched off |
provider_unavailable |
503 | no upstream has credentials for this model |
provider_error |
502 | the model did not answer |
The error body is the standard DraxonCloud envelope:
{
"error": {
"code": "insufficient_balance",
"message": "Not enough balance. This costs $0.01 and you have $0.00. Add funds to continue.",
"details": { "required_micros": 10000, "available_micros": 0 },
"request_id": "3f2a..."
}
}
8. Limits
Each API key can carry the llm scope, a daily spending limit and an IP allowlist. See
Authentication. The rolling account limits and the per-request token
caps are set by the operator and listed in the admin settings.
9. Use it from an SDK
from openai import OpenAI
client = OpenAI(base_url="https://draxon.one/api/llm/v1", api_key=DRAXON_KEY)
answer = client.chat.completions.create(
model="qwen3.8-flash",
messages=[{"role": "user", "content": "hello"}],
)
print(answer.choices[0].message.content)
export ANTHROPIC_BASE_URL="https://draxon.one/api/llm"
export ANTHROPIC_API_KEY="$DRAXON_KEY"
claude --model qwen3.8-flash