All insights

Coding agents

How to Use GPT-5 Codex (and What to Use Now)

GPT-5-Codex is marked shut down in OpenAI’s API catalog. Learn how to start a task with Codex CLI, review code changes safely, and distinguish Codex from an API model.

Illustration for How to use gpt 5 codex

If you mean the GPT-5-Codex model, you can’t make a new request to it through OpenAI’s API: OpenAI’s API catalog marks gpt-5-codex as shut down. That model is not the same thing as the Codex coding agent. You can still use Codex as a product; for example, OpenAI documents starting Codex CLI in a project directory and signing in with your ChatGPT account.

Start a coding task with Codex CLI

The CLI is a practical way to ask Codex to work with a local codebase. This walkthrough uses ChatGPT sign-in—not a direct API request.

Before you install

OpenAI says Codex is included across ChatGPT plans, including Free and Go, although usage limits vary by plan. Codex Cloud has separate eligibility and is not included with Free or Go; this walkthrough uses the CLI, not Codex Cloud.

This walkthrough is scoped to macOS 12 or later, which OpenAI lists among Codex’s supported operating systems. The official guidance retrieved for this tutorial does not establish a separate Node.js minimum for the npm installation route, so check the official Codex CLI installation instructions for applicable setup details. (github.com)

1. Install Codex CLI

If npm is available in your terminal, install Codex CLI with:

npm install -g @openai/codex

2. Open your project and sign in

In a terminal, change to the repository you want Codex to work in, then start the CLI:

cd path/to/your/project
codex

Follow the prompt to sign in with ChatGPT. This connects the CLI to your ChatGPT account; it does not make the shut-down gpt-5-codex API model available. OpenAI says Codex usage limits vary by plan.

3. Give Codex a small, checkable task

Start with a bounded change rather than an open-ended instruction. For example:

Find where the signup form validates email addresses. Add a test for an address with surrounding spaces, make the smallest appropriate fix, and run the relevant tests. Do not change unrelated files. Tell me what you changed and which tests you ran.

If your repository has project-specific guidance, an AGENTS.md file can describe its conventions and test commands. OpenAI has described GPT-5-Codex as following AGENTS.md instructions, but don’t assume a particular model is selectable or available just because Codex supports the file.

4. Check the result before keeping it

When Codex finishes, inspect the changed files and run the relevant project checks yourself. For a Git repository, a basic review is:

git status --short
git diff

Then run the test or lint command appropriate to your project—for example, the command documented by the repository. Confirm the change matches the request, review any unexpected edits, and keep or revert the changes deliberately. A passing test is useful evidence, not a substitute for reviewing the diff.

Can I call GPT-5-Codex in a production API?

No—not under the gpt-5-codex model ID, which OpenAI’s API catalog marks shut down. The catalog page includes model and pricing information, but a listed price does not make a shut-down model callable. Don’t build a new integration around old examples or a remembered price for this model.

For a production integration, choose a model that the current API catalog lists as available, then follow that model’s current API documentation for the endpoint, authentication, request format, pricing, and limits. I’m not including a GPT-5-Codex API request here because the requested model is shut down; substituting another model would require its own verified request example and applicable cost details.

If your goal is to build a cloud coding agent programmatically rather than call this specific model, OpenAI announced the Agents API in public beta as a way to build cloud agents using the Codex harness. That is a separate API route, not a way to revive gpt-5-codex; check its current documentation before implementing an integration.

In short

  • Use Codex as a coding tool: install or open a supported Codex client, sign in, give it a scoped task, and inspect the changes and tests.
  • Use the exact GPT-5-Codex API model: don’t—OpenAI marks gpt-5-codex shut down.
  • Build a production API workflow: select a currently available model or investigate the separate Agents API, and verify that route’s current documentation before writing code.

Sources

GPT-5-Codex Model | OpenAI API

Using Codex with your ChatGPT plan | OpenAI Help Center

OpenAI Codex CLI repository

Installing & building Codex CLI

Introducing upgrades to Codex | OpenAI

Introducing the Agents API | OpenAI

Contact us