Connect OpenAI Codex CLI to Anoman AI
OpenAI Codex CLI routes through Anoman with a custom OpenAI-compatible provider in its config file — guardrails, routing, and cost tracking on every run.
Prerequisites
- An Anoman API key — create one in the dashboard (format
anm-sk-…). - OpenAI Codex CLI installed and up to date.
- A model ID from the Anoman catalog, e.g.
gpt-4o,gpt-4o-mini, orclaude-sonnet-4-6.
Enable streaming for long agent runs
Set stream: true on requests. Autonomous, multi-step, and long-thinking tasks can exceed the 100-second edge timeout and fail with a 524 error; streaming returns tokens as they are generated and keeps the connection alive, so the request completes. Most tools stream by default — confirm it is on for agentic use.
More detail in the streaming guide.
Add Anoman as a model provider
Edit ~/.codex/config.toml (provider overrides only take effect at the user level). Pin wire_api = "chat" so Codex uses Anoman's /v1/chat/completions endpoint.
Set your key and run
Export the key referenced by env_key, then start Codex — every request now flows through Anoman.
Verify the guardrails are active
Every Anoman response carries guardrail result headers. Inspect them in your dashboard traces to confirm the pipeline is running on OpenAI Codex CLI requests — prompt-injection detection, PII masking, and content moderation all apply automatically.
Need help with your integration?
Join the Founding 50 for early access and direct support from the Anoman team.