Lesson 1 of 3 · OpenAI Codex: Your AI Coding Partner

What Codex Actually Is

reading10 min

In July 2021, OpenAI released the Codex API -- a model fine-tuned on billions of lines of public code that could turn natural language into working programs. GitHub Copilot was built on it. Developers loved it. Then, in March 2023, OpenAI quietly deprecated the Codex API. Many assumed the project was dead.

They were wrong. Codex did not die -- it evolved into something far more ambitious. In 2025, OpenAI relaunched Codex as a full coding agent: open-source, multi-surface, sandboxed, and capable of reading entire repositories, running shell commands, and producing verified code changes. The name stayed. Everything else changed.

Apache 2.0

Codex is fully open-source -- inspect every line, fork it, extend it

The Two Eras of Codex

The original Codex was a completion engine. You gave it a comment like // sort this array in descending order and it predicted the next tokens. It was impressive but fragile -- no memory, no file access, no ability to run or verify its output.

Modern Codex is an agent. The distinction matters enormously:

PropertyOld Codex (2021-2023)Modern Codex (2025+)
ArchitectureCompletion APIAgentic system with tool use
ScopeSingle code snippetEntire repository
ExecutionNone -- just text outputRuns commands, reads files, creates patches
VerificationNoneRuns tests, checks linting, validates builds
SafetyNoneSandboxed execution with approval modes
LicensingProprietary APIApache 2.0 open source
Why Open Source Matters

Codex being Apache 2.0 is not just a licensing detail. It means you can read the sandboxing code to verify its security claims. You can add custom model providers. You can fork it for internal tooling. You can contribute patches. This is fundamentally different from trusting a proprietary black box.

The Five Pillars

Modern Codex is not a single trick. It is an integrated system built around five core capabilities:

Models Under the Hood

Codex is not locked to a single model. It supports multiple providers and models out of the box:

  • o4-mini -- The default model. Fast, capable, and cost-effective for most coding tasks
  • o3 -- More powerful reasoning for complex architectural decisions and multi-step debugging
  • GPT-4.1 -- Strong general-purpose model with excellent instruction following
  • Gemini, Ollama, Mistral -- Community-supported providers via the multi-provider architecture

You select models per-session or per-profile in your configuration. Different tasks benefit from different models -- a quick rename refactor does not need o3's reasoning depth, but debugging a race condition in concurrent code might.

Do

Choose models based on task complexity. Use o4-mini for routine coding, o3 for architectural reasoning and complex debugging. Switch models mid-session when the problem changes shape.

Don't

Default to the most expensive model for everything. Most coding tasks -- scaffolding, refactoring, test writing -- are well-served by faster, cheaper models. Save the heavy reasoning for problems that actually need it.

What Codex Is Not

Let us be honest about the boundaries:

  • Codex is not a replacement for engineering judgment. It generates code. You own the architecture, the trade-offs, and the decision to ship.
  • Codex is not infallible. It produces confident output regardless of correctness. The sandbox exists precisely because the agent will sometimes do the wrong thing.
  • Codex is not magic. It works best with clear instructions, good context, and verifiable outputs. Vague prompts produce vague results -- just like vague requirements produce vague software.

beginner

Quick Exploration:

  1. Visit the Codex GitHub repo (github.com/openai/codex) and read the README
  2. Identify which of the five pillars (generation, understanding, review, debugging, automation) you would use first in your current project
  3. Write down one task from your last work week that Codex could have handled faster
  4. Note whether that task would need the CLI, Desktop, IDE, or Cloud surface
Concept Card