設定支出限制
POST/v1/organizations/spend_limits
設定支出限制。
以(scope, period)為鍵進行 upsert:設定已存在的限制
會就地覆寫。Claude Enterprise 組織設定 user
限制。其席位層級、群組及組織層級的預設值則在
claude.ai 中設定。Claude Console 組織設定 organization 與
workspace 限制,這些限制以每月計算且一律帶有金額。設定這些
限制目前處於搶先體驗預覽階段。如需申請存取權,請聯絡您的
Anthropic 客戶團隊。
Parameters
Returns
設定支出限制
import os
from anthropic import Anthropic
client = Anthropic(
api_key=os.environ.get(
"ANTHROPIC_API_KEY"
), # This is the default and can be omitted
)
beta_spend_limit = client.beta.organization.spend_limits.set(
amount="50000",
scope={
"type": "user",
"user_id": "user_01WCz1FkmYMm4gnmykNKUu3Q",
},
)
print(beta_spend_limit.id)Response 200
{
"id": "id",
"amount": "50000",
"created_at": "2019-12-27T18:11:19.117Z",
"currency": "USD",
"is_enabled": true,
"period": "daily",
"scope": {
"type": "user",
"user_id": "user_01WCz1FkmYMm4gnmykNKUu3Q"
},
"type": "spend_limit",
"updated_at": "2019-12-27T18:11:19.117Z"
}Returns Examples
Response 200
{
"id": "id",
"amount": "50000",
"created_at": "2019-12-27T18:11:19.117Z",
"currency": "USD",
"is_enabled": true,
"period": "daily",
"scope": {
"type": "user",
"user_id": "user_01WCz1FkmYMm4gnmykNKUu3Q"
},
"type": "spend_limit",
"updated_at": "2019-12-27T18:11:19.117Z"
}