Skip to main content

POST /v1/chat/completions

Create a model response for a chat conversation. OpenAI-compatible; works with any catalog model.

Request body

FieldTypeRequiredDescription
modelstringrequiredCatalog model id, e.g. claude-opus-4-7.
messagesarrayrequiredConversation turns with role and content.
streambooleanStream tokens over SSE. Default false.
toolsarrayTool definitions for function calling.
max_tokensintegerCap on generated tokens; defaults per model.
temperaturenumberSampling temperature; provider defaults apply.

Example

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…"}
]
}'

Errors

CodeMeaning
401 UNAUTHORIZEDMissing or invalid API key.
402 INSUFFICIENT_BALANCEWallet empty — top up to resume.
404 NOT_FOUNDUnknown model id — check the catalog.
429 LIMIT_EXCEEDEDRate limit hit; honor Retry-After.

See Errors for the full vocabulary and retry guidance.