For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

Assistants migration guide

The Assistants API was sunset on August 26, 2026.

The Assistants API was officially sunset on August 26, 2026, and is no longer available. Use the Responses API for new integrations.

Thank you to everyone who used the Assistants API. We appreciate everything you built and the feedback you shared along the way.

Use this guide to migrate your integration to the Responses API.

Responses are simpler—send input items and get output items back. With the Responses API, you also get better performance and new features like web search, MCP, and computer use. This change also lets you manage conversations instead of passing back previous_response_id.

What’s changed?

BeforeNowWhy?
AssistantsResponses request configuration

Keep the model, instructions, and tools in your application and pass them in the request.

ThreadsConversationsStreams of items instead of just messages
RunsResponses

Responses send input items or use a conversation object and receive output items; tool call loops are explicitly managed

Run stepsItems

Generalized objects—can be messages, tool calls, outputs, and more

Migrate Ruby applications

The Ruby SDK migration guide lists the retired Assistants and Threads bindings. Keep your model choice, instructions, and tool definitions in your application. Pass them as model:, instructions:, and tools: when you call client.responses.create.

Create a Conversation for each thread you migrate. Convert messages and tool results from your own stored history to Conversation items and keep them in their original order. Store the new Conversation ID with the original thread ID.

Create a Conversation with saved messages
require "openai"

client = OpenAI::Client.new
conversation = client.conversations.create(
  items: [
    {
      role: :user,
      content: "What are the five Ds of dodgeball?"
    }
  ],
  metadata: { user_id: "peter_le_fleur" }
)
puts(conversation.id)

Pass the returned ID as conversation: on later requests. For application-run function tools, send each result as a function_call_output item with the matching call_id.

Continue the Conversation with a Response
require "openai"

client = OpenAI::Client.new
response = client.responses.create(
  model: "gpt-6.2-astra",
  input: [
    {
      role: :user,
      content: "What are the five Ds of dodgeball?"
    }
  ],
  conversation: "conv_abc123"
)
puts(response.output_text)

From assistants to prompts

Assistants bundled model choice, instructions, and tool definitions. Move that configuration into a versioned module in your application and pass it with each Responses API request.

  1. Identify the model, instructions, tools, and output schema from your application’s Assistant configuration.
  2. Pass the model as model, instructions as instructions, and tool definitions as tools. Use text.format for a structured output schema.
  3. Test the new configuration against representative inputs before rolling it out. If your integration already moved to saved prompt IDs, follow Migrate from prompt objects.

From threads to conversations

A thread was a collection of messages stored server-side. Threads could only store messages. Conversations store items, which can include messages, tool calls, tool outputs, and other data.

Request example

Python

Thread object
thread = openai.beta.threads.create(
    messages=[{"role": "user", "content": "what are the 5 Ds of dodgeball?"}],
    metadata={"user_id": "peter_le_fleur"},
)
Conversation object
conversation = openai.conversations.create(
    items=[{"role": "user", "content": "what are the 5 Ds of dodgeball?"}],
    metadata={"user_id": "peter_le_fleur"},
)

Go

Thread object (Go)
thread, err := client.Beta.Threads.New(context.Background(), openai.BetaThreadNewParams{
	Messages: []openai.BetaThreadNewParamsMessage{{
		Role: "user",
		Content: openai.BetaThreadNewParamsMessageContentUnion{
			OfString: openai.String("what are the 5 Ds of dodgeball?"),
		},
	}},
	Metadata: shared.Metadata{"user_id": "peter_le_fleur"},
})
if err != nil {
	panic(err)
}
Conversation object (Go)
conversation, err := client.Conversations.New(context.Background(), conversations.ConversationNewParams{
	Items: []responses.ResponseInputItemUnionParam{
		responses.ResponseInputItemParamOfMessage("what are the 5 Ds of dodgeball?", responses.EasyInputMessageRoleUser),
	},
	Metadata: shared.Metadata{"user_id": "peter_le_fleur"},
})
if err != nil {
	panic(err)
}

TypeScript

Thread object (TypeScript)
import OpenAI from "openai";

const client = new OpenAI();
const thread = await client.beta.threads.create({
  messages: [{ role: "user", content: "what are the 5 Ds of dodgeball?" }],
  metadata: { user_id: "peter_le_fleur" },
});
console.log(thread.id);
Conversation object (TypeScript)
import OpenAI from "openai";

const client = new OpenAI();

const conversation = await client.conversations.create({
  items: [{ role: "user", content: "What are the five Ds of dodgeball?" }],
  metadata: { user_id: "peter_le_fleur" },
});

console.log(conversation.id);

Ruby

The “before” example uses OpenAI Ruby SDK 0.127.0 and the retired Assistants API. Ruby SDK 1.0 removed these bindings. Use the “now” example with the current SDK.

Before: Thread (Ruby SDK 0.127.0, retired)
# Historical OpenAI Ruby SDK 0.127.0 example.
# The Assistants API is retired; these bindings were removed in SDK 1.0.
require "openai"

client = OpenAI::Client.new
thread = client.beta.threads.create(
  messages: [
    {
      role: :user,
      content: "What are the five Ds of dodgeball?"
    }
  ],
  metadata: { user_id: "peter_le_fleur" }
)
puts(thread.id)
Now: Conversation (Ruby)
require "openai"

client = OpenAI::Client.new
conversation = client.conversations.create(
  items: [
    {
      role: :user,
      content: "What are the five Ds of dodgeball?"
    }
  ],
  metadata: { user_id: "peter_le_fleur" }
)
puts(conversation.id)

Response example

Thread object
{
"id": "thread_CrXtCzcyEQbkAcXuNmVSKFs1",
"object": "thread",
"created_at": 1752855924,
"metadata": {
  "user_id": "peter_le_fleur"
},
"tool_resources": {}
}
Conversation object
{
"id": "conv_68542dc602388199a30af27d040cefd4087a04b576bfeb24",
"object": "conversation",
"created_at": 1752855924,
"metadata": {
	"user_id": "peter_le_fleur"
}
}

From runs to responses

Runs were asynchronous processes that executed against threads. See the example below. Responses are simpler: provide a set of input items to execute, and get a list of output items back.

Use a conversation to store context across Responses API requests. Pass configuration such as instructions and tool definitions with each request.

Request example

Python

Run object
# Replace the illustrative IDs and URLs below with your own resource values.
import time

from openai import OpenAI

openai = OpenAI()
thread_id = "thread_123"
assistant_id = "asst_123"

run = openai.beta.threads.runs.create(
    thread_id=thread_id,
    assistant_id=assistant_id,
)

while run.status in ("queued", "in_progress"):
    time.sleep(1)
    run = openai.beta.threads.runs.retrieve(thread_id=thread_id, run_id=run.id)
Response object
# Replace the illustrative IDs and URLs below with your own resource values.

from openai import OpenAI

openai = OpenAI()
conversation_id = "conv_123"

response = openai.responses.create(
    model="gpt-6.2-astra",
    input=[{"role": "user", "content": "What are the 5 Ds of dodgeball?"}],
    conversation=conversation_id,
)

Go

Run object (Go)
run, err := client.Beta.Threads.Runs.New(context.Background(), "thread_abc123", openai.BetaThreadRunNewParams{
	AssistantID: "asst_abc123",
})
if err != nil {
	panic(err)
}
for run.Status == openai.RunStatusQueued || run.Status == openai.RunStatusInProgress {
	time.Sleep(time.Second)
	run, err = client.Beta.Threads.Runs.Get(context.Background(), "thread_abc123", run.ID)
	if err != nil {
		panic(err)
	}
}
Response object (Go)
_, err := client.Responses.New(context.Background(), responses.ResponseNewParams{
	Model: "gpt-6.2-astra",
	Input: responses.ResponseNewParamsInputUnion{OfInputItemList: responses.ResponseInputParam{
		responses.ResponseInputItemParamOfMessage("What are the 5 Ds of dodgeball?", responses.EasyInputMessageRoleUser),
	}},
	Conversation: responses.ResponseNewParamsConversationUnion{OfString: openai.String("conv_abc123")},
})
if err != nil {
	panic(err)
}

TypeScript

Run object (TypeScript)
import { setTimeout } from "node:timers/promises";
import OpenAI from "openai";

const client = new OpenAI();
// Replace these illustrative IDs with your own resources.
const threadId = "thread_123";
const assistantId = "asst_123";
let run = await client.beta.threads.runs.create(threadId, {
  assistant_id: assistantId,
});
while (run.status === "queued" || run.status === "in_progress") {
  await setTimeout(1000);
  run = await client.beta.threads.runs.retrieve(run.id, {
    thread_id: threadId,
  });
}
console.log(run.status);
Response object (TypeScript)
// Replace the illustrative IDs and URLs below with your own resource values.
import OpenAI from "openai";

const client = new OpenAI();
const conversationId = "conv_123";

const response = await client.responses.create({
  model: "gpt-6.2-astra",
  input: [{ role: "user", content: "What are the five Ds of dodgeball?" }],
  conversation: conversationId,
});

console.log(response.output_text);

Ruby

The “before” example uses OpenAI Ruby SDK 0.127.0 and the retired Assistants API. Ruby SDK 1.0 removed these bindings. Use the “now” example with the current SDK.

Before: Run (Ruby SDK 0.127.0, retired)
# Historical OpenAI Ruby SDK 0.127.0 example.
# The Assistants API is retired; these bindings were removed in SDK 1.0.
require "openai"

client = OpenAI::Client.new
thread_id = "thread_abc123"
run = client.beta.threads.runs.create(thread_id, assistant_id: "asst_abc123")
while %i[queued in_progress].include?(run.status)
  sleep(1)
  run = client.beta.threads.runs.retrieve(run.id, thread_id: thread_id)
end
puts(run.id)
Now: Response (Ruby)
require "openai"

client = OpenAI::Client.new
response = client.responses.create(
  model: "gpt-6.2-astra",
  input: [
    {
      role: :user,
      content: "What are the five Ds of dodgeball?"
    }
  ],
  conversation: "conv_abc123"
)
puts(response.output_text)

Response example

Run object
{
"id": "run_FKIpcs5ECSwuCmehBqsqkORj",
"assistant_id": "asst_8fVY45hU3IM6creFkVi5MBKB",
"cancelled_at": null,
"completed_at": 1752857327,
"created_at": 1752857322,
"expires_at": null,
"failed_at": null,
"incomplete_details": null,
"instructions": null,
"last_error": null,
"max_completion_tokens": null,
"max_prompt_tokens": null,
"metadata": {},
"model": "gpt-4.1",
"object": "thread.run",
"parallel_tool_calls": true,
"required_action": null,
"response_format": "auto",
"started_at": 1752857324,
"status": "completed",
"thread_id": "thread_CrXtCzcyEQbkAcXuNmVSKFs1",
"tool_choice": "auto",
"tools": [],
"truncation_strategy": {
  "type": "auto",
  "last_messages": null
},
"usage": {
  "completion_tokens": 130,
  "prompt_tokens": 34,
  "total_tokens": 164,
  "prompt_token_details": {
    "cached_tokens": 0
  },
  "completion_tokens_details": {
    "reasoning_tokens": 0
  }
},
"temperature": 1.0,
"top_p": 1.0,
"tool_resources": {},
"reasoning_effort": null
}
Response object
{
"id": "resp_687a7b53036c819baad6012d58b39bcb074adcd9e24850fc",
"created_at": 1752857427,
"conversation": {
  "id": "conv_689667905b048191b4740501625afd940c7533ace33a2dab"
},
"error": null,
"incomplete_details": null,
"instructions": null,
"metadata": {},
"model": "gpt-5.5",
"object": "response",
"output": [
  {
    "id": "msg_687a7b542948819ba79e77e14791ef83074adcd9e24850fc",
    "content": [
      {
        "annotations": [],
        "text": "The \"5 Ds of Dodgeball\" are a humorous set of rules made famous by the 2004 comedy film **\"Dodgeball: A True Underdog Story.\"** In the movie, dodgeball coach Patches O’Houlihan teaches these basics to his team. The **5 Ds** are:

1. **Dodge**
2. **Duck**
3. **Dip**
4. **Dive**
5. **Dodge** (yes, dodge is listed twice for emphasis!)

In summary:  
> **“If you can dodge a wrench, you can dodge a ball!”**

These 5 Ds are not official competitive rules, but have become a fun and memorable pop culture reference for the sport of dodgeball.",
        "type": "output_text",
        "logprobs": []
      }
    ],
    "role": "assistant",
    "status": "completed",
    "type": "message"
  }
],
"parallel_tool_calls": true,
"temperature": 1.0,
"tool_choice": "auto",
"tools": [],
"top_p": 1.0,
"background": false,
"max_output_tokens": null,
"previous_response_id": null,
"reasoning": {
  "effort": null,
  "generate_summary": null,
  "summary": null
},
"service_tier": "scale",
"status": "completed",
"text": {
  "format": {
    "type": "text"
  }
},
"truncation": "disabled",
"usage": {
  "input_tokens": 17,
  "input_tokens_details": {
    "cached_tokens": 0
  },
  "output_tokens": 150,
  "output_tokens_details": {
    "reasoning_tokens": 0
  },
  "total_tokens": 167
},
"user": null,
"max_tool_calls": null,
"store": true,
"top_logprobs": 0
}

Migrating your integration

Follow the migration steps below to move from the Assistants API to the Responses API.

For Ruby, follow Migrate Ruby applications to pass your application configuration directly in the request.

1. Move assistant configuration into code

Use the assistant configuration steps to build Responses API requests with your existing instructions and tools.

2. Move new user chats over to conversations and responses

Start new chats with the Conversations API and Responses API. To preserve earlier conversation history, use messages already stored by your application.

The example below shows how thread history could be migrated before the sunset. The Assistants API call that retrieves thread messages no longer works; use your stored messages instead.

# Replace the illustrative IDs and URLs below with your own resource values.

from openai import OpenAI

openai = OpenAI()
messages = []
thread_id = "thread_123"

for page in openai.beta.threads.messages.list(
    thread_id=thread_id, order="asc"
).iter_pages():
    messages += page.data

items = []
for m in messages:
    item = {"role": m.role}
    item_content = []

    for content in m.content:
        match content.type:
            case "text":
                item_content_type = "input_text" if m.role == "user" else "output_text"
                item_content += [
                    {"type": item_content_type, "text": content.text.value}
                ]
            case "image_url":
                item_content += [
                    {
                        "type": "input_image",
                        "image_url": content.image_url.url,
                        "detail": content.image_url.detail,
                    }
                ]

    item |= {"content": item_content}
    items.append(item)

# create a conversation with your converted items
conversation = openai.conversations.create(items=items)

Comparing full examples

These historical examples show two dependencies to remove from older chat apps. The Assistants API example uses retired endpoints. The Responses API example uses a saved prompt ID. For a new integration, configure the request in code.

User chat app

Historical chat app examples
# Replace the illustrative IDs and URLs below with your own resource values.
threads_by_session: dict[str, str] = {}


@app.post("/messages")
async def message(message: Message):
    thread_id = threads_by_session.get(message.session_id)
    if thread_id is None:
        thread_id = openai.beta.threads.create().id
        threads_by_session[message.session_id] = thread_id

    openai.beta.threads.messages.create(
        thread_id=thread_id,
        role="user",
        content=message.content,
    )

    example_assistant_id = "asst_123"
    run = openai.beta.threads.runs.create(
        assistant_id=example_assistant_id,
        thread_id=thread_id,
    )
    while run.status in ("queued", "in_progress"):
        await asyncio.sleep(1)
        run = openai.beta.threads.runs.retrieve(
            thread_id=thread_id,
            run_id=run.id,
        )

    messages = openai.beta.threads.messages.list(
        order="desc",
        limit=1,
        thread_id=thread_id,
    )

    return {"content": messages.data[0].content}
Earlier Ruby example using a reusable prompt

For new Ruby integrations, use the application-owned configuration in Migrate Ruby applications.

# Replace the illustrative IDs and URLs below with your own resource values.
require "openai"

client = OpenAI::Client.new
conversations_by_session = {}

handle_message = lambda do |session_id:, content:|
  unless session_id.is_a?(String) && !session_id.strip.empty? && content.is_a?(String) && !content.strip.empty?
    raise ArgumentError, "session_id and content are required"
  end

  conversation_id = conversations_by_session[session_id]
  unless conversation_id
    conversation_id = client.conversations.create.id
    conversations_by_session[session_id] = conversation_id
  end

  response = client.responses.create(
    prompt: { id: "pmpt_123" },
    input: [
      {
        role: :user,
        content: content
      }
    ],
    conversation: conversation_id
  )
  { content: response.output_text }
end

puts(
  handle_message.call(
    session_id: "example-session",
    content: "What are the five Ds of dodgeball?"
  )
)