Doku-Menü

Ratenbegrenzung

Ivy limits how fast an integration can work, to keep the service responsive for everyone.

Requests per API key

Each API key can make 600 requests a minute, counted in fixed one-minute windows. A request over the limit gets 429 Too Many Requests with the code rate_limited and a Retry-After header with the number of seconds until the next window. Nothing was changed, so the request is safe to repeat after that.

The limit is per key, not per service identity: give separate integrations separate service identities and keys rather than sharing one.

A self-hosted Ivy sets its own limit with the API_KEY_RATE_LIMIT_PER_MINUTE environment variable (600 by default). If your integration needs more on Ivy’s hosted service, contact us.

Share links have limits of their own, outside the per-key limit: opening and downloading through a share link is limited per link and per IP address, and wrong passwords are limited per link and IP address (too_many_attempts). Both answer 429 with a Retry-After header.

Limits on runs and uploads

These apply to service identities just as to people:

  • One agent run per conversation at a time. Sending a message while the agent is still answering gets 409 with run_in_progress. Follow or cancel the running reply first.
  • One code run per file at a time for each caller: starting another gets 409 with run_in_progress.
  • Concurrent code runs per organisation, set by its plan (max_concurrent_runs in getCodeExecution). A run that can’t get a sandbox ends with an error event whose code is sandbox_busy.
  • Concurrent uploads per caller: too many at once get 429 with too_many_uploads. Wait for the others to finish.
  • AI credits: each service identity can have a budget and a spending limit, on top of the organisation’s. When they’re used up, model calls and code runs are refused with 402 and usage_limit_reached until the next period or until an admin raises the limit.

Back off and retry

Honour Retry-After when it’s there. Otherwise, double the wait on each further 429, with some random jitter so that many clients don’t retry in step:

async function withBackoff<T>(call: () => Promise<{ response: Response } & T>) {
  for (let attempt = 0; ; attempt++) {
    const result = await call();
    if (result.response.status !== 429 || attempt === 5) return result;
    const retryAfter = Number(result.response.headers.get("Retry-After"));
    const delay = retryAfter > 0 ? retryAfter * 1000 : 2 ** attempt * 1000 * (0.5 + Math.random());
    await new Promise((resolve) => setTimeout(resolve, delay));
  }
}

Staying under the limits

  • Page through lists with cursor instead of re-reading from the start. See Pagination.
  • Follow a run with one event stream rather than polling it, and follow a space’s changes instead of listing it again and again.
  • Reuse the result of GET /v1/api-key instead of calling it before every request.