Run Codex CLI on a Local Model — OpenAI's Agent, on Your Mac

OpenAI's Codex CLI, pointed at a model on your own Mac. rapid-mlx serves the /v1/responses API Codex speaks, so it's a config block — not a bridge. Private, offline, no per-token bill.

Codex CLI is OpenAI's official terminal agent — a fast, Rust-based coding loop. It talks to api.openai.com over the Responses API. The nice part: rapid-mlx exposes that exact wire (/v1/responses) as a first-class route, so you can point Codex at a model on your own Mac and it behaves the same — just local.

Third in the series on running your favorite agent locally (after Claude Code and Cursor). About five minutes.

The whole thing

  1. brew install codex (if you don't have it)
  2. brew install rapid-mlxrapid-mlx serve qwen3.6-35b-4bit
  3. rapid-mlx agents codex --setup — writes the Codex config for you

1 · Install Codex + rapid-mlx

brew install codex        # or: npm install -g @openai/codex
brew install rapid-mlx    # in Homebrew core — no tap, no trust

2 · Serve a model that fits your Mac

rapid-mlx serve qwen3.6-35b-4bit
Your Mac Model Good for
16 GB qwen3.5-4b Fast edits, Q&A
32 GB gpt-oss-20b All-round + strong tools
48 GB+ qwen3.6-35b-4bit The coding sweet spot

3 · Point Codex at it

The one-shot writes ~/.codex/config.toml for you:

rapid-mlx agents codex --setup

Or drop it in by hand:

# ~/.codex/config.toml
model = "default"
model_provider = "rapid-mlx"

[model_providers.rapid-mlx]
name = "Rapid-MLX (local)"
base_url = "http://localhost:8000/v1"

base_url must include the trailing /v1 — Codex speaks the Responses API and appends /responses itself. rapid-mlx is unauthed by default, so there's no api_key line (Codex's --strict-config rejects an inline literal). If you started the server with --api-key, add env_key = "RAPID_MLX_API_KEY" and export it.

4 · Run

codex
> refactor the auth middleware in server.py and add a test

Codex plans, edits, and runs — all against the model on your Mac.

Honest expectations

A local model isn't a frontier cloud model. Great for private/offline work and the everyday 80% — refactors, tests, codebase Q&A — with no bill. For the hardest reasoning, switch model_provider back to OpenAI. Two configs, your choice per task.

Where to go next


Run this yourself. rapid-mlx is an open-source, OpenAI-compatible inference server for Apple Silicon. pip install rapid-mlx, then rapid-mlx serve <alias>. Browse every supported model on the family docs or pick one by your Mac's RAM at models.rapidmlx.com.