Chat

Ask a question

Answers in the same call. stream:false returns the finished answer; stream:true writes Server-Sent Events carrying the same frames. conversation_id is optional — omit it for a one-off and a thread is minted. A stream carries an SSE comment line whenever nothing was written for fifteen seconds. A blocking answer not ready in twenty seconds is committed as 200 at once and its body starts with spaces, which JSON parsers skip; a failure after that is the error body under that 200 — internal_error, with charged: unknown, retry: poll_first and the turn's job_id: read what it cost at GET /jobs/{id} before sending it again. On our own chat models closing the connection stops the turn: it settles at what was delivered, and a turn that produced nothing — no text, no reasoning, no tool call — and reported no usage is refunded in full. On a chat model another company runs, closing the connection once we have sent the turn to the model stops only what you receive: the answer is finished and kept, and charged as the finished answer, for its prompt and what it wrote, never more than its reserve; a turn one of our time limits cuts off — the turn's deadline, a silence, or the wait for its first word — is charged in full, for its prompt and the longest answer it allowed, never more than its reserve: its maker writes the answer to its end and charges for it. A turn you stop before we sent it is refunded whole on any model. Every case is in the chat settlement table, https://auray.ai/docs/jobs#chat-settlement.

POST
/v1/chat
POST
/v1/chat
Ask a question
Answers in the same call.
Authorizationstringrequired
Your API key. It is sent only when you press Send, to this request alone, and never stored.
Ask a question
curl --request POST \
  --url 'https://api.auray.ai/v1/chat' \
  --header 'Authorization: Bearer <api-key>'
  --header 'Content-Type: application/json' \
  --data '{
  
}'
{
  "id": "<string>",
  "job_id": "<string>",
  "object": "<string>",
  "status": "<string>",
  "conversation_id": "<string>",
  "conversation_created": true,
  "history_scrubbed": true,
  "history_budget_bytes": 123,
  "history_trimmed": {
    "dropped": 123,
    "shortened": 123
  },
  "message_id": "<string>",
  "content": "<string>",
  "reasoning": "<string>",
  "usage": {},
  "finish_reason": "<string>",
  "credits_reserved": 123,
  "credits_charged": 123,
  "credits_remaining": 123,
  "product": "<string>",
  "model": "<string>",
  "effort": "<string>",
  "error": "<string>",
  "waived": true,
  "settled_unknown": true
}
Ask a question
curl -X POST https://api.auray.ai/v1/chat \
  -H "Authorization: Bearer $AURAY_API_KEY" \
  -H "content-type: application/json" \
  -d '{
  "model": "glm-5-3-flash",
  "text": "In two sentences: why does a retried request need an idempotency key?"
}'
{
  "id": "<string>",
  "job_id": "<string>",
  "object": "<string>",
  "status": "<string>",
  "conversation_id": "<string>",
  "conversation_created": true,
  "history_scrubbed": true,
  "history_budget_bytes": 123,
  "history_trimmed": {
    "dropped": 123,
    "shortened": 123
  },
  "message_id": "<string>",
  "content": "<string>",
  "reasoning": "<string>",
  "usage": {},
  "finish_reason": "<string>",
  "credits_reserved": 123,
  "credits_charged": 123,
  "credits_remaining": 123,
  "product": "<string>",
  "model": "<string>",
  "effort": "<string>",
  "error": "<string>",
  "waived": true,
  "settled_unknown": true
}

Authorizations

Authorizationstringheaderrequired

Bearer auray_sk_… — text:write, or the older chat:write.

Headers

Idempotency-Keystring
Your own id for this turn: the same as idempotency_key in the body, which wins when both are sent. A header outside the pattern is folded into a key inside it (its SHA-256) rather than refused, so the same header is still the same key. A turn is never replayed: the same key again is 409 in_flight while the first turn is running and 409 key_settled once it has finished, and key_settled carries the first turn's message_id — read that turn rather than sending it again.

Body

application/json
modelstring
Required unless conversation_id names a thread of yours, whose own model is then used — the model the thread was made with is the default for its turns, and a different one is always named here explicitly (and wins). The first five are the slots. qwen and kimi are the names these slots carried until 2026-09-14 and are still accepted, mapped to glm-5-3-flash and deepseek-v4-1-flash respectively; they named models neither slot has served since 2026-09-12 and will be withdrawn once integrations have moved. No model and no thread of yours is 400 unknown_model, as it always was. A catalogue language model whose GET /models row carries chat answers here too, named by its address (auray-serverless/model/…, its catalogue slug also accepted) — no row carries it until such models are in force at the chat doors. One of "glm-5-3-flash", "deepseek-v4-1-flash", "kimi-k3", "qwen3-8", "glm-5-3", "qwen", "kimi", "auray-serverless/model/openai-gpt-5-nano"
and 18 more"auray-serverless/model/openai-gpt-5-mini", "auray-serverless/model/openai-gpt-5-4-nano", "auray-serverless/model/openai-gpt-5-4-mini", "auray-serverless/model/openai-gpt-5-4", "auray-serverless/model/openai-gpt-5-5", "auray-serverless/model/anthropic-claude-haiku-4-5", "auray-serverless/model/anthropic-claude-sonnet-4-6", "auray-serverless/model/anthropic-claude-opus-4-7", "auray-serverless/model/anthropic-claude-opus-4-8", "auray-serverless/model/anthropic-claude-fable-5", "auray-serverless/model/google-gemma-4-31b", "auray-serverless/model/google-gemini-3-1-flash-lite", "auray-serverless/model/google-gemini-3-flash", "auray-serverless/model/google-gemini-3-5-flash", "auray-serverless/model/google-gemini-3-1-pro", "auray-serverless/model/xai-grok-4-3", "auray-serverless/model/minimax-m3", "auray-serverless/model/zai-glm-5-1"
effortstringdefault: "balanced"
One of "light", "balanced", "deep".
textstringrequired
conversation_idstring
streambooleandefault: false
include_reasoningbooleandefault: false
idempotency_keystring
Your own id for this turn. CHAT DOES NOT REPLAY: unlike the four job products, sending the same key twice is refused — 409 key_settled once the first turn finished, 409 in_flight while it is still running — key_settled always carries the original message_id; in_flight carries it once the turn's row exists and null before that. Read that turn rather than re-sending. Idempotency-Key: as a header is accepted as an alias, and the body's key wins when both are sent. No colon, because a credit key is <product>:<user>:<this>.

Response

application/json

The finished turn, or an SSE stream when stream:true.

idstring
job_idstring
The job's one id on every host: id here, request_id on the queue host (the queue protocol's name for it).
objectstring
One of "chat.turn".
statusstring
One of "succeeded", "failed".
conversation_idstring
conversation_createdboolean
history_scrubbedboolean
True when the conversation this turn continues was scrubbed seven days after its last activity: its earlier turns are gone, and this answer was written without them. Continue in a new conversation, or send the context again.
history_budget_bytesinteger
Your plan's chat.context_budget in force (GET /plans prints it per plan): how much of the thread this turn could send, this message included, counted in bytes, not tokens — each message's UTF-8 text plus 64, and 128 a turn. This message counts first and is always sent whole, even alone over the budget; earlier messages are kept newest first while the total fits, one longer than a quarter of the budget shortened to that quarter, and the oldest past it are left out.
history_trimmedobject
What the history budget left out of the thread this turn re-sent, null when it sent all of it. The model answered without what was dropped; continue in a new conversation, or send the context that matters again. Also sent as the X-Auray-History-Trimmed header. May be null.
Show child attributes
droppedintegerrequired
Earlier messages left out whole, oldest first.
shortenedintegerrequired
Earlier messages cut to a quarter of the budget to fit, each marked as shortened; a cut answer keeps its end.
message_idstring
contentstring
reasoningstring
usageobject
May be null.
finish_reasonstring
Why the model stopped: stop when it finished, length when max_output_tokens or the ceiling stopped it — the plan's, or the model's own where it cannot write the plan's inside one turn's time (GET /openai/v1/models prints it per model) — tool_calls; null when the stream ended before it said. length beside status: failed and error: output_limit_reached means the whole limit — the token ceiling, or the time one turn may run — went on reasoning before a word of answer, and the turn was refunded — send it again with a lower effort. May be null.
credits_reservedinteger
Chat reserves the worst case and settles down to what the model produced. 0 for a turn a promotion paid for (waived: true): nothing was taken from the wallet.
credits_chargedinteger
What the turn cost — the ledger's net. 0 for a turn a promotion paid for (waived: true). Null, with settled_unknown: true, when the ledger could not be read. May be null.
credits_remaininginteger
The wallet after this turn; null, with settled_unknown: true, when it could not be read. May be null.
productstring
Always chat. One of "chat".
modelstring
The chat model that answered: a slot by its own name, or a catalogue language model by its published address (auray-serverless/model/…), as its catalogue jobs print it. A request may still name a slot by its pre-2026-09-14 alias (qwen, kimi); a response never does — it is always the slot's own name, so the old spellings are not in this enum. One of "glm-5-3-flash", "deepseek-v4-1-flash", "kimi-k3", "qwen3-8", "glm-5-3", "auray-serverless/model/openai-gpt-5-nano", "auray-serverless/model/openai-gpt-5-mini", "auray-serverless/model/openai-gpt-5-4-nano"
and 16 more"auray-serverless/model/openai-gpt-5-4-mini", "auray-serverless/model/openai-gpt-5-4", "auray-serverless/model/openai-gpt-5-5", "auray-serverless/model/anthropic-claude-haiku-4-5", "auray-serverless/model/anthropic-claude-sonnet-4-6", "auray-serverless/model/anthropic-claude-opus-4-7", "auray-serverless/model/anthropic-claude-opus-4-8", "auray-serverless/model/anthropic-claude-fable-5", "auray-serverless/model/google-gemma-4-31b", "auray-serverless/model/google-gemini-3-1-flash-lite", "auray-serverless/model/google-gemini-3-flash", "auray-serverless/model/google-gemini-3-5-flash", "auray-serverless/model/google-gemini-3-1-pro", "auray-serverless/model/xai-grok-4-3", "auray-serverless/model/minimax-m3", "auray-serverless/model/zai-glm-5-1"
effortstring
NOT THE VALUE YOU SENT. The request takes a ladder — light, balanced, deep — and this reports what that mapped to on the chosen model, which differs between them: glm-5-3-flash and deepseek-v4-1-flash run low/medium/max, kimi-k3 and glm-5-3 run low/high/max, qwen3-8 runs low/medium/xhigh, auray-serverless/model/openai-gpt-5-nano, auray-serverless/model/openai-gpt-5-mini, auray-serverless/model/openai-gpt-5-4-nano, auray-serverless/model/openai-gpt-5-4-mini, auray-serverless/model/openai-gpt-5-4 and auray-serverless/model/openai-gpt-5-5 run low/medium/high, auray-serverless/model/google-gemma-4-31b and auray-serverless/model/zai-glm-5-1 run —/—/high. auray-serverless/model/anthropic-claude-haiku-4-5, auray-serverless/model/anthropic-claude-sonnet-4-6, auray-serverless/model/anthropic-claude-opus-4-7, auray-serverless/model/anthropic-claude-opus-4-8, auray-serverless/model/anthropic-claude-fable-5, auray-serverless/model/google-gemini-3-1-flash-lite, auray-serverless/model/google-gemini-3-flash, auray-serverless/model/google-gemini-3-5-flash, auray-serverless/model/google-gemini-3-1-pro, auray-serverless/model/xai-grok-4-3 and auray-serverless/model/minimax-m3 have no thinking level, and report null. A rung shown — sends none, and reports null. Sending one of these back as effort is 400 unknown_effort. One of "high", "low", "max", "medium", "xhigh", null. May be null.
errorstring
Present only when status is failed, and then it is the reason.
waivedboolean
Present, and true, when a promotion paid for the turn and the wallet was not charged.
settled_unknownboolean
Present, and true, when the answer was delivered and its figures could not be read.

Headers:

HeaderDescription
RateLimit-LimitBurst capacity.
RateLimit-Remaining
RateLimit-ResetSeconds until refill.
X-RateLimit-Limit
X-RateLimit-Remaining
X-RateLimit-ResetUnix seconds. The X- spelling is what client libraries read.
X-Request-Id
X-Auray-History-Trimmeddropped=<n>, shortened=<n> when your plan's history budget left part of the thread out of this turn (history_trimmed in the body); absent when it sent all of it.

Was this page helpful?

Ask a question
curl -X POST https://api.auray.ai/v1/chat \
  -H "Authorization: Bearer $AURAY_API_KEY" \
  -H "content-type: application/json" \
  -d '{
  "model": "glm-5-3-flash",
  "text": "In two sentences: why does a retried request need an idempotency key?"
}'
{
  "id": "<string>",
  "job_id": "<string>",
  "object": "<string>",
  "status": "<string>",
  "conversation_id": "<string>",
  "conversation_created": true,
  "history_scrubbed": true,
  "history_budget_bytes": 123,
  "history_trimmed": {
    "dropped": 123,
    "shortened": 123
  },
  "message_id": "<string>",
  "content": "<string>",
  "reasoning": "<string>",
  "usage": {},
  "finish_reason": "<string>",
  "credits_reserved": 123,
  "credits_charged": 123,
  "credits_remaining": 123,
  "product": "<string>",
  "model": "<string>",
  "effort": "<string>",
  "error": "<string>",
  "waived": true,
  "settled_unknown": true
}

Use the up and down arrow keys to select a result, Enter to open it, and Escape to close search.