59API

← सभी गाइड पर लौटें

Claude Desktop API relay setup with 59API: 2 settings

Claude Code · EN · 2026-11-03

The setup problem is usually the environment variables

You have Claude Desktop open, you have an API key, and you still cannot get a response. That gap usually comes down to two things: the wrong base URL and the wrong client. A developer should not have to reverse-engineer a proxy configuration to run a model. With 59API, an independent third-party AI API relay, the Claude Desktop connection is defined by exactly 2 environment variables, one API host and one key, and nothing else needs to change in your workflow.

59API gives you one account and one API key across Claude, GPT, Gemini, DeepSeek and other models, all served through the single host https://api.59api.com. Billing is prepaid and charged per request according to real token usage. There is no monthly fee, and your balance never expires. Optional monthly and weekly cards sit alongside that wallet if your usage pattern calls for them.

For Claude specifically, there is one boundary worth stating up front: Claude models work only through the genuine Claude Code or Claude Desktop client, using Claude Code 2.1.285 or newer. They do not run through the OpenAI SDK, cURL, or other clients. If your plan is to work inside Claude Desktop, that constraint is not a limitation of your setup. It is the setup.

Once those 2 values are in place, you are no longer juggling several providers, several hosts and several billing paths. You have one place to fund, one key to manage, and one set of token rates to reason about.

Two settings: base URL and auth token

Here is the complete Claude Desktop configuration. Set ANTHROPIC_BASE_URL=https://api.59api.com and ANTHROPIC_AUTH_TOKEN=YOUR_59API_KEY, where YOUR_59API_KEY is replaced with the key issued to your 59API account. Those are the only 2 client settings required.

Note what the base URL does and does not contain. It is the host root, https://api.59api.com, with no path appended and no trailing /v1. That is different from the OpenAI-compatible route used by Codex, the OpenAI SDKs, cURL and clients such as Cursor, Cherry Studio, Cline and OpenCode, which point at https://api.59api.com/v1 and send chat requests to https://api.59api.com/v1/chat/completions for GPT, DeepSeek and other non-Claude, non-Gemini models. Mixing the two conventions is the single most common reason a configuration appears correct but returns nothing.

Gemini follows a third path. In Gemini CLI, use GOOGLE_GEMINI_BASE_URL=https://api.59api.com and GEMINI_API_KEY=YOUR_59API_KEY. Gemini models use Google's native protocol only, so they are not OpenAI-compatible and do not work on /v1/chat/completions.

For your Claude Desktop work, ignore the other two routes. Apply the 2 Claude settings, restart the client, and confirm the model you selected appears in the interface.

What each Claude request will cost

Because 59API charges by real token usage, the useful question is not what a request costs. It is what your input, output and cache-read tokens cost per 1 million tokens. Billing is in CNY, with USD figures shown at ¥7.2 = $1.

Claude Sonnet 5.5, model id claude-sonnet-5-5, is listed at $1.11 (¥8) for input, $5.56 (¥40) for output and $0.0972 (¥0.7) for cache read. Its official list price reference is $2 / $10. Claude Opus 5.5, model id claude-opus-5-5, is $1.53 (¥11) input, $7.22 (¥52) output and $0.0694 (¥0.5) cache read, against an official list price reference of $4 / $20. Claude Haiku 4.5, model id claude-haiku-4-5-20251001, is $0.3472 (¥2.5) input, $1.67 (¥12) output and $0.0278 (¥0.2) cache read, with an official list price reference of $1 / $5.

Two more entries can be useful when you want a stronger model for harder work. Claude Fable 5.1, model id claude-fable-5-1, is $3.61 (¥26) input, $18.06 (¥130) output and $0.2222 (¥1.6) cache read, with an official list price reference of $10 / $50. Claude Opus 5, model id claude-opus-5, is $1.81 (¥13) input, $9.03 (¥65) output and $0.1111 (¥0.8) cache read, against $5 / $25.

Write these 3 numbers down before you start: input, output, cache read. Every bill you receive will be built from them.

Worked examples: what a session actually costs

Rates are easier to trust when you see them applied to a realistic workload. Consider a hypothetical Claude Desktop session with 3M input tokens and 0.5M output tokens, no cache, on Claude Sonnet 5.5. On 59API that comes to $6.11 (¥44). At the official list price of $11 (about ¥79.2), the same workload would be about ¥79.2, so 59API is about 56% of list price.

Now take Claude Opus 5.5 with 2M input tokens and 0.5M output tokens, again without cache. On 59API the cost is $6.67 (¥48). At the official list price of $18 (about ¥129.6), 59API is about 37% of list price. The gap between these two examples is instructive: the discount is not a fixed percentage across models, so you should price the model you actually plan to use rather than assume a rule.

For lighter traffic, Claude Haiku 4.5 with 5M input tokens and 1M output tokens, no cache, costs $3.4 (¥24.5) on 59API. At the official list price of $10 (about ¥72), that is about 34% of list price.

These are illustrations of token arithmetic, not benchmarks. Your own usage will depend on context length, output length and how often cached content is reused. The point of the exercise is simple: you can estimate a session before you run it, and you can see the difference a model choice makes before the request is sent.

Prepaid balance or a card?

59API gives you two ways to pay, and you can decide per use case. The first is a prepaid balance, topped up in ¥10, ¥50, ¥100, ¥200, ¥500 or ¥1000, paid by WeChat Pay or bank card, with invoices available. Balance never expires, and you are charged per request by real token usage.

The second is optional cards. A card has its own key, can call only 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 written in card metering units, not official list-price dollars, so read them as meter values rather than as a comparison with list price.

For Claude, one monthly option is C-PRO 入门版 at $83.19 (¥599) for 30 days, with quota $1300 and a weekly cap $500. The 30-day C-PRO 标准版 is $152.64 (¥1099), quota $2650, weekly cap $1000. For shorter commitments, the 7-day 【周卡】C-PRO $600 is $40.14 (¥289) with quota $600 and weekly cap $600. Cards drain at the card's metering price × 2.4.

For a first run, the prepaid balance is the simplest path: top up, set the 2 variables, and let token usage draw it down. Once your Claude Desktop usage becomes predictable, a card may suit a committed window better. Either way, one account and one key cover the setup.

Ship the first request

Here is the shortest path from nothing to a working Claude Desktop session on 59API. Create your account, top up the balance with WeChat Pay or a bank card in one of ¥10, ¥50, ¥100, ¥200, ¥500 or ¥1000, and copy your API key. Then set ANTHROPIC_BASE_URL=https://api.59api.com and ANTHROPIC_AUTH_TOKEN=YOUR_59API_KEY in your environment. Restart Claude Desktop and pick your model.

Two details will save you time. First, the client must be the genuine Claude Code or Claude Desktop client, with Claude Code 2.1.285 or newer, because Claude models do not work through the OpenAI SDK, cURL or other clients. Second, do not append /v1 to the Claude base URL. That suffix belongs to the OpenAI-compatible route used by GPT, DeepSeek and other non-Claude, non-Gemini models.

What you gain is a single surface for your AI usage: one API host, one key, per-token pricing you can read in advance, a balance that never expires, and no monthly fee on the wallet itself. For a developer who wants Claude Desktop to behave predictably and be costed predictably, that is a short configuration with a clear payoff. Try it on a small top-up, watch the token numbers on your first few sessions, and scale from there.

दस्तावेज़

शुरू करने के लिए तैयार?

Claude, GPT और अन्य मॉडलों के लिए एक ही key, असली token उपयोग पर बिलिंग और कोई मासिक शुल्क नहीं। साइन अप करके अपनी API key बनाएं; हर मॉडल की दरें मूल्य पेज पर हैं।

मुफ़्त साइन अप मूल्य