59API

← Back to all guides

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

API · EN · 2026-11-17

Why SDK configuration keeps slowing you down

Most developers can write a chat completion. What slows them down is the plumbing: several base URLs, a key belonging to the wrong provider, an endpoint that returns an empty response, a dashboard asking for a subscription you never wanted. Your application code is ready, but the connection is not, and every hour spent on configuration is an hour you are not shipping.

A clean setup does not have to be complicated. With 59API, an independent third-party AI API relay, you get one account, one API key and one API host: https://api.59api.com. That host serves Claude, GPT, Gemini, DeepSeek and other models, so you are not managing a separate provider relationship for every experiment. The OpenAI-compatible path is designed to slot into code you already have, and the exact settings are short enough to paste without reading a guide twice.

In this walkthrough we will connect the OpenAI Node.js SDK to 59API, send a first request, and look at what a request actually costs. The example model is GPT-6.1 Sol, a practical starting point for a developer who wants a capable model without guessing at billing. The goal is simple: move from an empty project to a working call quickly, then keep the same configuration as your app grows.

One key, one host, and a prepaid balance

Here is what 59API is in practical terms. It is an independent third-party AI API relay, not an official channel of any model vendor, and it runs on a simple model: you top up a balance, then requests are charged per request based on real token usage. There is no monthly fee, and your balance never expires. Monthly and weekly cards are optional, so a small side project does not force a long commitment and a busy month does not require renegotiating anything.

Top-ups are available at ¥10, ¥50, ¥100, ¥200, ¥500 and ¥1000, paid by WeChat Pay or bank card, and invoices are available. Pricing is listed per 1 million tokens and billed in CNY, with USD figures shown at ¥7.2 = $1. That makes the numbers easy to reason about while you are budgeting. For GPT-6.1 Sol, the rate is $0.1847 (¥1.33) for input, $0.9264 (¥6.67) for output and $0.0375 (¥0.27) for cache read per 1 million tokens.

Because billing follows actual token usage, you can start with a small balance, watch your first few requests, and top up again when you are ready. Nothing expires while you are learning. The key point for setup is that this single key is what you pass to the SDK, and the single host is what you point the client at. Everything else is a model id and a prompt.

Install the SDK and set the exact client settings

Install the OpenAI Node.js package in your project, then create the client with three values: the API key, the base URL and the model id. For 59API the settings are exact. The base_url is https://api.59api.com/v1, and the chat endpoint is https://api.59api.com/v1/chat/completions. The API key is the one issued to your 59API account, referenced here as YOUR_59API_KEY.

A minimal client looks like this:

npm install openai

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 sentence.' }]

});

Keep the key in an environment variable rather than in source control. The same base_url and endpoint work for Codex, cURL and OpenAI-compatible clients such as Cursor, Cherry Studio, Cline and OpenCode, which is useful because you can prototype in one tool and ship from another without rewriting configuration. One boundary matters: this OpenAI-compatible path covers GPT, DeepSeek and other non-Claude, non-Gemini models only. 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 through Gemini CLI, so neither belongs in this SDK example.

Send your first request and confirm the model id

With the client configured, the first request is deliberately boring: one user message, one model id, one response. That is the point. If the call succeeds, your base URL, endpoint, key and model id are all correct, and everything you build on top inherits a working foundation. If it fails, the usual suspects are a missing /v1 on the base URL, a key copied with extra whitespace, or a model id that does not match the listing.

GPT-6.1 Sol uses the model id gpt-6.1-sol. Its rates are $0.1847 (¥1.33) per 1 million input tokens, $0.9264 (¥6.67) per 1 million output tokens and $0.0375 (¥0.27) per 1 million cache read tokens, against an official list price reference of $2 / $10. If you want a different family for routine work, DeepSeek V4 Flash is available as deepseek-v4-flash at $0.2778 (¥2) input, $1.11 (¥8) output and $0.006944 (¥0.05) cache read per 1 million tokens.

From a code perspective, switching models is a one-line change. From a budgeting perspective, it is worth knowing which model handles which task, since output tokens are the expensive side of most exchanges. A practical habit is to run a small script against the endpoint, log the token counts returned with the response, and compare them with your expectations. That gives you a real usage baseline instead of a guess, and it is exactly the feedback loop that makes pay-as-you-go pricing comfortable.

What a request costs and how to keep control

Per-request billing is easy to underestimate when you only think in monthly subscriptions. Here is a concrete example: GPT-6.1 Sol processing 5M input tokens and 1M output tokens without cache costs $1.85 (¥13.32) on 59API. At the official list price of $20 (about ¥144), 59API is about 9% of list price. That is a reference comparison only, but it makes the mechanics concrete: the bill follows tokens, so the way you write prompts and shape context directly affects cost.

Cache reads are where careful engineering pays off. At $0.0375 (¥0.27) per 1 million tokens for GPT-6.1 Sol, cached context costs far less than fresh input, which matters most in agent loops and repeated document questions. Cards exist if your usage pattern suits them. A G-PRO Starter card for GPT, valid 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). 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.

Finally, keep the client boundaries clear in your own tooling. The OpenAI Node.js SDK, Codex, cURL and OpenAI-compatible clients handle GPT, DeepSeek and other non-Claude, non-Gemini models through https://api.59api.com/v1 and https://api.59api.com/v1/chat/completions. Claude models belong exclusively in the genuine Claude Code or Claude Desktop client (Claude Code 2.1.285 or newer) with ANTHROPIC_BASE_URL=https://api.59api.com and ANTHROPIC_AUTH_TOKEN=YOUR_59API_KEY. Gemini models use Google's native protocol with Gemini CLI, setting GOOGLE_GEMINI_BASE_URL=https://api.59api.com and GEMINI_API_KEY=YOUR_59API_KEY, and they are not available on the OpenAI-compatible path. One account, one key, one host, and a prepaid balance that never expires: that is 59API, and you can test it with a single API call today.

Docs

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