Prompt Buddy logoPrompt Buddy

openai · OpenAI Platform Docs

Streaming API responses

How to implement server-sent events (SSE) by setting the stream parameter to true and handling typed semantic events to process model outputs incrementally.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Streaming API responses

How to implement server-sent events (SSE) by setting the stream parameter to true and handling typed semantic events to process model outputs incrementally.

When To Use

Use when you need to implement real-time text rendering or incremental processing of model outputs to reduce perceived latency in an application.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/streaming-api-responses-workflow-guide.mdA guide explaining how to enable and handle real-time streaming responses from the OpenAI API to reduce perceived latency.Questions about a guide explaining how to enable and handle real-time streaming responses from the OpenAI API to reduce perceived lat...
examples/streaming-api-responses-openai-streaming-api-python-event-types.pythonA Python implementation demonstrating the various event types used when streaming API responses.Exact payloads, commands, or snippets shown in A Python implementation demonstrating the various event types used when streaming API responses.
examples/streaming-api-responses-openai-streaming-api-response-object-structure.textA text representation of the fields and structure found in an OpenAI streaming API response object.Exact payloads, commands, or snippets shown in A text representation of the fields and structure found in an OpenAI streaming API response object.

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, Read the responses, Advanced use cases, Moderation risk.

Workflow

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. 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.md