Connect an agent
Connect Codex CLI, Claude Code, OpenCode, Hermes Agent or OpenClaw to Batchwell with one command, a paste-in prompt or a manual setup.
To connect a coding agent to Batchwell, point it at the base URL https://api.batchwell.ai/v1, give it your Batchwell API key from the
BATCHWELL_API_KEY environment variable, and choose a Batchwell model id. The connect command does this for Codex CLI,
Claude Code, OpenCode, Hermes Agent and OpenClaw in one step.
| Agent | API format | File it writes | Start it with |
|---|---|---|---|
| Codex CLI | OpenAI Responses | ~/, ~/ | codex --profile batchwell |
| Claude Code | Anthropic Messages | ~/ | env -u ANTHROPIC_ |
| OpenCode | OpenAI Chat Completions | ~/, ~/ | opencode |
| Hermes Agent | OpenAI Chat Completions | ~/, ~/ | hermes |
| OpenClaw | OpenAI Chat Completions | ~/, ~/ | openclaw chat |
Codex CLI calls the OpenAI Responses API and Claude Code calls the Anthropic Messages API. Batchwell serves both at the same base URL and runs each request as a chat completion on the same key, so credits, limits and usage work as they do for any other request.
Create a key as described in the Quickstart and Authentication, then run the connect
command with the agent's name: codex, claude, opencode, hermes or openclaw.
The command:
- reads your key from
BATCHWELL_API_KEY, or asks for it on the terminal with the input hidden. It never shows the key or passes it to another program as an argument. - checks the key with
GET /v1/modelsand stops if the key is wrong or the model is not served. - copies every file it changes to
<file>.first, then changes only Batchwell's entries.batchwell-backup-<time> - prints what it changed, the backups and the command that starts the agent.
Add --model and a model id from models to choose the model; without it, the command uses the first
model GET /v1/models lists. Add --dry-run to print what it would write without writing anything, and --help for
every option. Running it twice gives the same settings. To undo it, copy each backup back over the file it came from.
The connect command runs on macOS, Linux and WSL. It needs the agent installed first; if the agent is missing, it prints the agent's own install command and stops.
Each agent's guide has a prompt you can paste into that agent, or into any coding agent, to set it up. The prompt gives
the exact values, tells the agent to read the key from BATCHWELL_API_KEY and never to ask you to paste it, back up
each file before it changes it, and check the result with GET /v1/models. The prompts are on the
Codex CLI, Claude Code, OpenCode,
Hermes Agent and OpenClaw pages.
A tool that lets you set an OpenAI-compatible base URL, an API key and a model id can use Batchwell: set the base URL
to https://api.batchwell.ai/v1, the key to your Batchwell API key and the model to a model id from models. Batchwell
serves chat completions; see Migrate from the OpenAI SDK for
what changes.
The connect command runs in a POSIX shell. On Windows, run it inside WSL, or follow the "Set it up by hand" section of each agent's guide.