Sử dụng OpenAI Responses API cho hội thoại. Responses API là định dạng API OpenAI mới nhất với đầu vào linh hoạt hơn.
Bearer YOUR_API_KEY| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| model | string | Bắt buộc | Tên model, ví dụ deepseek-v4.1-flash, qwen3.8-max |
| input | string | Bắt buộc | Văn bản đầu vào hoặc nội dung hội thoại |
| max_tokens | integer | Tùy chọn | Số token đầu ra tối đa |
| temperature | float | Tùy chọn | Nhiệt độ sampling, kiểm soát độ ngẫu nhiên (0-2) |
| stream | boolean | Tùy chọn | Bật phản hồi streaming, đặt true cho SSE |
| Tham số | Kiểu | Mô tả |
|---|---|---|
| id | string | Định danh phản hồi duy nhất |
| model | string | Model thực tế được sử dụng |
| output | string | Văn bản đầu ra được tạo |
| usage | object | Thống kê sử dụng token, bao gồm prompt_tokens, completion_tokens, total_tokens |
curl https://your-domain.com/api/ai/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "deepseek-v4.1-flash",
"input": "Hello, who are you?",
"max_tokens": 1000
}'