OpenAI Node SDK migration guide
Upgrade the openai npm package from 4.x to 5.x, then through later 5, 6 and 7 releases. Find breaking changes in your code and review supported fixes.
Choose your OpenAI Node SDK migration path
The openai package is the OpenAI library for TypeScript and JavaScript. Start with the release you are moving to. The 5.0 guide covers the major upgrade, which changes calls and imports. Each later page covers a smaller change to request or client option types.
- Migrate openai 4.x to 5.0:
beta.chatmoves tochat,fileFromPath, the shims andrunFunctionsare removed, andopenai/srcno longer resolves. Read it with the OpenAI v5 migration guide. - Later 5.x, 6.x and 7.x releases: each page covers a change to the declared type of a request field or client option. Most add an accepted value. Some rename or deprecate one, such as
prompt_cache_retentionin 6.35.0 and Videos in 7.5.0. Read the page for each release between your current version and your target. The list is below.
Check your repository before you upgrade
- Check the installed
openaiversion in your manifest and lockfile. Read each guide between that version and your target. - Run
npx emendant scanin your TypeScript or JavaScript repository. It reports supported changes at affected call sites without editing your files. - Review the findings, then run
npx emendant fix --dry-runto inspect eligible patches. Emendant does not update package versions for you. - After you update dependencies, run your own typecheck and tests.
What Emendant fixes, and the gaps
- In 5.0, transforms patch the
beta.chatrename, the move toopenai/corepaths and theopenai/srcimports. The other 5.0 changes need a model provider you name, or are report only. - The type changes in later releases are patched only when you name a model provider. The Videos deprecation in 7.5.0 is report only.
- The feed has no entry for openai 6.0.0 or 7.0.0. A scan does not report what those major releases changed. Read the 6.0.0 and 7.0.0 release notes before you upgrade past them.
Emendant reports only changes in its curated feed. A clean scan does not prove that every OpenAI SDK migration step is complete. Read the supported projects guide for the current scope and the fix guide for patch grades.
OpenAI Node SDK release pages
- OpenAI Node SDK 7.x breaking changes: 7.2.0 to 7.12.1
5 releases, 7.2.0 to 7.12.1, released 30 July 2026 to 9 September 2026. 9 breaking, 1 deprecation. - OpenAI Node SDK 6.x breaking changes: 6.3.0 to 6.49.0
11 releases, 6.3.0 to 6.49.0, released 10 October 2025 to 23 July 2026. 17 breaking, 0 deprecations. - OpenAI Node SDK 5.x breaking changes: 5.4.0 to 5.18.0
3 releases, 5.4.0 to 5.18.0, released 16 June 2025 to 2 September 2025. 6 breaking, 0 deprecations. - OpenAI Node SDK 5.0.0: what breaks when you upgrade openai from 4.x
openai 5.0.0, released 29 May 2025. 10 breaking, 1 deprecation.
Releases without a page here may still be in the feed. Run emendant feed status to see what your snapshot holds.