Claude Platform Docs

Imposta i limiti di velocità del workspace

client.Beta.Organization.Workspaces.RateLimits.Update(ctx, rateLimitID, params) (*BetaWorkspaceRateLimit, error)
POST/v1/organizations/workspaces/{workspace_id}/rate_limits/{rate_limit_id}

Imposta o rimuovi gli override dei limiti di velocità per un gruppo di limiti di velocità in un workspace.

Cambiano solo i tipi di limitatore indicati in limits: un value intero imposta l'override di quel tipo e null lo rimuove. I tipi non indicati mantengono il loro valore attuale. Un valore superiore al limite dell'organizzazione viene memorizzato, ma il limite dell'organizzazione continua ad applicarsi, quindi viene applicato il minore dei due.

Restituisce la voce del gruppo interessato con questa richiesta applicata, nella forma restituita da GET /v1/organizations/workspaces/{workspace_id}/rate_limits. Le modifiche hanno effetto entro circa un'ora.

Parameters
rateLimitID string⁠Path parameter

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

params BetaOrganizationWorkspaceRateLimitUpdateParams
WorkspaceID string⁠Path parameter

The ID of the workspace.

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:
const BetaWorkspaceRateLimitTypeFastItpmca BetaWorkspaceRateLimitType = "fast_itpmca"
const BetaWorkspaceRateLimitTypeFastOtpm BetaWorkspaceRateLimitType = "fast_otpm"
const BetaWorkspaceRateLimitTypeInputTokensPerMinute BetaWorkspaceRateLimitType = "input_tokens_per_minute"
const BetaWorkspaceRateLimitTypeInputTokensPerMinuteCacheAware BetaWorkspaceRateLimitType = "input_tokens_per_minute_cache_aware"
const BetaWorkspaceRateLimitTypeOutputTokensPerMinute BetaWorkspaceRateLimitType = "output_tokens_per_minute"
const BetaWorkspaceRateLimitTypeRequestsPerMinute BetaWorkspaceRateLimitType = "requests_per_minute"
const BetaWorkspaceRateLimitTypeTokensPerDay BetaWorkspaceRateLimitType = "tokens_per_day"
const BetaWorkspaceRateLimitTypeTokensPerMinute BetaWorkspaceRateLimitType = "tokens_per_minute"
const BetaWorkspaceRateLimitTypeToolUsesPerSecond BetaWorkspaceRateLimitType = "tool_uses_per_second"
Value int64

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

minimum0
maximum9007199254740991
Returns
type BetaWorkspaceRateLimit struct { Type: "workspace_rate_limit"; Group; Limits; /* 3 more */ }
Errors

Any method can also return the general HTTP errors.

ErrorCodeSandboxEgressRestrictedHTTP 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.

Imposta i limiti di velocità del workspace
package main

import (
	"context"
	"fmt"

	"github.com/anthropics/anthropic-sdk-go/v2"
	"github.com/anthropics/anthropic-sdk-go/v2/option"
)

func main() {
	client := anthropic.NewClient(
		option.WithAPIKey("my-anthropic-api-key"),
	)
	betaWorkspaceRateLimit, err := client.Beta.Organization.Workspaces.RateLimits.Update(
		context.TODO(),
		"rate_limit_id",
		anthropic.BetaOrganizationWorkspaceRateLimitUpdateParams{
			WorkspaceID: "workspace_id",
			Limits: []anthropic.BetaWorkspaceRateLimitUpdateValueParam{{
				Type:  anthropic.BetaWorkspaceRateLimitTypeFastItpmca,
				Value: anthropic.Int(0),
			}},
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", betaWorkspaceRateLimit.RateLimitID)
}
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"
}