跳轉到主要內容

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_usdnumber最大累計消費(美元)。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_minuteinteger每分鐘最大請求數。null = 無限制。
requests_per_dayinteger每天最大請求數。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 覆蓋
        └── 每請求提供商物件

相關文件