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

# 速率限制

> 基于账户等级的 API 速率限制

## 限流规则

您的 API 速率限制由账户等级决定。余额会在每个请求前单独检查；余额不再动态决定 RPM。

### 账户等级

系统会根据合格的成功付款记录自动分配账户等级。

| 等级       | 条件                              | RPM |
| -------- | ------------------------------- | --- |
| `tier_0` | 没有合格付款                          | 6   |
| `tier_1` | 合格付款累计至少 \$5                    | 30  |
| `tier_2` | 合格付款累计至少 \$50，且首次合格付款超过 7 天     | 120 |
| `tier_3` | 合格付款累计至少 \$250，且首次合格付款超过 7 天    | 300 |
| `tier_4` | 合格付款累计至少 \$1,000，且首次合格付款超过 14 天 | 600 |

合格付款指真实成功的客户付款。赠送额度、补偿、账务修正和手动调整默认不一定计入自动等级，除非由 PipeLLM 标记为合格付款。

### 企业和自定义限额

企业客户可以获得自定义 RPM override。自定义 override 会优先于自动等级限额生效。

需要更高限额？联系我们：[support@pipellm.ai](mailto:support@pipellm.ai)

## 余额保护

为防止意外超额使用，平台在处理每个请求前会进行 **实时余额检查**。如果余额不足，请求将被拒绝并返回 `402` 状态码。

### 余额不足响应 (402)

```json theme={null}
{
  "error": {
    "type": "insufficient_balance",
    "code": "balance_exceeded",
    "message": "Insufficient balance. Please recharge to continue."
  }
}
```

## 速率限制响应 (429)

```json theme={null}
{
  "error": {
    "type": "rate_limit_error",
    "code": "rate_limit_exceeded",
    "message": "Rate limit exceeded. Your current limit is 120 requests per minute (approximately 2.00 requests per second). Please visit https://console.pipellm.ai/billing to upgrade your plan for higher limits."
  }
}
```

## 速率限制 Headers

每个 API 响应都包含速率限制信息：

| Header                           | 描述        |
| -------------------------------- | --------- |
| `x-ratelimit-limit-requests`     | 当前 RPM 限制 |
| `x-ratelimit-remaining-requests` | 当前窗口剩余请求数 |
| `x-ratelimit-reset-requests`     | 窗口重置时间    |
