Create chat completion
const url = 'https://api.wraitherix.com/v1/chat/completions';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"model":"gpt-5.6-luna","messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Write a haiku about the sea."}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Model ID from the catalogue.
object
object
object
Https URL or data:image/png;base64,...
object
object
JSON-encoded arguments
object
Send a final chunk with token usage.
object
object
JSON Schema
object
{"type":"json_object"} or {"type":"json_schema","json_schema":{...}}
object
Reasoning depth for reasoning models.
End-user identifier for your own tracking.
Example
{ "model": "gpt-5.6-luna", "messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Write a haiku about the sea." } ]}Responses
Section titled “Responses”Completion (or an SSE stream of chat.completion.chunk objects when stream is true).
object
object
object
object
object
Https URL or data:image/png;base64,...
object
object
JSON-encoded arguments
object
object
object
Example
{ "object": "chat.completion", "choices": [ { "message": { "role": "system", "content": [ { "type": "text", "image_url": { "detail": "auto" } } ], "tool_calls": [ { "type": "function" } ] }, "finish_reason": "stop" } ]}Lines of data: {chat.completion.chunk} terminated by data: [DONE].
The request is malformed or a parameter is invalid.
object
object
Example
{ "error": { "message": "Invalid request body", "type": "invalid_request_error", "param": "", "code": "invalid_request" }}Missing or invalid API key.
object
object
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.
object
object
Example
{ "error": { "message": "Insufficient balance", "type": "api_error", "param": "", "code": "insufficient_user_quota" }}Too many requests. Retry with exponential backoff.
object
object
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.
object
object
Example
{ "error": { "message": "No available channel for model x", "type": "api_error", "code": "model_not_found" }}