Contents
Like other coding agents, Codex doesn’t just suggest a line; it carries out a whole task: it searches files, edits, runs tests and iterates until they pass. You can use it in three ways.
Ways to use Codex
| Option | Where it runs | Good for |
|---|---|---|
| Codex CLI | A terminal on your machine or a server | Working directly on project files |
| Editor extension | Inside VS Code and similar editors | People who prefer staying in the editor |
| Codex cloud | An isolated environment at OpenAI | Longer tasks that end in a pull request on GitHub |
How Codex CLI works
Open a terminal in the project folder, run codex and describe the task. Codex reads an AGENTS.md file if present, holding project instructions such as test commands and code style. Approval modes control whether it edits files and runs commands on its own or asks you first. Start with a mode that asks before every command until you know how it behaves, then widen its permissions gradually.
Example: a task on a server over SSH
ssh user@your-server
cd ~/myapp
codex "Run the tests and fix any failing test without changing the public API"
For non-interactive use, such as a script that runs on its own, there’s the codex exec command.
Tips and common problems
- Work inside Git: review the diff before accepting changes and roll back easily when something goes wrong.
- Protect your API key: never write it into project files or commit it.
- Be specific: a small, well-defined task gets better results than “improve the project”.
- Tool vs model: Codex is the tool; the model behind it may change as OpenAI updates it.
On ArabyHost
Codex runs over SSH on AI/Developer plans inside the isolated CageFS environment, which limits access to your account’s files. Node.js 20 and 24, Python and Git are available; there’s no root or Docker, so system packages can’t be installed. Codex is an independent OpenAI product that runs on your own OpenAI account. Follow the Codex on a server guide, compare it with Claude Code, and see the AI plans.
FAQ
Is today's Codex the same as the original Codex?
No. The Codex name was first used in 2021 for a code-generating model; OpenAI later reused the name for today's coding agent that runs in the terminal and the cloud.
How do I sign in to Codex CLI?
On first run it asks you to sign in with a ChatGPT account or use an OpenAI API key. On a server without a browser, follow the headless sign-in method described in the Codex documentation.
How does Codex compare with Claude Code?
Both are terminal coding agents that read and edit your project. Codex is from OpenAI and reads project instructions from AGENTS.md; Claude Code is from Anthropic and reads CLAUDE.md. The choice comes down to which model you prefer and your account with each company.