Chat completions
POST /v1/chat/completions совместим с OpenAI и работает с любой
чат-моделью из каталога, включая модели Claude и Gemini.
from openai import OpenAIimport os
client = OpenAI(base_url="https://api.wraitherix.com/v1", api_key=os.environ["WRAITHERIX_API_KEY"])
r = client.chat.completions.create( model="claude-opus-5-5", messages=[ {"role": "system", "content": "You are a concise assistant."}, {"role": "user", "content": "What is the capital of Australia?"}, ], temperature=0.2, max_tokens=200,)print(r.choices[0].message.content)print(r.usage)import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.wraitherix.com/v1", apiKey: process.env.WRAITHERIX_API_KEY,});
const r = await client.chat.completions.create({ model: "claude-opus-5-5", messages: [ { role: "system", content: "You are a concise assistant." }, { role: "user", content: "What is the capital of Australia?" }, ], temperature: 0.2, max_tokens: 200,});console.log(r.choices[0].message.content);curl https://api.wraitherix.com/v1/chat/completions \ -H "Authorization: Bearer $WRAITHERIX_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-opus-5-5", "messages": [ {"role": "system", "content": "You are a concise assistant."}, {"role": "user", "content": "What is the capital of Australia?"} ], "temperature": 0.2, "max_tokens": 200 }'Основные параметры
Заголовок раздела «Основные параметры»| Параметр | Описание |
|---|---|
model |
ID модели, например gpt-5.6-luna, claude-opus-5-5. См. каталог. |
messages |
История диалога: сообщения system / user / assistant / tool. |
max_tokens |
Максимальное число генерируемых токенов. |
temperature, top_p |
Параметры сэмплирования. |
stop |
Строка или массив стоп-последовательностей. |
stream |
true для стриминга токенов — см. Стриминг. |
tools, tool_choice |
Вызов функций — см. Вызов инструментов (tool calling). |
response_format |
Режим JSON / JSON schema — см. Структурированный вывод. |
reasoning_effort |
low / medium / high для моделей с рассуждениями — см. Рассуждения (reasoning). |
Полная схема приведена в справочнике API.
{ "id": "resp_01fc…", "object": "chat.completion", "model": "claude-opus-5-5", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Canberra." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 24, "completion_tokens": 4, "total_tokens": 28 }}finish_reason принимает значения stop (естественное завершение), length
(достигнут max_tokens) или tool_calls (модель хочет вызвать инструмент).
Многоходовые диалоги
Заголовок раздела «Многоходовые диалоги»API не хранит состояние. Передавайте полную историю в каждом запросе:
history = [{"role": "user", "content": "My name is Ana."}]r = client.chat.completions.create(model="gpt-5.6-luna", messages=history)history.append({"role": "assistant", "content": r.choices[0].message.content})history.append({"role": "user", "content": "What is my name?"})r = client.chat.completions.create(model="gpt-5.6-luna", messages=history)