Skip to main content

Basic call

Use POST /v1/responses, Bearer authentication, and a responses model. This example does not store response content on the platform.

Streaming

Set stream: true and process individual events instead of treating SSE as JSON. Reuse the configured client:

Storage and continuation

store=true retains content for 30 days by default. Keep the response ID. With the same user and appropriate model permissions, query GET /v1/responses/RESPONSE_ID, inspect GET /v1/responses/RESPONSE_ID/input_items, and continue with previous_response_id through the original region. store=false keeps no platform content copy and does not permit HTTP lookup or continuation. History is available only within the same WebSocket connection. Background execution requires store=true.

Background execution and cancellation

When a channel supports background, submit with background: true, store: true and poll the stored response state. Cancel a background response:
DELETE /v1/responses/RESPONSE_ID cancels execution, denies future lookup and continuation, and removes content while retaining financial records. Cancellation or disconnection does not imply zero usage.

Other capabilities

POST /v1/responses/compact, POST /v1/responses/input_tokens, and WebSocket GET /v1/responses require channel support. Compact is metered; token counting has no generation charge. Event recovery uses the stream and starting_after query parameters in the original region.
After an interruption, check the stored response and logs before sending another generation request. See Capabilities and limits for tool and multimodal support.