Použijte OpenAI Chat Completions API pro konverzace. Toto je klasický formát OpenAI chat API.
/api/ai/v1/chat/completionsBearer YOUR_API_KEY| Parametr | Typ | Povinné | Popis |
|---|---|---|---|
model | string | Povinné | Název modelu, např. deepseek-v4.1-flash, qwen3.8-max |
messages | array | Povinné | Pole zpráv ve formátu |
max_tokens | integer | Volitelné | Maximální počet výstupních tokenů |
temperature | float | Volitelné | Teplota vzorkování, řídí náhodnost (0-2) |
stream | boolean | Volitelné | Povolit streamování odpovědi, nastavte true pro SSE |
| Parametr | Typ | Popis |
|---|---|---|
id | string | Jedinečný identifikátor odpovědi |
model | string | Použitý model |
choices | array | Pole voleb odpovědi, obvykle vezmeme první |
usage | object | Statistiky použití tokenů |
curl --location 'https://your-domain.com/api/ai/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data '{
"model": "deepseek-v4.1-flash",
"messages": [
{"role": "user", "content": "Hello, who are you?"}
],
"max_tokens": 1000,
"temperature": 0.7
}'import requests
response = requests.post(
"https://your-domain.com/api/ai/v1/chat/completions",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY"
},
json={
"model": "deepseek-v4.1-flash",
"messages": [
{"role": "user", "content": "Hello, who are you?"}
],
"max_tokens": 1000,
"temperature": 0.7
}
)
print(response.json())curl --location 'https://your-domain.com/api/ai/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data '{
"model": "deepseek-v4.1-flash",
"messages": [{"role": "user", "content": "Hello"}],
"max_tokens": 1000,
"stream": true
}'