Codex setup
Use Batchwell in Codex by adding a custom provider to ~/.codex/config.toml with base_url set to the Batchwell base URL.
To use Batchwell in Codex, add a custom provider to ~/.codex/config.toml with base_url set to https://api.batchwell.ai/v1,
wire_api = "responses" and env_key naming the environment variable that holds your Batchwell API key, then select it
with model_provider and a Batchwell model id as model. This is Codex's documented setup for a custom provider.
Create a key as described in the Quickstart and Authentication, then run:
It writes ~/.codex/batchwell.config.toml and ~/.config/batchwell/api-key, a Codex profile file, and leaves ~/.codex/config.toml as it is. It needs Codex 0.134.0 or later. It reads your key from BATCHWELL_API_KEY, or asks for it on the
terminal with the input hidden, and checks it with GET /v1/models before it writes anything. Then start the agent with
codex --profile batchwell. Every file it changes is first copied to <file>.; to undo
it, copy that backup back over the file, or delete a file the command created. The command runs on macOS, Linux and WSL;
see Connect an agent for every option.
Paste this prompt into the agent, or into any coding agent, and it sets itself up the same way. It names the variable that holds the key, never the key itself, and tells the agent to back up each file before it changes it.
The snippet is made for batchwell/kimi-k3.1-pro-uncensored, a model Batchwell serves today. In ~/.codex/config.toml, put
model_provider and model before the first [table], replacing any model_provider and model lines already there,
and replace an existing [model_providers. table rather than adding a second one: Codex will not read a file
that sets a key twice. Codex reads the key from BATCHWELL_API_KEY, so no key is written into the file. Create a key as described in the Quickstart
and Authentication, then start Codex:
model_providerpicks the provider Codex sends requests to, by its id undermodel_providers.modelis the model Codex uses. Set it to the model id fromGET /v1/models; see models.nameis the label Codex shows for the provider.base_urlis the address Codex sends its requests to. Set it to the Batchwell base URL, which ends in/v1.env_keynames the environment variable that holds the key. Codex sends it as a bearer token. The key starts withbw_live_orbw_test_.wire_api = "responses"selects the OpenAI Responses API. Batchwell serves it at/v1/responsesand runs each request as a chat completion on the same key, so credits, limits and usage work as they do for any other request.
Codex has no context window on record for a Batchwell model. Set model_context_window in the same file to the context
length of the model you choose, from models.
That model lists these supported parameters: temperature, top_p, max_tokens, max_completion_tokens, stop, stream_options, tools, tool_choice, reasoning_effort. These are the model's tunable
parameters, not the whole request. Batchwell turns each Codex request into a chat completion, which accepts the fields
listed under accepted fields, including stream and tools.
Batchwell accepts text content only. A request with an image, such as a screenshot added to a Codex prompt, gets
400 unsupported_content. The full list is on chat completions.
- Connect an agent compares the five agents and every option of the connect command.
- Errors lists every error code and what to do about it.
- Claude Code setup shows the same model in Claude Code.
- Hermes Agent setup shows the same model in Hermes Agent's
config..yaml