Skip to content
WRAITHERIXDocsENRU

Create chat completion

POST
/v1/chat/completions
curl --request POST \
--url https://api.wraitherix.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "model": "gpt-5.6-luna", "messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Write a haiku about the sea." } ] }'

Generates a model response for a conversation. Works with every chat model in the catalogue (GPT, Claude, Gemini, DeepSeek and others). Set stream: true to receive server-sent events.

Media typeapplication/json
object
model
required

Model ID from the catalogue.

string
messages
required
Array<object>
object
role
required
string
Allowed values: system developer user assistant tool
content
One of:
string
name
string
tool_calls
Array<object>
object
id
string
type
string
Allowed values: function
function
object
name
string
arguments

JSON-encoded arguments

string
tool_call_id
string
stream
boolean
stream_options
object
include_usage

Send a final chunk with token usage.

boolean
max_tokens
integer
max_completion_tokens
integer
temperature
number
<= 2
top_p
number
stop
One of:
string
presence_penalty
number
frequency_penalty
number
seed
integer
tools
Array<object>
object
type
required
string
Allowed values: function
function
required
object
name
required
string
description
string
parameters

JSON Schema

object
strict
boolean
tool_choice
One of:
string
parallel_tool_calls
boolean
response_format

{"type":"json_object"} or {"type":"json_schema","json_schema":{...}}

object
reasoning_effort

Reasoning depth for reasoning models.

string
Allowed values: minimal low medium high
user

End-user identifier for your own tracking.

string

Example

{
"model": "gpt-5.6-luna",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Write a haiku about the sea."
}
]
}

Completion (or an SSE stream of chat.completion.chunk objects when stream is true).

object
id
string
object
string
created
integer
model
string
choices
Array<object>
object
index
integer
message
object
role
required
string
Allowed values: system developer user assistant tool
content
One of:
string
name
string
tool_calls
Array<object>
object
id
string
type
string
Allowed values: function
function
object
name
string
arguments

JSON-encoded arguments

string
tool_call_id
string
finish_reason
string
Allowed values: stop length tool_calls content_filter
usage
object
prompt_tokens
integer
completion_tokens
integer
total_tokens
integer
prompt_tokens_details
object
cached_tokens
integer
completion_tokens_details
object
reasoning_tokens
integer

Example

{
"object": "chat.completion",
"choices": [
{
"message": {
"role": "system",
"content": [
{
"type": "text",
"image_url": {
"detail": "auto"
}
}
],
"tool_calls": [
{
"type": "function"
}
]
},
"finish_reason": "stop"
}
]
}

The request is malformed or a parameter is invalid.

Media typeapplication/json
object
error
object
message
string
type
string
param
string
code
string

Example

{
"error": {
"message": "Invalid request body",
"type": "invalid_request_error",
"param": "",
"code": "invalid_request"
}
}

Missing or invalid API key.

Media typeapplication/json
object
error
object
message
string
type
string
param
string
code
string

Example

{
"error": {
"message": "Invalid API key",
"type": "api_error",
"param": "",
"code": ""
}
}

Not enough credits on the account, or the key has reached its own credit limit.

Media typeapplication/json
object
error
object
message
string
type
string
param
string
code
string

Example

{
"error": {
"message": "Insufficient balance",
"type": "api_error",
"param": "",
"code": "insufficient_user_quota"
}
}

Too many requests. Retry with exponential backoff.

Media typeapplication/json
object
error
object
message
string
type
string
param
string
code
string

Example generated

{
"error": {
"message": "example",
"type": "example",
"param": "example",
"code": "example"
}
}

The model does not exist, is not enabled for your account, or is temporarily unavailable.

Media typeapplication/json
object
error
object
message
string
type
string
param
string
code
string

Example

{
"error": {
"message": "No available channel for model x",
"type": "api_error",
"code": "model_not_found"
}
}