Create Response
Generate a response for the provided input with optional web search and reasoning.
Request body
System instructions for the model
ISO 639-1 language code for response language
Maximum tokens to generate
Maximum number of research loop steps. If provided, overrides the preset's max_steps value. Must be >= 1 if specified. Maximum allowed is 100.
Model ID in provider/model format (e.g., "xai/grok-4-1", "openai/gpt-4o"). If models is also provided, models takes precedence. Required if neither models nor preset is provided.
Model fallback chain. Each model is in provider/model format. Models are tried in order until one succeeds. Max 5 models allowed. If set, takes precedence over single model field. The response.model will reflect the model that actually succeeded.
Preset configuration name (e.g., "sonar-pro", "sonar-reasoning"). Pre-configured model with system prompt and search parameters. Required if model is not provided.
If true, returns SSE stream instead of JSON
Run the response asynchronously. When true, the request is queued and the response object's status will be queued or in_progress. Poll GET /v1/responses/{response_id} to retrieve the final result.
OpenAI-compatible previous response id for multi-turn response chains. When set, the new response continues from the completed prior response using its durable continuation snapshot. The prior response must belong to the same account and have completed.
OpenAI-compatible storage toggle. When false, the response is hidden from later retrieve calls, and the echoed response reports store: false. It can still be used as a previous_response_id continuation source.
Response
Successful response. Content type depends on stream parameter:
- stream: false (default): application/json with Response
- stream: true: text/event-stream with SSE events
Object type in API responses
Status of a response or output item
Whether the response was created in background mode.
ID of the previous response in the chain, when the response was created with previous_response_id.
Whether the response is stored and visible to later retrieve calls. A response created with store=false can still be used as a previous_response_id continuation source.