POST /v1/chat/completions
Create a model response for a chat conversation. OpenAI-compatible; works with any catalog model.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
model | string | required | Catalog model id, e.g. claude-opus-4-7. |
messages | array | required | Conversation turns with role and content. |
stream | boolean | Stream tokens over SSE. Default false. | |
tools | array | Tool definitions for function calling. | |
max_tokens | integer | Cap on generated tokens; defaults per model. | |
temperature | number | Sampling temperature; provider defaults apply. |
Example
- Request
- Response (SSE)
curl https://gateway.oya.moe/v1/chat/completions \
-H "Authorization: Bearer $ARKAFLOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.1",
"stream": true,
"messages": [
{"role": "user", "content": "Summarize this…"}
]
}'
data: {"choices":[{"delta":{"content":"Sure"}}],"object":"chat.completion.chunk"}
data: {"choices":[{"delta":{"content":" —"}}],"object":"chat.completion.chunk"}
data: [DONE]
Errors
| Code | Meaning |
|---|---|
401 UNAUTHORIZED | Missing or invalid API key. |
402 INSUFFICIENT_BALANCE | Wallet empty — top up to resume. |
404 NOT_FOUND | Unknown model id — check the catalog. |
429 LIMIT_EXCEEDED | Rate limit hit; honor Retry-After. |
See Errors for the full vocabulary and retry guidance.