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

# 速率限制

> ARouter API 速率限制、基于积分的配额，以及如何查看当前限制。

ARouter 实施速率限制以确保公平访问并保护服务可用性。创建更多账户或 API Key **不会**增加速率限制 — 容量按账户全局管理。

## 查看当前限制

要查看 API Key 的速率限制或剩余积分，请向 `/v1/key` 发起 `GET` 请求：

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    import requests

    response = requests.get(
        "https://api.arouter.ai/v1/key",
        headers={"Authorization": f"Bearer {AROUTER_API_KEY}"}
    )
    print(response.json())
    ```
  </Tab>

  <Tab title="Node.js">
    ```typescript theme={null}
    const response = await fetch("https://api.arouter.ai/v1/key", {
      headers: { Authorization: `Bearer ${process.env.AROUTER_API_KEY}` },
    });
    const keyInfo = await response.json();
    console.log(keyInfo);
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl https://api.arouter.ai/v1/key \
      -H "Authorization: Bearer $AROUTER_API_KEY"
    ```
  </Tab>
</Tabs>

有效的 API Key 将返回：

```json theme={null}
{
  "data": {
    "label": "my-key",
    "limit": 100.0,
    "limit_reset": "monthly",
    "limit_remaining": 72.45,
    "usage": 27.55,
    "usage_daily": 2.10,
    "usage_weekly": 8.40,
    "usage_monthly": 27.55,
    "is_free_tier": false
  }
}
```

| 字段                                     | 说明                                        |
| -------------------------------------- | ----------------------------------------- |
| `limit`                                | 此密钥的积分限额（null = 无限制）                      |
| `limit_reset`                          | 限额重置时间（`daily`、`weekly`、`monthly` 或 null） |
| `limit_remaining`                      | 密钥被封锁前剩余的积分                               |
| `usage`                                | 历史累计消耗的积分                                 |
| `usage_daily` / `_weekly` / `_monthly` | 当前 UTC 周期的使用量                             |
| `is_free_tier`                         | 账户是否曾购买积分                                 |

## 免费套餐限制

ID 以 `:free` 结尾的模型无需购买积分即可使用，但受以下限制：

| 条件            | RPM     | RPD       |
| ------------- | ------- | --------- |
| 未购买付费积分       | 20 次/分钟 | 50 次/天    |
| 已购买至少 \$5 的积分 | 20 次/分钟 | 1,000 次/天 |

<Note>
  免费套餐限制仅适用于免费模型变体（后缀 `:free`）。付费模型需要积分余额。
</Note>

## DDoS 防护

Cloudflare 的 DDoS 防护会自动拦截明显超出合理使用模式的请求。这些拦截是临时的，待流量恢复正常后自动解除。

## 余额为负

如果账户积分余额为负，可能会看到 `402 Payment Required` 错误——包括在免费模型上。充值使余额恢复到零以上即可恢复访问。

## 单密钥消费限额

您可以在单个 API Key 上配置消费限额以控制成本：

* **限额**：密钥可消耗的最大积分
* **重置间隔**：`daily`、`weekly`、`monthly` 或 `never`

通过[密钥管理 API](/zh/api-reference/keys/create-key) 在创建或更新密钥时设置限额。

## 模型特定限制

某些高需求模型可能有独立于账户总配额的额外单模型速率限制。如果在特定模型上遇到 `429 Too Many Requests` 错误，请考虑：

* 使用 `:floor` 或 `:nitro` 变体以访问不同的服务商端点
* 指定有序的候选模型列表以将负载分散到多个模型
* 在客户端实现指数退避和重试逻辑

请参阅[错误处理](/zh/guides/error-handling)了解重试最佳实践。
