बातचीत के लिए 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
}'