Gamitin ang OpenAI Chat Completions API para sa mga pag-uusap. Ito ang klasikong format ng OpenAI chat API.
/api/ai/v1/chat/completionsBearer YOUR_API_KEY| Parameter | Uri | Kinakailangan | Paglalarawan |
|---|---|---|---|
model | string | Kinakailangan | Pangalan ng modelo, hal. deepseek-v4.1-flash, qwen3.8-max |
messages | array | Kinakailangan | Array ng mga mensahe sa sumusunod na format |
max_tokens | integer | Opsyonal | Pinakamataas na bilang ng output tokens |
temperature | float | Opsyonal | Sampling temperature, kinokontrol ang randomness (0-2) |
stream | boolean | Opsyonal | I-enable ang streaming response, i-set sa true para sa SSE |
| Parameter | Uri | Paglalarawan |
|---|---|---|
id | string | Natatanging identifier ng response |
model | string | Aktwal na model na ginamit |
choices | array | Array ng mga pagpipilian sa response, karaniwang kunin ang una |
usage | object | Mga istatistika ng paggamit ng 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
}'