Chat API
Available: OpenAI-compatible text chat completions, sync and streaming.
Status: Available — POST /v1/chat/completions.
Endpoint
POST https://api.beatra.ai/v1/chat/completions
Request
Key fields
| Field | Type | Required | Notes |
|---|---|---|---|
model | string | yes | "auto" or an account-enabled model id. |
messages | array | yes | Each item has role (system / user / assistant) and content (string). |
stream | boolean | no | When true, response is text/event-stream ending with data: [DONE]. |
temperature | number | no | 0.0–2.0. Lower = more deterministic. |
max_tokens | integer | no | Cap on response length. Combined input + output may also be capped by the model. |
top_p | number | no | Nucleus sampling. Pass either temperature or top_p, not both. |
Response (sync)
Store model and the X-Request-Id response header alongside your job record.
Response (stream)
With "stream": true, the response is text/event-stream:
Treat any disconnect before data: [DONE] as an incomplete response. See Sync vs streaming in Concepts.
Errors
Use the standard error envelope. Most common for this endpoint:
invalid_request(400) — body failed validation;detailslists fieldsrate_limited(429) — back off and retry with the sameIdempotency-Keymodel_unavailable(503) — switch to another model id or retry with"auto"