Rate limits and quotas

Rate limits and quotas

The logging rate and hourly rate limits that protect the service, monthly plan quotas, and how to see where you stand.

Three kinds of limit apply. Logging is limited by rows a second. Rate limits on everything else are sliding one-hour windows per organization that protect the service. Exceeding either returns 429 rate_limited with a Retry-After header, and the Python client retries after that delay when it is 30 seconds or less; past that, client 0.17.0 and later raise RateLimitError at once with retry_after, so a call never holds your thread for long. Quotas are plan allowances; exceeding one returns 403 quota_exceeded and does not resolve by waiting a minute.

429 Too Many RequestsRetry-After: 1480
{
  "error": {
    "type": "rate_limit_error",
    "code": "rate_limited",
    "message": "Too many explanations. Try again later.",
    "details": {"limit": 120, "window_s": 3600}
  }
}

#Logging rate

POST /v1/predictions, POST /v1/predictions/batch and POST /v1/predictions/actuals are limited by the rows they carry, not by requests: one row for each prediction or outcome. Each plan has a rate, logged_rows_per_second in its limits:

PlanRows a secondMost rows at once
Free101,000
Standard1006,000
Team50030,000
Enterprise2,000, or the contract's rate120,000, or a minute of the contract's rate

A workspace can send a minute of its rate at once, and never less than one full batch (1,000 rows); what it sends is taken from that allowance, which refills at the rate. Predictions (/v1/predictions and /batch) and outcomes (/actuals) each have their own, so outcomes arriving late never hold up predictions. A request with more rows than can be logged now is 429 rate_limited, nothing in it is logged, Retry-After is the seconds until it would fit, and details is {limit, per: "second", unit: "rows", available, requested}. Wait, or send smaller batches.

Each answer from those three routes says where the workspace stands: X-RateLimit-Limit is the rate in rows a second, X-RateLimit-Remaining the rows that could be logged right now, and X-RateLimit-Unit is rows/s.

Before API 1.9.0, logging was limited to 600 requests an hour times the plan factor, whatever a request carried; that limit is gone. POST /v1/models/{model}/predict and …/generate keep their hourly limit on requests, and POST /v1/explanations keeps its own, in the table below. An owner or admin can lower the rate in settings.quotas, as any limit; on Enterprise an operator sets the contract's rate (kaimei-api billing set-limits ORG --logged-rows-per-second N, or --unlimited logged-rows-per-second for none).

429 Too Many RequestsRetry-After: 79
{
  "error": {
    "type": "rate_limit_error",
    "code": "rate_limited",
    "message": "This workspace may log 10 predictions a second (bursts of up to 1,000); 212 can be logged now and this request has 1,000. Wait 79 s, send smaller batches, or move to a plan with a higher rate.",
    "details": {
      "limit": 10,
      "per": "second",
      "unit": "rows",
      "available": 212,
      "requested": 1000
    }
  }
}
200 OKheaders of a batch of 200 rows
X-RateLimit-Limit: 10
X-RateLimit-Remaining: 788
X-RateLimit-Unit: rows/s

#Hourly rate limits and quotas

Rate limitPer hour on FreeCounts
Models40POST /v1/models, POST …/versions and forks into the organization
Predict and generate600POST /v1/models/{model}/predict and …/generate (one hit per generation). Logging predictions is limited by rows a second instead.
Explanations120POST /v1/explanations, and …/batch (one hit per item)
Analyses30POST /v1/analyses
Model runs600Traces, stage studies, votes, activations and similar cases, and a model's history read whole (days=0) or with detail=true: each runs on Kaimei's servers. At most 8 at once per organization. Grows with the plan, as the first eight do.
Tensor uploads20,000PUT …/structure/tensors/{key}; a large model is thousands of tensors
API keys20POST /v1/api-keys and …/rotate
Invitations30POST /v1/organization/invitations and …/resend
Organizations5 per accountPOST /v1/organizations. An account can own 10.
Joining by email domain10 per accountPOST /v1/organizations/{id}/join, each of which emails a confirmation link
Turning joining by email domain on10 per accountPUT /v1/organization/join-domain while it is off, each of which emails the admin a confirmation link
Billing links30POST /v1/billing/checkout and …/portal together; …/refresh 120
Sign-in / sign-up20 / 5 per IPLogin and signup; verification emails 5 per IP and 3 per address
Registering agents60POST /v1/models/{model}/agent/sessions. Grows with the plan, as the first eight do.
Splitting text1,200POST /v1/models/{model}/tokenize with a text; naming token ids is not counted. Grows with the plan, as the first eight do.

The first eight limits count per organization and grow with its plan: three times the figures above on Standard, ten times on Team and thirty times on Enterprise. Organizations, joining by email domain, billing links and sign-in do not change with the plan.

Quotas on the free plan: 3 models, 5 API keys, and per calendar month 500 logged predictions, 50 explanations and 5 analyses. Monthly usage is counted as records are made, by the month the server stored them: deleting a model or a record, by hand or by a retention run, does not give back what it took that month, and a model moved to another workspace counts there without giving back the room it took where it was. Deleting a model does free its slot among the models. Paid plans raise every allowance and the hourly rate limits; the pricing page has the tiers, and GET /v1/billing lists each plan's limits and changes the plan. Your organization's current limits and this month's usage are in quotas on GET /v1/organization.

An owner or admin can cap the organization below its plan with settings.quotas on PATCH /v1/organization, for example to stop a runaway job; raising a limit above the plan is a plan change. On Enterprise the limits are set by the contract, outside settings, so the organization's own admins can lower them but not lift them.

403 ForbiddenResponse
{
  "error": {
    "type": "permission_error",
    "code": "quota_exceeded",
    "param": "explanations_per_month",
    "message": "The free plan allows 50 explanations this month. Upgrade or wait for the next cycle.",
    "details": {"used": 50, "limit": 50, "plan": "free"}
  }
}
GET /v1/organizationthe quotas field
{
  "plan": "free",
  "limits": {
    "models": 3,
    "api_keys": 5,
    "predictions_per_month": 500,
    "explanations_per_month": 50,
    "analyses_per_month": 5,
    "logged_rows_per_second": 10
  },
  "usage": {
    "models": 2,
    "api_keys": 2,
    "predictions_per_month": 320,
    "explanations_per_month": 18,
    "analyses_per_month": 3
  }
}