---
title: "LLM API में स्ट्रीमिंग क्या है? Server-sent events | BroadRouter"
description: "स्ट्रीमिंग LLM का जवाब बनते-बनते टुकड़ों में लौटाती है। server-sent events और [DONE] कैसे काम करते हैं, usage कैसे पाएँ, और स्ट्रीम टूटे तो क्या करें।"
url: https://broadrouter.com/hi/glossary/streaming/
lang: hi
updated: 2026-11-14
publisher: BroadRouter (a BroadNet site); API by BroadNet Inference, https://inference.broadnet.ai
---

यह पेज अंग्रेज़ी से AI की मदद से अनुवाद किया गया है। [अंग्रेज़ी मूल पढ़ें](https://broadrouter.com/glossary/streaming/) (2026-11-14 को अपडेट किया गया).

# स्ट्रीमिंग (streaming)

अपडेट किया गया 2026-11-14

स्ट्रीमिंग, लैंग्वेज मॉडल के जवाब को अंत में एक साथ लौटाने के बजाय, बनते समय ही छोटे-छोटे टुकड़ों (chunks) में लौटाने का तरीक़ा है। OpenAI-कम्पैटिबल API, अनुरोध में stream को true सेट करने पर server-sent events से स्ट्रीम करते हैं।

अन्य नाम: स्ट्रीमिंग, स्ट्रीमिंग रिस्पॉन्स, टोकन स्ट्रीमिंग, streaming kya hai, LLM streaming kya hai, streaming, streaming responses, stream=true, token streaming

स्ट्रीमिंग के बिना क्लाइंट तब तक इंतज़ार करता है जब तक पूरा जवाब तैयार न हो जाए। स्ट्रीमिंग के साथ, मॉडल जैसे-जैसे लिखता है, टेक्स्ट वैसे-वैसे दिखता है।

## यह कैसे काम करती है

स्ट्रीमिंग [server-sent events (SSE)](https://broadrouter.com/hi/glossary/sse/) इस्तेमाल करती है। सर्वर `text/event-stream` कंटेंट टाइप के साथ जवाब देता है और कनेक्शन खुला रखता है। MDN फ़ॉर्मैट बताता है: `field: value` वाली लाइनें, और मैसेज “separated by a pair of newline characters” (अनुवाद: दो newline कैरेक्टर से अलग किए गए)।

Chat Completions फ़ॉर्मैट में हर event एक chunk लाता है, जिसमें एक छोटा `delta` होता है:

```text
data: {"choices":[{"index":0,"delta":{"content":"Hel"}}]}

data: {"choices":[{"index":0,"delta":{"content":"lo"}}]}

data: {"choices":[],"usage":{"prompt_tokens":12,"completion_tokens":2}}

data: [DONE]
```

क्लाइंट सारे delta जोड़ता है। हूबहू `data: [DONE]` वाली लाइन अंत बताती है। usage वाला chunk तभी आता है जब अनुरोध ने `stream_options: {"include_usage": true}` के साथ उसे माँगा हो।

## यह क्यों मायने रखती है

-   **महसूस होने वाली रफ़्तार.** यूज़र को पहले शब्द पूरे जवाब के बाद नहीं, [पहले टोकन तक के समय](https://broadrouter.com/hi/glossary/time-to-first-token/) के बाद दिखते हैं। उसके बाद टेक्स्ट मॉडल के [टोकन प्रति सेकंड](https://broadrouter.com/hi/glossary/tokens-per-second/) की रफ़्तार से आता है।
-   **लंबे आउटपुट.** स्ट्रीमिंग कनेक्शन को सक्रिय रखती है, जिससे उन प्रॉक्सी के साथ मदद मिलती है जो निष्क्रिय अनुरोध बंद कर देते हैं।
-   **जल्दी कार्रवाई.** एजेंट और UI अंत से पहले ही पार्स या रेंडर करना शुरू कर सकते हैं।

इसकी क़ीमत भी है। OpenAI बताता है कि स्ट्रीमिंग से मॉडरेशन मुश्किल होता है, क्योंकि “partial completions may be more difficult to evaluate” (अनुवाद: अधूरे जवाबों का मूल्यांकन ज़्यादा मुश्किल हो सकता है)। स्ट्रीम बीच में टूट भी सकती है, और स्ट्रीम हो रहा जवाब ख़त्म होने तक एक [concurrency](https://broadrouter.com/hi/glossary/concurrency/) स्लॉट घेरे रखता है।

## BroadNet Inference पर

BroadNet, `https://inference.broadnet.ai/v1/chat/completions` पर स्टैंडर्ड chat-completions स्ट्रीमिंग ढाँचा इस्तेमाल करता है, इसलिए [Python](https://broadrouter.com/hi/guides/openai-python-sdk/) और [Node](https://broadrouter.com/hi/guides/openai-node-sdk/) SDK इसे आपके लिए पार्स कर देते हैं। curl के साथ बफ़रिंग बंद करने के लिए `-N` जोड़ें:

```bash
curl -N https://inference.broadnet.ai/v1/chat/completions \
  -H "Authorization: Bearer $BROADNET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"broadnet/gemma-4-26b-a4b","stream":true,"stream_options":{"include_usage":true},"messages":[{"role":"user","content":"Count to three."}]}'
```

रीज़निंग मॉडल आख़िरी usage chunk में `reasoning_tokens` और `cached_tokens` बता सकते हैं। अगर कनेक्शन `[DONE]` से पहले बंद हो जाए, तो जवाब को अधूरा मानें, `X-Request-ID` हेडर दर्ज करें, और तय करें कि नया अनुरोध भेजना सुरक्षित है या नहीं। BroadNet के डॉक्स कहते हैं कि प्रोडक्शन में भरोसा करने से पहले जिस मॉडल को आप इस्तेमाल करेंगे, उस पर स्ट्रीमिंग जाँच लें। ब्योरा [स्ट्रीमिंग गाइड](https://broadrouter.com/hi/guides/streaming-chat-completions/) और [एरर और रीट्राई](https://broadrouter.com/hi/guides/errors-and-retries/) में है।

## आम ग़लतियाँ

-   बंद हुए कनेक्शन को पूरा जवाब मान लेना। सिर्फ़ `[DONE]` का मतलब है कि जवाब पूरा है।
-   क्लाइंट के आगे बफ़र करने वाला प्रॉक्सी लगाना। तब जवाब एक साथ ही पहुँचता है।

## अक्सर पूछे जाने वाले सवाल

### क्या स्ट्रीमिंग से मॉडल तेज़ हो जाता है?

नहीं। जनरेशन की रफ़्तार वही रहती है। स्ट्रीमिंग पहले शब्द जल्दी दिखाती है, इसलिए जवाब तेज़ लगता है, और कोड अधूरे आउटपुट पर भी काम शुरू कर सकता है।

### स्ट्रीम में टोकन usage कैसे मिले?

Chat Completions फ़ॉर्मैट में stream\_options भेजें और उसमें include\_usage को true रखें। तब आख़िरी चंक में usage और एक ख़ाली choices लिस्ट आती है।

### क्या दोबारा चलाई गई स्ट्रीम का बिल दो बार बनता है?

प्रति-टोकन वाली key पर आम तौर पर हाँ। रीट्राई एक नया इन्फ़रेंस है, जिसका बिल फिर बनता है। बिना टोकन मीटर वाले फ़्लैट प्लान पर इसकी क़ीमत सिर्फ़ समय है।

## यह भी देखें

-   [टोकन प्रति सेकंड (tokens per second, TPS)](https://broadrouter.com/hi/glossary/tokens-per-second/) (शब्द)
-   [कॉन्करेंसी (concurrency)](https://broadrouter.com/hi/glossary/concurrency/) (शब्द)
-   [OpenAI-compatible API](https://broadrouter.com/hi/glossary/openai-compatible-api/) (शब्द)
-   [इनपुट और आउटपुट टोकन (input and output tokens)](https://broadrouter.com/hi/glossary/input-and-output-tokens/) (शब्द)
-   [Server-sent events (SSE)](https://broadrouter.com/hi/glossary/sse/) (शब्द)
-   [पहले टोकन तक का समय (TTFT, time to first token)](https://broadrouter.com/hi/glossary/time-to-first-token/) (शब्द)
-   [chat completions स्ट्रीम करें और टूटे कनेक्शन सँभालें](https://broadrouter.com/hi/guides/streaming-chat-completions/) (गाइड)
-   [BroadNet Inference के साथ OpenAI Python SDK इस्तेमाल करें](https://broadrouter.com/hi/guides/openai-python-sdk/) (गाइड)
-   [BroadNet Inference के साथ OpenAI Node.js SDK इस्तेमाल करें](https://broadrouter.com/hi/guides/openai-node-sdk/) (गाइड)
-   [BroadNet Inference के एरर कोड और रीट्राई कब करें](https://broadrouter.com/hi/guides/errors-and-retries/) (गाइड)
-   [OpenAI-कम्पैटिबल API पर माइग्रेट करना: पूरी चेकलिस्ट](https://broadrouter.com/hi/blog/openai-compatible-api-migration-checklist/) (लेख)

इसे अपने असली वर्कलोड पर आज़माएँ। नए अकाउंट Gemma और ट्रांसक्रिप्शन के लिए US$5 के क्रेडिट से शुरू होते हैं। DeepSeek, GLM, और Qwen3.8 के लिए टॉप-अप ज़रूरी है।

[शुरू करें](https://inference.broadnet.ai/account/?utm_source=broadrouter&utm_medium=referral&utm_campaign=hi-glossary-streaming&utm_content=page-cta) ·

**स्रोत**

-   [MDN, server-sent events का इस्तेमाल](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)
-   [OpenAI, API रिस्पॉन्स की स्ट्रीमिंग](https://developers.openai.com/api/docs/guides/streaming-responses)
-   [BroadNet Inference API रेफ़रंस, स्ट्रीमिंग (अंग्रेज़ी में)](https://inference.broadnet.ai/docs?utm_source=broadrouter&utm_medium=referral&utm_campaign=hi-glossary-streaming&utm_content=sources#requests)
