GPT-6.1 Sol via 59API: OpenAI Node.js SDK setup
Most Node.js developers hit the same wall when they want to move a prototype beyond a single vendor: the SDK is familiar, but the endpoints, keys and model names are not. Every new provider means another base URL, another environment variable and another round of debugging. The result is a codebase that is harder to change than the problem it was meant to solve.
If you are evaluating an API relay for GPT models, the question is not only what it costs. It is how much of your afternoon disappears into setup. A relay that asks you to learn a new client, translate protocols by hand or guess at undocumented fields will cost more in time than it saves in tokens.
This guide walks through the shortest path to a working call with 59API using the OpenAI Node.js SDK. You will get the exact base URL, the exact chat endpoint, the environment variable names, a copy-ready snippet and a realistic sense of what a request costs. The goal is simple: one account, one API key, one host, and a request that works.
We will also cover the limits, because they matter. The OpenAI SDK path is for GPT, DeepSeek and other non-Claude, non-Gemini models. Claude models work only in the genuine Claude Code or Claude Desktop client (Claude Code 2.1.285 or newer), and Gemini models use Google's native protocol only through Gemini CLI. Neither belongs in an OpenAI SDK integration.
By the end, you should be able to decide whether 59API fits your project before you commit a day to wiring it up.
What 59API actually gives you
59API is an independent third-party AI API relay, not an official channel of any model vendor. It gives you one account and one API key for one API host: https://api.59api.com. From that single endpoint you can reach Claude, GPT, Gemini, DeepSeek and other models, each through the protocol its client expects.
For the OpenAI Node.js SDK, the settings are exact and short. The base URL is https://api.59api.com/v1, and the chat endpoint is https://api.59api.com/v1/chat/completions. The same base URL works for Codex, cURL and OpenAI-compatible clients such as Cursor, Cherry Studio, Cline and OpenCode, which is handy if your team mixes tools across a laptop and a CI runner.
There is one boundary worth repeating. The OpenAI SDK path serves GPT, DeepSeek and other non-Claude, non-Gemini models only. Claude models work only in 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 they do not work on /v1/chat/completions. Keeping that line clear avoids the most common wasted afternoon in relay integrations.
Account setup is deliberately thin: create an account, top up a prepaid balance, and copy your key. Billing is per request based on real token usage, with no monthly fee, and your balance never expires. You are not signing a contract or committing to a seat count before you know what the traffic actually costs.
Wiring up the OpenAI Node.js SDK
Install the official SDK package once:
npm install openai
Then point the client at 59API. The only two things that change are the key and the base URL; everything else in your existing code stays familiar:
const OpenAI = require('openai');const client = new OpenAI({apiKey: process.env['YOUR_59API_KEY'],baseURL: 'https://api.59api.com/v1',});const response = await client.chat.completions.create({model: 'gpt-6.1-sol',messages: [{ role: 'user', content: 'Say hello in one line.' }],});console.log(response.choices[0].message.content);
Export your key as YOUR_59API_KEY in the environment rather than hard-coding it, and keep it out of source control. The SDK appends the chat path itself, so client.chat.completions.create resolves to https://api.59api.com/v1/chat/completions.
If you prefer to see the raw request, the same settings work with cURL against that endpoint. And if your team also uses Codex or an OpenAI-compatible editor client such as Cursor, Cherry Studio, Cline or OpenCode, the same https://api.59api.com/v1 base URL and the same key work there, so there is no second account to manage.
Two quick checks when something fails: confirm the model id is one of the ids 59API publishes (for example gpt-6.1-sol), and confirm your prepaid balance covers the request. Because billing follows real token usage, a working request is also your fastest proof that the key and host are correct.
What the calls actually cost
Setup is cheap; the reason to care is the running cost. Rates are published per 1 million tokens, billed in CNY, with USD shown at ¥7.2 = $1. For GPT-6.1 Sol, 59API lists input at $0.1847 (¥1.33), output at $0.9264 (¥6.67) and cache read at $0.0375 (¥0.27), against an official list price reference of $2 / $10.
Here is a hypothetical but concrete workload. GPT-6.1 Sol with 5M input and 1M output tokens, without cache, costs $1.85 (¥13.32) on 59API. At the official list price of $20 (about ¥144), that is about 9% of list price. For a second example, GPT-5.6 Sol with 2M input and 0.5M output tokens without cache costs $1.67 (¥12) on 59API, versus $18 (about ¥129.6) at official list price, also about 9% of list price.
You are not locked to one model. DeepSeek V4 Flash is listed at $0.2778 (¥2) input and $1.11 (¥8) output, and MiniMax M3 at $0.1389 (¥1) input and $0.5556 (¥4) output, both per 1 million tokens. That makes it practical to route cheap, high-volume classification or summarisation work to a lighter model while keeping a stronger GPT model for the harder calls, all through the same SDK client and the same key.
Because you are charged by real token usage per request, the practical habit is to log your token counts from day one. The numbers above are examples, not quotes for your application; your own mix of prompts and completions is what determines the bill.
Balance, cards and the decision to switch
59API is prepaid. Top-ups are available at ¥10, ¥50, ¥100, ¥200, ¥500 and ¥1000, paid by WeChat Pay or bank card, and invoices are available. There is no monthly fee, and your balance never expires, so a small top-up is enough to start testing without a commitment.
Cards are optional, and they behave differently from wallet balance. 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 do not read them as a price comparison.
Two examples to keep in mind: G-PRO Entry (GPT, 30 days) is $83.19 (¥599), with quota $2300 and a weekly cap of $880; the G-PRO $1100 weekly card (GPT, 7 days) is $40.56 (¥292), with quota $1100 and a weekly cap of $1100.
So how should you decide? If you want a single integration, one key, pay-as-you-go pricing and no expiry on your balance, start with 59API's prepaid wallet and the OpenAI Node.js SDK settings above. If you already know you will run a heavy, predictable GPT workload every week, compare a card against your own token forecast before committing. Either way, the setup is one host, one key and a base URL you can paste into an existing client today.
शुरू करने के लिए तैयार?
Claude, GPT और अन्य मॉडलों के लिए एक ही key, असली token उपयोग पर बिलिंग और कोई मासिक शुल्क नहीं। साइन अप करके अपनी API key बनाएं; हर मॉडल की दरें मूल्य पेज पर हैं।
मुफ़्त साइन अप मूल्य