> ## Documentation Index
> Fetch the complete documentation index at: https://weights.fyi/run/llms.txt

# Rate limits

Limits keep one key from filling the shared queue for everybody. Each key has a request rate for the calls that send work and an optional spend cap per day, and the service takes a bounded amount of unfinished work for all workspaces together.

> **Status.** Written on 2026-11-14 and extended on 2026-11-16 with admission at the capacity edge; the figures below are this service's current settings.

## Request rate per key

| Calls | Rate | Burst |
|---|---|---|
| Calls that send work (scope `submit`): classify, batches, training jobs, datasets, compute plans and packs, cancelling, making the model ready | 8 a second | 64 |
| Chat completions, on `/v1/chat/completions` and `/v1/proxy/chat/completions` | 16 a second | 64 |
| Reads and management (scopes `read` and `manage`) | not counted | not counted |

Each key has a bucket that holds the burst and refills at the rate: a key may send 64 calls that send work at once, then 8 a second. A key can carry figures of its own, set by us; `rate_limit` in [GET /v1/tokens/self](/run/docs/reference/tokens-self.md) answers the figures of the key that asks:

```sh
curl -s https://weights.fyi/run/v1/tokens/self -H "Authorization: Bearer $WEIGHTS_API_KEY"
```

## 429 answers

| Code | Cause | `Retry-After` | What to do |
|---|---|---|---|
| `rate_limited` | This key sent work faster than its rate. | Whole seconds until its bucket has room. | Wait, then send again with the same `Idempotency-Key`. |
| `overloaded` | The service holds as much unfinished work as it takes (`reason` is `queue_full` or `concurrency_limit`), or a call with `options.rejectIfBusy` found the model not ready or busy (`capacity_unavailable`). | Seconds: a polling interval, not a promise. | Wait, then send again; nothing was accepted. |
| `stream_backpressure` | A stream's pending and running packs reached its limit. | None. | Poll [the backlog](/run/docs/reference/streams-packs-list.md) and register packs as work drains. |
| `campaign_concurrency_limited` | One chat turn of a plan's session met a model at the edge of its capacity: every seat of its share is taken, or the capacity is not ready yet. Expected under load, by design; see [below](/run/docs/api/rate-limits.md#admission-at-the-capacity-edge). | Seconds, with randomness added so refused callers do not return in step. | Send that turn again within your own deadline. Do not resubmit the plan: it keeps running. |
| `dry_run_busy` | Every simulation slot of [the dry run](/run/docs/reference/compute-plans-dry-run.md) stayed busy. | Seconds. | Send the same check again; nothing was checked. |

Every `429` is safe to retry: the refused request itself was not kept, and accepted work is never refused this way. One call can keep part of what it was sent: a batch of packs ([POST /v1/streams/{stage_id}/packs](/run/docs/reference/streams-packs-create.md)) is registered pack by pack, so a `stream_backpressure` partway through leaves the earlier packs registered. Send the same batch again; packs already registered answer unchanged.

The body's `retry_after_seconds` repeats `Retry-After`. A `202` answer also carries `Retry-After`, as the time to look at the job again. On the chat calls the same refusals come in OpenAI's shape ([API errors](/run/docs/api/errors.md#openai-compatible-calls)).

## Admission at the capacity edge

A hosted model has no fixed number of seats. The service measures each model while it runs and admits chat turns up to the edge of what it can serve, on purpose: held safely below that edge, capacity you are waiting for would sit idle. Under load, therefore, a share of turns is answered `429` with `Retry-After`. A refused turn means that one turn waits. The plan, its sessions and its other turns run on, and nothing was charged for the refused turn.

| Mechanism | What it does |
|---|---|
| Operating band | The service steers a busy model toward 5 to 15% of its turns refused. Below the band it admits more sessions; above it, it adds none until the pressure clears. The band is a target for the model as a whole, not a rate promised to any one caller: a model with free seats refuses none, and your own share can be higher or lower. |
| Seat lending | A session that waits on a tool call uses no compute, so its seat is lent to other ready work and the ceiling on sessions becomes `1 + lent` times the modelled capacity. Only compute is lent: the paused session's context stays in the model's cache, and it resumes without reloading. When a lent seat is wanted back, a borrowing turn is the one refused. |
| Fair shares | Sessions of several plans on one model share its seats by [priority weight](/run/docs/reference/compute-plans-create.md). Borrowed seats are given back first: a plan that bursts past its share is refused before a plan inside its own share is. |
| Tool-wait seats are not worker seats | The seats of [GET /v1/seats/leases](/run/docs/reference/seats-leases.md) bound subscription command-line workers you enrolled. They are a different thing from a hosted model's adaptive admission. |

The refusal on [POST /v1/chat/completions](/run/docs/reference/chat-completions.md), selected fields:

```json
{"error": {"type": "overloaded", "code": "campaign_concurrency_limited", "retryable": true,
           "retry_after_seconds": 3, "reason": "concurrency_limit", "concurrent_seats": 12,
           "message": "Capacity is temporarily unavailable. Retry after the indicated delay."}}
```

| Field | Meaning |
|---|---|
| `Retry-After` (header), `retry_after_seconds` | Whole seconds to wait before sending the turn again. |
| `retryable` | Always `true` on this refusal. |
| `reason` | `concurrency_limit`: every seat of your share is taken, and one frees when an answer closes. `capacity_unavailable`: the model's capacity is starting or being replaced; the wait is longer. |
| `concurrent_seats` | The seats your stage may hold at once right now. |
| `code` on the drop-in base | On `https://weights.fyi/run/v1/proxy` the stable public `code` is `rate_limited`, and `reason` carries `campaign_concurrency_limited` or its cause above. |

Because the spelling differs by base URL, do not match one code: treat every `429` that carries `Retry-After` and `retryable: true` as "send this turn again after the wait".

## Spend cap per day

A key may carry a spend cap in US dollars per UTC day: set `daily_cap_usd` when you make it ([POST /v1/tokens](/run/docs/reference/tokens-create.md)), or on [your panel](/run/app). Today's charges of the key's jobs and chats, plus its waiting pages at their price, count against it. New work that would pass the cap answers `402`, not `429`, so waiting a few seconds does not help; it resets at 00:00 UTC.

```json
{
  "error": "token_daily_cap",
  "cap_usd_micros": 25000000,
  "committed_today_usd_micros": 24990000,
  "day": "UTC",
  "resets_at": "2026-11-15T00:00:00.000Z",
  "message": "This token's spend cap is $25.00 a day (UTC). Today it has $24.99 spent or waiting, and more work would pass the cap. It resets at 00:00 UTC; the account owner can raise it on the panel."
}
```

## Back off and retry

Retry `429` and `5xx` answers and lost connections with the same `Idempotency-Key`. Wait `Retry-After` when the answer has it; otherwise start from the service's own retry interval, 10 s, and double it after each failure. Add randomness, so many clients do not retry in step. Always bound the loop with a deadline of your own, as both functions below do: they give up when it passes, and no single request may outlast it. A chat turn takes no `Idempotency-Key`; a refused turn was not run, so send it again as it is and pass no key.

```python
import os
import random
import time

import requests

API = "https://weights.fyi/run/v1"
RETRYABLE = {429, 500, 502, 503}


def post_with_retries(path, payload, deadline_seconds, idempotency_key=None):
    """POST until the call is answered or `deadline_seconds` have passed; TimeoutError at the deadline."""
    deadline = time.monotonic() + deadline_seconds          # your own limit for this piece of work
    headers = {"Authorization": f"Bearer {os.environ['WEIGHTS_API_KEY']}"}
    if idempotency_key is not None:
        headers["Idempotency-Key"] = idempotency_key
    delay = 10   # the service's retry interval, doubled after each failure
    while True:
        left = deadline - time.monotonic()
        if left <= 0:
            raise TimeoutError(f"{path}: no answer within {deadline_seconds} s")
        try:
            response = requests.post(f"{API}{path}", json=payload, headers=headers, timeout=left)
        except (requests.ConnectionError, requests.Timeout):
            response = None                     # a lost or stalled connection: send again with the same key
        if response is not None and response.status_code not in RETRYABLE:
            response.raise_for_status()
            return response.json()
        retry_after = response.headers.get("Retry-After") if response is not None else None
        wait = float(retry_after) if retry_after else delay
        wait += random.uniform(0, wait)
        if time.monotonic() + wait >= deadline:
            raise TimeoutError(f"{path}: the next attempt would fall after the {deadline_seconds} s deadline")
        time.sleep(wait)
        delay *= 2
```

```js
const API = "https://weights.fyi/run/v1";
const RETRYABLE = new Set([429, 500, 502, 503]);
const sleep = (seconds) => new Promise((done) => setTimeout(done, seconds * 1000));

async function postWithRetries(path, payload, deadlineSeconds, idempotencyKey) {
  const deadline = Date.now() + deadlineSeconds * 1000; // your own limit for this piece of work
  const headers = {
    Authorization: `Bearer ${process.env.WEIGHTS_API_KEY}`,
    "Content-Type": "application/json",
  };
  if (idempotencyKey !== undefined) headers["Idempotency-Key"] = idempotencyKey;
  let delay = 10; // the service's retry interval, doubled after each failure
  for (;;) {
    const left = deadline - Date.now();
    if (left <= 0) throw new Error(`${path}: no answer within ${deadlineSeconds} s`);
    let response = null;
    try {
      response = await fetch(`${API}${path}`, {
        method: "POST",
        headers,
        body: JSON.stringify(payload),
        signal: AbortSignal.timeout(left), // no request outlasts the deadline
      });
    } catch (error) {
      // fetch's network failure or the timeout above: send again with the same key
      if (error.name !== "TypeError" && error.name !== "TimeoutError") throw error;
    }
    if (response && !RETRYABLE.has(response.status)) {
      if (!response.ok) throw new Error(`${response.status} ${await response.text()}`);
      return response.json();
    }
    const retryAfter = response && response.headers.get("Retry-After");
    let wait = retryAfter ? Number(retryAfter) : delay;
    wait += Math.random() * wait;
    if (Date.now() + wait * 1000 >= deadline) {
      throw new Error(`${path}: the next attempt would fall after the ${deadlineSeconds} s deadline`);
    }
    await sleep(wait);
    delay *= 2;
  }
}
```

Call either with a deadline of your own: `post_with_retries("/jobs", {"pages": pages}, 900, "nightly-2026-11-14")` gives a batch upload fifteen minutes, and `post_with_retries("/chat/completions", turn, 120)` retries one refused chat turn for two minutes, without a key. Choose the deadline from what the work is worth waiting for; when it passes, the function raises and never loops on.
