Appearance
Rate limits and spend caps
Rate limits
Every /v1 request counts against two sliding one-minute windows:
- the organization's requests per minute (default 600), shared by all keys of all projects;
- the API key's own limit, if one was set when the key was created.
A request is allowed only when both windows have room. Every response carries (except while the rate limiter is unavailable: requests are then allowed and the two x-ratelimit-* headers are left out):
| Header | Meaning |
|---|---|
x-ratelimit-limit | the limit of the tightest window |
x-ratelimit-remaining | requests left in it |
retry-after | on 429 only: seconds to wait before retrying |
Over the limit the API answers 429 RATE_LIMITED:
json
{
"code": "RATE_LIMITED",
"message": "Too many requests. Retry after 3 seconds.",
"params": { "retryAfter": 3 },
"requestId": "…"
}Back off for retry-after seconds. The SDK does this automatically (up to 60 s per wait, then up to maxRetries times) and exposes the headers as response.rateLimit:
ts
const { data, response } = await hevkar.agents.run('triage', { input }).withResponse();
console.log(response.rateLimit); // { limit: 600, remaining: 597, retryAfter: undefined }Set a per-key limit to protect one integration (for example a public-facing feature) from using up the whole organization's budget.
Spend cap
Each organization has a monthly spend cap (default 50 USD), measured in customer price over the current UTC month. Once month-to-date spend reaches it, new billable work is refused with 402 QUOTA_EXCEEDED:
- run requests (sync, stream and async, also when an async run reaches the worker),
- conversation messages,
- new realtime sessions; running realtime sessions end with reason
limit(close code 4402), - data source syncs, reindexes and document uploads; a sync already queued stops before it embeds more documents.
Runs that fail or are cancelled are billed for what they used before stopping (finished model steps, and for a run cancelled or disconnected mid-stream, an estimate of the step in progress).
Reading runs, usage and files keeps working. Owners and admins receive alerts at 80 % and 100 %. The console shows the month's spend against the cap under Usage; your platform operator can raise the cap.
Other organization limits
| Limit | Default | Error |
|---|---|---|
| Concurrent realtime sessions | 5 | 429 REALTIME_SESSION_LIMIT |
| Storage (files and documents) | 1024 MB | 402 STORAGE_LIMIT_REACHED |
| Data sources | 20 | 402 DATA_SOURCE_LIMIT_REACHED |
A suspended organization gets 403 ORG_SUSPENDED on every API call.
Per-request limits
| What | Limit |
|---|---|
| Files per run or message | 20 |
| Upload size | 50 MB (platform setting) |
| Text input per run | guardrails.maxInputChars, default 50 000 |
Conversation message content | 1 000 000 characters |
| Documents per push | 1 to 500 text documents, or up to 20 files |
| Tool calls per run | maxToolCalls, default 10 (max 50) |
| Agent-as-tool nesting | 3 levels |
| Workflow sync wait | 60 s, then 202 |
Tracking usage per end user
Pass externalUserId on runs, conversations and realtime sessions. The console's usage dashboard breaks spend down by end user, with the number of runs and realtime (voice) sessions each one used, so you can enforce your own per-user quotas or credits. GET /v1/usage returns the project's totals per day (see Usage).