canirequire › ESM-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.
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.
| Runtime | require("@openai/codex") | import "@openai/codex" |
|---|---|---|
| Node.js 18 | ✗ expected | ✓ expected |
| Node.js 20 | depends | ✓ expected |
| Node.js 22 | depends | ✓ expected |
| Node.js 24 | depends | ✓ expected |
| Node.js 26 | depends | ✓ expected |
| Bun 1.4 | pending | pending |
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).
| Versions | Format | First published |
|---|---|---|
| 0.111.0 – 0.153.4 | ESM-only | Mar 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
- ansi-styles 7.0.0last CJS
5.2.0 - strip-ansi 7.2.0last CJS
6.0.1 - commander 15.0.0last CJS
14.0.3 - supports-color 11.0.0last CJS
8.1.1 - chalk 6.0.0last CJS
4.1.2 - tslib 2.8.1last CJS
2.5.2 - string-width 8.2.2last CJS
4.2.3 - ansi-regex 6.3.0last CJS
5.0.1
Similar popularity
- @smithy/smithy-client 4.15.2CommonJS
- @sinonjs/commons 4.0.0-alpha.0Dual
- @rollup/pluginutils 5.4.0Dual
- @napi-rs/wasm-runtime 1.2.3Dual
- @jest/console 30.5.1Dual
- @radix-ui/react-use-previous 1.1.4Dual
- @smithy/middleware-endpoint 4.7.2CommonJS
- @smithy/shared-ini-file-loader 4.7.2CommonJS