
Run OpenAI Codex CLI on any model
OpenAI's official CLI coding agent - use antseed codex for per-run proxy config.
Codex is OpenAI's terminal coding agent. Recent versions ignore OPENAI_BASE_URL and instead read provider config from Codex settings.
antseed codex supplies that provider config for one run with Codex -c overrides, points it at the active buyer proxy, sets the placeholder API key, and leaves your real CODEX_HOME untouched.
If you prefer a persistent manual setup, create ~/.codex/antseed.config.toml and launch Codex with codex --profile antseed; the wrapper is still the shortest path for one-off sessions.
Run AntSeed first
Every integration assumes a buyer proxy at http://localhost:8377. One-time setup, ~2 minutes.
Step 1
Install OpenAI Codex CLI
- Install Codex globallynpm install -g @openai/codex
- Verify it runscodex --version
Step 2
Point OpenAI Codex CLI at AntSeed
Recommended: the wrapper resolves the proxy URL, injects an AntSeed model provider with wire_api = "responses", sets ANTSEED_API_KEY=antseed, and forwards extra Codex args. Put child flags after -- when they look like wrapper flags. To route to a specific peer, prefix the model with its peer id: antseed codex --model <peerId>@deepseek-v4-flash.
Manual profile only: this must be your **user-level** ~/.codex/antseed.config.toml, then launch with codex --profile antseed. If your buyer proxy uses a non-default port, update base_url to match it. Project-local ./.codex/config.toml provider blocks are ignored by Codex.
Step 3
Pick a model
Pass the peer service id to antseed codex --model <service-id>. For a manual profile, set top-level model = "<service-id>" in ~/.codex/antseed.config.toml or override with codex --profile antseed --model <service-id>. Route to a specific peer by prefixing the model: <peerId>@<service-id>.
The exact list of models depends on which peer you pin. Run antseed network browse or open the live network page to see what's available right now.
Verify
Test it
- See which service ids your pinned peer exposescurl -s http://localhost:8377/v1/models | jq '.data[].id'Example response"deepseek-v4-flash" "gpt-oss-120b" "kimi-k2.6" "minimax-m2.7"
Whatever appears here is a valid value for top-level
model = ...in~/.codex/antseed.config.toml(or forcodex --profile antseed --model <id>). - Run Codex through the wrapperantseed codex --model deepseek-v4-flash
Manual profile equivalent:
codex --profile antseed --model deepseek-v4-flash. - Verify inference is actually paid through AntSeedopen http://localhost:3118 # or: antseed buyer statusWhat to look for after one real promptDeposits available: 4.289391 USDC → 3.289391 USDC Deposits reserved: 0 USDC → 1 USDC
The buyer dashboard at http://localhost:3118 is the authoritative real-time signal: a non-zero
Reserved(channel opened) and/or a drop inAvailable(settled spend) after a real prompt confirms AntSeed served the request. Theantseed buyer statusCLI output is cached and may lag the dashboard - refresh the web view for confirmation. Do not rely onlsof -i | grep codexor~/.codex/log/codex-tui.log: Codex keeps persistent TCP connections to Cloudflare/ChatGPT IPs (e.g. 172.64.0.0/13) for non-inference purposes (the cause was not isolated during testing), and theprovider=OpenAIlines in the TUI log are not a reliable indicator that inference went to OpenAI - the on-chain numbers can show AntSeed served the request despite that log line.
How OpenAI Codex CLI talks to AntSeed
- Wire format sent by OpenAI Codex CLI:
OpenAI Chat Completions(hits/v1/chat/completionson the buyer proxy) - Best-fit services: any service whose
protocolsarray containsopenai-chat-completions. That's what the peer advertises as natively-supported - zero translation overhead, no transform edge cases. - How to check a peer: run
antseed network peer <peerId> --jsonand look atproviderServiceApiProtocols[provider].services[service]. The browse command exposes the same field per peer. - What happens when protocols don't match: AntSeed's
@antseed/api-adaptertranslates between OpenAI Chat Completions and the service's native protocol on the fly. So a request from OpenAI Codex CLI can still reach a service that only advertisesanthropic-messages- just with a small transform step. - One known caveat: services whose only advertised protocol is
openai-responsesrequire streaming. If OpenAI Codex CLI sends a non-streaming request and the proxy routes it to one of those services, the call fails withHTTP 400: Stream must be set to true. Pick a service whoseprotocolsincludesopenai-chat-completions(or another non-responses protocol) to avoid this.
If it goes wrong
Troubleshooting
OPENAI_BASE_URL/OPENAI_API_KEYare being ignoredExpected on recent Codex builds. Useantseed codex --model <service-id>so the wrapper injects the provider config for the current run, or use the manual~/.codex/antseed.config.tomlprofile above.- How can I tell if Codex is actually routing through AntSeed?Check the buyer dashboard at http://localhost:3118 (or
antseed buyer status) after sending a test prompt.Reservedgoing from $0 to a non-zero value (a channel was opened) and/orAvailabledropping (spend settled) confirms AntSeed served the request. If both stay flat after a real prompt, the profile is not being applied. Do not trustlsofconnections to Cloudflare IPs orprovider=OpenAIlines in~/.codex/log/codex-tui.log- neither is a reliable routing signal. - Codex prints
Ignored unsupported project-local config keys … model_provider, model_providersProvider settings must live in your **user-level** Codex profile file. For this manual flow, put the top-levelmodel,model_provider, and[model_providers.antseed]block in~/.codex/antseed.config.toml, then relaunch withcodex --profile antseed. Codex silently rejects provider blocks in project-local./.codex/config.tomland falls back to its default provider. - Hand-written Codex
-cprovider overrides behave inconsistentlyUseantseed codex --model <service-id>so AntSeed supplies the complete provider block (base_url,wire_api, andmodel_provider) for the current run. If managing config yourself, keep the full provider/profile in user-level~/.codex/antseed.config.toml. - Streaming stops after the first chunk with a manual profileUse
antseed codex, or setwire_api = "responses"in the manual[model_providers.antseed]block. unknown profile: antseedCodex caches profile config on launch. Make sure you saved~/.codex/antseed.config.toml, then start a freshcodex --profile antseedsession.- Hangs forever on first messageNo peer is pinned. Run
antseed network browse, thenantseed buyer connection set --peer <peerId>.
Reference
Links
Same category