API documentation
BikAI implements the OpenAI API. Any OpenAI-compatible SDK or tool works by changing two settings: the base URL and the API key.
1. Base URL and authentication
Create an API key in the dashboard, then send it as a bearer token:
Base URL: https://api.bikai.bikiran.win/v1
Authorization: Bearer sk-bik-...2. Chat completions
curl https://api.bikai.bikiran.win/v1/chat/completions \
-H "Authorization: Bearer $BIKAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o-mini",
"messages": [{"role": "user", "content": "Write a haiku about Dhaka."}]
}'import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.bikai.bikiran.win/v1", apiKey: process.env.BIKAI_API_KEY });
const stream = await client.chat.completions.create({
model: "anthropic/claude-3.5-sonnet",
messages: [{ role: "user", content: "Explain streaming in one sentence." }],
stream: true,
});
for await (const chunk of stream) process.stdout.write(chunk.choices[0]?.delta?.content ?? "");3. Endpoints
GET /models— models available to your key, with per-token prices in AI Credit.GET /models/{id}— a single model.POST /chat/completions— chat, streaming (SSE), tools / function calling, JSON mode, vision.POST /completions— legacy text completions.
Model ids look like openai/gpt-4o-mini. Set stream_options.include_usage to receive a final usage chunk when streaming. n greater than 1 is not supported.
4. Billing
Each request is charged from your AI Credit for its actual usage on the provider that served it. Model prices on the Models page and in GET /models are approximate, and actual charges are usually at or below them. The exact charge for every request is shown in Usage. Failed requests are not charged; if you disconnect during a stream you are charged only for tokens already generated. Every request appears in Usage.
5. Errors
Errors use the OpenAI format: {"error": {"message", "type", "param", "code"}}.
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request_error | The request body is invalid (missing model, bad JSON, unsupported parameter). |
| 401 | invalid_api_key | Missing, malformed, revoked or expired API key. |
| 402 | insufficient_quota | Your AI Credit is used up, or the key reached its monthly spend limit. |
| 403 | account_suspended | The account is suspended. |
| 404 | model_not_found | The model does not exist, is not available, or is not allowed for this key. |
| 429 | rate_limit_exceeded | Too many requests for this key or account. Retry after the Retry-After header. |
| 502 / 504 | upstream_error / timeout | The model provider failed or timed out. Failed requests are not charged. |