Leni developers
Usage, billing, and limits
The project key determines environment, quota, rate limits, and billing. Sandbox, development, and production use the same HTTPS base URL.
| Key environment | Per-key limit | Usage behavior |
|---|---|---|
| Sandbox | 5 requests per 60 seconds | Default allowance is 100 successful calls per calendar month (UTC); the key response is authoritative. |
| Development | 60 requests per 60 seconds | Rate limited and metered according to the account attached to the key. No sandbox monthly-call allowance applies. |
| Production | 120 requests per 60 seconds | Metered analysis consumes included subscription credit first, then funded API credits when available. Non-analysis reads still count toward request limits. |
How the request limit is counted
- The window is a fixed 60-second window keyed by the authenticated project key.
- Every authenticated attempt that reaches the limiter counts, including requests that later return 4xx or 5xx.
- The published limit is the client budget. Keep sustained traffic below it instead of probing for the exact boundary.
- HTTP 429 includes
Retry-AfterandretryAfterSeconds. Wait at least that long and add jitter before retrying. - No remaining-request response header is currently part of the public contract.
Current pricing
Rate-limit response
HTTP/1.1 429 Too Many Requests
Retry-After: 42
{
"error": "RATE_LIMIT_EXCEEDED",
"limit": 5,
"windowSeconds": 60,
"retryAfterSeconds": 42,
"environment": "sandbox"
}Limits are independent
| Control | Applies to | When consumed |
|---|---|---|
| Per-minute request limit | All authenticated HTTP API calls | Every attempt reaching the rate limiter |
| Sandbox monthly allowance | Sandbox keys only | Successful 2xx and 3xx calls |
| Analysis usage | Metered run-models work outside sandbox | According to the account plan and analysis result |
| API-credit spending control | Funded API-credit spillover | After included plan usage is unavailable |
These controls overlap. Passing one does not bypass another. A production key can be below its per-minute limit and still receive HTTP 402 when neither plan usage nor funded API credits are available.
Sandbox quota
A sandbox request is decremented only after a successful 2xx or 3xx response. Failed 4xx or 5xx requests do not consume a call. HTTP 202 admission and successful polling reads each consume a call, even if an admitted analysis later fails. The allowance resets lazily at the first request after 00:00 UTC on the first day of the next calendar month.
HTTP/1.1 402 Payment Required
{
"error": "SANDBOX_LIMIT_EXCEEDED",
"message": "Sandbox API call quota exhausted for this key.",
"sandboxLimit": 0,
"sandboxLimitResetAt": "<ISO-8601 timestamp>",
"environment": "sandbox"
}Analysis usage order
- Leni checks whether the account may start the requested analysis.
- Available included plan usage is consumed first.
- Free and Enterprise accounts can spill into funded API credits when available.
- If no eligible usage remains, the request returns HTTP 402 without starting new compute.
Do not infer dollars from API usage
Analysis credit errors
Development and production POST /users/run-models requests check credit before starting analysis. Sandbox keys use their monthly call quota instead. Handle these HTTP 402 codes separately:
| HTTP API error | Meaning | Response fields |
|---|---|---|
| INSUFFICIENT_CREDIT | Both included subscription credit and the plan payer's API credit are depleted. | subscriptionBalanceCents, apiBalanceCents, cancelled |
| SPENDING_LIMIT_REACHED | Included credit is depleted and this period's API-credit spending limit has been reached, even if API credit remains. | spendingLimitCents, effectiveLimitCents, carriedOverageCents, overageCents, currentPeriodSpentCents, currentPeriodResetAt |
HTTP/1.1 402 Payment Required
{
"error": "SPENDING_LIMIT_REACHED",
"message": "Spending limit for this period has been reached. Increase the limit or wait for the next period.",
"spendingLimitCents": 10000,
"effectiveLimitCents": 7000,
"carriedOverageCents": 3000,
"overageCents": 250,
"currentPeriodSpentCents": 7250,
"currentPeriodResetAt": "<ISO-8601 timestamp>"
}Amounts with a Cents suffix are integer cents. The spending control is a pre-call check when included credit is exhausted, not a guaranteed maximum cost for work already admitted: a call admitted under the limit completes, so spend can pass it. overageCents is the spend past this period's limit. Carry begins with the first full month after the billing change is enabled; overage from the month it is enabled is not carried. Later overage comes off the next period's limit.effectiveLimitCents is the limit less the overage carried in (carriedOverageCents), never below 0; overage larger than one period's limit keeps carrying into later periods. Once the limit is reached, included-credit calls no longer spill into API credits. The plan's payer can raise the limit in Leni; otherwise retry in the next period, whose limit is reduced by any overage carried into it.