BLACK FRIDAYUntil Dec 8 (Tue) 23:59 JSTUntil Dec 8

DocsLimits and rate limits

Limits and rate limits

Per-key spending limits, what happens when your balance runs out, rate limits, per-model limits, the request size limit, and the errors returned when you go over each.

Requests to Echo have the following 5 limits.

LimitSet perHTTP status when exceeded
Key spending limitKey (optional)403 or 401
BalanceAccount403
Rate limit (the number of requests you can send in a period)Account, source IP address429
Per-model limits (requests, tokens, concurrent requests)Account and model together, and the model as a whole429
Request body sizeRequest400

Key spending limits

  • If you enter Spending limit (JPY) when issuing a key, the key can spend up to that amount. A key without a limit can be used up to your account balance
  • The spending limit goes down as you use it. It is never reset automatically, for example each month
  • Before a request is sent, its estimated price is compared with the key's remaining spending limit. If the estimate is higher, the request is not sent and 403 is returned (This API key has reached its spending limit)
  • The price is fixed from the actual token counts after the answer ends, so a key can go over its spending limit. If you send several requests at the same time, each of them passes the check above, and the amount over the limit can be more than one request. The amount over the limit is also deducted from your balance. To keep it small, send fewer requests at the same time
  • A key that has used up its spending limit returns the same 401 as a wrong key (Invalid API key). If you get 401 with a key you believe is correct, check the key's status and remaining spending limit in API keys in the console
  • You can change the limit for each key with Change spending limit in API keys in the console. A key that has reached its limit also resumes automatically when you raise the limit. You do not need to replace the key in your program

How to issue keys and read the key list is in API keys and usage.

When your balance runs out

When your balance is used up, requests are stopped (HTTP 403, Insufficient balance). However, like the key spending limit, the balance is checked against the estimated price before a request is sent, so the price can exceed the balance (if you send several requests at the same time, the excess can be more than one request). The excess makes the balance negative and is deducted from your next top-up. If you set max_tokens, the estimate assumes the output reaches that length; an extremely large value returns Insufficient balance even when your balance is enough (403 insufficient_quota).

Once a top-up is reflected in your balance, you can use the API again. This can take a few seconds to about a minute. Details of pricing and top-ups are in Pricing and top-ups.

Rate limits

Counted perLimit (provisional)When exceeded
Account. All keys of the same account are counted together60 per minute. 600 per minute for Premium membersReturns 429 and Rate limit exceeded for your account, please retry after 60 seconds, with a Retry-After: 60 header
Source IP address. Requests to paths that start with /v1 are counted3,000 per minuteReturns 429 and Too many requests from your IP address, please retry after the number of seconds in the Retry-After header. The Retry-After header holds the number of seconds to wait

The upstream APIs (the APIs of the providers that actually run the models) also have rate limits. When you exceed an upstream rate limit, Echo returns 429 and The model service is temporarily rate limited, please retry after 60 seconds, with a Retry-After: 60 header.

Requests rejected by a rate limit are free. 429s caused by an upstream rate limit are also free.

Per-model limits

Some models have their own limits in addition to the rate limits above. Three things are counted. The values differ by model and by account.

LimitHow it is counted
Requests per minuteThe number of requests accepted in the last 60 seconds
Tokens per minuteThe number of tokens used in the last minute (input plus output). It is based on actual usage, so it lags by about 10 to 20 seconds
Concurrent requestsThe number of requests whose response has not finished yet. A streaming response counts as finished when the last part has been delivered

There are two levels. Going over either one returns 429, and the Retry-After header holds the number of seconds to wait.

Limit exceededMessage returned
The share your account can use on that modelYou have reached your rate limit for the model <model ID> (<kind of limit>), please retry after <seconds> seconds
The limit for the model as a whole (all users together)The model <model ID> is receiving too many requests right now (<kind of limit>), please retry after <seconds> seconds

<kind of limit> is one of requests per minute, tokens per minute, or concurrent requests. The error body has the same format as other 429s (the Anthropic format on /v1/messages, the OpenAI format elsewhere; see Errors and fixes).

Wait at least the number of seconds in Retry-After before sending again. The OpenAI and Anthropic SDKs retry a 429 automatically and follow Retry-After. If you hit the concurrent request limit, send fewer requests at the same time, or wait for the previous request to finish before sending the next. Requests rejected by a per-model limit are free.

To count per-model limits, Echo receives the whole request body before sending it to the model. If the body takes too long to arrive, Echo returns 408 and The request body was not received in time, please send the request again. You are not charged; send the same request again. If this happens with requests that carry large images or files, check your upload speed or put less in a single request.

Request size

ItemContents
Maximum request body size128 MB (provisional). Larger requests return 400 and Invalid request: request body exceeds 128 MB: request body too large
Number of input tokensUp to each model's context length (the number of tokens it can handle at once), listed on each model's page in the model list

Each upstream API also has its own request size limit. We have confirmed that a request containing a 4 MB image in base64 reaches the upstream as is. If the input is longer than the context length, the upstream API returns 400.