Imposta limite di spesa
POST/v1/organizations/spend_limits
Imposta un limite di spesa.
Upsert con chiave (scope, periodo): impostare un limite già esistente
lo sovrascrive. Un'organizzazione Claude Enterprise imposta limiti user.
I valori predefiniti per livello di licenza, gruppo e organizzazione si configurano
in claude.ai. Un'organizzazione Claude Console imposta limiti organization e
workspace, che sono mensili e hanno sempre un importo. L'impostazione di questi
limiti è in anteprima ad accesso anticipato. Per richiedere l'accesso, contatta il tuo
team di account Anthropic.
Parameters
Returns
Imposta limite di spesa
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"
}