आखिरी token का इंतज़ार न करें।
सेट करें stream: true करें ताकि server-sent events मिलें। हर event का data: payload में completion chunk होता है। stream का अंत data: [DONE].
data: {"choices":[{"delta":{"content":"Hello"}}]}
data: {"choices":[{"delta":{"content":" there."}}]}
data: [DONE]यह protocol का उदाहरण है, वास्तविक API प्रतिक्रिया या उपयोग रिकॉर्ड नहीं।
रुकावट को स्पष्ट रूप से संभालें
आंशिक रूप से प्राप्त stream को अपने आप दोबारा न चलाएँ। कनेक्शन टूटने का अर्थ हमेशा यह नहीं कि मॉडल रुक गया। बिल योग्य काम दोहराने से पहले अनुरोध लॉग और trace ID जाँचें।
curl https://unlimit.chat/v1/chat/completions \
-H "Authorization: Bearer $UNLIMIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_MODEL_ID",
"messages": [
{"role": "user", "content": "What if we built something different?"}
],
"stream": true
}'