How It Works
Each response has a uniqueid. Pass it as previous_response_id in your next request, and the model automatically has access to the full conversation context up to that point.
You don’t need to resend any messages from earlier turns. The server reconstructs the full conversation from the chain of response IDs.
Basic Example
- Python
- Node.js
- cURL
Using Instructions Across Turns
Theinstructions parameter applies system-level guidance to every turn. When using previous_response_id, include instructions on each request to maintain consistent behavior.
Conversation Branching
Since each response has its own ID, you can branch conversations by referencing the sameprevious_response_id in multiple follow-up requests:
Disabling Storage
By default, responses are stored server-side so they can be referenced by future requests. If you don’t need multi-turn and want to avoid storing data, setstore: false:
Comparison: Multi-turn Approaches
Token Usage in Multi-turn
Each turn in aprevious_response_id chain re-processes the full conversation history as input tokens. The billing is the same as Chat Completions — longer conversations cost more per turn.
To manage costs:
- Keep conversations short when possible
- Use
instructionsinstead of long system messages repeated ininput - Start a new conversation chain when the topic changes significantly
- Use Prompt Caching on models that support it
Token usage reported in the
usage field reflects the full context processed for that turn, including all prior messages from the chain.