Use Claude Code with Halfbill
Set up Claude Code with a Halfbill key, step by step, for people who have never opened a terminal.
Claude Code is Anthropic's coding assistant. It runs in a terminal (a text window where you type commands) and can read, write, and run code in a folder for you. Normally it needs an Anthropic account. With two settings it uses your Halfbill account instead.
What you'll need
A Halfbill account with credits or a Halfbill Code plan, about 15 minutes, and permission to install software on your computer.
1. Install Node.js
Node.js is the runtime Claude Code needs. Download the LTS installer from nodejs.org and run it, accepting the defaults.
2. Open a terminal and install Claude Code
- Press Cmd + Space, type
Terminal, press Enter. - Paste this line and press Enter:
npm install -g @anthropic-ai/claude-code- Press the Windows key, type
PowerShell, press Enter. - Paste this line and press Enter:
npm install -g @anthropic-ai/claude-codeIf the terminal says npm is not recognized, close it and open a new one after the Node.js install finishes.
3. Create a key in the dashboard
A key is a long secret string that tells Halfbill "this tool may use my balance".
- Open halfbill.uk/dashboard → API Keys → Create API Key.
- Give it a name like
Claude Code. Optionally set a spending limit. - Click Create API Key and copy the key. It is shown once.

4. Tell Claude Code to use Halfbill
Claude Code reads a settings file. Create it with the content below, replacing your_key_here with the key you copied.
The file is ~/.claude/settings.json (the .claude folder in your home folder). In the terminal:
mkdir -p ~/.claude && open -e ~/.claude/settings.jsonTextEdit opens. Paste this, then save and close:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.halfbill.uk",
"ANTHROPIC_AUTH_TOKEN": "your_key_here",
"ANTHROPIC_MODEL": "claude-sonnet-5"
}
}The file is %USERPROFILE%\.claude\settings.json. In PowerShell:
mkdir $env:USERPROFILE\.claude -Force; notepad $env:USERPROFILE\.claude\settings.jsonNotepad asks to create the file; say yes. Paste this, then save and close:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.halfbill.uk",
"ANTHROPIC_AUTH_TOKEN": "your_key_here",
"ANTHROPIC_MODEL": "claude-sonnet-5"
}
}ANTHROPIC_BASE_URL is the address Claude Code sends requests to; ANTHROPIC_AUTH_TOKEN is your key. Both are explained in the Glossary.
5. Start it and check
- In the terminal, go to a project folder (for example
cd Documents/my-project) and typeclaude, then Enter. - Type
/statusand press Enter. The API section should showhttps://api.halfbill.uk. - Ask it something small, such as "list the files in this folder and explain them".
- Open Activity in your dashboard: the request appears there with its cost.
6. Pick a model
Type /model claude-sonnet-5 inside Claude Code to switch models for the session. Use claude-opus-5 for harder tasks, claude-fable-5-1 (the strongest Anthropic model) for the hardest ones, and claude-haiku-4-5 for cheap, quick ones. The ids are on halfbill.uk/models.
If something goes wrong
- It says the key is invalid or asks you to log in. Open the settings file again and check the key has no spaces or missing characters. Create a new key in the dashboard if in doubt, and restart Claude Code.
- It mentions insufficient credits or balance. Your balance is empty, or the key's spending limit is reached. Top up in the dashboard or raise the limit under API Keys.
- A model is "not found". Use an id from halfbill.uk/models, for example
/model claude-sonnet-5.
More cases are in Troubleshooting.
Want the technical details?
The Claude Code integration guide covers environment variables, model discovery, and per-session flags.
Next step
How is this guide?