API Reference — Gateway Endpoint Manual
Endpoint docs · error codes · request examples
The Lurus API is fully compatible with the OpenAI API format, so you can call it directly with any OpenAI-compatible SDK or tool.
Why use the Lurus API
OpenAI compatible
All endpoint paths and semantics match OpenAI; swap in the base_url with zero SDK changes
Complete error codes
Every error carries code + message + a suggested action, making automated handling easy
Multiple auth methods
Bearer Token / PAT / JWT, covering everything from scripts to enterprise SSO
Model routing and retries
Automatically routes to upstream channels by model name and fails over to backups
Get started in three steps
Point the base URL at
https://hub.lurus.cn/v1.Include
Authorization: Bearer sk-your-api-keyin the request header (Get an API Key).Send requests with any OpenAI SDK — no changes to your business code needed. See SDK support below.
Base URL
https://hub.lurus.cn/v1Authentication
Every API request must include your API Key in the Header:
Authorization: Bearer sk-your-api-keyMore than just API Keys
Available endpoints
Get model list
/v1/models获取模型列表/v1beta/modelsGemini 格式获取OpenAI format (Chat)
/v1/chat/completions创建聊天对话OpenAI format (Responses)
/v1/responses创建响应 (OpenAI Responses API)/v1/responses/compact压缩对话 (OpenAI Responses API)Image generation
/v1/images/generations生成图像(qwen-image)/v1/images/edits编辑图像(qwen-image-edit)Video generation
/v1/videos创建视频 /v1/videos/{task_id}获取视频任务状态 /v1/videos/{task_id}/content获取视频内容/kling/v1/videos/text2videoKling 文生视频/kling/v1/videos/text2video/{task_id}获取 Kling 文生视频任务状态/kling/v1/videos/image2videoKling 图生视频/kling/v1/videos/image2video/{task_id}获取 Kling 图生视频任务状态/jimeng/即梦视频生成/v1/video/generations创建视频生成任务/v1/video/generations/{task_id}获取视频生成任务状态Claude format (Messages)
/v1/messagesClaude 聊天Gemini format
/v1beta/models/{model}:generateContentGemini 图片(Nano Banana)/v1/engines/{model}/embeddingsGemini 嵌入(Embeddings)OpenAI format (Embeddings)
/v1/embeddings创建文本嵌入Text completions (Completions)
/v1/completions创建文本补全OpenAI Audio
/v1/audio/transcriptions音频转录/v1/audio/translations音频翻译/v1/audio/speech文本转语音Rerank
/v1/rerank文档重排序Moderations
/v1/moderations内容审核Realtime
/v1/realtime实时 WebSocket 连接Request format
All requests use JSON:
POST /v1/chat/completions HTTP/1.1
Host: hub.lurus.cn
Content-Type: application/json
Authorization: Bearer sk-your-api-key
{
"model": "deepseek-chat",
"messages": [
{"role": "user", "content": "Hello!"}
]
}Response format
For the type of each field and whether it is required, see Data structures / Schema (auto-synced from the OpenAPI spec and consistent with the gateway implementation).
Successful response
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1677858242,
"model": "deepseek-chat",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 12,
"total_tokens": 22
}
}Error response
{
"error": {
"code": "invalid_api_key",
"message": "Invalid API key provided",
"type": "authentication_error"
}
}Rate limits
| Limit type | Default | Description |
|---|---|---|
| RPM (requests/minute) | 60 | Maximum requests per minute |
| TPM (tokens/minute) | 100,000 | Maximum tokens per minute |
| Concurrent requests | 10 | Maximum requests in flight at once |
Exceeding a limit returns a 429 Too Many Requests error; for how to handle it, see Error handling.
SDK support
Python (official OpenAI SDK)
pip install openaifrom openai import OpenAI
client = OpenAI(
base_url="https://hub.lurus.cn/v1",
api_key="sk-your-api-key"
)Node.js
npm install openaiimport OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://hub.lurus.cn/v1',
apiKey: 'sk-your-api-key'
});Go
import "github.com/sashabaranov/go-openai"
config := openai.DefaultConfig("sk-your-api-key")
config.BaseURL = "https://hub.lurus.cn/v1"
client := openai.NewClientWithConfig(config)cURL
curl https://hub.lurus.cn/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-api-key" \
-d '{"model": "deepseek-chat", "messages": [{"role": "user", "content": "Hi"}]}'Special features
Gateway-enhanced capabilities
Streaming responses
Set stream: true to enable Server-Sent Events and return tokens incrementally
Model routing
Automatically routes to the matching upstream channel by model name, with no need to worry about the underlying configuration
Automatic retries
On a failed request, automatically switches to a backup channel (if multiple are configured)
Streaming responses
Set stream: true to enable Server-Sent Events streaming responses:
{
"model": "deepseek-chat",
"messages": [...],
"stream": true
}For the full streaming data format and token-by-token handling, see Chat Completions — Streaming responses.
Model routing
Automatically routes to the matching upstream channel by model name, with no need to worry about the underlying configuration.
Automatic retries
On a failed request, automatically switches to a backup channel (if multiple are configured).