設定支出限制
POST/v1/organizations/spend_limits
設定支出限制。
以(scope, period)為鍵進行 upsert:設定已存在的限制
會就地覆寫。Claude Enterprise 組織設定 user
限制。其席位層級、群組及組織層級的預設值則在
claude.ai 中設定。Claude Console 組織設定 organization 與
workspace 限制,這些限制以每月計算且一律帶有金額。設定這些
限制目前處於搶先體驗預覽階段。如需申請存取權,請聯絡您的
Anthropic 客戶團隊。
Parameters
Returns
設定支出限制
<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Anthropic\Client;
use Anthropic\Beta\AnthropicBeta;
use Anthropic\Beta\Organization\SpendLimits\SpendLimitPeriod;
$client = new Client(apiKey: 'my-anthropic-api-key');
$betaSpendLimit = $client->beta->organization->spendLimits->set(
amount: '50000',
scope: ['type' => 'user', 'userID' => 'user_01WxYzAbCdEfGhJkMnPqRsTu'],
period: SpendLimitPeriod::MONTHLY,
betas: [AnthropicBeta::MESSAGE_BATCHES_2024_09_24],
);
var_dump($betaSpendLimit);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_01WxYzAbCdEfGhJkMnPqRsTu"
},
"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_01WxYzAbCdEfGhJkMnPqRsTu"
},
"type": "spend_limit",
"updated_at": "2019-12-27T18:11:19.117Z"
}