用户名
邮箱
星智超级聚合AI的API调用说明
152.136.175.209 的请求:直接通过,无需API密钥127.0.0.1、::1、::ffff:127.0.0.1)的请求:直接通过,无需API密钥x-api-key 或查询参数 apiKey 提供/api/auth 路由公开访问,无需API密钥https://xingkai.wu.airoe.cn/api
JWT + API密钥
JSON
端点:
/api/auth/login
请求体:
{"email": "user@example.com", "password": "your-password"}
响应:
{"message": "登录成功", "token": "your-jwt-token", "user": {"id": 1, "username": "user", "email": "user@example.com"}}
示例代码:
// 使用Fetch API
fetch('https://xingkai.wu.airoe.cn/api/auth/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: 'user@example.com',
password: 'your-password'
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error));
端点:
/api/auth/register
请求体:
{"username": "user", "email": "user@example.com", "password": "your-password"}
响应:
{"message": "注册成功", "token": "your-jwt-token", "user": {"id": 1, "username": "user", "email": "user@example.com"}}
端点:
/api/chat/models
请求头:
// JWT认证 Authorization: Bearer your-jwt-token // 或API密钥(来自其他域名) x-api-key: your-api-key
响应:
{"models": [{"id": "ant", "name": "蚂蚁Ling2.0-1t", "description": "阿里官方镜像模型,支持多轮对话"}, {"id": "doubao", "name": "字节跳动豆包", "description": "抖音旗下开源Seed语言模型"}, ...]}
端点:
/api/chat
请求头:
Authorization: Bearer your-jwt-token Content-Type: application/json // 或API密钥(来自其他域名) x-api-key: your-api-key
请求体:
{"model": "ant", "question": "你好,如何学习编程?", "options": {}}
响应:
{"message": "聊天请求成功", "model": "ant", "question": "你好,如何学习编程?", "result": "学习编程的步骤...", "token": {"remaining": 999, "used": 1}}
端点:
/api/code/models
请求头:
Authorization: Bearer your-jwt-token // 或API密钥(来自其他域名) x-api-key: your-api-key
响应:
{"models": [{"id": "qwen3-coder", "name": "Qwen3-coder", "description": "阿里官方镜像模型,模态优化版"}, ...]}
端点:
/api/code
请求头:
Authorization: Bearer your-jwt-token Content-Type: application/json // 或API密钥(来自其他域名) x-api-key: your-api-key
请求体:
{"model": "qwen3-coder", "question": "生成一个登录页面的HTML代码", "options": {}}
响应:
{"message": "编程请求成功", "model": "qwen3-coder", "question": "生成一个登录页面的HTML代码", "result": "<!DOCTYPE html>...", "token": {"remaining": 998, "used": 2}}
端点:
/api/image/models
请求头:
Authorization: Bearer your-jwt-token // 或API密钥(来自其他域名) x-api-key: your-api-key
响应:
{"models": [{"id": "flux", "name": "FLUX.1", "description": "先进的图像生成模型"}, ...]}
端点:
/api/image
请求头:
Authorization: Bearer your-jwt-token Content-Type: application/json // 或API密钥(来自其他域名) x-api-key: your-api-key
请求体:
{"model": "flux", "prompt": "一只可爱的橘猫,坐在窗台上,阳光照射", "options": {"size": "1024*1024", "steps": 4}}
响应:
{"message": "图片生成请求成功", "model": "flux", "prompt": "一只可爱的橘猫,坐在窗台上,阳光照射", "result": "https://example.com/image.jpg", "token": {"remaining": 995, "used": 5}}
端点:
/api/token
请求头:
Authorization: Bearer your-jwt-token // 或API密钥(来自其他域名) x-api-key: your-api-key
响应:
{"tokens": [{"id": 1, "token_type": "free", "amount": 1000, "used": 0, "remaining": 1000, "status": "active", "created_at": "2024-01-01T00:00:00Z"}, ...]}
端点:
/api/token/claim-free
请求头:
Authorization: Bearer your-jwt-token Content-Type: application/json // 或API密钥(来自其他域名) x-api-key: your-api-key
响应:
{"message": "领取免费令牌成功", "token": {"id": 1, "token_type": "free", "amount": 1000, "used": 0, "remaining": 1000, "status": "active"}}
端点:
/api/token/purchase
请求头:
Authorization: Bearer your-jwt-token Content-Type: application/json // 或API密钥(来自其他域名) x-api-key: your-api-key
请求体:
{"amount": 100, "token_type": "standard"}
响应:
{"message": "购买令牌成功(暂时免费)", "token": {"id": 2, "token_type": "standard", "amount": 100, "used": 0, "remaining": 100, "status": "active"}}
端点:
/api/token/stats
请求头:
Authorization: Bearer your-jwt-token // 或API密钥(来自其他域名) x-api-key: your-api-key
响应:
{"stats": [{"token_type": "free", "total_amount": 1000, "total_used": 10, "total_remaining": 990}, ...]}
{"message": "API密钥缺失"}
原因:未提供API密钥或密钥无效
{"message": "令牌不足,请购买或领取免费令牌"}
原因:令牌余额不足
{"message": "Internal Server Error"}
原因:服务器内部错误