
Run OpenAI Codex CLI on any model
OpenAI's official CLI coding agent - add your Antseed gateway as a Codex provider, or launch it with antseed codex.
Codex is OpenAI's terminal coding agent. Recent versions ignore OPENAI_BASE_URL and instead read provider config from Codex settings, so Antseed plugs in as a custom model provider that speaks the Responses API.
The recommended endpoint is a gateway: add it as a provider in your user-level ~/.codex/config.toml, with the gateway key in ANTSEED_API_KEY. That works from any machine and gives Codex its own budget and usage log.
When Codex runs on the same computer as a buyer, antseed codex supplies the provider config for one run with Codex -c overrides, points it at the local buyer proxy, and leaves your real CODEX_HOME untouched.
Run Antseed first
Every integration needs an Antseed endpoint: a gateway, best on a small server so every tool on every machine can reach it, or the local buyer proxy (same computer only). One-time setup, a few 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: a gateway
| ANTSEED_BASE_URL | https://gateway.example.com/v1 |
| ANTSEED_API_KEY | antseed_… |
Show as shell exports
Your gateway's base URL, ending in /v1, and an API key from the Keys page of its console. Recommended: a gateway on a server, which every machine can reach. A gateway on this computer is http://localhost:8379/v1; publish it with a tunnel (antseed tunnel start) for other machines. No gateway yet: see Run Antseed first above. Export both in the shell that starts Codex.
Set base_url to your gateway URL ending in /v1; Codex reads the key from ANTSEED_API_KEY. @preset/coder is a gateway preset (create one under Presets in the console): with a raw model name, Codex can switch to a tool format some providers drop. A model id from GET /v1/models works too. Provider settings must live in your user-level config; Codex ignores them in a project-local ./.codex/config.toml.
Same computer, no gateway: the local buyer proxy
The wrapper resolves the local proxy URL, injects an Antseed model provider with wire_api = "responses", sets a placeholder ANTSEED_API_KEY, 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.1-flash.
Step 3
Pick a model
Set top-level model = "<model-id>" in ~/.codex/config.toml, or override per run with codex --model <model-id>. With the wrapper, pass antseed codex --model <model-id>. Route to a specific peer by prefixing its advertised service id: <peerId>@<service-id>.
The full list is every model on the network. Run GET /v1/models on your endpoint, antseed network browse, or open the live network page to see what's available right now.
Verify
Test it
- List every model on the networkcurl -s "$ANTSEED_BASE_URL/models" -H "Authorization: Bearer $ANTSEED_API_KEY" | jq '.data[].id'Example response"deepseek/deepseek-v4.1-flash" "moonshotai/kimi-k3" "z-ai/glm-5.2" "z-ai/glm-5.3-flash"
Whatever appears here, or the short name without the vendor prefix (
deepseek-v4.1-flash), is a validmodelvalue. Against the local buyer proxy:curl -s http://localhost:8377/v1/models. - Run Codexcodex
Through the local buyer proxy instead:
antseed codex --model deepseek-v4.1-flash. - Verify inference is actually paid through Antseedantseed buyer balance # local buyer proxy onlyWhat to look for after one real promptDeposits available: 4.289391 USDC → 3.289391 USDC Deposits reserved: 0 USDC → 1 USDC
On a gateway, the request shows up in the console under Logs, with the seller, tokens and cost. With the local buyer proxy, a non-zero
Reserved(channel opened) and/or a drop inAvailable(settled spend) after a real prompt confirms Antseed served the request. Do not rely onlsof -i | grep codexor~/.codex/log/codex-tui.log: Codex keeps persistent TCP connections to Cloudflare/ChatGPT IPs for non-inference purposes, and theprovider=OpenAIlines in the TUI log are not a reliable indicator that inference went to OpenAI.
How OpenAI Codex CLI talks to Antseed
- Wire format sent by OpenAI Codex CLI:
OpenAI Responses(hits/v1/responseson your gateway or buyer proxy) - Best-fit services: any service whose
protocolsarray containsopenai-responses. 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 Responses and the service's native protocol on the fly, inside the buyer. So a request from OpenAI Codex CLI can still reach a service that only advertisesanthropic-messages- just with a small transform step.
If it goes wrong
Troubleshooting
OPENAI_BASE_URL/OPENAI_API_KEYare being ignoredExpected on recent Codex builds. Add the[model_providers.antseed]block above to~/.codex/config.toml, or useantseed codex --model <model-id>with a local buyer proxy.401from the gatewayExportANTSEED_API_KEYwith your gateway key in the shell that starts Codex, and keepenv_key = "ANTSEED_API_KEY"in the provider block.- How can I tell if Codex is actually routing through Antseed?On a gateway, check Logs in the console after a test prompt. With the local buyer proxy, check
antseed buyer balance:Reservedgoing from $0 to a non-zero value and/orAvailabledropping confirms Antseed served the request. Do not trustlsofconnections to Cloudflare IPs orprovider=OpenAIlines in~/.codex/log/codex-tui.log. - Codex prints
Ignored unsupported project-local config keys … model_provider, model_providersProvider settings must live in your user-level~/.codex/config.toml. Codex rejects provider blocks in a project-local./.codex/config.tomland falls back to its default provider. - Tool calls fail or Codex switches tool formats mid-sessionUse a gateway preset as the model (
model = "@preset/coder"), as recommended in the gateway API docs. - Streaming stops after the first chunkSet
wire_api = "responses"in the[model_providers.antseed]block (the wrapper does this for you). Model metadata for … not found. Defaulting to fallback metadataExpected for open model ids.antseed codexsets a context window for you; in~/.codex/config.toml, setmodel_context_windowto the model's context length.- Hangs forever on first messageCheck the endpoint answers:
curl -s "$ANTSEED_BASE_URL/models" -H "Authorization: Bearer $ANTSEED_API_KEY". With the local buyer proxy, also checkantseed buyer status; if a stale session pin points at an offline peer, clear it withantseed buyer connection clear.
Reference
Links
Same category