Server address: https://txapi-usa.lbai.ai
✅1. Create a user on the Little Beauty server
Interface description
Enabling Little Beauty AI capabilities for users. Create a unique user ID for the user, and give it access to memory space, file space, and AI partners. Returns the user token valid for a long time.
Interface address
GET /ai-api/v1/apiService/addUser?identifier=
Request Head
Authorization: Bearer CPN-XXXXXXXXXXXXXXXXXXXXXX (enterprise token)
Request parameters
Sample request
curl /ai-api/v1/apiService/addUser?identifier=xxx \
-H "Content-Type: application/json" \
-H "Authorization: xxxxx"
Reply to sample
{
"data": {
"token": "xxxxxx" //returns a token to the user that needs to be added to the header for 15 days when the user requests the API
"userId": "13000998888932" //Little Beauty platform user identity
},
"errorCode": 0,
"message": null,
"success": true
}
✅2. Get/update the user token
Interface description
Calling this interface generates a new token. exe. The user's old token will expire;
Interface address
GET /ai-api/v1/apiService/refreshToken?userId=
Request Head
Authorization: Bearer CPN-XXXXXXXXXXXXXXXXXXXXXX (enterprise token)
Request parameters
Sample request
curl /ai-api/v1/apiService/refreshToken?userId= \
-H "Content-Type: application/json" \
-H "Authorization: xxxxx"
Reply to sample
{
"data": {
"token": "xxxxxx" //The token returned to the user, which needs to be added to the header when the user requests the API
},
"errorCode": 0,
"message": "success",
"success": true
}
✅3. The user logs off
Interface description
Calling this interface destroys the user token. exe.
Interface address
GET /ai-api/v1/apiService/logout
Request Head
Authorization: Bearer CPN-XXXXXXXXXXXXXXXXXXXXXX (enterprise token)
Request parameters
Sample request
curl /ai-api/v1/apiService/refreshToken?userId= \
-H "Authorization: xxxxx"
Reply to sample
{
"data": null,
"errorCode": 0,
"message": "success",
"success": true
}
✅4. Enterprise query balance interface
Interface description
Check account balance
Interface address
GET /ai-api/v1/account/banlance
Request Head
Authorization: Bearer CPN-XXXXXXXXXXXXXXXXXXXXXX (enterprise token)
Returns the result
{
"data": {
"balance": 9830602 //Balance
},
"errorCode": 0,
"line": null,
"message": "success",
"success": true
}
5. Fee enquiries
✅5.1 user fee enquiry
Look up the total chip consumption of the user. Note that some tasks are handled asynchronously and are time-consuming, resulting in delayed consumption.
Query the user's total cost or the user's group's total cost (at least one of the userId and groupId is not empty)
Interface description
Look up chip consumption for a single user.
Interface address
GET /ai-api/v1/costByUser
Request Head
Authorization: Bearer CPN-XXXXXXXXXXXXXXXXXXXXXX (enterprise token)
Request parameters
Sample request
curl /ai-api/v1/costByUser?userId=11&groupId= \
-H "Content-Type: application/json" \
-H "Authorization: xxxxx"
Response parameters
Reply to sample
{
"data": {
"usage": 3332
},
"errorCode": 0,
"message": "success",
"success": true
}
✅5.2 Inquiry of details of user fees
Interface description
Look up chip consumption for a single user. Reverse by time (at least one of userId and groupId is not empty)
Interface address
GET /ai-api/v1/costListByUser
Request Head
Authorization: Bearer CPN-XXXXXXXXXXXXXXXXXXXXXX (enterprise token)
Request parameters
Sample request
curl /ai-api/v1/costListByUser?userId= \
-H "Content-Type: application/json" \
-H "Authorization: xxxxx"
Response parameters
Reply to sample
{
"data": {
"isMore": 0,
"items": [
{
"id":"9999",
"costUsage":8888,
"consumeTime":3239923,
"consumeName":"AI partner dialogue"
},{
"id":"9999",
"costUsage":8888,
"consumeTime":3239923,
"consumeName":"AI partner dialogue"
}
],
"pageNum": 1,
"pageSize": 10,
"startIndex": 0,
"totalCount": 2,
"totalPage": 1
},
"errorCode": 0,
"message": "success",
"success": true
}