The facility of OpenAI’s newest reasoning fashions is delivered straight to your terminal with the OpenAI Codex CLI, an open-source command-line software. It serves as a conveyable coding assistant that may learn, edit, and execute code regionally in your laptop to hurry up characteristic improvement, repair points, and show you how to perceive advanced code. Your supply code by no means leaves your atmosphere except you select to share it, because the CLI operates regionally, in keeping with OpenAI. On this article, I’ll present you the way to set up and use OpenAI’s Codex CLI regionally.
Why Codex CLI?
Codex CLI is designed for builders who’re snug within the terminal and wish ChatGPT-level reasoning mixed with the power to run code, handle information, and iterate, all whereas holding model management intact. Briefly, it’s chat-driven improvement that understands and executes your code. A few of its key options are:
- Zero Setup: No configuration required, simply carry your OpenAI API key, and also you’re able to go!
- Minimal Necessities: You’ll want Node.js (v22+) and npm (v10+), however total, the setup is fast and light-weight.
- Full Auto Mode: Operates in a listing sandbox with the community disabled, making certain your information stays non-public and safe.
- Multimodal Assist: Ship in screenshots or diagrams, Codex CLI can interpret and replicate the necessities proven in your pictures.
- Open Supply: The software is totally open-source, so you may discover the codebase and even contribute to its improvement
Please observe that Codex CLI is an ongoing experimental mission. It might have points, lack options, or expertise disruptive adjustments as a result of it isn’t but secure.
Additionally Learn: Easy methods to Entry and Use OpenAI Codex?
Approval Modes
Approval modes management the extent of entry granted to the AI system (Codex CLI). There are three approval modes out there, every described under:
Mode | What the Agent Can Do | When to Use |
---|---|---|
Recommend (default) | Learn information. Proposes edits & shell instructions, however requires your approval earlier than making adjustments or executing instructions. | Secure exploration, code critiques, studying a codebase. |
Auto Edit | Learn and write information robotically. Nonetheless asks earlier than working shell instructions. | Refactoring or repetitive edits the place you wish to keep watch over side-effects. |
Full Auto | Learn, write, and execute instructions autonomously inside a sandboxed, network-disabled atmosphere scoped to the present listing. | Longer duties like fixing a damaged construct or prototyping options whilst you seize a espresso. |
Sandboxing Particulars
macOS 12+
Codex CLI makes use of Apple Seatbelt (sandbox-exec
) to sandbox instructions.
- A lot of the filesystem is positioned in a read-only jail, with a number of exceptions akin to
$PWD
,$TMPDIR
, and~/.codex
, which stay writable. - By default, outbound community entry is totally blocked—even when a baby course of tries to make use of
curl
, it is going to fail.
Linux
Sandboxing just isn’t enabled by default. OpenAI recommends utilizing Docker for sandboxing.
Codex CLI runs inside a light-weight container picture, along with your repository mounted in the identical location for learn/write entry. A customized iptables
/ipset
firewall script blocks all egress besides entry to the OpenAI API. This ensures repeatable, predictable execution with out requiring root entry on the host. To allow this, use the run_in_container.sh
script to configure the sandbox atmosphere.
New codex-mini-latest
codex-mini-latest is a fine-tuned model of o4-mini particularly to be used in Codex CLI. It has a context window of 200k, and might output a max of 100,000 tokens. codex-mini-latest’s is pricing between GPT-4.1 and o4-mini, and under is the picture exhibiting the pricing of enter, cached enter, and output per million tokens.
Easy methods to Entry Codex CLI?
Comply with these easy steps to entry Codex CLI:
- Go to a mission that you’re engaged on
If you want to experiment with a dummy repository, suggesting you to clone this repository in order that we will begin testing out codex cli. Github Repository hyperlink
Use the command “git clone https://github.com/Badribn0612/warren_buffet_persona” to clone this repository. You need to use a even smaller repository as properly.
- Go to the listing the place the repository is current
Use the command “cd
” to go to that listing. - Set up Codex CLI
Now that we’re set to start out accessing Codex CLI. Let’s set up the identical. Use the command:
npm set up -g @openai/codex – this command will set up codex cli globally in your system. - Get the API
OpenAI offers 5$ value of codex-mini-latest api for Plus customers and 50$ value of credit for Professional customers. With the intention to redeem that use the command.
codex — login
It will ask you to login or use an API key.
- Now you may Signin with Codex CLI with ChatGPT
- Profitable Redemption Message
After efficiently Signing in into Codex CLI, you need to be capable to see a profitable redemption message in your terminal in addition to your OpenAI dashboard.
- Verify in case you can entry Codex CLI in terminal
Begin accessing codex cli:
- Scan your repository
After 3 total minutes of skimming and scanning the repository it gave me a complete response in regards to the repository.
- Make adjustments within the repo
Let’s now ask Codex CLI to make some adjustments.
Immediate: “Improve the chainlit utility app.py, this has the persona of warren buffet:
1. Add search instruments
2. Enhance the code high quality, 3. Improve the chainlit utility”
Output:
After working the codex cli for round 15+ min, and having gone by way of adjustments made by the agent and approving them, the execution stopped.



Above are some screenshots in between the Codex CLI agent execution.
Additionally Learn: 12 AI Code Generator Instruments in 2025
Inference from Utilizing Codex CLI
Primarily based on my expertise utilizing the Codex CLI agent, I discovered that it takes a cautious and deliberate strategy when making adjustments. It verifies every step, applies modifications solely the place obligatory, and constantly goals to search out the absolute best answer. Nevertheless, the method will be noticeably slower in comparison with making related adjustments manually utilizing instruments like Cursor or Windsurf.
After all, that is simply my private expertise, your outcomes could range relying on the area or tech stack you’re working with. On this case, the codebase concerned just lately up to date libraries, which Codex struggled with. (Be aware: Codex has a information cutoff of June 1, 2024)
You may additionally think about experimenting with Claude Code to see the way it handles your use case, and resolve which software works finest to your workflow.
Additionally Learn: Constructing a CodeBase Explorer with Google’s Gemini-2.0
Conclusion
Codex CLI is a robust command-line software that brings OpenAI’s superior reasoning capabilities on to your native improvement atmosphere. It permits builders to work together with their code, utilizing pure language, enabling duties like debugging, refactoring, and have improvement, all whereas holding delicate information native and safe.
With built-in sandboxing, multimodal help, and minimal setup, Codex CLI is right for builders preferring working within the terminal and wish to keep full management over their codebase. Whereas it stays experimental and could also be slower than different instruments in sure situations, its cautious strategy to code adjustments and robust emphasis on privateness make it a compelling alternative for integrating clever code help into your workflow.
Login to proceed studying and luxuriate in expert-curated content material.