Gunakan API Respons OpenAI untuk perbualan. API Respons ialah format API OpenAI terkini dengan input yang lebih fleksibel.
/api/ai/v1/responsesBearer YOUR_API_KEY| Parameter | Jenis | Diperlukan | Keterangan |
|---|---|---|---|
model | string | Diperlukan | Nama model, cth. deepseek-v4.1-flash, qwen3.8-max |
input | string | Diperlukan | Teks input atau kandungan perbualan |
max_tokens | integer | Opsional | Bilangan maksimum token output |
temperature | float | Opsional | Suhu pensampelan, mengawal keacakan (0-2) |
stream | boolean | Opsional | Dayakan respons penstriman, tetapkan kepada true untuk SSE |
| Parameter | Jenis | Keterangan |
|---|---|---|
id | string | Pengecam respons unik |
model | string | Model sebenar yang digunakan |
output | string | Output teks yang dijana |
usage | object | Statistik penggunaan token termasuk prompt_tokens, completion_tokens, total_tokens |
curl --location 'https://your-domain.com/api/ai/v1/responses' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data '{
"model": "deepseek-v4.1-flash",
"input": "Hello, who are you?",
"max_tokens": 1000,
"temperature": 0.7
}'import requests
response = requests.post(
"https://your-domain.com/api/ai/v1/responses",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY"
},
json={
"model": "deepseek-v4.1-flash",
"input": "Hello, who are you?",
"max_tokens": 1000,
"temperature": 0.7
}
)
print(response.json())curl --location 'https://your-domain.com/api/ai/v1/responses' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data '{
"model": "deepseek-v4.1-flash",
"input": "Hello",
"max_tokens": 1000,
"stream": true
}'