stream_responses_api: Stream from Responses API

View source: R/provider_openai.R

stream_responses_apiR Documentation

Stream from Responses API

Description

Makes a streaming POST request to OpenAI Responses API and processes SSE events. The Responses API uses different event types than Chat Completions.

Usage

stream_responses_api(
  url,
  headers,
  body,
  callback,
  timeout_seconds = NULL,
  total_timeout_seconds = NULL,
  first_byte_timeout_seconds = NULL,
  connect_timeout_seconds = NULL,
  idle_timeout_seconds = NULL
)

Arguments

url

The API endpoint URL.

headers

A named list of HTTP headers.

body

The request body (will be converted to JSON).

callback

A function called for each event: callback(event_type, data, done).

timeout_seconds

Legacy alias for total_timeout_seconds.

total_timeout_seconds

Optional total stream timeout in seconds.

first_byte_timeout_seconds

Optional time-to-first-byte timeout in seconds.

connect_timeout_seconds

Optional connection-establishment timeout in seconds.

idle_timeout_seconds

Optional stall timeout in seconds.


aisdk documentation built on May 29, 2026, 9:07 a.m.