OpenAI SDK: how to switch base_url to kiree.net
Part of the Kiree.net how-to series: short, with commands and checks you can repeat.
If your app already works with the OpenAI SDK, moving to Kiree.net takes one line. Only the address and key change; the request and response structure stays the same.
Python
from openai import OpenAI
client = OpenAI(
base_url="https://kiree.net/v1",
api_key="sk-...",
)
resp = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)Node.js
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://kiree.net/v1",
apiKey: "sk-...",
});
const resp = await client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello" }],
});
console.log(resp.choices[0].message.content);What to keep in mind
- One key for all models: no separate key is needed for Claude or DeepSeek.
- You are billed for actual token usage; each model has its own price, listed per 1M tokens.
- Streaming (
stream: true) is supported the same way as in the original SDK. - When you rotate a key, the old one stops working on all clients at once.
If a request returns 403 with the text insufficient quota, this is not a code error — the balance has run out. Top-up is done in packages through the Top-up page.
Need a key?
Create a key in a minute; Base URL https://kiree.net/v1, pay only for actual usage, no subscription.
Setup & migration
OpenAI-compatible API: from first key to first response
Key, Base URL https://kiree.net/v1, first requests via curl and Python, and how to set up Cherry Studio, NextChat and other clients.
Setup & migration
Connecting Kiree.net to Cursor in two minutes
Set Cursor to an OpenAI-compatible gateway: Base URL, key, model selection, a chat test and notes on working with code.
Pricing & budget
How to plan your API budget: tokens, video and voice with no surprises
Formulas for token, video and voice costs, three typical scenarios with numbers, how to choose a top-up package, and ways to cut spending by 2–3×.