Klarety

Limits and rate limits

Read what your plan allows from code, and what happens when you reach a limit.

For devs

Your plan sets limits: calls per minute, how much a query may read, upload size, active and more. Read them from code so requests are right the first time.

Read your limits

In Python

limits.py
from klarety import Nexus

with Nexus.connect() as nexus:
    limits = nexus.limits()
    print("Plan family:", limits.family)
    for knob in limits.knobs:
        value = knob.fixed if knob.fixed is not None else knob.default
        print(f"{knob.name}: {value} {knob.unit or ''}  ({knob.description})")

nexus.limits() returns a Limits object:

FieldMeaning
familyYour plan's family.
knobsEvery limit, as a Knob.
studio_sizesEach size your plan offers, with cores and memory_gb.

Find one limit by name with limits.knob("api_key.max_active"). It raises KeyError when there is no such limit.

What a knob holds

FieldMeaning
nameThe limit's name.
descriptionWhat it limits, in words.
kind, unitIts type and unit.
fixedThe value, when your plan fixes it.
default, minimum, maximumThe default and range, when a project may choose within it.
choicesThe allowed values, for a limit that is a choice.
settable_on_projectWhether a project may set its own value.

Over HTTP

GET/v1/limits
curl -s https://api.klarety.ai/v1/limits -H "Authorization: Bearer $TOKEN"

In the app

Open SettingsUsage & limits to see your , spend and plan limits.

Usage settings page showing credit balance, spend and plan limits

A description, not a promise

limits() describes your plan. The server still checks every request, so handle refusals anyway.

Fixed limits

These are the same on every plan:

LimitValue
Request body1 MiB. Larger data goes through an upload, not the request.
Upload linkLasts one hour.
max_rows on a SQL statement1 to 10,000, and never more than your plan's page of rows.
SQL parametersUp to 256 per statement.
Rows changed by one edit_rows()Up to 500.
Statements in one batch job1 to 50.
Edges sent in one assert_edges()Up to 1,000.

When you reach a limit

What happensStatusSDK exceptionWhat to do
Too many calls per minute429 with Retry-AfterRateLimitedErrorThe SDK waits and retries. Slow your loop down.
Every statement slot busy429OverBudgetErrorThe SDK waits and retries. Send it again later.
A query would read too much413OverBudgetErrorNarrow it; check with nexus.estimate().
Body over 1 MiB413OverBudgetErrorSend less, or upload a file.
Out of credits402InsufficientCreditsErrorAdd credits.
Another plan limit403 or 422RefusedErrorThe error's limit field names it.

A refusing limit is named in the error's limit field, so you can ask for it to be raised. See Errors.

Next steps

On this page