Balance queries
Use the site that issued the key. Set the environment variables below to your own keys. Both requests take no parameters and work with a zero balance.
Check your wallet balance
Generate a wallet query key in Wallet & Billing. Regenerating or revoking it immediately invalidates the old key.
curl -H "Authorization: Bearer $WALLET_QUERY_KEY" https://shanghaido.com/v1/balance
{"balance":"12.50","currency":"CNY"}
balance is the site wallet balance as a decimal string. currency is the currency or unit shown in your wallet.
Check one API key’s remaining allowance
Send the request with the model API key you want to check. data.balance is its remaining allowance and data.currency is its unit.
curl -H "Authorization: Bearer $MODEL_API_KEY" https://shanghaido.com/api/usage/token/
{"code":true,"message":"ok","data":{"balance":"3.25","currency":"CNY","unlimited_quota":false}}
If data.unlimited_quota is true, data.balance is null. The key has no separate spending cap.
For 401, check the site, key type and authorization header. For 429, try again later. Contact support on the site for help.