No KYC — no ID, no selfie, no documents. Pay in crypto: BTC, USDT, USDC, ETH, SOL, LTC
Language: English
Get an API key

Guide · OpenAI-compatible API · prices as of 23 October 2026

Switch the OpenAI SDK to open-weight models in three changes

If your code already calls OpenAI through its SDK, moving a workload to an open-weight model is a configuration change, not a rewrite. This guide shows the three values to change, which of our models to try for which job, and what behaves differently.

Last updated: · 4 min read

Quick answer

How do I use the OpenAI SDK with open-weight models?

Change three values: the base URL, the API key and the model name. With LLMwithCrypto, set the base URL to https://llmwithcrypto.com/api/v1, use a key from your dashboard and pick a model id such as deepseek-v4-pro or gpt-oss-120b. As of 23 October 2026, DeepSeek V4 Pro costs $1.254 per million input tokens. The rest of your code stays the same.

What are the three changes?

  1. Base URL

    Point the client at https://llmwithcrypto.com/api/v1 instead of OpenAI. Both the Python and the Node.js SDK accept a base_url / baseURL option, and read the OPENAI_BASE_URL environment variable.

  2. API key

    Create a key in your dashboard and keep it in LLMWITHCRYPTO_API_KEY. Pass your API key as a Bearer token in the Authorization header, as the OpenAI SDK does.

  3. Model name

    Replace gpt-… with one of our ids, for example deepseek-v4-pro. GET https://llmwithcrypto.com/api/v1/models lists every id your key can call.

switch.py
import os

from openai import OpenAI

client = OpenAI(
    base_url="https://llmwithcrypto.com/api/v1",
    api_key=os.environ["LLMWITHCRYPTO_API_KEY"],
)

reply = client.chat.completions.create(
    model="deepseek-v4-pro",
    messages=[{"role": "user", "content": "Summarise this changelog in three bullet points: ..."}],
)
print(reply.choices[0].message.content)
print(reply.usage)
switch.mjs
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://llmwithcrypto.com/api/v1',
  apiKey: process.env.LLMWITHCRYPTO_API_KEY,
});

const reply = await client.chat.completions.create({
  model: 'gpt-oss-120b',
  messages: [{ role: 'user', content: 'Write a regex that matches ISO 8601 dates.' }],
});
console.log(reply.choices[0].message.content);

Which open model should I try for which job?

A starting point by job, from what each model's maker built it for. Test on your own prompts before you switch: no model is a drop-in copy of another. Prices per 1M input / output tokens, as of 23 October 2026.

JobModel to tryAPI idContextPrice (in / out)
General chat, reasoning and codeDeepSeek V4 Prodeepseek-v4-pro1M$1.254 / $3.762
High-volume, low-cost callsDeepSeek V4.1 Flashdeepseek-v4.1-flash1M$0.285 / $1.14
Reasoning and tool usegpt-oss-120bgpt-oss-120b128K$0.142 / $0.57
Small, fast reasoninggpt-oss-20bgpt-oss-20b128K$0.033 / $0.161
Coding and agentsGLM-4.7glm-4.7200K$0.57 / $2.09
Multilingual chat and long documentsQwen3 235B A22B Instructqwen3-235b-a22b-instruct-2507256K$0.161 / $0.57
Step-by-step reasoningDeepSeek R1deepseek-r1160K$0.57 / $2.208
A European modelMistral Large 3mistral-large-3256K$0.475 / $1.424

Prices checked on

The models page lists all twelve, with their licences.

What behaves differently after the switch?

  • Token counts. You pay per token from your balance: input and output tokens are counted by the model’s own tokenizer and charged at that model’s price per 1M tokens. A call that ends in an error costs nothing. Each model has its own tokenizer, so the same text can count as a different number of tokens than on OpenAI.
  • Features per model. Streaming works on every model; tool calling and JSON output follow what each model itself supports. Check the models page before you rely on tool calling or JSON output.
  • Output style and quality. Different models answer differently. Run your own test prompts, especially for structured output.
  • Closed-model features. OpenAI-only endpoints and models are not available here. We do not sell access to GPT, Claude, Gemini or Grok: their makers forbid reselling API access without their approval, and we do not have it.

Why do teams move workloads to open models?

Mostly for price and control. Open-weight models are served by many hosts, and the median price of DeepSeek V4 Pro across 7 hosts was $1.32 per million input tokens on 23 October 2026. Usage follows: in the week to 21 October 2026, DeepSeek V4.1 Flash was the most-used model on OpenRouter's public rankings.

With LLMwithCrypto you can also pay without a card: BTC, USDT, USDC, ETH, SOL, LTC, from a $25 top-up, with no KYC.

Switching from OpenAI: common questions

Does streaming still work?

Yes, with stream: true, as with OpenAI. The streaming docs show the event format.

Do I need a new SDK?

No. The official OpenAI SDKs work; only the base URL, the key and the model name change. LangChain works the same way, see the LangChain docs.

Can I keep GPT for some calls?

Yes, by keeping a second client pointed at OpenAI with your OpenAI key. We do not sell GPT models.

How do I check what a call cost?

Each response carries a usage object with input and output tokens; the dashboard shows the cost of every call, and GET https://llmwithcrypto.com/api/v1/credits returns what is left.

Sources (1)
  1. OpenRouter rankings openrouter.ai/rankings — OpenRouter (read 2026-10-23)

DeepSeek V4 Pro from $1.254 per 1M input tokens · no KYC

Get an API key