insufficient_quota (403 / 429): not enough balance or key spending limit
Causes and fixes when Echo Token Station's API returns HTTP 403 and insufficient_quota (Insufficient balance, This API key has reached its spending limit). It is also returned when max_tokens is set too high. OpenAI's API returns these billing errors as HTTP 429.
This error is returned when your balance or the key's spending limit is not enough for the estimated price of this request. Before sending a request, Echo checks it against the estimated price, and if there is not enough, it returns 403 without sending the request.
Example
There are two kinds of message, depending on what is not enough.
Not enough key spending limit (This API key has reached its spending limit)
OpenAI format (/v1/chat/completions and so on):
{"error":{"message":"This API key has reached its spending limit","type":"api_error","param":"","code":"insufficient_quota"}}Anthropic format (/v1/messages):
{"error":{"type":"permission_error","message":"This API key has reached its spending limit"},"type":"error"}Not enough balance (Insufficient balance)
OpenAI format. This is the response returned when max_tokens was set too high. The same body is returned when the balance is not enough.
{"error":{"message":"Insufficient balance","type":"api_error","param":"","code":"insufficient_quota"}}How this differs from OpenAI's 429
OpenAI's API returns HTTP 429 when your credits run out or you reach a spend limit. error.code is credit_balance_exhausted (no credits left), project_spend_limit_exceeded (project spend limit) and so on, and error.type can be insufficient_quota. Echo returns HTTP 403 in the same situation.
- If your code handles 429 separately for OpenAI, handle 403 the same way for Echo
- In both cases, waiting and retrying does not help. Fix the balance or the spending limit, then send the request again
Common causes
- The balance is not enough: you have used up the balance you topped up, or little is left
max_tokensis too high: the estimated price assumes output up tomax_tokens. Even if your balance is enough, a very largemax_tokensreturnsInsufficient balance- The key's remaining spending limit is not enough: what is left of the spending limit set for the key is less than the estimated price of this request. A key that has used up its limit returns 401, not 403 (401 Invalid API key)
How to fix
- Check your balance in Balance and top-up in the console, and top up if it is not enough
- Lower
max_tokensto the length you need. The upper limit is the maximum output tokens on the model page
curl "https://token.echohub.io/v1/chat/completions" \
-H "Authorization: Bearer $ECHO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-fable-5-1",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "What is the capital of Japan?"}
]
}'- For
This API key has reached its spending limit, check the key's spending limit in API keys in the console, and raise it with Change spending limit or leave it empty for no limit
Related
- Pricing and top-ups: how prices are calculated and what happens when the balance is not enough
- Limits and rate limits: how the key's spending limit and the balance are checked
- Claude Code: Claude Code shows
Failed to authenticate. API Error: 403 Insufficient balance. The cause is the balance, not the key - Errors and fixes: other errors and the error body format