Code & DeveloperOpen source codeopenai/codex

Codex CLI: Open Source AI Repository & Self-Hosting Guide

OpenAI open-source Rust/TypeScript terminal coding agent executing sandboxed shell commands, reading repositories, and patching files directly in CLI.

GitHub Stars
137,295 stars
Repository License
Apache-2.0
Last Push (UTC)
Dec 4, 2026
Check the repo's license. Model weights may have a different license.
git clone https://github.com/openai/codex.git
View on GitHub
Installnpm install -g @openai/codex

Codex CLI: Architecture & Practical Workflow

Codex CLI runs locally in your terminal under OS-enforced read/write sandboxes (Seatbelt/Landlock), supporting image inputs, approval modes (`suggest`, `auto-edit`, `full-auto`), MCP servers, and OpenAI or compatible API endpoints.

Recommended End-to-End Pipeline

Invoke `codex` inside a feature branch to inspect failing tests, draft multi-file refactors under approval prompts, and review git diffs before committing.

Runtime Target
Terminal (GitHub)
Primary Users
Developers, Terminal users
Code License
Apache-2.0
Focus Topics
open-source, github, cli, agent, self-hosted

Quick Setup & Installation Steps

Platform target: Terminal (GitHub). Always verify environment variables and dependencies in the upstream repository README.

  1. 1Clone the repository from GitHub: `git clone https://github.com/openai/codex.git && cd codex`.
  2. 2Review the Apache-2.0 license (Check the repo's license. Model weights may have a different license.) and note any separate terms on external model weights.
  3. 3Install or launch the project directly: `npm install -g @openai/codex` (use an isolated Python virtualenv, Node workspace, or Docker volume so dependencies remain clean).
  4. 4Validate end-to-end behavior with a small sample input (Invoke `codex` inside a feature branch to inspect failing tests, draft multi-file refactors under approval prompts, and review git diffs before committing.)

Hardware & VRAM Notes

Runs on standard developer workstations without specialized hardware unless loading large local weights.

CPU & Memory

Modern multi-core CPU with 8 GB–16 GB RAM for orchestration, CLI agents, OCR/document parsing, or UI workflows (32 GB+ if co-hosting large local LLMs).

GPU / VRAM

Optional unless running local neural weights; pairs cleanly with local inference servers (Ollama / llama.cpp) or remote endpoints.

Runtime Target

Terminal (GitHub)

Strengths & Best For

  • Terminal-based coding agent
  • Reads and edits project files
  • Approval modes
  • Best suited for: Developers, Terminal users

Limitations & Caveats

  • Needs OpenAI account access
  • Review changes before applying them
  • Check the repo's license. Model weights may have a different license.

3 Similar Tools on /tools (Code)

Prefer a hosted web app instead of managing local weights or Docker containers? Explore these cloud alternatives.

Browse all tools
Self-Hosted Codex CLI vs. Hosted Alternatives (Gemini CLI & OpenHands (OpenDevin))
FactorCodex CLI (Self-Hosted)Gemini CLIOpenHands (OpenDevin)
Execution & PrivacyRuns locally via Terminal (GitHub); data stays on your disk or private server.Hosted cloud web interface; zero local dependency setup required.Hosted cloud web interface; zero local dependency setup required.
Cost & QuotaApache-2.0 code; bound only by local CPU/GPU hardware.Free; subject to vendor free-tier limits or paid plans.Open Source; subject to vendor free-tier limits or paid plans.
Primary FitTerminal-based coding agent; Reads and edits project filesGoogle's open-source terminal AI coding agent providing generous free daily requests directly from your command line.Open-source AI software development agent capable of complex task execution.
Key Trade-offNeeds OpenAI account accessRequires internet access and vendor account/quota limits.Requires internet access and vendor account/quota limits.

Matching Ready-Made Prompts

All Prompts →

Customize variables in Live Prompt Studio for Codex CLI workflows.

Chrome Extension Background Service Worker for One-Click ScrapingCode · Chrome Extension, Manifest V3, TypeScript, Scraping
Open in Studio
Next.js & Tailwind CSS UI ComponentCode · React, TypeScript, Tailwind, Next.js
Open in Studio

More Open Source Code & Developer Repositories

Frequently Asked Questions

What does Codex CLI do and how does it work?

Codex CLI (openai/codex) is an open-source code & developer project with 137,295 stars on GitHub. OpenAI open-source Rust/TypeScript terminal coding agent executing sandboxed shell commands, reading repositories, and patching files directly in CLI. Codex CLI runs locally in your terminal under OS-enforced read/write sandboxes (Seatbelt/Landlock), supporting image inputs, approval modes (`suggest`, `auto-edit`, `full-auto`), MCP servers, and OpenAI or compatible API endpoints.

Is Codex CLI free to self-host and use commercially?

Codex CLI provides open source code licensed under Apache-2.0. Check the repo's license. Model weights may have a different license. Always verify both source code and model weight licenses in the GitHub repository before commercial deployment.

What hardware, runtime, or VRAM does Codex CLI require?

Codex CLI targets Terminal (GitHub). Typical installation runs via `npm install -g @openai/codex`. Needs OpenAI account access

How does self-hosting Codex CLI compare to hosted tools like Gemini CLI?

Self-hosting Codex CLI gives you full local data control, zero per-usage vendor fees, and customizable Terminal (GitHub) pipelines—at the cost of managing your own setup and compute. By contrast, Gemini CLI (Free) runs in the browser with no local installation, though usage quotas and cloud privacy policies apply.

Is Codex CLI actively maintained and what workflow fits it best?

Repository metadata records 137,295 stars on GitHub with the latest recorded push on Dec 4, 2026. Invoke `codex` inside a feature branch to inspect failing tests, draft multi-file refactors under approval prompts, and review git diffs before committing.