কথোপকথনের জন্য OpenAI Chat Completions API ব্যবহার করুন। এটি OpenAI চ্যাট API-এর ক্লাসিক ফরম্যাট।
/api/ai/v1/chat/completionsBearer YOUR_API_KEY| প্যারামিটার | ধরন | আবশ্যক | বর্ণনা |
|---|---|---|---|
model | string | আবশ্যক | মডেলের নাম, যেমন deepseek-v4.1-flash, qwen3.8-max |
messages | array | আবশ্যক | নিম্নলিখিত বিন্যাসে বার্তা অ্যারে |
max_tokens | integer | ঐচ্ছিক | আউটপুট টোকেনের সর্বোচ্চ সংখ্যা |
temperature | float | ঐচ্ছিক | স্যাম্পলিং তাপমাত্রা, এলোমেলোবৃত্ত নিয়ন্ত্রণ (0-2) |
stream | boolean | ঐচ্ছিক | স্ট্রিমিং রেসপন্স সক্রিয় করুন, SSE এর জন্য true সেট করুন |
| প্যারামিটার | ধরন | বর্ণনা |
|---|---|---|
id | string | অনন্য রেসপন্স আইডেন্টিফায়ার |
model | string | ব্যবহৃত আসল মডেল |
choices | array | রেসপন্স চয়েস অ্যারে, সাধারণত প্রথমটি নিন |
usage | object | টোকেন ব্যবহারের পরিসংখ্যান |
curl --location 'https://your-domain.com/api/ai/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data '{
"model": "deepseek-v4.1-flash",
"messages": [
{"role": "user", "content": "Hello, who are you?"}
],
"max_tokens": 1000,
"temperature": 0.7
}'import requests
response = requests.post(
"https://your-domain.com/api/ai/v1/chat/completions",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY"
},
json={
"model": "deepseek-v4.1-flash",
"messages": [
{"role": "user", "content": "Hello, who are you?"}
],
"max_tokens": 1000,
"temperature": 0.7
}
)
print(response.json())curl --location 'https://your-domain.com/api/ai/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data '{
"model": "deepseek-v4.1-flash",
"messages": [{"role": "user", "content": "Hello"}],
"max_tokens": 1000,
"stream": true
}'