- EN
- UA
POST /v1/chat/completions
Standard OpenAI-compatible endpoint. Any library that supports OpenAI works without changes.Base URL:https://api.lapathoniia.topParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | ✅ | Model ID (see Models) |
messages | array | ✅ | Array of messages |
stream | boolean | — | Streaming response (recommended) |
temperature | float | — | 0.0–2.0, default 0.15 |
max_tokens | integer | — | Maximum tokens in response |
Examples
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.lapathoniia.top/v1",
)
stream = client.chat.completions.create(
model="MamayLM-Gemma-3-27B-IT-v2.0",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Tell me about Ukraine"},
],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")
response = client.chat.completions.create(
model="LapaLLM-Gemma-3-12B-v0.1.2-instruct",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
print(f"Tokens: {response.usage.total_tokens}")
curl https://api.lapathoniia.top/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "MamayLM-Gemma-3-27B-IT-v2.0",
"messages": [{"role": "user", "content": "What is AI?"}],
"stream": false
}'
Response
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"model": "MamayLM-Gemma-3-27B-IT-v2.0",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Artificial intelligence (AI) is..."
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 150,
"total_tokens": 162
}
}
Error Codes
| Code | Cause |
|---|---|
401 | Invalid or missing API key |
429 | Rate limit or budget exceeded |
400 | Context window exceeded |
503 | Model temporarily unavailable |
POST /v1/chat/completions
Стандартний OpenAI-сумісний ендпоінт. Будь-яка бібліотека, що підтримує OpenAI, працює без змін.Base URL:https://api.lapathoniia.topParameters
| Параметр | Тип | Обов’язковий | Опис |
|---|---|---|---|
model | string | ✅ | ID моделі (див. Моделі) |
messages | array | ✅ | Масив повідомлень |
stream | boolean | — | Streaming відповідь (рекомендовано) |
temperature | float | — | 0.0–2.0, за замовчуванням 0.15 |
max_tokens | integer | — | Максимум токенів у відповіді |
Приклад
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.lapathoniia.top/v1",
)
stream = client.chat.completions.create(
model="MamayLM-Gemma-3-27B-IT-v2.0",
messages=[{"role": "user", "content": "Розкажи про Україну"}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")
Коди помилок
| Код | Причина |
|---|---|
401 | Невірний або відсутній API ключ |
429 | Перевищено rate limit або бюджет |
400 | Контекстне вікно перевищено |
503 | Модель тимчасово недоступна |
