Skip to content

How to Migrate from OpenAI Assistants API to Responses API

I was building an AI research assistant using the OpenAI Assistants API when I got the news: OpenAI is sunsetting the Assistants API in 2026. I needed to migrate my application to the new Responses API before the deadline. Here’s what I learned during the migration process.

Why the Migration Matters

OpenAI announced that the Assistants API will sunset in 2026 after achieving full feature parity with the Responses API. From the official changelog:

  • March 11, 2025: Responses API released as “a new API for creating and using agents and tools”
  • Same announcement: “Announced plans to bring all Assistants API features to the easier to use Responses API, with an anticipated sunset date for Assistants in 2026 (after achieving full feature parity)”
  • August 20, 2025: Conversations API released “which allows you to create and manage long-running conversations with the Responses API”
  • May 20, 2025: New built-in tools added to Responses API including MCP servers and code interpreter

Endpoint Changes

The first thing I noticed was that everything moved. The Assistants API used v1/assistants endpoints, but the Responses API uses v1/responses. Here’s what changed:

Endpoint Mapping
Assistants API → Responses API
─────────────────────────────────
v1/assistants → v1/responses
v1/threads → v1/conversations
v1/threads/runs → Inline with responses
v1/threads/runs/steps → Streaming responses

Tool Integrations

I had to rewrite how I handle tools. The old Assistants API created an assistant with tools configured:

old_approach.py
# Creating an assistant with file search
from openai import OpenAI
client = OpenAI()
assistant = client.beta.assistants.create(
name="Research Assistant",
instructions="You are a helpful research assistant.",
tools=[{"type": "file_search"}],
model="gpt-4o"
)
# Running on a thread
run = client.beta.threads.runs.create(
thread_id=thread.id,
assistant_id=assistant.id
)

The new Responses API approach is more direct:

new_approach.py
from openai import OpenAI
client = OpenAI()
response = client.responses.create(
model="gpt-4o",
instructions="You are a helpful research assistant.",
tools=[
{"type": "file_search"},
{"type": "code_interpreter"}
],
input="Research the latest AI developments"
)

Conversation Handling

For long-running conversations, I learned to use the Conversations API instead of managing threads manually:

conversation_handling.py
from openai import OpenAI
client = OpenAI()
# Create a conversation for persistent sessions
conversation = client.conversations.create()
print(f"Conversation ID: {conversation.id}")
# Send messages in the conversation
response = client.responses.create(
model="gpt-4o",
conversation_id=conversation.id,
input="Continue our discussion about AI developments"
)
# Conversation keeps context automatically
second_response = client.responses.create(
model="gpt-4o",
conversation_id=conversation.id,
input="What about LLM efficiency improvements?"
)

What I Gained from Migration

After migrating, I got access to features that weren’t available in the Assistants API:

  • Compaction: Server-side and client-side compaction for long-running agent workflows
  • WebSocket mode: Real-time streaming for interactive experiences
  • Skills support: Custom tool execution through skills
  • Hosted Shell tool: Networking in containers for more powerful code execution
  • Connectors: MCP wrappers for Google apps, Dropbox, and other services

Common Mistakes I Made

During migration, I hit several issues:

Mistake 1: Assuming exact endpoint compatibility

I tried to map the old endpoint structure directly to the new one. The Responses API has a different structure that doesn’t map 1:1 with Assistants API endpoints.

Mistake 2: Waiting too long to test

I assumed feature parity was complete. It’s not. Test early and check which features your application actually needs.

Mistake 3: Not leveraging new tools

I initially ported my existing tools without exploring the new MCP connectors and other built-in tools that could simplify my code.

Testing Feature Parity

Before fully migrating, I created a test suite to verify that my application’s critical features still work:

migration_test.py
import pytest
from openai import OpenAI
client = OpenAI()
def test_file_search_migration():
"""Test that file search works in Responses API"""
response = client.responses.create(
model="gpt-4o",
tools=[{"type": "file_search"}],
input="Find information in the uploaded documents"
)
assert response.status == "completed"
def test_code_interpreter_migration():
"""Test that code interpreter works in Responses API"""
response = client.responses.create(
model="gpt-4o",
tools=[{"type": "code_interpreter"}],
input="Calculate the first 100 prime numbers"
)
assert response.status == "completed"
def test_conversation_persistence():
"""Test that conversations maintain context"""
conv = client.conversations.create()
first = client.responses.create(
model="gpt-4o",
conversation_id=conv.id,
input="My favorite color is blue"
)
second = client.responses.create(
model="gpt-4o",
conversation_id=conv.id,
input="What did I just tell you?"
)
# Check if the model remembers the first message
assert "blue" in second.output[0].content[0].text.lower()

Next Steps

Here’s what I recommend for your migration:

  1. Review the official migration guide - Start with OpenAI’s documentation to understand the full scope of changes
  2. Audit your current usage - List all features you’re using in the Assistants API
  3. Test feature parity - Run your test suite against the Responses API
  4. Migrate incrementally - Don’t try to change everything at once
  5. Explore new features - Take advantage of compaction, WebSocket streaming, and MCP connectors

The 2026 sunset gives us time, but migrating early gives you access to newer agentic capabilities that can improve your applications. Don’t wait until the last minute.

Final Words + More Resources

My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me

Here are also the most important links from this article along with some further resources that will help you in this scope:

Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!

Comments