openai 5 is the first release on the rewritten Stainless client. Most of the migration guide never touches application code. What does: beta.chat and runFunctions are gone, fileFromPath and the fetch shims were removed, openai/src no longer resolves, and APIError.headers changed type. The core modules moved under openai/core, with the old paths kept as deprecated re-exports.

What changed

Before and after

The beta.chat rename, on a client held in a variable:

import OpenAI from 'openai';
const client = new OpenAI();
export async function run() {
const parsed = await client.beta.chat.completions.parse({ model: 'gpt-4o', messages: [] });
const stream = client.beta.chat.completions.stream({ model: 'gpt-4o', messages: [] });
const runner = client.beta.chat.completions.runTools({ model: 'gpt-4o', messages: [], tools: [] });
return { parsed, stream, runner };
}

After npx emendant fix, the beta segment is dropped and nothing else moves:

import OpenAI from 'openai';
const client = new OpenAI();
export async function run() {
const parsed = await client.chat.completions.parse({ model: 'gpt-4o', messages: [] });
const stream = client.chat.completions.stream({ model: 'gpt-4o', messages: [] });
const runner = client.chat.completions.runTools({ model: 'gpt-4o', messages: [], tools: [] });
return { parsed, stream, runner };
}

The core module move is a specifier rewrite: 'openai/error' becomes 'openai/core/error', import clause untouched. fileFromPath is guidance rather than a patch, because the replacement is not a promise and the await goes with it:

const viaHelper = await fileFromPath('data/training.jsonl');

becomes

const viaHelper = fs.createReadStream('data/training.jsonl');

Migration guidance and its limits

Apply the three deterministic patches: the beta.chat rename, the openai/core rewrite and the openai/src rewrite. The last covers only the two specifiers that mean the package root; a deeper openai/src/... path is reported by nothing.

The assisted changes need a model provider named on the command line or in emendant.json. fileFromPath and the shims are small edits. runFunctions to runTools and APIClient to the concrete client are shape changes, so read the diff.

APIError.headers is reported at medium confidence, because the receiver type cannot be resolved from imports alone. Confirm it, then replace err.headers['x-request-id'] with err.headers.get('x-request-id').

The internal upload helpers and AzureClientOptions are report only: removed, with no documented replacement. The core module move is not urgent, since the old paths still resolve.

Releases after 5.0 change request and client option types one at a time. The OpenAI Node SDK migration guide lists a page for each one, and says what the feed does not cover in openai 6.0.0 and 7.0.0.

What Emendant detects, fixes and verifies

11 changes in openai 5.0.0. 3 automatic fixes, 6 fixes requiring a model provider you choose, 2 report only. Each patch states which checks passed. Understand patch evidence.

ChangeSeverityDetectsFixVerified by
Public core modules moved under openai/core
openai-npm-5.0.0-core-module-paths
Deprecation
  • any import of openai/error
  • any import of openai/pagination
  • any import of openai/resource
  • any import of openai/streaming
  • any import of openai/uploads
Patch, written by the replace-module-path transformYour typecheck and tests
APIClient base class removed
openai-npm-5.0.0-apiclient-removed
Breaking
  • APIClient imported from openai/core
Patch, only when you name a model providerYour typecheck and tests
fileFromPath helper removed
openai-npm-5.0.0-filefrompath-removed
error TS2305: Module '"openai/uploads"' has no exported member 'fileFromPath'.
error TS2339: Property 'fileFromPath' does not exist on type 'typeof OpenAI'.
Breaking
  • fileFromPath imported from openai/uploads
  • calls to fileFromPath imported from openai/uploads
  • .fileFromPath() on the openai namespace
Patch, only when you name a model providerYour typecheck and tests
beta.chat namespace removed
openai-npm-5.0.0-beta-chat-namespace
error TS2339: Property 'chat' does not exist on type 'Beta'.
Breaking
  • .beta.chat.completions.parse() on an instance constructed from openai
  • .beta.chat.completions.stream() on an instance constructed from openai
  • .beta.chat.completions.runTools() on an instance constructed from openai
Patch, written by the rename-property transformYour typecheck and tests
APIError.headers is now a Web Headers instance
openai-npm-5.0.0-apierror-headers-web
Breaking
medium confidence
  • .headers indexed on a value from openai
Patch, only when you name a model providerYour typecheck and tests
Internal upload helpers dropped from the uploads entrypoint
openai-npm-5.0.0-uploads-internal-exports-removed
error TS2305: Module '"openai/uploads"' has no exported member 'createForm'.
error TS2305: Module '"openai/uploads"' has no exported member 'isBlobLike'.
error TS2305: Module '"openai/uploads"' has no exported member 'FileLike'.
Breaking
  • BlobPart imported from openai/uploads
  • BlobLike imported from openai/uploads
  • FileLike imported from openai/uploads
  • ResponseLike imported from openai/uploads
  • isResponseLike imported from openai/uploads
  • isFileLike imported from openai/uploads
  • isBlobLike imported from openai/uploads
  • isUploadable imported from openai/uploads
  • isMultipartBody imported from openai/uploads
  • maybeMultipartFormRequestOptions imported from openai/uploads
  • multipartFormRequestOptions imported from openai/uploads
  • createForm imported from openai/uploads
Report onlyNot applicable
The shims entrypoints were removed
openai-npm-5.0.0-shims-removed
Breaking
  • any import of openai/shims/web
  • any import of openai/shims/node
Patch, only when you name a model providerYour typecheck and tests
The openai/src entrypoints were removed
openai-npm-5.0.0-src-directory-removed
Breaking
  • any import of openai/src
  • any import of openai/src/index
Patch, written by the replace-module-path transformYour typecheck and tests
The runFunctions helpers were removed
openai-npm-5.0.0-runfunctions-removed
error TS2339: Property 'chat' does not exist on type 'Beta'.
Breaking
  • .chat.completions.runFunctions() on an instance constructed from openai
  • .beta.chat.completions.runFunctions() on an instance constructed from openai
Patch, only when you name a model providerYour typecheck and tests
Removed AzureClientOptions
openai-npm-5.0.0-azure-client-options-removed
error TS2724: '"openai"' has no exported member named 'AzureClientOptions'. Did you mean 'ClientOptions'?
Breaking
  • AzureClientOptions imported from openai
Report onlyNot applicable
fileFromPath removed from the package root
openai-npm-5.0.0-file-from-path-removed
error TS2614: Module '"openai"' has no exported member 'fileFromPath'. Did you mean to use 'import fileFromPath from "openai"' instead?
Breaking
  • fileFromPath imported from openai
Patch, only when you name a model providerYour typecheck and tests

emendant explain <change-id> prints any row's entry, guidance and sources at the terminal.

The error TS lines are what TypeScript 5.9.3 printed when code that compiled against openai 4.104.0 was compiled against 5.0.0. A row without one is a change the compiler does not report, such as a deprecation or a change in behaviour.

Coverage

Requires emendant@0.1.0 or later. Run emendant feed update to get the latest coverage.

Coverage details
Snapshot
2026-08-28.1, sequence 11, signed 28 August 2026
Feed entry
feed/npm/openai/5.0.0.json

emendant feed status shows the snapshot your machine holds.

Primary sources

Scan your repository

Find affected code without editing your files.

npx emendant scan

Then npx emendant fix writes the patches the table says exist. The getting started guide covers the flags and the patch grades.

The OpenAI Node SDK migration guide lists every release page and says which to read for your upgrade.