View source: R/provider_openai.R
| stream_responses_api | R Documentation |
Makes a streaming POST request to OpenAI Responses API and processes SSE events. The Responses API uses different event types than Chat Completions.
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
)
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 |
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. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.