API Documentation
OpenAI-compatible API gateway. Base URL: https://api.zlkpro.tech
Drop-in replacement — point any OpenAI SDK here and start building.
On this page
Quickstart
The API is fully OpenAI-compatible. Point any OpenAI SDK at https://api.zlkpro.tech and use your ZLKPro API key.
curl https://api.zlkpro.tech/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "zlkcombo",
"messages": [
{"role": "user", "content": "Hello!"}
]
}'from openai import OpenAI
client = OpenAI(
base_url="https://api.zlkpro.tech/v1",
api_key="YOUR_API_KEY",
)
response = client.chat.completions.create(
model="zlkcombo",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.zlkpro.tech/v1",
apiKey: "YOUR_API_KEY",
});
const response = await client.chat.completions.create({
model: "zlkcombo",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);Authentication
All requests require a Bearer token in the Authorization header. Generate keys from your dashboard or via the Telegram bot.
# Header format
Authorization: Bearer sk-zlk-xxxxxxxxxxxxxxxxKeys are SHA256-hashed at rest. Never share your key — if compromised, rotate it immediately from the dashboard.
Available Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /v1/chat/completions | Chat completions (OpenAI format) |
| POST | /v1/completions | Text completions (legacy) |
| POST | /v1/embeddings | Text embeddings |
| GET | /v1/models | List available models |
Available Models
Error Codes
| Status | Code | Description |
|---|---|---|
| 400 | bad_request | Malformed request body or parameters |
| 401 | unauthorized | Missing or invalid API key |
| 402 | payment_required | Insufficient balance or expired subscription |
| 403 | forbidden | Key blocked or model not permitted |
| 404 | not_found | Model not found |
| 429 | rate_limited | Rate limit exceeded — slow down or retry |
| 500 | server_error | Internal error — retry with backoff |
| 503 | service_unavailable | Upstream provider temporarily unavailable |
Rate Limits
Rate limits are applied per API key and scale with your plan. All responses include rate-limit headers.
| Plan | Requests / min |
|---|---|
| Loading rate limits… | |
Headers: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
On 429, respect the Retry-After header before retrying.
Streaming
All chat completion endpoints support "stream": true. Responses use Server-Sent Events (SSE) — each chunk is a data: {...} line terminated by a blank line. The stream ends with data: [DONE].
# -N disables buffering so you see chunks in real-time
curl -N https://api.zlkpro.tech/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "zlkcombo",
"stream": true,
"messages": [
{"role": "user", "content": "Count to 5 slowly."}
]
}'from openai import OpenAI
client = OpenAI(
base_url="https://api.zlkpro.tech/v1",
api_key="YOUR_API_KEY",
)
# streaming=True returns an iterator of chunks
stream = client.chat.completions.create(
model="zlkcombo",
stream=True,
messages=[{"role": "user", "content": "Count to 5 slowly."}],
)
for chunk in stream:
delta = chunk.choices[0].delta.content or ""
print(delta, end="", flush=True)
print() # newlineimport OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.zlkpro.tech/v1",
apiKey: "YOUR_API_KEY",
});
const stream = await client.chat.completions.create({
model: "zlkcombo",
stream: true,
messages: [{ role: "user", content: "Count to 5 slowly." }],
});
for await (const chunk of stream) {
const delta = chunk.choices[0]?.delta?.content ?? "";
process.stdout.write(delta);
}
console.log();Tip: When streaming, the usage field is included in the final chunk (with stream_options: { include_usage: true }).
Webhooks & Bot
Manage your account and API keys directly from Telegram. The bot @zlkprobot runs in webhook mode and responds to the following commands:
| Command | Description |
|---|---|
/start | Link your Telegram account to ZLKPro and get started |
/key | Generate a new API key or list your existing keys |
/usage | Show current billing cycle usage, spend, and token counts |
/models | List all available model IDs and their families |
The bot webhook is served at /api/bot/webhook — no long-polling, no extra infrastructure needed.
SDK Compatibility
ZLKPro implements the OpenAI API spec. Any SDK that lets you override the base_url works out of the box.
| SDK | Language | Compatibility | Notes |
|---|---|---|---|
| openai | Python / Node | Full | Set base_url — zero code changes |
| langchain-openai | Python / Node | Full | ChatOpenAI(openai_api_base="...") |
| llama-index | Python | Full | set api_base on LLM or Settings |
| autogen | Python | Full | Set base_url in config_list |
| curl / httpie | CLI | Full | Raw HTTP — no SDK needed |
zlkpro docs · last updated 2026-07