Claude Code setup
Use Batchwell in Claude Code by setting ANTHROPIC_BASE_URL to the Batchwell address and ANTHROPIC_AUTH_TOKEN to your API key.
To use Batchwell in Claude Code, set ANTHROPIC_BASE_URL to the base URL https://api.batchwell.ai/v1 without its /v1, set
ANTHROPIC_AUTH_TOKEN to your Batchwell API key, and set ANTHROPIC_MODEL to a Batchwell model id. This is Claude
Code's documented setup for an LLM gateway.
Create a key as described in the Quickstart and Authentication, then run:
It writes ~/.config/batchwell/claude-settings.json with the key in its env block (readable only by you), and leaves ~/.claude/settings.json as it is. 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
env -u ANTHROPIC_API_KEY claude --settings ~/.config/batchwell/claude-settings.json. 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. It reads the key from
BATCHWELL_API_KEY, so no key is written into the snippet. Create a key as described in the Quickstart and
Authentication, then run the lines in the shell you start Claude Code from. The last line
starts Claude Code.
The first line clears ANTHROPIC_API_KEY. If it is set, Claude Code sends it in an x-api-key header, and it conflicts
with a Claude login. Leave it unset whenever you use Batchwell.
ANTHROPIC_BASE_URLis the address Claude Code sends its requests to. Set it tohttps://api.batchwell.ai, the Batchwell base URL without/v1: Claude Code adds/v1/messagesitself.ANTHROPIC_AUTH_TOKENis the key Claude Code sends as a bearer token. The snippet copies it fromBATCHWELL_API_KEY. The key starts withbw_live_orbw_test_.ANTHROPIC_MODELis the model Claude Code uses. Set it to the model id fromGET /v1/models; see models.ANTHROPIC_DEFAULT_HAIKU_MODELis the model Claude Code uses for its background requests. The snippet sets it to the same model so every request reaches a model Batchwell serves. A cheaper Batchwell model id works here too.
Batchwell serves Claude Code's requests at /v1/messages and runs each one as a chat completion on the same key, so
credits, limits and usage work as they do for any other request.
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 Claude Code 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 pasted into Claude Code, 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.
- Codex setup shows the same model in Codex's
config..toml - Hermes Agent setup shows the same model in Hermes Agent's
config..yaml