Tumia OpenAI Majibu ya Mazungumzo API kwa mazungumzo. Hii ni fomati ya kawaida ya mazungumzo ya OpenAI chat API.
/api/ai/v1/chat/completionsBearer YOUR_API_KEY| Parameta | Aina | Inahitajika | Maelezo |
|---|---|---|---|
model | string | Inahitajika | Jina la muundo, mfano. deepseek-v4.1-flash, qwen3.8-max |
messages | array | Inahitajika | Safu ya ujumbe kwa muundo ufuatao |
max_tokens | integer | Si lazima | Idadi kubwa ya token za pato |
temperature | float | Si lazima | Halijoto ya sampuli, inadhibiti nasibu (0-2) |
stream | boolean | Si lazima | Washa majibu yanayotiririka, weka true kwa SSE |
| Parameta | Aina | Maelezo |
|---|---|---|
id | string | Kitambulisho cha kipekee cha jibu |
model | string | Modeli halisi iliyotumika |
choices | array | Array ya chaguo za majibu, kawaida chukua ya kwanza |
usage | object | Takwimu za matumizi ya 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
}'