API 文档
Base URL: https://lumitokenhub.nat200.top
快速开始
1
获取 API Key
Sign up for an account and generate an API key from the dashboard.
2
设置 API Key
Set your API key as an environment variable or pass it in the Authorization header.
3
发起请求
Send a POST request to the chat completions endpoint with your model and messages.
代码示例
cURL
curl https://lumitokenhub.nat200.top/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <你的API Key>" \
-d '{
"model": "auto",
"messages": [{"role": "user", "content": "Hello!"}]
}'Python
import requests
api_key = "lum-xxxx...(控制台获取)"
url = "https://lumitokenhub.nat200.top/v1/chat/completions"
resp = requests.post(
url,
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
},
json={
"model": "auto",
"messages": [
{"role": "user",
"content": "Hello!"}
],
},
)
print(resp.json())JavaScript
const apiKey = "lum-xxxx...(控制台获取)";
const resp = await fetch(
"https://lumitokenhub.nat200.top/v1/chat/completions",
{
method: "POST",
headers: {
"Authorization": `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "auto",
messages: [
{ role: "user",
content: "Hello!" }
],
}),
}
);
const data = await resp.json();可用模型
| Model ID | 文档 | Context | Pricing |
|---|---|---|---|
| deepseek | DeepSeek | — | $0.0733/1K |
| local | 本地模型 | 64K | $0.0081/1K |
| xiaomi | 小米 MiMo | — | $0.0098/1K |
| chaosuan | 超算中心 | — | $0.0059/1K |
错误代码
| 代码 | 消息 | 说明 |
|---|---|---|
| 400 | Bad Request | Invalid request parameters |
| 401 | Unauthorized | Invalid or expired API key |
| 402 | Insufficient Balance | Account balance too low |
| 429 | Rate Limited | Too many requests per minute |
| 500 | Server Error | Internal server error, try again |
| 503 | Model Unavailable | Model temporarily unavailable |