安全护栏的控制范围
消费限额
为任意 API key 设置硬性信用额度限制。超出限额的请求将被拒绝并返回402 错误。
通过控制台
前往 API Keys → 编辑 Key → 设置信用限额。通过 API
达到限额时:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
对每个 API 请求强制执行组织策略。安全护栏控制可使用的模型、设置消费限额并配置数据保留策略,一切均可集中管理。
| 控制项 | 描述 |
|---|---|
| 模型允许列表 | 限制成员可使用的模型 |
| 提供商允许列表 | 限制请求可路由到的提供商 |
| 消费限额 | 每个 key 和每个组织的预算上限 |
| 频率限制 | 每个 key 或成员的请求频率限制 |
| 数据策略 | ZDR 强制执行、数据收集限制 |
402 错误。
curl -X PATCH https://api.arouter.ai/api/v1/keys/{key_hash} \
-H "Authorization: Bearer lr_admin_xxxx" \
-H "Content-Type: application/json" \
-d '{"limit_usd": 50.00}'
| 字段 | 类型 | 描述 |
|---|---|---|
limit_usd | number | 最大累计消费(美元)。null = 无限制。 |
{"error": {"code": 402, "message": "Credit limit exceeded for this API key.", "metadata": {"limit_usd": 50.00, "used_usd": 50.01}}}
curl -X PATCH https://api.arouter.ai/api/v1/keys/{key_hash} \
-H "Authorization: Bearer lr_admin_xxxx" \
-H "Content-Type: application/json" \
-d '{"rate_limit": {"requests_per_minute": 60, "requests_per_day": 1000}}'
| 字段 | 类型 | 描述 |
|---|---|---|
requests_per_minute | integer | 每分钟最大请求数。null = 无限制。 |
requests_per_day | integer | 每天最大请求数。null = 无限制。 |
curl -X PATCH https://api.arouter.ai/api/v1/keys/{key_hash} \
-H "Authorization: Bearer lr_admin_xxxx" \
-H "Content-Type: application/json" \
-d '{"allowed_models": ["openai/gpt-5.4", "anthropic/claude-sonnet-4.6", "google/gemini-2.5-flash"]}'
curl -X PATCH https://api.arouter.ai/api/v1/keys/{key_hash} \
-H "Authorization: Bearer lr_admin_xxxx" \
-H "Content-Type: application/json" \
-d '{"allowed_providers": ["OpenAI", "Anthropic"]}'
curl -X PATCH https://api.arouter.ai/api/v1/keys/{key_hash} \
-H "Authorization: Bearer lr_admin_xxxx" \
-H "Content-Type: application/json" \
-d '{"enforce_zdr": true}'
组织默认设置
└── API Key 覆盖
└── 每请求提供商对象