GPT-6.1 Sol setup with 59API: OpenAI SDK API relay
The setup problem behind every AI prototype
Most Node.js developers did not start building with an AI API because they wanted to spend an afternoon on provider plumbing. Yet that is often exactly where the first hour disappears: hunting for the right base URL, rewriting request objects for every provider, juggling separate API keys, and tracking separate invoices for every project. The model is the interesting part. The connection layer is the tax you pay before you can test a single prompt.
59API was built to remove that tax. It is an independent third-party AI API relay: one account, one API key, and one API host at https://api.59api.com for Claude, GPT, Gemini, DeepSeek and other models. For this article we stay inside the OpenAI Node.js SDK, which means GPT, DeepSeek and other non-Claude, non-Gemini models. Claude models work only through 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 setup.
So what is an API relay, exactly? It is a service that receives your standard request, forwards it to the upstream model provider, and returns the response in the format your client already understands. 59API is not OpenAI, Anthropic or Google, and it is not an official channel for them. It is a separate layer you choose to point your SDK at.
So what does setup actually look like? Three edits. Install the official openai package, change baseURL to the 59API host, and supply your 59API key instead of an OpenAI key. The rest of your application code can stay as it is. That is the whole pitch, and the rest of this guide shows you how to do it.
What 59API gives you before you write code
Before touching your editor, it helps to understand the commercial shape of the service, because it affects how you behave as a developer. 59API runs on a prepaid balance model. You top up once, and each request is charged according to the real token usage of that request. There is no monthly fee, and your balance never expires. If a project goes quiet for two months and then wakes up, the money you already paid is still there.
Top-ups come in deliberately small steps so you can start without a large commitment: ¥10, ¥50, ¥100, ¥200, ¥500 and ¥1000. Payment is handled through WeChat Pay or bank card, and invoices are available. For a solo developer testing an idea on a weekend, that means you can fund a real experiment without negotiating a procurement contract or committing to a fixed subscription.
Monthly and weekly cards are also available if you prefer a prepaid allowance structure over pure pay-as-you-go spending. 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. Cards are optional, though: plenty of developers never need one.
What you get in exchange is a single, predictable relationship with the endpoint. One host, one key format, one billing view. Whether you ship a prototype today or an internal tool next quarter, the configuration stays the same. That consistency is the real convenience, and it is why 59API is worth a try even if your current script already works with a single provider.
Install the SDK and point it at 59API
Let's set up the client. First, install the official OpenAI Node.js package in your project directory with npm install openai. Next, create a client instance and change two values. The baseURL becomes https://api.59api.com/v1, and the API key becomes the key from your 59API account, referenced through the YOUR_59API_KEY placeholder.
Here is the complete client setup in a form you can paste into a module:
import OpenAI from 'openai';
const client = new OpenAI({ baseURL: 'https://api.59api.com/v1', apiKey: process.env.YOUR_59API_KEY,});
Those two settings are the entire integration. The /v1 suffix matters: it is what keeps the SDK request paths aligned with the relay. Underneath it, the chat endpoint 59API exposes for OpenAI-compatible clients is https://api.59api.com/v1/chat/completions, which is exactly where client.chat.completions.create() sends your payload once the base URL is set.
Keep your key out of source control. The cleanest approach is to load it from an environment variable, as shown above, and set that variable in your shell or deployment platform before starting the process. A second key belongs in a .env file that you exclude from version control, not in a file that gets committed next to your application logic.
One boundary is worth repeating: this configuration covers GPT, DeepSeek and other non-Claude, non-Gemini models. If you later want Claude, use the genuine Claude Code or Claude Desktop client with ANTHROPIC_BASE_URL=https://api.59api.com and ANTHROPIC_AUTH_TOKEN=YOUR_59API_KEY, never the OpenAI SDK or cURL. If you want Gemini, use Gemini CLI with GOOGLE_GEMINI_BASE_URL=https://api.59api.com and GEMINI_API_KEY=YOUR_59API_KEY. The SDK setup above stays focused on the models it actually supports.
Send your first request and confirm the wiring
With the client configured, a first call is short. Ask for a completion using GPT-6.1 Sol, whose model id is gpt-6.1-sol, and print the returned message:
const response = await client.chat.completions.create({ model: 'gpt-6.1-sol', messages: [ { role: 'user', content: 'Explain what an API relay does in two sentences.' } ],});
console.log(response.choices[0].message.content);
Run it. If you get text back, the wiring is correct, and everything else in your project is ordinary OpenAI SDK work. Streaming works the same way through client.chat.completions.create({ stream: true, ... }), and tool calling, function calling and the rest of your existing prompt logic carry over unchanged because the request and response formats stay standard.
If the call fails, the failure is usually one of three things: a missing or mistyped key, a base URL without the /v1 suffix, or a model id that is not available through the OpenAI-compatible path. Check the model id first, because it is the easiest mistake to make when you are copying names from a pricing table. GPT-6.1 Sol is gpt-6.1-sol. GPT-5.6 Sol is gpt-5.6-sol. DeepSeek V4 Flash is deepseek-v4-flash. Use the id exactly as written, including case.
From a development standpoint, this is the part that surprises people. There is no adapter layer to write, no response parser to maintain, and no custom client class to debug at 2 a.m. Your existing code, your existing error handling, your existing tests. You changed the host and the key; the SDK kept doing its job. That predictability is what makes 59API a practical API relay for a working codebase rather than an experiment you have to rebuild later.
What it costs, and how to keep control
Because 59API charges per request by real token usage, the numbers you see in a pricing table are the numbers your bill will follow. Prices are per 1 million tokens, billing is in CNY, and USD figures are shown at ¥7.2 = $1. GPT-6.1 Sol is listed at $0.1847 (¥1.33) for input, $0.9264 (¥6.67) for output and $0.0375 (¥0.27) for cache read. GPT-5.6 Sol is $0.3472 (¥2.5) input, $1.94 (¥14) output and $0.0278 (¥0.2) cache read. DeepSeek V4 Flash is $0.2778 (¥2) input and $1.11 (¥8) output, with cache read at $0.006944 (¥0.05).
A worked example makes that concrete. For GPT-6.1 Sol, 5M input plus 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 GPT-5.6 Sol, 2M input plus 0.5M output tokens without cache costs $1.67 (¥12) on 59API, against an official list price of $18 (about ¥129.6) — again about 9% of list price. Official list prices are reference prices only; 59API is an independent relay and not an official channel.
Control comes from the prepaid balance. Because there is no monthly fee and no expiry, you can top up in small increments, watch consumption for a while, and increase only when real usage justifies it. Invoices are available when you need documentation, and optional monthly or weekly cards exist for teams that prefer a fixed allowance with its own key and its own family of models.
Start with the smallest top-up that lets you test properly, point your SDK at https://api.59api.com/v1, and send one request. If the response comes back, the rest is ordinary development. That is the entire trial: no rewrite, no new abstraction, no new mental model. Try 59API with the model you already use, and see how the numbers feel on your own workload.
Ready to get started?
One key for Claude, GPT and more, billed by real token usage with no monthly fee. Sign up to create your API key; rates for every model are on the pricing page.
Sign up free Pricing