Using BeatAPI in Claude Code
Using BeatAPI in 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. It speaks the Anthropic Messages format, which BeatAPI serves directly at POST /v1/messages — so pointing it at BeatAPI is a base-URL change, not a translation layer.
Prerequisites
- Claude Code installed — see Step 1 if you have not installed it yet.
- 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:
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 once and it persists across terminals.
Locate the configuration directory:
- macOS / Linux:
~/.claude - Windows:
%userprofile%\.claude
If it does not exist, run claude once and press Ctrl + C to exit; the directory is created for you.
Create or edit settings.json:
Save the file and restart Claude Code.
Method 2: Persistent environment variables
macOS (zsh)
Linux (bash)
Windows (PowerShell)
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 it did not — see the FAQ below.
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.
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
The account balance is exhausted. Add credits 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 that long 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 — it identifies the exact call in the logs.

