curl --request POST \
--url https://zeus.agentspro.cn/api/auth/api-token \
--header 'Content-Type: application/json' \
--data '{
"email": "user@example.com",
"password": "your-password"
}'
# 1. 获取 token
TOKEN=$(curl -s -X POST https://zeus.agentspro.cn/api/auth/api-token \
-H 'Content-Type: application/json' \
-d '{"email":"user@example.com","password":"xxx"}' | jq -r '.token')
# 2. 调用 Agent
curl -X POST https://zeus-api.agentspro.cn/api/agent/invoke \
-H "Authorization: Bearer $TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"message": "Hello",
"llm_config": {
"baseUrl": "https://api.openai.com/v1",
"apiKey": "sk-...",
"modelName": "gpt-4o"
}
}'
{
"token": "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCIsImtpZCI6Inh4eCJ9...",
"refreshToken": "dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4...",
"user": {
"id": "user_abc123",
"email": "user@example.com",
"name": "Frank"
},
"expires_in": 3600
}
{
"error": "Invalid email or password"
}
认证
获取 API Token
用邮箱密码获取 JWT Token — 供外部调用者直接访问 AI Backend
POST
/
api
/
auth
/
api-token
curl --request POST \
--url https://zeus.agentspro.cn/api/auth/api-token \
--header 'Content-Type: application/json' \
--data '{
"email": "user@example.com",
"password": "your-password"
}'
# 1. 获取 token
TOKEN=$(curl -s -X POST https://zeus.agentspro.cn/api/auth/api-token \
-H 'Content-Type: application/json' \
-d '{"email":"user@example.com","password":"xxx"}' | jq -r '.token')
# 2. 调用 Agent
curl -X POST https://zeus-api.agentspro.cn/api/agent/invoke \
-H "Authorization: Bearer $TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"message": "Hello",
"llm_config": {
"baseUrl": "https://api.openai.com/v1",
"apiKey": "sk-...",
"modelName": "gpt-4o"
}
}'
{
"token": "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCIsImtpZCI6Inh4eCJ9...",
"refreshToken": "dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4...",
"user": {
"id": "user_abc123",
"email": "user@example.com",
"name": "Frank"
},
"expires_in": 3600
}
{
"error": "Invalid email or password"
}
用邮箱密码直接获取 JWT Token,无需走浏览器登录流程。获取的 Token 可以用于直接调用 AI Backend 所有需要认证的 API。
使用场景
- CLI 工具调用 Agent API
- 第三方系统集成
- Postman / cURL 调试
- 自动化脚本
认证流程
此接口由 Next.js Web 端提供(不是 AI Backend),因为 JWT 签发依赖 Better Auth。
string
必填
注册邮箱
string
必填
密码
string
JWT accessToken(有效期 1 小时)。使用方式:
Authorization: Bearer <token>string
Refresh Token(有效期 30 天)。accessToken 过期后,使用
POST /api/auth/refresh 获取新的 accessToken。number
accessToken 有效期(秒):
3600(1 小时)curl --request POST \
--url https://zeus.agentspro.cn/api/auth/api-token \
--header 'Content-Type: application/json' \
--data '{
"email": "user@example.com",
"password": "your-password"
}'
# 1. 获取 token
TOKEN=$(curl -s -X POST https://zeus.agentspro.cn/api/auth/api-token \
-H 'Content-Type: application/json' \
-d '{"email":"user@example.com","password":"xxx"}' | jq -r '.token')
# 2. 调用 Agent
curl -X POST https://zeus-api.agentspro.cn/api/agent/invoke \
-H "Authorization: Bearer $TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"message": "Hello",
"llm_config": {
"baseUrl": "https://api.openai.com/v1",
"apiKey": "sk-...",
"modelName": "gpt-4o"
}
}'
{
"token": "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCIsImtpZCI6Inh4eCJ9...",
"refreshToken": "dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4...",
"user": {
"id": "user_abc123",
"email": "user@example.com",
"name": "Frank"
},
"expires_in": 3600
}
{
"error": "Invalid email or password"
}
⌘I