Claude Platform Docs

Установить ограничения скорости рабочего пространства

BetaWorkspaceRateLimit beta().organization().workspaces().rateLimits().update(params, requestOptions = RequestOptions.none())
POST/v1/organizations/workspaces/{workspace_id}/rate_limits/{rate_limit_id}

Задаёт или сбрасывает переопределения ограничений скорости для одной группы ограничений скорости в рабочем пространстве.

Изменяются только типы ограничителей, указанные в limits: целочисленное value задаёт переопределение для этого типа, а null сбрасывает его. Типы, не указанные в запросе, сохраняют текущее значение. Значение, превышающее собственное ограничение организации, сохраняется, но ограничение организации продолжает действовать, поэтому применяется меньшее из двух.

Возвращает запись целевой группы с применёнными изменениями в том же формате, что и GET /v1/organizations/workspaces/{workspace_id}/rate_limits. Изменения вступают в силу примерно в течение часа.

Parameters
RateLimitUpdateParams params
String workspaceId⁠Path parameter

The ID of the workspace.

Optional<String> rateLimitId⁠Path parameter

The id of the organization's rate-limit entry to set overrides for.

Limits to set or clear. Unspecified limit types are unchanged.

minItems1
maxItems16

Rate limiter type. input_tokens_per_minute counts every input token, cache reads included. input_tokens_per_minute_cache_aware does not count cache reads, and on current models the organization's input-token limit usually has this type. A workspace limit of either type applies alongside the organization's limit, not in place of it. Because cache reads count toward an input_tokens_per_minute limit, it can reject requests that read mostly from the cache while the organization's limit still has room.

One of the following:
FAST_ITPMCA("fast_itpmca")
FAST_OTPM("fast_otpm")
INPUT_TOKENS_PER_MINUTE("input_tokens_per_minute")
INPUT_TOKENS_PER_MINUTE_CACHE_AWARE("input_tokens_per_minute_cache_aware")
OUTPUT_TOKENS_PER_MINUTE("output_tokens_per_minute")
REQUESTS_PER_MINUTE("requests_per_minute")
TOKENS_PER_DAY("tokens_per_day")
TOKENS_PER_MINUTE("tokens_per_minute")
TOOL_USES_PER_SECOND("tool_uses_per_second")
Optional<Long> value

New limit value. Set to null to clear the workspace override and fall back to the organization limit.

minimum0
maximum9007199254740991
Returns
class BetaWorkspaceRateLimit { type = "workspace_rate_limit"; group; limits; /* 3 more */ }
Errors

Any method can also return the general HTTP errors.

SandboxEgressRestrictedExceptionHTTP status 403error code sandbox_egress_restricted

The request came from a Claude sandbox with restricted network access, which is not allowed to make this request. Send it from outside the sandbox, or from a sandbox with unrestricted network access.

Установить ограничения скорости рабочего пространства
package com.anthropic.example;

import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.beta.organization.workspaces.ratelimits.BetaWorkspaceRateLimit;
import com.anthropic.models.beta.organization.workspaces.ratelimits.BetaWorkspaceRateLimitType;
import com.anthropic.models.beta.organization.workspaces.ratelimits.BetaWorkspaceRateLimitUpdateValue;
import com.anthropic.models.beta.organization.workspaces.ratelimits.RateLimitUpdateParams;

public final class Main {
    private Main() {}

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

        RateLimitUpdateParams params = RateLimitUpdateParams.builder()
            .workspaceId("workspace_id")
            .rateLimitId("rate_limit_id")
            .addLimit(BetaWorkspaceRateLimitUpdateValue.builder()
                .type(BetaWorkspaceRateLimitType.FAST_ITPMCA)
                .value(0L)
                .build())
            .build();
        BetaWorkspaceRateLimit betaWorkspaceRateLimit = client.beta().organization().workspaces().rateLimits().update(params);
    }
}
Returns Examples
Response 200
{
  "group": {
    "id": "id",
    "display_name": "display_name",
    "type": "model_group"
  },
  "limits": [
    {
      "org_limit": 0,
      "source": {
        "type": "workspace"
      },
      "type": "type",
      "value": 0
    }
  ],
  "models": [
    "string"
  ],
  "rate_limit_id": "rate_limit_id",
  "type": "workspace_rate_limit",
  "workspace_id": "workspace_id"
}