This API is in beta stage and may have breaking changes.
The Responses API Beta supports both simple string input and structured message arrays, making it easy to get started with basic text generation.
The simplest way to use the API is with a string input:
For more complex conversations, use the message array format:
The API returns a structured response with the generated content:
Enable streaming for real-time response generation:
The streaming response returns Server-Sent Events (SSE) chunks:
Handle common errors gracefully:
Since the Responses API Beta is stateless, you must include the full conversation history in each request to maintain context:
The id and status fields are required for any assistant role messages included in the conversation history.
Always include the complete conversation history in each request. The API does not store previous messages, so context must be maintained client-side.