How can I detect breaking changes in the OpenAI Node SDK?

Emendant finds supported OpenAI Node SDK changes in TypeScript and JavaScript code. It covers the 4.x to 5.0 upgrade and selected later 5.x, 6.x and 7.x releases listed below. Run npx emendant scan from your repository, then review each affected code location and its release source with npx emendant explain <change-id>. Use the scan guide to read findings and coverage warnings. A clean scan does not cover changes absent from the feed.

Example: move a beta chat call in openai 5.0

In openai 5.0.0, beta.chat is removed. For a client created with new OpenAI(), Emendant can report this affected call and offer a deterministic rename:

Before the upgrade:

import OpenAI from "openai";
const client = new OpenAI();
await client.beta.chat.completions.parse({
  model: "gpt-4o", messages: [],
});

Possible fix for 5.0:

await client.chat.completions.parse({
  model: "gpt-4o", messages: [],
});

The OpenAI v5 migration source confirms this move. Review the 5.0 coverage and remaining changes. Related type imports also move and need review. An ambiguous client binding can prevent detection. Inspect possible patches with npx emendant fix --dry-run; a preview checks structure but does not install the target SDK or run your typecheck and tests. Run your typecheck and tests against the target SDK before you apply a patch.

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. Later pages cover selected changes to request types, client options or runtime requirements.

  • Migrate openai 4.x to 5.0: beta.chat moves to chat, fileFromPath, the shims and runFunctions are removed, and openai/src no longer resolves. Read it with the OpenAI v5 migration guide.
  • Later 5.x, 6.x and 7.x releases: pages cover selected changes to request fields, client options or runtime requirements. Most add an accepted value. Some rename or deprecate one, such as prompt_cache_retention in 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

  1. Check the installed openai version in your manifest and lockfile. Read each guide between that version and your target.
  2. Run npx emendant scan in your TypeScript or JavaScript repository. It reports supported changes at affected call sites without editing your files.
  3. Review the findings, then run npx emendant fix --dry-run to inspect eligible patches. Emendant does not update package versions for you.
  4. After you update dependencies, run your own typecheck and tests.

What Emendant fixes, and the gaps

  • In 5.0, transforms patch the beta.chat rename, the move to openai/core paths and the openai/src imports. 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. The 7.0.0 entry checks the tighter Node.js requirement only and offers no patch. 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, the fix guide for patch grades, and whether AI-generated migration patches are safe.

Reviewing a dependency update PR? Follow Use Emendant alongside Dependabot to scan affected code, review possible patches, and check the remaining migration work.

OpenAI Node SDK release pages

Releases without a page here may still be in the feed. Run emendant feed status to see what your snapshot holds.