API referenceBeginnersUpdated
GET/v1/user/balance
Balance Query API
Query your account balance and plan usage with your API key — ideal for your own scripts or monitoring.
Endpoint & Authentication
text
GET https://api.icodeeasy.cc/v1/user/balance
The path without the /v1 prefix, https://api.icodeeasy.cc/user/balance, works as well.
Authenticate with your own API key using any one of these headers:
text
Authorization: Bearer <your API key>
X-Api-Key: <your API key>
x-goog-api-key: <your API key>
Response Fields
| Field | Type | Description |
|---|---|---|
is_active | boolean | Whether the account is enabled |
balance | number | Available balance |
unit | string | Currency for balances and quotas, always CNY (yuan) |
plan_type | string | paygo for pay-as-you-go. Monthly plan values start with monthly_, for example monthly_2, monthly_limit_5, and monthly_gpt_5 |
daily_limit | number | Monthly plan daily quota |
daily_used | number | Monthly plan quota used today |
daily_remaining | number | Quota remaining today on an active monthly plan. 0 without an active plan |
plan_expires_at | string/null | Plan expiry time (ISO 8601), null without a monthly plan |
Examples
curl:
bash
curl https://api.icodeeasy.cc/v1/user/balance \
-H "Authorization: Bearer <your API key>"
Example response:
json
{
"is_active": true,
"balance": 80.28,
"unit": "CNY",
"plan_type": "paygo",
"daily_limit": 0,
"daily_used": 0,
"daily_remaining": 0,
"plan_expires_at": null
}
Python:
python
import requests
resp = requests.get(
"https://api.icodeeasy.cc/v1/user/balance",
headers={"Authorization": "Bearer <your API key>"},
timeout=10,
)
resp.raise_for_status()
data = resp.json()
print(f"Balance: ¥{data['balance']:.2f} ({data['unit']})")
Notes
The query consumes no quota and works with a zero balance. Requests outside monthly plan coverage can draw from the account balance.
HTTP 401 indicates a missing or invalid API key. For network issues, see connection and recovery.