The facility of OpenAI’s newest reasoning fashions is delivered straight to your terminal with the OpenAI Codex CLI, an open-source command-line device. It serves as a conveyable coding assistant that may learn, edit, and execute code domestically in your laptop to hurry up characteristic improvement, repair points, and allow you to perceive advanced code. Your supply code by no means leaves your atmosphere except you select to share it, because the CLI operates domestically, based on OpenAI. On this article, I’ll present you easy methods to set up and use OpenAI’s Codex CLI domestically.
Why Codex CLI?
Codex CLI is designed for builders who’re snug within the terminal and need ChatGPT-level reasoning mixed with the flexibility to run code, handle information, and iterate, all whereas maintaining 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 deliver your OpenAI API key, and also you’re able to go!
- Minimal Necessities: You’ll want Node.js (v22+) and npm (v10+), however general, 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 Help: Ship in screenshots or diagrams, Codex CLI can interpret and replicate the necessities proven in your pictures.
- Open Supply: The device is totally open-source, so you’ll be able to 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: How you can 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 accessible, every described beneath:
Mode | What the Agent Can Do | When to Use |
---|---|---|
Counsel (default) | Learn information. Proposes edits & shell instructions, however requires your approval earlier than making adjustments or executing instructions. | Protected exploration, code evaluations, 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.
- Many 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’s 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 may output a max of 100,000 tokens. codex-mini-latest’s is pricing between GPT-4.1 and o4-mini, and beneath is the picture exhibiting the pricing of enter, cached enter, and output per million tokens.
How you can Entry Codex CLI?
Comply with these easy steps to entry Codex CLI:
- Go to a mission that you’re engaged on
If you need to experiment with a dummy repository, suggesting you to clone this repository in order that we are able to 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 should 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 supplies 5$ price of codex-mini-latest api for Plus customers and 50$ price of credit for Professional customers. With a view to redeem that use the command.
codex — login
This can ask you to login or use an API key.
- Now you’ll be able to Signin with Codex CLI with ChatGPT
- Profitable Redemption Message
After efficiently Signing in into Codex CLI, you must be capable of see a profitable redemption message in your terminal in addition to your OpenAI dashboard.
- Verify when 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 concerning 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 means 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 crucial, and persistently goals to seek out the absolute best answer. Nevertheless, the method could be noticeably slower in comparison with making related adjustments manually utilizing instruments like Cursor or Windsurf.
In fact, that is simply my private expertise, your outcomes could fluctuate relying on the area or tech stack you’re working with. On this case, the codebase concerned not too long ago up to date libraries, which Codex struggled with. (Word: Codex has a information cutoff of June 1, 2024)
You may also take into account experimenting with Claude Code to see the way it handles your use case, and determine which device works greatest on your workflow.
Additionally Learn: Constructing a CodeBase Explorer with Google’s Gemini-2.0
Conclusion
Codex CLI is a robust command-line device 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 maintaining 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 preserve full management over their codebase. Whereas it stays experimental and could also be slower than different instruments in sure eventualities, 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.