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. Get 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. Call 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"
}
Auth
Get API Token
Obtain a JWT Token using email and password — for external callers to directly access the 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. Get 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. Call 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"
}
Obtain a JWT Token directly using email and password, without going through the browser login flow. The token can be used to call any authenticated API on the AI Backend.
Use Cases
- CLI tools calling the Agent API
- Third-party system integrations
- Postman / cURL debugging
- Automation scripts
Authentication Flow
This endpoint is served by the Next.js web layer (not the AI Backend), because JWT issuance relies on Better Auth.
Refresh token (valid for 30 days). Use with
POST /api/auth/refresh to obtain a new access token when it expires.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. Get 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. Call 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"
}