設定支出限制
POST/v1/organizations/spend_limits
設定支出限制。
以(scope, period)為鍵進行 upsert:設定已存在的限制
會就地覆寫。Claude Enterprise 組織設定 user
限制。其席位層級、群組及組織層級的預設值則在
claude.ai 中設定。Claude Console 組織設定 organization 與
workspace 限制,這些限制以每月計算且一律帶有金額。設定這些
限制目前處於搶先體驗預覽階段。如需申請存取權,請聯絡您的
Anthropic 客戶團隊。
Parameters
Returns
設定支出限制
package main
import (
"context"
"fmt"
"github.com/anthropics/anthropic-sdk-go"
"github.com/anthropics/anthropic-sdk-go/option"
)
func main() {
client := anthropic.NewClient(
option.WithAPIKey("my-anthropic-api-key"),
)
betaSpendLimit, err := client.Beta.Organization.SpendLimits.Set(context.TODO(), anthropic.BetaOrganizationSpendLimitSetParams{
Amount: anthropic.String("50000"),
Scope: anthropic.BetaOrganizationSpendLimitSetParamsScopeUnion{
OfUser: &anthropic.BetaSpendLimitUserScopeParam{
UserID: "user_01WCz1FkmYMm4gnmykNKUu3Q",
},
},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", betaSpendLimit.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"
}