canirequire

canirequireESM-only › @openai/codex

Is @openai/codex ESM-only? Can you require() it?

Codex CLI is a coding agent from OpenAI that runs locally on your computer.

Latest version 0.153.4, published Sep 4, 2026. JSON

ESM-only ESM-only — it has never shipped a CommonJS build

@openai/codex has been ESM-only since its first stable release. There is no version you can require() on Node.js 18 or older.

On Node.js 20.19+, 22.12+ and newer, require() of ESM packages usually works unless the package uses top-level await. Node.js 18 and older fail with ERR_REQUIRE_ESM.

Latest
0.153.4 (Sep 4, 2026)
Module format
ESM-only
Last CommonJS version
none
ESM-only since
0.1.4160940 (Apr 16, 2025)
TypeScript types
None
Node engines
>=16
License
Apache-2.0

Does @openai/codex@0.153.4 actually load? Runtime test results

Runtime probe pending for this version. The values below are what package.json declares; they are refreshed once the probe runs.

Runtimerequire("@openai/codex")import "@openai/codex"
Node.js 18✗ expected✓ expected
Node.js 20depends✓ expected
Node.js 22depends✓ expected
Node.js 24depends✓ expected
Node.js 26depends✓ expected
Bun 1.4pendingpending

Install failed in our sandbox: PROBE_TIMEOUT The rows above show what package.json declares.

How to import @openai/codex

ES modules (import)

import codex from "@openai/codex";

CommonJS (require)

// Node.js 20.19+ / 22.12+ / newer (package has no top-level await):
const codex = require("@openai/codex");

// Any Node.js version:
const codex = await import("@openai/codex");

Module format by version

Derived from the type, main and exports fields of every stable release on npm (185 versions; the newest 60 shown).

VersionsFormatFirst published
0.111.0 – 0.153.4ESM-onlyMar 5, 2026

Frequently asked

Is @openai/codex ESM-only?

@openai/codex@0.153.4 is ESM-only. @openai/codex has been ESM-only since its first stable release. There is no version you can require() on Node.js 18 or older.

Which version of @openai/codex still supports CommonJS / require()?

None. @openai/codex has always been ESM-only. Use import, or await import("@openai/codex") from CommonJS.

How do I use @openai/codex from a CommonJS file?

Use a dynamic import: const mod = await import("@openai/codex"). On Node.js 20.19+, 22.12+ and newer, a plain require("@openai/codex") also works for ESM packages that do not use top-level await.

Does @openai/codex ship TypeScript types?

No. @openai/codex ships no type declarations and there is no @types package for it.

Links

Other esm-only packages

Similar popularity