Claude Code setup on 59API: exact settings and pricing
Why Claude Code setup tends to stall
Most developers do not struggle with writing code. They struggle with the ten minutes before the first request goes out: hunting for the right base URL, guessing which environment variable the client expects, and discovering that a snippet copied from the wrong client silently fails. Connecting Claude Code to 59API should not be one of those tasks.
59API is an independent third-party AI API relay. One account and one API key give you one API host, https://api.59api.com, for Claude, GPT, Gemini, DeepSeek and other models. There is no monthly fee, and you are charged per request based on real token usage. Your balance is prepaid and never expires, so a quiet week costs nothing and a busy week does not require a separate subscription.
For Claude Code specifically, the setup is deliberately small: two environment variables, one genuine client, one key. Below you will find the exact values to paste, the model rates that decide what each request costs, worked examples that put real numbers on a bill, and a clear picture of how billing behaves once your workloads start running. Let us begin with the part that trips up almost everyone: which client is allowed to talk to Claude models at all.
The exact settings for Claude Code
Claude models work only through the genuine Claude Code or Claude Desktop client, and you need Claude Code 2.1.285 or newer. They do not work through the OpenAI SDK, cURL or other clients, and no amount of endpoint tweaking changes that. This is not a limitation of your account or your key; it is a condition of how Claude models are served.
With the right client in hand, the configuration is two values. Set ANTHROPIC_BASE_URL=https://api.59api.com and ANTHROPIC_AUTH_TOKEN=YOUR_59API_KEY, where YOUR_59API_KEY is the key from your 59API account. There is no separate base path to append, no version string to guess, and no second host to manage.
That is the whole setup. Restart the client after you export the variables, point it at a Claude model, and your request travels to https://api.59api.com with your key attached. If a request fails, check the client version first and then the variable names, because a near-miss in an environment variable name is the most common cause of a silent setup failure.
For comparison, 59API supports other ecosystems through their native conventions. Gemini CLI uses GOOGLE_GEMINI_BASE_URL=https://api.59api.com and GEMINI_API_KEY=YOUR_59API_KEY, because Gemini models use Google's native protocol only and are not OpenAI-compatible. OpenAI-compatible clients such as Cursor, Cherry Studio, Cline and OpenCode, along with Codex, the OpenAI SDKs and cURL, use base_url https://api.59api.com/v1 and chat endpoint https://api.59api.com/v1/chat/completions for GPT, DeepSeek and other non-Claude, non-Gemini models only.
How billing works once you connect
59API uses a prepaid balance model. You top up, then every request is charged per request by real token usage. There is no monthly fee, and your balance never expires, which means unused funds stay available for the next sprint instead of disappearing at a billing boundary.
Top-ups are available at ¥10, ¥50, ¥100, ¥200, ¥500 and ¥1000, paid by WeChat Pay or bank card. Invoices are available, so if you need one for a company expense, it is there. Pricing is quoted per 1 million tokens, with billing in CNY and USD figures shown at ¥7.2 = $1, which makes it easy to compare a model rate against an official list price without doing currency conversions by hand.
Cards are optional. If you prefer a prepaid monthly or weekly package over paying straight from your wallet balance, you can pick one later, but nothing about the Claude Code setup depends on it. The default path is simple: add funds, use your key, and let real token usage determine the cost.
One detail worth internalising is that a card has its own key, can only call that family's models, and is paid only from the card. It never falls back to wallet balance, and a balance key never draws on a card. Unused quota does not roll over. Quota and caps are card metering units written in $, not official list-price dollars, so treat them as limits on usage rather than as a comparable price.
What Claude models cost through 59API
Here are three Claude rates to keep in mind as you plan, all per 1 million tokens. Claude Haiku 4.5, model id claude-haiku-4-5-20251001, is input $0.3472 (¥2.5), output $1.67 (¥12), cache read $0.0278 (¥0.2). Claude Sonnet 5.5, model id claude-sonnet-5-5, is input $1.11 (¥8), output $5.56 (¥40), cache read $0.0972 (¥0.7). Claude Opus 5.5, model id claude-opus-5-5, is input $1.53 (¥11), output $7.22 (¥52), cache read $0.0694 (¥0.5).
For context, the official list price for Haiku 4.5 is $1 / $5, for Sonnet 5.5 it is $2 / $10, and for Opus 5.5 it is $4 / $20. Official list price here is only a reference point; 59API is an independent relay and charges the rates shown above.
Two patterns are worth noticing. First, output tokens cost several times more than input tokens on every model here, so a chatty agent that narrates every step costs more than a terse one that returns answers. Second, cache reads are priced far below input tokens, which matters when you run a long session with a stable context prefix.
That is the practical argument for choosing a model deliberately rather than defaulting to the most capable option for every task. A hypothetical research assistant that mostly replays a large fixed context may behave very differently in cost from a code review loop that sends short prompts and receives short answers.
Worked examples: what a real month can look like
Numbers help more than rate tables when you are deciding whether a relay fits your workload. Consider three hypothetical usage patterns, each without cache.
Claude Sonnet 5.5 with 3M input tokens and 0.5M output tokens costs $6.11 (¥44) on 59API. At the official list price of $11 (about ¥79.2), 59API is about 56% of list price. For a team shipping several features a week on one mid-tier model, that gap is visible on the invoice without changing how anyone works.
Claude Opus 5.5 with 2M input tokens and 0.5M output tokens costs $6.67 (¥48) on 59API, against an official list price of $18 (about ¥129.6), so 59API is about 37% of list price. This is the case where a stronger model is still comfortable to use for the hard, high-stakes portion of a project.
Claude Haiku 4.5 with 5M input tokens and 1M output tokens costs $3.4 (¥24.5) on 59API, compared with an official list price of $10 (about ¥72), making 59API about 34% of list price. Haiku is a sensible default for the high-volume, low-stakes traffic that tends to dominate a token bill.
The pattern across all three is consistent: pick the model the task deserves, then let 59API keep the per-token cost down. Because billing follows real token usage, you can start with a small top-up, watch your first few requests, and adjust from there.
Should you add a card, and what to try first
Cards are optional, so the simplest path is to skip them. If you do want one, C-PRO 入门版 (Claude, 30 days) is $83.19 (¥599) with quota $610 and weekly cap $230, draining at the card's metering price × 2.4, and a reference value at official list prices of about $169.44 (¥1220). For shorter bursts, 【周卡】C-PRO $290 (Claude, 7 days) is $40.14 (¥289) with quota $290 and weekly cap $290, reference value at official list prices about $80.56 (¥580).
Remember the mechanics: a card key calls only that family, is paid only from the card, never falls back to wallet balance, and unused quota does not roll over.
Here is a practical first run. Create your account, top up a small amount such as ¥10 or ¥50, and copy your key. Export ANTHROPIC_BASE_URL=https://api.59api.com and ANTHROPIC_AUTH_TOKEN=YOUR_59API_KEY in the environment where Claude Code 2.1.285 or newer runs. Start with a Claude model whose rate suits the task, send one request, and confirm it arrives. Then watch how the balance moves against real token usage.
From there, expand deliberately: keep one model for routine work, reserve a stronger model for the tasks that need it, and consider a card only when prepaid wallet billing stops matching your usage pattern. That is the whole decision, and it starts with two environment variables.
Prêt à commencer ?
Une seule clé pour Claude, GPT et d’autres modèles, facturée aux tokens réels, sans abonnement mensuel. Inscrivez-vous pour créer votre clé API ; les tarifs de chaque modèle sont sur la page Tarifs.
Inscription gratuite Tarifs