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 key 和所有请求的策略。
安全护栏的控制范围
| 控制项 | 描述 |
|---|
| 模型允许列表 | 限制成员可使用的模型 |
| 提供商允许列表 | 限制请求可路由到的提供商 |
| 消费限额 | 每个 key 和每个组织的预算上限 |
| 频率限制 | 每个 key 或成员的请求频率限制 |
| 数据策略 | ZDR 强制执行、数据收集限制 |
消费限额
为任意 API key 设置硬性信用额度限制。超出限额的请求将被拒绝并返回 402 错误。
通过控制台
前往 API Keys → 编辑 Key → 设置信用限额。
通过 API
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 覆盖
└── 每请求提供商对象
相关文档