Claude Desktop API relay setup with 59API: two settings
Why Claude Desktop setup usually stalls
Most developers who want to use Claude models through a different API host hit the same wall: the setup guide looks like it should be trivial, but the client refuses the connection, or the request fails with an authentication error that has nothing to do with your key. The reason is usually procedural, not a limitation of the model. Claude models work only through the genuine Claude Code or Claude Desktop client, and that client expects two environment variables before it talks to anything.
That constraint is worth stating plainly, because it saves an afternoon. If you plan to route Claude through an API relay, you are not choosing an SDK, a script or a compatibility layer. You are pointing the official desktop client at a different host and letting it speak its native protocol.
59API is built around that shape of work. It is an independent third-party AI API relay, so one account and one API key give you one API host, https://api.59api.com, across Claude, GPT, Gemini, DeepSeek and other models. For a developer who wants Claude Desktop connected in minutes rather than a custom integration weekend, the setup is deliberately small: two settings, one key, and pay-as-you-go billing.
The only two settings you need
The connection itself comes down to two values. Set ANTHROPIC_BASE_URL=https://api.59api.com and ANTHROPIC_AUTH_TOKEN=YOUR_59API_KEY, then restart the client so it picks up the new environment. There is no SDK to install, no adapter to write, and no request format to translate.
Two details decide whether this works. First, use the genuine Claude Desktop client, or Claude Code 2.1.285 or newer. Older builds may not read the same configuration, and Claude models will not work through the OpenAI SDK, cURL or other clients, no matter how the request is shaped. Second, replace YOUR_59API_KEY with the key issued to your 59API account; the placeholder is only there so nobody copies a broken value by accident.
A practical sequence looks like this: add the two values to the environment your terminal and desktop apps launch from, restart Claude Desktop, open a fresh conversation, and send a short message. If the reply arrives, the host and the key are both correct. If it fails, the first thing to check is whether the client was fully restarted, because environment changes are read at launch rather than mid-session.
That is the entire handshake. The client still knows it is talking to Claude, still uses its own protocol, and still renders the conversation the way it normally does. 59API simply sits between the client and the upstream provider as a relay, handling billing at the same time.
One account, one key, prepaid balance
Before the first request, make sure the account has a balance. 59API uses a prepaid model: you top up, and each request is charged according to real token usage. There is no monthly fee, and your balance never expires, so an unused top-up is not a deadline you have to rush to spend. Monthly and weekly cards are optional if you would rather buy a fixed block of usage instead of paying per request.
Top-ups come in six amounts: ¥10, ¥50, ¥100, ¥200, ¥500 and ¥1000. Payment is by WeChat Pay or bank card, and invoices are available. Billing is in CNY, with USD figures shown at ¥7.2 = $1, which makes it easy to compare the rates on the pricing page against official list prices without doing currency conversions in your head.
Because the balance is prepaid and metered by token usage, the practical workflow is simple: start with a small top-up, run your real workload, and let the numbers tell you what the next one should be. There is no recurring subscription to cancel and no seat count to manage. One account, one API key and one host cover the whole setup, which is exactly why the connection step stays this short.
If you are testing the connection with a short prompt, a small balance is enough to confirm the path is live before you commit to a larger top-up.
What a request actually costs
Setup is only interesting if the running cost is reasonable. Here are the Claude rates on 59API, per 1 million tokens. Claude Sonnet 5.5 is $1.11 (¥8) for input, $5.56 (¥40) for output and $0.0972 (¥0.7) for cache reads. Claude Opus 5.5 is $1.53 (¥11) input, $7.22 (¥52) output and $0.0694 (¥0.5) cache reads. Claude Haiku 4.5 is $0.3472 (¥2.5) input, $1.67 (¥12) output and $0.0278 (¥0.2) cache reads.
A worked example makes the shape clearer. Claude Sonnet 5.5 with 3M input and 0.5M output tokens without cache costs $6.11 (¥44) on 59API, compared with $11 (about ¥79.2) at official list price, so 59API is about 56% of list price. For a lighter model, Claude Haiku 4.5 with 5M input and 1M output tokens without cache is $3.4 (¥24.5) on 59API against $10 (about ¥72) at official list price, or about 34% of list price.
The point is not to promise a single number for every project. Token mix changes the bill, and long prompts behave differently from short ones. The point is that the rate card is published per model and per token type, so you can estimate before you run anything and compare the result afterwards. Cache reads are listed separately, which matters for long Claude sessions that reuse context repeatedly.
For a team that prefers a fixed block, 59API also offers optional cards. A card has its own key, can only call that family of models, and is paid only from the card. For example, the C-PRO Starter Edition for Claude runs 30 days at $83.19 (¥599), with quota $610 and a weekly cap of $230.
Verify it, and know the boundaries
Once the client responds, verify the boundaries so you do not build on a wrong assumption. Claude models work only through the genuine Claude Code or Claude Desktop client, with Claude Code 2.1.285 or newer. They do not work through the OpenAI SDK, cURL, Codex, Cursor, Cherry Studio, Cline or OpenCode. Those OpenAI-compatible clients and SDKs work with GPT, DeepSeek and other non-Claude, non-Gemini models only, using base_url https://api.59api.com/v1 and the chat endpoint https://api.59api.com/v1/chat/completions. Gemini models follow Google native protocol through Gemini CLI, using GOOGLE_GEMINI_BASE_URL=https://api.59api.com and GEMINI_API_KEY=YOUR_59API_KEY, and they are not available on /v1/chat/completions.
If you use an optional card, remember its rules: it has its own key, 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 do not convert them into official prices when you compare options.
In practice, the whole journey is short: issue the key, top up the balance you need, set the two values, restart the client. From there, 59API keeps the relay path and the token-metered billing out of your way, and Claude Desktop behaves the way it always does.
Pronto para começar?
Uma só chave para Claude, GPT e outros, com cobrança por tokens reais e sem mensalidade. Cadastre-se para criar sua chave API; as tarifas de cada modelo estão na página de preços.
Cadastro grátis Preços