Skip to main content
This guide helps you migrate between major versions of the OpenAI Python SDK.

Version 2.x to Latest

Breaking Changes in v2.0.0

Function Call Output Types

In v2.0.0, the output field for function tool calls now supports images and files in addition to strings: Before (v1.x):
After (v2.x):
This change affects ResponseFunctionToolCallOutputItem.output and ResponseCustomToolCallOutput.output.

Version 1.x to 2.x

Package Compatibility

Version 2.x maintains backward compatibility for most features. Update your package:

New Features in v2.x

Responses API Enhancements

Version 0.x to 1.x

Version 0.x is no longer supported. Please upgrade to v1.x or later.

Major Changes

Version 1.0 was a complete rewrite with many breaking changes:

Client Initialization

Before (v0.x):
After (v1.x):

Resource Structure

Before (v0.x):
After (v1.x):

Error Handling

Before (v0.x):
After (v1.x):

Async Support

Before (v0.x):
After (v1.x):

Streaming

Before (v0.x):
After (v1.x):

Migration Checklist

1

Update imports

Change from module-level functions to client-based API:
2

Update API calls

Migrate resource paths:
3

Update error handling

Error classes moved:
4

Update async usage

Use AsyncOpenAI client:
5

Test thoroughly

Test all API interactions in your application to ensure compatibility.

Python Version Support

Python 3.8 support was dropped in SDK version 2.7.1. Please upgrade to Python 3.9 or later.

Deprecated Features

Assistants API

The Assistants API is deprecated in favor of the Responses API: Deprecated:
Use instead:
See the Responses API documentation for migration details.

Getting Help

If you encounter issues during migration:
  1. Check the CHANGELOG for detailed version changes
  2. Review the API Reference for current method signatures
  3. Visit the GitHub issues for community support
  4. See the examples directory for working code samples

Version Detection

Check your installed version:
Or via command line: