Quick Start
AI Station is a unified model gateway built on NewAPI. The API is OpenAI-compatible, and additionally supports Anthropic, Gemini, Midjourney, and a range of video/audio plugin tasks.
Endpoint
| Item | Value |
|---|---|
| Base URL | https://test.kailin.com.cn |
| Auth | Authorization: Bearer sk-xxxx (request header) |
| Protocol | HTTPS — REST, SSE streaming, and WebSocket (Realtime) |
Get an API Key
- Sign in to the Console.
- Create a new token on the Tokens / API Keys page. Tokens look like
sk-xxxxxxxx. - Keep your token safe. Never commit it to a repository or expose it in client-side code.
Your First Request
Every endpoint is authenticated with the Authorization: Bearer <your token> header. Chat completion example:
curl https://test.kailin.com.cn/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-token" \
-d '{
"model": "deepseek-v4-1-flash-261017",
"messages": [
{ "role": "user", "content": "Hello, introduce yourself" }
]
}'
https://test.kailin.com.cn/v1/chat/completionsOfficial SDKs
The API is OpenAI-compatible, so the official SDKs work out of the box — just point base_url at this site:
from openai import OpenAI
client = OpenAI(
api_key="sk-your-token",
base_url="https://test.kailin.com.cn/v1",
)
resp = client.chat.completions.create(
model="deepseek-v4-1-flash-261017",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'sk-your-token',
baseURL: 'https://test.kailin.com.cn/v1',
});
const resp = await client.chat.completions.create({
model: 'deepseek-v4-1-flash-261017',
messages: [{ role: 'user', content: 'Hello' }],
});
console.log(resp.choices[0].message.content);
The Anthropic SDK works too (point base_url at this site). See Anthropic Messages.
Streaming
Most text endpoints accept "stream": true and respond with SSE (Server-Sent Events) — text/event-stream, each event prefixed with data: , terminated by data: [DONE]:
data: {"id":"chatcmpl-xxx","choices":[{"delta":{"content":"Hi"},"index":0}]}
data: {"id":"chatcmpl-xxx","choices":[{"delta":{"content":" there"},"index":0}]}
data: [DONE]
Set stream=True (Python) or stream: true (Node.js) in the SDK and it handles the parsing for you.
Error Format
Errors are returned as JSON. type is usually new_api_error (gateway-level) or an upstream error such as invalid_request_error:
{
"error": {
"message": "Invalid token (request id: 2026xxxx)",
"type": "new_api_error",
"code": ""
}
}
| HTTP Status | Meaning | Common Causes |
|---|---|---|
| 401 | Auth failed | Token invalid, deleted, or Authorization header missing |
| 403 | Forbidden | Token lacks model access, group mismatch, or IP restriction |
| 404 | Not found | Wrong model name or task ID |
| 429 | Rate limited | RPM/TPM limit hit — retry later |
| 5xx | Server error | Upstream channel issue — retry or switch models |
The request id in an error message is the key to troubleshooting. Include it when reporting issues.
List Available Models
Call List Models to see which models your token can access:
curl https://test.kailin.com.cn/v1/models \
-H "Authorization: Bearer sk-your-token"
API Overview
| Category | Endpoint | Description |
|---|---|---|
| Models | GET /v1/models | List available models |
| Text | POST /v1/chat/completions | Chat completion (multimodal / tools / reasoning) |
| Text | POST /v1/completions | Legacy text completion |
| Text | POST /v1/responses | Responses API |
| Text | POST /v1/messages | Anthropic format |
| Embeddings | POST /v1/embeddings | Text embeddings |
| Images | POST /v1/images/generations | Image generation |
| Audio | POST /v1/audio/transcriptions etc. | Transcription / translation / TTS |
| Realtime | WS /v1/realtime | Realtime voice conversation |
| Ranking | POST /v1/rerank | Text reranking |
| Safety | POST /v1/moderations | Content moderation |
| Video | POST /v1/video/generations | Video generation task |
| Images | /mj/* | Midjourney proxy |
| Tasks | POST /v1/tasks | Generic plugin tasks (Suno/Kling etc.) |