Codex
Run the OpenAI Codex CLI on XField models with a custom provider in config.toml, plus profiles and reasoning effort.
The Codex CLI talks to models through the OpenAI Responses API, which XField serves at https://xfield.cloud.brutal.ai/api/v1/responses. You add XField as a custom model provider in ~/.codex/config.toml, point Codex at it, and keep everything else about your workflow.
You need the Codex CLI installed and an API key from Settings › API keys. No key yet? Request access.
Setup
- Export your key
Codex reads the key from the environment variable named in the provider entry. Add this to your shell profile so every new terminal has it.
export XFIELD_API_KEY="sk-xf-v1-..." - Add the provider
~/.codex/config.toml model = "deepseek-v4.1-flash-1017-uncensored" model_provider = "field" model_reasoning_effort = "high" model_context_window = 1000000 [model_providers.field] name = "XField" base_url = "https://xfield.cloud.brutal.ai/api/v1" env_key = "XFIELD_API_KEY" wire_api = "responses"base_urlalready ends in/v1; Codex appends/responses.wire_api = "responses"is the only protocol current Codex versions support, and the default.model_context_windowtells Codex how much room it has before compacting, since it does not know these models. - Run it
codexRun
/statusin the session to confirm the model and provider. A 401 meansXFIELD_API_KEYis not set in the shell that started Codex.
Switching models
Override the model for one run with -m, or any config key with -c:
codex -m glm-5.3-uncensored
codex -c model_reasoning_effort="max" "Review this diff for auth bypasses"Inside a session, /model switches too. Model ids are exact; see models for the list.
| Job | Model |
|---|---|
| Day-to-day coding, long agent runs | deepseek-v4.1-flash-1017-uncensored |
| Hard reasoning, security review, planning | glm-5.3-uncensored |
| Bulk edits, labeling, cheap batch work | glm-5.3-flash-uncensored |
Profiles
Profiles let you keep a few named setups and pick one per run. In current Codex versions a profile is its own file next to config.toml, with top-level keys:
model = "glm-5.3-uncensored"
model_provider = "field"
model_reasoning_effort = "max"codex --profile reviewOlder Codex versions read profiles from [profiles.review] tables inside config.toml instead. If --profile ignores your file, check codex --version and use the form your version expects.
Reasoning effort
model_reasoning_effort maps to reasoning.effort on the Responses API. XField accepts none, minimal, low, medium, high, xhigh and max, and each model maps the word to the levels it has. DeepSeek V4.1 Flash has low, high, xhigh and max, and runs at high when you set nothing.
Rules of thumb:
highfor normal coding. It is the default for a reason.xhighormaxfor a stubborn bug, a security review, or a plan you will follow for hours.lowfor mechanical work: renames, formatting, test scaffolding.
Higher effort means more reasoning tokens and slower turns, so raise it per run with -c rather than globally.
Tips
- Prompt caching is automatic. Codex keeps its instructions and tool list stable at the top of each request, so long sessions mostly bill as cached input.
codex exec "…"runs non-interactively, which suits CI jobs and scripted red-team harnesses.- Rate limited? Codex retries 429s on its own. If it gives up, wait a moment and resume.