உரையாடல்களுக்கு OpenAI Chat Completions API-ஐப் பயன்படுத்தவும். இது கிளாசிக் OpenAI chat 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
}'