Setup & migration9 min read

OpenAI-compatible API: from first key to first response

Below is a working sequence from registration to the first model reply, and how to set up popular clients. Everything runs through one OpenAI-compatible gateway at kiree.net.

Why a gateway

Official APIs from OpenAI, Anthropic and Google are built for international cards and stable direct access. A developer has to solve three problems at once: how to pay, how to keep network access working, and how not to keep five keys for five different vendors.

A gateway covers all of this: one address https://kiree.net/v1, one key in the sk-… format, and a balance spent on any model — text, image, video, voice. OpenAI SDK compatibility is kept in full: code written for api.openai.com works without changes; only the base_url changes.

What one key gives access to:

The full list with prices is on the Models & prices page.

Step 1. Registration and key

Registration opens the dashboard; create a key in the Tokens section. The order:

One key for all models. Separate keys for video or images are not needed: access is determined by the balance, not the key type.

Step 2. Base URL and compatibility

Replace the address in the client or SDK:

Everything else stays as before: the Authorization: Bearer sk-… header, the request structure, the response format, streaming. The openai libraries (Python, Node.js), LangChain, LlamaIndex, Vercel AI SDK and custom wrappers work with no code changes.

The list of models available to the key is returned by the standard GET /v1/models, which clients also use for the dropdown.

Step 3. First request

curl https://kiree.net/v1/chat/completions \
  -H "Authorization: Bearer $KIREE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Hello! Who are you?"}]}'
from openai import OpenAI

client = OpenAI(
    api_key="sk-…",
    base_url="https://kiree.net/v1",
)

r = client.chat.completions.create(
    model="deepseek-flash",
    messages=[{"role": "user", "content": "Summarize the text into three points: …"}],
    max_tokens=600,
)
print(r.choices[0].message.content)
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.KIREE_KEY,
  baseURL: "https://kiree.net/v1",
});

const res = await client.chat.completions.create({
  model: "claude-sonnet-5",
  messages: [{ role: "user", content: "Write 5 headlines for a landing page" }],
});

If the reply comes back, the core integration is done. Next it makes sense to configure the client to your workflow, so you do not reach for curl every time.

Step 4. Ready-made clients

Almost all popular apps support an “OpenAI-compatible” provider. Four fields are needed.

Check after saving: send a short message on the balance and confirm a reply comes back and the balance is deducted. If the model list is empty, the key is not active or the request is not going to /v1.

Step 5. Images, video and voice

Media requests differ from text ones only in the endpoint. The key is the same.

curl https://kiree.net/v1/images/generations \
  -H "Authorization: Bearer $KIREE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"img-seedream-50-flash-1img","prompt":"a ginger cat walking on grass, morning light","size":"1536x1536"}'

The price is fixed per image; resolution and aspect ratio are set in the request.

curl -X POST https://kiree.net/v1/videos/generations \
  -H "Authorization: Bearer $KIREE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"kling-v3-std-5s","prompt":"a cat walking on grass","aspect_ratio":"16:9"}'

Generation is asynchronous: POST returns a task ID, then you poll GET /v1/videos/{id} until the status is ready, and the file link sits in the response metadata. A clip renders in 30–120 seconds; holding the connection open is pointless.

Per-clip prices are listed on the model pages and in the video prices section; a detailed comparison is in the article on what video generation costs.

Step 6. Balance and limits

The balance has no “text” and “video” split: deductions follow each model’s rate; every catalog entry lists a price per million tokens or per call.

The balance is topped up in the dashboard, and the code is activated there as well.

Three numbers for planning:

Video is an order of magnitude pricier than text: one five-second clip costs as much as 100–200 thousand text tokens. So in interfaces and bots it is best to add a confirmation before expensive calls.

Common mistakes

Forgetting the trailing /v1 in the base_url, pasting a truncated key, or using a model ID that does not match the catalog are the three most frequent causes of 401, 404 and 403 errors.

Key security

A key is money. Three rules: do not commit sk-… to public repositories; do not paste it into client-side JavaScript (otherwise a visitor can see it in Network); issue separate keys per service in production and revoke them on a leak. On the app side it helps to cap max_tokens — a guard against an “endless” reply and a bill running into hundreds of dollars.

Launch checklist

Common questions

The gateway accepts requests over a standard connection.

One key per account. Access is determined by the balance, not the key: the whole catalog is available.

Yes, any client with an “OpenAI-compatible provider” setting works: just set the Base URL and key.

Need a key?

Create a key in a minute; Base URL https://kiree.net/v1, pay only for actual usage, no subscription.

Clients & integrations →