از OpenAI Responses API برای مکالمات استفاده کنید. Responses API جدیدترین فرمت API OpenAI با ورودی انعطافپذیرتر است.
/api/ai/v1/responsesBearer YOUR_API_KEY| پارامتر | نوع | الزامی | توضیحات |
|---|---|---|---|
model | string | الزامی | نام مدل، مثلاً deepseek-v4.1-flash،qwen3.8-max |
input | string | الزامی | متن ورودی یا محتوای مکالمه |
max_tokens | integer | اختیاری | حداکثر تعداد توکنهای خروجی |
temperature | float | اختیاری | دمای نمونهبرداری، کنترل میزان تصادفی بودن (0-2) |
stream | boolean | اختیاری | فعالسازی پاسخ جریانی؛ برای SSE روی true تنظیم کنید |
| پارامتر | نوع | توضیحات |
|---|---|---|
id | string | شناسه یکتای پاسخ |
model | string | مدل واقعی استفادهشده |
output | string | خروجی متن تولیدشده |
usage | object | آمار مصرف توکن شامل 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
}'