Claude Platform Docs

Ausgabenlimit abrufen

client.Beta.Organization.SpendLimits.Get(ctx, spendLimitID) (*BetaSpendLimit, error)
GET/v1/organizations/spend_limits/{spend_limit_id}

Ruft ein Ausgabenlimit anhand seiner ID ab.

Parameters
spendLimitID string⁠Path parameter

ID of the Spend Limit.

Returns
type BetaSpendLimit struct { Type: "spend_limit"; ID; Amount; /* 6 more */ }

A configured spend limit: a cap on metered spend for one scope and period.

Ausgabenlimit abrufen
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.Get(context.TODO(), "spend_limit_id")
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", betaSpendLimit.ID)
}
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"
}