Skip to content
This page was translated from the Chinese original, which has changed since — it may be out of date. The Chinese version is authoritative. View the Chinese original →
Live

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 ​

  1. Point the base URL at https://hub.lurus.cn/v1.

  2. Include Authorization: Bearer sk-your-api-key in the request header (Get an API Key).

  3. Send requests with any OpenAI SDK — no changes to your business code needed. See SDK support below.

Base URL ​

https://hub.lurus.cn/v1

Authentication ​

Every API request must include your API Key in the Header:

http
Authorization: Bearer sk-your-api-key

More than just API Keys

Beyond Bearer Token, OIDC / OAuth2, PAT, and JWT are also supported. See Authentication in detail.

Available endpoints ​

Get model list

GET/v1/models获取模型列表
GET/v1beta/modelsGemini 格式获取

OpenAI format (Chat)

POST/v1/chat/completions创建聊天对话

OpenAI format (Responses)

POST/v1/responses创建响应 (OpenAI Responses API)
POST/v1/responses/compact压缩对话 (OpenAI Responses API)

Image generation

POST/v1/images/generations生成图像(qwen-image)
POST/v1/images/edits编辑图像(qwen-image-edit)

Video generation

POST/v1/videos创建视频
GET/v1/videos/{task_id}获取视频任务状态
GET/v1/videos/{task_id}/content获取视频内容
POST/kling/v1/videos/text2videoKling 文生视频
GET/kling/v1/videos/text2video/{task_id}获取 Kling 文生视频任务状态
POST/kling/v1/videos/image2videoKling 图生视频
GET/kling/v1/videos/image2video/{task_id}获取 Kling 图生视频任务状态
POST/jimeng/即梦视频生成
POST/v1/video/generations创建视频生成任务
GET/v1/video/generations/{task_id}获取视频生成任务状态

Claude format (Messages)

POST/v1/messagesClaude 聊天

Gemini format

POST/v1beta/models/{model}:generateContentGemini 图片(Nano Banana)
POST/v1/engines/{model}/embeddingsGemini 嵌入(Embeddings)

OpenAI format (Embeddings)

POST/v1/embeddings创建文本嵌入

Text completions (Completions)

POST/v1/completions创建文本补全

OpenAI Audio

POST/v1/audio/transcriptions音频转录
POST/v1/audio/translations音频翻译
POST/v1/audio/speech文本转语音

Rerank

POST/v1/rerank文档重排序

Moderations

POST/v1/moderations内容审核

Realtime

GET/v1/realtime实时 WebSocket 连接

Request format ​

All requests use JSON:

http
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 ​

json
{
  "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 ​

json
{
  "error": {
    "code": "invalid_api_key",
    "message": "Invalid API key provided",
    "type": "authentication_error"
  }
}

Rate limits ​

60RPM (requests/minute)
100,000TPM (tokens/minute)
10Max concurrent requests
Limit typeDefaultDescription
RPM (requests/minute)60Maximum requests per minute
TPM (tokens/minute)100,000Maximum tokens per minute
Concurrent requests10Maximum 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) ​

bash
pip install openai
python
from openai import OpenAI

client = OpenAI(
    base_url="https://hub.lurus.cn/v1",
    api_key="sk-your-api-key"
)

Node.js ​

bash
npm install openai
javascript
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://hub.lurus.cn/v1',
  apiKey: 'sk-your-api-key'
});

Go ​

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 ​

bash
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:

json
{
  "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).


Next steps

Powered by Lurus Technologies