Claude Platform Docs

取得支出限制

BetaSpendLimit beta().organization().spendLimits().retrieve(params = SpendLimitRetrieveParams.none(), requestOptions = RequestOptions.none())
GET/v1/organizations/spend_limits/{spend_limit_id}

依 ID 擷取支出限制。

Parameters
SpendLimitRetrieveParams params
Optional<String> spendLimitId⁠Path parameter

ID of the Spend Limit.

Returns
class BetaSpendLimit { type = "spend_limit"; id; amount; /* 6 more */ }

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

Errors

Any method can also return the general HTTP errors.

BetaSpendLimitsAdminApiWritesNotEnabledExceptionHTTP status 403error code spend_limits_admin_api_writes_not_enabled

The organization cannot retrieve, set or delete spend limits with an Admin API credential.

取得支出限制
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.SpendLimitRetrieveParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        AnthropicClient client = AnthropicOkHttpClient.fromEnv();

        BetaSpendLimit betaSpendLimit = client.beta().organization().spendLimits().retrieve("spend_limit_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_01WxYzAbCdEfGhJkMnPqRsTu"
  },
  "type": "spend_limit",
  "updated_at": "2019-12-27T18:11:19.117Z"
}