Codex CLI
OpenAI Codex CLI
(Rust, 0.136.0+) is the official OpenAI agent CLI.
It speaks /v1/responses — the "responses" API, not the
chat-completions one. rapid-mlx exposes /v1/responses
as a first-class route so Codex talks to your local server the same
way it talks to api.openai.com.
/v1/responses ·
Setup: rapid-mlx agents codex --setup ·
Matrix cell:
✅ ✅ ✅ ✅
(Qwen 3.6 / Gemma 4 / DeepSeek / gpt-oss on 2026-07-07 pilot).
Install
Homebrew or npm — Codex CLI is upstream OpenAI, install the vendor binary:
$ brew install codex # or $ npm install -g @openai/codex
Config
The one-shot: rapid-mlx agents codex --setup writes
~/.codex/config.toml for you. By hand, the exact
block rapid-mlx 0.10.3 emits is:
# ~/.codex/config.toml model = "default" model_provider = "rapid-mlx" [model_providers.rapid-mlx] name = "Rapid-MLX (local)" base_url = "http://localhost:8000/v1" # No auth field — rapid-mlx is unauthed by default and Codex # --strict-config rejects an inline literal like `api_key = "..."`. # If you start the server with --api-key, add: # env_key = "RAPID_MLX_API_KEY" # and `export RAPID_MLX_API_KEY=<your-key>` in your shell.
The [model_providers.rapid-mlx] block is what Codex
resolves after reading model_provider = "rapid-mlx".
base_url must include the trailing /v1.
Run
$ rapid-mlx serve qwen3.6-35b-4bit \ --tool-call-parser qwen3_coder_xml --enable-auto-tool-choice # in another shell: $ codex # or one-shot exec: $ codex exec "read main.py and summarize what it does"
Recommended aliases (per rapid-mlx agents codex):
qwen3.6-35b-4bit, qwen3.5-9b-4bit,
qwen3-coder-30b-4bit.
Gotchas
-
Codex hardcodes
stream: true. rapid-mlx's/v1/responsesemits the 7 SSE events Codex parses (response.created,response.output_text.delta,response.function_call_arguments.delta,response.completed, …). No override needed. -
Stateless shim.
previous_response_idis not implemented (upstream codex#3841); Codex re-sends the full conversation ininput[]each turn, which is what makes the local backend work. -
reasoning.effortis accepted but not mapped. Set thinking viarapid-mlx serve --enable-thinkinginstead of Codex's config field. -
Gemma 4 12B hangs Codex ~60% of tool-use prompts due to a
model-side
thought\n…degenerate loop (upstream Gemma issue, downstream tracked as#686, closed). Use Qwen 3.5 / 3.6 for Codex agent workflows. - Sandbox permissions. Codex CLI runs commands via Landlock (Linux) / Seatbelt (macOS) — first run prompts for sandbox permissions. This is Codex behavior, unrelated to rapid-mlx.
Empirical
The codex-cli row of the integration matrix
is ✅ across all four Tier-1 families (Qwen 3.6, Gemma 4,
DeepSeek R1-Distill, gpt-oss) on the 2026-07-07 pilot. The matrix cell
posts a minimal /v1/responses envelope, verifies the
SSE-shaped output body is non-empty, and asserts no
<think> or <|channel|>analysis
leak in the emitted text. Source of truth for this page:
tests/integrations/test_agents_matrix.py::TestCodexCLI
and the CLI output of
rapid-mlx agents codex.