openai · OpenAI Platform Docs
Streaming API responses | OpenAI API
Explains how to implement real-time token streaming from the OpenAI API to improve perceived latency in user interfaces.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
Streaming API responses | OpenAI API
Explains how to implement real-time token streaming from the OpenAI API to improve perceived latency in user interfaces.
When To Use
Use when you need to implement real-time text updates in a UI to reduce perceived latency during long model generations.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/streaming-api-responses-openai-workflow-guide.md | A guide explaining how to enable and read streaming responses for chat completions using the OpenAI API. | Questions about a guide explaining how to enable and read streaming responses for chat completions using the OpenAI API. |
examples/streaming-api-responses-openai-openai-api-nodejs-streaming-response.text | A Node.js code example demonstrating how to use the OpenAI client to create and iterate over a streaming API response. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to use the OpenAI client to create and iterate over a streaming API response. |
examples/streaming-api-responses-openai-openai-python-streaming-api-response.text | A Python code example demonstrating how to use the OpenAI client to create and iterate over a streaming API response. | Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the OpenAI client to create and iterate over a streaming API response. |
examples/streaming-api-responses-openai-openai-streaming-api-csharp.text | A C# code example demonstrating how to implement asynchronous streaming responses using the OpenAI API. | Exact payloads, commands, or snippets shown in A C# code example demonstrating how to implement asynchronous streaming responses using the OpenAI API. |
examples/streaming-api-responses-openai-openai-streaming-event-typescript-types.text | A TypeScript definition of the various event types used in OpenAI streaming API responses. | Exact payloads, commands, or snippets shown in A TypeScript definition of the various event types used in OpenAI streaming API responses. |
examples/streaming-api-responses-openai-openai-chat-completions-nodejs-streaming.text | A Node.js code example demonstrating how to iterate over a stream of chat completion chunks using the OpenAI SDK. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to iterate over a stream of chat completion chunks using the OpenAI SDK. |
examples/streaming-api-responses-openai-openai-chat-completions-python-streaming.text | A Python script demonstrating how to iterate through a stream of chat completion chunks using the OpenAI client. | Exact payloads, commands, or snippets shown in A Python script demonstrating how to iterate through a stream of chat completion chunks using the OpenAI client. |
examples/streaming-api-responses-openai-openai-streaming-api-response-event-struc.text | A text representation of the specific fields and event objects returned during an OpenAI streaming API response. | Exact payloads, commands, or snippets shown in A text representation of the specific fields and event objects returned during an OpenAI streaming API response. |
examples/streaming-api-responses-openai-openai-streaming-api-response-chunks.text | A text representation of sequential content chunks received during an OpenAI API streaming response. | Exact payloads, commands, or snippets shown in A text representation of sequential content chunks received during an OpenAI API streaming response. |
examples/streaming-api-responses-openai-openai-chat-completions-streaming-nodejs.text | A Node.js code example demonstrating how to use the OpenAI client to stream chat completion responses using an async iterator. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to use the OpenAI client to stream chat completion responses using an async... |
examples/streaming-api-responses-openai-openai-chat-completions-python-streaming-2.text | A Python script demonstrating how to iterate through a stream of chat completion chunks using the OpenAI client. | Exact payloads, commands, or snippets shown in A Python script demonstrating how to iterate through a stream of chat completion chunks using the OpenAI client. |
What This Skill Covers
- By default, when you make a request to the OpenAI API, we generate the model’s entire output before sending it back in a single HTTP response. When generatin...
- Main sections:
Enable streaming,Stream a chat completion,Read the responses,Advanced use cases,Moderation risk.
Workflow
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - Do not add behavior or configuration that is not present in the attached source files.
Canonical source: https://developers.openai.com/api/docs/guides/streaming-responses
