> ## Documentation Index
> Fetch the complete documentation index at: https://aisa.one/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> - Base URLs: models `https://api.aisa.one/v1` (Gemini GenerateContent: `https://api.aisa.one/v1beta`); data APIs `https://api.aisa.one/apis/v1`. The `servers` of each operation in https://aisa.one/openapi.yaml is authoritative.
> - Auth: `Authorization: Bearer $AISA_API_KEY`. Never print, log, or commit the key.
> - MCP (preferred for agents): `https://mcp.aisa.one/mcp`, signed in with OAuth, so there is no key to paste.
> - Agent Skill: `npx skills add AIsa-team/agent-skills --skill aisa`. Fallback with the AIsa CLI: `aisa skills install aisa`.
> - Spending: docs, https://aisa.one/models, https://aisa.one/api, `/v1/models`, and MCP `search`, `list_categories`, `get_details`, `batch_quote`, and the `account` operation are free. Quote the exact calls before running them (MCP `batch_quote`, CLI `aisa quote --json`). If the quote reports `auto_execute_eligible: true`, run it unless the user set a tighter limit or asked only for a quote. Otherwise, tell the user in one message the planned calls, the quoted price, and a total USD budget for the task, then wait for approval. Direct HTTP calls follow the stricter rule at https://aisa.one/docs/get-started/cli.md#direct-http-fallback. Do not make paid calls to test availability. Full rule: https://aisa.one/llms.txt

# Rate Limits

> How AIsa throttles requests: per-model success limits on some models, upstream provider 429s, and how to handle 429 responses with Retry-After.

AIsa does not publish fixed request-per-minute (RPM), token-per-minute (TPM), or concurrency tiers, and responses do not carry `X-RateLimit-*` headers. A `429 Too Many Requests` can come from one of the sources below. In every case, wait for `Retry-After` when it is present and back off before retrying.

## Where a 429 comes from

| Source | Applies to | How to recognize it |
| - | - | - |
| Per-model success limit | Only models that have a limit configured | `error.code = "model_success_rate_limit_exceeded"` with a `Retry-After` header |
| Upstream provider | Any model or data API | The provider throttled the request and no fallback attempt succeeded; the body follows the [endpoint's error format](https://aisa.one/docs/api-reference/errors.md) |
| Async capacity | Async data API jobs | `{"error": "integration async capacity is unavailable"}` with `Retry-After: 2` |

### Per-model success limit

Some models cap how many **successful** calls one account can make to that model within a rolling window of hours. Failed calls do not count toward the limit. Most models have no such limit.

When the cap is reached, the gateway returns `429` with a `Retry-After` header (seconds) and this body:

```json theme={null}
{
  "error": {
    "message": "model <model-id> is limited to 100 successful calls per 1h0m0s for this user",
    "code": "model_success_rate_limit_exceeded",
    "model": "<model-id>",
    "limit": 100,
    "window_seconds": 3600,
    "retry_after_seconds": 812,
    "reset_at": "2026-10-14T09:30:00Z"
  }
}
```

The values above are illustrative. `reset_at` is when the oldest counted call leaves the window and a slot frees up.

## Handling 429 responses

**1. Honor `Retry-After`**

When the header is present, wait at least that many seconds before the next attempt. Never retry immediately.

**2. Use exponential backoff with jitter**

Without `Retry-After`, start around 1 second, double the delay on each consecutive 429, add ±25% jitter, and cap the delay. See [Retry guidance](https://aisa.one/docs/api-reference/errors.md#retry-guidance).

**3. Switch models for success limits**

`model_success_rate_limit_exceeded` is per model. If you cannot wait until `reset_at`, send the request to a different model.

**4. Queue instead of looping**

For batch workloads, queue requests and drain them at a steady rate rather than retrying in a tight loop.

## Example: retry on 429

```python theme={null}
import time
from openai import OpenAI, RateLimitError

client = OpenAI(base_url="https://api.aisa.one/v1", api_key="sk-aisa-...")

def create_with_retry(max_attempts=5, **kwargs):
    delay = 1.0
    for attempt in range(max_attempts):
        try:
            return client.chat.completions.create(**kwargs)
        except RateLimitError as err:
            if attempt == max_attempts - 1:
                raise
            retry_after = err.response.headers.get("retry-after")
            time.sleep(float(retry_after) if retry_after else delay)
            delay = min(delay * 2, 30)

response = create_with_retry(
    model="qwen3.7-flash",
    messages=[{"role": "user", "content": "Hello"}],
)
```

## Need more capacity?

If a per-model limit or upstream throttling blocks a production workload, contact [developer@aisa.one](mailto:developer@aisa.one) with the model or endpoint, your expected peak request rate, and a short description of the use case.

## Related

> [card] [Error Codes](https://aisa.one/docs/api-reference/errors.md)
>
> Response formats and retry guidance.

> [card] [Usage](https://aisa.one/docs/guides/dashboard/overview.md#usage)
>
> Per-request status and billing in the dashboard.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.