Get System Token (AccessToken)
Before calling the balance query API, you need to obtain a system token (AccessToken).Go to Account Settings
After logging in, visit the Account Settings page and click on “System Token”.

API Reference
Endpoint Information
| Item | Description |
|---|---|
| Endpoint URL | https://api.laozhang.ai/api/user/self |
| Method | GET |
| Authentication | Authorization Header |
| Response Format | JSON (gzip compressed) |
Request Headers
| Header Name | Required | Description |
|---|---|---|
| Authorization | Yes | System token, directly use the Token string |
| Accept | No | Recommended: application/json |
| Content-Type | No | Recommended: application/json |
Response Fields
Successful response example:| Field Name | Type | Description |
|---|---|---|
| success | Boolean | Whether the request was successful |
| message | String | Error message (null on success) |
| data.quota | Integer | Remaining quota (current available balance) |
| data.used_quota | Integer | Used quota |
| data.request_count | Integer | Total request count |
| data.group | String | User group |
Quota Conversion Formula
Code Examples
- cURL
- cURL Quick Test
- Python
Basic Request (must add
--compressed option):Error Handling
HTTP 401 - Authentication Failed
HTTP 403 - Permission Denied
FAQ
What does the quota field represent?
What does the quota field represent?
The
quota field represents your current remaining balance (available quota). If quota is 0 or near 0, your account balance is insufficient and needs to be recharged.How to calculate remaining USD amount?
How to calculate remaining USD amount?
Use the formula: Remaining USD = quota ÷ 500,000Example:
quota: 24997909 → $49.99 USDcurl command returns garbled output?
curl command returns garbled output?
Cause: API returns gzip compressed content, curl doesn’t auto-decompress.Solution: Add
--compressed option:jq reports Invalid numeric literal error?
jq reports Invalid numeric literal error?
This usually happens because curl didn’t decompress the gzip content. Add
--compressed option to fix it.What is the ModelFixedPrice field for?
What is the ModelFixedPrice field for?
This field returns pricing information for various AI models. If you only care about balance info, you can ignore this field.
How to implement balance alerts?
How to implement balance alerts?
You can write a scheduled script to periodically query the balance, and send alert notifications (email, Slack, etc.) when
quota falls below a threshold.Notes
Security
- Use environment variables for Token
- Don’t commit to public repos
- Rotate Token regularly
Rate Limits
- Set reasonable timeout (10s recommended)
- Avoid too frequent queries
- Recommended interval ≥ 1 minute
Error Handling
- Handle network errors and timeouts
- Handle authentication failures
- Log errors for troubleshooting
Response Format
- API returns gzip compressed content
- curl must add
--compressed - requests library handles automatically

