Native Anthropic Messages · 90% Prompt Cache Savings · Zero Lock-In

Claude Code API,pay as you go.

Run full-strength official Claude (Fable, Opus, Sonnet) inside Claude Code with Extended Thinking and native Prompt Caching — billed strictly per token in RMB with never-expiring balance and no 5-hour quota walls.

  • ¥5 Free Trial Credit on Signup
  • Native Prompt Caching (~90% Read Savings)
  • One-Click Toolkit & CC Switch Import
  • Corporate Wire & Digital VAT Invoices

Sign Up & Claim ¥5 Credit · View all live Claude prices →

Live Claude groups,side-by-side rates.

Choose a dedicated "CC Only" channel group for maximum savings inside Claude Code CLI, or pick an "External / Official" group when sharing one key across Cursor, Cline and custom SDKs.

Prices shown in RMB per 1M tokens (official USD list rates converted at $1 = ¥7) · See every Claude model & cache-write rate on the Pricing page →

Pay-as-you-go vs monthly plans:run the math.

Not sure whether to pay $20–$200/month for an official subscription or use pay-per-token API billing? Compare real developer workflows:

ZhenAPI Pay-As-You-Go (Best Flexibility)

From ¥1 · Never-expiring balance · Per-token billing — Ideal as your primary coding gateway or an instant overflow route when subscriptions hit cooldowns

  • Zero 5-hour rolling quota lockouts during crunch deployments
  • Pay ¥0 on weekends, vacations, or meeting-heavy weeks
  • Alipay, WeChat Pay, Stripe cards & corporate bank transfers supported
  • Per-engineer API key spending caps + 0%-fee corporate VAT invoices

Official Claude Pro (Entry Subscription)

$20 / mo · ~¥145 / month recurring — Suits light solo sessions if you rarely refactor multi-file repositories

  • Strict 5-hour rolling cap quickly interrupts deep multi-file refactors
  • Fixed monthly charge regardless of actual coding days
  • Cannot split quota across team members or export per-project cost logs

Official Claude Max (Heavy Subscription)

$100–$200 · ~¥720–¥1,450 / month recurring — Only breaks even if a single developer saturates the CLI all day, every week

  • High fixed burn during architecture, review, or QA weeks
  • Individual seats cannot pool unused balance across an engineering team
  • Many developers pair pay-as-you-go groups via CC Switch to cut monthly spend in half

Why large Claude Code token counts cost far less than you think

Claude Code resends repository context and tool schemas on every turn, making raw token counters look huge. Because 85%–95% of that prefix repeats across turns, Anthropic Prompt Caching automatically bills cache hits at ~10% of standard input rates:

  • Turn 1 — Initial repo indexing (cache_write): Written once when starting a session; TTL refreshes automatically as you keep working
  • Turns 2–40 — Iterative coding (cache_read): 90%+ of input tokens hit cache_read at ~90% off standard input pricing
  • Code edits & reasoning (output): Full output rate applies only to newly generated patches and explanations

Connect Claude Code in 30 seconds

Create an sk-... key bound to a Claude group on the API Keys page, then pick your preferred setup method (do NOT append /v1 to ANTHROPIC_BASE_URL):

macOS / Linux / WSL Script

Installs Node.js & Claude Code if needed and writes ANTHROPIC_BASE_URL + token to your shell profile:

curl -fsSL https://zhenapi.ai/install/claude-code.sh | bash

Windows PowerShell Script

Writes user-level environment variables on Windows (right-click in PowerShell to paste your key when prompted):

irm https://zhenapi.ai/install/claude-code.ps1 | iex

Manual ~/.claude/settings.json

Cleanest manual method — scoped strictly to Claude Code without polluting global shell variables:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.zhenapi.ai",
    "ANTHROPIC_AUTH_TOKEN": "sk-your-zhenapi-key",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  }
}

Download Windows Toolkit ↓ · Toolkit Guide → · Switch profiles with CC Switch → · Full Claude Code Setup Docs

Claude Code API FAQ & Troubleshooting

Which Claude group should I pick — "CC Only" or "External / Official"?

Pick "Claude Max (CC Only)" if this key is used exclusively inside the official Claude Code CLI for the deepest discount. Pick "Claude Max (External)" or "Claude Official" if you also use the same key in Cline, Roo Code, Cursor, Cherry Studio, or custom scripts.

Why am I getting 404 Not Found (/v1/v1/messages)?

Anthropic SDKs append /v1/messages automatically. Set ANTHROPIC_BASE_URL to exactly https://api.zhenapi.ai without /v1 or a trailing slash.

Why does running claude still open the browser asking for an Anthropic login?

Either your current terminal has not reloaded updated shell environment variables (open a new terminal window), or ~/.claude/settings.json has a JSON syntax error. Running the one-click script or ZhenAPI Toolkit fixes both automatically.

Are failed requests (401 / 403 / 429 / 503) billed?

Never. Non-200 error responses incur zero charges. 401 indicates an invalid/disabled key; 403 means insufficient balance or group-client mismatch; 503 indicates temporary upstream congestion (retry or switch to a backup group in CC Switch).

Can engineering teams set per-developer budgets and request VAT invoices?

Yes. Create separate API keys with individual RMB spending caps per developer in the console, and use corporate wire transfers (≥¥1,000) for 0%-surcharge Chinese Digital VAT General Invoices. See /en/enterprise.

Enterprise Procurement & VAT →