UNPKG

@anthropic-ai/sdk

Version:
154 lines • 6.36 kB
import { APIResource } from "../../core/resource.mjs"; import { PageCursor, type PageCursorParams, PagePromise } from "../../core/pagination.mjs"; import { RequestOptions } from "../../internal/request-options.mjs"; export declare class RateLimits extends APIResource { /** * List Messages API rate limits for your organization. * * Each entry corresponds to one rate-limit group (either a model family or an * API-surface category such as the Message Batches API or the web search tool) and * contains the set of limiter values that apply to it. * * When `limit` is omitted, every matching entry is returned in a single page; when * `limit` truncates the result, follow `next_page` to fetch the remaining entries. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const organizationRateLimit of client.organization.rateLimits.list()) { * // ... * } * ``` */ list(query?: RateLimitListParams | null | undefined, options?: RequestOptions): PagePromise<OrganizationRateLimitsPageCursor, OrganizationRateLimit>; } export type OrganizationRateLimitsPageCursor = PageCursor<OrganizationRateLimit>; export interface OrganizationRateLimit { /** * Identifier of this rate-limit entry. It is stable within the organization and * differs between organizations; the group's own identifier is `group.id`. Pass it * as `rate_limit_id` to set a workspace's overrides for this group. */ id: string; /** * The rate-limit group this entry's limits apply to. */ group: OrganizationRateLimitModelGroup | OrganizationRateLimitBatchGroup | OrganizationRateLimitTokenCountGroup | OrganizationRateLimitFilesGroup | OrganizationRateLimitSkillsGroup | OrganizationRateLimitWebSearchGroup; /** * The limiter values that apply to this group. */ limits: Array<OrganizationRateLimitValue>; /** * Model names this entry's limits apply to, including aliases. `null` when * `group.type` is not `"model_group"`. */ models: Array<string> | null; /** * Object type. Always `rate_limit` for organization rate-limit entries. */ type: 'rate_limit'; } export interface OrganizationRateLimitBatchGroup { /** * Opaque identifier of the rate-limit group (for example, * `rlg_01VPTCmyiu5ZLsWkcxYG2pY8`). It is the same in every organization and never * changes, unlike the entry's own identifier, which differs per organization. */ id: string; /** * Always `batch`: the Message Batches API. */ type: 'batch'; } export interface OrganizationRateLimitFilesGroup { /** * Opaque identifier of the rate-limit group (for example, * `rlg_01VPTCmyiu5ZLsWkcxYG2pY8`). It is the same in every organization and never * changes, unlike the entry's own identifier, which differs per organization. */ id: string; /** * Always `files`: the Files API. */ type: 'files'; } export interface OrganizationRateLimitModelGroup { /** * Opaque identifier of the rate-limit group (for example, * `rlg_01VPTCmyiu5ZLsWkcxYG2pY8`). It is the same in every organization and never * changes, unlike the entry's own identifier, which differs per organization. */ id: string; /** * Human-readable name of the model group (for example, `Claude Sonnet 4.x`). For * display only; it may change. */ display_name: string; /** * Always `model_group`: a family of models. */ type: 'model_group'; } export interface OrganizationRateLimitSkillsGroup { /** * Opaque identifier of the rate-limit group (for example, * `rlg_01VPTCmyiu5ZLsWkcxYG2pY8`). It is the same in every organization and never * changes, unlike the entry's own identifier, which differs per organization. */ id: string; /** * Always `skills`: the Skills API. */ type: 'skills'; } export interface OrganizationRateLimitTokenCountGroup { /** * Opaque identifier of the rate-limit group (for example, * `rlg_01VPTCmyiu5ZLsWkcxYG2pY8`). It is the same in every organization and never * changes, unlike the entry's own identifier, which differs per organization. */ id: string; /** * Always `token_count`: the Token Count API. */ type: 'token_count'; } export interface OrganizationRateLimitValue { /** * The limiter type (for example, `requests_per_minute` or * `input_tokens_per_minute`). */ type: string; /** * The configured limit value for this limiter type. */ value: number; } export interface OrganizationRateLimitWebSearchGroup { /** * Opaque identifier of the rate-limit group (for example, * `rlg_01VPTCmyiu5ZLsWkcxYG2pY8`). It is the same in every organization and never * changes, unlike the entry's own identifier, which differs per organization. */ id: string; /** * Always `web_search`: the Messages API web search tool. */ type: 'web_search'; } export interface RateLimitListParams extends PageCursorParams { /** * Filter by group type. */ group_type?: 'batch' | 'files' | 'model_group' | 'skills' | 'token_count' | 'web_search' | null; /** * Filter to the single entry containing this model. Accepts full model names and * aliases. Returns 404 if the model is not found or has no rate limits for this * organization. */ model?: string | null; } export declare namespace RateLimits { export { type OrganizationRateLimit as OrganizationRateLimit, type OrganizationRateLimitBatchGroup as OrganizationRateLimitBatchGroup, type OrganizationRateLimitFilesGroup as OrganizationRateLimitFilesGroup, type OrganizationRateLimitModelGroup as OrganizationRateLimitModelGroup, type OrganizationRateLimitSkillsGroup as OrganizationRateLimitSkillsGroup, type OrganizationRateLimitTokenCountGroup as OrganizationRateLimitTokenCountGroup, type OrganizationRateLimitValue as OrganizationRateLimitValue, type OrganizationRateLimitWebSearchGroup as OrganizationRateLimitWebSearchGroup, type OrganizationRateLimitsPageCursor as OrganizationRateLimitsPageCursor, type RateLimitListParams as RateLimitListParams, }; } //# sourceMappingURL=rate-limits.d.mts.map