設定支出限制
POST/v1/organizations/spend_limits
設定支出限制。
以(scope, period)為鍵進行 upsert:設定已存在的限制
會就地覆寫。Claude Enterprise 組織設定 user
限制。其席位層級、群組及組織層級的預設值則在
claude.ai 中設定。Claude Console 組織設定 organization 與
workspace 限制,這些限制以每月計算且一律帶有金額。設定這些
限制目前處於搶先體驗預覽階段。如需申請存取權,請聯絡您的
Anthropic 客戶團隊。
Parameters
Returns
設定支出限制
package com.anthropic.example;
import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.beta.organization.spendlimits.BetaSpendLimit;
import com.anthropic.models.beta.organization.spendlimits.SpendLimitSetParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
AnthropicClient client = AnthropicOkHttpClient.fromEnv();
SpendLimitSetParams params = SpendLimitSetParams.builder()
.amount("50000")
.userScope("user_01WCz1FkmYMm4gnmykNKUu3Q")
.build();
BetaSpendLimit betaSpendLimit = client.beta().organization().spendLimits().set(params);
}
}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"
}