Using BeatAPI in Claude Code
To run Claude Code on BeatAPI, set ANTHROPIC_BASE_URL to https://api.beatapi.io and ANTHROPIC_AUTH_TOKEN to your BeatAPI API key, then restart Claude Code. Claude Code is a command-line coding agent that reads and writes files, runs commands, and works through a task in the terminal. Claude Code speaks the Anthropic Messages format, which BeatAPI serves directly at POST /v1/messages, so no translation layer sits in between.
Prerequisites
- Claude Code installed — Step 1 shows how to install Claude Code.
- A BeatAPI API key — create one in Dashboard → API Keys.
Step 1: Install Claude Code
macOS / Linux
Windows
npm
Install with the official script:
Or with Homebrew:
PowerShell:
CMD:
With Node.js 18 or newer, on any operating system:
Confirm the install:
Step 2: Point Claude Code at BeatAPI
Three configuration methods, in descending order of durability. Pick one.
Method 1: settings.json
The most stable approach: configure settings.json once, and the settings persist across terminals.
Locate the configuration directory:
- macOS / Linux:
~/.claude - Windows:
%userprofile%\.claude
If the directory does not exist, run claude once and press Ctrl + C to exit; Claude Code creates the directory.
Create or edit settings.json:
Save the file and restart Claude Code.
Method 2: Persistent environment variables
macOS (zsh)
Linux (bash)
Windows (PowerShell)
Restart the terminal afterwards.
Method 3: One terminal only
Useful for a quick test. The values disappear when the terminal closes.
Step 3: Verify and start working
A reply means the configuration took effect. A login prompt, a 401, or a 403 means the configuration did not take effect — see the FAQ section on this page.
Claude Code has two interaction modes:
- Interactive — run
claudefor a continuing session, suited to multi-step work. - One-shot — run
claude "your question"for a single answer.
Models
Every Claude model on the account is reachable with the same key. Switch with /model inside an interactive session, or change ANTHROPIC_MODEL and restart.
Prices for each are on the pricing page; the Claude API page documents the request shape.
Configure Sonnet 5.5
Merge these values into ~/.claude/settings.json, replace the key placeholder, then restart Claude Code:
Sonnet 5.5 uses adaptive thinking by default. Let Claude Code manage the model’s thinking and tool settings. See the Sonnet 5.5 model guide for limits and current token rates.
Common commands
FAQ
The login screen still appears after configuring
The configuration did not take effect.
- Using
settings.json— check the path is~/.claude/settings.json(%userprofile%\.claude\settings.jsonon Windows). - Using environment variables — make sure you launched Claude Code from the terminal where the variables were set.
- Check the JSON is valid: matching braces, no trailing comma, straight quotes rather than typographic ones.
401 or 403
Also confirm ANTHROPIC_BASE_URL is https://api.beatapi.io and not the vendor’s own address.
”Auth conflict” on startup
You are signed in to a first-party account and have an API key set at the same time. Run /logout inside Claude Code to drop the session and keep the key.
402 insufficient_credits
Insufficient balance: the account balance is zero or below the price of the request. Top up from the dashboard; in-flight requests fail rather than queue.
429 rate_limit_exceeded
The key exceeded its request rate. BeatAPI returns Retry-After — wait for the Retry-After interval before retrying. The per-minute allowance rises with lifetime top-ups and is shown on the dashboard.
Connection failures
- Check general connectivity.
- Re-check
ANTHROPIC_BASE_URLfor a typo or a stray/v1. - Behind a corporate proxy, allow
api.beatapi.io.
Checking usage and spend
The dashboard shows calls, token consumption, and cost per key. The same numbers are available programmatically from GET /v1/usage.
Support
Open a support ticket from the dashboard and include the request_id from the failing response — the request_id identifies the exact call in the logs.

