Persistent Multi-Turn State — Conversations API
Persistent Multi-Turn State
What Is the Conversations API?
The Conversations API is OpenAI's dedicated endpoint for managing persistent, server-side conversation state. It replaces the manual pattern of tracking message arrays client-side or using the legacy Assistants API Threads.
Why It Exists
With Chat Completions, developers had to store and re-send the entire message history on every request - leading to token waste, context truncation bugs, and complex client-side state management. The Conversations API eliminates this by letting OpenAI manage the conversation server-side.
Relationship to the Responses API
The Conversations API works hand-in-hand with the Responses API. You can either chain responses using store: true and previous_response_id, or explicitly create a Conversation object via POST /v1/conversations and pass conversation: conv.id in your Responses API requests.
API Usage Patterns
import OpenAI from "openai";
const openai = new OpenAI();
// Create an explicit server-side conversation container
const conv = await openai.conversations.create({
metadata: { user_id: "usr_882" }
});
// Start a conversation via the Responses API
const r1 = await openai.responses.create({
model: "gpt-6.1-sol",
conversation: conv.id,
store: true,
input: "I need help planning a product launch."
});
// Or chain directly via previous_response_id
const r2 = await openai.responses.create({
model: "gpt-6.1-sol",
store: true,
previous_response_id: r1.id,
input: "What marketing channels should I prioritize?"
});
// Retrieve or delete a stored response when no longer needed
const stored = await openai.responses.retrieve(r1.id);
await openai.responses.delete(r1.id);
Key Benefits
- Zero client-side state: No message arrays, no truncation logic, no local databases.
- Automatic prompt caching: Stored conversations get automatic prefix caching for 90%–95% input token savings on GPT-6 models (and 50%–75% on earlier generations).
- Seamless migration: Replaced Assistants API Threads (which shut down August 26, 2026) - use Conversations API + Responses API instead.
- Full audit trail: Every response is stored with metadata for compliance and debugging.
/v1/prompts also sunset on November 30, 2026). OpenAI did not provide an automated Thread-to-Conversation migration tool; pass instructions inline in your application code and use conversation or store: true + previous_response_id.Offload chat history to OpenAI servers. Initialize a persistent conversation session via /v1/conversations.