استخدم OpenAI Responses API للمحادثات. Responses API هو أحدث تنسيق لـ OpenAI API مع إدخال أكثر مرونة.
/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 | اختياري | تفعيل الاستجابة المتدفقة، عيّن إلى true لـ SSE |
| المعلمة | النوع | الوصف |
|---|---|---|
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
}'