Skip to content

API Token Quota Exhausted: Signs, Check and Top Up

Updated · TokenomixAI

An API token quota exhausted key reports status exhausted on the quota endpoint and remainingTokens near zero, and requests start failing. Check the balance with a GET request to the quota endpoint, then top up on the website. Your OpenCode or Claude Code config stays as it is, because new tokens are added to the quota you already use.

Quota is counted in tokens with no time-based reset, so watch the quota endpoint and add tokens when it says exhausted; a top-up never asks you to edit OpenCode or Claude Code config.

Signs your API token quota is exhausted

Quota on TokenomixAI is counted in tokens, not time windows. There is no reset every 5 hours: the key keeps working while tokens remain and before it expires. Once the tokens run out, requests stop being served until quota is added.

The symptoms show up in the middle of a coding agent session. OpenCode or Claude Code stops finishing tasks, a repeated command gives the same result, and restarting the terminal changes nothing. Before you blame the config, call the quota endpoint: the JSON response tells you whether the problem is remaining tokens, expiry, or something else.

Field in the quota responseWhat it means when quota runs out
statusexhausted means the tokens are gone, not just running low
remainingTokens0 or close to it: what you can still spend right now
usagePercenthow much of the recorded ceiling the key has already used
lowtrue at 10 percent or less, the early warning before zero
expiresAtwhen the key stops working, separate from running out of tokens

How to check remaining tokens with the quota endpoint

The quota endpoint takes a GET request with an Authorization header carrying your API key. Run it from the same terminal where you normally call the API.

curl https://api.tokenomixai.com/v1/quota -H "Authorization: Bearer sk-tkx-..."

Read the response in order: status first, then remainingTokens, then expiresAt. If status is active and remainingTokens is positive, your problem is not quota. If status is exhausted, no tool setting will help until tokens are added.

  • status: active means the key still works, exhausted means the tokens are gone
  • remainingTokens: the current balance, the number you base a top-up decision on
  • maxTokens: the quota ceiling recorded for that key
  • usagePercent: usage relative to maxTokens
  • expiresAt: when the key expires even if tokens remain
  • low: true at 10 percent or less, handy as an early warning trigger

If your own script drives the API, call the quota endpoint before a long batch starts. One request before the job avoids a job that dies halfway through on an empty balance. The low field works as a warning trigger so you do not have to compute the threshold yourself.

Quota exhausted or rate limited?

These two get mixed up, and the result is a top-up that fixes nothing. Quota is how many tokens are left; a rate limit is how fast you may send requests.

TokenomixAI allows 600 requests per minute per account, shared by all keys on that account. Above that, the API returns 429 with a Retry-After header. The token balance can still be large, so adding quota does not speed anything up in this case.

  • 429 with Retry-After: wait for the value in the header, then resend the same request
  • status exhausted on the quota endpoint: tokens really are gone, so add quota
  • 401 or the key not being read: usually a wrong or partially pasted key, not quota

To tell a 401 apart from a quota problem, see 401 API Key Error. If the limit you are hitting comes from another tool on a time schedule, that is a different topic, covered in Claude Code Limit Reset.

How to top up tokens without changing config

Adding quota happens on the website, not in the terminal, so there is no new command to memorise. The flow is short and asks nothing of the tools you already connected.

  1. Open tokenomixai.com and pick the token package you need.
  2. Pay with QRIS if you are in Indonesia, or with USDT. No account and no credit card are needed.
  3. After payment, the tokens are added to the quota on the key you already use.
  4. Check the quota endpoint again until status reads active and remainingTokens is filled in.

There is no new value to paste anywhere. You do not edit opencode.json, do not overwrite ANTHROPIC_AUTH_TOKEN, and do not rerun the installer. The key already sitting in your tool keeps working.

Remaining tokens are added together, so unused quota is not lost when you top up early. Validity follows the latest top-up. That is the reason to add tokens before the balance reaches zero instead of after a session dies midway.

Where the API key lives in OpenCode and Claude Code

In OpenCode the key sits in ~/.config/opencode/opencode.json (Windows: %USERPROFILE%\.config\opencode\opencode.json) as a provider named tokenomixai inside the provider object. In Claude Code, ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN are written into the env block of ~/.claude/settings.json (Windows: %USERPROFILE%\.claude\settings.json).

For Claude Code, ANTHROPIC_BASE_URL holds https://api.tokenomixai.com without /v1, because Claude Code appends /v1/messages itself. That base URL does not change when quota is added, so there is no reason to touch the settings file just because tokens ran out.

If you want the key on another machine, the one-command installer is still the short path to writing the configuration. Installer behaviour and file locations are documented in /en/docs, and the Claude Code specifics live on /en/claude-code.

Topped up but requests still fail

First make sure the key the tool uses is the same key whose quota you just added. One missing character, or an older key still saved in config, makes the quota endpoint report a status you did not expect.

  1. Run the quota check with the exact key written in your tool config.
  2. Look at expiresAt, not only at remainingTokens.
  3. Confirm the error is not a 429 with Retry-After.
  4. If the account holds several keys, remember the 600 requests per minute cap counts across all of them.
  5. If every value looks right and requests still fail, compare the base URL in your tool with the one in the docs.

One thing you do not need to worry about: your prompts and code are not lost when quota runs out. The gateway logs request metadata only, meaning model, token count, time and status. Prompt and completion content is not stored, so a session that failed on an empty balance did not leave your work recorded somewhere else.

Frequently asked questions

Do my old tokens disappear after a top-up?

No. Remaining tokens are added together with the new ones, and validity follows the latest top-up. The key itself stays the same, so nothing changes in OpenCode or Claude Code.

Does the token quota reset every 5 hours?

No. Quota is counted in tokens, not time windows, so there is no periodic reset. The key keeps working while tokens remain and before it expires. Time-based limits you see in another tool are a separate thing.

What does status exhausted mean on the quota endpoint?

It means the key has no tokens left, so requests are not served until quota is added. If status is active but requests still fail, check for a 429 with Retry-After or confirm the key in your config is the right one.

Are my prompts and code stored when the quota runs out?

No. Only request metadata is logged: model, token count, time and status. Prompt and completion content is not stored by the gateway.

How do I pay for more tokens?

Buy a package on tokenomixai.com with QRIS if you are in Indonesia, or with USDT. No account or credit card is needed, and the quota lands on your existing key after payment. Verify it with the quota endpoint.

More articles