Claude Platform Docs

Workspace-Ratenlimits festlegen

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

Legt Ratenlimit-Überschreibungen für eine Ratenlimit-Gruppe in einem Workspace fest oder entfernt sie.

Nur die in limits genannten Limiter-Typen ändern sich: Ein ganzzahliger value setzt die Überschreibung dieses Typs, und null entfernt sie. Nicht genannte Typen behalten ihren aktuellen Wert. Ein Wert über dem eigenen Limit der Organisation wird gespeichert, aber das Organisationslimit gilt weiterhin, sodass der niedrigere der beiden Werte durchgesetzt wird.

Gibt den Eintrag der betroffenen Gruppe mit angewendeter Anfrage zurück, in der Form, die GET /v1/organizations/workspaces/{workspace_id}/rate_limits zurückgibt. Änderungen werden innerhalb von etwa einer Stunde wirksam.

Parameters
rateLimitID string⁠Path parameter

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

params OrganizationWorkspaceRateLimitUpdateParams
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 WorkspaceRateLimitTypeFastItpmca WorkspaceRateLimitType = "fast_itpmca"
const WorkspaceRateLimitTypeFastOtpm WorkspaceRateLimitType = "fast_otpm"
const WorkspaceRateLimitTypeInputTokensPerMinute WorkspaceRateLimitType = "input_tokens_per_minute"
const WorkspaceRateLimitTypeInputTokensPerMinuteCacheAware WorkspaceRateLimitType = "input_tokens_per_minute_cache_aware"
const WorkspaceRateLimitTypeOutputTokensPerMinute WorkspaceRateLimitType = "output_tokens_per_minute"
const WorkspaceRateLimitTypeRequestsPerMinute WorkspaceRateLimitType = "requests_per_minute"
const WorkspaceRateLimitTypeTokensPerDay WorkspaceRateLimitType = "tokens_per_day"
const WorkspaceRateLimitTypeTokensPerMinute WorkspaceRateLimitType = "tokens_per_minute"
const WorkspaceRateLimitTypeToolUsesPerSecond WorkspaceRateLimitType = "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 WorkspaceRateLimit 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.

Workspace-Ratenlimits festlegen
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"),
	)
	workspaceRateLimit, err := client.Organization.Workspaces.RateLimits.Update(
		context.TODO(),
		"rate_limit_id",
		anthropic.OrganizationWorkspaceRateLimitUpdateParams{
			WorkspaceID: "workspace_id",
			Limits: []anthropic.WorkspaceRateLimitUpdateValueParam{{
				Type:  anthropic.WorkspaceRateLimitTypeFastItpmca,
				Value: anthropic.Int(0),
			}},
		},
	)
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", workspaceRateLimit.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"
}