使用 OpenAI 響應 API 進行對話。響應 API 是最新 OpenAI API 格式,具有更靈活的輸入。
/api/ai/v1/responsesBearer YOUR_API_KEY| 參數 | 類型 | 必要 | 說明 |
|---|---|---|---|
model | string | 必要 | 模型名稱,例如 deepseek-v4.1-flash、qwen3.8-max |
input | string | 必要 | 輸入文字或對話內容 |
max_tokens | integer | 選填 | 最大輸出 token 數量 |
temperature | float | 選填 | 取樣溫度,控制隨機性(0-2) |
stream | boolean | 選填 | 啟用流式響應,設定為 true 以獲取 SSE |
| 參數 | 類型 | 說明 |
|---|---|---|
id | string | 唯一響應識別符號 |
model | string | 實際使用的模型 |
output | string | 生成的文字輸出 |
usage | object | token 使用統計資訊,包括 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
}'