Skip to main content
Want to see how much balance you have left from a script, a program, or another tool? Call one endpoint with your API Key. You don’t need to log in to the console, and the query itself is free. You only need two things:

Check your balance

Replace sk-YOUR-KEY with your own Key and run:
Keep the trailing /. The full URL is https://ruoli.dev/api/usage/token/.

Read the response

Example response (the numbers are illustrative):
Divide any quota number by 500000 to get the amount in CNY:

Balance for unlimited tokens

For an unlimited token, the remaining quota is negative.An unlimited token has no limit of its own. Every call is charged to your account balance, so total_available is just “0 minus usage” and doesn’t show your real balance.
To see your real account balance, give the token one extra permission:
1

Open the token settings

Log in to ruoli.dev, go to the Tokens page, and edit the token you query with.
2

Turn on Allow querying user quota

Turn on Allow querying user quota and save.
3

Query again

Run the command above again and read data.user_quota.total_available. Divide it by 500000 to get your account balance.
This switch only controls whether the query endpoint can see your account balance. It doesn’t change the token’s quota or what it can call.

Show your balance in third-party clients

Many chat clients and balance checkers use OpenAI’s legacy billing endpoints. Set the API URL in the client to https://ruoli.dev and the Key to your token, and the balance usually shows up with no extra setup. These are the two endpoints they call. You can query them yourself too:
These two endpoints only count the token itself. For an unlimited token, use /api/usage/token/ above and turn on Allow querying user quota.

Common errors

The Key was copied incorrectly, or it has been deleted, disabled, or has expired. Check its status on the Tokens page and copy the full string starting with sk- again.
Balance queries must also come from an allowed IP, or they are rejected.
Check the URL: use https and keep the trailing /. The full URL is https://ruoli.dev/api/usage/token/.
Yes, but the endpoint is rate limited. Once every few minutes is enough.