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?
Base URL
Point the client at
https://llmwithcrypto.com/api/v1instead of OpenAI. Both the Python and the Node.js SDK accept abase_url/baseURLoption, and read theOPENAI_BASE_URLenvironment variable.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.Model name
Replace
gpt-…with one of our ids, for exampledeepseek-v4-pro.GET https://llmwithcrypto.com/api/v1/modelslists every id your key can call.
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)
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.
| Job | Model to try | API id | Context | Price (in / out) |
|---|---|---|---|---|
| General chat, reasoning and code | DeepSeek V4 Pro | deepseek-v4-pro | 1M | $1.254 / $3.762 |
| High-volume, low-cost calls | DeepSeek V4.1 Flash | deepseek-v4.1-flash | 1M | $0.285 / $1.14 |
| Reasoning and tool use | gpt-oss-120b | gpt-oss-120b | 128K | $0.142 / $0.57 |
| Small, fast reasoning | gpt-oss-20b | gpt-oss-20b | 128K | $0.033 / $0.161 |
| Coding and agents | GLM-4.7 | glm-4.7 | 200K | $0.57 / $2.09 |
| Multilingual chat and long documents | Qwen3 235B A22B Instruct | qwen3-235b-a22b-instruct-2507 | 256K | $0.161 / $0.57 |
| Step-by-step reasoning | DeepSeek R1 | deepseek-r1 | 160K | $0.57 / $2.208 |
| A European model | Mistral Large 3 | mistral-large-3 | 256K | $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)
- OpenRouter rankings openrouter.ai/rankings — OpenRouter (read 2026-10-23)