Сайт находится в активной разработке — возможны ошибки и изменения

Аутентификация

Все API-запросы требуют API-ключ в заголовке Authorization: Bearer sk-.... Ключи можно создать на странице Ключи API.

GET /v1/models

Получение списка доступных моделей.

cURL
curl https://tokendom.ru/v1/models \ -H "Authorization: Bearer sk-..."
Python
import requests r = requests.get("https://tokendom.ru/v1/models", headers={"Authorization": "Bearer sk-..."}) print(r.json())

POST /v1/chat/completions

Отправка chat completion запроса. Совместимо с OpenAI API форматом.

cURL
curl https://tokendom.ru/v1/chat/completions \ -H "Authorization: Bearer sk-..." \ -H "Content-Type: application/json" \ -d '{ "model": "deepseek-v4-flash", "messages": [{"role": "user", "content": "Привет!"}], "stream": false }'
Python
import requests r = requests.post("https://tokendom.ru/v1/chat/completions", headers={"Authorization": "Bearer sk-...", "Content-Type": "application/json"}, json={"model": "deepseek-v4-flash", "messages": [{"role": "user", "content": "Привет!"}]}) print(r.json())
OpenAI SDK
from openai import OpenAI client = OpenAI(base_url="https://tokendom.ru/v1", api_key="sk-...") r = client.chat.completions.create( model="deepseek-v4-flash", messages=[{"role": "user", "content": "Привет!"}]) print(r.choices[0].message.content)

Ответ / Формат

Ответ приходит в формате OpenAI API:

JSON
{ "id": "chatcmpl-...", "object": "chat.completion", "choices": [{ "index": 0, "message": { "role": "assistant", "content": "Привет! Чем могу помочь?" }, "finish_reason": "stop" }], "usage": { "prompt_tokens": 10, "completion_tokens": 8, "total_tokens": 18 } }

Потоковая передача (Streaming)

Установите "stream": true для получения ответа частями через Server-Sent Events:

cURL
curl https://tokendom.ru/v1/chat/completions \ -H "Authorization: Bearer sk-..." \ -H "Content-Type: application/json" \ -d '{ "model": "deepseek-v4-flash", "messages": [{"role": "user", "content": "Привет!"}], "stream": true }'