59API

← Voltar aos guias

GPT-6.1 Sol with 59API API relay: Node.js setup

API · EN · 2026-11-13

The setup problem behind every provider switch

Most teams do not change API providers because they enjoy changing API providers. They change because a new model ships, a key gets rotated, or a base URL has to move. In Node.js, that usually means editing the same three lines of configuration and then re-testing every call path that depends on them.

59API removes that kind of friction. It is an independent third-party AI API relay: one account, one API key, one API host at https://api.59api.com. Point the OpenAI Node.js SDK at that host and GPT, DeepSeek and other non-Claude, non-Gemini models become reachable through the standard chat completions endpoint. There is no monthly fee, and each request is charged by real token usage.

The application logic does not need to change. Streaming, error handling, your prompt pipeline and your tests stay exactly where they are. What changes is the address the SDK calls and the key it sends.

One limit is worth stating up front, because it saves debugging time. Claude models on 59API work only through the genuine Claude Code or Claude Desktop client (Claude Code 2.1.285 or newer), never through the OpenAI SDK, cURL or other clients. Gemini models use Google's native protocol only, through Gemini CLI, and are not OpenAI-compatible. So the SDK route covered here is the route for GPT, DeepSeek and other compatible models.

The exact client settings for 59API

Here is the complete configuration. The base URL is https://api.59api.com/v1. The chat endpoint is https://api.59api.com/v1/chat/completions. The API key is the single key issued with your 59API account, written here as YOUR_59API_KEY.

const OpenAI = require('openai'); const client = new OpenAI({ baseURL: 'https://api.59api.com/v1', apiKey: process.env.YOUR_59API_KEY, }); const response = await client.chat.completions.create({ model: 'gpt-6.1-sol', messages: [ { role: 'user', content: 'Summarise this change in two sentences.' }, ], }); console.log(response.choices[0].message.content);

Two details matter. Keep the /v1 suffix in the base URL, because the SDK appends the rest of the path itself. And keep the key out of source control by reading it from an environment variable, as in the snippet above.

If a request fails, check the base URL first: a missing /v1, or a trailing path that duplicates /chat/completions, will fail even when the key is perfectly valid.

The same base URL serves Codex, cURL and OpenAI-compatible clients such as Cursor, Cherry Studio, Cline and OpenCode. That is useful when a Node.js service and a desktop editor need to share one provider and one key instead of two separate configurations.

In practice, setup is one host, one key, one model string. There is no monthly fee to activate, no subscription to start, and no 59API-specific SDK to learn.

Model ids and per-token rates you can use today

Once the client is wired up, the next decision is which model id to pass. 59API prices are per 1 million tokens, billed in CNY, with USD shown at ¥7.2 = $1.

GPT-6.1 Sol, model id gpt-6.1-sol, is $0.1847 (¥1.33) for input, $0.9264 (¥6.67) for output and $0.0375 (¥0.27) for cache read. Its official list price is $2 / $10.

GPT-5.6 Sol, model id gpt-5.6-sol, is $0.3472 (¥2.5) input, $1.94 (¥14) output and $0.0278 (¥0.2) cache read, against an official list price of $4 / $20. That list price is a reference price for comparison, not what 59API charges.

DeepSeek V4 Flash, model id deepseek-v4-flash, is $0.2778 (¥2) input, $1.11 (¥8) output and $0.006944 (¥0.05) cache read. For a lighter option, MiniMax M3, model id MiniMax-M3, is $0.1389 (¥1) input and $0.5556 (¥4) output, with cache read at $0.0278 (¥0.2).

Notice the pattern: output tokens cost more than input tokens on every model above, and cache reads cost less than either. If your application reuses a large fixed prompt, that cache read rate is the number to watch. Swap the model string, keep everything else, and the same code path serves each one.

What the numbers look like on a real workload

Numbers make the case clearer than adjectives. Take GPT-6.1 Sol with 5M input tokens and 1M output tokens, no cache. On 59API that is $1.85 (¥13.32). At official list price the same usage is $20 (about ¥144), so 59API is about 9% of list price.

GPT-5.6 Sol is similar. For 2M input and 0.5M output tokens without cache, 59API charges $1.67 (¥12). At official list price the same call is $18 (about ¥129.6), again about 9% of list price.

Cache reads change the picture further. Because cache read is priced far below input, a production service that keeps a stable system prompt can spend less per request than any of these worked examples assume.

These are worked examples, not customer stories. They show the arithmetic: real token usage, published per-million-token rates, and no monthly fee layered on top. Nothing here requires a commitment period, because the balance never expires. That makes short experiments and long-running services the same workflow.

Because billing follows actual usage, you can start with a small balance, watch the first requests land, and adjust the model id or the prompt size from what you actually see.

Prepaid balance, top-ups and optional cards

Money handling is deliberately simple. 59API runs on a prepaid balance, charged per request by real token usage, with no monthly fee and no expiry on the balance. Top-ups come in ¥10, ¥50, ¥100, ¥200, ¥500 and ¥1000, paid by WeChat Pay or bank card, and invoices are available.

Monthly and weekly cards are optional. 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.

For example, the G-PRO entry card, for GPT over 30 days, is $83.19 (¥599) with quota $2300 and a weekly cap of $880. It drains at the card's metering price × 2.4, and its reference value at official list prices is about $638.89 (¥4600). Quota and caps are card metering units written in $, not official list-price dollars, so they are not directly convertible into official prices.

So which should you pick? If usage is irregular, the prepaid balance is the flexible option: top up ¥10 or ¥50, call the SDK with your balance key, and stop. If usage is heavy and predictable, a card may suit better, because the key and the model family are separated from the wallet.

Either way, the Node.js code does not change. The base URL stays https://api.59api.com/v1, the key stays YOUR_59API_KEY, and the model id stays yours to choose.

Docs

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