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, or claude-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.
# ~/.codex/config.toml
[model_providers.anoman]
name = "Anoman"
base_url = "https://api.anoman.io/v1"
env_key = "ANOMAN_API_KEY"
wire_api = "chat"
model_provider = "anoman"
model = "gpt-4o"Set your key and run
Export the key referenced by env_key, then start Codex — every request now flows through Anoman.
export ANOMAN_API_KEY=anm-sk-your-key-here
codexVerify 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.
X-Anoman-Guardrail-Injection: pass score=0.03
X-Anoman-Guardrail-Pii: pass
X-Anoman-Guardrail-Content: pass
X-Anoman-Cache: noneNeed help with your integration?
Join the Founding 50 for early access and direct support from the Anoman team.
Join Founding 50