Getting started with an OpenAI-compatible API: base URL, model name and key handling
This article was prepared by the SiberAI team.
An OpenAI-compatible client speaks a familiar request shape. It does not decide where the request goes or which model runs. Those two choices—and how you store the key—decide whether your first call hits SiberAI correctly.
This guide follows the public SiberAI documentation. No live call was made while writing it.
Separate base URL from model identity
SiberAI’s API root is https://siberai.net/api/siberai/v1. The model id is fixed as siber-v3. Putting the right model into a client that still points at another provider’s default host sends traffic to the wrong place. Pointing at SiberAI with the wrong model id typically surfaces as a not-found style error for the model.
Read both values from configuration or environment variables. Do not hard-code secrets. The official first API request walkthrough shows reading the key from the environment and setting the SiberAI base URL explicitly.
Key format, lifetime and scopes
Requests use a customer key with the sai_ide_ prefix in an HTTP Bearer header, with Content-Type: application/json. New customer keys are valid for 30 days. Each call checks user status, auth version, workspace access, key scope and revocation. Model generation needs the chat:write scope; listing models needs models:read. A browser account cookie is not a substitute for the API Bearer key.
When you rotate: create a new key, update the client, verify a small request, then revoke the old key in the panel. The full value appears only at creation time—store it in a secret store or the IDE’s secure key area, never in a public repo. See API authentication.
Minimal working shape
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["SIBERAI_API_KEY"],
base_url="https://siberai.net/api/siberai/v1",
)
answer = client.chat.completions.create(
model="siber-v3",
messages=[{"role": "user", "content": "Suggest a test plan for this change."}],
max_tokens=1024,
)
print(answer.choices[0].message.content)
After a successful call, inspect request status and token usage in the panel. Do not paste the key into an error ticket.
Read errors by class, not by vibes
Invalid structure is not the same as an empty balance. The error reference asks you to read the HTTP status together with error.code. Rough groups: 401 for key/lifetime/user state; 402 for balance or usage reconciliation; 404 for model id; 415 for wrong content type; 429 for rate or concurrency; 502/503/504 for service or connection issues. Retrying the same invalid body does not fix a bad key. After an interrupted call, check the usage record first—this API does not promise fully idempotent automatic production retries.
First-run checklist
- Base URL is the SiberAI
/api/siberai/v1path. - Model is exactly
siber-v3. - Key is
sai_ide_-prefixed, unexpired, correct scope, not revoked. - No cookie-based API auth.
- Staging and production keys are separated.
Product overview: SiberAI. Getting the first request right is mostly configuration hygiene, not prompt cleverness.
A short staging smoke test with a non-secret prompt is enough to validate base URL, model id and key scope before any production traffic. Keep that smoke test’s key separate from production so a mistake stays cheap.
Yorumlar
Yorum Gönder