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.

What Emendant detects, fixes and verifies

11 changes in openai 5.0.0. 3 patched by a transform, 6 patched only with a model provider you name, 2 report only. Every patch is proved in a copy of your repository before it is offered, and its header names the checks that passed. This table is generated from the feed entry, so it cannot claim more than the entry does.

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
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
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
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
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
Breaking
  • AzureClientOptions imported from openai
Report onlyNot applicable
fileFromPath removed from the package root
openai-npm-5.0.0-file-from-path-removed
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.

Coverage

Snapshot
2026-08-28.1, sequence 11, signed 28 August 2026
Minimum CLI
emendant@0.1.0
Feed entry
feed/npm/openai/5.0.0.json

emendant feed status shows the snapshot your machine holds, and emendant feed update fetches the latest.

Primary sources

Every claim above was checked against these, each pinned to the release rather than to a default branch.

Scan your repository

Runs locally, reads your lockfile and source, sends nothing anywhere.

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.