One-line installer and setup guide for Claude Code CLI with the LLM API Claude-compatible relay.
Claude Code is Anthropic's official agentic CLI for AI-assisted coding. Claude Code CLI supports a configurable backend via the documented ANTHROPIC_BASE_URL environment variable — you can point it at any Anthropic-API-compatible endpoint.
This repo provides:
- One-line install scripts (Windows PowerShell, macOS, Linux)
- Manual setup instructions
- A common-issues reference
The default backend used by these scripts is LLM API — a Claude-compatible API relay service running a multi-provider pool with automatic failover, directly accessible from China without VPN, and supporting CNY billing via Alipay/WeChat.
irm llmapi.pro/setup.ps1 | iexcurl -fsSL llmapi.pro/setup.sh | bashThe installer will:
- Install Claude Code CLI via npm (if not already installed)
- Walk you through registering at llmapi.pro to get a free API key
- Set the two environment variables (
ANTHROPIC_BASE_URL,ANTHROPIC_API_KEY) - Run a connectivity check
If you would rather not run a script:
# 1. Install Claude Code CLI
npm install -g @anthropic-ai/claude-code
# 2. Get a free API key from https://llmapi.pro/register
# 3. Set environment variables (add to ~/.bashrc or ~/.zshrc)
export ANTHROPIC_BASE_URL=https://llmapi.pro
export ANTHROPIC_API_KEY=sk-...your-key...
# 4. Use Claude Code
claudeTo switch back to the default backend, just unset ANTHROPIC_BASE_URL.
| Symptom | Likely cause | Fix |
|---|---|---|
Connection refused / TLS hangs |
Network issue | Try a different ISP or DNS |
401 Unauthorized |
Wrong API key | Re-copy the key from your dashboard |
429 Rate limit exceeded |
Free tier cap hit | See the 429 triage guide |
| Tools fail silently | Claude Code version mismatch | npm update -g @anthropic-ai/claude-code |
| Behind GFW / China network issues | Direct foreign endpoints unreliable | See the China setup guide |
| Direct foreign API | LLM API relay | |
|---|---|---|
| China access | VPN required | Direct from most ISPs |
| Payment | Foreign card | Alipay / WeChat / CNY |
| Failover | Single vendor | Multi-provider pool |
| Setup | Account + billing | One API key |
More background on the relay model: llmapi.pro/blog.
Once you have Claude Code running, consider these workflow add-ons:
- claude-next — One-key handoff between deep Claude Code sessions. When a long conversation starts hallucinating past ~400K tokens,
/nextin the old window produces an audited handoff; pastecontinue Ain a new window to resume instantly.npx claude-next install. - claude-md-templates — Drop-in
CLAUDE.mdtemplates tuned for popular stacks (Next.js, FastAPI, Go, Rust, etc.). - awesome-claude-code — Curated list of other high-quality Claude Code tools and guides.
- Fix Claude Code 429 "Rate Limit Exceeded": Complete Triage Guide
- Running Claude Code from China: A Practical 2026 Guide
- Claude Code Tool Use: A Complete Developer Guide
- Claude Code on a Budget: A Solo Developer Starter Guide
MIT — see LICENSE.
LLM API and this repository are independent of Anthropic and not affiliated with Anthropic. Claude Code CLI is Anthropic's official tool that supports configurable backends via the documented ANTHROPIC_BASE_URL environment variable.