@anthropic-ai/sdk
Version:
The official TypeScript library for the Anthropic API
432 lines • 21.6 kB
TypeScript
import * as FilesAPI from "./files.js";
import * as BetaAPI from "./beta/beta.js";
import * as MessagesAPI from "./messages/messages.js";
import * as APIKeysAPI from "./organization/api-keys.js";
import * as ExternalKeysAPI from "./organization/external-keys.js";
import * as InvitesAPI from "./organization/invites.js";
import * as OrganizationAPI from "./organization/organization.js";
import * as UsersAPI from "./organization/users.js";
import * as SkillsAPI from "./skills/skills.js";
import * as UserProfilesAPI from "./user-profiles/user-profiles.js";
import * as EnvironmentsAPI from "./beta/environments/environments.js";
import * as WorkAPI from "./beta/environments/work.js";
import * as OrganizationUsersAPI from "./beta/organization/users.js";
import * as RBACGroupsAPI from "./organization/rbac-groups/rbac-groups.js";
import * as WorkspacesAPI from "./organization/workspaces/workspaces.js";
import * as ClaudeTagAPI from "./beta/organization/claude-tag/claude-tag.js";
import * as PluginsAPI from "./beta/organization/plugins/plugins.js";
import * as OrganizationRBACGroupsAPI from "./beta/organization/rbac-groups/rbac-groups.js";
import * as SpendLimitsAPI from "./beta/organization/spend-limits/spend-limits.js";
import * as ManagedSettingsAPI from "./beta/organization/claude-code/managed-settings/managed-settings.js";
import { BadRequestError, ContentTooLargeError, PaymentRequiredError, PermissionDeniedError, RateLimitError as ErrorsRateLimitError, ServiceUnavailableError } from "../core/error.js";
/**
* The API key belongs to the Claude Code workspace, and the user who created it is
* no longer a member of the organization or of that workspace.
*/
export declare class ClaudeCodeKeyCreatorNotMemberError extends BadRequestError {
readonly errorCode: 'claude_code_key_creator_not_member';
readonly details: ClaudeCodeKeyCreatorNotMemberErrorDetails;
}
/**
* The request comes from a Claude Code version older than the minimum that the
* requested model or the organization requires. Update Claude Code, then retry.
*/
export declare class ClaudeCodeVersionTooOldError extends BadRequestError {
readonly errorCode: 'claude_code_version_too_old';
readonly details: ClaudeCodeVersionTooOldErrorDetails;
}
/**
* The workspace's customer-managed encryption key is disabled or revoked.
* Re-enable the key, then retry.
*/
export declare class CMEKKeyDisabledError extends BadRequestError {
readonly errorCode: 'cmek_key_disabled';
readonly details: CMEKKeyDisabledErrorDetails;
}
/**
* The key management service's network access controls blocked the request to the
* workspace's customer-managed encryption key. The key itself may be healthy.
*/
export declare class CMEKKeyNetworkBlockedError extends BadRequestError {
readonly errorCode: 'cmek_key_network_blocked';
readonly details: CMEKKeyNetworkBlockedErrorDetails;
}
/**
* Anthropic has disabled the organization for trust and safety reasons. An
* organization disabled for any other reason, such as billing, does not get this
* code. `appeal_url`, when present, is where the organization can appeal.
*/
export declare class OrganizationOnHoldError extends BadRequestError {
readonly errorCode: 'organization_on_hold';
readonly details: OrganizationOnHoldErrorDetails;
}
/**
* The endpoint does not support the organization's type. Each endpoint's
* description says which organization types it supports.
*/
export declare class OrganizationTypeNotSupportedError extends BadRequestError {
readonly errorCode: 'organization_type_not_supported';
readonly details: OrganizationTypeNotSupportedErrorDetails;
}
/**
* The endpoint serves only organizations that belong to a parent organization, and
* this organization belongs to none.
*/
export declare class ParentOrganizationRequiredError extends BadRequestError {
readonly errorCode: 'parent_organization_required';
readonly details: ParentOrganizationRequiredErrorDetails;
}
/**
* The request body is not valid for its `Content-Encoding`.
*/
export declare class RequestBodyEncodingInvalidError extends BadRequestError {
readonly errorCode: 'request_body_encoding_invalid';
readonly details: RequestBodyEncodingInvalidErrorDetails;
}
/**
* The request's `Content-Encoding` is not supported.
*/
export declare class RequestBodyEncodingUnsupportedError extends BadRequestError {
readonly errorCode: 'request_body_encoding_unsupported';
readonly details: RequestBodyEncodingUnsupportedErrorDetails;
}
/**
* Anthropic cannot currently bill the organization linked to the request's user
* profile, for a reason that lies with that organization's own account. The
* response does not say what the reason is.
*/
export declare class LinkedOrganizationBillingUnavailableError extends PaymentRequiredError {
readonly errorCode: 'linked_organization_billing_unavailable';
readonly details: LinkedOrganizationBillingUnavailableErrorDetails;
}
/**
* The organization linked to the request's user profile has reached a spend limit
* that it set, or lacks credit for the request. The response does not say which
* applies.
*/
export declare class LinkedOrganizationSpendLimitReachedError extends PaymentRequiredError {
readonly errorCode: 'linked_organization_spend_limit_reached';
readonly details: LinkedOrganizationSpendLimitReachedErrorDetails;
}
/**
* 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.
*/
export declare class SandboxEgressRestrictedError extends PermissionDeniedError {
readonly errorCode: 'sandbox_egress_restricted';
readonly details: SandboxEgressRestrictedErrorDetails;
}
/**
* The compressed request body exceeds the request size limit once decoded.
*/
export declare class RequestBodyTooLargeAfterDecodingError extends ContentTooLargeError {
readonly errorCode: 'request_body_too_large_after_decoding';
readonly details: RequestBodyTooLargeAfterDecodingErrorDetails;
}
/**
* The organization has reached the spend limit of its contract.
*/
export declare class ContractSpendLimitReachedError extends ErrorsRateLimitError {
readonly errorCode: 'contract_spend_limit_reached';
readonly details: ContractSpendLimitReachedErrorDetails;
}
/**
* The organization has crossed the monthly API usage threshold of its API tier.
*/
export declare class EnforcedSpendLimitReachedError extends ErrorsRateLimitError {
readonly errorCode: 'enforced_spend_limit_reached';
readonly details: EnforcedSpendLimitReachedErrorDetails;
}
/**
* The request would exceed a ramp limit, which caps how fast usage can grow. Retry
* after the time in the `retry-after` header.
*/
export declare class RampLimitExceededError extends ErrorsRateLimitError {
readonly errorCode: 'ramp_limit_exceeded';
readonly details: RampLimitExceededErrorDetails;
}
/**
* The workspace's encryption settings could not be read, so the request was
* refused. Retry in a few minutes.
*/
export declare class CMEKContextUnavailableError extends ServiceUnavailableError {
readonly errorCode: 'cmek_context_unavailable';
readonly details: CMEKContextUnavailableErrorDetails;
}
/**
* The workspace's customer-managed encryption key could not be reached. Retry the
* request; if this continues, check that the key is available in your key
* management service, or contact Anthropic support.
*/
export declare class CMEKKeyUnreachableError extends ServiceUnavailableError {
readonly errorCode: 'cmek_key_unreachable';
readonly details: CMEKKeyUnreachableErrorDetails;
}
export interface APIErrorObject {
/**
* A human-readable explanation of the error. Its wording can change, so don't
* match on it.
*/
message: string;
/**
* The broad category of the error.
*/
type: 'api_error';
}
export interface AuthenticationErrorObject {
/**
* A human-readable explanation of the error. Its wording can change, so don't
* match on it.
*/
message: string;
/**
* The broad category of the error.
*/
type: 'authentication_error';
}
export interface BillingErrorObject {
/**
* A human-readable explanation of the error. Its wording can change, so don't
* match on it.
*/
message: string;
/**
* The broad category of the error.
*/
type: 'billing_error';
}
/**
* The API key belongs to the Claude Code workspace, and the user who created it is
* no longer a member of the organization or of that workspace.
*/
export interface ClaudeCodeKeyCreatorNotMemberErrorDetails {
error_code: 'claude_code_key_creator_not_member';
}
/**
* The request comes from a Claude Code version older than the minimum that the
* requested model or the organization requires. Update Claude Code, then retry.
*/
export interface ClaudeCodeVersionTooOldErrorDetails {
error_code: 'claude_code_version_too_old';
}
/**
* The workspace's encryption settings could not be read, so the request was
* refused. Retry in a few minutes.
*/
export interface CMEKContextUnavailableErrorDetails {
error_code: 'cmek_context_unavailable';
}
/**
* The workspace's customer-managed encryption key is disabled or revoked.
* Re-enable the key, then retry.
*/
export interface CMEKKeyDisabledErrorDetails {
error_code: 'cmek_key_disabled';
}
/**
* The key management service's network access controls blocked the request to the
* workspace's customer-managed encryption key. The key itself may be healthy.
*/
export interface CMEKKeyNetworkBlockedErrorDetails {
error_code: 'cmek_key_network_blocked';
}
/**
* The workspace's customer-managed encryption key could not be reached. Retry the
* request; if this continues, check that the key is available in your key
* management service, or contact Anthropic support.
*/
export interface CMEKKeyUnreachableErrorDetails {
error_code: 'cmek_key_unreachable';
}
/**
* The organization has reached the spend limit of its contract.
*/
export interface ContractSpendLimitReachedErrorDetails {
error_code: 'contract_spend_limit_reached';
}
/**
* The organization has crossed the monthly API usage threshold of its API tier.
*/
export interface EnforcedSpendLimitReachedErrorDetails {
error_code: 'enforced_spend_limit_reached';
}
export type ErrorDetails = MessagesAPI.AvailableToolsLimitExceededErrorDetails | ClaudeCodeKeyCreatorNotMemberErrorDetails | ClaudeCodeVersionTooOldErrorDetails | CMEKKeyDisabledErrorDetails | CMEKKeyNetworkBlockedErrorDetails | MessagesAPI.CompactionBlockAmbiguousErrorDetails | MessagesAPI.CompactionBlockMisplacedErrorDetails | MessagesAPI.CompactionContentMismatchErrorDetails | MessagesAPI.CompactionIncompleteTurnErrorDetails | MessagesAPI.CompactionNothingToSummarizeErrorDetails | MessagesAPI.CompactionSignatureInvalidErrorDetails | MessagesAPI.CompactionTooManyToolReferencesErrorDetails | MessagesAPI.CompactionToolChangesMismatchErrorDetails | MessagesAPI.ImageDimensionsTooLargeErrorDetails | OrganizationOnHoldErrorDetails | RequestBodyEncodingInvalidErrorDetails | RequestBodyEncodingUnsupportedErrorDetails | MessagesAPI.ThreadAlreadyContinuedErrorDetails | MessagesAPI.ThreadContinueInFlightErrorDetails | MessagesAPI.ThreadFingerprintMismatchErrorDetails | MessagesAPI.ThreadUnsupportedRequestErrorDetails | MessagesAPI.ToolNameConflictErrorDetails | MessagesAPI.ToolReferenceUnresolvedErrorDetails | UserProfilesAPI.UserProfileRequiredErrorDetails | LinkedOrganizationBillingUnavailableErrorDetails | LinkedOrganizationSpendLimitReachedErrorDetails | UserProfilesAPI.UserProfileBillingNotAuthorizedErrorDetails | UserProfilesAPI.UserProfileNotBillableErrorDetails | MessagesAPI.ThreadNotFoundErrorDetails | SkillsAPI.SkillReadBlockedUndecryptableErrorDetails | RequestBodyTooLargeAfterDecodingErrorDetails | ContractSpendLimitReachedErrorDetails | EnforcedSpendLimitReachedErrorDetails | RampLimitExceededErrorDetails | CMEKKeyUnreachableErrorDetails | MessagesAPI.CompactionUnavailableErrorDetails | FilesAPI.StorageQuotaExceededErrorDetails | FilesAPI.FileNotDownloadableErrorDetails | FilesAPI.FileExpiredErrorDetails | CMEKContextUnavailableErrorDetails | APIKeysAPI.OrgAPIKeyLimitExceededErrorDetails | APIKeysAPI.WorkspaceAPIKeyLimitExceededErrorDetails | SandboxEgressRestrictedErrorDetails | UserProfilesAPI.UserProfileNotFoundErrorDetails | ExternalKeysAPI.ExternalKeyInWorkspacePolicyErrorDetails | InvitesAPI.AlreadyMemberErrorDetails | InvitesAPI.CannotInviteEmailsWithUnverifiedDomainsErrorDetails | InvitesAPI.EmailDomainNotAllowedErrorDetails | InvitesAPI.InviteAlreadyExistsErrorDetails | OrganizationAPI.OrgMemberLimitExceededErrorDetails | RBACGroupsAPI.RBACGroupGrantsOwnerAccessErrorDetails | RBACGroupsAPI.RBACGroupOwnerAccessUnconfirmedErrorDetails | UsersAPI.CannotRemoveLastMemberErrorDetails | OrganizationAPI.ConcurrentMembershipChangeErrorDetails | ExternalKeysAPI.ExternalKeyValidationFailedErrorDetails | ExternalKeysAPI.ExternalKeyValidationTimedOutErrorDetails | WorkspacesAPI.KeyProfileMismatchErrorDetails | WorkspacesAPI.WorkspacePolicyViolationErrorDetails | ExternalKeysAPI.ExternalKeyChangedErrorDetails | WorkspacesAPI.WorkspaceMemberLimitExceededErrorDetails | OrganizationTypeNotSupportedErrorDetails | ParentOrganizationRequiredErrorDetails | OrganizationAPI.RBACRoleNotFoundErrorDetails | EnvironmentsAPI.BetaEnvironmentCreateDisabledErrorDetails | EnvironmentsAPI.BetaEnvironmentArchivedErrorDetails | EnvironmentsAPI.BetaInvalidConfigTypeChangeErrorDetails | EnvironmentsAPI.BetaEnvironmentUpdateDisabledErrorDetails | WorkAPI.BetaHeartbeatPreconditionFailedErrorDetails | EnvironmentsAPI.BetaInvalidMetadataErrorDetails | OrganizationUsersAPI.BetaCannotSignOutPrimaryOwnerErrorDetails | OrganizationUsersAPI.BetaCannotSignOutSelfErrorDetails | BetaAPI.BetaOrganizationNotEnrolledInBetaErrorDetails | OrganizationUsersAPI.BetaCannotSignOutManagedMemberErrorDetails | OrganizationUsersAPI.BetaCannotSignOutMembershipAdminErrorDetails | OrganizationUsersAPI.BetaCannotSignOutOwnerErrorDetails | OrganizationUsersAPI.BetaCannotSignOutPrivilegedMemberErrorDetails | SpendLimitsAPI.BetaSpendLimitsAdminAPIWritesNotEnabledErrorDetails | BetaAPI.BetaUnsupportedCharsetErrorDetails | PluginsAPI.BetaPluginNameTakenErrorDetails | PluginsAPI.BetaSkillNameTakenErrorDetails | PluginsAPI.BetaRegistrationPendingErrorDetails | PluginsAPI.BetaScanFailedErrorDetails | PluginsAPI.BetaScanPendingErrorDetails | BetaAPI.BetaRequestBodyTimeoutErrorDetails | ManagedSettingsAPI.BetaSettingsDocumentLimitExceededErrorDetails | ManagedSettingsAPI.BetaSettingsHistoryLimitExceededErrorDetails | ManagedSettingsAPI.BetaCMEKFeatureUnsupportedErrorDetails | ManagedSettingsAPI.BetaRBACGroupManagedSettingsNotFoundErrorDetails | ManagedSettingsAPI.BetaRBACGroupOrderLimitExceededErrorDetails | OrganizationRBACGroupsAPI.BetaRBACGroupNotFoundErrorDetails | ClaudeTagAPI.BetaSlackChannelSetUpSettingsRefusedErrorDetails | ClaudeTagAPI.BetaAPIKeyScopeMissingErrorDetails | ClaudeTagAPI.BetaClaudeTagWritesNotEnabledErrorDetails | ClaudeTagAPI.BetaComplianceConfigurationRestrictedErrorDetails | ClaudeTagAPI.BetaOrganizationLevelScopedAPIKeyRequiredErrorDetails | EnvironmentsAPI.BetaEnvironmentNotFoundErrorDetails | ClaudeTagAPI.BetaSlackChannelSetUpEnvironmentNotFoundErrorDetails | ClaudeTagAPI.BetaSlackChannelSetUpSettingsConflictErrorDetails | ClaudeTagAPI.BetaBundleAttachmentNotSupportedErrorDetails | ClaudeTagAPI.BetaBundleOnCallErrorDetails;
export type ErrorObject = InvalidRequestErrorObject | AuthenticationErrorObject | BillingErrorObject | PermissionErrorObject | NotFoundErrorObject | RateLimitErrorObject | GatewayTimeoutErrorObject | APIErrorObject | OverloadedErrorObject;
export interface ErrorResponse {
error: ErrorObject;
request_id: string | null;
type: 'error';
}
export type ErrorType = 'invalid_request_error' | 'authentication_error' | 'billing_error' | 'permission_error' | 'not_found_error' | 'rate_limit_error' | 'timeout_error' | 'api_error' | 'overloaded_error' | 'memory_precondition_failed_error' | 'memory_path_conflict_error' | 'conflict_error';
export interface GatewayTimeoutErrorObject {
/**
* A human-readable explanation of the error. Its wording can change, so don't
* match on it.
*/
message: string;
/**
* The broad category of the error.
*/
type: 'timeout_error';
}
export interface InvalidRequestErrorObject {
/**
* A human-readable explanation of the error. Its wording can change, so don't
* match on it.
*/
message: string;
/**
* The broad category of the error.
*/
type: 'invalid_request_error';
}
/**
* Anthropic cannot currently bill the organization linked to the request's user
* profile, for a reason that lies with that organization's own account. The
* response does not say what the reason is.
*/
export interface LinkedOrganizationBillingUnavailableErrorDetails {
error_code: 'linked_organization_billing_unavailable';
}
/**
* The organization linked to the request's user profile has reached a spend limit
* that it set, or lacks credit for the request. The response does not say which
* applies.
*/
export interface LinkedOrganizationSpendLimitReachedErrorDetails {
error_code: 'linked_organization_spend_limit_reached';
}
export interface NotFoundErrorObject {
/**
* A human-readable explanation of the error. Its wording can change, so don't
* match on it.
*/
message: string;
/**
* The broad category of the error.
*/
type: 'not_found_error';
}
/**
* Anthropic has disabled the organization for trust and safety reasons. An
* organization disabled for any other reason, such as billing, does not get this
* code. `appeal_url`, when present, is where the organization can appeal.
*/
export interface OrganizationOnHoldErrorDetails {
error_code: 'organization_on_hold';
appeal_url?: string | null;
}
/**
* The endpoint does not support the organization's type. Each endpoint's
* description says which organization types it supports.
*/
export interface OrganizationTypeNotSupportedErrorDetails {
error_code: 'organization_type_not_supported';
}
export interface OverloadedErrorObject {
/**
* A human-readable explanation of the error. Its wording can change, so don't
* match on it.
*/
message: string;
/**
* The broad category of the error.
*/
type: 'overloaded_error';
}
/**
* The endpoint serves only organizations that belong to a parent organization, and
* this organization belongs to none.
*/
export interface ParentOrganizationRequiredErrorDetails {
error_code: 'parent_organization_required';
}
export interface PermissionErrorObject {
/**
* A human-readable explanation of the error. Its wording can change, so don't
* match on it.
*/
message: string;
/**
* The broad category of the error.
*/
type: 'permission_error';
}
/**
* The request would exceed a ramp limit, which caps how fast usage can grow. Retry
* after the time in the `retry-after` header.
*/
export interface RampLimitExceededErrorDetails {
error_code: 'ramp_limit_exceeded';
}
export interface RateLimitErrorObject {
/**
* A human-readable explanation of the error. Its wording can change, so don't
* match on it.
*/
message: string;
/**
* The broad category of the error.
*/
type: 'rate_limit_error';
}
/**
* The request body is not valid for its `Content-Encoding`.
*/
export interface RequestBodyEncodingInvalidErrorDetails {
error_code: 'request_body_encoding_invalid';
}
/**
* The request's `Content-Encoding` is not supported.
*/
export interface RequestBodyEncodingUnsupportedErrorDetails {
error_code: 'request_body_encoding_unsupported';
}
/**
* The compressed request body exceeds the request size limit once decoded.
*/
export interface RequestBodyTooLargeAfterDecodingErrorDetails {
error_code: 'request_body_too_large_after_decoding';
}
/**
* 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.
*/
export interface SandboxEgressRestrictedErrorDetails {
error_code: 'sandbox_egress_restricted';
}
/**
* @deprecated AuthenticationError has been renamed to AuthenticationErrorObject
*/
export type AuthenticationError = AuthenticationErrorObject;
/**
* @deprecated InvalidRequestError has been renamed to InvalidRequestErrorObject
*/
export type InvalidRequestError = InvalidRequestErrorObject;
/**
* @deprecated BillingError has been renamed to BillingErrorObject
*/
export type BillingError = BillingErrorObject;
/**
* @deprecated GatewayTimeoutError has been renamed to GatewayTimeoutErrorObject
*/
export type GatewayTimeoutError = GatewayTimeoutErrorObject;
/**
* @deprecated NotFoundError has been renamed to NotFoundErrorObject
*/
export type NotFoundError = NotFoundErrorObject;
/**
* @deprecated OverloadedError has been renamed to OverloadedErrorObject
*/
export type OverloadedError = OverloadedErrorObject;
/**
* @deprecated PermissionError has been renamed to PermissionErrorObject
*/
export type PermissionError = PermissionErrorObject;
/**
* @deprecated RateLimitError has been renamed to RateLimitErrorObject
*/
export type RateLimitError = RateLimitErrorObject;
//# sourceMappingURL=shared.d.ts.map