diff --git a/.changeset/update-ai-generated-clients.md b/.changeset/update-ai-generated-clients.md new file mode 100644 index 0000000000..39ad707c01 --- /dev/null +++ b/.changeset/update-ai-generated-clients.md @@ -0,0 +1,11 @@ +--- +"@effect/ai-openai": patch +"@effect/ai-anthropic": patch +"@effect/ai-openrouter": patch +--- + +Update the generated OpenAI client from the latest OpenAI OpenAPI spec, adding generated data retention, spend alert, group, role, and project service account operations, and fixing recursive file search filter generation. + +Update the generated Anthropic client from the latest Anthropic OpenAPI spec and remove obsolete generated-code replacements for unknown JSON fields. + +Update the generated OpenRouter client from the latest OpenRouter OpenAPI spec, retargeting codegen patches for renamed schemas and updating the integration for regenerated schema names. diff --git a/packages/ai/anthropic/codegen.yml b/packages/ai/anthropic/codegen.yml index a39a97db8a..dd3f8ceec3 100644 --- a/packages/ai/anthropic/codegen.yml +++ b/packages/ai/anthropic/codegen.yml @@ -16,15 +16,6 @@ header: | excludeAnnotations: - examples replacements: - # Schema.Unknown doesn't work with Schema.toCodecJson (used by HttpClientResponse.schemaBodyJson) - # Replace with Schema.Json which properly handles arbitrary JSON values - - from: "Schema.Record(Schema.String, Schema.Unknown)" - to: "Schema.Record(Schema.String, Schema.Json)" - - from: "{ readonly [x: string]: unknown }" - to: "{ readonly [x: string]: Schema.Json }" - # Index signature in struct rest pattern - - from: "readonly [x: string]: unknown" - to: "readonly [x: string]: Schema.Json" # Make citations optional in ResponseTextBlock (API may omit this field) - from: "export type ResponseTextBlock = { readonly \"citations\":" to: "export type ResponseTextBlock = { readonly \"citations\"?:" @@ -60,4 +51,4 @@ replacements: to: "\"container\": Schema.optionalKey(Schema.Union([BetaContainer, Schema.Null]).annotate({ \"description\": \"Information about the container used in this request.\\n\\nThis will be non-null if a container tool (e.g. code execution) was used.\", \"default\": null }))" # Make context_management optional in BetaMessageDeltaEvent (API may omit this field) - from: "\"context_management\": Schema.Union([BetaResponseContextManagement, Schema.Null]).annotate({ \"description\": \"Information about context management strategies applied during the request\", \"default\": null })," - to: "\"context_management\": Schema.optionalKey(Schema.Union([BetaResponseContextManagement, Schema.Null]).annotate({ \"description\": \"Information about context management strategies applied during the request\", \"default\": null }))," \ No newline at end of file + to: "\"context_management\": Schema.optionalKey(Schema.Union([BetaResponseContextManagement, Schema.Null]).annotate({ \"description\": \"Information about context management strategies applied during the request\", \"default\": null }))," diff --git a/packages/ai/anthropic/src/Generated.ts b/packages/ai/anthropic/src/Generated.ts index 1d2ebcb0e6..50d5ab9ed8 100644 --- a/packages/ai/anthropic/src/Generated.ts +++ b/packages/ai/anthropic/src/Generated.ts @@ -1,5 +1,5 @@ /** - * @since 4.0.0 + * @since 1.0.0 */ import * as Data from "effect/Data" @@ -17,6 +17,14 @@ export const APIError = Schema.Struct({ "message": Schema.String.annotate({ "title": "Message", "default": "Internal server error" }), "type": Schema.Literal("api_error").annotate({ "title": "Type", "default": "api_error" }) }).annotate({ "title": "APIError" }) +export type AllowedCaller = "direct" | "code_execution_20250825" | "code_execution_20260120" +export const AllowedCaller = Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"]).annotate( + { + "title": "AllowedCaller", + "description": + "Specifies who can invoke a tool.\n\nValues:\n direct: The model can call this tool directly.\n code_execution_20250825: The tool can be called from the code execution environment (v1).\n code_execution_20260120: The tool can be called from the code execution environment (v2 with persistence)." + } +) export type AuthenticationError = { readonly "message": string; readonly "type": "authentication_error" } export const AuthenticationError = Schema.Struct({ "message": Schema.String.annotate({ "title": "Message", "default": "Authentication error" }), @@ -62,9 +70,31 @@ export const BetaAPIError = Schema.Struct({ "message": Schema.String.annotate({ "title": "Message", "default": "Internal server error" }), "type": Schema.Literal("api_error").annotate({ "title": "Type", "default": "api_error" }) }).annotate({ "title": "APIError" }) +export type BetaAdvisorToolResultErrorCode = + | "max_uses_exceeded" + | "prompt_too_long" + | "too_many_requests" + | "overloaded" + | "unavailable" + | "execution_time_exceeded" +export const BetaAdvisorToolResultErrorCode = Schema.Literals([ + "max_uses_exceeded", + "prompt_too_long", + "too_many_requests", + "overloaded", + "unavailable", + "execution_time_exceeded" +]).annotate({ "title": "AdvisorToolResultErrorCode" }) export type BetaAllThinkingTurns = { readonly "type": "all" } export const BetaAllThinkingTurns = Schema.Struct({ "type": Schema.Literal("all").annotate({ "title": "Type" }) }) .annotate({ "title": "AllThinkingTurns" }) +export type BetaAllowedCaller = "direct" | "code_execution_20250825" | "code_execution_20260120" +export const BetaAllowedCaller = Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"]) + .annotate({ + "title": "AllowedCaller", + "description": + "Specifies who can invoke a tool.\n\nValues:\n direct: The model can call this tool directly.\n code_execution_20250825: The tool can be called from the code execution environment (v1).\n code_execution_20260120: The tool can be called from the code execution environment (v2 with persistence)." + }) export type BetaAuthenticationError = { readonly "message": string; readonly "type": "authentication_error" } export const BetaAuthenticationError = Schema.Struct({ "message": Schema.String.annotate({ "title": "Message", "default": "Authentication error" }), @@ -169,10 +199,76 @@ export const BetaCacheCreation = Schema.Struct({ "default": 0 }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)) }).annotate({ "title": "CacheCreation" }) +export type BetaCacheMissMessagesChanged = { + readonly "cache_missed_input_tokens": number + readonly "type": "messages_changed" +} +export const BetaCacheMissMessagesChanged = Schema.Struct({ + "cache_missed_input_tokens": Schema.Number.annotate({ + "title": "Cache Missed Input Tokens", + "description": + "Approximate number of input tokens that would have been read from cache had the prefix matched the previous request." + }).check(Schema.isInt()), + "type": Schema.Literal("messages_changed").annotate({ "title": "Type", "default": "messages_changed" }) +}).annotate({ "title": "CacheMissMessagesChanged" }) +export type BetaCacheMissModelChanged = { + readonly "cache_missed_input_tokens": number + readonly "type": "model_changed" +} +export const BetaCacheMissModelChanged = Schema.Struct({ + "cache_missed_input_tokens": Schema.Number.annotate({ + "title": "Cache Missed Input Tokens", + "description": + "Approximate number of input tokens that would have been read from cache had the prefix matched the previous request." + }).check(Schema.isInt()), + "type": Schema.Literal("model_changed").annotate({ "title": "Type", "default": "model_changed" }) +}).annotate({ "title": "CacheMissModelChanged" }) +export type BetaCacheMissPreviousMessageNotFound = { readonly "type": "previous_message_not_found" } +export const BetaCacheMissPreviousMessageNotFound = Schema.Struct({ + "type": Schema.Literal("previous_message_not_found").annotate({ + "title": "Type", + "default": "previous_message_not_found" + }) +}).annotate({ "title": "CacheMissPreviousMessageNotFound" }) +export type BetaCacheMissSystemChanged = { + readonly "cache_missed_input_tokens": number + readonly "type": "system_changed" +} +export const BetaCacheMissSystemChanged = Schema.Struct({ + "cache_missed_input_tokens": Schema.Number.annotate({ + "title": "Cache Missed Input Tokens", + "description": + "Approximate number of input tokens that would have been read from cache had the prefix matched the previous request." + }).check(Schema.isInt()), + "type": Schema.Literal("system_changed").annotate({ "title": "Type", "default": "system_changed" }) +}).annotate({ "title": "CacheMissSystemChanged" }) +export type BetaCacheMissToolsChanged = { + readonly "cache_missed_input_tokens": number + readonly "type": "tools_changed" +} +export const BetaCacheMissToolsChanged = Schema.Struct({ + "cache_missed_input_tokens": Schema.Number.annotate({ + "title": "Cache Missed Input Tokens", + "description": + "Approximate number of input tokens that would have been read from cache had the prefix matched the previous request." + }).check(Schema.isInt()), + "type": Schema.Literal("tools_changed").annotate({ "title": "Type", "default": "tools_changed" }) +}).annotate({ "title": "CacheMissToolsChanged" }) +export type BetaCacheMissUnavailable = { readonly "type": "unavailable" } +export const BetaCacheMissUnavailable = Schema.Struct({ + "type": Schema.Literal("unavailable").annotate({ "title": "Type", "default": "unavailable" }) +}).annotate({ "title": "CacheMissUnavailable" }) export type BetaCanceledResult = { readonly "type": "canceled" } export const BetaCanceledResult = Schema.Struct({ "type": Schema.Literal("canceled").annotate({ "title": "Type", "default": "canceled" }) }).annotate({ "title": "CanceledResult" }) +export type BetaCapabilitySupport = { readonly "supported": boolean } +export const BetaCapabilitySupport = Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) +}).annotate({ "title": "CapabilitySupport", "description": "Indicates whether a capability is supported." }) export type BetaCodeExecutionToolResultErrorCode = | "invalid_tool_input" | "unavailable" @@ -184,9 +280,18 @@ export const BetaCodeExecutionToolResultErrorCode = Schema.Literals([ "too_many_requests", "execution_time_exceeded" ]).annotate({ "title": "CodeExecutionToolResultErrorCode" }) -export type BetaCompactionContentBlockDelta = { readonly "content": string | null; readonly "type": "compaction_delta" } +export type BetaCompactionContentBlockDelta = { + readonly "content": string | null + readonly "encrypted_content": string | null + readonly "type": "compaction_delta" +} export const BetaCompactionContentBlockDelta = Schema.Struct({ "content": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Content" }), + "encrypted_content": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Encrypted Content", + "description": "Opaque metadata from prior compaction, to be round-tripped verbatim", + "default": null + }), "type": Schema.Literal("compaction_delta").annotate({ "title": "Type", "default": "compaction_delta" }) }).annotate({ "title": "CompactionContentBlockDelta" }) export type BetaContentBlockStopEvent = { readonly "index": number; readonly "type": "content_block_stop" } @@ -292,6 +397,37 @@ export const BetaCreateSkillVersionResponse = Schema.Struct({ "Version identifier for the skill.\n\nEach version is identified by a Unix epoch timestamp (e.g., \"1759178010641129\")." }) }).annotate({ "title": "CreateSkillVersionResponse" }) +export type BetaCreateUserProfileRequest = { + readonly "external_id"?: string + readonly "name"?: string + readonly "relationship"?: "external" | "resold" | "internal" + readonly "metadata"?: { readonly [x: string]: string } +} +export const BetaCreateUserProfileRequest = Schema.Struct({ + "external_id": Schema.optionalKey( + Schema.String.annotate({ + "description": "Platform's own identifier for this user. Not enforced unique. Maximum 255 characters." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)) + ), + "name": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Display name of the entity this profile represents. Required when relationship is `resold` (the resold-to company's name); optional otherwise. Maximum 255 characters." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)) + ), + "relationship": Schema.optionalKey( + Schema.Literals(["external", "resold", "internal"]).annotate({ + "description": + "How the entity behind a user profile relates to the platform that owns the API key. `external`: an individual end-user of the platform. `resold`: a company the platform resells Claude access to. `internal`: the platform's own usage." + }) + ), + "metadata": Schema.optionalKey( + Schema.Record(Schema.String, Schema.String).annotate({ + "description": + "Free-form key-value data to attach to this user profile. Maximum 16 keys, with keys up to 64 characters and values up to 512 characters. Values must be non-empty strings." + }) + ) +}) export type BetaDeleteMessageBatchResponse = { readonly "id": string; readonly "type": "message_batch_deleted" } export const BetaDeleteMessageBatchResponse = Schema.Struct({ "id": Schema.String.annotate({ "title": "Id", "description": "ID of the Message Batch." }), @@ -326,14 +462,47 @@ export const BetaDeleteSkillVersionResponse = Schema.Struct({ "default": "skill_version_deleted" }) }).annotate({ "title": "DeleteSkillVersionResponse" }) +export type BetaDiagnosticsParam = { readonly "previous_message_id"?: string | null } +export const BetaDiagnosticsParam = Schema.Struct({ + "previous_message_id": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMaxLength(256)), Schema.Null]).annotate({ + "title": "Previous Message Id", + "description": + "The `id` (`msg_...`) from this client's previous /v1/messages response. The server compares that request's prompt fingerprint against this one and returns `diagnostics.cache_miss_reason` when the prompt-cache prefix could not be reused. Pass `null` on the first turn to opt in without a prior message to compare." + }) + ) +}).annotate({ + "title": "DiagnosticsParam", + "description": + "Request-level diagnostics. Currently carries the previous response\nid for prompt-cache divergence reporting." +}) export type BetaDirectCaller = { readonly "type": "direct" } export const BetaDirectCaller = Schema.Struct({ "type": Schema.Literal("direct").annotate({ "title": "Type" }) }) .annotate({ "title": "DirectCaller", "description": "Tool invocation directly from the model." }) -export type BetaEffortLevel = "low" | "medium" | "high" | "max" -export const BetaEffortLevel = Schema.Literals(["low", "medium", "high", "max"]).annotate({ +export type BetaEffortLevel = "low" | "medium" | "high" | "xhigh" | "max" +export const BetaEffortLevel = Schema.Literals(["low", "medium", "high", "xhigh", "max"]).annotate({ "title": "EffortLevel", "description": "All possible effort levels." }) +export type BetaEnrollmentUrl = { + readonly "url": string + readonly "expires_at": string + readonly "type": "enrollment_url" +} +export const BetaEnrollmentUrl = Schema.Struct({ + "url": Schema.String.annotate({ "description": "Enrollment URL to send to the end user. Valid until `expires_at`." }), + "expires_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "type": Schema.Literal("enrollment_url").annotate({ "description": "Object type. Always `enrollment_url`." }) +}) +export type BetaEnvironmentDeleteResponse = { readonly "id": string; readonly "type": "environment_deleted" } +export const BetaEnvironmentDeleteResponse = Schema.Struct({ + "id": Schema.String.annotate({ "title": "Id", "description": "Environment identifier" }), + "type": Schema.Literal("environment_deleted").annotate({ + "title": "Type", + "description": "The type of response", + "default": "environment_deleted" + }) +}).annotate({ "title": "EnvironmentDeleteResponse", "description": "Response after deleting an environment." }) export type BetaExpiredResult = { readonly "type": "expired" } export const BetaExpiredResult = Schema.Struct({ "type": Schema.Literal("expired").annotate({ "title": "Type", "default": "expired" }) @@ -359,45 +528,17 @@ export const BetaFileImageSource = Schema.Struct({ "file_id": Schema.String.annotate({ "title": "File Id" }), "type": Schema.Literal("file").annotate({ "title": "Type" }) }).annotate({ "title": "FileImageSource" }) -export type BetaFileMetadataSchema = { - readonly "created_at": string - readonly "downloadable"?: boolean - readonly "filename": string - readonly "id": string - readonly "mime_type": string - readonly "size_bytes": number - readonly "type": "file" -} -export const BetaFileMetadataSchema = Schema.Struct({ - "created_at": Schema.String.annotate({ - "title": "Created At", - "description": "RFC 3339 datetime string representing when the file was created.", - "format": "date-time" - }), - "downloadable": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Downloadable", - "description": "Whether the file can be downloaded.", - "default": false - }) - ), - "filename": Schema.String.annotate({ "title": "Filename", "description": "Original filename of the uploaded file." }) - .check(Schema.isMinLength(1)).check(Schema.isMaxLength(500)), +export type BetaFileScope = { readonly "id": string; readonly "type": "session" } +export const BetaFileScope = Schema.Struct({ "id": Schema.String.annotate({ "title": "Id", - "description": "Unique object identifier.\n\nThe format and length of IDs may change over time." + "description": "The ID of the scoping resource (e.g., the session ID)." }), - "mime_type": Schema.String.annotate({ "title": "Mime Type", "description": "MIME type of the file." }).check( - Schema.isMinLength(1) - ).check(Schema.isMaxLength(255)), - "size_bytes": Schema.Number.annotate({ "title": "Size Bytes", "description": "Size of the file in bytes." }).check( - Schema.isInt() - ).check(Schema.isGreaterThanOrEqualTo(0)), - "type": Schema.Literal("file").annotate({ + "type": Schema.Literal("session").annotate({ "title": "Type", - "description": "Object type.\n\nFor files, this is always `\"file\"`." + "description": "The type of scope (e.g., `\"session\"`)." }) -}).annotate({ "title": "FileMetadataSchema" }) +}).annotate({ "title": "FileScope" }) export type BetaGatewayTimeoutError = { readonly "message": string; readonly "type": "timeout_error" } export const BetaGatewayTimeoutError = Schema.Struct({ "message": Schema.String.annotate({ "title": "Message", "default": "Request timeout" }), @@ -515,11 +656,11 @@ export const BetaInvalidRequestError = Schema.Struct({ "type": Schema.Literal("invalid_request_error").annotate({ "title": "Type", "default": "invalid_request_error" }) }).annotate({ "title": "InvalidRequestError" }) export type BetaJsonOutputFormat = { - readonly "schema": { readonly [x: string]: Schema.Json } + readonly "schema": { readonly [x: string]: unknown } readonly "type": "json_schema" } export const BetaJsonOutputFormat = Schema.Struct({ - "schema": Schema.Record(Schema.String, Schema.Json).annotate({ + "schema": Schema.Record(Schema.String, Schema.Unknown).annotate({ "title": "Schema", "description": "The JSON schema of the format" }), @@ -527,3011 +668,4127 @@ export const BetaJsonOutputFormat = Schema.Struct({ }).annotate({ "title": "JsonOutputFormat" }) export type BetaJsonValue = unknown export const BetaJsonValue = Schema.Unknown +export type BetaLimitedNetwork = { + readonly "allow_mcp_servers": boolean + readonly "allow_package_managers": boolean + readonly "allowed_hosts": ReadonlyArray + readonly "type": "limited" +} +export const BetaLimitedNetwork = Schema.Struct({ + "allow_mcp_servers": Schema.Boolean.annotate({ + "title": "Allow Mcp Servers", + "description": + "Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array." + }), + "allow_package_managers": Schema.Boolean.annotate({ + "title": "Allow Package Managers", + "description": + "Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array." + }), + "allowed_hosts": Schema.Array(Schema.String).annotate({ + "title": "Allowed Hosts", + "description": "Specifies domains the container can reach." + }), + "type": Schema.Literal("limited").annotate({ "title": "Type", "description": "Network policy type" }) +}).annotate({ "title": "LimitedNetwork", "description": "Limited network access." }) +export type BetaLimitedNetworkParams = { + readonly "allow_mcp_servers"?: boolean | null + readonly "allow_package_managers"?: boolean | null + readonly "allowed_hosts"?: ReadonlyArray | null + readonly "type": "limited" +} +export const BetaLimitedNetworkParams = Schema.Struct({ + "allow_mcp_servers": Schema.optionalKey( + Schema.Union([Schema.Boolean, Schema.Null]).annotate({ + "title": "Allow Mcp Servers", + "description": + "Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`." + }) + ), + "allow_package_managers": Schema.optionalKey( + Schema.Union([Schema.Boolean, Schema.Null]).annotate({ + "title": "Allow Package Managers", + "description": + "Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false`." + }) + ), + "allowed_hosts": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Allowed Hosts", + "description": "Specifies domains the container can reach." + }) + ), + "type": Schema.Literal("limited").annotate({ "title": "Type", "description": "Network policy type" }) +}).annotate({ + "title": "LimitedNetworkParams", + "description": + "Limited network request params.\n\nFields default to null; on update, omitted fields preserve the\nexisting value." +}) export type BetaMCPToolConfig = { readonly "defer_loading"?: boolean; readonly "enabled"?: boolean } export const BetaMCPToolConfig = Schema.Struct({ "defer_loading": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Defer Loading" })), "enabled": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Enabled" })) }).annotate({ "title": "MCPToolConfig", "description": "Configuration for a specific tool in an MCP toolset." }) -export type BetaMessageBatch = { - readonly "archived_at": string | null - readonly "cancel_initiated_at": string | null - readonly "created_at": string - readonly "ended_at": string | null - readonly "expires_at": string +export type BetaManagedAgentsAddSessionResourceParams = { + readonly "type": "file" + readonly "file_id": string + readonly "mount_path"?: string +} +export const BetaManagedAgentsAddSessionResourceParams = Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("file"), + "file_id": Schema.String.annotate({ "description": "ID of a previously uploaded file." }).check( + Schema.isMinLength(1) + ).check(Schema.isMaxLength(128)), + "mount_path": Schema.optionalKey( + Schema.String.annotate({ + "description": "Mount path in the container. Defaults to `/mnt/session/uploads/`." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(4096)) + ) + }).annotate({ "description": "Request parameters for adding a resource to a session." }) +], { mode: "oneOf" }) +export type BetaManagedAgentsAgentParams = { + readonly "type": "agent" readonly "id": string - readonly "processing_status": "in_progress" | "canceling" | "ended" - readonly "request_counts": { - readonly "canceled": number - readonly "errored": number - readonly "expired": number - readonly "processing": number - readonly "succeeded": number - } - readonly "results_url": string | null - readonly "type": "message_batch" + readonly "version"?: number } -export const BetaMessageBatch = Schema.Struct({ - "archived_at": Schema.Union([Schema.String.annotate({ "format": "date-time" }), Schema.Null]).annotate({ - "title": "Archived At", - "description": - "RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable." - }), - "cancel_initiated_at": Schema.Union([Schema.String.annotate({ "format": "date-time" }), Schema.Null]).annotate({ - "title": "Cancel Initiated At", - "description": - "RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated." - }), - "created_at": Schema.String.annotate({ - "title": "Created At", - "description": "RFC 3339 datetime string representing the time at which the Message Batch was created.", - "format": "date-time" - }), - "ended_at": Schema.Union([Schema.String.annotate({ "format": "date-time" }), Schema.Null]).annotate({ - "title": "Ended At", - "description": - "RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.\n\nProcessing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired." - }), - "expires_at": Schema.String.annotate({ - "title": "Expires At", - "description": - "RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.", - "format": "date-time" - }), - "id": Schema.String.annotate({ - "title": "Id", - "description": "Unique object identifier.\n\nThe format and length of IDs may change over time." - }), - "processing_status": Schema.Literals(["in_progress", "canceling", "ended"]).annotate({ - "title": "Processing Status", - "description": "Processing status of the Message Batch." - }), - "request_counts": Schema.Struct({ - "canceled": Schema.Number.annotate({ - "title": "Canceled", - "description": - "Number of requests in the Message Batch that have been canceled.\n\nThis is zero until processing of the entire Message Batch has ended.", - "default": 0 - }).check(Schema.isInt()), - "errored": Schema.Number.annotate({ - "title": "Errored", +export const BetaManagedAgentsAgentParams = Schema.Struct({ + "type": Schema.Literal("agent"), + "id": Schema.String.annotate({ "description": "The `agent` ID." }).check(Schema.isMinLength(1)).check( + Schema.isMaxLength(128) + ), + "version": Schema.optionalKey( + Schema.Number.annotate({ "description": - "Number of requests in the Message Batch that encountered an error.\n\nThis is zero until processing of the entire Message Batch has ended.", - "default": 0 - }).check(Schema.isInt()), - "expired": Schema.Number.annotate({ - "title": "Expired", + "The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified.", + "format": "int32" + }).check(Schema.isInt()) + ) +}).annotate({ + "description": + "Specification for an Agent. Provide a specific `version` or use the short-form `agent=\"agent_id\"` for the most recent version" +}) +export type BetaManagedAgentsAgentReference = { + readonly "type": "agent" + readonly "id": string + readonly "version": number +} +export const BetaManagedAgentsAgentReference = Schema.Struct({ + "type": Schema.Literal("agent"), + "id": Schema.String, + "version": Schema.Number.annotate({ "format": "int32" }).check(Schema.isInt()) +}).annotate({ "description": "A resolved agent reference with a concrete version." }) +export type BetaManagedAgentsAgentToolName = + | "bash" + | "edit" + | "read" + | "write" + | "glob" + | "grep" + | "web_fetch" + | "web_search" +export const BetaManagedAgentsAgentToolName = Schema.Literals([ + "bash", + "edit", + "read", + "write", + "glob", + "grep", + "web_fetch", + "web_search" +]).annotate({ "description": "Built-in agent tool identifier." }) +export type BetaManagedAgentsAnthropicSkill = { + readonly "type": "anthropic" + readonly "skill_id": string + readonly "version": string +} +export const BetaManagedAgentsAnthropicSkill = Schema.Struct({ + "type": Schema.Literal("anthropic"), + "skill_id": Schema.String, + "version": Schema.String +}).annotate({ "description": "A resolved Anthropic-managed skill." }) +export type BetaManagedAgentsAnthropicSkillParams = { + readonly "type": "anthropic" + readonly "skill_id": string + readonly "version"?: string +} +export const BetaManagedAgentsAnthropicSkillParams = Schema.Struct({ + "type": Schema.Literal("anthropic"), + "skill_id": Schema.String.annotate({ "description": "Identifier of the Anthropic skill (e.g., \"xlsx\")." }).check( + Schema.isMinLength(1) + ).check(Schema.isMaxLength(64)), + "version": Schema.optionalKey( + Schema.String.annotate({ "description": "Version to pin. Defaults to latest if omitted." }).check( + Schema.isMinLength(1) + ).check(Schema.isMaxLength(64)) + ) +}).annotate({ "description": "An Anthropic-managed skill." }) +export type BetaManagedAgentsArchiveMemoryStoreResponse = { + readonly "type": "memory_store" + readonly "id": string + readonly "name": string + readonly "description"?: string + readonly "created_at": string + readonly "updated_at": string + readonly "metadata"?: { readonly [x: string]: string } + readonly "archived_at"?: string +} +export const BetaManagedAgentsArchiveMemoryStoreResponse = Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("memory_store"), + "id": Schema.String.annotate({ "description": - "Number of requests in the Message Batch that have expired.\n\nThis is zero until processing of the entire Message Batch has ended.", - "default": 0 - }).check(Schema.isInt()), - "processing": Schema.Number.annotate({ - "title": "Processing", - "description": "Number of requests in the Message Batch that are processing.", - "default": 0 - }).check(Schema.isInt()), - "succeeded": Schema.Number.annotate({ - "title": "Succeeded", + "Unique identifier for the memory store (a `memstore_...` tagged ID). Use this when attaching the store to a session, or in the `{memory_store_id}` path parameter of subsequent calls." + }), + "name": Schema.String.annotate({ "description": - "Number of requests in the Message Batch that have completed successfully.\n\nThis is zero until processing of the entire Message Batch has ended.", - "default": 0 - }).check(Schema.isInt()) - }).annotate({ - "title": "RequestCounts", + "Human-readable name for the store. 1–255 characters. The store's mount-path slug under `/mnt/memory/` is derived from this name." + }), + "description": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Free-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent. Empty string when unset." + }) + ), + "created_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "updated_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "metadata": Schema.optionalKey( + Schema.Record(Schema.String, Schema.String).annotate({ + "description": + "Arbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Returned on retrieve/list but not filterable." + }) + ), + "archived_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ) + }).annotate({ "description": "Response from archiving a `memory_store`. Returns the store with `archived_at` set." }) +], { mode: "oneOf" }) +export type BetaManagedAgentsCreateMemoryParams = { readonly "path": string; readonly "content": string } +export const BetaManagedAgentsCreateMemoryParams = Schema.Struct({ + "path": Schema.String.annotate({ "description": - "Tallies requests within the Message Batch, categorized by their status.\n\nRequests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch." - }), - "results_url": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Results Url", + "Hierarchical path for the new memory, e.g. `/projects/foo/notes.md`. Must start with `/`, contain at least one non-empty segment, and be at most 1,024 bytes. Must not contain empty segments, `.` or `..` segments, control or format characters, and must be NFC-normalized. Paths are case-sensitive." + }).check(Schema.isMinLength(2)).check(Schema.isMaxLength(1024)), + "content": Schema.String.annotate({ "description": - "URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.\n\nResults in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests." - }), - "type": Schema.Literal("message_batch").annotate({ - "title": "Type", - "description": "Object type.\n\nFor Message Batches, this is always `\"message_batch\"`.", - "default": "message_batch" + "UTF-8 text content for the new memory. Maximum 100 kB (102,400 bytes). Required; pass `\"\"` explicitly to create an empty memory." }) -}).annotate({ "title": "MessageBatch" }) -export type BetaMessageStopEvent = { readonly "type": "message_stop" } -export const BetaMessageStopEvent = Schema.Struct({ - "type": Schema.Literal("message_stop").annotate({ "title": "Type", "default": "message_stop" }) -}).annotate({ "title": "MessageStopEvent" }) -export type BetaModelInfo = { - readonly "created_at": string - readonly "display_name": string - readonly "id": string - readonly "type": "model" +}).annotate({ + "description": + "Request parameters for [Create a memory](/en/api/beta/memory_stores/memories/create). The path must be unoccupied: if a memory already exists at the path, or the path is an ancestor or descendant of an existing memory's path, the request returns `memory_path_conflict_error` (HTTP 409). Create never overwrites; to modify an existing memory, use [Update a memory](/en/api/beta/memory_stores/memories/update)." +}) +export type BetaManagedAgentsCreateMemoryStoreRequest = { + readonly "name": string + readonly "description"?: string + readonly "metadata"?: { readonly [x: string]: string } } -export const BetaModelInfo = Schema.Struct({ - "created_at": Schema.String.annotate({ - "title": "Created At", +export const BetaManagedAgentsCreateMemoryStoreRequest = Schema.Struct({ + "name": Schema.String.annotate({ "description": - "RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown.", - "format": "date-time" - }), - "display_name": Schema.String.annotate({ - "title": "Display Name", - "description": "A human-readable name for the model." - }), - "id": Schema.String.annotate({ "title": "Id", "description": "Unique model identifier." }), - "type": Schema.Literal("model").annotate({ - "title": "Type", - "description": "Object type.\n\nFor Models, this is always `\"model\"`.", - "default": "model" - }) -}).annotate({ "title": "ModelInfo" }) -export type BetaNotFoundError = { readonly "message": string; readonly "type": "not_found_error" } -export const BetaNotFoundError = Schema.Struct({ - "message": Schema.String.annotate({ "title": "Message", "default": "Not found" }), - "type": Schema.Literal("not_found_error").annotate({ "title": "Type", "default": "not_found_error" }) -}).annotate({ "title": "NotFoundError" }) -export type BetaOverloadedError = { readonly "message": string; readonly "type": "overloaded_error" } -export const BetaOverloadedError = Schema.Struct({ - "message": Schema.String.annotate({ "title": "Message", "default": "Overloaded" }), - "type": Schema.Literal("overloaded_error").annotate({ "title": "Type", "default": "overloaded_error" }) -}).annotate({ "title": "OverloadedError" }) -export type BetaPermissionError = { readonly "message": string; readonly "type": "permission_error" } -export const BetaPermissionError = Schema.Struct({ - "message": Schema.String.annotate({ "title": "Message", "default": "Permission denied" }), - "type": Schema.Literal("permission_error").annotate({ "title": "Type", "default": "permission_error" }) -}).annotate({ "title": "PermissionError" }) -export type BetaPlainTextSource = { - readonly "data": string - readonly "media_type": "text/plain" - readonly "type": "text" + "Human-readable name for the store. Required; 1–255 characters; no control characters. The mount-path slug under `/mnt/memory/` is derived from this name (lowercased, non-alphanumeric runs collapsed to a hyphen). Names need not be unique within a workspace." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), + "description": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Free-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent." + }).check(Schema.isMaxLength(1024)) + ), + "metadata": Schema.optionalKey( + Schema.Record(Schema.String, Schema.String).annotate({ + "description": + "Arbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Not visible to the agent." + }) + ) +}).annotate({ "description": "Request parameters for creating a `memory_store`." }) +export type BetaManagedAgentsCreateMemoryStoreResponse = { + readonly "type": "memory_store" + readonly "id": string + readonly "name": string + readonly "description"?: string + readonly "created_at": string + readonly "updated_at": string + readonly "metadata"?: { readonly [x: string]: string } + readonly "archived_at"?: string } -export const BetaPlainTextSource = Schema.Struct({ - "data": Schema.String.annotate({ "title": "Data" }), - "media_type": Schema.Literal("text/plain").annotate({ "title": "Media Type" }), - "type": Schema.Literal("text").annotate({ "title": "Type" }) -}).annotate({ "title": "PlainTextSource" }) -export type BetaRateLimitError = { readonly "message": string; readonly "type": "rate_limit_error" } -export const BetaRateLimitError = Schema.Struct({ - "message": Schema.String.annotate({ "title": "Message", "default": "Rate limited" }), - "type": Schema.Literal("rate_limit_error").annotate({ "title": "Type", "default": "rate_limit_error" }) -}).annotate({ "title": "RateLimitError" }) -export type BetaRequestBashCodeExecutionOutputBlock = { - readonly "file_id": string - readonly "type": "bash_code_execution_output" +export const BetaManagedAgentsCreateMemoryStoreResponse = Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("memory_store"), + "id": Schema.String.annotate({ + "description": + "Unique identifier for the memory store (a `memstore_...` tagged ID). Use this when attaching the store to a session, or in the `{memory_store_id}` path parameter of subsequent calls." + }), + "name": Schema.String.annotate({ + "description": + "Human-readable name for the store. 1–255 characters. The store's mount-path slug under `/mnt/memory/` is derived from this name." + }), + "description": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Free-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent. Empty string when unset." + }) + ), + "created_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "updated_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "metadata": Schema.optionalKey( + Schema.Record(Schema.String, Schema.String).annotate({ + "description": + "Arbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Returned on retrieve/list but not filterable." + }) + ), + "archived_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ) + }).annotate({ "description": "Response from creating a `memory_store`. Returns the created store." }) +], { mode: "oneOf" }) +export type BetaManagedAgentsCreateVaultRequest = { + readonly "display_name": string + readonly "metadata"?: { readonly [x: string]: string } } -export const BetaRequestBashCodeExecutionOutputBlock = Schema.Struct({ - "file_id": Schema.String.annotate({ "title": "File Id" }), - "type": Schema.Literal("bash_code_execution_output").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestBashCodeExecutionOutputBlock" }) -export type BetaRequestCharLocationCitation = { - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string | null - readonly "end_char_index": number - readonly "start_char_index": number - readonly "type": "char_location" +export const BetaManagedAgentsCreateVaultRequest = Schema.Struct({ + "display_name": Schema.String.annotate({ "description": "Human-readable name for the vault. 1-255 characters." }) + .check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), + "metadata": Schema.optionalKey( + Schema.Record(Schema.String, Schema.String).annotate({ + "description": + "Arbitrary key-value metadata to attach to the vault. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars." + }) + ) +}).annotate({ "description": "Request parameters for creating a vault." }) +export type BetaManagedAgentsCredentialValidation = { + readonly "type": "vault_credential_validation" + readonly "credential_id": string + readonly "vault_id": string + readonly "status": "valid" | "invalid" | "unknown" + readonly "validated_at": string + readonly "has_refresh_token": boolean + readonly "mcp_probe": { + readonly "method": string + readonly "http_response": { + readonly "status_code": number + readonly "content_type": string + readonly "body": string + readonly "body_truncated": boolean + } + } + readonly "refresh": { + readonly "status": "succeeded" | "failed" | "connect_error" | "no_refresh_token" + readonly "http_response": { + readonly "status_code": number + readonly "content_type": string + readonly "body": string + readonly "body_truncated": boolean + } + } } -export const BetaRequestCharLocationCitation = Schema.Struct({ - "cited_text": Schema.String.annotate({ "title": "Cited Text" }), - "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) - ), - "document_title": Schema.Union([ - Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), - Schema.Null - ]).annotate({ "title": "Document Title" }), - "end_char_index": Schema.Number.annotate({ "title": "End Char Index" }).check(Schema.isInt()), - "start_char_index": Schema.Number.annotate({ "title": "Start Char Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) - ), - "type": Schema.Literal("char_location").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestCharLocationCitation" }) -export type BetaRequestCitationsConfig = { readonly "enabled"?: boolean } -export const BetaRequestCitationsConfig = Schema.Struct({ - "enabled": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Enabled" })) -}).annotate({ "title": "RequestCitationsConfig" }) -export type BetaRequestCodeExecutionOutputBlock = { - readonly "file_id": string - readonly "type": "code_execution_output" +export const BetaManagedAgentsCredentialValidation = Schema.Struct({ + "type": Schema.Literal("vault_credential_validation"), + "credential_id": Schema.String.annotate({ "description": "Unique identifier of the credential that was validated." }), + "vault_id": Schema.String.annotate({ "description": "Identifier of the vault containing the credential." }), + "status": Schema.Literals(["valid", "invalid", "unknown"]).annotate({ + "description": "Overall verdict of a credential validation probe." + }), + "validated_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "has_refresh_token": Schema.Boolean.annotate({ + "description": "Whether the credential has a refresh token configured." + }), + "mcp_probe": Schema.Struct({ + "method": Schema.String.annotate({ + "description": "The MCP method that failed (for example `initialize` or `tools/list`)." + }), + "http_response": Schema.Struct({ + "status_code": Schema.Number.annotate({ "description": "HTTP status code.", "format": "int32" }).check( + Schema.isInt() + ), + "content_type": Schema.String.annotate({ "description": "Value of the `Content-Type` response header." }), + "body": Schema.String.annotate({ + "description": "Response body. May be truncated and has sensitive values scrubbed." + }), + "body_truncated": Schema.Boolean.annotate({ "description": "Whether `body` was truncated." }) + }).annotate({ "description": "An HTTP response captured during a credential validation probe." }) + }).annotate({ "description": "The failing step of an MCP validation probe." }), + "refresh": Schema.Struct({ + "status": Schema.Literals(["succeeded", "failed", "connect_error", "no_refresh_token"]).annotate({ + "description": "Outcome of a refresh-token exchange attempted during credential validation." + }), + "http_response": Schema.Struct({ + "status_code": Schema.Number.annotate({ "description": "HTTP status code.", "format": "int32" }).check( + Schema.isInt() + ), + "content_type": Schema.String.annotate({ "description": "Value of the `Content-Type` response header." }), + "body": Schema.String.annotate({ + "description": "Response body. May be truncated and has sensitive values scrubbed." + }), + "body_truncated": Schema.Boolean.annotate({ "description": "Whether `body` was truncated." }) + }).annotate({ "description": "An HTTP response captured during a credential validation probe." }) + }).annotate({ "description": "Outcome of a refresh-token exchange attempted during credential validation." }) +}).annotate({ "description": "Result of live-probing a credential against its configured MCP server." }) +export type BetaManagedAgentsCustomSkill = { + readonly "type": "custom" + readonly "skill_id": string + readonly "version": string } -export const BetaRequestCodeExecutionOutputBlock = Schema.Struct({ - "file_id": Schema.String.annotate({ "title": "File Id" }), - "type": Schema.Literal("code_execution_output").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestCodeExecutionOutputBlock" }) -export type BetaRequestContentBlockLocationCitation = { - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string | null - readonly "end_block_index": number - readonly "start_block_index": number - readonly "type": "content_block_location" +export const BetaManagedAgentsCustomSkill = Schema.Struct({ + "type": Schema.Literal("custom"), + "skill_id": Schema.String, + "version": Schema.String +}).annotate({ "description": "A resolved user-created custom skill." }) +export type BetaManagedAgentsCustomSkillParams = { + readonly "type": "custom" + readonly "skill_id": string + readonly "version"?: string } -export const BetaRequestContentBlockLocationCitation = Schema.Struct({ - "cited_text": Schema.String.annotate({ "title": "Cited Text" }), - "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) +export const BetaManagedAgentsCustomSkillParams = Schema.Struct({ + "type": Schema.Literal("custom"), + "skill_id": Schema.String.annotate({ "description": "Tagged ID of the custom skill (e.g., \"skill_01XJ5...\")." }) + .check(Schema.isMinLength(1)).check(Schema.isMaxLength(64)), + "version": Schema.optionalKey( + Schema.String.annotate({ "description": "Version to pin. Defaults to latest if omitted." }).check( + Schema.isMinLength(1) + ).check(Schema.isMaxLength(64)) + ) +}).annotate({ "description": "A user-created custom skill." }) +export type BetaManagedAgentsCustomToolInputSchema = { + readonly "type"?: "object" + readonly "properties"?: { readonly [x: string]: unknown } + readonly "required"?: ReadonlyArray +} +export const BetaManagedAgentsCustomToolInputSchema = Schema.Struct({ + "type": Schema.optionalKey( + Schema.Literal("object").annotate({ "description": "Must be 'object' for tool input schemas." }) ), - "document_title": Schema.Union([ - Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), - Schema.Null - ]).annotate({ "title": "Document Title" }), - "end_block_index": Schema.Number.annotate({ "title": "End Block Index" }).check(Schema.isInt()), - "start_block_index": Schema.Number.annotate({ "title": "Start Block Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) + "properties": Schema.optionalKey( + Schema.Record(Schema.String, Schema.Unknown).annotate({ + "description": "JSON Schema properties defining the tool's input parameters." + }) ), - "type": Schema.Literal("content_block_location").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestContentBlockLocationCitation" }) -export type BetaRequestMCPServerToolConfiguration = { - readonly "allowed_tools"?: ReadonlyArray | null - readonly "enabled"?: boolean | null + "required": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "List of required property names." }) + ) +}).annotate({ "description": "JSON Schema for custom tool input parameters." }) +export type BetaManagedAgentsDeleteMemoryStoreResponse = { + readonly "type": "memory_store_deleted" + readonly "id": string } -export const BetaRequestMCPServerToolConfiguration = Schema.Struct({ - "allowed_tools": Schema.optionalKey( - Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Allowed Tools" }) - ), - "enabled": Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null]).annotate({ "title": "Enabled" })) -}).annotate({ "title": "RequestMCPServerToolConfiguration" }) -export type BetaRequestPageLocationCitation = { - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string | null - readonly "end_page_number": number - readonly "start_page_number": number - readonly "type": "page_location" +export const BetaManagedAgentsDeleteMemoryStoreResponse = Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("memory_store_deleted"), + "id": Schema.String.annotate({ + "description": + "ID of the deleted memory store (a `memstore_...` identifier). The store and all its memories and versions are no longer retrievable." + }) + }).annotate({ "description": "Response from deleting a `memory_store`. Confirms the deleted ID." }) +], { mode: "oneOf" }) +export type BetaManagedAgentsDeleteSessionResource = { + readonly "type": "session_resource_deleted" + readonly "id": string } -export const BetaRequestPageLocationCitation = Schema.Struct({ - "cited_text": Schema.String.annotate({ "title": "Cited Text" }), - "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) - ), - "document_title": Schema.Union([ - Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), - Schema.Null - ]).annotate({ "title": "Document Title" }), - "end_page_number": Schema.Number.annotate({ "title": "End Page Number" }).check(Schema.isInt()), - "start_page_number": Schema.Number.annotate({ "title": "Start Page Number" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(1) - ), - "type": Schema.Literal("page_location").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestPageLocationCitation" }) -export type BetaRequestSearchResultLocationCitation = { - readonly "cited_text": string - readonly "end_block_index": number - readonly "search_result_index": number - readonly "source": string - readonly "start_block_index": number - readonly "title": string | null - readonly "type": "search_result_location" +export const BetaManagedAgentsDeleteSessionResource = Schema.Struct({ + "type": Schema.Literal("session_resource_deleted"), + "id": Schema.String +}).annotate({ "description": "Confirmation of resource deletion." }) +export type BetaManagedAgentsDeletedCredential = { readonly "type": "vault_credential_deleted"; readonly "id": string } +export const BetaManagedAgentsDeletedCredential = Schema.Struct({ + "type": Schema.Literal("vault_credential_deleted"), + "id": Schema.String.annotate({ "description": "Unique identifier of the deleted credential." }) +}).annotate({ "description": "Confirmation of a deleted credential." }) +export type BetaManagedAgentsDeletedMemory = { readonly "type": "memory_deleted"; readonly "id": string } +export const BetaManagedAgentsDeletedMemory = Schema.Struct({ + "type": Schema.Literal("memory_deleted"), + "id": Schema.String.annotate({ "description": "ID of the deleted memory (a `mem_...` value)." }) +}).annotate({ + "description": + "Tombstone returned by [Delete a memory](/en/api/beta/memory_stores/memories/delete). The memory's version history persists and remains listable via [List memory versions](/en/api/beta/memory_stores/memory_versions/list) until the store itself is deleted." +}) +export type BetaManagedAgentsDeletedSession = { readonly "type": "session_deleted"; readonly "id": string } +export const BetaManagedAgentsDeletedSession = Schema.Struct({ + "type": Schema.Literal("session_deleted"), + "id": Schema.String +}).annotate({ "description": "Confirmation that a `session` has been permanently deleted." }) +export type BetaManagedAgentsDeletedVault = { readonly "type": "vault_deleted"; readonly "id": string } +export const BetaManagedAgentsDeletedVault = Schema.Struct({ + "type": Schema.Literal("vault_deleted"), + "id": Schema.String.annotate({ "description": "Unique identifier of the deleted vault." }) +}).annotate({ "description": "Confirmation of a deleted vault." }) +export type BetaManagedAgentsFileRubric = { readonly "type": "file"; readonly "file_id": string } +export const BetaManagedAgentsFileRubric = Schema.Struct({ + "type": Schema.Literal("file"), + "file_id": Schema.String.annotate({ "description": "ID of the rubric file." }) +}).annotate({ "description": "Rubric referenced by a file uploaded via the Files API." }) +export type BetaManagedAgentsFileRubricParams = { readonly "type": "file"; readonly "file_id": string } +export const BetaManagedAgentsFileRubricParams = Schema.Struct({ + "type": Schema.Literal("file"), + "file_id": Schema.String.annotate({ "description": "ID of the rubric file." }) +}).annotate({ "description": "Rubric referenced by a file uploaded via the Files API." }) +export type BetaManagedAgentsGetMemoryStoreResponse = { + readonly "type": "memory_store" + readonly "id": string + readonly "name": string + readonly "description"?: string + readonly "created_at": string + readonly "updated_at": string + readonly "metadata"?: { readonly [x: string]: string } + readonly "archived_at"?: string } -export const BetaRequestSearchResultLocationCitation = Schema.Struct({ - "cited_text": Schema.String.annotate({ "title": "Cited Text" }), - "end_block_index": Schema.Number.annotate({ "title": "End Block Index" }).check(Schema.isInt()), - "search_result_index": Schema.Number.annotate({ "title": "Search Result Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) - ), - "source": Schema.String.annotate({ "title": "Source" }), - "start_block_index": Schema.Number.annotate({ "title": "Start Block Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) - ), - "title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Title" }), - "type": Schema.Literal("search_result_location").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestSearchResultLocationCitation" }) -export type BetaRequestTextEditorCodeExecutionCreateResultBlock = { - readonly "is_file_update": boolean - readonly "type": "text_editor_code_execution_create_result" +export const BetaManagedAgentsGetMemoryStoreResponse = Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("memory_store"), + "id": Schema.String.annotate({ + "description": + "Unique identifier for the memory store (a `memstore_...` tagged ID). Use this when attaching the store to a session, or in the `{memory_store_id}` path parameter of subsequent calls." + }), + "name": Schema.String.annotate({ + "description": + "Human-readable name for the store. 1–255 characters. The store's mount-path slug under `/mnt/memory/` is derived from this name." + }), + "description": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Free-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent. Empty string when unset." + }) + ), + "created_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "updated_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "metadata": Schema.optionalKey( + Schema.Record(Schema.String, Schema.String).annotate({ + "description": + "Arbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Returned on retrieve/list but not filterable." + }) + ), + "archived_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ) + }).annotate({ + "description": "Response from retrieving a `memory_store`. Returns the store, including archived stores." + }) +], { mode: "oneOf" }) +export type BetaManagedAgentsListOrder = "asc" | "desc" +export const BetaManagedAgentsListOrder = Schema.Literals(["asc", "desc"]).annotate({ "description": "ListOrder enum" }) +export type BetaManagedAgentsMCPServer = { readonly "type": "url"; readonly "name": string; readonly "url": string } +export const BetaManagedAgentsMCPServer = Schema.Union([ + Schema.Struct({ "type": Schema.Literal("url"), "name": Schema.String, "url": Schema.String }).annotate({ + "description": "Union type for MCP server connection definitions returned in API responses." + }) +], { mode: "oneOf" }) +export type BetaManagedAgentsMCPServerParams = { + readonly "type": "url" + readonly "name": string + readonly "url": string } -export const BetaRequestTextEditorCodeExecutionCreateResultBlock = Schema.Struct({ - "is_file_update": Schema.Boolean.annotate({ "title": "Is File Update" }), - "type": Schema.Literal("text_editor_code_execution_create_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestTextEditorCodeExecutionCreateResultBlock" }) -export type BetaRequestTextEditorCodeExecutionStrReplaceResultBlock = { - readonly "lines"?: ReadonlyArray | null - readonly "new_lines"?: number | null - readonly "new_start"?: number | null - readonly "old_lines"?: number | null - readonly "old_start"?: number | null - readonly "type": "text_editor_code_execution_str_replace_result" +export const BetaManagedAgentsMCPServerParams = Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("url"), + "name": Schema.String.annotate({ + "description": "Unique name for this server, referenced by mcp_toolset configurations. 1-255 characters." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), + "url": Schema.String.annotate({ "description": "Endpoint URL for the MCP server." }).check(Schema.isMaxLength(2048)) + }).annotate({ "description": "Union type for MCP server connection definitions." }) +], { mode: "oneOf" }) +export type BetaManagedAgentsMCPToolConfigParams = { + readonly "name": string + readonly "enabled"?: boolean + readonly "permission_policy"?: { readonly "type": "always_allow" } | { readonly "type": "always_ask" } } -export const BetaRequestTextEditorCodeExecutionStrReplaceResultBlock = Schema.Struct({ - "lines": Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Lines" })), - "new_lines": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "New Lines" }) +export const BetaManagedAgentsMCPToolConfigParams = Schema.Struct({ + "name": Schema.String.annotate({ "description": "Name of the MCP tool to configure. 1-128 characters." }).check( + Schema.isMinLength(1) + ).check(Schema.isMaxLength(128)), + "enabled": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether this tool is enabled. Overrides the `default_config` setting." }) ), - "new_start": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "New Start" }) - ), - "old_lines": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Old Lines" }) - ), - "old_start": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Old Start" }) - ), - "type": Schema.Literal("text_editor_code_execution_str_replace_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestTextEditorCodeExecutionStrReplaceResultBlock" }) -export type BetaRequestTextEditorCodeExecutionViewResultBlock = { - readonly "content": string - readonly "file_type": "text" | "image" | "pdf" - readonly "num_lines"?: number | null - readonly "start_line"?: number | null - readonly "total_lines"?: number | null - readonly "type": "text_editor_code_execution_view_result" -} -export const BetaRequestTextEditorCodeExecutionViewResultBlock = Schema.Struct({ - "content": Schema.String.annotate({ "title": "Content" }), - "file_type": Schema.Literals(["text", "image", "pdf"]).annotate({ "title": "File Type" }), - "num_lines": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Num Lines" }) - ), - "start_line": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Start Line" }) - ), - "total_lines": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Total Lines" }) - ), - "type": Schema.Literal("text_editor_code_execution_view_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestTextEditorCodeExecutionViewResultBlock" }) -export type BetaRequestWebSearchResultBlock = { - readonly "encrypted_content": string - readonly "page_age"?: string | null - readonly "title": string - readonly "type": "web_search_result" - readonly "url": string -} -export const BetaRequestWebSearchResultBlock = Schema.Struct({ - "encrypted_content": Schema.String.annotate({ "title": "Encrypted Content" }), - "page_age": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Page Age" })), - "title": Schema.String.annotate({ "title": "Title" }), - "type": Schema.Literal("web_search_result").annotate({ "title": "Type" }), - "url": Schema.String.annotate({ "title": "Url" }) -}).annotate({ "title": "RequestWebSearchResultBlock" }) -export type BetaRequestWebSearchResultLocationCitation = { - readonly "cited_text": string - readonly "encrypted_index": string - readonly "title": string | null - readonly "type": "web_search_result_location" - readonly "url": string -} -export const BetaRequestWebSearchResultLocationCitation = Schema.Struct({ - "cited_text": Schema.String.annotate({ "title": "Cited Text" }), - "encrypted_index": Schema.String.annotate({ "title": "Encrypted Index" }), - "title": Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(512)), Schema.Null]) - .annotate({ "title": "Title" }), - "type": Schema.Literal("web_search_result_location").annotate({ "title": "Type" }), - "url": Schema.String.annotate({ "title": "Url" }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(2048)) -}).annotate({ "title": "RequestWebSearchResultLocationCitation" }) -export type BetaResponseBashCodeExecutionOutputBlock = { - readonly "file_id": string - readonly "type": "bash_code_execution_output" -} -export const BetaResponseBashCodeExecutionOutputBlock = Schema.Struct({ - "file_id": Schema.String.annotate({ "title": "File Id" }), - "type": Schema.Literal("bash_code_execution_output").annotate({ - "title": "Type", - "default": "bash_code_execution_output" - }) -}).annotate({ "title": "ResponseBashCodeExecutionOutputBlock" }) -export type BetaResponseCharLocationCitation = { - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string | null - readonly "end_char_index": number - readonly "file_id": string | null - readonly "start_char_index": number - readonly "type": "char_location" + "permission_policy": Schema.optionalKey( + Schema.Union([ + Schema.Struct({ "type": Schema.Literal("always_allow") }).annotate({ + "description": "Permission policy for tool execution." + }), + Schema.Struct({ "type": Schema.Literal("always_ask") }).annotate({ + "description": "Permission policy for tool execution." + }) + ], { mode: "oneOf" }).annotate({ + "description": "Permission policy for this tool. Overrides the `default_config` setting." + }) + ) +}).annotate({ "description": "Configuration override for a specific MCP tool." }) +export type BetaManagedAgentsMemory = { + readonly "type": "memory" + readonly "id": string + readonly "memory_store_id": string + readonly "path": string + readonly "content"?: string + readonly "content_size_bytes": number + readonly "content_sha256": string + readonly "memory_version_id": string + readonly "created_at": string + readonly "updated_at": string } -export const BetaResponseCharLocationCitation = Schema.Struct({ - "cited_text": Schema.String.annotate({ "title": "Cited Text" }), - "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) - ), - "document_title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Document Title" }), - "end_char_index": Schema.Number.annotate({ "title": "End Char Index" }).check(Schema.isInt()), - "file_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "File Id", "default": null }), - "start_char_index": Schema.Number.annotate({ "title": "Start Char Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) +export const BetaManagedAgentsMemory = Schema.Struct({ + "type": Schema.Literal("memory"), + "id": Schema.String.annotate({ + "description": + "Unique identifier for this memory (a `mem_...` value). Stable across renames; use this ID, not the path, to read, update, or delete the memory." + }), + "memory_store_id": Schema.String.annotate({ + "description": "ID of the memory store this memory belongs to (a `memstore_...` value)." + }), + "path": Schema.String.annotate({ + "description": + "Hierarchical path of the memory within the store, e.g. `/projects/foo/notes.md`. Always starts with `/`. Paths are case-sensitive and unique within a store. Maximum 1,024 bytes." + }), + "content": Schema.optionalKey( + Schema.String.annotate({ + "description": + "The memory's UTF-8 text content. Populated when `view=full`; `null` when `view=basic`. Maximum 100 kB (102,400 bytes)." + }) ), - "type": Schema.Literal("char_location").annotate({ "title": "Type", "default": "char_location" }) -}).annotate({ "title": "ResponseCharLocationCitation" }) -export type BetaResponseCitationsConfig = { readonly "enabled": boolean } -export const BetaResponseCitationsConfig = Schema.Struct({ - "enabled": Schema.Boolean.annotate({ "title": "Enabled", "default": false }) -}).annotate({ "title": "ResponseCitationsConfig" }) -export type BetaResponseClearThinking20251015Edit = { - readonly "cleared_input_tokens": number - readonly "cleared_thinking_turns": number - readonly "type": "clear_thinking_20251015" -} -export const BetaResponseClearThinking20251015Edit = Schema.Struct({ - "cleared_input_tokens": Schema.Number.annotate({ - "title": "Cleared Input Tokens", - "description": "Number of input tokens cleared by this edit." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - "cleared_thinking_turns": Schema.Number.annotate({ - "title": "Cleared Thinking Turns", - "description": "Number of thinking turns that were cleared." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - "type": Schema.Literal("clear_thinking_20251015").annotate({ - "title": "Type", - "description": "The type of context management edit applied.", - "default": "clear_thinking_20251015" - }) -}).annotate({ "title": "ResponseClearThinking20251015Edit" }) -export type BetaResponseClearToolUses20250919Edit = { - readonly "cleared_input_tokens": number - readonly "cleared_tool_uses": number - readonly "type": "clear_tool_uses_20250919" -} -export const BetaResponseClearToolUses20250919Edit = Schema.Struct({ - "cleared_input_tokens": Schema.Number.annotate({ - "title": "Cleared Input Tokens", - "description": "Number of input tokens cleared by this edit." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - "cleared_tool_uses": Schema.Number.annotate({ - "title": "Cleared Tool Uses", - "description": "Number of tool uses that were cleared." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - "type": Schema.Literal("clear_tool_uses_20250919").annotate({ - "title": "Type", - "description": "The type of context management edit applied.", - "default": "clear_tool_uses_20250919" - }) -}).annotate({ "title": "ResponseClearToolUses20250919Edit" }) -export type BetaResponseCodeExecutionOutputBlock = { - readonly "file_id": string - readonly "type": "code_execution_output" -} -export const BetaResponseCodeExecutionOutputBlock = Schema.Struct({ - "file_id": Schema.String.annotate({ "title": "File Id" }), - "type": Schema.Literal("code_execution_output").annotate({ "title": "Type", "default": "code_execution_output" }) -}).annotate({ "title": "ResponseCodeExecutionOutputBlock" }) -export type BetaResponseCompactionBlock = { readonly "content": string | null; readonly "type": "compaction" } -export const BetaResponseCompactionBlock = Schema.Struct({ - "content": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Content", - "description": "Summary of compacted content, or null if compaction failed" + "content_size_bytes": Schema.Number.annotate({ + "description": "Size of `content` in bytes (the UTF-8 plaintext length). Always populated, regardless of `view`.", + "format": "int32" + }).check(Schema.isInt()), + "content_sha256": Schema.String.annotate({ + "description": + "Lowercase hex SHA-256 digest of the UTF-8 `content` bytes (64 characters). The server applies no normalization, so clients can compute the same hash locally for staleness checks and as the value for a `content_sha256` precondition on update. Always populated, regardless of `view`." }), - "type": Schema.Literal("compaction").annotate({ "title": "Type", "default": "compaction" }) + "memory_version_id": Schema.String.annotate({ + "description": + "ID of the `memory_version` representing this memory's current content (a `memver_...` value). This is the authoritative head pointer; `memory_version` objects do not carry an `is_latest` flag, so compare against this field instead. Enumerate the full history via [List memory versions](/en/api/beta/memory_stores/memory_versions/list)." + }), + "created_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "updated_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) }).annotate({ - "title": "ResponseCompactionBlock", "description": - "A compaction block returned when autocompact is triggered.\n\nWhen content is None, it indicates the compaction failed to produce a valid\nsummary (e.g., malformed output from the model). Clients may round-trip\ncompaction blocks with null content; the server treats them as no-ops." + "A `memory` object: a single text document at a hierarchical path inside a memory store. The `content` field is populated when `view=full` and `null` when `view=basic`; the `content_size_bytes` and `content_sha256` fields are always populated so sync clients can diff without fetching content. Memories are addressed by their `mem_...` ID; the path is the create key and can be changed via update." }) -export type BetaResponseContainerUploadBlock = { readonly "file_id": string; readonly "type": "container_upload" } -export const BetaResponseContainerUploadBlock = Schema.Struct({ - "file_id": Schema.String.annotate({ "title": "File Id" }), - "type": Schema.Literal("container_upload").annotate({ "title": "Type", "default": "container_upload" }) -}).annotate({ - "title": "ResponseContainerUploadBlock", - "description": "Response model for a file uploaded to the container." +export type BetaManagedAgentsMemoryListItem = { + readonly "type": "memory" + readonly "id": string + readonly "memory_store_id": string + readonly "path": string + readonly "content"?: string + readonly "content_size_bytes": number + readonly "content_sha256": string + readonly "memory_version_id": string + readonly "created_at": string + readonly "updated_at": string +} | { readonly "type": "memory_prefix"; readonly "path": string } +export const BetaManagedAgentsMemoryListItem = Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("memory"), + "id": Schema.String.annotate({ + "description": + "Unique identifier for this memory (a `mem_...` value). Stable across renames; use this ID, not the path, to read, update, or delete the memory." + }), + "memory_store_id": Schema.String.annotate({ + "description": "ID of the memory store this memory belongs to (a `memstore_...` value)." + }), + "path": Schema.String.annotate({ + "description": + "Hierarchical path of the memory within the store, e.g. `/projects/foo/notes.md`. Always starts with `/`. Paths are case-sensitive and unique within a store. Maximum 1,024 bytes." + }), + "content": Schema.optionalKey( + Schema.String.annotate({ + "description": + "The memory's UTF-8 text content. Populated when `view=full`; `null` when `view=basic`. Maximum 100 kB (102,400 bytes)." + }) + ), + "content_size_bytes": Schema.Number.annotate({ + "description": "Size of `content` in bytes (the UTF-8 plaintext length). Always populated, regardless of `view`.", + "format": "int32" + }).check(Schema.isInt()), + "content_sha256": Schema.String.annotate({ + "description": + "Lowercase hex SHA-256 digest of the UTF-8 `content` bytes (64 characters). The server applies no normalization, so clients can compute the same hash locally for staleness checks and as the value for a `content_sha256` precondition on update. Always populated, regardless of `view`." + }), + "memory_version_id": Schema.String.annotate({ + "description": + "ID of the `memory_version` representing this memory's current content (a `memver_...` value). This is the authoritative head pointer; `memory_version` objects do not carry an `is_latest` flag, so compare against this field instead. Enumerate the full history via [List memory versions](/en/api/beta/memory_stores/memory_versions/list)." + }), + "created_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "updated_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ + "description": + "One item in a [List memories](/en/api/beta/memory_stores/memories/list) response: either a `memory` object or, when `depth` is set, a `memory_prefix` rollup marker." + }), + Schema.Struct({ + "type": Schema.Literal("memory_prefix"), + "path": Schema.String.annotate({ + "description": + "The rolled-up path prefix, including a trailing `/` (e.g. `/projects/foo/`). Pass this value as `path_prefix` on a subsequent list call to drill into the directory." + }) + }).annotate({ + "description": + "One item in a [List memories](/en/api/beta/memory_stores/memories/list) response: either a `memory` object or, when `depth` is set, a `memory_prefix` rollup marker." + }) +], { mode: "oneOf" }) +export type BetaManagedAgentsMemoryPathConflictError = { + readonly "type": "memory_path_conflict_error" + readonly "message"?: string + readonly "conflicting_path"?: string + readonly "conflicting_memory_id"?: string +} +export const BetaManagedAgentsMemoryPathConflictError = Schema.Struct({ + "type": Schema.Literal("memory_path_conflict_error"), + "message": Schema.optionalKey(Schema.String), + "conflicting_path": Schema.optionalKey(Schema.String), + "conflicting_memory_id": Schema.optionalKey(Schema.String) }) -export type BetaResponseContentBlockLocationCitation = { - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string | null - readonly "end_block_index": number - readonly "file_id": string | null - readonly "start_block_index": number - readonly "type": "content_block_location" +export type BetaManagedAgentsMemoryPreconditionFailedError = { + readonly "type": "memory_precondition_failed_error" + readonly "message"?: string } -export const BetaResponseContentBlockLocationCitation = Schema.Struct({ - "cited_text": Schema.String.annotate({ "title": "Cited Text" }), - "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) - ), - "document_title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Document Title" }), - "end_block_index": Schema.Number.annotate({ "title": "End Block Index" }).check(Schema.isInt()), - "file_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "File Id", "default": null }), - "start_block_index": Schema.Number.annotate({ "title": "Start Block Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) - ), - "type": Schema.Literal("content_block_location").annotate({ "title": "Type", "default": "content_block_location" }) -}).annotate({ "title": "ResponseContentBlockLocationCitation" }) -export type BetaResponseMCPToolUseBlock = { +export const BetaManagedAgentsMemoryPreconditionFailedError = Schema.Struct({ + "type": Schema.Literal("memory_precondition_failed_error"), + "message": Schema.optionalKey(Schema.String) +}) +export type BetaManagedAgentsMemoryStore = { + readonly "type": "memory_store" readonly "id": string - readonly "input": { readonly [x: string]: Schema.Json } readonly "name": string - readonly "server_name": string - readonly "type": "mcp_tool_use" -} -export const BetaResponseMCPToolUseBlock = Schema.Struct({ - "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$"))), - "input": Schema.Record(Schema.String, Schema.Json).annotate({ "title": "Input" }), - "name": Schema.String.annotate({ "title": "Name", "description": "The name of the MCP tool" }), - "server_name": Schema.String.annotate({ "title": "Server Name", "description": "The name of the MCP server" }), - "type": Schema.Literal("mcp_tool_use").annotate({ "title": "Type", "default": "mcp_tool_use" }) -}).annotate({ "title": "ResponseMCPToolUseBlock" }) -export type BetaResponsePageLocationCitation = { - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string | null - readonly "end_page_number": number - readonly "file_id": string | null - readonly "start_page_number": number - readonly "type": "page_location" + readonly "description"?: string + readonly "created_at": string + readonly "updated_at": string + readonly "metadata"?: { readonly [x: string]: string } + readonly "archived_at"?: string } -export const BetaResponsePageLocationCitation = Schema.Struct({ - "cited_text": Schema.String.annotate({ "title": "Cited Text" }), - "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) - ), - "document_title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Document Title" }), - "end_page_number": Schema.Number.annotate({ "title": "End Page Number" }).check(Schema.isInt()), - "file_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "File Id", "default": null }), - "start_page_number": Schema.Number.annotate({ "title": "Start Page Number" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(1) - ), - "type": Schema.Literal("page_location").annotate({ "title": "Type", "default": "page_location" }) -}).annotate({ "title": "ResponsePageLocationCitation" }) -export type BetaResponseRedactedThinkingBlock = { readonly "data": string; readonly "type": "redacted_thinking" } -export const BetaResponseRedactedThinkingBlock = Schema.Struct({ - "data": Schema.String.annotate({ "title": "Data" }), - "type": Schema.Literal("redacted_thinking").annotate({ "title": "Type", "default": "redacted_thinking" }) -}).annotate({ "title": "ResponseRedactedThinkingBlock" }) -export type BetaResponseSearchResultLocationCitation = { - readonly "cited_text": string - readonly "end_block_index": number - readonly "search_result_index": number - readonly "source": string - readonly "start_block_index": number - readonly "title": string | null - readonly "type": "search_result_location" -} -export const BetaResponseSearchResultLocationCitation = Schema.Struct({ - "cited_text": Schema.String.annotate({ "title": "Cited Text" }), - "end_block_index": Schema.Number.annotate({ "title": "End Block Index" }).check(Schema.isInt()), - "search_result_index": Schema.Number.annotate({ "title": "Search Result Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) - ), - "source": Schema.String.annotate({ "title": "Source" }), - "start_block_index": Schema.Number.annotate({ "title": "Start Block Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) - ), - "title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Title" }), - "type": Schema.Literal("search_result_location").annotate({ "title": "Type", "default": "search_result_location" }) -}).annotate({ "title": "ResponseSearchResultLocationCitation" }) -export type BetaResponseTextEditorCodeExecutionCreateResultBlock = { - readonly "is_file_update": boolean - readonly "type": "text_editor_code_execution_create_result" -} -export const BetaResponseTextEditorCodeExecutionCreateResultBlock = Schema.Struct({ - "is_file_update": Schema.Boolean.annotate({ "title": "Is File Update" }), - "type": Schema.Literal("text_editor_code_execution_create_result").annotate({ - "title": "Type", - "default": "text_editor_code_execution_create_result" - }) -}).annotate({ "title": "ResponseTextEditorCodeExecutionCreateResultBlock" }) -export type BetaResponseTextEditorCodeExecutionStrReplaceResultBlock = { - readonly "lines": ReadonlyArray | null - readonly "new_lines": number | null - readonly "new_start": number | null - readonly "old_lines": number | null - readonly "old_start": number | null - readonly "type": "text_editor_code_execution_str_replace_result" -} -export const BetaResponseTextEditorCodeExecutionStrReplaceResultBlock = Schema.Struct({ - "lines": Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Lines", "default": null }), - "new_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ - "title": "New Lines", - "default": null - }), - "new_start": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ - "title": "New Start", - "default": null - }), - "old_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ - "title": "Old Lines", - "default": null - }), - "old_start": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ - "title": "Old Start", - "default": null - }), - "type": Schema.Literal("text_editor_code_execution_str_replace_result").annotate({ - "title": "Type", - "default": "text_editor_code_execution_str_replace_result" - }) -}).annotate({ "title": "ResponseTextEditorCodeExecutionStrReplaceResultBlock" }) -export type BetaResponseTextEditorCodeExecutionViewResultBlock = { - readonly "content": string - readonly "file_type": "text" | "image" | "pdf" - readonly "num_lines": number | null - readonly "start_line": number | null - readonly "total_lines": number | null - readonly "type": "text_editor_code_execution_view_result" -} -export const BetaResponseTextEditorCodeExecutionViewResultBlock = Schema.Struct({ - "content": Schema.String.annotate({ "title": "Content" }), - "file_type": Schema.Literals(["text", "image", "pdf"]).annotate({ "title": "File Type" }), - "num_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ - "title": "Num Lines", - "default": null - }), - "start_line": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ - "title": "Start Line", - "default": null - }), - "total_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ - "title": "Total Lines", - "default": null +export const BetaManagedAgentsMemoryStore = Schema.Struct({ + "type": Schema.Literal("memory_store"), + "id": Schema.String.annotate({ + "description": + "Unique identifier for the memory store (a `memstore_...` tagged ID). Use this when attaching the store to a session, or in the `{memory_store_id}` path parameter of subsequent calls." }), - "type": Schema.Literal("text_editor_code_execution_view_result").annotate({ - "title": "Type", - "default": "text_editor_code_execution_view_result" - }) -}).annotate({ "title": "ResponseTextEditorCodeExecutionViewResultBlock" }) -export type BetaResponseThinkingBlock = { - readonly "signature": string - readonly "thinking": string - readonly "type": "thinking" -} -export const BetaResponseThinkingBlock = Schema.Struct({ - "signature": Schema.String.annotate({ "title": "Signature" }), - "thinking": Schema.String.annotate({ "title": "Thinking" }), - "type": Schema.Literal("thinking").annotate({ "title": "Type", "default": "thinking" }) -}).annotate({ "title": "ResponseThinkingBlock" }) -export type BetaResponseToolReferenceBlock = { readonly "tool_name": string; readonly "type": "tool_reference" } -export const BetaResponseToolReferenceBlock = Schema.Struct({ - "tool_name": Schema.String.annotate({ "title": "Tool Name" }).check(Schema.isMinLength(1)).check( - Schema.isMaxLength(256) - ).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]{1,256}$"))), - "type": Schema.Literal("tool_reference").annotate({ "title": "Type", "default": "tool_reference" }) -}).annotate({ "title": "ResponseToolReferenceBlock" }) -export type BetaResponseWebSearchResultBlock = { - readonly "encrypted_content": string - readonly "page_age": string | null - readonly "title": string - readonly "type": "web_search_result" - readonly "url": string -} -export const BetaResponseWebSearchResultBlock = Schema.Struct({ - "encrypted_content": Schema.String.annotate({ "title": "Encrypted Content" }), - "page_age": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Page Age", "default": null }), - "title": Schema.String.annotate({ "title": "Title" }), - "type": Schema.Literal("web_search_result").annotate({ "title": "Type", "default": "web_search_result" }), - "url": Schema.String.annotate({ "title": "Url" }) -}).annotate({ "title": "ResponseWebSearchResultBlock" }) -export type BetaResponseWebSearchResultLocationCitation = { - readonly "cited_text": string - readonly "encrypted_index": string - readonly "title": string | null - readonly "type": "web_search_result_location" - readonly "url": string -} -export const BetaResponseWebSearchResultLocationCitation = Schema.Struct({ - "cited_text": Schema.String.annotate({ "title": "Cited Text" }), - "encrypted_index": Schema.String.annotate({ "title": "Encrypted Index" }), - "title": Schema.Union([Schema.String.check(Schema.isMaxLength(512)), Schema.Null]).annotate({ "title": "Title" }), - "type": Schema.Literal("web_search_result_location").annotate({ - "title": "Type", - "default": "web_search_result_location" + "name": Schema.String.annotate({ + "description": + "Human-readable name for the store. 1–255 characters. The store's mount-path slug under `/mnt/memory/` is derived from this name." }), - "url": Schema.String.annotate({ "title": "Url" }) -}).annotate({ "title": "ResponseWebSearchResultLocationCitation" }) -export type BetaServerToolCaller = { readonly "tool_id": string; readonly "type": "code_execution_20250825" } -export const BetaServerToolCaller = Schema.Struct({ - "tool_id": Schema.String.annotate({ "title": "Tool Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + "description": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Free-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent. Empty string when unset." + }) ), - "type": Schema.Literal("code_execution_20250825").annotate({ "title": "Type" }) -}).annotate({ "title": "ServerToolCaller", "description": "Tool invocation generated by a server-side tool." }) -export type BetaServerToolCaller_20260120 = { readonly "tool_id": string; readonly "type": "code_execution_20260120" } -export const BetaServerToolCaller_20260120 = Schema.Struct({ - "tool_id": Schema.String.annotate({ "title": "Tool Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + "created_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "updated_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "metadata": Schema.optionalKey( + Schema.Record(Schema.String, Schema.String).annotate({ + "description": + "Arbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Returned on retrieve/list but not filterable." + }) ), - "type": Schema.Literal("code_execution_20260120").annotate({ "title": "Type" }) -}).annotate({ "title": "ServerToolCaller_20260120" }) -export type BetaServerToolUsage = { readonly "web_fetch_requests": number; readonly "web_search_requests": number } -export const BetaServerToolUsage = Schema.Struct({ - "web_fetch_requests": Schema.Number.annotate({ - "title": "Web Fetch Requests", - "description": "The number of web fetch tool requests.", - "default": 0 - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - "web_search_requests": Schema.Number.annotate({ - "title": "Web Search Requests", - "description": "The number of web search tool requests.", - "default": 0 - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)) -}).annotate({ "title": "ServerToolUsage" }) -export type BetaSignatureContentBlockDelta = { readonly "signature": string; readonly "type": "signature_delta" } -export const BetaSignatureContentBlockDelta = Schema.Struct({ - "signature": Schema.String.annotate({ "title": "Signature" }), - "type": Schema.Literal("signature_delta").annotate({ "title": "Type", "default": "signature_delta" }) -}).annotate({ "title": "SignatureContentBlockDelta" }) -export type BetaSkill = { - readonly "skill_id": string - readonly "type": "anthropic" | "custom" - readonly "version": string -} -export const BetaSkill = Schema.Struct({ - "skill_id": Schema.String.annotate({ "title": "Skill Id", "description": "Skill ID" }).check(Schema.isMinLength(1)) - .check(Schema.isMaxLength(64)), - "type": Schema.Literals(["anthropic", "custom"]).annotate({ - "title": "Type", - "description": "Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)" - }), - "version": Schema.String.annotate({ - "title": "Version", - "description": "Skill version or 'latest' for most recent version" - }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(64)) -}).annotate({ "title": "Skill", "description": "A skill that was loaded in a container (response model)." }) -export type BetaSkillParams = { - readonly "skill_id": string - readonly "type": "anthropic" | "custom" - readonly "version"?: string -} -export const BetaSkillParams = Schema.Struct({ - "skill_id": Schema.String.annotate({ "title": "Skill Id", "description": "Skill ID" }).check(Schema.isMinLength(1)) - .check(Schema.isMaxLength(64)), - "type": Schema.Literals(["anthropic", "custom"]).annotate({ - "title": "Type", - "description": "Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)" - }), - "version": Schema.optionalKey( - Schema.String.annotate({ "title": "Version", "description": "Skill version or 'latest' for most recent version" }) - .check(Schema.isMinLength(1)).check(Schema.isMaxLength(64)) + "archived_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) ) }).annotate({ - "title": "SkillParams", - "description": "Specification for a skill to be loaded in a container (request model)." + "description": + "A `memory_store`: a named container for agent memories, scoped to a workspace. Attach a store to a session via `resources[]` to mount it as a directory the agent can read and write." }) -export type BetaSkillVersion = { - readonly "created_at": string - readonly "description": string - readonly "directory": string +export type BetaManagedAgentsMemoryVersion = { + readonly "type": "memory_version" readonly "id": string - readonly "name": string - readonly "skill_id": string - readonly "type": string - readonly "version": string -} -export const BetaSkillVersion = Schema.Struct({ - "created_at": Schema.String.annotate({ - "title": "Created At", - "description": "ISO 8601 timestamp of when the skill version was created." - }), - "description": Schema.String.annotate({ - "title": "Description", - "description": "Description of the skill version.\n\nThis is extracted from the SKILL.md file in the skill upload." + readonly "memory_store_id": string + readonly "memory_id": string + readonly "path"?: string + readonly "operation": "created" | "modified" | "deleted" + readonly "content"?: string + readonly "content_size_bytes"?: number + readonly "content_sha256"?: string + readonly "created_by"?: { readonly "type": "session_actor"; readonly "session_id": string } | { + readonly "type": "api_actor" + readonly "api_key_id": string + } | { readonly "type": "user_actor"; readonly "user_id": string } + readonly "created_at": string + readonly "redacted_at"?: string + readonly "redacted_by"?: { readonly "type": "session_actor"; readonly "session_id": string } | { + readonly "type": "api_actor" + readonly "api_key_id": string + } | { readonly "type": "user_actor"; readonly "user_id": string } +} +export const BetaManagedAgentsMemoryVersion = Schema.Struct({ + "type": Schema.Literal("memory_version"), + "id": Schema.String.annotate({ "description": "Unique identifier for this version (a `memver_...` value)." }), + "memory_store_id": Schema.String.annotate({ + "description": "ID of the memory store this version belongs to (a `memstore_...` value)." }), - "directory": Schema.String.annotate({ - "title": "Directory", + "memory_id": Schema.String.annotate({ "description": - "Directory name of the skill version.\n\nThis is the top-level directory name that was extracted from the uploaded files." - }), - "id": Schema.String.annotate({ - "title": "Id", - "description": "Unique identifier for the skill version.\n\nThe format and length of IDs may change over time." + "ID of the memory this version snapshots (a `mem_...` value). Remains valid after the memory is deleted; pass it as `memory_id` to [List memory versions](/en/api/beta/memory_stores/memory_versions/list) to retrieve the full lineage including the `deleted` row." }), - "name": Schema.String.annotate({ - "title": "Name", + "path": Schema.optionalKey( + Schema.String.annotate({ + "description": "The memory's path at the time of this write. `null` if and only if `redacted_at` is set." + }) + ), + "operation": Schema.Literals(["created", "modified", "deleted"]).annotate({ "description": - "Human-readable name of the skill version.\n\nThis is extracted from the SKILL.md file in the skill upload." + "The kind of mutation a `memory_version` records. Every non-no-op mutation to a memory appends exactly one version row with one of these values." }), - "skill_id": Schema.String.annotate({ - "title": "Skill Id", - "description": "Identifier for the skill that this version belongs to." - }), - "type": Schema.String.annotate({ - "title": "Type", - "description": "Object type.\n\nFor Skill Versions, this is always `\"skill_version\"`.", - "default": "skill_version" - }), - "version": Schema.String.annotate({ - "title": "Version", - "description": - "Version identifier for the skill.\n\nEach version is identified by a Unix epoch timestamp (e.g., \"1759178010641129\")." - }) -}).annotate({ "title": "SkillVersion" }) -export type BetaSpeed = "standard" | "fast" -export const BetaSpeed = Schema.Literals(["standard", "fast"]).annotate({ "title": "Speed" }) -export type BetaTextContentBlockDelta = { readonly "text": string; readonly "type": "text_delta" } -export const BetaTextContentBlockDelta = Schema.Struct({ - "text": Schema.String.annotate({ "title": "Text" }), - "type": Schema.Literal("text_delta").annotate({ "title": "Type", "default": "text_delta" }) -}).annotate({ "title": "TextContentBlockDelta" }) -export type BetaTextEditorCodeExecutionToolResultErrorCode = - | "invalid_tool_input" - | "unavailable" - | "too_many_requests" - | "execution_time_exceeded" - | "file_not_found" -export const BetaTextEditorCodeExecutionToolResultErrorCode = Schema.Literals([ - "invalid_tool_input", - "unavailable", - "too_many_requests", - "execution_time_exceeded", - "file_not_found" -]).annotate({ "title": "TextEditorCodeExecutionToolResultErrorCode" }) -export type BetaThinkingConfigAdaptive = { readonly "type": "adaptive" } -export const BetaThinkingConfigAdaptive = Schema.Struct({ - "type": Schema.Literal("adaptive").annotate({ "title": "Type" }) -}).annotate({ "title": "ThinkingConfigAdaptive" }) -export type BetaThinkingConfigDisabled = { readonly "type": "disabled" } -export const BetaThinkingConfigDisabled = Schema.Struct({ - "type": Schema.Literal("disabled").annotate({ "title": "Type" }) -}).annotate({ "title": "ThinkingConfigDisabled" }) -export type BetaThinkingConfigEnabled = { readonly "budget_tokens": number; readonly "type": "enabled" } -export const BetaThinkingConfigEnabled = Schema.Struct({ - "budget_tokens": Schema.Number.annotate({ - "title": "Budget Tokens", - "description": - "Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.\n\nMust be ≥1024 and less than `max_tokens`.\n\nSee [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1024)), - "type": Schema.Literal("enabled").annotate({ "title": "Type" }) -}).annotate({ "title": "ThinkingConfigEnabled" }) -export type BetaThinkingContentBlockDelta = { readonly "thinking": string; readonly "type": "thinking_delta" } -export const BetaThinkingContentBlockDelta = Schema.Struct({ - "thinking": Schema.String.annotate({ "title": "Thinking" }), - "type": Schema.Literal("thinking_delta").annotate({ "title": "Type", "default": "thinking_delta" }) -}).annotate({ "title": "ThinkingContentBlockDelta" }) -export type BetaThinkingTurns = { readonly "type": "thinking_turns"; readonly "value": number } -export const BetaThinkingTurns = Schema.Struct({ - "type": Schema.Literal("thinking_turns").annotate({ "title": "Type" }), - "value": Schema.Number.annotate({ "title": "Value" }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)) -}).annotate({ "title": "ThinkingTurns" }) -export type BetaToolChoiceAny = { readonly "disable_parallel_tool_use"?: boolean; readonly "type": "any" } -export const BetaToolChoiceAny = Schema.Struct({ - "disable_parallel_tool_use": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Disable Parallel Tool Use", + "content": Schema.optionalKey( + Schema.String.annotate({ "description": - "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output exactly one tool use." + "The memory's UTF-8 text content as of this version. `null` when `view=basic`, when `operation` is `deleted`, or when `redacted_at` is set." }) ), - "type": Schema.Literal("any").annotate({ "title": "Type" }) -}).annotate({ "title": "ToolChoiceAny", "description": "The model will use any available tools." }) -export type BetaToolChoiceAuto = { readonly "disable_parallel_tool_use"?: boolean; readonly "type": "auto" } -export const BetaToolChoiceAuto = Schema.Struct({ - "disable_parallel_tool_use": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Disable Parallel Tool Use", + "content_size_bytes": Schema.optionalKey( + Schema.Number.annotate({ "description": - "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output at most one tool use." + "Size of `content` in bytes as of this version. `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise.", + "format": "int32" + }).check(Schema.isInt()) + ), + "content_sha256": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Lowercase hex SHA-256 digest of `content` as of this version (64 characters). `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise." }) ), - "type": Schema.Literal("auto").annotate({ "title": "Type" }) -}).annotate({ "title": "ToolChoiceAuto", "description": "The model will automatically decide whether to use tools." }) -export type BetaToolChoiceNone = { readonly "type": "none" } -export const BetaToolChoiceNone = Schema.Struct({ "type": Schema.Literal("none").annotate({ "title": "Type" }) }) - .annotate({ "title": "ToolChoiceNone", "description": "The model will not be allowed to use tools." }) -export type BetaToolChoiceTool = { - readonly "disable_parallel_tool_use"?: boolean - readonly "name": string - readonly "type": "tool" -} -export const BetaToolChoiceTool = Schema.Struct({ - "disable_parallel_tool_use": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Disable Parallel Tool Use", + "created_by": Schema.optionalKey( + Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("session_actor"), + "session_id": Schema.String.annotate({ + "description": + "ID of the session that performed the write (a `sesn_...` value). Look up the session via [Retrieve a session](/en/api/sessions-retrieve) for further provenance." + }).check(Schema.isMinLength(1)) + }).annotate({ + "description": + "Identifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the [Sessions API](/en/api/sessions-retrieve)." + }), + Schema.Struct({ + "type": Schema.Literal("api_actor"), + "api_key_id": Schema.String.annotate({ + "description": "ID of the API key that performed the write. This identifies the key, not the secret." + }).check(Schema.isMinLength(1)) + }).annotate({ + "description": + "Identifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the [Sessions API](/en/api/sessions-retrieve)." + }), + Schema.Struct({ + "type": Schema.Literal("user_actor"), + "user_id": Schema.String.annotate({ + "description": "ID of the user who performed the write (a `user_...` value)." + }).check(Schema.isMinLength(1)) + }).annotate({ + "description": + "Identifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the [Sessions API](/en/api/sessions-retrieve)." + }) + ], { mode: "oneOf" }).annotate({ "description": - "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output exactly one tool use." + "Who performed this write: a `session_actor`, `api_actor`, or `user_actor`. Captured at write time and preserved through redaction." }) ), - "name": Schema.String.annotate({ "title": "Name", "description": "The name of the tool to use." }), - "type": Schema.Literal("tool").annotate({ "title": "Type" }) + "created_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "redacted_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ), + "redacted_by": Schema.optionalKey( + Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("session_actor"), + "session_id": Schema.String.annotate({ + "description": + "ID of the session that performed the write (a `sesn_...` value). Look up the session via [Retrieve a session](/en/api/sessions-retrieve) for further provenance." + }).check(Schema.isMinLength(1)) + }).annotate({ + "description": + "Identifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the [Sessions API](/en/api/sessions-retrieve)." + }), + Schema.Struct({ + "type": Schema.Literal("api_actor"), + "api_key_id": Schema.String.annotate({ + "description": "ID of the API key that performed the write. This identifies the key, not the secret." + }).check(Schema.isMinLength(1)) + }).annotate({ + "description": + "Identifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the [Sessions API](/en/api/sessions-retrieve)." + }), + Schema.Struct({ + "type": Schema.Literal("user_actor"), + "user_id": Schema.String.annotate({ + "description": "ID of the user who performed the write (a `user_...` value)." + }).check(Schema.isMinLength(1)) + }).annotate({ + "description": + "Identifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the [Sessions API](/en/api/sessions-retrieve)." + }) + ], { mode: "oneOf" }).annotate({ + "description": + "Who redacted this version, or `null` if it has not been redacted. In practice always an `api_actor` or `user_actor` (agents do not have a redact capability)." + }) + ) }).annotate({ - "title": "ToolChoiceTool", - "description": "The model will use the specified tool with `tool_choice.name`." + "description": + "A `memory_version` object: one immutable, attributed row in a memory's append-only history. Every non-no-op mutation to a memory produces a new version. Versions belong to the store (not the individual memory) and persist after the memory is deleted. Retrieving a redacted version returns 200 with `content`, `path`, `content_size_bytes`, and `content_sha256` set to `null`; branch on `redacted_at`, not HTTP status." }) -export type BetaToolSearchToolResultErrorCode = - | "invalid_tool_input" - | "unavailable" - | "too_many_requests" - | "execution_time_exceeded" -export const BetaToolSearchToolResultErrorCode = Schema.Literals([ - "invalid_tool_input", - "unavailable", - "too_many_requests", - "execution_time_exceeded" -]).annotate({ "title": "ToolSearchToolResultErrorCode" }) -export type BetaToolUsesKeep = { readonly "type": "tool_uses"; readonly "value": number } -export const BetaToolUsesKeep = Schema.Struct({ - "type": Schema.Literal("tool_uses").annotate({ "title": "Type" }), - "value": Schema.Number.annotate({ "title": "Value" }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)) -}).annotate({ "title": "ToolUsesKeep" }) -export type BetaToolUsesTrigger = { readonly "type": "tool_uses"; readonly "value": number } -export const BetaToolUsesTrigger = Schema.Struct({ - "type": Schema.Literal("tool_uses").annotate({ "title": "Type" }), - "value": Schema.Number.annotate({ "title": "Value" }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)) -}).annotate({ "title": "ToolUsesTrigger" }) -export type BetaURLImageSource = { readonly "type": "url"; readonly "url": string } -export const BetaURLImageSource = Schema.Struct({ - "type": Schema.Literal("url").annotate({ "title": "Type" }), - "url": Schema.String.annotate({ "title": "Url" }) -}).annotate({ "title": "URLImageSource" }) -export type BetaURLPDFSource = { readonly "type": "url"; readonly "url": string } -export const BetaURLPDFSource = Schema.Struct({ - "type": Schema.Literal("url").annotate({ "title": "Type" }), - "url": Schema.String.annotate({ "title": "Url" }) -}).annotate({ "title": "URLPDFSource" }) -export type BetaUserLocation = { - readonly "city"?: string | null - readonly "country"?: string | null - readonly "region"?: string | null - readonly "timezone"?: string | null - readonly "type": "approximate" +export type BetaManagedAgentsMemoryVersionOperation = "created" | "modified" | "deleted" +export const BetaManagedAgentsMemoryVersionOperation = Schema.Literals(["created", "modified", "deleted"]).annotate({ + "description": + "The kind of mutation a `memory_version` records. Every non-no-op mutation to a memory appends exactly one version row with one of these values." +}) +export type BetaManagedAgentsMemoryView = "basic" | "full" +export const BetaManagedAgentsMemoryView = Schema.Literals(["basic", "full"]).annotate({ + "description": + "Selects which projection of a `memory` or `memory_version` the server returns. `basic` returns the object with `content` set to `null`; `full` populates `content`. When omitted, the default is endpoint-specific: retrieve operations default to `full`; list, create, and update operations default to `basic`. Listing with `view=full` caps `limit` at 20." +}) +export type BetaManagedAgentsMultiagentSelfParams = { readonly "type": "self" } +export const BetaManagedAgentsMultiagentSelfParams = Schema.Struct({ "type": Schema.Literal("self") }).annotate({ + "description": + "Sentinel roster entry meaning \"the agent that owns this configuration\". Resolved server-side to a concrete agent reference." +}) +export type BetaManagedAgentsOutcomeEvaluationResource = { + readonly "type": "outcome_evaluation" + readonly "outcome_id": string + readonly "description": string + readonly "result": string + readonly "iteration": number + readonly "completed_at": string + readonly "explanation": string +} +export const BetaManagedAgentsOutcomeEvaluationResource = Schema.Struct({ + "type": Schema.Literal("outcome_evaluation"), + "outcome_id": Schema.String.annotate({ "description": "Server-generated outc_ ID for this outcome." }), + "description": Schema.String.annotate({ "description": "What the agent should produce." }), + "result": Schema.String.annotate({ + "description": + "Current evaluation state. `pending` before the agent begins work; `running` while producing or revising; `evaluating` while the grader scores; `satisfied`/`max_iterations_reached`/`failed`/`interrupted` are terminal." + }), + "iteration": Schema.Number.annotate({ + "description": "0-indexed revision cycle the outcome is currently on.", + "format": "int32" + }).check(Schema.isInt()), + "completed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "explanation": Schema.String.annotate({ + "description": + "Grader's verdict text from the most recent evaluation. For satisfied, explains why criteria are met; for needs_revision (intermediate), what's missing; for failed, why unrecoverable." + }) +}).annotate({ "description": "Evaluation state for a single outcome defined via a define_outcome event." }) +export type BetaManagedAgentsPermissionPolicy = { readonly "type": "always_allow" } | { readonly "type": "always_ask" } +export const BetaManagedAgentsPermissionPolicy = Schema.Union([ + Schema.Struct({ "type": Schema.Literal("always_allow") }).annotate({ + "description": "Permission policy for tool execution." + }), + Schema.Struct({ "type": Schema.Literal("always_ask") }).annotate({ + "description": "Permission policy for tool execution." + }) +], { mode: "oneOf" }) +export type BetaManagedAgentsRepositoryCheckout = { readonly "type": "branch"; readonly "name": string } | { + readonly "type": "commit" + readonly "sha": string } -export const BetaUserLocation = Schema.Struct({ - "city": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), Schema.Null]).annotate({ - "title": "City", - "description": "The city of the user." +export const BetaManagedAgentsRepositoryCheckout = Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("branch"), + "name": Schema.String.annotate({ "description": "Branch name to check out." }).check(Schema.isMinLength(1)).check( + Schema.isMaxLength(255) + ) + }), + Schema.Struct({ + "type": Schema.Literal("commit"), + "sha": Schema.String.annotate({ "description": "Full commit SHA to check out." }).check(Schema.isMinLength(7)) + .check(Schema.isMaxLength(64)) + }) +], { mode: "oneOf" }) +export type BetaManagedAgentsSearchResultContent = { readonly "type": "text"; readonly "text": string } +export const BetaManagedAgentsSearchResultContent = Schema.Struct({ + "type": Schema.Literal("text"), + "text": Schema.String.annotate({ "description": "The text content." }).check(Schema.isMinLength(1)) +}).annotate({ "description": "Text content within a search result." }) +export type BetaManagedAgentsSessionResourceParams = + | { + readonly "type": "github_repository" + readonly "url": string + readonly "authorization_token": string + readonly "mount_path"?: string + readonly "checkout"?: { readonly "type": "branch"; readonly "name": string } | { + readonly "type": "commit" + readonly "sha": string + } + } + | { readonly "type": "file"; readonly "file_id": string; readonly "mount_path"?: string } + | { + readonly "type": "memory_store" + readonly "memory_store_id": string + readonly "access"?: "read_write" | "read_only" + readonly "instructions"?: string + } +export const BetaManagedAgentsSessionResourceParams = Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("github_repository"), + "url": Schema.String.annotate({ "description": "Github URL of the repository" }).check(Schema.isMinLength(1)).check( + Schema.isMaxLength(2048) + ), + "authorization_token": Schema.String.annotate({ + "description": "GitHub authorization token used to clone the repository." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(4096)), + "mount_path": Schema.optionalKey( + Schema.String.annotate({ "description": "Mount path in the container. Defaults to `/workspace/`." }) + .check(Schema.isMinLength(1)).check(Schema.isMaxLength(4096)) + ), + "checkout": Schema.optionalKey( + Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("branch"), + "name": Schema.String.annotate({ "description": "Branch name to check out." }).check(Schema.isMinLength(1)) + .check(Schema.isMaxLength(255)) + }), + Schema.Struct({ + "type": Schema.Literal("commit"), + "sha": Schema.String.annotate({ "description": "Full commit SHA to check out." }).check(Schema.isMinLength(7)) + .check(Schema.isMaxLength(64)) + }) + ], { mode: "oneOf" }).annotate({ + "description": "Branch or commit to check out. Defaults to the repository's default branch." + }) + ) + }).annotate({ "description": "Union of resources that can be mounted into a session." }), + Schema.Struct({ + "type": Schema.Literal("file"), + "file_id": Schema.String.annotate({ "description": "ID of a previously uploaded file." }).check( + Schema.isMinLength(1) + ).check(Schema.isMaxLength(128)), + "mount_path": Schema.optionalKey( + Schema.String.annotate({ + "description": "Mount path in the container. Defaults to `/mnt/session/uploads/`." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(4096)) + ) + }).annotate({ "description": "Union of resources that can be mounted into a session." }), + Schema.Struct({ + "type": Schema.Literal("memory_store"), + "memory_store_id": Schema.String.annotate({ + "description": "The memory store ID (memstore_...). Must belong to the caller's organization and workspace." + }), + "access": Schema.optionalKey( + Schema.Literals(["read_write", "read_only"]).annotate({ + "description": "Access mode for an attached memory store." + }) + ), + "instructions": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars." + }).check(Schema.isMaxLength(4096)) + ) + }).annotate({ "description": "Union of resources that can be mounted into a session." }) +], { mode: "oneOf" }) +export type BetaManagedAgentsSessionStatus = "rescheduling" | "running" | "idle" | "terminated" +export const BetaManagedAgentsSessionStatus = Schema.Literals(["rescheduling", "running", "idle", "terminated"]) + .annotate({ "description": "SessionStatus enum" }) +export type BetaManagedAgentsTextBlock = { readonly "type": "text"; readonly "text": string } +export const BetaManagedAgentsTextBlock = Schema.Struct({ + "type": Schema.Literal("text"), + "text": Schema.String.annotate({ "description": "The text content." }).check(Schema.isMinLength(1)) +}).annotate({ "description": "Regular text content." }) +export type BetaManagedAgentsTextRubric = { readonly "type": "text"; readonly "content": string } +export const BetaManagedAgentsTextRubric = Schema.Struct({ + "type": Schema.Literal("text"), + "content": Schema.String.annotate({ + "description": "Rubric content. Plain text or markdown — the grader treats it as freeform text." + }) +}).annotate({ "description": "Rubric content provided inline as text." }) +export type BetaManagedAgentsTextRubricParams = { readonly "type": "text"; readonly "content": string } +export const BetaManagedAgentsTextRubricParams = Schema.Struct({ + "type": Schema.Literal("text"), + "content": Schema.String.annotate({ + "description": + "Rubric content. Plain text or markdown — the grader treats it as freeform text. Maximum 262144 characters." + }).check(Schema.isMaxLength(262144)) +}).annotate({ "description": "Rubric content provided inline as text." }) +export type BetaManagedAgentsUpdateMemoryParams = { + readonly "content"?: string + readonly "path"?: string + readonly "precondition"?: { readonly "type": "content_sha256"; readonly "content_sha256"?: string } +} +export const BetaManagedAgentsUpdateMemoryParams = Schema.Struct({ + "content": Schema.optionalKey( + Schema.String.annotate({ + "description": + "New UTF-8 text content for the memory. Maximum 100 kB (102,400 bytes). Omit to leave the content unchanged (e.g., for a rename-only update)." }) ), - "country": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMinLength(2)).check(Schema.isMaxLength(2)), Schema.Null]).annotate({ - "title": "Country", - "description": "The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user." - }) + "path": Schema.optionalKey( + Schema.String.annotate({ + "description": + "New path for the memory (a rename). Must start with `/`, contain at least one non-empty segment, and be at most 1,024 bytes. Must not contain empty segments, `.` or `..` segments, control or format characters, and must be NFC-normalized. Paths are case-sensitive. The memory's `id` is preserved across renames. Omit to leave the path unchanged." + }).check(Schema.isMinLength(2)).check(Schema.isMaxLength(1024)) ), - "region": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), Schema.Null]).annotate({ - "title": "Region", - "description": "The region of the user." + "precondition": Schema.optionalKey( + Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("content_sha256"), + "content_sha256": Schema.optionalKey(Schema.String.annotate({ + "description": + "Expected `content_sha256` of the stored memory (64 lowercase hexadecimal characters). Typically the `content_sha256` returned by a prior read or list call. Because the server applies no content normalization, clients can also compute this locally as the SHA-256 of the UTF-8 content bytes." + })) + }).annotate({ + "description": + "Optional condition that must hold for an update to apply. When omitted, the update is unconditional. Asserts the current state of the memory being updated. When an update changes `path`, the precondition still refers to the memory's current content, not the destination path. Currently the only supported variant is `content_sha256`." + }) + ], { mode: "oneOf" }).annotate({ + "description": + "Optional optimistic-concurrency precondition. When supplied, the update applies only if the memory's current state matches; on mismatch the request returns `memory_precondition_failed_error` (HTTP 409). When omitted, the update is unconditional." }) + ) +}).annotate({ + "description": + "Request parameters for [Update a memory](/en/api/beta/memory_stores/memories/update). At least one of `content` or `path` must be provided. Renaming onto a path occupied by a different memory returns `memory_path_conflict_error` (HTTP 409). Rename never overwrites; delete or rename the blocking memory first. An update where every supplied field already matches the stored value is a no-op: it returns 200 with the existing memory and writes no new version." +}) +export type BetaManagedAgentsUpdateMemoryStoreRequestBody = { + readonly "name"?: string + readonly "description"?: string + readonly "metadata"?: { readonly [x: string]: string } +} +export const BetaManagedAgentsUpdateMemoryStoreRequestBody = Schema.Struct({ + "name": Schema.optionalKey( + Schema.String.annotate({ + "description": + "New human-readable name for the store. 1–255 characters; no control characters. Renaming changes the slug used for the store's `mount_path` in sessions created after the update." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)) ), - "timezone": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), Schema.Null]).annotate({ - "title": "Timezone", - "description": "The [IANA timezone](https://nodatime.org/TimeZones) of the user." - }) + "description": Schema.optionalKey( + Schema.String.annotate({ + "description": "New description for the store, up to 1024 characters. Pass an empty string to clear it." + }).check(Schema.isMaxLength(1024)) ), - "type": Schema.Literal("approximate").annotate({ "title": "Type" }) -}).annotate({ "title": "UserLocation" }) -export type BetaWebFetchToolResultErrorCode = - | "invalid_tool_input" - | "url_too_long" - | "url_not_allowed" - | "url_not_accessible" - | "unsupported_content_type" - | "too_many_requests" - | "max_uses_exceeded" - | "unavailable" -export const BetaWebFetchToolResultErrorCode = Schema.Literals([ - "invalid_tool_input", - "url_too_long", - "url_not_allowed", - "url_not_accessible", - "unsupported_content_type", - "too_many_requests", - "max_uses_exceeded", - "unavailable" -]).annotate({ "title": "WebFetchToolResultErrorCode" }) -export type BetaWebSearchToolResultErrorCode = - | "invalid_tool_input" - | "unavailable" - | "max_uses_exceeded" - | "too_many_requests" - | "query_too_long" - | "request_too_large" -export const BetaWebSearchToolResultErrorCode = Schema.Literals([ - "invalid_tool_input", - "unavailable", - "max_uses_exceeded", - "too_many_requests", - "query_too_long", - "request_too_large" -]).annotate({ "title": "WebSearchToolResultErrorCode" }) -export type Betaapi__schemas__skills__Skill = { - readonly "created_at": string - readonly "display_title": string | null + "metadata": Schema.optionalKey( + Schema.Record(Schema.String, Schema.String).annotate({ + "description": + "Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars." + }) + ) +}) +export type BetaManagedAgentsUpdateMemoryStoreResponse = { + readonly "type": "memory_store" readonly "id": string - readonly "latest_version": string | null - readonly "source": string - readonly "type": string + readonly "name": string + readonly "description"?: string + readonly "created_at": string readonly "updated_at": string + readonly "metadata"?: { readonly [x: string]: string } + readonly "archived_at"?: string } -export const Betaapi__schemas__skills__Skill = Schema.Struct({ +export const BetaManagedAgentsUpdateMemoryStoreResponse = Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("memory_store"), + "id": Schema.String.annotate({ + "description": + "Unique identifier for the memory store (a `memstore_...` tagged ID). Use this when attaching the store to a session, or in the `{memory_store_id}` path parameter of subsequent calls." + }), + "name": Schema.String.annotate({ + "description": + "Human-readable name for the store. 1–255 characters. The store's mount-path slug under `/mnt/memory/` is derived from this name." + }), + "description": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Free-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent. Empty string when unset." + }) + ), + "created_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "updated_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "metadata": Schema.optionalKey( + Schema.Record(Schema.String, Schema.String).annotate({ + "description": + "Arbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Returned on retrieve/list but not filterable." + }) + ), + "archived_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ) + }).annotate({ "description": "Response from updating a `memory_store`. Returns the store with the changes applied." }) +], { mode: "oneOf" }) +export type BetaManagedAgentsUpdateSessionResourceParams = { readonly "authorization_token": string } +export const BetaManagedAgentsUpdateSessionResourceParams = Schema.Struct({ + "authorization_token": Schema.String.annotate({ + "description": + "New authorization token for the resource. Currently only `github_repository` resources support token rotation." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(4096)) +}).annotate({ "description": "Request parameters for updating a session resource." }) +export type BetaManagedAgentsUpdateVaultRequestBody = { + readonly "display_name"?: string + readonly "metadata"?: { readonly [x: string]: string } +} +export const BetaManagedAgentsUpdateVaultRequestBody = Schema.Struct({ + "display_name": Schema.optionalKey( + Schema.String.annotate({ "description": "Updated human-readable name for the vault. 1-255 characters." }).check( + Schema.isMinLength(1) + ).check(Schema.isMaxLength(255)) + ), + "metadata": Schema.optionalKey( + Schema.Record(Schema.String, Schema.String).annotate({ + "description": + "Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved." + }) + ) +}) +export type BetaManagedAgentsUserContentBlock = { readonly "type": "text"; readonly "text": string } | { + readonly "type": "image" + readonly "source": { readonly "type": "base64"; readonly "media_type": string; readonly "data": string } | { + readonly "type": "url" + readonly "url": string + } | { readonly "type": "file"; readonly "file_id": string } +} | { + readonly "type": "document" + readonly "source": + | { readonly "type": "base64"; readonly "media_type": string; readonly "data": string } + | { readonly "type": "text"; readonly "media_type": "text/plain"; readonly "data": string } + | { readonly "type": "url"; readonly "url": string } + | { readonly "type": "file"; readonly "file_id": string } + readonly "title"?: string + readonly "context"?: string +} +export const BetaManagedAgentsUserContentBlock = Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("text"), + "text": Schema.String.annotate({ "description": "The text content." }).check(Schema.isMinLength(1)) + }).annotate({ "description": "Content block in a user message. Can be `text`, `image`, or `document`." }), + Schema.Struct({ + "type": Schema.Literal("image"), + "source": Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("base64"), + "media_type": Schema.String.annotate({ + "description": "MIME type of the image (e.g., \"image/png\", \"image/jpeg\", \"image/gif\", \"image/webp\")." + }).check(Schema.isMinLength(1)), + "data": Schema.String.annotate({ "description": "Base64-encoded image data." }).check(Schema.isMinLength(1)) + }).annotate({ "description": "Union type for image source variants." }), + Schema.Struct({ + "type": Schema.Literal("url"), + "url": Schema.String.annotate({ "description": "URL of the image to fetch." }).check(Schema.isMinLength(1)) + }).annotate({ "description": "Union type for image source variants." }), + Schema.Struct({ + "type": Schema.Literal("file"), + "file_id": Schema.String.annotate({ "description": "ID of a previously uploaded file." }).check( + Schema.isMinLength(1) + ) + }).annotate({ "description": "Union type for image source variants." }) + ], { mode: "oneOf" }).annotate({ "description": "The source of the image data." }) + }).annotate({ "description": "Content block in a user message. Can be `text`, `image`, or `document`." }), + Schema.Struct({ + "type": Schema.Literal("document"), + "source": Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("base64"), + "media_type": Schema.String.annotate({ + "description": "MIME type of the document (e.g., \"application/pdf\")." + }).check(Schema.isMinLength(1)), + "data": Schema.String.annotate({ "description": "Base64-encoded document data." }).check(Schema.isMinLength(1)) + }).annotate({ "description": "Union type for document source variants." }), + Schema.Struct({ + "type": Schema.Literal("text"), + "media_type": Schema.Literal("text/plain").annotate({ + "description": "MIME type of the text content. Must be \"text/plain\"." + }), + "data": Schema.String.annotate({ "description": "The plain text content." }).check(Schema.isMinLength(1)) + }).annotate({ "description": "Union type for document source variants." }), + Schema.Struct({ + "type": Schema.Literal("url"), + "url": Schema.String.annotate({ "description": "URL of the document to fetch." }).check(Schema.isMinLength(1)) + }).annotate({ "description": "Union type for document source variants." }), + Schema.Struct({ + "type": Schema.Literal("file"), + "file_id": Schema.String.annotate({ "description": "ID of a previously uploaded file." }).check( + Schema.isMinLength(1) + ) + }).annotate({ "description": "Union type for document source variants." }) + ], { mode: "oneOf" }).annotate({ "description": "The source of the document data." }), + "title": Schema.optionalKey(Schema.String.annotate({ "description": "The title of the document." })), + "context": Schema.optionalKey( + Schema.String.annotate({ "description": "Additional context about the document for the model." }) + ) + }).annotate({ "description": "Content block in a user message. Can be `text`, `image`, or `document`." }) +], { mode: "oneOf" }) +export type BetaMessageBatch = { + readonly "archived_at": string | null + readonly "cancel_initiated_at": string | null + readonly "created_at": string + readonly "ended_at": string | null + readonly "expires_at": string + readonly "id": string + readonly "processing_status": "in_progress" | "canceling" | "ended" + readonly "request_counts": { + readonly "canceled": number + readonly "errored": number + readonly "expired": number + readonly "processing": number + readonly "succeeded": number + } + readonly "results_url": string | null + readonly "type": "message_batch" +} +export const BetaMessageBatch = Schema.Struct({ + "archived_at": Schema.Union([Schema.String.annotate({ "format": "date-time" }), Schema.Null]).annotate({ + "title": "Archived At", + "description": + "RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable." + }), + "cancel_initiated_at": Schema.Union([Schema.String.annotate({ "format": "date-time" }), Schema.Null]).annotate({ + "title": "Cancel Initiated At", + "description": + "RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated." + }), "created_at": Schema.String.annotate({ "title": "Created At", - "description": "ISO 8601 timestamp of when the skill was created." + "description": "RFC 3339 datetime string representing the time at which the Message Batch was created.", + "format": "date-time" }), - "display_title": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Display Title", + "ended_at": Schema.Union([Schema.String.annotate({ "format": "date-time" }), Schema.Null]).annotate({ + "title": "Ended At", "description": - "Display title for the skill.\n\nThis is a human-readable label that is not included in the prompt sent to the model." + "RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.\n\nProcessing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired." + }), + "expires_at": Schema.String.annotate({ + "title": "Expires At", + "description": + "RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.", + "format": "date-time" }), "id": Schema.String.annotate({ "title": "Id", - "description": "Unique identifier for the skill.\n\nThe format and length of IDs may change over time." + "description": "Unique object identifier.\n\nThe format and length of IDs may change over time." }), - "latest_version": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Latest Version", + "processing_status": Schema.Literals(["in_progress", "canceling", "ended"]).annotate({ + "title": "Processing Status", + "description": "Processing status of the Message Batch." + }), + "request_counts": Schema.Struct({ + "canceled": Schema.Number.annotate({ + "title": "Canceled", + "description": + "Number of requests in the Message Batch that have been canceled.\n\nThis is zero until processing of the entire Message Batch has ended.", + "default": 0 + }).check(Schema.isInt()), + "errored": Schema.Number.annotate({ + "title": "Errored", + "description": + "Number of requests in the Message Batch that encountered an error.\n\nThis is zero until processing of the entire Message Batch has ended.", + "default": 0 + }).check(Schema.isInt()), + "expired": Schema.Number.annotate({ + "title": "Expired", + "description": + "Number of requests in the Message Batch that have expired.\n\nThis is zero until processing of the entire Message Batch has ended.", + "default": 0 + }).check(Schema.isInt()), + "processing": Schema.Number.annotate({ + "title": "Processing", + "description": "Number of requests in the Message Batch that are processing.", + "default": 0 + }).check(Schema.isInt()), + "succeeded": Schema.Number.annotate({ + "title": "Succeeded", + "description": + "Number of requests in the Message Batch that have completed successfully.\n\nThis is zero until processing of the entire Message Batch has ended.", + "default": 0 + }).check(Schema.isInt()) + }).annotate({ + "title": "RequestCounts", "description": - "The latest version identifier for the skill.\n\nThis represents the most recent version of the skill that has been created." + "Tallies requests within the Message Batch, categorized by their status.\n\nRequests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch." }), - "source": Schema.String.annotate({ - "title": "Source", + "results_url": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Results Url", "description": - "Source of the skill.\n\nThis may be one of the following values:\n* `\"custom\"`: the skill was created by a user\n* `\"anthropic\"`: the skill was created by Anthropic" + "URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.\n\nResults in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests." }), - "type": Schema.String.annotate({ + "type": Schema.Literal("message_batch").annotate({ "title": "Type", - "description": "Object type.\n\nFor Skills, this is always `\"skill\"`.", - "default": "skill" - }), - "updated_at": Schema.String.annotate({ - "title": "Updated At", - "description": "ISO 8601 timestamp of when the skill was last updated." + "description": "Object type.\n\nFor Message Batches, this is always `\"message_batch\"`.", + "default": "message_batch" }) -}).annotate({ "title": "Skill" }) -export type BillingError = { readonly "message": string; readonly "type": "billing_error" } -export const BillingError = Schema.Struct({ - "message": Schema.String.annotate({ "title": "Message", "default": "Billing error" }), - "type": Schema.Literal("billing_error").annotate({ "title": "Type", "default": "billing_error" }) -}).annotate({ "title": "BillingError" }) -export type Body_create_skill_v1_skills_post = { - readonly "display_title"?: string | null - readonly "files"?: ReadonlyArray | null -} -export const Body_create_skill_v1_skills_post = Schema.Struct({ - "display_title": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Display Title", - "description": - "Display title for the skill.\n\nThis is a human-readable label that is not included in the prompt sent to the model." +}).annotate({ "title": "MessageBatch" }) +export type BetaMessageStopEvent = { readonly "type": "message_stop" } +export const BetaMessageStopEvent = Schema.Struct({ + "type": Schema.Literal("message_stop").annotate({ "title": "Type", "default": "message_stop" }) +}).annotate({ "title": "MessageStopEvent" }) +export type BetaNotFoundError = { readonly "message": string; readonly "type": "not_found_error" } +export const BetaNotFoundError = Schema.Struct({ + "message": Schema.String.annotate({ "title": "Message", "default": "Not found" }), + "type": Schema.Literal("not_found_error").annotate({ "title": "Type", "default": "not_found_error" }) +}).annotate({ "title": "NotFoundError" }) +export type BetaOverloadedError = { readonly "message": string; readonly "type": "overloaded_error" } +export const BetaOverloadedError = Schema.Struct({ + "message": Schema.String.annotate({ "title": "Message", "default": "Overloaded" }), + "type": Schema.Literal("overloaded_error").annotate({ "title": "Type", "default": "overloaded_error" }) +}).annotate({ "title": "OverloadedError" }) +export type BetaPackagesParams = { + readonly "apt"?: ReadonlyArray | null + readonly "cargo"?: ReadonlyArray | null + readonly "gem"?: ReadonlyArray | null + readonly "go"?: ReadonlyArray | null + readonly "npm"?: ReadonlyArray | null + readonly "pip"?: ReadonlyArray | null + readonly "type"?: "packages" +} +export const BetaPackagesParams = Schema.Struct({ + "apt": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Apt", + "description": "Ubuntu/Debian packages to install" }) ), - "files": Schema.optionalKey( - Schema.Union([Schema.Array(Schema.String.annotate({ "format": "binary" })), Schema.Null]).annotate({ - "title": "Files", - "description": - "Files to upload for the skill.\n\nAll files must be in the same top-level directory and must include a SKILL.md file at the root of that directory." + "cargo": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Cargo", + "description": "Rust packages to install" }) - ) -}).annotate({ "title": "Body_create_skill_v1_skills_post" }) -export type Body_create_skill_version_v1_skills__skill_id__versions_post = { - readonly "files"?: ReadonlyArray | null -} -export const Body_create_skill_version_v1_skills__skill_id__versions_post = Schema.Struct({ - "files": Schema.optionalKey( - Schema.Union([Schema.Array(Schema.String.annotate({ "format": "binary" })), Schema.Null]).annotate({ - "title": "Files", - "description": - "Files to upload for the skill.\n\nAll files must be in the same top-level directory and must include a SKILL.md file at the root of that directory." + ), + "gem": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Gem", + "description": "Ruby packages to install" }) - ) -}).annotate({ "title": "Body_create_skill_version_v1_skills__skill_id__versions_post" }) -export type CacheControlEphemeral = { readonly "ttl"?: "5m" | "1h"; readonly "type": "ephemeral" } -export const CacheControlEphemeral = Schema.Struct({ - "ttl": Schema.optionalKey( - Schema.Literals(["5m", "1h"]).annotate({ - "title": "Ttl", - "description": - "The time-to-live for the cache control breakpoint.\n\nThis may be one the following values:\n- `5m`: 5 minutes\n- `1h`: 1 hour\n\nDefaults to `5m`." + ), + "go": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Go", + "description": "Go packages to install" }) ), - "type": Schema.Literal("ephemeral").annotate({ "title": "Type" }) -}).annotate({ "title": "CacheControlEphemeral" }) -export type CacheCreation = { - readonly "ephemeral_1h_input_tokens": number - readonly "ephemeral_5m_input_tokens": number -} -export const CacheCreation = Schema.Struct({ - "ephemeral_1h_input_tokens": Schema.Number.annotate({ - "title": "Ephemeral 1H Input Tokens", - "description": "The number of input tokens used to create the 1 hour cache entry.", - "default": 0 - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - "ephemeral_5m_input_tokens": Schema.Number.annotate({ - "title": "Ephemeral 5M Input Tokens", - "description": "The number of input tokens used to create the 5 minute cache entry.", - "default": 0 - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)) -}).annotate({ "title": "CacheCreation" }) -export type CanceledResult = { readonly "type": "canceled" } -export const CanceledResult = Schema.Struct({ - "type": Schema.Literal("canceled").annotate({ "title": "Type", "default": "canceled" }) -}).annotate({ "title": "CanceledResult" }) -export type CodeExecutionToolResultErrorCode = - | "invalid_tool_input" - | "unavailable" - | "too_many_requests" - | "execution_time_exceeded" -export const CodeExecutionToolResultErrorCode = Schema.Literals([ - "invalid_tool_input", - "unavailable", - "too_many_requests", - "execution_time_exceeded" -]).annotate({ "title": "CodeExecutionToolResultErrorCode" }) -export type Container = { readonly "expires_at": string; readonly "id": string } -export const Container = Schema.Struct({ - "expires_at": Schema.String.annotate({ - "title": "Expires At", - "description": "The time at which the container will expire.", - "format": "date-time" - }), - "id": Schema.String.annotate({ "title": "Id", "description": "Identifier for the container used in this request" }) + "npm": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Npm", + "description": "Node.js packages to install" + }) + ), + "pip": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Pip", + "description": "Python packages to install" + }) + ), + "type": Schema.optionalKey( + Schema.Literal("packages").annotate({ + "title": "Type", + "description": "Package configuration type", + "default": "packages" + }) + ) }).annotate({ - "title": "Container", - "description": "Information about the container used in the request (for the code execution tool)" + "title": "PackagesParams", + "description": + "Specify packages (and optionally their versions) available in this environment.\n\nWhen versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest." }) -export type ContentBlockStopEvent = { readonly "index": number; readonly "type": "content_block_stop" } -export const ContentBlockStopEvent = Schema.Struct({ - "index": Schema.Number.annotate({ "title": "Index" }).check(Schema.isInt()), - "type": Schema.Literal("content_block_stop").annotate({ "title": "Type", "default": "content_block_stop" }) -}).annotate({ "title": "ContentBlockStopEvent" }) -export type CountMessageTokensResponse = { readonly "input_tokens": number } -export const CountMessageTokensResponse = Schema.Struct({ - "input_tokens": Schema.Number.annotate({ - "title": "Input Tokens", - "description": "The total number of tokens across the provided list of messages, system prompt, and tools." - }).check(Schema.isInt()) -}).annotate({ "title": "CountMessageTokensResponse" }) -export type CreateSkillResponse = { - readonly "created_at": string - readonly "display_title": string | null - readonly "id": string - readonly "latest_version": string | null - readonly "source": string - readonly "type": string - readonly "updated_at": string +export type BetaPermissionError = { readonly "message": string; readonly "type": "permission_error" } +export const BetaPermissionError = Schema.Struct({ + "message": Schema.String.annotate({ "title": "Message", "default": "Permission denied" }), + "type": Schema.Literal("permission_error").annotate({ "title": "Type", "default": "permission_error" }) +}).annotate({ "title": "PermissionError" }) +export type BetaPlainTextSource = { + readonly "data": string + readonly "media_type": "text/plain" + readonly "type": "text" } -export const CreateSkillResponse = Schema.Struct({ - "created_at": Schema.String.annotate({ - "title": "Created At", - "description": "ISO 8601 timestamp of when the skill was created." +export const BetaPlainTextSource = Schema.Struct({ + "data": Schema.String.annotate({ "title": "Data" }), + "media_type": Schema.Literal("text/plain").annotate({ "title": "Media Type" }), + "type": Schema.Literal("text").annotate({ "title": "Type" }) +}).annotate({ "title": "PlainTextSource" }) +export type BetaRateLimitError = { readonly "message": string; readonly "type": "rate_limit_error" } +export const BetaRateLimitError = Schema.Struct({ + "message": Schema.String.annotate({ "title": "Message", "default": "Rate limited" }), + "type": Schema.Literal("rate_limit_error").annotate({ "title": "Type", "default": "rate_limit_error" }) +}).annotate({ "title": "RateLimitError" }) +export type BetaRefusalStopDetails = { + readonly "category": "cyber" | "bio" | null + readonly "explanation": string | null + readonly "type": "refusal" +} +export const BetaRefusalStopDetails = Schema.Struct({ + "category": Schema.Union([Schema.Literals(["cyber", "bio"]), Schema.Null]).annotate({ + "title": "Category", + "description": + "The policy category that triggered the refusal.\n\n`null` when the refusal doesn't map to a named category.", + "default": null }), - "display_title": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Display Title", + "explanation": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Explanation", "description": - "Display title for the skill.\n\nThis is a human-readable label that is not included in the prompt sent to the model." + "Human-readable explanation of the refusal.\n\nThis text is not guaranteed to be stable. `null` when no explanation is available for the category.", + "default": null }), - "id": Schema.String.annotate({ - "title": "Id", - "description": "Unique identifier for the skill.\n\nThe format and length of IDs may change over time." + "type": Schema.Literal("refusal").annotate({ "title": "Type", "default": "refusal" }) +}).annotate({ "title": "RefusalStopDetails", "description": "Structured information about a refusal." }) +export type BetaRequestAdvisorRedactedResultBlock = { + readonly "encrypted_content": string + readonly "type": "advisor_redacted_result" +} +export const BetaRequestAdvisorRedactedResultBlock = Schema.Struct({ + "encrypted_content": Schema.String.annotate({ + "title": "Encrypted Content", + "description": "Opaque blob produced by a prior response; must be round-tripped verbatim." }), - "latest_version": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Latest Version", + "type": Schema.Literal("advisor_redacted_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestAdvisorRedactedResultBlock" }) +export type BetaRequestAdvisorResultBlock = { readonly "text": string; readonly "type": "advisor_result" } +export const BetaRequestAdvisorResultBlock = Schema.Struct({ + "text": Schema.String.annotate({ "title": "Text" }), + "type": Schema.Literal("advisor_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestAdvisorResultBlock" }) +export type BetaRequestBashCodeExecutionOutputBlock = { + readonly "file_id": string + readonly "type": "bash_code_execution_output" +} +export const BetaRequestBashCodeExecutionOutputBlock = Schema.Struct({ + "file_id": Schema.String.annotate({ "title": "File Id" }), + "type": Schema.Literal("bash_code_execution_output").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestBashCodeExecutionOutputBlock" }) +export type BetaRequestCharLocationCitation = { + readonly "cited_text": string + readonly "document_index": number + readonly "document_title": string | null + readonly "end_char_index": number + readonly "start_char_index": number + readonly "type": "char_location" +} +export const BetaRequestCharLocationCitation = Schema.Struct({ + "cited_text": Schema.String.annotate({ "title": "Cited Text" }), + "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) + ), + "document_title": Schema.Union([ + Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), + Schema.Null + ]).annotate({ "title": "Document Title" }), + "end_char_index": Schema.Number.annotate({ "title": "End Char Index" }).check(Schema.isInt()), + "start_char_index": Schema.Number.annotate({ "title": "Start Char Index" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) + ), + "type": Schema.Literal("char_location").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestCharLocationCitation" }) +export type BetaRequestCitationsConfig = { readonly "enabled"?: boolean } +export const BetaRequestCitationsConfig = Schema.Struct({ + "enabled": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Enabled" })) +}).annotate({ "title": "RequestCitationsConfig" }) +export type BetaRequestCodeExecutionOutputBlock = { + readonly "file_id": string + readonly "type": "code_execution_output" +} +export const BetaRequestCodeExecutionOutputBlock = Schema.Struct({ + "file_id": Schema.String.annotate({ "title": "File Id" }), + "type": Schema.Literal("code_execution_output").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestCodeExecutionOutputBlock" }) +export type BetaRequestContentBlockLocationCitation = { + readonly "cited_text": string + readonly "document_index": number + readonly "document_title": string | null + readonly "end_block_index": number + readonly "start_block_index": number + readonly "type": "content_block_location" +} +export const BetaRequestContentBlockLocationCitation = Schema.Struct({ + "cited_text": Schema.String.annotate({ + "title": "Cited Text", "description": - "The latest version identifier for the skill.\n\nThis represents the most recent version of the skill that has been created." + "The full text of the cited block range, concatenated.\n\nAlways equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns." }), - "source": Schema.String.annotate({ - "title": "Source", + "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) + ), + "document_title": Schema.Union([ + Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), + Schema.Null + ]).annotate({ "title": "Document Title" }), + "end_block_index": Schema.Number.annotate({ + "title": "End Block Index", "description": - "Source of the skill.\n\nThis may be one of the following values:\n* `\"custom\"`: the skill was created by a user\n* `\"anthropic\"`: the skill was created by Anthropic" - }), - "type": Schema.String.annotate({ - "title": "Type", - "description": "Object type.\n\nFor Skills, this is always `\"skill\"`.", - "default": "skill" - }), - "updated_at": Schema.String.annotate({ - "title": "Updated At", - "description": "ISO 8601 timestamp of when the skill was last updated." - }) -}).annotate({ "title": "CreateSkillResponse" }) -export type CreateSkillVersionResponse = { - readonly "created_at": string - readonly "description": string - readonly "directory": string - readonly "id": string - readonly "name": string - readonly "skill_id": string - readonly "type": string - readonly "version": string + "Exclusive 0-based end index of the cited block range in the source's `content` array.\n\nAlways greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`." + }).check(Schema.isInt()), + "start_block_index": Schema.Number.annotate({ + "title": "Start Block Index", + "description": "0-based index of the first cited block in the source's `content` array." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "type": Schema.Literal("content_block_location").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestContentBlockLocationCitation" }) +export type BetaRequestMCPServerToolConfiguration = { + readonly "allowed_tools"?: ReadonlyArray | null + readonly "enabled"?: boolean | null } -export const CreateSkillVersionResponse = Schema.Struct({ - "created_at": Schema.String.annotate({ - "title": "Created At", - "description": "ISO 8601 timestamp of when the skill version was created." - }), - "description": Schema.String.annotate({ - "title": "Description", - "description": "Description of the skill version.\n\nThis is extracted from the SKILL.md file in the skill upload." - }), - "directory": Schema.String.annotate({ - "title": "Directory", +export const BetaRequestMCPServerToolConfiguration = Schema.Struct({ + "allowed_tools": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Allowed Tools" }) + ), + "enabled": Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null]).annotate({ "title": "Enabled" })) +}).annotate({ "title": "RequestMCPServerToolConfiguration" }) +export type BetaRequestPageLocationCitation = { + readonly "cited_text": string + readonly "document_index": number + readonly "document_title": string | null + readonly "end_page_number": number + readonly "start_page_number": number + readonly "type": "page_location" +} +export const BetaRequestPageLocationCitation = Schema.Struct({ + "cited_text": Schema.String.annotate({ "title": "Cited Text" }), + "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) + ), + "document_title": Schema.Union([ + Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), + Schema.Null + ]).annotate({ "title": "Document Title" }), + "end_page_number": Schema.Number.annotate({ "title": "End Page Number" }).check(Schema.isInt()), + "start_page_number": Schema.Number.annotate({ "title": "Start Page Number" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(1) + ), + "type": Schema.Literal("page_location").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestPageLocationCitation" }) +export type BetaRequestSearchResultLocationCitation = { + readonly "cited_text": string + readonly "end_block_index": number + readonly "search_result_index": number + readonly "source": string + readonly "start_block_index": number + readonly "title": string | null + readonly "type": "search_result_location" +} +export const BetaRequestSearchResultLocationCitation = Schema.Struct({ + "cited_text": Schema.String.annotate({ + "title": "Cited Text", "description": - "Directory name of the skill version.\n\nThis is the top-level directory name that was extracted from the uploaded files." - }), - "id": Schema.String.annotate({ - "title": "Id", - "description": "Unique identifier for the skill version.\n\nThe format and length of IDs may change over time." + "The full text of the cited block range, concatenated.\n\nAlways equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns." }), - "name": Schema.String.annotate({ - "title": "Name", + "end_block_index": Schema.Number.annotate({ + "title": "End Block Index", "description": - "Human-readable name of the skill version.\n\nThis is extracted from the SKILL.md file in the skill upload." - }), - "skill_id": Schema.String.annotate({ - "title": "Skill Id", - "description": "Identifier for the skill that this version belongs to." - }), - "type": Schema.String.annotate({ - "title": "Type", - "description": "Object type.\n\nFor Skill Versions, this is always `\"skill_version\"`.", - "default": "skill_version" - }), - "version": Schema.String.annotate({ - "title": "Version", + "Exclusive 0-based end index of the cited block range in the source's `content` array.\n\nAlways greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`." + }).check(Schema.isInt()), + "search_result_index": Schema.Number.annotate({ + "title": "Search Result Index", "description": - "Version identifier for the skill.\n\nEach version is identified by a Unix epoch timestamp (e.g., \"1759178010641129\")." - }) -}).annotate({ "title": "CreateSkillVersionResponse" }) -export type DeleteMessageBatchResponse = { readonly "id": string; readonly "type": "message_batch_deleted" } -export const DeleteMessageBatchResponse = Schema.Struct({ - "id": Schema.String.annotate({ "title": "Id", "description": "ID of the Message Batch." }), - "type": Schema.Literal("message_batch_deleted").annotate({ + "0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.\n\nCounted separately from `document_index`; server-side web search results are not included in this count." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "source": Schema.String.annotate({ "title": "Source" }), + "start_block_index": Schema.Number.annotate({ + "title": "Start Block Index", + "description": "0-based index of the first cited block in the source's `content` array." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Title" }), + "type": Schema.Literal("search_result_location").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestSearchResultLocationCitation" }) +export type BetaRequestTextEditorCodeExecutionCreateResultBlock = { + readonly "is_file_update": boolean + readonly "type": "text_editor_code_execution_create_result" +} +export const BetaRequestTextEditorCodeExecutionCreateResultBlock = Schema.Struct({ + "is_file_update": Schema.Boolean.annotate({ "title": "Is File Update" }), + "type": Schema.Literal("text_editor_code_execution_create_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestTextEditorCodeExecutionCreateResultBlock" }) +export type BetaRequestTextEditorCodeExecutionStrReplaceResultBlock = { + readonly "lines"?: ReadonlyArray | null + readonly "new_lines"?: number | null + readonly "new_start"?: number | null + readonly "old_lines"?: number | null + readonly "old_start"?: number | null + readonly "type": "text_editor_code_execution_str_replace_result" +} +export const BetaRequestTextEditorCodeExecutionStrReplaceResultBlock = Schema.Struct({ + "lines": Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Lines" })), + "new_lines": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "New Lines" }) + ), + "new_start": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "New Start" }) + ), + "old_lines": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Old Lines" }) + ), + "old_start": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Old Start" }) + ), + "type": Schema.Literal("text_editor_code_execution_str_replace_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestTextEditorCodeExecutionStrReplaceResultBlock" }) +export type BetaRequestTextEditorCodeExecutionViewResultBlock = { + readonly "content": string + readonly "file_type": "text" | "image" | "pdf" + readonly "num_lines"?: number | null + readonly "start_line"?: number | null + readonly "total_lines"?: number | null + readonly "type": "text_editor_code_execution_view_result" +} +export const BetaRequestTextEditorCodeExecutionViewResultBlock = Schema.Struct({ + "content": Schema.String.annotate({ "title": "Content" }), + "file_type": Schema.Literals(["text", "image", "pdf"]).annotate({ "title": "File Type" }), + "num_lines": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Num Lines" }) + ), + "start_line": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Start Line" }) + ), + "total_lines": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Total Lines" }) + ), + "type": Schema.Literal("text_editor_code_execution_view_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestTextEditorCodeExecutionViewResultBlock" }) +export type BetaRequestWebSearchResultBlock = { + readonly "encrypted_content": string + readonly "page_age"?: string | null + readonly "title": string + readonly "type": "web_search_result" + readonly "url": string +} +export const BetaRequestWebSearchResultBlock = Schema.Struct({ + "encrypted_content": Schema.String.annotate({ "title": "Encrypted Content" }), + "page_age": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Page Age" })), + "title": Schema.String.annotate({ "title": "Title" }), + "type": Schema.Literal("web_search_result").annotate({ "title": "Type" }), + "url": Schema.String.annotate({ "title": "Url" }) +}).annotate({ "title": "RequestWebSearchResultBlock" }) +export type BetaRequestWebSearchResultLocationCitation = { + readonly "cited_text": string + readonly "encrypted_index": string + readonly "title": string | null + readonly "type": "web_search_result_location" + readonly "url": string +} +export const BetaRequestWebSearchResultLocationCitation = Schema.Struct({ + "cited_text": Schema.String.annotate({ "title": "Cited Text" }), + "encrypted_index": Schema.String.annotate({ "title": "Encrypted Index" }), + "title": Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(512)), Schema.Null]) + .annotate({ "title": "Title" }), + "type": Schema.Literal("web_search_result_location").annotate({ "title": "Type" }), + "url": Schema.String.annotate({ "title": "Url" }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(2048)) +}).annotate({ "title": "RequestWebSearchResultLocationCitation" }) +export type BetaResponseAdvisorRedactedResultBlock = { + readonly "encrypted_content": string + readonly "type": "advisor_redacted_result" +} +export const BetaResponseAdvisorRedactedResultBlock = Schema.Struct({ + "encrypted_content": Schema.String.annotate({ + "title": "Encrypted Content", + "description": "Opaque blob containing the advisor's output. Round-trip verbatim; do not inspect or modify." + }), + "type": Schema.Literal("advisor_redacted_result").annotate({ "title": "Type", "default": "advisor_redacted_result" }) +}).annotate({ "title": "ResponseAdvisorRedactedResultBlock" }) +export type BetaResponseAdvisorResultBlock = { readonly "text": string; readonly "type": "advisor_result" } +export const BetaResponseAdvisorResultBlock = Schema.Struct({ + "text": Schema.String.annotate({ "title": "Text" }), + "type": Schema.Literal("advisor_result").annotate({ "title": "Type", "default": "advisor_result" }) +}).annotate({ "title": "ResponseAdvisorResultBlock" }) +export type BetaResponseBashCodeExecutionOutputBlock = { + readonly "file_id": string + readonly "type": "bash_code_execution_output" +} +export const BetaResponseBashCodeExecutionOutputBlock = Schema.Struct({ + "file_id": Schema.String.annotate({ "title": "File Id" }), + "type": Schema.Literal("bash_code_execution_output").annotate({ "title": "Type", - "description": "Deleted object type.\n\nFor Message Batches, this is always `\"message_batch_deleted\"`.", - "default": "message_batch_deleted" + "default": "bash_code_execution_output" }) -}).annotate({ "title": "DeleteMessageBatchResponse" }) -export type DeleteSkillResponse = { readonly "id": string; readonly "type": string } -export const DeleteSkillResponse = Schema.Struct({ - "id": Schema.String.annotate({ - "title": "Id", - "description": "Unique identifier for the skill.\n\nThe format and length of IDs may change over time." - }), - "type": Schema.String.annotate({ +}).annotate({ "title": "ResponseBashCodeExecutionOutputBlock" }) +export type BetaResponseCharLocationCitation = { + readonly "cited_text": string + readonly "document_index": number + readonly "document_title": string | null + readonly "end_char_index": number + readonly "file_id": string | null + readonly "start_char_index": number + readonly "type": "char_location" +} +export const BetaResponseCharLocationCitation = Schema.Struct({ + "cited_text": Schema.String.annotate({ "title": "Cited Text" }), + "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) + ), + "document_title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Document Title" }), + "end_char_index": Schema.Number.annotate({ "title": "End Char Index" }).check(Schema.isInt()), + "file_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "File Id", "default": null }), + "start_char_index": Schema.Number.annotate({ "title": "Start Char Index" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) + ), + "type": Schema.Literal("char_location").annotate({ "title": "Type", "default": "char_location" }) +}).annotate({ "title": "ResponseCharLocationCitation" }) +export type BetaResponseCitationsConfig = { readonly "enabled": boolean } +export const BetaResponseCitationsConfig = Schema.Struct({ + "enabled": Schema.Boolean.annotate({ "title": "Enabled", "default": false }) +}).annotate({ "title": "ResponseCitationsConfig" }) +export type BetaResponseClearThinking20251015Edit = { + readonly "cleared_input_tokens": number + readonly "cleared_thinking_turns": number + readonly "type": "clear_thinking_20251015" +} +export const BetaResponseClearThinking20251015Edit = Schema.Struct({ + "cleared_input_tokens": Schema.Number.annotate({ + "title": "Cleared Input Tokens", + "description": "Number of input tokens cleared by this edit." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "cleared_thinking_turns": Schema.Number.annotate({ + "title": "Cleared Thinking Turns", + "description": "Number of thinking turns that were cleared." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "type": Schema.Literal("clear_thinking_20251015").annotate({ "title": "Type", - "description": "Deleted object type.\n\nFor Skills, this is always `\"skill_deleted\"`.", - "default": "skill_deleted" + "description": "The type of context management edit applied.", + "default": "clear_thinking_20251015" }) -}).annotate({ "title": "DeleteSkillResponse" }) -export type DeleteSkillVersionResponse = { readonly "id": string; readonly "type": string } -export const DeleteSkillVersionResponse = Schema.Struct({ - "id": Schema.String.annotate({ - "title": "Id", - "description": - "Version identifier for the skill.\n\nEach version is identified by a Unix epoch timestamp (e.g., \"1759178010641129\")." - }), - "type": Schema.String.annotate({ +}).annotate({ "title": "ResponseClearThinking20251015Edit" }) +export type BetaResponseClearToolUses20250919Edit = { + readonly "cleared_input_tokens": number + readonly "cleared_tool_uses": number + readonly "type": "clear_tool_uses_20250919" +} +export const BetaResponseClearToolUses20250919Edit = Schema.Struct({ + "cleared_input_tokens": Schema.Number.annotate({ + "title": "Cleared Input Tokens", + "description": "Number of input tokens cleared by this edit." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "cleared_tool_uses": Schema.Number.annotate({ + "title": "Cleared Tool Uses", + "description": "Number of tool uses that were cleared." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "type": Schema.Literal("clear_tool_uses_20250919").annotate({ "title": "Type", - "description": "Deleted object type.\n\nFor Skill Versions, this is always `\"skill_version_deleted\"`.", - "default": "skill_version_deleted" + "description": "The type of context management edit applied.", + "default": "clear_tool_uses_20250919" }) -}).annotate({ "title": "DeleteSkillVersionResponse" }) -export type DirectCaller = { readonly "type": "direct" } -export const DirectCaller = Schema.Struct({ "type": Schema.Literal("direct").annotate({ "title": "Type" }) }).annotate({ - "title": "DirectCaller", - "description": "Tool invocation directly from the model." -}) -export type EffortLevel = "low" | "medium" | "high" | "max" -export const EffortLevel = Schema.Literals(["low", "medium", "high", "max"]).annotate({ - "title": "EffortLevel", - "description": "All possible effort levels." -}) -export type ExpiredResult = { readonly "type": "expired" } -export const ExpiredResult = Schema.Struct({ - "type": Schema.Literal("expired").annotate({ "title": "Type", "default": "expired" }) -}).annotate({ "title": "ExpiredResult" }) -export type FileDeleteResponse = { readonly "id": string; readonly "type"?: "file_deleted" } -export const FileDeleteResponse = Schema.Struct({ - "id": Schema.String.annotate({ "title": "Id", "description": "ID of the deleted file." }), - "type": Schema.optionalKey( - Schema.Literal("file_deleted").annotate({ - "title": "Type", - "description": "Deleted object type.\n\nFor file deletion, this is always `\"file_deleted\"`.", - "default": "file_deleted" - }) - ) -}).annotate({ "title": "FileDeleteResponse" }) -export type FileMetadataSchema = { - readonly "created_at": string - readonly "downloadable"?: boolean - readonly "filename": string - readonly "id": string - readonly "mime_type": string - readonly "size_bytes": number - readonly "type": "file" +}).annotate({ "title": "ResponseClearToolUses20250919Edit" }) +export type BetaResponseCodeExecutionOutputBlock = { + readonly "file_id": string + readonly "type": "code_execution_output" } -export const FileMetadataSchema = Schema.Struct({ - "created_at": Schema.String.annotate({ - "title": "Created At", - "description": "RFC 3339 datetime string representing when the file was created.", - "format": "date-time" +export const BetaResponseCodeExecutionOutputBlock = Schema.Struct({ + "file_id": Schema.String.annotate({ "title": "File Id" }), + "type": Schema.Literal("code_execution_output").annotate({ "title": "Type", "default": "code_execution_output" }) +}).annotate({ "title": "ResponseCodeExecutionOutputBlock" }) +export type BetaResponseCompactionBlock = { + readonly "content": string | null + readonly "encrypted_content": string | null + readonly "type": "compaction" +} +export const BetaResponseCompactionBlock = Schema.Struct({ + "content": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Content", + "description": "Summary of compacted content, or null if compaction failed" }), - "downloadable": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Downloadable", - "description": "Whether the file can be downloaded.", - "default": false - }) - ), - "filename": Schema.String.annotate({ "title": "Filename", "description": "Original filename of the uploaded file." }) - .check(Schema.isMinLength(1)).check(Schema.isMaxLength(500)), - "id": Schema.String.annotate({ - "title": "Id", - "description": "Unique object identifier.\n\nThe format and length of IDs may change over time." + "encrypted_content": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Encrypted Content", + "description": "Opaque metadata from prior compaction, to be round-tripped verbatim", + "default": null }), - "mime_type": Schema.String.annotate({ "title": "Mime Type", "description": "MIME type of the file." }).check( - Schema.isMinLength(1) - ).check(Schema.isMaxLength(255)), - "size_bytes": Schema.Number.annotate({ "title": "Size Bytes", "description": "Size of the file in bytes." }).check( - Schema.isInt() - ).check(Schema.isGreaterThanOrEqualTo(0)), - "type": Schema.Literal("file").annotate({ - "title": "Type", - "description": "Object type.\n\nFor files, this is always `\"file\"`." - }) -}).annotate({ "title": "FileMetadataSchema" }) -export type GatewayTimeoutError = { readonly "message": string; readonly "type": "timeout_error" } -export const GatewayTimeoutError = Schema.Struct({ - "message": Schema.String.annotate({ "title": "Message", "default": "Request timeout" }), - "type": Schema.Literal("timeout_error").annotate({ "title": "Type", "default": "timeout_error" }) -}).annotate({ "title": "GatewayTimeoutError" }) -export type GetSkillResponse = { - readonly "created_at": string - readonly "display_title": string | null + "type": Schema.Literal("compaction").annotate({ "title": "Type", "default": "compaction" }) +}).annotate({ + "title": "ResponseCompactionBlock", + "description": + "A compaction block returned when autocompact is triggered.\n\nWhen content is None, it indicates the compaction failed to produce a valid\nsummary (e.g., malformed output from the model). Clients may round-trip\ncompaction blocks with null content; the server treats them as no-ops." +}) +export type BetaResponseContainerUploadBlock = { readonly "file_id": string; readonly "type": "container_upload" } +export const BetaResponseContainerUploadBlock = Schema.Struct({ + "file_id": Schema.String.annotate({ "title": "File Id" }), + "type": Schema.Literal("container_upload").annotate({ "title": "Type", "default": "container_upload" }) +}).annotate({ + "title": "ResponseContainerUploadBlock", + "description": "Response model for a file uploaded to the container." +}) +export type BetaResponseContentBlockLocationCitation = { + readonly "cited_text": string + readonly "document_index": number + readonly "document_title": string | null + readonly "end_block_index": number + readonly "file_id": string | null + readonly "start_block_index": number + readonly "type": "content_block_location" +} +export const BetaResponseContentBlockLocationCitation = Schema.Struct({ + "cited_text": Schema.String.annotate({ + "title": "Cited Text", + "description": + "The full text of the cited block range, concatenated.\n\nAlways equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns." + }), + "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) + ), + "document_title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Document Title" }), + "end_block_index": Schema.Number.annotate({ + "title": "End Block Index", + "description": + "Exclusive 0-based end index of the cited block range in the source's `content` array.\n\nAlways greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`." + }).check(Schema.isInt()), + "file_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "File Id", "default": null }), + "start_block_index": Schema.Number.annotate({ + "title": "Start Block Index", + "description": "0-based index of the first cited block in the source's `content` array." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "type": Schema.Literal("content_block_location").annotate({ "title": "Type", "default": "content_block_location" }) +}).annotate({ "title": "ResponseContentBlockLocationCitation" }) +export type BetaResponseMCPToolUseBlock = { readonly "id": string - readonly "latest_version": string | null + readonly "input": { readonly [x: string]: unknown } + readonly "name": string + readonly "server_name": string + readonly "type": "mcp_tool_use" +} +export const BetaResponseMCPToolUseBlock = Schema.Struct({ + "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$"))), + "input": Schema.Record(Schema.String, Schema.Unknown).annotate({ "title": "Input" }), + "name": Schema.String.annotate({ "title": "Name", "description": "The name of the MCP tool" }), + "server_name": Schema.String.annotate({ "title": "Server Name", "description": "The name of the MCP server" }), + "type": Schema.Literal("mcp_tool_use").annotate({ "title": "Type", "default": "mcp_tool_use" }) +}).annotate({ "title": "ResponseMCPToolUseBlock" }) +export type BetaResponsePageLocationCitation = { + readonly "cited_text": string + readonly "document_index": number + readonly "document_title": string | null + readonly "end_page_number": number + readonly "file_id": string | null + readonly "start_page_number": number + readonly "type": "page_location" +} +export const BetaResponsePageLocationCitation = Schema.Struct({ + "cited_text": Schema.String.annotate({ "title": "Cited Text" }), + "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) + ), + "document_title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Document Title" }), + "end_page_number": Schema.Number.annotate({ "title": "End Page Number" }).check(Schema.isInt()), + "file_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "File Id", "default": null }), + "start_page_number": Schema.Number.annotate({ "title": "Start Page Number" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(1) + ), + "type": Schema.Literal("page_location").annotate({ "title": "Type", "default": "page_location" }) +}).annotate({ "title": "ResponsePageLocationCitation" }) +export type BetaResponseRedactedThinkingBlock = { readonly "data": string; readonly "type": "redacted_thinking" } +export const BetaResponseRedactedThinkingBlock = Schema.Struct({ + "data": Schema.String.annotate({ "title": "Data" }), + "type": Schema.Literal("redacted_thinking").annotate({ "title": "Type", "default": "redacted_thinking" }) +}).annotate({ "title": "ResponseRedactedThinkingBlock" }) +export type BetaResponseSearchResultLocationCitation = { + readonly "cited_text": string + readonly "end_block_index": number + readonly "search_result_index": number readonly "source": string - readonly "type": string - readonly "updated_at": string + readonly "start_block_index": number + readonly "title": string | null + readonly "type": "search_result_location" } -export const GetSkillResponse = Schema.Struct({ - "created_at": Schema.String.annotate({ - "title": "Created At", - "description": "ISO 8601 timestamp of when the skill was created." - }), - "display_title": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Display Title", +export const BetaResponseSearchResultLocationCitation = Schema.Struct({ + "cited_text": Schema.String.annotate({ + "title": "Cited Text", "description": - "Display title for the skill.\n\nThis is a human-readable label that is not included in the prompt sent to the model." - }), - "id": Schema.String.annotate({ - "title": "Id", - "description": "Unique identifier for the skill.\n\nThe format and length of IDs may change over time." + "The full text of the cited block range, concatenated.\n\nAlways equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns." }), - "latest_version": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Latest Version", + "end_block_index": Schema.Number.annotate({ + "title": "End Block Index", "description": - "The latest version identifier for the skill.\n\nThis represents the most recent version of the skill that has been created." - }), - "source": Schema.String.annotate({ - "title": "Source", + "Exclusive 0-based end index of the cited block range in the source's `content` array.\n\nAlways greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`." + }).check(Schema.isInt()), + "search_result_index": Schema.Number.annotate({ + "title": "Search Result Index", "description": - "Source of the skill.\n\nThis may be one of the following values:\n* `\"custom\"`: the skill was created by a user\n* `\"anthropic\"`: the skill was created by Anthropic" - }), - "type": Schema.String.annotate({ + "0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.\n\nCounted separately from `document_index`; server-side web search results are not included in this count." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "source": Schema.String.annotate({ "title": "Source" }), + "start_block_index": Schema.Number.annotate({ + "title": "Start Block Index", + "description": "0-based index of the first cited block in the source's `content` array." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Title" }), + "type": Schema.Literal("search_result_location").annotate({ "title": "Type", "default": "search_result_location" }) +}).annotate({ "title": "ResponseSearchResultLocationCitation" }) +export type BetaResponseTextEditorCodeExecutionCreateResultBlock = { + readonly "is_file_update": boolean + readonly "type": "text_editor_code_execution_create_result" +} +export const BetaResponseTextEditorCodeExecutionCreateResultBlock = Schema.Struct({ + "is_file_update": Schema.Boolean.annotate({ "title": "Is File Update" }), + "type": Schema.Literal("text_editor_code_execution_create_result").annotate({ "title": "Type", - "description": "Object type.\n\nFor Skills, this is always `\"skill\"`.", - "default": "skill" - }), - "updated_at": Schema.String.annotate({ - "title": "Updated At", - "description": "ISO 8601 timestamp of when the skill was last updated." + "default": "text_editor_code_execution_create_result" }) -}).annotate({ "title": "GetSkillResponse" }) -export type GetSkillVersionResponse = { - readonly "created_at": string - readonly "description": string - readonly "directory": string - readonly "id": string - readonly "name": string - readonly "skill_id": string - readonly "type": string - readonly "version": string +}).annotate({ "title": "ResponseTextEditorCodeExecutionCreateResultBlock" }) +export type BetaResponseTextEditorCodeExecutionStrReplaceResultBlock = { + readonly "lines": ReadonlyArray | null + readonly "new_lines": number | null + readonly "new_start": number | null + readonly "old_lines": number | null + readonly "old_start": number | null + readonly "type": "text_editor_code_execution_str_replace_result" } -export const GetSkillVersionResponse = Schema.Struct({ - "created_at": Schema.String.annotate({ - "title": "Created At", - "description": "ISO 8601 timestamp of when the skill version was created." +export const BetaResponseTextEditorCodeExecutionStrReplaceResultBlock = Schema.Struct({ + "lines": Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Lines", "default": null }), + "new_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "New Lines", + "default": null }), - "description": Schema.String.annotate({ - "title": "Description", - "description": "Description of the skill version.\n\nThis is extracted from the SKILL.md file in the skill upload." + "new_start": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "New Start", + "default": null }), - "directory": Schema.String.annotate({ - "title": "Directory", - "description": - "Directory name of the skill version.\n\nThis is the top-level directory name that was extracted from the uploaded files." + "old_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "Old Lines", + "default": null }), - "id": Schema.String.annotate({ - "title": "Id", - "description": "Unique identifier for the skill version.\n\nThe format and length of IDs may change over time." + "old_start": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "Old Start", + "default": null }), - "name": Schema.String.annotate({ - "title": "Name", - "description": - "Human-readable name of the skill version.\n\nThis is extracted from the SKILL.md file in the skill upload." + "type": Schema.Literal("text_editor_code_execution_str_replace_result").annotate({ + "title": "Type", + "default": "text_editor_code_execution_str_replace_result" + }) +}).annotate({ "title": "ResponseTextEditorCodeExecutionStrReplaceResultBlock" }) +export type BetaResponseTextEditorCodeExecutionViewResultBlock = { + readonly "content": string + readonly "file_type": "text" | "image" | "pdf" + readonly "num_lines": number | null + readonly "start_line": number | null + readonly "total_lines": number | null + readonly "type": "text_editor_code_execution_view_result" +} +export const BetaResponseTextEditorCodeExecutionViewResultBlock = Schema.Struct({ + "content": Schema.String.annotate({ "title": "Content" }), + "file_type": Schema.Literals(["text", "image", "pdf"]).annotate({ "title": "File Type" }), + "num_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "Num Lines", + "default": null }), - "skill_id": Schema.String.annotate({ - "title": "Skill Id", - "description": "Identifier for the skill that this version belongs to." + "start_line": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "Start Line", + "default": null }), - "type": Schema.String.annotate({ - "title": "Type", - "description": "Object type.\n\nFor Skill Versions, this is always `\"skill_version\"`.", - "default": "skill_version" + "total_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "Total Lines", + "default": null }), - "version": Schema.String.annotate({ - "title": "Version", - "description": - "Version identifier for the skill.\n\nEach version is identified by a Unix epoch timestamp (e.g., \"1759178010641129\")." + "type": Schema.Literal("text_editor_code_execution_view_result").annotate({ + "title": "Type", + "default": "text_editor_code_execution_view_result" }) -}).annotate({ "title": "GetSkillVersionResponse" }) -export type InputJsonContentBlockDelta = { readonly "partial_json": string; readonly "type": "input_json_delta" } -export const InputJsonContentBlockDelta = Schema.Struct({ - "partial_json": Schema.String.annotate({ "title": "Partial Json" }), - "type": Schema.Literal("input_json_delta").annotate({ "title": "Type", "default": "input_json_delta" }) -}).annotate({ "title": "InputJsonContentBlockDelta" }) -export type InvalidRequestError = { readonly "message": string; readonly "type": "invalid_request_error" } -export const InvalidRequestError = Schema.Struct({ - "message": Schema.String.annotate({ "title": "Message", "default": "Invalid request" }), - "type": Schema.Literal("invalid_request_error").annotate({ "title": "Type", "default": "invalid_request_error" }) -}).annotate({ "title": "InvalidRequestError" }) -export type JsonOutputFormat = { - readonly "schema": { readonly [x: string]: Schema.Json } - readonly "type": "json_schema" +}).annotate({ "title": "ResponseTextEditorCodeExecutionViewResultBlock" }) +export type BetaResponseThinkingBlock = { + readonly "signature": string + readonly "thinking": string + readonly "type": "thinking" } -export const JsonOutputFormat = Schema.Struct({ - "schema": Schema.Record(Schema.String, Schema.Json).annotate({ - "title": "Schema", - "description": "The JSON schema of the format" - }), - "type": Schema.Literal("json_schema").annotate({ "title": "Type" }) -}).annotate({ "title": "JsonOutputFormat" }) -export type JsonValue = unknown -export const JsonValue = Schema.Unknown -export type MessageBatch = { - readonly "archived_at": string | null - readonly "cancel_initiated_at": string | null - readonly "created_at": string - readonly "ended_at": string | null - readonly "expires_at": string - readonly "id": string - readonly "processing_status": "in_progress" | "canceling" | "ended" - readonly "request_counts": { - readonly "canceled": number - readonly "errored": number - readonly "expired": number - readonly "processing": number - readonly "succeeded": number - } - readonly "results_url": string | null - readonly "type": "message_batch" +export const BetaResponseThinkingBlock = Schema.Struct({ + "signature": Schema.String.annotate({ "title": "Signature" }), + "thinking": Schema.String.annotate({ "title": "Thinking" }), + "type": Schema.Literal("thinking").annotate({ "title": "Type", "default": "thinking" }) +}).annotate({ "title": "ResponseThinkingBlock" }) +export type BetaResponseToolReferenceBlock = { readonly "tool_name": string; readonly "type": "tool_reference" } +export const BetaResponseToolReferenceBlock = Schema.Struct({ + "tool_name": Schema.String.annotate({ "title": "Tool Name" }).check(Schema.isMinLength(1)).check( + Schema.isMaxLength(256) + ).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]{1,256}$"))), + "type": Schema.Literal("tool_reference").annotate({ "title": "Type", "default": "tool_reference" }) +}).annotate({ "title": "ResponseToolReferenceBlock" }) +export type BetaResponseWebSearchResultBlock = { + readonly "encrypted_content": string + readonly "page_age": string | null + readonly "title": string + readonly "type": "web_search_result" + readonly "url": string } -export const MessageBatch = Schema.Struct({ - "archived_at": Schema.Union([Schema.String.annotate({ "format": "date-time" }), Schema.Null]).annotate({ - "title": "Archived At", - "description": - "RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable." +export const BetaResponseWebSearchResultBlock = Schema.Struct({ + "encrypted_content": Schema.String.annotate({ "title": "Encrypted Content" }), + "page_age": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Page Age", "default": null }), + "title": Schema.String.annotate({ "title": "Title" }), + "type": Schema.Literal("web_search_result").annotate({ "title": "Type", "default": "web_search_result" }), + "url": Schema.String.annotate({ "title": "Url" }) +}).annotate({ "title": "ResponseWebSearchResultBlock" }) +export type BetaResponseWebSearchResultLocationCitation = { + readonly "cited_text": string + readonly "encrypted_index": string + readonly "title": string | null + readonly "type": "web_search_result_location" + readonly "url": string +} +export const BetaResponseWebSearchResultLocationCitation = Schema.Struct({ + "cited_text": Schema.String.annotate({ "title": "Cited Text" }), + "encrypted_index": Schema.String.annotate({ "title": "Encrypted Index" }), + "title": Schema.Union([Schema.String.check(Schema.isMaxLength(512)), Schema.Null]).annotate({ "title": "Title" }), + "type": Schema.Literal("web_search_result_location").annotate({ + "title": "Type", + "default": "web_search_result_location" }), - "cancel_initiated_at": Schema.Union([Schema.String.annotate({ "format": "date-time" }), Schema.Null]).annotate({ - "title": "Cancel Initiated At", - "description": - "RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated." + "url": Schema.String.annotate({ "title": "Url" }) +}).annotate({ "title": "ResponseWebSearchResultLocationCitation" }) +export type BetaSelfHostedConfig = { readonly "type": "self_hosted" } +export const BetaSelfHostedConfig = Schema.Struct({ + "type": Schema.Literal("self_hosted").annotate({ "title": "Type", "description": "Environment type" }) +}).annotate({ "title": "SelfHostedConfig", "description": "Configuration for self-hosted environments." }) +export type BetaSelfHostedConfigParams = { readonly "type": "self_hosted" } +export const BetaSelfHostedConfigParams = Schema.Struct({ + "type": Schema.Literal("self_hosted").annotate({ "title": "Type", "description": "Environment type" }) +}).annotate({ + "title": "SelfHostedConfigParams", + "description": "Request params for `self_hosted` environment configuration." +}) +export type BetaSelfHostedWork = { + readonly "acknowledged_at": string | null + readonly "created_at": string + readonly "data": { readonly "id": string; readonly "type": "session" } + readonly "environment_id": string + readonly "id": string + readonly "latest_heartbeat_at": string | null + readonly "metadata": { readonly [x: string]: string } + readonly "started_at": string | null + readonly "state": "queued" | "starting" | "active" | "stopping" | "stopped" + readonly "stop_requested_at": string | null + readonly "stopped_at": string | null + readonly "type": "work" +} +export const BetaSelfHostedWork = Schema.Struct({ + "acknowledged_at": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Acknowledged At", + "description": "RFC 3339 timestamp when the work item was acknowledged and assigned to a self-hosted sandbox" }), "created_at": Schema.String.annotate({ "title": "Created At", - "description": "RFC 3339 datetime string representing the time at which the Message Batch was created.", - "format": "date-time" + "description": "RFC 3339 timestamp when work was created" }), - "ended_at": Schema.Union([Schema.String.annotate({ "format": "date-time" }), Schema.Null]).annotate({ - "title": "Ended At", - "description": - "RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.\n\nProcessing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired." + "data": Schema.Struct({ + "id": Schema.String.annotate({ "title": "Id", "description": "Session identifier (e.g., 'session_...')" }), + "type": Schema.Literal("session").annotate({ "title": "Type", "description": "Type of work data" }) + }).annotate({ "title": "SessionWorkData", "description": "The actual work to be performed" }), + "environment_id": Schema.String.annotate({ + "title": "Environment Id", + "description": "Environment identifier this work belongs to (e.g., `env_...`)" }), - "expires_at": Schema.String.annotate({ - "title": "Expires At", - "description": - "RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.", - "format": "date-time" + "id": Schema.String.annotate({ "title": "Id", "description": "Work identifier (e.g., 'work_...')" }), + "latest_heartbeat_at": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Latest Heartbeat At", + "description": "RFC 3339 timestamp of the most recent heartbeat" }), - "id": Schema.String.annotate({ - "title": "Id", - "description": "Unique object identifier.\n\nThe format and length of IDs may change over time." + "metadata": Schema.Record(Schema.String, Schema.String).annotate({ + "title": "Metadata", + "description": "User-provided metadata key-value pairs associated with this work item" }), - "processing_status": Schema.Literals(["in_progress", "canceling", "ended"]).annotate({ - "title": "Processing Status", - "description": "Processing status of the Message Batch." + "started_at": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Started At", + "description": "RFC 3339 timestamp when work execution started" }), - "request_counts": Schema.Struct({ - "canceled": Schema.Number.annotate({ - "title": "Canceled", - "description": - "Number of requests in the Message Batch that have been canceled.\n\nThis is zero until processing of the entire Message Batch has ended.", - "default": 0 - }).check(Schema.isInt()), - "errored": Schema.Number.annotate({ - "title": "Errored", - "description": - "Number of requests in the Message Batch that encountered an error.\n\nThis is zero until processing of the entire Message Batch has ended.", - "default": 0 - }).check(Schema.isInt()), - "expired": Schema.Number.annotate({ - "title": "Expired", - "description": - "Number of requests in the Message Batch that have expired.\n\nThis is zero until processing of the entire Message Batch has ended.", - "default": 0 - }).check(Schema.isInt()), - "processing": Schema.Number.annotate({ - "title": "Processing", - "description": "Number of requests in the Message Batch that are processing.", - "default": 0 - }).check(Schema.isInt()), - "succeeded": Schema.Number.annotate({ - "title": "Succeeded", - "description": - "Number of requests in the Message Batch that have completed successfully.\n\nThis is zero until processing of the entire Message Batch has ended.", - "default": 0 - }).check(Schema.isInt()) - }).annotate({ - "title": "RequestCounts", - "description": - "Tallies requests within the Message Batch, categorized by their status.\n\nRequests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch." + "state": Schema.Literals(["queued", "starting", "active", "stopping", "stopped"]).annotate({ + "title": "State", + "description": "Current state of the work item" }), - "results_url": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Results Url", + "stop_requested_at": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Stop Requested At", + "description": "RFC 3339 timestamp when stop was requested" + }), + "stopped_at": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Stopped At", + "description": "RFC 3339 timestamp when work execution stopped" + }), + "type": Schema.Literal("work").annotate({ + "title": "Type", + "description": "The type of object (always 'work')", + "default": "work" + }) +}).annotate({ + "title": "SelfHostedWork", + "description": + "Work resource representing a unit of work in a self-hosted environment.\n\nWork items are queued when sessions are created or when long-dormant sessions\nreceive new messages. The environment worker polls for work to execute in a\nself-hosted sandbox." +}) +export type BetaSelfHostedWorkHeartbeatResponse = { + readonly "last_heartbeat": string + readonly "lease_extended": boolean + readonly "state": "queued" | "starting" | "active" | "stopping" | "stopped" + readonly "ttl_seconds": number + readonly "type": "work_heartbeat" +} +export const BetaSelfHostedWorkHeartbeatResponse = Schema.Struct({ + "last_heartbeat": Schema.String.annotate({ + "title": "Last Heartbeat", + "description": "RFC 3339 timestamp of the actual heartbeat from DB" + }), + "lease_extended": Schema.Boolean.annotate({ + "title": "Lease Extended", + "description": "Whether the heartbeat succeeded in extending the lease" + }), + "state": Schema.Literals(["queued", "starting", "active", "stopping", "stopped"]).annotate({ + "title": "State", + "description": "Current state of the work item (active/stopping/stopped)" + }), + "ttl_seconds": Schema.Number.annotate({ "title": "Ttl Seconds", "description": "Effective TTL applied to the lease" }) + .check(Schema.isInt()), + "type": Schema.Literal("work_heartbeat").annotate({ + "title": "Type", + "description": "The type of response", + "default": "work_heartbeat" + }) +}).annotate({ + "title": "SelfHostedWorkHeartbeatResponse", + "description": "Response after recording a heartbeat for a work item." +}) +export type BetaSelfHostedWorkQueueStats = { + readonly "depth": number + readonly "oldest_queued_at": string | null + readonly "pending": number + readonly "type": "work_queue_stats" + readonly "workers_polling": number | null +} +export const BetaSelfHostedWorkQueueStats = Schema.Struct({ + "depth": Schema.Number.annotate({ + "title": "Depth", + "description": "Number of work items waiting to be picked up (lag from consumer group)" + }).check(Schema.isInt()), + "oldest_queued_at": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Oldest Queued At", "description": - "URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.\n\nResults in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests." + "RFC 3339 timestamp of oldest item in the work stream (includes both queued and pending items), null if stream empty" }), - "type": Schema.Literal("message_batch").annotate({ + "pending": Schema.Number.annotate({ + "title": "Pending", + "description": "Number of work items being processed (polled but not acknowledged)", + "default": 0 + }).check(Schema.isInt()), + "type": Schema.Literal("work_queue_stats").annotate({ "title": "Type", - "description": "Object type.\n\nFor Message Batches, this is always `\"message_batch\"`.", - "default": "message_batch" + "description": "The type of object", + "default": "work_queue_stats" + }), + "workers_polling": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "Workers Polling", + "description": + "Number of workers that have polled for work in the last 30 seconds. Requires worker_id to be sent with poll requests." }) -}).annotate({ "title": "MessageBatch" }) -export type MessageStopEvent = { readonly "type": "message_stop" } -export const MessageStopEvent = Schema.Struct({ - "type": Schema.Literal("message_stop").annotate({ "title": "Type", "default": "message_stop" }) -}).annotate({ "title": "MessageStopEvent" }) -export type ModelInfo = { +}).annotate({ + "title": "SelfHostedWorkQueueStats", + "description": + "Statistics about the work queue for an environment.\n\nUses Redis Stream consumer group metrics for O(1) queries." +}) +export type BetaSelfHostedWorkStopRequest = { readonly "force"?: boolean } +export const BetaSelfHostedWorkStopRequest = Schema.Struct({ + "force": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Force", + "description": "If true, immediately stop work without graceful shutdown", + "default": false + }) + ) +}).annotate({ "title": "SelfHostedWorkStopRequest", "description": "Request to stop a work item." }) +export type BetaSelfHostedWorkUpdateRequest = { readonly "metadata": { readonly [x: string]: string | null } } +export const BetaSelfHostedWorkUpdateRequest = Schema.Struct({ + "metadata": Schema.Record(Schema.String, Schema.Union([Schema.String, Schema.Null])).annotate({ + "title": "Metadata", + "description": + "Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve existing metadata." + }) +}).annotate({ "title": "SelfHostedWorkUpdateRequest", "description": "Request to update work item metadata." }) +export type BetaServerToolCaller = { readonly "tool_id": string; readonly "type": "code_execution_20250825" } +export const BetaServerToolCaller = Schema.Struct({ + "tool_id": Schema.String.annotate({ "title": "Tool Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + ), + "type": Schema.Literal("code_execution_20250825").annotate({ "title": "Type" }) +}).annotate({ "title": "ServerToolCaller", "description": "Tool invocation generated by a server-side tool." }) +export type BetaServerToolCaller_20260120 = { readonly "tool_id": string; readonly "type": "code_execution_20260120" } +export const BetaServerToolCaller_20260120 = Schema.Struct({ + "tool_id": Schema.String.annotate({ "title": "Tool Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + ), + "type": Schema.Literal("code_execution_20260120").annotate({ "title": "Type" }) +}).annotate({ "title": "ServerToolCaller_20260120" }) +export type BetaServerToolUsage = { readonly "web_fetch_requests": number; readonly "web_search_requests": number } +export const BetaServerToolUsage = Schema.Struct({ + "web_fetch_requests": Schema.Number.annotate({ + "title": "Web Fetch Requests", + "description": "The number of web fetch tool requests.", + "default": 0 + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "web_search_requests": Schema.Number.annotate({ + "title": "Web Search Requests", + "description": "The number of web search tool requests.", + "default": 0 + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)) +}).annotate({ "title": "ServerToolUsage" }) +export type BetaSignatureContentBlockDelta = { readonly "signature": string; readonly "type": "signature_delta" } +export const BetaSignatureContentBlockDelta = Schema.Struct({ + "signature": Schema.String.annotate({ "title": "Signature" }), + "type": Schema.Literal("signature_delta").annotate({ "title": "Type", "default": "signature_delta" }) +}).annotate({ "title": "SignatureContentBlockDelta" }) +export type BetaSkill = { + readonly "skill_id": string + readonly "type": "anthropic" | "custom" + readonly "version": string +} +export const BetaSkill = Schema.Struct({ + "skill_id": Schema.String.annotate({ "title": "Skill Id", "description": "Skill ID" }).check(Schema.isMinLength(1)) + .check(Schema.isMaxLength(64)), + "type": Schema.Literals(["anthropic", "custom"]).annotate({ + "title": "Type", + "description": "Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)" + }), + "version": Schema.String.annotate({ + "title": "Version", + "description": "Skill version or 'latest' for most recent version" + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(64)) +}).annotate({ "title": "Skill", "description": "A skill that was loaded in a container (response model)." }) +export type BetaSkillParams = { + readonly "skill_id": string + readonly "type": "anthropic" | "custom" + readonly "version"?: string +} +export const BetaSkillParams = Schema.Struct({ + "skill_id": Schema.String.annotate({ "title": "Skill Id", "description": "Skill ID" }).check(Schema.isMinLength(1)) + .check(Schema.isMaxLength(64)), + "type": Schema.Literals(["anthropic", "custom"]).annotate({ + "title": "Type", + "description": "Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined)" + }), + "version": Schema.optionalKey( + Schema.String.annotate({ "title": "Version", "description": "Skill version or 'latest' for most recent version" }) + .check(Schema.isMinLength(1)).check(Schema.isMaxLength(64)) + ) +}).annotate({ + "title": "SkillParams", + "description": "Specification for a skill to be loaded in a container (request model)." +}) +export type BetaSkillVersion = { readonly "created_at": string - readonly "display_name": string + readonly "description": string + readonly "directory": string readonly "id": string - readonly "type": "model" + readonly "name": string + readonly "skill_id": string + readonly "type": string + readonly "version": string } -export const ModelInfo = Schema.Struct({ +export const BetaSkillVersion = Schema.Struct({ "created_at": Schema.String.annotate({ "title": "Created At", + "description": "ISO 8601 timestamp of when the skill version was created." + }), + "description": Schema.String.annotate({ + "title": "Description", + "description": "Description of the skill version.\n\nThis is extracted from the SKILL.md file in the skill upload." + }), + "directory": Schema.String.annotate({ + "title": "Directory", "description": - "RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown.", - "format": "date-time" + "Directory name of the skill version.\n\nThis is the top-level directory name that was extracted from the uploaded files." }), - "display_name": Schema.String.annotate({ - "title": "Display Name", - "description": "A human-readable name for the model." + "id": Schema.String.annotate({ + "title": "Id", + "description": "Unique identifier for the skill version.\n\nThe format and length of IDs may change over time." }), - "id": Schema.String.annotate({ "title": "Id", "description": "Unique model identifier." }), - "type": Schema.Literal("model").annotate({ - "title": "Type", - "description": "Object type.\n\nFor Models, this is always `\"model\"`.", - "default": "model" - }) -}).annotate({ "title": "ModelInfo" }) -export type NotFoundError = { readonly "message": string; readonly "type": "not_found_error" } -export const NotFoundError = Schema.Struct({ - "message": Schema.String.annotate({ "title": "Message", "default": "Not found" }), - "type": Schema.Literal("not_found_error").annotate({ "title": "Type", "default": "not_found_error" }) -}).annotate({ "title": "NotFoundError" }) -export type OverloadedError = { readonly "message": string; readonly "type": "overloaded_error" } -export const OverloadedError = Schema.Struct({ - "message": Schema.String.annotate({ "title": "Message", "default": "Overloaded" }), - "type": Schema.Literal("overloaded_error").annotate({ "title": "Type", "default": "overloaded_error" }) -}).annotate({ "title": "OverloadedError" }) -export type PermissionError = { readonly "message": string; readonly "type": "permission_error" } -export const PermissionError = Schema.Struct({ - "message": Schema.String.annotate({ "title": "Message", "default": "Permission denied" }), - "type": Schema.Literal("permission_error").annotate({ "title": "Type", "default": "permission_error" }) -}).annotate({ "title": "PermissionError" }) -export type PlainTextSource = { readonly "data": string; readonly "media_type": "text/plain"; readonly "type": "text" } -export const PlainTextSource = Schema.Struct({ - "data": Schema.String.annotate({ "title": "Data" }), - "media_type": Schema.Literal("text/plain").annotate({ "title": "Media Type" }), - "type": Schema.Literal("text").annotate({ "title": "Type" }) -}).annotate({ "title": "PlainTextSource" }) -export type RateLimitError = { readonly "message": string; readonly "type": "rate_limit_error" } -export const RateLimitError = Schema.Struct({ - "message": Schema.String.annotate({ "title": "Message", "default": "Rate limited" }), - "type": Schema.Literal("rate_limit_error").annotate({ "title": "Type", "default": "rate_limit_error" }) -}).annotate({ "title": "RateLimitError" }) -export type RequestBashCodeExecutionOutputBlock = { - readonly "file_id": string - readonly "type": "bash_code_execution_output" + "name": Schema.String.annotate({ + "title": "Name", + "description": + "Human-readable name of the skill version.\n\nThis is extracted from the SKILL.md file in the skill upload." + }), + "skill_id": Schema.String.annotate({ + "title": "Skill Id", + "description": "Identifier for the skill that this version belongs to." + }), + "type": Schema.String.annotate({ + "title": "Type", + "description": "Object type.\n\nFor Skill Versions, this is always `\"skill_version\"`.", + "default": "skill_version" + }), + "version": Schema.String.annotate({ + "title": "Version", + "description": + "Version identifier for the skill.\n\nEach version is identified by a Unix epoch timestamp (e.g., \"1759178010641129\")." + }) +}).annotate({ "title": "SkillVersion" }) +export type BetaSpeed = "standard" | "fast" +export const BetaSpeed = Schema.Literals(["standard", "fast"]).annotate({ "title": "Speed" }) +export type BetaTextContentBlockDelta = { readonly "text": string; readonly "type": "text_delta" } +export const BetaTextContentBlockDelta = Schema.Struct({ + "text": Schema.String.annotate({ "title": "Text" }), + "type": Schema.Literal("text_delta").annotate({ "title": "Type", "default": "text_delta" }) +}).annotate({ "title": "TextContentBlockDelta" }) +export type BetaTextEditorCodeExecutionToolResultErrorCode = + | "invalid_tool_input" + | "unavailable" + | "too_many_requests" + | "execution_time_exceeded" + | "file_not_found" +export const BetaTextEditorCodeExecutionToolResultErrorCode = Schema.Literals([ + "invalid_tool_input", + "unavailable", + "too_many_requests", + "execution_time_exceeded", + "file_not_found" +]).annotate({ "title": "TextEditorCodeExecutionToolResultErrorCode" }) +export type BetaThinkingConfigDisabled = { readonly "type": "disabled" } +export const BetaThinkingConfigDisabled = Schema.Struct({ + "type": Schema.Literal("disabled").annotate({ "title": "Type" }) +}).annotate({ "title": "ThinkingConfigDisabled" }) +export type BetaThinkingContentBlockDelta = { + readonly "estimated_tokens": number | null + readonly "thinking": string + readonly "type": "thinking_delta" } -export const RequestBashCodeExecutionOutputBlock = Schema.Struct({ - "file_id": Schema.String.annotate({ "title": "File Id" }), - "type": Schema.Literal("bash_code_execution_output").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestBashCodeExecutionOutputBlock" }) -export type RequestCharLocationCitation = { - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string | null - readonly "end_char_index": number - readonly "start_char_index": number - readonly "type": "char_location" +export const BetaThinkingContentBlockDelta = Schema.Struct({ + "estimated_tokens": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "Estimated Tokens", + "description": + "Per-frame increment of a coarse, running estimate of the tokens this thinking block has produced so far. Present whenever the `thinking-token-count-2026-05-13` beta is set; `null` unless `thinking.display` resolves to `\"omitted\"` and a count is due this frame. Sum the increments across `thinking_delta` frames on this block for a progress indicator. Each increment is a non-negative multiple of a fixed quantum and the cadence is rate-limited, so this is a deliberately lossy display hint, not a billable count; `usage.output_tokens` remains authoritative.", + "default": null + }), + "thinking": Schema.String.annotate({ "title": "Thinking" }), + "type": Schema.Literal("thinking_delta").annotate({ "title": "Type", "default": "thinking_delta" }) +}).annotate({ "title": "ThinkingContentBlockDelta" }) +export type BetaThinkingDisplayMode = "summarized" | "omitted" +export const BetaThinkingDisplayMode = Schema.Literals(["summarized", "omitted"]).annotate({ + "title": "ThinkingDisplayMode" +}) +export type BetaThinkingTurns = { readonly "type": "thinking_turns"; readonly "value": number } +export const BetaThinkingTurns = Schema.Struct({ + "type": Schema.Literal("thinking_turns").annotate({ "title": "Type" }), + "value": Schema.Number.annotate({ "title": "Value" }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)) +}).annotate({ "title": "ThinkingTurns" }) +export type BetaThinkingTypes = { + readonly "adaptive": { readonly "supported": boolean } + readonly "enabled": { readonly "supported": boolean } } -export const RequestCharLocationCitation = Schema.Struct({ - "cited_text": Schema.String.annotate({ "title": "Cited Text" }), - "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) +export const BetaThinkingTypes = Schema.Struct({ + "adaptive": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ + "title": "CapabilitySupport", + "description": "Whether the model supports thinking with type 'adaptive' (auto)." + }), + "enabled": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ + "title": "CapabilitySupport", + "description": "Whether the model supports thinking with type 'enabled'." + }) +}).annotate({ "title": "ThinkingTypes", "description": "Supported thinking type configurations." }) +export type BetaTimestamp = string +export const BetaTimestamp = Schema.String.annotate({ + "description": "A timestamp in RFC 3339 format", + "format": "date-time" +}) +export type BetaTokenTaskBudget = { readonly "remaining"?: number; readonly "total": number; readonly "type": "tokens" } +export const BetaTokenTaskBudget = Schema.Struct({ + "remaining": Schema.optionalKey( + Schema.Union([ + Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check( + Schema.makeFilterGroup([Schema.isFinite(), Schema.isGreaterThanOrEqualTo(0)], { + "title": "Remaining", + "description": + "Remaining tokens in the budget. Use this to track usage across contexts when implementing compaction client-side. Defaults to total if not provided." + }) + ) + ]) ), - "document_title": Schema.Union([ - Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), - Schema.Null - ]).annotate({ "title": "Document Title" }), - "end_char_index": Schema.Number.annotate({ "title": "End Char Index" }).check(Schema.isInt()), - "start_char_index": Schema.Number.annotate({ "title": "Start Char Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) + "total": Schema.Number.annotate({ + "title": "Total", + "description": "Total token budget across all contexts in the session." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1024)), + "type": Schema.Literal("tokens").annotate({ + "title": "Type", + "description": "The budget type. Currently only 'tokens' is supported." + }) +}).annotate({ "title": "TokenTaskBudget", "description": "User-configurable total token budget across contexts." }) +export type BetaToolChoiceAny = { readonly "disable_parallel_tool_use"?: boolean; readonly "type": "any" } +export const BetaToolChoiceAny = Schema.Struct({ + "disable_parallel_tool_use": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Disable Parallel Tool Use", + "description": + "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output exactly one tool use." + }) ), - "type": Schema.Literal("char_location").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestCharLocationCitation" }) -export type RequestCitationsConfig = { readonly "enabled"?: boolean } -export const RequestCitationsConfig = Schema.Struct({ - "enabled": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Enabled" })) -}).annotate({ "title": "RequestCitationsConfig" }) -export type RequestCodeExecutionOutputBlock = { readonly "file_id": string; readonly "type": "code_execution_output" } -export const RequestCodeExecutionOutputBlock = Schema.Struct({ - "file_id": Schema.String.annotate({ "title": "File Id" }), - "type": Schema.Literal("code_execution_output").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestCodeExecutionOutputBlock" }) -export type RequestContentBlockLocationCitation = { - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string | null - readonly "end_block_index": number - readonly "start_block_index": number - readonly "type": "content_block_location" + "type": Schema.Literal("any").annotate({ "title": "Type" }) +}).annotate({ "title": "ToolChoiceAny", "description": "The model will use any available tools." }) +export type BetaToolChoiceAuto = { readonly "disable_parallel_tool_use"?: boolean; readonly "type": "auto" } +export const BetaToolChoiceAuto = Schema.Struct({ + "disable_parallel_tool_use": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Disable Parallel Tool Use", + "description": + "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output at most one tool use." + }) + ), + "type": Schema.Literal("auto").annotate({ "title": "Type" }) +}).annotate({ "title": "ToolChoiceAuto", "description": "The model will automatically decide whether to use tools." }) +export type BetaToolChoiceNone = { readonly "type": "none" } +export const BetaToolChoiceNone = Schema.Struct({ "type": Schema.Literal("none").annotate({ "title": "Type" }) }) + .annotate({ "title": "ToolChoiceNone", "description": "The model will not be allowed to use tools." }) +export type BetaToolChoiceTool = { + readonly "disable_parallel_tool_use"?: boolean + readonly "name": string + readonly "type": "tool" } -export const RequestContentBlockLocationCitation = Schema.Struct({ - "cited_text": Schema.String.annotate({ "title": "Cited Text" }), - "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) +export const BetaToolChoiceTool = Schema.Struct({ + "disable_parallel_tool_use": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Disable Parallel Tool Use", + "description": + "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output exactly one tool use." + }) ), - "document_title": Schema.Union([ - Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), - Schema.Null - ]).annotate({ "title": "Document Title" }), - "end_block_index": Schema.Number.annotate({ "title": "End Block Index" }).check(Schema.isInt()), - "start_block_index": Schema.Number.annotate({ "title": "Start Block Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) + "name": Schema.String.annotate({ "title": "Name", "description": "The name of the tool to use." }), + "type": Schema.Literal("tool").annotate({ "title": "Type" }) +}).annotate({ + "title": "ToolChoiceTool", + "description": "The model will use the specified tool with `tool_choice.name`." +}) +export type BetaToolSearchToolResultErrorCode = + | "invalid_tool_input" + | "unavailable" + | "too_many_requests" + | "execution_time_exceeded" +export const BetaToolSearchToolResultErrorCode = Schema.Literals([ + "invalid_tool_input", + "unavailable", + "too_many_requests", + "execution_time_exceeded" +]).annotate({ "title": "ToolSearchToolResultErrorCode" }) +export type BetaToolUsesKeep = { readonly "type": "tool_uses"; readonly "value": number } +export const BetaToolUsesKeep = Schema.Struct({ + "type": Schema.Literal("tool_uses").annotate({ "title": "Type" }), + "value": Schema.Number.annotate({ "title": "Value" }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)) +}).annotate({ "title": "ToolUsesKeep" }) +export type BetaToolUsesTrigger = { readonly "type": "tool_uses"; readonly "value": number } +export const BetaToolUsesTrigger = Schema.Struct({ + "type": Schema.Literal("tool_uses").annotate({ "title": "Type" }), + "value": Schema.Number.annotate({ "title": "Value" }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)) +}).annotate({ "title": "ToolUsesTrigger" }) +export type BetaURLImageSource = { readonly "type": "url"; readonly "url": string } +export const BetaURLImageSource = Schema.Struct({ + "type": Schema.Literal("url").annotate({ "title": "Type" }), + "url": Schema.String.annotate({ "title": "Url" }) +}).annotate({ "title": "URLImageSource" }) +export type BetaURLPDFSource = { readonly "type": "url"; readonly "url": string } +export const BetaURLPDFSource = Schema.Struct({ + "type": Schema.Literal("url").annotate({ "title": "Type" }), + "url": Schema.String.annotate({ "title": "Url" }) +}).annotate({ "title": "URLPDFSource" }) +export type BetaUnrestrictedNetwork = { readonly "type": "unrestricted" } +export const BetaUnrestrictedNetwork = Schema.Struct({ + "type": Schema.Literal("unrestricted").annotate({ "title": "Type", "description": "Network policy type" }) +}).annotate({ "title": "UnrestrictedNetwork", "description": "Unrestricted network access." }) +export type BetaUpdateUserProfileRequestBody = { + readonly "external_id"?: string + readonly "metadata"?: { readonly [x: string]: string } + readonly "name"?: string + readonly "relationship"?: "external" | "resold" | "internal" +} +export const BetaUpdateUserProfileRequestBody = Schema.Struct({ + "external_id": Schema.optionalKey( + Schema.String.annotate({ + "description": "If present, replaces the stored external_id. Omit to leave unchanged. Maximum 255 characters." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)) ), - "type": Schema.Literal("content_block_location").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestContentBlockLocationCitation" }) -export type RequestPageLocationCitation = { - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string | null - readonly "end_page_number": number - readonly "start_page_number": number - readonly "type": "page_location" -} -export const RequestPageLocationCitation = Schema.Struct({ - "cited_text": Schema.String.annotate({ "title": "Cited Text" }), - "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) + "metadata": Schema.optionalKey( + Schema.Record(Schema.String, Schema.String).annotate({ + "description": + "Key-value pairs to merge into the stored metadata. Keys provided overwrite existing values. To remove a key, set its value to an empty string. Keys not provided are left unchanged. Maximum 16 keys, with keys up to 64 characters and values up to 512 characters." + }) ), - "document_title": Schema.Union([ - Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), - Schema.Null - ]).annotate({ "title": "Document Title" }), - "end_page_number": Schema.Number.annotate({ "title": "End Page Number" }).check(Schema.isInt()), - "start_page_number": Schema.Number.annotate({ "title": "Start Page Number" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(1) + "name": Schema.optionalKey( + Schema.String.annotate({ + "description": "If present, replaces the stored name. Omit to leave unchanged. Maximum 255 characters." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)) ), - "type": Schema.Literal("page_location").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestPageLocationCitation" }) -export type RequestSearchResultLocationCitation = { - readonly "cited_text": string - readonly "end_block_index": number - readonly "search_result_index": number - readonly "source": string - readonly "start_block_index": number - readonly "title": string | null - readonly "type": "search_result_location" -} -export const RequestSearchResultLocationCitation = Schema.Struct({ - "cited_text": Schema.String.annotate({ "title": "Cited Text" }), - "end_block_index": Schema.Number.annotate({ "title": "End Block Index" }).check(Schema.isInt()), - "search_result_index": Schema.Number.annotate({ "title": "Search Result Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) - ), - "source": Schema.String.annotate({ "title": "Source" }), - "start_block_index": Schema.Number.annotate({ "title": "Start Block Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) - ), - "title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Title" }), - "type": Schema.Literal("search_result_location").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestSearchResultLocationCitation" }) -export type RequestTextEditorCodeExecutionCreateResultBlock = { - readonly "is_file_update": boolean - readonly "type": "text_editor_code_execution_create_result" -} -export const RequestTextEditorCodeExecutionCreateResultBlock = Schema.Struct({ - "is_file_update": Schema.Boolean.annotate({ "title": "Is File Update" }), - "type": Schema.Literal("text_editor_code_execution_create_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestTextEditorCodeExecutionCreateResultBlock" }) -export type RequestTextEditorCodeExecutionStrReplaceResultBlock = { - readonly "lines"?: ReadonlyArray | null - readonly "new_lines"?: number | null - readonly "new_start"?: number | null - readonly "old_lines"?: number | null - readonly "old_start"?: number | null - readonly "type": "text_editor_code_execution_str_replace_result" + "relationship": Schema.optionalKey( + Schema.Literals(["external", "resold", "internal"]).annotate({ + "description": + "How the entity behind a user profile relates to the platform that owns the API key. `external`: an individual end-user of the platform. `resold`: a company the platform resells Claude access to. `internal`: the platform's own usage." + }) + ) +}) +export type BetaUserLocation = { + readonly "city"?: string | null + readonly "country"?: string | null + readonly "region"?: string | null + readonly "timezone"?: string | null + readonly "type": "approximate" } -export const RequestTextEditorCodeExecutionStrReplaceResultBlock = Schema.Struct({ - "lines": Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Lines" })), - "new_lines": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "New Lines" }) - ), - "new_start": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "New Start" }) - ), - "old_lines": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Old Lines" }) - ), - "old_start": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Old Start" }) +export const BetaUserLocation = Schema.Struct({ + "city": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), Schema.Null]).annotate({ + "title": "City", + "description": "The city of the user." + }) ), - "type": Schema.Literal("text_editor_code_execution_str_replace_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestTextEditorCodeExecutionStrReplaceResultBlock" }) -export type RequestTextEditorCodeExecutionViewResultBlock = { - readonly "content": string - readonly "file_type": "text" | "image" | "pdf" - readonly "num_lines"?: number | null - readonly "start_line"?: number | null - readonly "total_lines"?: number | null - readonly "type": "text_editor_code_execution_view_result" -} -export const RequestTextEditorCodeExecutionViewResultBlock = Schema.Struct({ - "content": Schema.String.annotate({ "title": "Content" }), - "file_type": Schema.Literals(["text", "image", "pdf"]).annotate({ "title": "File Type" }), - "num_lines": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Num Lines" }) + "country": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMinLength(2)).check(Schema.isMaxLength(2)), Schema.Null]).annotate({ + "title": "Country", + "description": "The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user." + }) ), - "start_line": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Start Line" }) + "region": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), Schema.Null]).annotate({ + "title": "Region", + "description": "The region of the user." + }) ), - "total_lines": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Total Lines" }) + "timezone": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), Schema.Null]).annotate({ + "title": "Timezone", + "description": "The [IANA timezone](https://nodatime.org/TimeZones) of the user." + }) ), - "type": Schema.Literal("text_editor_code_execution_view_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestTextEditorCodeExecutionViewResultBlock" }) -export type RequestWebSearchResultBlock = { - readonly "encrypted_content": string - readonly "page_age"?: string | null - readonly "title": string - readonly "type": "web_search_result" - readonly "url": string -} -export const RequestWebSearchResultBlock = Schema.Struct({ - "encrypted_content": Schema.String.annotate({ "title": "Encrypted Content" }), - "page_age": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Page Age" })), - "title": Schema.String.annotate({ "title": "Title" }), - "type": Schema.Literal("web_search_result").annotate({ "title": "Type" }), - "url": Schema.String.annotate({ "title": "Url" }) -}).annotate({ "title": "RequestWebSearchResultBlock" }) -export type RequestWebSearchResultLocationCitation = { - readonly "cited_text": string - readonly "encrypted_index": string - readonly "title": string | null - readonly "type": "web_search_result_location" - readonly "url": string -} -export const RequestWebSearchResultLocationCitation = Schema.Struct({ - "cited_text": Schema.String.annotate({ "title": "Cited Text" }), - "encrypted_index": Schema.String.annotate({ "title": "Encrypted Index" }), - "title": Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(512)), Schema.Null]) - .annotate({ "title": "Title" }), - "type": Schema.Literal("web_search_result_location").annotate({ "title": "Type" }), - "url": Schema.String.annotate({ "title": "Url" }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(2048)) -}).annotate({ "title": "RequestWebSearchResultLocationCitation" }) -export type ResponseBashCodeExecutionOutputBlock = { - readonly "file_id": string - readonly "type": "bash_code_execution_output" + "type": Schema.Literal("approximate").annotate({ "title": "Type" }) +}).annotate({ "title": "UserLocation" }) +export type BetaUserProfileListOrder = "asc" | "desc" +export const BetaUserProfileListOrder = Schema.Literals(["asc", "desc"]).annotate({ "description": "ListOrder enum" }) +export type BetaUserProfileTrustGrant = { readonly "status": "active" | "pending" | "rejected" } +export const BetaUserProfileTrustGrant = Schema.Struct({ + "status": Schema.Literals(["active", "pending", "rejected"]).annotate({ "description": "Status of the trust grant." }) +}) +export type BetaWebFetchToolResultErrorCode = + | "invalid_tool_input" + | "url_too_long" + | "url_not_allowed" + | "url_not_accessible" + | "unsupported_content_type" + | "too_many_requests" + | "max_uses_exceeded" + | "unavailable" +export const BetaWebFetchToolResultErrorCode = Schema.Literals([ + "invalid_tool_input", + "url_too_long", + "url_not_allowed", + "url_not_accessible", + "unsupported_content_type", + "too_many_requests", + "max_uses_exceeded", + "unavailable" +]).annotate({ "title": "WebFetchToolResultErrorCode" }) +export type BetaWebSearchToolResultErrorCode = + | "invalid_tool_input" + | "unavailable" + | "max_uses_exceeded" + | "too_many_requests" + | "query_too_long" + | "request_too_large" +export const BetaWebSearchToolResultErrorCode = Schema.Literals([ + "invalid_tool_input", + "unavailable", + "max_uses_exceeded", + "too_many_requests", + "query_too_long", + "request_too_large" +]).annotate({ "title": "WebSearchToolResultErrorCode" }) +export type BetaWebhookSessionArchivedEventData = { + readonly "type": "session.archived" + readonly "id": string + readonly "organization_id": string + readonly "workspace_id": string +} +export const BetaWebhookSessionArchivedEventData = Schema.Struct({ + "type": Schema.Literal("session.archived"), + "id": Schema.String.annotate({ "description": "ID of the resource that triggered the event." }), + "organization_id": Schema.String, + "workspace_id": Schema.String +}).annotate({ "title": "BetaWebhookSessionArchivedEventData" }) +export type BetaWebhookSessionCreatedEventData = { + readonly "type": "session.created" + readonly "id": string + readonly "organization_id": string + readonly "workspace_id": string +} +export const BetaWebhookSessionCreatedEventData = Schema.Struct({ + "type": Schema.Literal("session.created"), + "id": Schema.String.annotate({ "description": "ID of the resource that triggered the event." }), + "organization_id": Schema.String, + "workspace_id": Schema.String +}).annotate({ "title": "BetaWebhookSessionCreatedEventData" }) +export type BetaWebhookSessionDeletedEventData = { + readonly "type": "session.deleted" + readonly "id": string + readonly "organization_id": string + readonly "workspace_id": string +} +export const BetaWebhookSessionDeletedEventData = Schema.Struct({ + "type": Schema.Literal("session.deleted"), + "id": Schema.String.annotate({ "description": "ID of the resource that triggered the event." }), + "organization_id": Schema.String, + "workspace_id": Schema.String +}).annotate({ "title": "BetaWebhookSessionDeletedEventData" }) +export type BetaWebhookSessionIdledEventData = { + readonly "type": "session.idled" + readonly "id": string + readonly "organization_id": string + readonly "workspace_id": string +} +export const BetaWebhookSessionIdledEventData = Schema.Struct({ + "type": Schema.Literal("session.idled"), + "id": Schema.String.annotate({ "description": "ID of the resource that triggered the event." }), + "organization_id": Schema.String, + "workspace_id": Schema.String +}).annotate({ "title": "BetaWebhookSessionIdledEventData" }) +export type BetaWebhookSessionOutcomeEvaluationEndedEventData = { + readonly "type": "session.outcome_evaluation_ended" + readonly "id": string + readonly "organization_id": string + readonly "workspace_id": string +} +export const BetaWebhookSessionOutcomeEvaluationEndedEventData = Schema.Struct({ + "type": Schema.Literal("session.outcome_evaluation_ended"), + "id": Schema.String.annotate({ "description": "ID of the resource that triggered the event." }), + "organization_id": Schema.String, + "workspace_id": Schema.String +}).annotate({ "title": "BetaWebhookSessionOutcomeEvaluationEndedEventData" }) +export type BetaWebhookSessionPendingEventData = { + readonly "type": "session.pending" + readonly "id": string + readonly "organization_id": string + readonly "workspace_id": string +} +export const BetaWebhookSessionPendingEventData = Schema.Struct({ + "type": Schema.Literal("session.pending"), + "id": Schema.String.annotate({ "description": "ID of the resource that triggered the event." }), + "organization_id": Schema.String, + "workspace_id": Schema.String +}).annotate({ "title": "BetaWebhookSessionPendingEventData" }) +export type BetaWebhookSessionRequiresActionEventData = { + readonly "type": "session.requires_action" + readonly "id": string + readonly "organization_id": string + readonly "workspace_id": string +} +export const BetaWebhookSessionRequiresActionEventData = Schema.Struct({ + "type": Schema.Literal("session.requires_action"), + "id": Schema.String.annotate({ "description": "ID of the resource that triggered the event." }), + "organization_id": Schema.String, + "workspace_id": Schema.String +}).annotate({ "title": "BetaWebhookSessionRequiresActionEventData" }) +export type BetaWebhookSessionRunningEventData = { + readonly "type": "session.running" + readonly "id": string + readonly "organization_id": string + readonly "workspace_id": string +} +export const BetaWebhookSessionRunningEventData = Schema.Struct({ + "type": Schema.Literal("session.running"), + "id": Schema.String.annotate({ "description": "ID of the resource that triggered the event." }), + "organization_id": Schema.String, + "workspace_id": Schema.String +}).annotate({ "title": "BetaWebhookSessionRunningEventData" }) +export type BetaWebhookSessionStatusIdledEventData = { + readonly "type": "session.status_idled" + readonly "id": string + readonly "organization_id": string + readonly "workspace_id": string +} +export const BetaWebhookSessionStatusIdledEventData = Schema.Struct({ + "type": Schema.Literal("session.status_idled"), + "id": Schema.String.annotate({ "description": "ID of the resource that triggered the event." }), + "organization_id": Schema.String, + "workspace_id": Schema.String +}).annotate({ "title": "BetaWebhookSessionStatusIdledEventData" }) +export type BetaWebhookSessionStatusRescheduledEventData = { + readonly "type": "session.status_rescheduled" + readonly "id": string + readonly "organization_id": string + readonly "workspace_id": string +} +export const BetaWebhookSessionStatusRescheduledEventData = Schema.Struct({ + "type": Schema.Literal("session.status_rescheduled"), + "id": Schema.String.annotate({ "description": "ID of the resource that triggered the event." }), + "organization_id": Schema.String, + "workspace_id": Schema.String +}).annotate({ "title": "BetaWebhookSessionStatusRescheduledEventData" }) +export type BetaWebhookSessionStatusRunStartedEventData = { + readonly "type": "session.status_run_started" + readonly "id": string + readonly "organization_id": string + readonly "workspace_id": string +} +export const BetaWebhookSessionStatusRunStartedEventData = Schema.Struct({ + "type": Schema.Literal("session.status_run_started"), + "id": Schema.String.annotate({ "description": "ID of the resource that triggered the event." }), + "organization_id": Schema.String, + "workspace_id": Schema.String +}).annotate({ "title": "BetaWebhookSessionStatusRunStartedEventData" }) +export type BetaWebhookSessionStatusTerminatedEventData = { + readonly "type": "session.status_terminated" + readonly "id": string + readonly "organization_id": string + readonly "workspace_id": string +} +export const BetaWebhookSessionStatusTerminatedEventData = Schema.Struct({ + "type": Schema.Literal("session.status_terminated"), + "id": Schema.String.annotate({ "description": "ID of the resource that triggered the event." }), + "organization_id": Schema.String, + "workspace_id": Schema.String +}).annotate({ "title": "BetaWebhookSessionStatusTerminatedEventData" }) +export type BetaWebhookSessionThreadCreatedEventData = { + readonly "type": "session.thread_created" + readonly "id": string + readonly "organization_id": string + readonly "workspace_id": string +} +export const BetaWebhookSessionThreadCreatedEventData = Schema.Struct({ + "type": Schema.Literal("session.thread_created"), + "id": Schema.String.annotate({ "description": "ID of the resource that triggered the event." }), + "organization_id": Schema.String, + "workspace_id": Schema.String +}).annotate({ "title": "BetaWebhookSessionThreadCreatedEventData" }) +export type BetaWebhookSessionThreadIdledEventData = { + readonly "type": "session.thread_idled" + readonly "id": string + readonly "organization_id": string + readonly "workspace_id": string +} +export const BetaWebhookSessionThreadIdledEventData = Schema.Struct({ + "type": Schema.Literal("session.thread_idled"), + "id": Schema.String.annotate({ "description": "ID of the resource that triggered the event." }), + "organization_id": Schema.String, + "workspace_id": Schema.String +}).annotate({ "title": "BetaWebhookSessionThreadIdledEventData" }) +export type BetaWebhookSessionThreadTerminatedEventData = { + readonly "type": "session.thread_terminated" + readonly "id": string + readonly "organization_id": string + readonly "workspace_id": string +} +export const BetaWebhookSessionThreadTerminatedEventData = Schema.Struct({ + "type": Schema.Literal("session.thread_terminated"), + "id": Schema.String.annotate({ "description": "ID of the resource that triggered the event." }), + "organization_id": Schema.String, + "workspace_id": Schema.String +}).annotate({ "title": "BetaWebhookSessionThreadTerminatedEventData" }) +export type BetaWebhookVaultArchivedEventData = { + readonly "type": "vault.archived" + readonly "id": string + readonly "organization_id": string + readonly "workspace_id": string +} +export const BetaWebhookVaultArchivedEventData = Schema.Struct({ + "type": Schema.Literal("vault.archived"), + "id": Schema.String.annotate({ "description": "ID of the resource that triggered the event." }), + "organization_id": Schema.String, + "workspace_id": Schema.String +}).annotate({ "title": "BetaWebhookVaultArchivedEventData" }) +export type BetaWebhookVaultCreatedEventData = { + readonly "type": "vault.created" + readonly "id": string + readonly "organization_id": string + readonly "workspace_id": string +} +export const BetaWebhookVaultCreatedEventData = Schema.Struct({ + "type": Schema.Literal("vault.created"), + "id": Schema.String.annotate({ "description": "ID of the resource that triggered the event." }), + "organization_id": Schema.String, + "workspace_id": Schema.String +}).annotate({ "title": "BetaWebhookVaultCreatedEventData" }) +export type BetaWebhookVaultCredentialArchivedEventData = { + readonly "type": "vault_credential.archived" + readonly "id": string + readonly "organization_id": string + readonly "workspace_id": string + readonly "vault_id": string +} +export const BetaWebhookVaultCredentialArchivedEventData = Schema.Struct({ + "type": Schema.Literal("vault_credential.archived"), + "id": Schema.String.annotate({ "description": "ID of the resource that triggered the event." }), + "organization_id": Schema.String, + "workspace_id": Schema.String, + "vault_id": Schema.String.annotate({ "description": "ID of the vault that owns this credential." }) +}).annotate({ "title": "BetaWebhookVaultCredentialArchivedEventData" }) +export type BetaWebhookVaultCredentialCreatedEventData = { + readonly "type": "vault_credential.created" + readonly "id": string + readonly "organization_id": string + readonly "workspace_id": string + readonly "vault_id": string +} +export const BetaWebhookVaultCredentialCreatedEventData = Schema.Struct({ + "type": Schema.Literal("vault_credential.created"), + "id": Schema.String.annotate({ "description": "ID of the resource that triggered the event." }), + "organization_id": Schema.String, + "workspace_id": Schema.String, + "vault_id": Schema.String.annotate({ "description": "ID of the vault that owns this credential." }) +}).annotate({ "title": "BetaWebhookVaultCredentialCreatedEventData" }) +export type BetaWebhookVaultCredentialDeletedEventData = { + readonly "type": "vault_credential.deleted" + readonly "id": string + readonly "organization_id": string + readonly "workspace_id": string + readonly "vault_id": string +} +export const BetaWebhookVaultCredentialDeletedEventData = Schema.Struct({ + "type": Schema.Literal("vault_credential.deleted"), + "id": Schema.String.annotate({ "description": "ID of the resource that triggered the event." }), + "organization_id": Schema.String, + "workspace_id": Schema.String, + "vault_id": Schema.String.annotate({ "description": "ID of the vault that owns this credential." }) +}).annotate({ "title": "BetaWebhookVaultCredentialDeletedEventData" }) +export type BetaWebhookVaultCredentialRefreshFailedEventData = { + readonly "type": "vault_credential.refresh_failed" + readonly "id": string + readonly "organization_id": string + readonly "workspace_id": string + readonly "vault_id": string +} +export const BetaWebhookVaultCredentialRefreshFailedEventData = Schema.Struct({ + "type": Schema.Literal("vault_credential.refresh_failed"), + "id": Schema.String.annotate({ "description": "ID of the resource that triggered the event." }), + "organization_id": Schema.String, + "workspace_id": Schema.String, + "vault_id": Schema.String.annotate({ "description": "ID of the vault that owns this credential." }) +}).annotate({ "title": "BetaWebhookVaultCredentialRefreshFailedEventData" }) +export type BetaWebhookVaultDeletedEventData = { + readonly "type": "vault.deleted" + readonly "id": string + readonly "organization_id": string + readonly "workspace_id": string +} +export const BetaWebhookVaultDeletedEventData = Schema.Struct({ + "type": Schema.Literal("vault.deleted"), + "id": Schema.String.annotate({ "description": "ID of the resource that triggered the event." }), + "organization_id": Schema.String, + "workspace_id": Schema.String +}).annotate({ "title": "BetaWebhookVaultDeletedEventData" }) +export type Betaapi__schemas__skills__Skill = { + readonly "created_at": string + readonly "display_title": string | null + readonly "id": string + readonly "latest_version": string | null + readonly "source": string + readonly "type": string + readonly "updated_at": string } -export const ResponseBashCodeExecutionOutputBlock = Schema.Struct({ - "file_id": Schema.String.annotate({ "title": "File Id" }), - "type": Schema.Literal("bash_code_execution_output").annotate({ +export const Betaapi__schemas__skills__Skill = Schema.Struct({ + "created_at": Schema.String.annotate({ + "title": "Created At", + "description": "ISO 8601 timestamp of when the skill was created." + }), + "display_title": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Display Title", + "description": + "Display title for the skill.\n\nThis is a human-readable label that is not included in the prompt sent to the model." + }), + "id": Schema.String.annotate({ + "title": "Id", + "description": "Unique identifier for the skill.\n\nThe format and length of IDs may change over time." + }), + "latest_version": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Latest Version", + "description": + "The latest version identifier for the skill.\n\nThis represents the most recent version of the skill that has been created." + }), + "source": Schema.String.annotate({ + "title": "Source", + "description": + "Source of the skill.\n\nThis may be one of the following values:\n* `\"custom\"`: the skill was created by a user\n* `\"anthropic\"`: the skill was created by Anthropic" + }), + "type": Schema.String.annotate({ "title": "Type", - "default": "bash_code_execution_output" + "description": "Object type.\n\nFor Skills, this is always `\"skill\"`.", + "default": "skill" + }), + "updated_at": Schema.String.annotate({ + "title": "Updated At", + "description": "ISO 8601 timestamp of when the skill was last updated." }) -}).annotate({ "title": "ResponseBashCodeExecutionOutputBlock" }) -export type ResponseCharLocationCitation = { - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string | null - readonly "end_char_index": number - readonly "file_id": string | null - readonly "start_char_index": number - readonly "type": "char_location" -} -export const ResponseCharLocationCitation = Schema.Struct({ - "cited_text": Schema.String.annotate({ "title": "Cited Text" }), - "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) +}).annotate({ "title": "Skill" }) +export type BillingError = { readonly "message": string; readonly "type": "billing_error" } +export const BillingError = Schema.Struct({ + "message": Schema.String.annotate({ "title": "Message", "default": "Billing error" }), + "type": Schema.Literal("billing_error").annotate({ "title": "Type", "default": "billing_error" }) +}).annotate({ "title": "BillingError" }) +export type CacheControlEphemeral = { readonly "ttl"?: "5m" | "1h"; readonly "type": "ephemeral" } +export const CacheControlEphemeral = Schema.Struct({ + "ttl": Schema.optionalKey( + Schema.Literals(["5m", "1h"]).annotate({ + "title": "Ttl", + "description": + "The time-to-live for the cache control breakpoint.\n\nThis may be one the following values:\n- `5m`: 5 minutes\n- `1h`: 1 hour\n\nDefaults to `5m`." + }) ), - "document_title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Document Title" }), - "end_char_index": Schema.Number.annotate({ "title": "End Char Index" }).check(Schema.isInt()), - "file_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "File Id", "default": null }), - "start_char_index": Schema.Number.annotate({ "title": "Start Char Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) - ), - "type": Schema.Literal("char_location").annotate({ "title": "Type", "default": "char_location" }) -}).annotate({ "title": "ResponseCharLocationCitation" }) -export type ResponseCitationsConfig = { readonly "enabled": boolean } -export const ResponseCitationsConfig = Schema.Struct({ - "enabled": Schema.Boolean.annotate({ "title": "Enabled", "default": false }) -}).annotate({ "title": "ResponseCitationsConfig" }) -export type ResponseCodeExecutionOutputBlock = { readonly "file_id": string; readonly "type": "code_execution_output" } -export const ResponseCodeExecutionOutputBlock = Schema.Struct({ - "file_id": Schema.String.annotate({ "title": "File Id" }), - "type": Schema.Literal("code_execution_output").annotate({ "title": "Type", "default": "code_execution_output" }) -}).annotate({ "title": "ResponseCodeExecutionOutputBlock" }) -export type ResponseContainerUploadBlock = { readonly "file_id": string; readonly "type": "container_upload" } -export const ResponseContainerUploadBlock = Schema.Struct({ - "file_id": Schema.String.annotate({ "title": "File Id" }), - "type": Schema.Literal("container_upload").annotate({ "title": "Type", "default": "container_upload" }) + "type": Schema.Literal("ephemeral").annotate({ "title": "Type" }) +}).annotate({ "title": "CacheControlEphemeral" }) +export type CacheCreation = { + readonly "ephemeral_1h_input_tokens": number + readonly "ephemeral_5m_input_tokens": number +} +export const CacheCreation = Schema.Struct({ + "ephemeral_1h_input_tokens": Schema.Number.annotate({ + "title": "Ephemeral 1H Input Tokens", + "description": "The number of input tokens used to create the 1 hour cache entry.", + "default": 0 + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "ephemeral_5m_input_tokens": Schema.Number.annotate({ + "title": "Ephemeral 5M Input Tokens", + "description": "The number of input tokens used to create the 5 minute cache entry.", + "default": 0 + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)) +}).annotate({ "title": "CacheCreation" }) +export type CanceledResult = { readonly "type": "canceled" } +export const CanceledResult = Schema.Struct({ + "type": Schema.Literal("canceled").annotate({ "title": "Type", "default": "canceled" }) +}).annotate({ "title": "CanceledResult" }) +export type CapabilitySupport = { readonly "supported": boolean } +export const CapabilitySupport = Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) +}).annotate({ "title": "CapabilitySupport", "description": "Indicates whether a capability is supported." }) +export type CodeExecutionToolResultErrorCode = + | "invalid_tool_input" + | "unavailable" + | "too_many_requests" + | "execution_time_exceeded" +export const CodeExecutionToolResultErrorCode = Schema.Literals([ + "invalid_tool_input", + "unavailable", + "too_many_requests", + "execution_time_exceeded" +]).annotate({ "title": "CodeExecutionToolResultErrorCode" }) +export type Container = { readonly "expires_at": string; readonly "id": string } +export const Container = Schema.Struct({ + "expires_at": Schema.String.annotate({ + "title": "Expires At", + "description": "The time at which the container will expire.", + "format": "date-time" + }), + "id": Schema.String.annotate({ "title": "Id", "description": "Identifier for the container used in this request" }) }).annotate({ - "title": "ResponseContainerUploadBlock", - "description": "Response model for a file uploaded to the container." + "title": "Container", + "description": "Information about the container used in the request (for the code execution tool)" }) -export type ResponseContentBlockLocationCitation = { - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string | null - readonly "end_block_index": number - readonly "file_id": string | null - readonly "start_block_index": number - readonly "type": "content_block_location" -} -export const ResponseContentBlockLocationCitation = Schema.Struct({ - "cited_text": Schema.String.annotate({ "title": "Cited Text" }), - "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) - ), - "document_title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Document Title" }), - "end_block_index": Schema.Number.annotate({ "title": "End Block Index" }).check(Schema.isInt()), - "file_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "File Id", "default": null }), - "start_block_index": Schema.Number.annotate({ "title": "Start Block Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) - ), - "type": Schema.Literal("content_block_location").annotate({ "title": "Type", "default": "content_block_location" }) -}).annotate({ "title": "ResponseContentBlockLocationCitation" }) -export type ResponsePageLocationCitation = { - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string | null - readonly "end_page_number": number - readonly "file_id": string | null - readonly "start_page_number": number - readonly "type": "page_location" -} -export const ResponsePageLocationCitation = Schema.Struct({ - "cited_text": Schema.String.annotate({ "title": "Cited Text" }), - "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) - ), - "document_title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Document Title" }), - "end_page_number": Schema.Number.annotate({ "title": "End Page Number" }).check(Schema.isInt()), - "file_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "File Id", "default": null }), - "start_page_number": Schema.Number.annotate({ "title": "Start Page Number" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(1) - ), - "type": Schema.Literal("page_location").annotate({ "title": "Type", "default": "page_location" }) -}).annotate({ "title": "ResponsePageLocationCitation" }) -export type ResponseRedactedThinkingBlock = { readonly "data": string; readonly "type": "redacted_thinking" } -export const ResponseRedactedThinkingBlock = Schema.Struct({ - "data": Schema.String.annotate({ "title": "Data" }), - "type": Schema.Literal("redacted_thinking").annotate({ "title": "Type", "default": "redacted_thinking" }) -}).annotate({ "title": "ResponseRedactedThinkingBlock" }) -export type ResponseSearchResultLocationCitation = { - readonly "cited_text": string - readonly "end_block_index": number - readonly "search_result_index": number - readonly "source": string - readonly "start_block_index": number - readonly "title": string | null - readonly "type": "search_result_location" -} -export const ResponseSearchResultLocationCitation = Schema.Struct({ - "cited_text": Schema.String.annotate({ "title": "Cited Text" }), - "end_block_index": Schema.Number.annotate({ "title": "End Block Index" }).check(Schema.isInt()), - "search_result_index": Schema.Number.annotate({ "title": "Search Result Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) - ), - "source": Schema.String.annotate({ "title": "Source" }), - "start_block_index": Schema.Number.annotate({ "title": "Start Block Index" }).check(Schema.isInt()).check( - Schema.isGreaterThanOrEqualTo(0) - ), - "title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Title" }), - "type": Schema.Literal("search_result_location").annotate({ "title": "Type", "default": "search_result_location" }) -}).annotate({ "title": "ResponseSearchResultLocationCitation" }) -export type ResponseTextEditorCodeExecutionCreateResultBlock = { - readonly "is_file_update": boolean - readonly "type": "text_editor_code_execution_create_result" -} -export const ResponseTextEditorCodeExecutionCreateResultBlock = Schema.Struct({ - "is_file_update": Schema.Boolean.annotate({ "title": "Is File Update" }), - "type": Schema.Literal("text_editor_code_execution_create_result").annotate({ +export type ContentBlockStopEvent = { readonly "index": number; readonly "type": "content_block_stop" } +export const ContentBlockStopEvent = Schema.Struct({ + "index": Schema.Number.annotate({ "title": "Index" }).check(Schema.isInt()), + "type": Schema.Literal("content_block_stop").annotate({ "title": "Type", "default": "content_block_stop" }) +}).annotate({ "title": "ContentBlockStopEvent" }) +export type CountMessageTokensResponse = { readonly "input_tokens": number } +export const CountMessageTokensResponse = Schema.Struct({ + "input_tokens": Schema.Number.annotate({ + "title": "Input Tokens", + "description": "The total number of tokens across the provided list of messages, system prompt, and tools." + }).check(Schema.isInt()) +}).annotate({ "title": "CountMessageTokensResponse" }) +export type DeleteMessageBatchResponse = { readonly "id": string; readonly "type": "message_batch_deleted" } +export const DeleteMessageBatchResponse = Schema.Struct({ + "id": Schema.String.annotate({ "title": "Id", "description": "ID of the Message Batch." }), + "type": Schema.Literal("message_batch_deleted").annotate({ "title": "Type", - "default": "text_editor_code_execution_create_result" + "description": "Deleted object type.\n\nFor Message Batches, this is always `\"message_batch_deleted\"`.", + "default": "message_batch_deleted" }) -}).annotate({ "title": "ResponseTextEditorCodeExecutionCreateResultBlock" }) -export type ResponseTextEditorCodeExecutionStrReplaceResultBlock = { - readonly "lines": ReadonlyArray | null - readonly "new_lines": number | null - readonly "new_start": number | null - readonly "old_lines": number | null - readonly "old_start": number | null - readonly "type": "text_editor_code_execution_str_replace_result" +}).annotate({ "title": "DeleteMessageBatchResponse" }) +export type DirectCaller = { readonly "type": "direct" } +export const DirectCaller = Schema.Struct({ "type": Schema.Literal("direct").annotate({ "title": "Type" }) }).annotate({ + "title": "DirectCaller", + "description": "Tool invocation directly from the model." +}) +export type EffortLevel = "low" | "medium" | "high" | "xhigh" | "max" +export const EffortLevel = Schema.Literals(["low", "medium", "high", "xhigh", "max"]).annotate({ + "title": "EffortLevel", + "description": "All possible effort levels." +}) +export type ExpiredResult = { readonly "type": "expired" } +export const ExpiredResult = Schema.Struct({ + "type": Schema.Literal("expired").annotate({ "title": "Type", "default": "expired" }) +}).annotate({ "title": "ExpiredResult" }) +export type GatewayTimeoutError = { readonly "message": string; readonly "type": "timeout_error" } +export const GatewayTimeoutError = Schema.Struct({ + "message": Schema.String.annotate({ "title": "Message", "default": "Request timeout" }), + "type": Schema.Literal("timeout_error").annotate({ "title": "Type", "default": "timeout_error" }) +}).annotate({ "title": "GatewayTimeoutError" }) +export type InputJsonContentBlockDelta = { readonly "partial_json": string; readonly "type": "input_json_delta" } +export const InputJsonContentBlockDelta = Schema.Struct({ + "partial_json": Schema.String.annotate({ "title": "Partial Json" }), + "type": Schema.Literal("input_json_delta").annotate({ "title": "Type", "default": "input_json_delta" }) +}).annotate({ "title": "InputJsonContentBlockDelta" }) +export type InvalidRequestError = { readonly "message": string; readonly "type": "invalid_request_error" } +export const InvalidRequestError = Schema.Struct({ + "message": Schema.String.annotate({ "title": "Message", "default": "Invalid request" }), + "type": Schema.Literal("invalid_request_error").annotate({ "title": "Type", "default": "invalid_request_error" }) +}).annotate({ "title": "InvalidRequestError" }) +export type JsonOutputFormat = { readonly "schema": { readonly [x: string]: unknown }; readonly "type": "json_schema" } +export const JsonOutputFormat = Schema.Struct({ + "schema": Schema.Record(Schema.String, Schema.Unknown).annotate({ + "title": "Schema", + "description": "The JSON schema of the format" + }), + "type": Schema.Literal("json_schema").annotate({ "title": "Type" }) +}).annotate({ "title": "JsonOutputFormat" }) +export type JsonValue = unknown +export const JsonValue = Schema.Unknown +export type MessageBatch = { + readonly "archived_at": string | null + readonly "cancel_initiated_at": string | null + readonly "created_at": string + readonly "ended_at": string | null + readonly "expires_at": string + readonly "id": string + readonly "processing_status": "in_progress" | "canceling" | "ended" + readonly "request_counts": { + readonly "canceled": number + readonly "errored": number + readonly "expired": number + readonly "processing": number + readonly "succeeded": number + } + readonly "results_url": string | null + readonly "type": "message_batch" } -export const ResponseTextEditorCodeExecutionStrReplaceResultBlock = Schema.Struct({ - "lines": Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Lines", "default": null }), - "new_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ - "title": "New Lines", - "default": null +export const MessageBatch = Schema.Struct({ + "archived_at": Schema.Union([Schema.String.annotate({ "format": "date-time" }), Schema.Null]).annotate({ + "title": "Archived At", + "description": + "RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable." }), - "new_start": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ - "title": "New Start", - "default": null + "cancel_initiated_at": Schema.Union([Schema.String.annotate({ "format": "date-time" }), Schema.Null]).annotate({ + "title": "Cancel Initiated At", + "description": + "RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated." }), - "old_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ - "title": "Old Lines", - "default": null + "created_at": Schema.String.annotate({ + "title": "Created At", + "description": "RFC 3339 datetime string representing the time at which the Message Batch was created.", + "format": "date-time" }), - "old_start": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ - "title": "Old Start", - "default": null + "ended_at": Schema.Union([Schema.String.annotate({ "format": "date-time" }), Schema.Null]).annotate({ + "title": "Ended At", + "description": + "RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.\n\nProcessing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired." }), - "type": Schema.Literal("text_editor_code_execution_str_replace_result").annotate({ - "title": "Type", - "default": "text_editor_code_execution_str_replace_result" - }) -}).annotate({ "title": "ResponseTextEditorCodeExecutionStrReplaceResultBlock" }) -export type ResponseTextEditorCodeExecutionViewResultBlock = { - readonly "content": string - readonly "file_type": "text" | "image" | "pdf" - readonly "num_lines": number | null - readonly "start_line": number | null - readonly "total_lines": number | null - readonly "type": "text_editor_code_execution_view_result" -} -export const ResponseTextEditorCodeExecutionViewResultBlock = Schema.Struct({ - "content": Schema.String.annotate({ "title": "Content" }), - "file_type": Schema.Literals(["text", "image", "pdf"]).annotate({ "title": "File Type" }), - "num_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ - "title": "Num Lines", - "default": null - }), - "start_line": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ - "title": "Start Line", - "default": null - }), - "total_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ - "title": "Total Lines", - "default": null - }), - "type": Schema.Literal("text_editor_code_execution_view_result").annotate({ - "title": "Type", - "default": "text_editor_code_execution_view_result" - }) -}).annotate({ "title": "ResponseTextEditorCodeExecutionViewResultBlock" }) -export type ResponseThinkingBlock = { - readonly "signature": string - readonly "thinking": string - readonly "type": "thinking" -} -export const ResponseThinkingBlock = Schema.Struct({ - "signature": Schema.String.annotate({ "title": "Signature" }), - "thinking": Schema.String.annotate({ "title": "Thinking" }), - "type": Schema.Literal("thinking").annotate({ "title": "Type", "default": "thinking" }) -}).annotate({ "title": "ResponseThinkingBlock" }) -export type ResponseToolReferenceBlock = { readonly "tool_name": string; readonly "type": "tool_reference" } -export const ResponseToolReferenceBlock = Schema.Struct({ - "tool_name": Schema.String.annotate({ "title": "Tool Name" }).check(Schema.isMinLength(1)).check( - Schema.isMaxLength(256) - ).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]{1,256}$"))), - "type": Schema.Literal("tool_reference").annotate({ "title": "Type", "default": "tool_reference" }) -}).annotate({ "title": "ResponseToolReferenceBlock" }) -export type ResponseWebSearchResultBlock = { - readonly "encrypted_content": string - readonly "page_age": string | null - readonly "title": string - readonly "type": "web_search_result" - readonly "url": string -} -export const ResponseWebSearchResultBlock = Schema.Struct({ - "encrypted_content": Schema.String.annotate({ "title": "Encrypted Content" }), - "page_age": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Page Age", "default": null }), - "title": Schema.String.annotate({ "title": "Title" }), - "type": Schema.Literal("web_search_result").annotate({ "title": "Type", "default": "web_search_result" }), - "url": Schema.String.annotate({ "title": "Url" }) -}).annotate({ "title": "ResponseWebSearchResultBlock" }) -export type ResponseWebSearchResultLocationCitation = { - readonly "cited_text": string - readonly "encrypted_index": string - readonly "title": string | null - readonly "type": "web_search_result_location" - readonly "url": string -} -export const ResponseWebSearchResultLocationCitation = Schema.Struct({ - "cited_text": Schema.String.annotate({ "title": "Cited Text" }), - "encrypted_index": Schema.String.annotate({ "title": "Encrypted Index" }), - "title": Schema.Union([Schema.String.check(Schema.isMaxLength(512)), Schema.Null]).annotate({ "title": "Title" }), - "type": Schema.Literal("web_search_result_location").annotate({ - "title": "Type", - "default": "web_search_result_location" - }), - "url": Schema.String.annotate({ "title": "Url" }) -}).annotate({ "title": "ResponseWebSearchResultLocationCitation" }) -export type ServerToolCaller = { readonly "tool_id": string; readonly "type": "code_execution_20250825" } -export const ServerToolCaller = Schema.Struct({ - "tool_id": Schema.String.annotate({ "title": "Tool Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) - ), - "type": Schema.Literal("code_execution_20250825").annotate({ "title": "Type" }) -}).annotate({ "title": "ServerToolCaller", "description": "Tool invocation generated by a server-side tool." }) -export type ServerToolCaller_20260120 = { readonly "tool_id": string; readonly "type": "code_execution_20260120" } -export const ServerToolCaller_20260120 = Schema.Struct({ - "tool_id": Schema.String.annotate({ "title": "Tool Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) - ), - "type": Schema.Literal("code_execution_20260120").annotate({ "title": "Type" }) -}).annotate({ "title": "ServerToolCaller_20260120" }) -export type ServerToolUsage = { readonly "web_fetch_requests": number; readonly "web_search_requests": number } -export const ServerToolUsage = Schema.Struct({ - "web_fetch_requests": Schema.Number.annotate({ - "title": "Web Fetch Requests", - "description": "The number of web fetch tool requests.", - "default": 0 - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - "web_search_requests": Schema.Number.annotate({ - "title": "Web Search Requests", - "description": "The number of web search tool requests.", - "default": 0 - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)) -}).annotate({ "title": "ServerToolUsage" }) -export type SignatureContentBlockDelta = { readonly "signature": string; readonly "type": "signature_delta" } -export const SignatureContentBlockDelta = Schema.Struct({ - "signature": Schema.String.annotate({ "title": "Signature" }), - "type": Schema.Literal("signature_delta").annotate({ "title": "Type", "default": "signature_delta" }) -}).annotate({ "title": "SignatureContentBlockDelta" }) -export type Skill = { - readonly "created_at": string - readonly "display_title": string | null - readonly "id": string - readonly "latest_version": string | null - readonly "source": string - readonly "type": string - readonly "updated_at": string -} -export const Skill = Schema.Struct({ - "created_at": Schema.String.annotate({ - "title": "Created At", - "description": "ISO 8601 timestamp of when the skill was created." - }), - "display_title": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Display Title", + "expires_at": Schema.String.annotate({ + "title": "Expires At", "description": - "Display title for the skill.\n\nThis is a human-readable label that is not included in the prompt sent to the model." + "RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.", + "format": "date-time" }), "id": Schema.String.annotate({ "title": "Id", - "description": "Unique identifier for the skill.\n\nThe format and length of IDs may change over time." + "description": "Unique object identifier.\n\nThe format and length of IDs may change over time." }), - "latest_version": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Latest Version", + "processing_status": Schema.Literals(["in_progress", "canceling", "ended"]).annotate({ + "title": "Processing Status", + "description": "Processing status of the Message Batch." + }), + "request_counts": Schema.Struct({ + "canceled": Schema.Number.annotate({ + "title": "Canceled", + "description": + "Number of requests in the Message Batch that have been canceled.\n\nThis is zero until processing of the entire Message Batch has ended.", + "default": 0 + }).check(Schema.isInt()), + "errored": Schema.Number.annotate({ + "title": "Errored", + "description": + "Number of requests in the Message Batch that encountered an error.\n\nThis is zero until processing of the entire Message Batch has ended.", + "default": 0 + }).check(Schema.isInt()), + "expired": Schema.Number.annotate({ + "title": "Expired", + "description": + "Number of requests in the Message Batch that have expired.\n\nThis is zero until processing of the entire Message Batch has ended.", + "default": 0 + }).check(Schema.isInt()), + "processing": Schema.Number.annotate({ + "title": "Processing", + "description": "Number of requests in the Message Batch that are processing.", + "default": 0 + }).check(Schema.isInt()), + "succeeded": Schema.Number.annotate({ + "title": "Succeeded", + "description": + "Number of requests in the Message Batch that have completed successfully.\n\nThis is zero until processing of the entire Message Batch has ended.", + "default": 0 + }).check(Schema.isInt()) + }).annotate({ + "title": "RequestCounts", "description": - "The latest version identifier for the skill.\n\nThis represents the most recent version of the skill that has been created." + "Tallies requests within the Message Batch, categorized by their status.\n\nRequests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch." }), - "source": Schema.String.annotate({ - "title": "Source", + "results_url": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Results Url", "description": - "Source of the skill.\n\nThis may be one of the following values:\n* `\"custom\"`: the skill was created by a user\n* `\"anthropic\"`: the skill was created by Anthropic" + "URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.\n\nResults in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests." }), - "type": Schema.String.annotate({ + "type": Schema.Literal("message_batch").annotate({ "title": "Type", - "description": "Object type.\n\nFor Skills, this is always `\"skill\"`.", - "default": "skill" - }), - "updated_at": Schema.String.annotate({ - "title": "Updated At", - "description": "ISO 8601 timestamp of when the skill was last updated." + "description": "Object type.\n\nFor Message Batches, this is always `\"message_batch\"`.", + "default": "message_batch" }) -}).annotate({ "title": "Skill" }) -export type SkillVersion = { - readonly "created_at": string - readonly "description": string - readonly "directory": string - readonly "id": string - readonly "name": string - readonly "skill_id": string - readonly "type": string - readonly "version": string -} -export const SkillVersion = Schema.Struct({ - "created_at": Schema.String.annotate({ - "title": "Created At", - "description": "ISO 8601 timestamp of when the skill version was created." - }), - "description": Schema.String.annotate({ - "title": "Description", - "description": "Description of the skill version.\n\nThis is extracted from the SKILL.md file in the skill upload." - }), - "directory": Schema.String.annotate({ - "title": "Directory", +}).annotate({ "title": "MessageBatch" }) +export type MessageStopEvent = { readonly "type": "message_stop" } +export const MessageStopEvent = Schema.Struct({ + "type": Schema.Literal("message_stop").annotate({ "title": "Type", "default": "message_stop" }) +}).annotate({ "title": "MessageStopEvent" }) +export type NotFoundError = { readonly "message": string; readonly "type": "not_found_error" } +export const NotFoundError = Schema.Struct({ + "message": Schema.String.annotate({ "title": "Message", "default": "Not found" }), + "type": Schema.Literal("not_found_error").annotate({ "title": "Type", "default": "not_found_error" }) +}).annotate({ "title": "NotFoundError" }) +export type OverloadedError = { readonly "message": string; readonly "type": "overloaded_error" } +export const OverloadedError = Schema.Struct({ + "message": Schema.String.annotate({ "title": "Message", "default": "Overloaded" }), + "type": Schema.Literal("overloaded_error").annotate({ "title": "Type", "default": "overloaded_error" }) +}).annotate({ "title": "OverloadedError" }) +export type PermissionError = { readonly "message": string; readonly "type": "permission_error" } +export const PermissionError = Schema.Struct({ + "message": Schema.String.annotate({ "title": "Message", "default": "Permission denied" }), + "type": Schema.Literal("permission_error").annotate({ "title": "Type", "default": "permission_error" }) +}).annotate({ "title": "PermissionError" }) +export type PlainTextSource = { readonly "data": string; readonly "media_type": "text/plain"; readonly "type": "text" } +export const PlainTextSource = Schema.Struct({ + "data": Schema.String.annotate({ "title": "Data" }), + "media_type": Schema.Literal("text/plain").annotate({ "title": "Media Type" }), + "type": Schema.Literal("text").annotate({ "title": "Type" }) +}).annotate({ "title": "PlainTextSource" }) +export type RateLimitError = { readonly "message": string; readonly "type": "rate_limit_error" } +export const RateLimitError = Schema.Struct({ + "message": Schema.String.annotate({ "title": "Message", "default": "Rate limited" }), + "type": Schema.Literal("rate_limit_error").annotate({ "title": "Type", "default": "rate_limit_error" }) +}).annotate({ "title": "RateLimitError" }) +export type RefusalStopDetails = { + readonly "category": "cyber" | "bio" | null + readonly "explanation": string | null + readonly "type": "refusal" +} +export const RefusalStopDetails = Schema.Struct({ + "category": Schema.Union([Schema.Literals(["cyber", "bio"]), Schema.Null]).annotate({ + "title": "Category", "description": - "Directory name of the skill version.\n\nThis is the top-level directory name that was extracted from the uploaded files." - }), - "id": Schema.String.annotate({ - "title": "Id", - "description": "Unique identifier for the skill version.\n\nThe format and length of IDs may change over time." + "The policy category that triggered the refusal.\n\n`null` when the refusal doesn't map to a named category.", + "default": null }), - "name": Schema.String.annotate({ - "title": "Name", + "explanation": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Explanation", "description": - "Human-readable name of the skill version.\n\nThis is extracted from the SKILL.md file in the skill upload." - }), - "skill_id": Schema.String.annotate({ - "title": "Skill Id", - "description": "Identifier for the skill that this version belongs to." - }), - "type": Schema.String.annotate({ - "title": "Type", - "description": "Object type.\n\nFor Skill Versions, this is always `\"skill_version\"`.", - "default": "skill_version" + "Human-readable explanation of the refusal.\n\nThis text is not guaranteed to be stable. `null` when no explanation is available for the category.", + "default": null }), - "version": Schema.String.annotate({ - "title": "Version", + "type": Schema.Literal("refusal").annotate({ "title": "Type", "default": "refusal" }) +}).annotate({ "title": "RefusalStopDetails", "description": "Structured information about a refusal." }) +export type RequestBashCodeExecutionOutputBlock = { + readonly "file_id": string + readonly "type": "bash_code_execution_output" +} +export const RequestBashCodeExecutionOutputBlock = Schema.Struct({ + "file_id": Schema.String.annotate({ "title": "File Id" }), + "type": Schema.Literal("bash_code_execution_output").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestBashCodeExecutionOutputBlock" }) +export type RequestCharLocationCitation = { + readonly "cited_text": string + readonly "document_index": number + readonly "document_title": string | null + readonly "end_char_index": number + readonly "start_char_index": number + readonly "type": "char_location" +} +export const RequestCharLocationCitation = Schema.Struct({ + "cited_text": Schema.String.annotate({ "title": "Cited Text" }), + "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) + ), + "document_title": Schema.Union([ + Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), + Schema.Null + ]).annotate({ "title": "Document Title" }), + "end_char_index": Schema.Number.annotate({ "title": "End Char Index" }).check(Schema.isInt()), + "start_char_index": Schema.Number.annotate({ "title": "Start Char Index" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) + ), + "type": Schema.Literal("char_location").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestCharLocationCitation" }) +export type RequestCitationsConfig = { readonly "enabled"?: boolean } +export const RequestCitationsConfig = Schema.Struct({ + "enabled": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Enabled" })) +}).annotate({ "title": "RequestCitationsConfig" }) +export type RequestCodeExecutionOutputBlock = { readonly "file_id": string; readonly "type": "code_execution_output" } +export const RequestCodeExecutionOutputBlock = Schema.Struct({ + "file_id": Schema.String.annotate({ "title": "File Id" }), + "type": Schema.Literal("code_execution_output").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestCodeExecutionOutputBlock" }) +export type RequestContentBlockLocationCitation = { + readonly "cited_text": string + readonly "document_index": number + readonly "document_title": string | null + readonly "end_block_index": number + readonly "start_block_index": number + readonly "type": "content_block_location" +} +export const RequestContentBlockLocationCitation = Schema.Struct({ + "cited_text": Schema.String.annotate({ + "title": "Cited Text", "description": - "Version identifier for the skill.\n\nEach version is identified by a Unix epoch timestamp (e.g., \"1759178010641129\")." - }) -}).annotate({ "title": "SkillVersion" }) -export type TextContentBlockDelta = { readonly "text": string; readonly "type": "text_delta" } -export const TextContentBlockDelta = Schema.Struct({ - "text": Schema.String.annotate({ "title": "Text" }), - "type": Schema.Literal("text_delta").annotate({ "title": "Type", "default": "text_delta" }) -}).annotate({ "title": "TextContentBlockDelta" }) -export type TextEditorCodeExecutionToolResultErrorCode = - | "invalid_tool_input" - | "unavailable" - | "too_many_requests" - | "execution_time_exceeded" - | "file_not_found" -export const TextEditorCodeExecutionToolResultErrorCode = Schema.Literals([ - "invalid_tool_input", - "unavailable", - "too_many_requests", - "execution_time_exceeded", - "file_not_found" -]).annotate({ "title": "TextEditorCodeExecutionToolResultErrorCode" }) -export type ThinkingConfigAdaptive = { readonly "type": "adaptive" } -export const ThinkingConfigAdaptive = Schema.Struct({ - "type": Schema.Literal("adaptive").annotate({ "title": "Type" }) -}).annotate({ "title": "ThinkingConfigAdaptive" }) -export type ThinkingConfigDisabled = { readonly "type": "disabled" } -export const ThinkingConfigDisabled = Schema.Struct({ - "type": Schema.Literal("disabled").annotate({ "title": "Type" }) -}).annotate({ "title": "ThinkingConfigDisabled" }) -export type ThinkingConfigEnabled = { readonly "budget_tokens": number; readonly "type": "enabled" } -export const ThinkingConfigEnabled = Schema.Struct({ - "budget_tokens": Schema.Number.annotate({ - "title": "Budget Tokens", + "The full text of the cited block range, concatenated.\n\nAlways equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns." + }), + "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) + ), + "document_title": Schema.Union([ + Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), + Schema.Null + ]).annotate({ "title": "Document Title" }), + "end_block_index": Schema.Number.annotate({ + "title": "End Block Index", "description": - "Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.\n\nMust be ≥1024 and less than `max_tokens`.\n\nSee [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1024)), - "type": Schema.Literal("enabled").annotate({ "title": "Type" }) -}).annotate({ "title": "ThinkingConfigEnabled" }) -export type ThinkingContentBlockDelta = { readonly "thinking": string; readonly "type": "thinking_delta" } -export const ThinkingContentBlockDelta = Schema.Struct({ - "thinking": Schema.String.annotate({ "title": "Thinking" }), - "type": Schema.Literal("thinking_delta").annotate({ "title": "Type", "default": "thinking_delta" }) -}).annotate({ "title": "ThinkingContentBlockDelta" }) -export type ToolChoiceAny = { readonly "disable_parallel_tool_use"?: boolean; readonly "type": "any" } -export const ToolChoiceAny = Schema.Struct({ - "disable_parallel_tool_use": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Disable Parallel Tool Use", - "description": - "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output exactly one tool use." - }) + "Exclusive 0-based end index of the cited block range in the source's `content` array.\n\nAlways greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`." + }).check(Schema.isInt()), + "start_block_index": Schema.Number.annotate({ + "title": "Start Block Index", + "description": "0-based index of the first cited block in the source's `content` array." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "type": Schema.Literal("content_block_location").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestContentBlockLocationCitation" }) +export type RequestPageLocationCitation = { + readonly "cited_text": string + readonly "document_index": number + readonly "document_title": string | null + readonly "end_page_number": number + readonly "start_page_number": number + readonly "type": "page_location" +} +export const RequestPageLocationCitation = Schema.Struct({ + "cited_text": Schema.String.annotate({ "title": "Cited Text" }), + "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) ), - "type": Schema.Literal("any").annotate({ "title": "Type" }) -}).annotate({ "title": "ToolChoiceAny", "description": "The model will use any available tools." }) -export type ToolChoiceAuto = { readonly "disable_parallel_tool_use"?: boolean; readonly "type": "auto" } -export const ToolChoiceAuto = Schema.Struct({ - "disable_parallel_tool_use": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Disable Parallel Tool Use", - "description": - "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output at most one tool use." - }) + "document_title": Schema.Union([ + Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), + Schema.Null + ]).annotate({ "title": "Document Title" }), + "end_page_number": Schema.Number.annotate({ "title": "End Page Number" }).check(Schema.isInt()), + "start_page_number": Schema.Number.annotate({ "title": "Start Page Number" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(1) ), - "type": Schema.Literal("auto").annotate({ "title": "Type" }) -}).annotate({ "title": "ToolChoiceAuto", "description": "The model will automatically decide whether to use tools." }) -export type ToolChoiceNone = { readonly "type": "none" } -export const ToolChoiceNone = Schema.Struct({ "type": Schema.Literal("none").annotate({ "title": "Type" }) }).annotate({ - "title": "ToolChoiceNone", - "description": "The model will not be allowed to use tools." -}) -export type ToolChoiceTool = { - readonly "disable_parallel_tool_use"?: boolean - readonly "name": string - readonly "type": "tool" + "type": Schema.Literal("page_location").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestPageLocationCitation" }) +export type RequestSearchResultLocationCitation = { + readonly "cited_text": string + readonly "end_block_index": number + readonly "search_result_index": number + readonly "source": string + readonly "start_block_index": number + readonly "title": string | null + readonly "type": "search_result_location" } -export const ToolChoiceTool = Schema.Struct({ - "disable_parallel_tool_use": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Disable Parallel Tool Use", - "description": - "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output exactly one tool use." - }) - ), - "name": Schema.String.annotate({ "title": "Name", "description": "The name of the tool to use." }), - "type": Schema.Literal("tool").annotate({ "title": "Type" }) -}).annotate({ - "title": "ToolChoiceTool", - "description": "The model will use the specified tool with `tool_choice.name`." -}) -export type ToolSearchToolResultErrorCode = - | "invalid_tool_input" - | "unavailable" - | "too_many_requests" - | "execution_time_exceeded" -export const ToolSearchToolResultErrorCode = Schema.Literals([ - "invalid_tool_input", - "unavailable", - "too_many_requests", - "execution_time_exceeded" -]).annotate({ "title": "ToolSearchToolResultErrorCode" }) -export type URLImageSource = { readonly "type": "url"; readonly "url": string } -export const URLImageSource = Schema.Struct({ - "type": Schema.Literal("url").annotate({ "title": "Type" }), - "url": Schema.String.annotate({ "title": "Url" }) -}).annotate({ "title": "URLImageSource" }) -export type URLPDFSource = { readonly "type": "url"; readonly "url": string } -export const URLPDFSource = Schema.Struct({ - "type": Schema.Literal("url").annotate({ "title": "Type" }), - "url": Schema.String.annotate({ "title": "Url" }) -}).annotate({ "title": "URLPDFSource" }) -export type UserLocation = { - readonly "city"?: string | null - readonly "country"?: string | null - readonly "region"?: string | null - readonly "timezone"?: string | null - readonly "type": "approximate" +export const RequestSearchResultLocationCitation = Schema.Struct({ + "cited_text": Schema.String.annotate({ + "title": "Cited Text", + "description": + "The full text of the cited block range, concatenated.\n\nAlways equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns." + }), + "end_block_index": Schema.Number.annotate({ + "title": "End Block Index", + "description": + "Exclusive 0-based end index of the cited block range in the source's `content` array.\n\nAlways greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`." + }).check(Schema.isInt()), + "search_result_index": Schema.Number.annotate({ + "title": "Search Result Index", + "description": + "0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.\n\nCounted separately from `document_index`; server-side web search results are not included in this count." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "source": Schema.String.annotate({ "title": "Source" }), + "start_block_index": Schema.Number.annotate({ + "title": "Start Block Index", + "description": "0-based index of the first cited block in the source's `content` array." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Title" }), + "type": Schema.Literal("search_result_location").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestSearchResultLocationCitation" }) +export type RequestTextEditorCodeExecutionCreateResultBlock = { + readonly "is_file_update": boolean + readonly "type": "text_editor_code_execution_create_result" } -export const UserLocation = Schema.Struct({ - "city": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), Schema.Null]).annotate({ - "title": "City", - "description": "The city of the user." - }) +export const RequestTextEditorCodeExecutionCreateResultBlock = Schema.Struct({ + "is_file_update": Schema.Boolean.annotate({ "title": "Is File Update" }), + "type": Schema.Literal("text_editor_code_execution_create_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestTextEditorCodeExecutionCreateResultBlock" }) +export type RequestTextEditorCodeExecutionStrReplaceResultBlock = { + readonly "lines"?: ReadonlyArray | null + readonly "new_lines"?: number | null + readonly "new_start"?: number | null + readonly "old_lines"?: number | null + readonly "old_start"?: number | null + readonly "type": "text_editor_code_execution_str_replace_result" +} +export const RequestTextEditorCodeExecutionStrReplaceResultBlock = Schema.Struct({ + "lines": Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Lines" })), + "new_lines": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "New Lines" }) ), - "country": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMinLength(2)).check(Schema.isMaxLength(2)), Schema.Null]).annotate({ - "title": "Country", - "description": "The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user." - }) + "new_start": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "New Start" }) ), - "region": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), Schema.Null]).annotate({ - "title": "Region", - "description": "The region of the user." - }) + "old_lines": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Old Lines" }) ), - "timezone": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), Schema.Null]).annotate({ - "title": "Timezone", - "description": "The [IANA timezone](https://nodatime.org/TimeZones) of the user." - }) + "old_start": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Old Start" }) ), - "type": Schema.Literal("approximate").annotate({ "title": "Type" }) -}).annotate({ "title": "UserLocation" }) -export type WebFetchToolResultErrorCode = - | "invalid_tool_input" - | "url_too_long" - | "url_not_allowed" - | "url_not_accessible" - | "unsupported_content_type" - | "too_many_requests" - | "max_uses_exceeded" - | "unavailable" -export const WebFetchToolResultErrorCode = Schema.Literals([ - "invalid_tool_input", - "url_too_long", - "url_not_allowed", - "url_not_accessible", - "unsupported_content_type", - "too_many_requests", - "max_uses_exceeded", - "unavailable" -]).annotate({ "title": "WebFetchToolResultErrorCode" }) -export type WebSearchToolResultErrorCode = - | "invalid_tool_input" - | "unavailable" - | "max_uses_exceeded" - | "too_many_requests" - | "query_too_long" - | "request_too_large" -export const WebSearchToolResultErrorCode = Schema.Literals([ - "invalid_tool_input", - "unavailable", - "max_uses_exceeded", - "too_many_requests", - "query_too_long", - "request_too_large" -]).annotate({ "title": "WebSearchToolResultErrorCode" }) -export type StopReason = "end_turn" | "max_tokens" | "stop_sequence" | "tool_use" | "pause_turn" | "refusal" -export const StopReason = Schema.Literals([ - "end_turn", - "max_tokens", - "stop_sequence", - "tool_use", - "pause_turn", - "refusal" -]) -export type BetaStopReason = - | "end_turn" - | "max_tokens" - | "stop_sequence" - | "tool_use" - | "pause_turn" - | "compaction" - | "refusal" - | "model_context_window_exceeded" -export const BetaStopReason = Schema.Literals([ - "end_turn", - "max_tokens", - "stop_sequence", - "tool_use", - "pause_turn", - "compaction", - "refusal", - "model_context_window_exceeded" -]) -export type Model = - | "claude-opus-4-6" - | "claude-sonnet-4-6" - | "claude-opus-4-5-20251101" - | "claude-opus-4-5" - | "claude-3-7-sonnet-latest" - | "claude-3-7-sonnet-20250219" - | "claude-3-5-haiku-latest" - | "claude-3-5-haiku-20241022" - | "claude-haiku-4-5" - | "claude-haiku-4-5-20251001" - | "claude-sonnet-4-20250514" - | "claude-sonnet-4-0" - | "claude-4-sonnet-20250514" - | "claude-sonnet-4-5" - | "claude-sonnet-4-5-20250929" - | "claude-opus-4-0" - | "claude-opus-4-20250514" - | "claude-4-opus-20250514" - | "claude-opus-4-1-20250805" - | "claude-3-opus-latest" - | "claude-3-opus-20240229" - | "claude-3-haiku-20240307" -export const Model = Schema.Literals([ - "claude-opus-4-6", - "claude-sonnet-4-6", - "claude-opus-4-5-20251101", - "claude-opus-4-5", - "claude-3-7-sonnet-latest", - "claude-3-7-sonnet-20250219", - "claude-3-5-haiku-latest", - "claude-3-5-haiku-20241022", - "claude-haiku-4-5", - "claude-haiku-4-5-20251001", - "claude-sonnet-4-20250514", - "claude-sonnet-4-0", - "claude-4-sonnet-20250514", - "claude-sonnet-4-5", - "claude-sonnet-4-5-20250929", - "claude-opus-4-0", - "claude-opus-4-20250514", - "claude-4-opus-20250514", - "claude-opus-4-1-20250805", - "claude-3-opus-latest", - "claude-3-opus-20240229", - "claude-3-haiku-20240307" -]).annotate({ - "title": "Model", - "description": - "The model that will complete your prompt.\\n\\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options." -}) -export type BetaMemoryTool_20250818_ViewCommand = { - readonly "command": "view" - readonly "path": string - readonly "view_range"?: ReadonlyArray -} -export const BetaMemoryTool_20250818_ViewCommand = Schema.Struct({ - "command": Schema.Literal("view").annotate({ "description": "Command type identifier", "default": "view" }), - "path": Schema.String.annotate({ "description": "Path to directory or file to view" }), - "view_range": Schema.optionalKey( - Schema.Array(Schema.Number.check(Schema.isInt())).annotate({ - "description": "Optional line range for viewing specific lines" - }).check(Schema.isMinLength(2)).check(Schema.isMaxLength(2)) - ) -}) -export type BetaMemoryTool_20250818_CreateCommand = { - readonly "command": "create" - readonly "path": string - readonly "file_text": string -} -export const BetaMemoryTool_20250818_CreateCommand = Schema.Struct({ - "command": Schema.Literal("create").annotate({ "description": "Command type identifier", "default": "create" }), - "path": Schema.String.annotate({ "description": "Path where the file should be created" }), - "file_text": Schema.String.annotate({ "description": "Content to write to the file" }) -}) -export type BetaMemoryTool_20250818_StrReplaceCommand = { - readonly "command": "str_replace" - readonly "path": string - readonly "old_str": string - readonly "new_str": string -} -export const BetaMemoryTool_20250818_StrReplaceCommand = Schema.Struct({ - "command": Schema.Literal("str_replace").annotate({ - "description": "Command type identifier", - "default": "str_replace" - }), - "path": Schema.String.annotate({ "description": "Path to the file where text should be replaced" }), - "old_str": Schema.String.annotate({ "description": "Text to search for and replace" }), - "new_str": Schema.String.annotate({ "description": "Text to replace with" }) -}) -export type BetaMemoryTool_20250818_InsertCommand = { - readonly "command": "insert" - readonly "path": string - readonly "insert_line": number - readonly "insert_text": string + "type": Schema.Literal("text_editor_code_execution_str_replace_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestTextEditorCodeExecutionStrReplaceResultBlock" }) +export type RequestTextEditorCodeExecutionViewResultBlock = { + readonly "content": string + readonly "file_type": "text" | "image" | "pdf" + readonly "num_lines"?: number | null + readonly "start_line"?: number | null + readonly "total_lines"?: number | null + readonly "type": "text_editor_code_execution_view_result" } -export const BetaMemoryTool_20250818_InsertCommand = Schema.Struct({ - "command": Schema.Literal("insert").annotate({ "description": "Command type identifier", "default": "insert" }), - "path": Schema.String.annotate({ "description": "Path to the file where text should be inserted" }), - "insert_line": Schema.Number.annotate({ "description": "Line number where text should be inserted" }).check( - Schema.isInt() - ).check(Schema.isGreaterThanOrEqualTo(1)), - "insert_text": Schema.String.annotate({ "description": "Text to insert at the specified line" }) -}) -export type BetaMemoryTool_20250818_DeleteCommand = { readonly "command": "delete"; readonly "path": string } -export const BetaMemoryTool_20250818_DeleteCommand = Schema.Struct({ - "command": Schema.Literal("delete").annotate({ "description": "Command type identifier", "default": "delete" }), - "path": Schema.String.annotate({ "description": "Path to the file or directory to delete" }) -}) -export type BetaMemoryTool_20250818_RenameCommand = { - readonly "command": "rename" - readonly "old_path": string - readonly "new_path": string +export const RequestTextEditorCodeExecutionViewResultBlock = Schema.Struct({ + "content": Schema.String.annotate({ "title": "Content" }), + "file_type": Schema.Literals(["text", "image", "pdf"]).annotate({ "title": "File Type" }), + "num_lines": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Num Lines" }) + ), + "start_line": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Start Line" }) + ), + "total_lines": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ "title": "Total Lines" }) + ), + "type": Schema.Literal("text_editor_code_execution_view_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestTextEditorCodeExecutionViewResultBlock" }) +export type RequestWebSearchResultBlock = { + readonly "encrypted_content": string + readonly "page_age"?: string | null + readonly "title": string + readonly "type": "web_search_result" + readonly "url": string } -export const BetaMemoryTool_20250818_RenameCommand = Schema.Struct({ - "command": Schema.Literal("rename").annotate({ "description": "Command type identifier", "default": "rename" }), - "old_path": Schema.String.annotate({ "description": "Current path of the file or directory" }), - "new_path": Schema.String.annotate({ "description": "New path for the file or directory" }) -}) -export type RequestBashCodeExecutionToolResultError = { - readonly "error_code": BashCodeExecutionToolResultErrorCode - readonly "type": "bash_code_execution_tool_result_error" +export const RequestWebSearchResultBlock = Schema.Struct({ + "encrypted_content": Schema.String.annotate({ "title": "Encrypted Content" }), + "page_age": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Page Age" })), + "title": Schema.String.annotate({ "title": "Title" }), + "type": Schema.Literal("web_search_result").annotate({ "title": "Type" }), + "url": Schema.String.annotate({ "title": "Url" }) +}).annotate({ "title": "RequestWebSearchResultBlock" }) +export type RequestWebSearchResultLocationCitation = { + readonly "cited_text": string + readonly "encrypted_index": string + readonly "title": string | null + readonly "type": "web_search_result_location" + readonly "url": string } -export const RequestBashCodeExecutionToolResultError = Schema.Struct({ - "error_code": BashCodeExecutionToolResultErrorCode, - "type": Schema.Literal("bash_code_execution_tool_result_error").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestBashCodeExecutionToolResultError" }) -export type ResponseBashCodeExecutionToolResultError = { - readonly "error_code": BashCodeExecutionToolResultErrorCode - readonly "type": "bash_code_execution_tool_result_error" +export const RequestWebSearchResultLocationCitation = Schema.Struct({ + "cited_text": Schema.String.annotate({ "title": "Cited Text" }), + "encrypted_index": Schema.String.annotate({ "title": "Encrypted Index" }), + "title": Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(512)), Schema.Null]) + .annotate({ "title": "Title" }), + "type": Schema.Literal("web_search_result_location").annotate({ "title": "Type" }), + "url": Schema.String.annotate({ "title": "Url" }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(2048)) +}).annotate({ "title": "RequestWebSearchResultLocationCitation" }) +export type ResponseBashCodeExecutionOutputBlock = { + readonly "file_id": string + readonly "type": "bash_code_execution_output" } -export const ResponseBashCodeExecutionToolResultError = Schema.Struct({ - "error_code": BashCodeExecutionToolResultErrorCode, - "type": Schema.Literal("bash_code_execution_tool_result_error").annotate({ +export const ResponseBashCodeExecutionOutputBlock = Schema.Struct({ + "file_id": Schema.String.annotate({ "title": "File Id" }), + "type": Schema.Literal("bash_code_execution_output").annotate({ "title": "Type", - "default": "bash_code_execution_tool_result_error" + "default": "bash_code_execution_output" }) -}).annotate({ "title": "ResponseBashCodeExecutionToolResultError" }) -export type BetaRequestBashCodeExecutionToolResultError = { - readonly "error_code": BetaBashCodeExecutionToolResultErrorCode - readonly "type": "bash_code_execution_tool_result_error" +}).annotate({ "title": "ResponseBashCodeExecutionOutputBlock" }) +export type ResponseCharLocationCitation = { + readonly "cited_text": string + readonly "document_index": number + readonly "document_title": string | null + readonly "end_char_index": number + readonly "file_id": string | null + readonly "start_char_index": number + readonly "type": "char_location" } -export const BetaRequestBashCodeExecutionToolResultError = Schema.Struct({ - "error_code": BetaBashCodeExecutionToolResultErrorCode, - "type": Schema.Literal("bash_code_execution_tool_result_error").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestBashCodeExecutionToolResultError" }) -export type BetaResponseBashCodeExecutionToolResultError = { - readonly "error_code": BetaBashCodeExecutionToolResultErrorCode - readonly "type": "bash_code_execution_tool_result_error" -} -export const BetaResponseBashCodeExecutionToolResultError = Schema.Struct({ - "error_code": BetaBashCodeExecutionToolResultErrorCode, - "type": Schema.Literal("bash_code_execution_tool_result_error").annotate({ - "title": "Type", - "default": "bash_code_execution_tool_result_error" - }) -}).annotate({ "title": "ResponseBashCodeExecutionToolResultError" }) -export type BetaCodeExecutionTool_20250522 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "defer_loading"?: boolean - readonly "name": "code_execution" - readonly "strict"?: boolean - readonly "type": "code_execution_20250522" -} -export const BetaCodeExecutionTool_20250522 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "defer_loading": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Defer Loading", - "description": - "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." - }) +export const ResponseCharLocationCitation = Schema.Struct({ + "cited_text": Schema.String.annotate({ "title": "Cited Text" }), + "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) ), - "name": Schema.Literal("code_execution").annotate({ - "title": "Name", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." - }), - "strict": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Strict", - "description": "When true, guarantees schema validation on tool names and inputs" - }) + "document_title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Document Title" }), + "end_char_index": Schema.Number.annotate({ "title": "End Char Index" }).check(Schema.isInt()), + "file_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "File Id", "default": null }), + "start_char_index": Schema.Number.annotate({ "title": "Start Char Index" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) ), - "type": Schema.Literal("code_execution_20250522").annotate({ "title": "Type" }) -}).annotate({ "title": "CodeExecutionTool_20250522" }) -export type BetaCodeExecutionTool_20250825 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "defer_loading"?: boolean - readonly "name": "code_execution" - readonly "strict"?: boolean - readonly "type": "code_execution_20250825" + "type": Schema.Literal("char_location").annotate({ "title": "Type", "default": "char_location" }) +}).annotate({ "title": "ResponseCharLocationCitation" }) +export type ResponseCitationsConfig = { readonly "enabled": boolean } +export const ResponseCitationsConfig = Schema.Struct({ + "enabled": Schema.Boolean.annotate({ "title": "Enabled", "default": false }) +}).annotate({ "title": "ResponseCitationsConfig" }) +export type ResponseCodeExecutionOutputBlock = { readonly "file_id": string; readonly "type": "code_execution_output" } +export const ResponseCodeExecutionOutputBlock = Schema.Struct({ + "file_id": Schema.String.annotate({ "title": "File Id" }), + "type": Schema.Literal("code_execution_output").annotate({ "title": "Type", "default": "code_execution_output" }) +}).annotate({ "title": "ResponseCodeExecutionOutputBlock" }) +export type ResponseContainerUploadBlock = { readonly "file_id": string; readonly "type": "container_upload" } +export const ResponseContainerUploadBlock = Schema.Struct({ + "file_id": Schema.String.annotate({ "title": "File Id" }), + "type": Schema.Literal("container_upload").annotate({ "title": "Type", "default": "container_upload" }) +}).annotate({ + "title": "ResponseContainerUploadBlock", + "description": "Response model for a file uploaded to the container." +}) +export type ResponseContentBlockLocationCitation = { + readonly "cited_text": string + readonly "document_index": number + readonly "document_title": string | null + readonly "end_block_index": number + readonly "file_id": string | null + readonly "start_block_index": number + readonly "type": "content_block_location" } -export const BetaCodeExecutionTool_20250825 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "defer_loading": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Defer Loading", - "description": - "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." - }) - ), - "name": Schema.Literal("code_execution").annotate({ - "title": "Name", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." +export const ResponseContentBlockLocationCitation = Schema.Struct({ + "cited_text": Schema.String.annotate({ + "title": "Cited Text", + "description": + "The full text of the cited block range, concatenated.\n\nAlways equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns." }), - "strict": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Strict", - "description": "When true, guarantees schema validation on tool names and inputs" - }) + "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) ), - "type": Schema.Literal("code_execution_20250825").annotate({ "title": "Type" }) -}).annotate({ "title": "CodeExecutionTool_20250825" }) -export type BetaCodeExecutionTool_20260120 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "defer_loading"?: boolean - readonly "name": "code_execution" - readonly "strict"?: boolean - readonly "type": "code_execution_20260120" + "document_title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Document Title" }), + "end_block_index": Schema.Number.annotate({ + "title": "End Block Index", + "description": + "Exclusive 0-based end index of the cited block range in the source's `content` array.\n\nAlways greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`." + }).check(Schema.isInt()), + "file_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "File Id", "default": null }), + "start_block_index": Schema.Number.annotate({ + "title": "Start Block Index", + "description": "0-based index of the first cited block in the source's `content` array." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "type": Schema.Literal("content_block_location").annotate({ "title": "Type", "default": "content_block_location" }) +}).annotate({ "title": "ResponseContentBlockLocationCitation" }) +export type ResponsePageLocationCitation = { + readonly "cited_text": string + readonly "document_index": number + readonly "document_title": string | null + readonly "end_page_number": number + readonly "file_id": string | null + readonly "start_page_number": number + readonly "type": "page_location" } -export const BetaCodeExecutionTool_20260120 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "defer_loading": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Defer Loading", - "description": - "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." - }) +export const ResponsePageLocationCitation = Schema.Struct({ + "cited_text": Schema.String.annotate({ "title": "Cited Text" }), + "document_index": Schema.Number.annotate({ "title": "Document Index" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) ), - "name": Schema.Literal("code_execution").annotate({ - "title": "Name", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." - }), - "strict": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Strict", - "description": "When true, guarantees schema validation on tool names and inputs" - }) + "document_title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Document Title" }), + "end_page_number": Schema.Number.annotate({ "title": "End Page Number" }).check(Schema.isInt()), + "file_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "File Id", "default": null }), + "start_page_number": Schema.Number.annotate({ "title": "Start Page Number" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(1) ), - "type": Schema.Literal("code_execution_20260120").annotate({ "title": "Type" }) -}).annotate({ - "title": "CodeExecutionTool_20260120", - "description": "Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint)." -}) -export type BetaRequestCompactionBlock = { - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "content": string | null - readonly "type": "compaction" + "type": Schema.Literal("page_location").annotate({ "title": "Type", "default": "page_location" }) +}).annotate({ "title": "ResponsePageLocationCitation" }) +export type ResponseRedactedThinkingBlock = { readonly "data": string; readonly "type": "redacted_thinking" } +export const ResponseRedactedThinkingBlock = Schema.Struct({ + "data": Schema.String.annotate({ "title": "Data" }), + "type": Schema.Literal("redacted_thinking").annotate({ "title": "Type", "default": "redacted_thinking" }) +}).annotate({ "title": "ResponseRedactedThinkingBlock" }) +export type ResponseSearchResultLocationCitation = { + readonly "cited_text": string + readonly "end_block_index": number + readonly "search_result_index": number + readonly "source": string + readonly "start_block_index": number + readonly "title": string | null + readonly "type": "search_result_location" } -export const BetaRequestCompactionBlock = Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "content": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Content", - "description": "Summary of previously compacted content, or null if compaction failed" +export const ResponseSearchResultLocationCitation = Schema.Struct({ + "cited_text": Schema.String.annotate({ + "title": "Cited Text", + "description": + "The full text of the cited block range, concatenated.\n\nAlways equals the contents of `content[start_block_index:end_block_index]` joined together. The text block is the minimal citable unit; this field is never a substring of a single block. Not counted toward output tokens, and not counted toward input tokens when sent back in subsequent turns." }), - "type": Schema.Literal("compaction").annotate({ "title": "Type" }) -}).annotate({ - "title": "RequestCompactionBlock", - "description": - "A compaction block containing summary of previous context.\n\nUsers should round-trip these blocks from responses to subsequent requests\nto maintain context across compaction boundaries.\n\nWhen content is None, the block represents a failed compaction. The server\ntreats these as no-ops. Empty string content is not allowed." -}) -export type BetaRequestContainerUploadBlock = { - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "file_id": string - readonly "type": "container_upload" + "end_block_index": Schema.Number.annotate({ + "title": "End Block Index", + "description": + "Exclusive 0-based end index of the cited block range in the source's `content` array.\n\nAlways greater than `start_block_index`; a single-block citation has `end_block_index = start_block_index + 1`." + }).check(Schema.isInt()), + "search_result_index": Schema.Number.annotate({ + "title": "Search Result Index", + "description": + "0-based index of the cited search result among all `search_result` content blocks in the request, in the order they appear across messages and tool results.\n\nCounted separately from `document_index`; server-side web search results are not included in this count." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "source": Schema.String.annotate({ "title": "Source" }), + "start_block_index": Schema.Number.annotate({ + "title": "Start Block Index", + "description": "0-based index of the first cited block in the source's `content` array." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "title": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Title" }), + "type": Schema.Literal("search_result_location").annotate({ "title": "Type", "default": "search_result_location" }) +}).annotate({ "title": "ResponseSearchResultLocationCitation" }) +export type ResponseTextEditorCodeExecutionCreateResultBlock = { + readonly "is_file_update": boolean + readonly "type": "text_editor_code_execution_create_result" } -export const BetaRequestContainerUploadBlock = Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "file_id": Schema.String.annotate({ "title": "File Id" }), - "type": Schema.Literal("container_upload").annotate({ "title": "Type" }) -}).annotate({ - "title": "RequestContainerUploadBlock", - "description": - "A content block that represents a file to be uploaded to the container\nFiles uploaded via this block will be available in the container's input directory." -}) -export type BetaRequestMCPToolUseBlock = { - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "id": string - readonly "input": { readonly [x: string]: Schema.Json } - readonly "name": string - readonly "server_name": string - readonly "type": "mcp_tool_use" +export const ResponseTextEditorCodeExecutionCreateResultBlock = Schema.Struct({ + "is_file_update": Schema.Boolean.annotate({ "title": "Is File Update" }), + "type": Schema.Literal("text_editor_code_execution_create_result").annotate({ + "title": "Type", + "default": "text_editor_code_execution_create_result" + }) +}).annotate({ "title": "ResponseTextEditorCodeExecutionCreateResultBlock" }) +export type ResponseTextEditorCodeExecutionStrReplaceResultBlock = { + readonly "lines": ReadonlyArray | null + readonly "new_lines": number | null + readonly "new_start": number | null + readonly "old_lines": number | null + readonly "old_start": number | null + readonly "type": "text_editor_code_execution_str_replace_result" } -export const BetaRequestMCPToolUseBlock = Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$"))), - "input": Schema.Record(Schema.String, Schema.Json).annotate({ "title": "Input" }), - "name": Schema.String.annotate({ "title": "Name" }), - "server_name": Schema.String.annotate({ "title": "Server Name", "description": "The name of the MCP server" }), - "type": Schema.Literal("mcp_tool_use").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestMCPToolUseBlock" }) -export type BetaRequestToolReferenceBlock = { - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "tool_name": string - readonly "type": "tool_reference" +export const ResponseTextEditorCodeExecutionStrReplaceResultBlock = Schema.Struct({ + "lines": Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Lines", "default": null }), + "new_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "New Lines", + "default": null + }), + "new_start": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "New Start", + "default": null + }), + "old_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "Old Lines", + "default": null + }), + "old_start": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "Old Start", + "default": null + }), + "type": Schema.Literal("text_editor_code_execution_str_replace_result").annotate({ + "title": "Type", + "default": "text_editor_code_execution_str_replace_result" + }) +}).annotate({ "title": "ResponseTextEditorCodeExecutionStrReplaceResultBlock" }) +export type ResponseTextEditorCodeExecutionViewResultBlock = { + readonly "content": string + readonly "file_type": "text" | "image" | "pdf" + readonly "num_lines": number | null + readonly "start_line": number | null + readonly "total_lines": number | null + readonly "type": "text_editor_code_execution_view_result" } -export const BetaRequestToolReferenceBlock = Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), +export const ResponseTextEditorCodeExecutionViewResultBlock = Schema.Struct({ + "content": Schema.String.annotate({ "title": "Content" }), + "file_type": Schema.Literals(["text", "image", "pdf"]).annotate({ "title": "File Type" }), + "num_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "Num Lines", + "default": null + }), + "start_line": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "Start Line", + "default": null + }), + "total_lines": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "Total Lines", + "default": null + }), + "type": Schema.Literal("text_editor_code_execution_view_result").annotate({ + "title": "Type", + "default": "text_editor_code_execution_view_result" + }) +}).annotate({ "title": "ResponseTextEditorCodeExecutionViewResultBlock" }) +export type ResponseThinkingBlock = { + readonly "signature": string + readonly "thinking": string + readonly "type": "thinking" +} +export const ResponseThinkingBlock = Schema.Struct({ + "signature": Schema.String.annotate({ "title": "Signature" }), + "thinking": Schema.String.annotate({ "title": "Thinking" }), + "type": Schema.Literal("thinking").annotate({ "title": "Type", "default": "thinking" }) +}).annotate({ "title": "ResponseThinkingBlock" }) +export type ResponseToolReferenceBlock = { readonly "tool_name": string; readonly "type": "tool_reference" } +export const ResponseToolReferenceBlock = Schema.Struct({ "tool_name": Schema.String.annotate({ "title": "Tool Name" }).check(Schema.isMinLength(1)).check( Schema.isMaxLength(256) ).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]{1,256}$"))), - "type": Schema.Literal("tool_reference").annotate({ "title": "Type" }) -}).annotate({ - "title": "RequestToolReferenceBlock", - "description": "Tool reference block that can be included in tool_result content." + "type": Schema.Literal("tool_reference").annotate({ "title": "Type", "default": "tool_reference" }) +}).annotate({ "title": "ResponseToolReferenceBlock" }) +export type ResponseWebSearchResultBlock = { + readonly "encrypted_content": string + readonly "page_age": string | null + readonly "title": string + readonly "type": "web_search_result" + readonly "url": string +} +export const ResponseWebSearchResultBlock = Schema.Struct({ + "encrypted_content": Schema.String.annotate({ "title": "Encrypted Content" }), + "page_age": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Page Age", "default": null }), + "title": Schema.String.annotate({ "title": "Title" }), + "type": Schema.Literal("web_search_result").annotate({ "title": "Type", "default": "web_search_result" }), + "url": Schema.String.annotate({ "title": "Url" }) +}).annotate({ "title": "ResponseWebSearchResultBlock" }) +export type ResponseWebSearchResultLocationCitation = { + readonly "cited_text": string + readonly "encrypted_index": string + readonly "title": string | null + readonly "type": "web_search_result_location" + readonly "url": string +} +export const ResponseWebSearchResultLocationCitation = Schema.Struct({ + "cited_text": Schema.String.annotate({ "title": "Cited Text" }), + "encrypted_index": Schema.String.annotate({ "title": "Encrypted Index" }), + "title": Schema.Union([Schema.String.check(Schema.isMaxLength(512)), Schema.Null]).annotate({ "title": "Title" }), + "type": Schema.Literal("web_search_result_location").annotate({ + "title": "Type", + "default": "web_search_result_location" + }), + "url": Schema.String.annotate({ "title": "Url" }) +}).annotate({ "title": "ResponseWebSearchResultLocationCitation" }) +export type ServerToolCaller = { readonly "tool_id": string; readonly "type": "code_execution_20250825" } +export const ServerToolCaller = Schema.Struct({ + "tool_id": Schema.String.annotate({ "title": "Tool Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + ), + "type": Schema.Literal("code_execution_20250825").annotate({ "title": "Type" }) +}).annotate({ "title": "ServerToolCaller", "description": "Tool invocation generated by a server-side tool." }) +export type ServerToolCaller_20260120 = { readonly "tool_id": string; readonly "type": "code_execution_20260120" } +export const ServerToolCaller_20260120 = Schema.Struct({ + "tool_id": Schema.String.annotate({ "title": "Tool Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + ), + "type": Schema.Literal("code_execution_20260120").annotate({ "title": "Type" }) +}).annotate({ "title": "ServerToolCaller_20260120" }) +export type ServerToolUsage = { readonly "web_fetch_requests": number; readonly "web_search_requests": number } +export const ServerToolUsage = Schema.Struct({ + "web_fetch_requests": Schema.Number.annotate({ + "title": "Web Fetch Requests", + "description": "The number of web fetch tool requests.", + "default": 0 + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "web_search_requests": Schema.Number.annotate({ + "title": "Web Search Requests", + "description": "The number of web search tool requests.", + "default": 0 + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)) +}).annotate({ "title": "ServerToolUsage" }) +export type SignatureContentBlockDelta = { readonly "signature": string; readonly "type": "signature_delta" } +export const SignatureContentBlockDelta = Schema.Struct({ + "signature": Schema.String.annotate({ "title": "Signature" }), + "type": Schema.Literal("signature_delta").annotate({ "title": "Type", "default": "signature_delta" }) +}).annotate({ "title": "SignatureContentBlockDelta" }) +export type TextContentBlockDelta = { readonly "text": string; readonly "type": "text_delta" } +export const TextContentBlockDelta = Schema.Struct({ + "text": Schema.String.annotate({ "title": "Text" }), + "type": Schema.Literal("text_delta").annotate({ "title": "Type", "default": "text_delta" }) +}).annotate({ "title": "TextContentBlockDelta" }) +export type TextEditorCodeExecutionToolResultErrorCode = + | "invalid_tool_input" + | "unavailable" + | "too_many_requests" + | "execution_time_exceeded" + | "file_not_found" +export const TextEditorCodeExecutionToolResultErrorCode = Schema.Literals([ + "invalid_tool_input", + "unavailable", + "too_many_requests", + "execution_time_exceeded", + "file_not_found" +]).annotate({ "title": "TextEditorCodeExecutionToolResultErrorCode" }) +export type ThinkingConfigDisabled = { readonly "type": "disabled" } +export const ThinkingConfigDisabled = Schema.Struct({ + "type": Schema.Literal("disabled").annotate({ "title": "Type" }) +}).annotate({ "title": "ThinkingConfigDisabled" }) +export type ThinkingContentBlockDelta = { readonly "thinking": string; readonly "type": "thinking_delta" } +export const ThinkingContentBlockDelta = Schema.Struct({ + "thinking": Schema.String.annotate({ "title": "Thinking" }), + "type": Schema.Literal("thinking_delta").annotate({ "title": "Type", "default": "thinking_delta" }) +}).annotate({ "title": "ThinkingContentBlockDelta" }) +export type ThinkingDisplayMode = "summarized" | "omitted" +export const ThinkingDisplayMode = Schema.Literals(["summarized", "omitted"]).annotate({ + "title": "ThinkingDisplayMode" }) -export type BetaToolSearchToolBM25_20251119 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "defer_loading"?: boolean - readonly "name": "tool_search_tool_bm25" - readonly "strict"?: boolean - readonly "type": "tool_search_tool_bm25_20251119" | "tool_search_tool_bm25" +export type ThinkingTypes = { + readonly "adaptive": { readonly "supported": boolean } + readonly "enabled": { readonly "supported": boolean } } -export const BetaToolSearchToolBM25_20251119 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" +export const ThinkingTypes = Schema.Struct({ + "adaptive": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." }) - ), - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." + }).annotate({ + "title": "CapabilitySupport", + "description": "Whether the model supports thinking with type 'adaptive' (auto)." + }), + "enabled": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." }) - ), - "defer_loading": Schema.optionalKey( + }).annotate({ + "title": "CapabilitySupport", + "description": "Whether the model supports thinking with type 'enabled'." + }) +}).annotate({ "title": "ThinkingTypes", "description": "Supported thinking type configurations." }) +export type ToolChoiceAny = { readonly "disable_parallel_tool_use"?: boolean; readonly "type": "any" } +export const ToolChoiceAny = Schema.Struct({ + "disable_parallel_tool_use": Schema.optionalKey( Schema.Boolean.annotate({ - "title": "Defer Loading", + "title": "Disable Parallel Tool Use", "description": - "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output exactly one tool use." }) ), - "name": Schema.Literal("tool_search_tool_bm25").annotate({ - "title": "Name", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." - }), - "strict": Schema.optionalKey( + "type": Schema.Literal("any").annotate({ "title": "Type" }) +}).annotate({ "title": "ToolChoiceAny", "description": "The model will use any available tools." }) +export type ToolChoiceAuto = { readonly "disable_parallel_tool_use"?: boolean; readonly "type": "auto" } +export const ToolChoiceAuto = Schema.Struct({ + "disable_parallel_tool_use": Schema.optionalKey( Schema.Boolean.annotate({ - "title": "Strict", - "description": "When true, guarantees schema validation on tool names and inputs" + "title": "Disable Parallel Tool Use", + "description": + "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output at most one tool use." }) ), - "type": Schema.Literals(["tool_search_tool_bm25_20251119", "tool_search_tool_bm25"]).annotate({ "title": "Type" }) -}).annotate({ "title": "ToolSearchToolBM25_20251119" }) -export type BetaToolSearchToolRegex_20251119 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "defer_loading"?: boolean - readonly "name": "tool_search_tool_regex" - readonly "strict"?: boolean - readonly "type": "tool_search_tool_regex_20251119" | "tool_search_tool_regex" + "type": Schema.Literal("auto").annotate({ "title": "Type" }) +}).annotate({ "title": "ToolChoiceAuto", "description": "The model will automatically decide whether to use tools." }) +export type ToolChoiceNone = { readonly "type": "none" } +export const ToolChoiceNone = Schema.Struct({ "type": Schema.Literal("none").annotate({ "title": "Type" }) }).annotate({ + "title": "ToolChoiceNone", + "description": "The model will not be allowed to use tools." +}) +export type ToolChoiceTool = { + readonly "disable_parallel_tool_use"?: boolean + readonly "name": string + readonly "type": "tool" } -export const BetaToolSearchToolRegex_20251119 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "defer_loading": Schema.optionalKey( +export const ToolChoiceTool = Schema.Struct({ + "disable_parallel_tool_use": Schema.optionalKey( Schema.Boolean.annotate({ - "title": "Defer Loading", + "title": "Disable Parallel Tool Use", "description": - "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + "Whether to disable parallel tool use.\n\nDefaults to `false`. If set to `true`, the model will output exactly one tool use." }) ), - "name": Schema.Literal("tool_search_tool_regex").annotate({ - "title": "Name", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." - }), - "strict": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Strict", - "description": "When true, guarantees schema validation on tool names and inputs" - }) - ), - "type": Schema.Literals(["tool_search_tool_regex_20251119", "tool_search_tool_regex"]).annotate({ "title": "Type" }) -}).annotate({ "title": "ToolSearchToolRegex_20251119" }) -export type BetaCompactionIterationUsage = { - readonly "cache_creation": BetaCacheCreation | null - readonly "cache_creation_input_tokens": number - readonly "cache_read_input_tokens": number - readonly "input_tokens": number - readonly "output_tokens": number - readonly "type": "compaction" -} -export const BetaCompactionIterationUsage = Schema.Struct({ - "cache_creation": Schema.Union([BetaCacheCreation, Schema.Null]).annotate({ - "description": "Breakdown of cached tokens by TTL", - "default": null - }), - "cache_creation_input_tokens": Schema.Number.annotate({ - "title": "Cache Creation Input Tokens", - "description": "The number of input tokens used to create the cache entry.", - "default": 0 - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - "cache_read_input_tokens": Schema.Number.annotate({ - "title": "Cache Read Input Tokens", - "description": "The number of input tokens read from the cache.", - "default": 0 - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - "input_tokens": Schema.Number.annotate({ - "title": "Input Tokens", - "description": "The number of input tokens which were used." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - "output_tokens": Schema.Number.annotate({ - "title": "Output Tokens", - "description": "The number of output tokens which were used." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - "type": Schema.Literal("compaction").annotate({ - "title": "Type", - "description": "Usage for a compaction iteration", - "default": "compaction" - }) -}).annotate({ "title": "CompactionIterationUsage", "description": "Token usage for a compaction iteration." }) -export type BetaMessageIterationUsage = { - readonly "cache_creation": BetaCacheCreation | null - readonly "cache_creation_input_tokens": number - readonly "cache_read_input_tokens": number - readonly "input_tokens": number - readonly "output_tokens": number - readonly "type": "message" -} -export const BetaMessageIterationUsage = Schema.Struct({ - "cache_creation": Schema.Union([BetaCacheCreation, Schema.Null]).annotate({ - "description": "Breakdown of cached tokens by TTL", - "default": null - }), - "cache_creation_input_tokens": Schema.Number.annotate({ - "title": "Cache Creation Input Tokens", - "description": "The number of input tokens used to create the cache entry.", - "default": 0 - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - "cache_read_input_tokens": Schema.Number.annotate({ - "title": "Cache Read Input Tokens", - "description": "The number of input tokens read from the cache.", - "default": 0 - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - "input_tokens": Schema.Number.annotate({ - "title": "Input Tokens", - "description": "The number of input tokens which were used." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - "output_tokens": Schema.Number.annotate({ - "title": "Output Tokens", - "description": "The number of output tokens which were used." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - "type": Schema.Literal("message").annotate({ - "title": "Type", - "description": "Usage for a sampling iteration", - "default": "message" - }) -}).annotate({ "title": "MessageIterationUsage", "description": "Token usage for a sampling iteration." }) -export type BetaRequestCodeExecutionToolResultError = { - readonly "error_code": BetaCodeExecutionToolResultErrorCode - readonly "type": "code_execution_tool_result_error" -} -export const BetaRequestCodeExecutionToolResultError = Schema.Struct({ - "error_code": BetaCodeExecutionToolResultErrorCode, - "type": Schema.Literal("code_execution_tool_result_error").annotate({ "title": "Type" }) -}).annotate({ "title": "Error" }) -export type BetaResponseCodeExecutionToolResultError = { - readonly "error_code": BetaCodeExecutionToolResultErrorCode - readonly "type": "code_execution_tool_result_error" -} -export const BetaResponseCodeExecutionToolResultError = Schema.Struct({ - "error_code": BetaCodeExecutionToolResultErrorCode, - "type": Schema.Literal("code_execution_tool_result_error").annotate({ - "title": "Type", - "default": "code_execution_tool_result_error" - }) -}).annotate({ "title": "ResponseCodeExecutionToolResultError" }) -export type BetaCountMessageTokensResponse = { - readonly "context_management": BetaContextManagementResponse | null - readonly "input_tokens": number -} -export const BetaCountMessageTokensResponse = Schema.Struct({ - "context_management": Schema.Union([BetaContextManagementResponse, Schema.Null]).annotate({ - "description": "Information about context management applied to the message." - }), - "input_tokens": Schema.Number.annotate({ - "title": "Input Tokens", - "description": "The total number of tokens across the provided list of messages, system prompt, and tools." - }).check(Schema.isInt()) -}).annotate({ "title": "CountMessageTokensResponse" }) -export type BetaFileListResponse = { - readonly "data": ReadonlyArray - readonly "first_id"?: string | null - readonly "has_more"?: boolean - readonly "last_id"?: string | null -} -export const BetaFileListResponse = Schema.Struct({ - "data": Schema.Array(BetaFileMetadataSchema).annotate({ - "title": "Data", - "description": "List of file metadata objects." - }), - "first_id": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "First Id", - "description": "ID of the first file in this page of results." - }) - ), - "has_more": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Has More", - "description": "Whether there are more results available.", - "default": false - }) - ), - "last_id": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Last Id", - "description": "ID of the last file in this page of results." - }) - ) -}).annotate({ "title": "FileListResponse" }) -export type BetaCompact20260112 = { - readonly "instructions"?: string | null - readonly "pause_after_compaction"?: boolean - readonly "trigger"?: BetaInputTokensTrigger | null - readonly "type": "compact_20260112" -} -export const BetaCompact20260112 = Schema.Struct({ - "instructions": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Instructions", - "description": "Additional instructions for summarization." - }) - ), - "pause_after_compaction": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Pause After Compaction", - "description": "Whether to pause after compaction and return the compaction block to the user." - }) - ), - "trigger": Schema.optionalKey( - Schema.Union([BetaInputTokensTrigger, Schema.Null]).annotate({ - "description": "When to trigger compaction. Defaults to 150000 input tokens." - }) - ), - "type": Schema.Literal("compact_20260112").annotate({ "title": "Type" }) + "name": Schema.String.annotate({ "title": "Name", "description": "The name of the tool to use." }), + "type": Schema.Literal("tool").annotate({ "title": "Type" }) }).annotate({ - "title": "Compact20260112", - "description": "Automatically compact older context when reaching the configured trigger threshold." + "title": "ToolChoiceTool", + "description": "The model will use the specified tool with `tool_choice.name`." }) -export type BetaBashTool_20241022 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "defer_loading"?: boolean - readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> - readonly "name": "bash" - readonly "strict"?: boolean - readonly "type": "bash_20241022" +export type ToolSearchToolResultErrorCode = + | "invalid_tool_input" + | "unavailable" + | "too_many_requests" + | "execution_time_exceeded" +export const ToolSearchToolResultErrorCode = Schema.Literals([ + "invalid_tool_input", + "unavailable", + "too_many_requests", + "execution_time_exceeded" +]).annotate({ "title": "ToolSearchToolResultErrorCode" }) +export type URLImageSource = { readonly "type": "url"; readonly "url": string } +export const URLImageSource = Schema.Struct({ + "type": Schema.Literal("url").annotate({ "title": "Type" }), + "url": Schema.String.annotate({ "title": "Url" }) +}).annotate({ "title": "URLImageSource" }) +export type URLPDFSource = { readonly "type": "url"; readonly "url": string } +export const URLPDFSource = Schema.Struct({ + "type": Schema.Literal("url").annotate({ "title": "Type" }), + "url": Schema.String.annotate({ "title": "Url" }) +}).annotate({ "title": "URLPDFSource" }) +export type UserLocation = { + readonly "city"?: string | null + readonly "country"?: string | null + readonly "region"?: string | null + readonly "timezone"?: string | null + readonly "type": "approximate" } -export const BetaBashTool_20241022 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" +export const UserLocation = Schema.Struct({ + "city": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), Schema.Null]).annotate({ + "title": "City", + "description": "The city of the user." }) ), - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." + "country": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMinLength(2)).check(Schema.isMaxLength(2)), Schema.Null]).annotate({ + "title": "Country", + "description": "The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user." }) ), - "defer_loading": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Defer Loading", - "description": - "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + "region": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), Schema.Null]).annotate({ + "title": "Region", + "description": "The region of the user." }) ), - "input_examples": Schema.optionalKey( - Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" }) - ), - "name": Schema.Literal("bash").annotate({ - "title": "Name", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." - }), - "strict": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Strict", - "description": "When true, guarantees schema validation on tool names and inputs" + "timezone": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), Schema.Null]).annotate({ + "title": "Timezone", + "description": "The [IANA timezone](https://nodatime.org/TimeZones) of the user." }) ), - "type": Schema.Literal("bash_20241022").annotate({ "title": "Type" }) -}).annotate({ "title": "BashTool_20241022" }) -export type BetaBashTool_20250124 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "cache_control"?: BetaCacheControlEphemeral | null + "type": Schema.Literal("approximate").annotate({ "title": "Type" }) +}).annotate({ "title": "UserLocation" }) +export type WebFetchToolResultErrorCode = + | "invalid_tool_input" + | "url_too_long" + | "url_not_allowed" + | "url_not_accessible" + | "unsupported_content_type" + | "too_many_requests" + | "max_uses_exceeded" + | "unavailable" +export const WebFetchToolResultErrorCode = Schema.Literals([ + "invalid_tool_input", + "url_too_long", + "url_not_allowed", + "url_not_accessible", + "unsupported_content_type", + "too_many_requests", + "max_uses_exceeded", + "unavailable" +]).annotate({ "title": "WebFetchToolResultErrorCode" }) +export type WebSearchToolResultErrorCode = + | "invalid_tool_input" + | "unavailable" + | "max_uses_exceeded" + | "too_many_requests" + | "query_too_long" + | "request_too_large" +export const WebSearchToolResultErrorCode = Schema.Literals([ + "invalid_tool_input", + "unavailable", + "max_uses_exceeded", + "too_many_requests", + "query_too_long", + "request_too_large" +]).annotate({ "title": "WebSearchToolResultErrorCode" }) +export type BetaManagedAgentsConflictError = { readonly "type": "conflict_error"; readonly "message"?: string } +export const BetaManagedAgentsConflictError = Schema.Struct({ + "type": Schema.Literal("conflict_error"), + "message": Schema.optionalKey(Schema.String) +}) +export type StopReason = "end_turn" | "max_tokens" | "stop_sequence" | "tool_use" | "pause_turn" | "refusal" +export const StopReason = Schema.Literals([ + "end_turn", + "max_tokens", + "stop_sequence", + "tool_use", + "pause_turn", + "refusal" +]) +export type BetaStopReason = + | "end_turn" + | "max_tokens" + | "stop_sequence" + | "tool_use" + | "pause_turn" + | "compaction" + | "refusal" + | "model_context_window_exceeded" +export const BetaStopReason = Schema.Literals([ + "end_turn", + "max_tokens", + "stop_sequence", + "tool_use", + "pause_turn", + "compaction", + "refusal", + "model_context_window_exceeded" +]) +export type Model = + | "claude-opus-4-7" + | "claude-mythos-preview" + | "claude-opus-4-6" + | "claude-sonnet-4-6" + | "claude-haiku-4-5" + | "claude-haiku-4-5-20251001" + | "claude-opus-4-5" + | "claude-opus-4-5-20251101" + | "claude-sonnet-4-5" + | "claude-sonnet-4-5-20250929" + | "claude-opus-4-1" + | "claude-opus-4-1-20250805" + | "claude-opus-4-0" + | "claude-opus-4-20250514" + | "claude-sonnet-4-0" + | "claude-sonnet-4-20250514" + | "claude-3-haiku-20240307" +export const Model = Schema.Literals([ + "claude-opus-4-7", + "claude-mythos-preview", + "claude-opus-4-6", + "claude-sonnet-4-6", + "claude-haiku-4-5", + "claude-haiku-4-5-20251001", + "claude-opus-4-5", + "claude-opus-4-5-20251101", + "claude-sonnet-4-5", + "claude-sonnet-4-5-20250929", + "claude-opus-4-1", + "claude-opus-4-1-20250805", + "claude-opus-4-0", + "claude-opus-4-20250514", + "claude-sonnet-4-0", + "claude-sonnet-4-20250514", + "claude-3-haiku-20240307" +]).annotate({ + "title": "Model", + "description": + "The model that will complete your prompt.\\n\\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options." +}) +export type BetaManagedAgentsModel = + | string + | "claude-opus-4-7" + | "claude-opus-4-6" + | "claude-sonnet-4-6" + | "claude-haiku-4-5" + | "claude-haiku-4-5-20251001" + | "claude-opus-4-5" + | "claude-opus-4-5-20251101" + | "claude-sonnet-4-5" + | "claude-sonnet-4-5-20250929" +export const BetaManagedAgentsModel = Schema.Union([ + Schema.String, + Schema.Literal("claude-opus-4-7").annotate({ + "description": "Frontier intelligence for long-running agents and coding" + }), + Schema.Literal("claude-opus-4-6").annotate({ + "description": "Most intelligent model for building agents and coding" + }), + Schema.Literal("claude-sonnet-4-6").annotate({ "description": "Best combination of speed and intelligence" }), + Schema.Literal("claude-haiku-4-5").annotate({ "description": "Fastest model with near-frontier intelligence" }), + Schema.Literal("claude-haiku-4-5-20251001").annotate({ + "description": "Fastest model with near-frontier intelligence" + }), + Schema.Literal("claude-opus-4-5").annotate({ + "description": "Premium model combining maximum intelligence with practical performance" + }), + Schema.Literal("claude-opus-4-5-20251101").annotate({ + "description": "Premium model combining maximum intelligence with practical performance" + }), + Schema.Literal("claude-sonnet-4-5").annotate({ "description": "High-performance model for agents and coding" }), + Schema.Literal("claude-sonnet-4-5-20250929").annotate({ + "description": "High-performance model for agents and coding" + }) +]).annotate({ + "title": "BetaManagedAgentsModel", + "description": + "The model that will power your agent.\\n\\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options." +}) +export type BetaMemoryTool_20250818_ViewCommand = { + readonly "command": "view" + readonly "path": string + readonly "view_range"?: ReadonlyArray +} +export const BetaMemoryTool_20250818_ViewCommand = Schema.Struct({ + "command": Schema.Literal("view").annotate({ "description": "Command type identifier", "default": "view" }), + "path": Schema.String.annotate({ "description": "Path to directory or file to view" }), + "view_range": Schema.optionalKey( + Schema.Array(Schema.Number.check(Schema.isInt())).annotate({ + "description": "Optional line range for viewing specific lines" + }).check(Schema.isMinLength(2)).check(Schema.isMaxLength(2)) + ) +}) +export type BetaMemoryTool_20250818_CreateCommand = { + readonly "command": "create" + readonly "path": string + readonly "file_text": string +} +export const BetaMemoryTool_20250818_CreateCommand = Schema.Struct({ + "command": Schema.Literal("create").annotate({ "description": "Command type identifier", "default": "create" }), + "path": Schema.String.annotate({ "description": "Path where the file should be created" }), + "file_text": Schema.String.annotate({ "description": "Content to write to the file" }) +}) +export type BetaMemoryTool_20250818_StrReplaceCommand = { + readonly "command": "str_replace" + readonly "path": string + readonly "old_str": string + readonly "new_str": string +} +export const BetaMemoryTool_20250818_StrReplaceCommand = Schema.Struct({ + "command": Schema.Literal("str_replace").annotate({ + "description": "Command type identifier", + "default": "str_replace" + }), + "path": Schema.String.annotate({ "description": "Path to the file where text should be replaced" }), + "old_str": Schema.String.annotate({ "description": "Text to search for and replace" }), + "new_str": Schema.String.annotate({ "description": "Text to replace with" }) +}) +export type BetaMemoryTool_20250818_InsertCommand = { + readonly "command": "insert" + readonly "path": string + readonly "insert_line": number + readonly "insert_text": string +} +export const BetaMemoryTool_20250818_InsertCommand = Schema.Struct({ + "command": Schema.Literal("insert").annotate({ "description": "Command type identifier", "default": "insert" }), + "path": Schema.String.annotate({ "description": "Path to the file where text should be inserted" }), + "insert_line": Schema.Number.annotate({ "description": "Line number where text should be inserted" }).check( + Schema.isInt() + ).check(Schema.isGreaterThanOrEqualTo(1)), + "insert_text": Schema.String.annotate({ "description": "Text to insert at the specified line" }) +}) +export type BetaMemoryTool_20250818_DeleteCommand = { readonly "command": "delete"; readonly "path": string } +export const BetaMemoryTool_20250818_DeleteCommand = Schema.Struct({ + "command": Schema.Literal("delete").annotate({ "description": "Command type identifier", "default": "delete" }), + "path": Schema.String.annotate({ "description": "Path to the file or directory to delete" }) +}) +export type BetaMemoryTool_20250818_RenameCommand = { + readonly "command": "rename" + readonly "old_path": string + readonly "new_path": string +} +export const BetaMemoryTool_20250818_RenameCommand = Schema.Struct({ + "command": Schema.Literal("rename").annotate({ "description": "Command type identifier", "default": "rename" }), + "old_path": Schema.String.annotate({ "description": "Current path of the file or directory" }), + "new_path": Schema.String.annotate({ "description": "New path for the file or directory" }) +}) +export type RequestBashCodeExecutionToolResultError = { + readonly "error_code": BashCodeExecutionToolResultErrorCode + readonly "type": "bash_code_execution_tool_result_error" +} +export const RequestBashCodeExecutionToolResultError = Schema.Struct({ + "error_code": BashCodeExecutionToolResultErrorCode, + "type": Schema.Literal("bash_code_execution_tool_result_error").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestBashCodeExecutionToolResultError" }) +export type ResponseBashCodeExecutionToolResultError = { + readonly "error_code": BashCodeExecutionToolResultErrorCode + readonly "type": "bash_code_execution_tool_result_error" +} +export const ResponseBashCodeExecutionToolResultError = Schema.Struct({ + "error_code": BashCodeExecutionToolResultErrorCode, + "type": Schema.Literal("bash_code_execution_tool_result_error").annotate({ + "title": "Type", + "default": "bash_code_execution_tool_result_error" + }) +}).annotate({ "title": "ResponseBashCodeExecutionToolResultError" }) +export type BetaRequestAdvisorToolResultError = { + readonly "error_code": BetaAdvisorToolResultErrorCode + readonly "type": "advisor_tool_result_error" +} +export const BetaRequestAdvisorToolResultError = Schema.Struct({ + "error_code": BetaAdvisorToolResultErrorCode, + "type": Schema.Literal("advisor_tool_result_error").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestAdvisorToolResultError" }) +export type BetaResponseAdvisorToolResultError = { + readonly "error_code": BetaAdvisorToolResultErrorCode + readonly "type": "advisor_tool_result_error" +} +export const BetaResponseAdvisorToolResultError = Schema.Struct({ + "error_code": BetaAdvisorToolResultErrorCode, + "type": Schema.Literal("advisor_tool_result_error").annotate({ + "title": "Type", + "default": "advisor_tool_result_error" + }) +}).annotate({ "title": "ResponseAdvisorToolResultError" }) +export type BetaRequestBashCodeExecutionToolResultError = { + readonly "error_code": BetaBashCodeExecutionToolResultErrorCode + readonly "type": "bash_code_execution_tool_result_error" +} +export const BetaRequestBashCodeExecutionToolResultError = Schema.Struct({ + "error_code": BetaBashCodeExecutionToolResultErrorCode, + "type": Schema.Literal("bash_code_execution_tool_result_error").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestBashCodeExecutionToolResultError" }) +export type BetaResponseBashCodeExecutionToolResultError = { + readonly "error_code": BetaBashCodeExecutionToolResultErrorCode + readonly "type": "bash_code_execution_tool_result_error" +} +export const BetaResponseBashCodeExecutionToolResultError = Schema.Struct({ + "error_code": BetaBashCodeExecutionToolResultErrorCode, + "type": Schema.Literal("bash_code_execution_tool_result_error").annotate({ + "title": "Type", + "default": "bash_code_execution_tool_result_error" + }) +}).annotate({ "title": "ResponseBashCodeExecutionToolResultError" }) +export type BetaCodeExecutionTool_20250522 = { + readonly "allowed_callers"?: ReadonlyArray + readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "defer_loading"?: boolean - readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> - readonly "name": "bash" + readonly "name": "code_execution" readonly "strict"?: boolean - readonly "type": "bash_20250124" + readonly "type": "code_execution_20250522" } -export const BetaBashTool_20250124 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), +export const BetaCodeExecutionTool_20250522 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -3545,10 +4802,7 @@ export const BetaBashTool_20250124 = Schema.Struct({ "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." }) ), - "input_examples": Schema.optionalKey( - Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" }) - ), - "name": Schema.Literal("bash").annotate({ + "name": Schema.Literal("code_execution").annotate({ "title": "Name", "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." }), @@ -3558,26 +4812,18 @@ export const BetaBashTool_20250124 = Schema.Struct({ "description": "When true, guarantees schema validation on tool names and inputs" }) ), - "type": Schema.Literal("bash_20250124").annotate({ "title": "Type" }) -}).annotate({ "title": "BashTool_20250124" }) -export type BetaComputerUseTool_20241022 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + "type": Schema.Literal("code_execution_20250522").annotate({ "title": "Type" }) +}).annotate({ "title": "CodeExecutionTool_20250522" }) +export type BetaCodeExecutionTool_20250825 = { + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "defer_loading"?: boolean - readonly "display_height_px": number - readonly "display_number"?: number | null - readonly "display_width_px": number - readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> - readonly "name": "computer" + readonly "name": "code_execution" readonly "strict"?: boolean - readonly "type": "computer_20241022" + readonly "type": "code_execution_20250825" } -export const BetaComputerUseTool_20241022 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), +export const BetaCodeExecutionTool_20250825 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -3591,24 +4837,7 @@ export const BetaComputerUseTool_20241022 = Schema.Struct({ "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." }) ), - "display_height_px": Schema.Number.annotate({ - "title": "Display Height Px", - "description": "The height of the display in pixels." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), - "display_number": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null]).annotate({ - "title": "Display Number", - "description": "The X11 display number (e.g. 0, 1) for the display." - }) - ), - "display_width_px": Schema.Number.annotate({ - "title": "Display Width Px", - "description": "The width of the display in pixels." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), - "input_examples": Schema.optionalKey( - Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" }) - ), - "name": Schema.Literal("computer").annotate({ + "name": Schema.Literal("code_execution").annotate({ "title": "Name", "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." }), @@ -3618,26 +4847,18 @@ export const BetaComputerUseTool_20241022 = Schema.Struct({ "description": "When true, guarantees schema validation on tool names and inputs" }) ), - "type": Schema.Literal("computer_20241022").annotate({ "title": "Type" }) -}).annotate({ "title": "ComputerUseTool_20241022" }) -export type BetaComputerUseTool_20250124 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + "type": Schema.Literal("code_execution_20250825").annotate({ "title": "Type" }) +}).annotate({ "title": "CodeExecutionTool_20250825" }) +export type BetaCodeExecutionTool_20260120 = { + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "defer_loading"?: boolean - readonly "display_height_px": number - readonly "display_number"?: number | null - readonly "display_width_px": number - readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> - readonly "name": "computer" + readonly "name": "code_execution" readonly "strict"?: boolean - readonly "type": "computer_20250124" + readonly "type": "code_execution_20260120" } -export const BetaComputerUseTool_20250124 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), +export const BetaCodeExecutionTool_20260120 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -3651,24 +4872,7 @@ export const BetaComputerUseTool_20250124 = Schema.Struct({ "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." }) ), - "display_height_px": Schema.Number.annotate({ - "title": "Display Height Px", - "description": "The height of the display in pixels." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), - "display_number": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null]).annotate({ - "title": "Display Number", - "description": "The X11 display number (e.g. 0, 1) for the display." - }) - ), - "display_width_px": Schema.Number.annotate({ - "title": "Display Width Px", - "description": "The width of the display in pixels." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), - "input_examples": Schema.optionalKey( - Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" }) - ), - "name": Schema.Literal("computer").annotate({ + "name": Schema.Literal("code_execution").annotate({ "title": "Name", "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." }), @@ -3678,133 +4882,112 @@ export const BetaComputerUseTool_20250124 = Schema.Struct({ "description": "When true, guarantees schema validation on tool names and inputs" }) ), - "type": Schema.Literal("computer_20250124").annotate({ "title": "Type" }) -}).annotate({ "title": "ComputerUseTool_20250124" }) -export type BetaComputerUseTool_20251124 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + "type": Schema.Literal("code_execution_20260120").annotate({ "title": "Type" }) +}).annotate({ + "title": "CodeExecutionTool_20260120", + "description": "Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint)." +}) +export type BetaRequestCompactionBlock = { readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "defer_loading"?: boolean - readonly "display_height_px": number - readonly "display_number"?: number | null - readonly "display_width_px": number - readonly "enable_zoom"?: boolean - readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> - readonly "name": "computer" - readonly "strict"?: boolean - readonly "type": "computer_20251124" + readonly "content"?: string | null + readonly "encrypted_content"?: string | null + readonly "type": "compaction" } -export const BetaComputerUseTool_20251124 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), +export const BetaRequestCompactionBlock = Schema.Struct({ "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "defer_loading": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Defer Loading", - "description": - "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." - }) - ), - "display_height_px": Schema.Number.annotate({ - "title": "Display Height Px", - "description": "The height of the display in pixels." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), - "display_number": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null]).annotate({ - "title": "Display Number", - "description": "The X11 display number (e.g. 0, 1) for the display." - }) - ), - "display_width_px": Schema.Number.annotate({ - "title": "Display Width Px", - "description": "The width of the display in pixels." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), - "enable_zoom": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Enable Zoom", - "description": "Whether to enable an action to take a zoomed-in screenshot of the screen." + "content": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Content", + "description": "Summary of previously compacted content, or null if compaction failed" }) ), - "input_examples": Schema.optionalKey( - Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" }) - ), - "name": Schema.Literal("computer").annotate({ - "title": "Name", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." - }), - "strict": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Strict", - "description": "When true, guarantees schema validation on tool names and inputs" + "encrypted_content": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Encrypted Content", + "description": "Opaque metadata from prior compaction, to be round-tripped verbatim" }) ), - "type": Schema.Literal("computer_20251124").annotate({ "title": "Type" }) -}).annotate({ "title": "ComputerUseTool_20251124" }) -export type BetaMemoryTool_20250818 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + "type": Schema.Literal("compaction").annotate({ "title": "Type" }) +}).annotate({ + "title": "RequestCompactionBlock", + "description": + "A compaction block containing summary of previous context.\n\nUsers should round-trip these blocks from responses to subsequent requests\nto maintain context across compaction boundaries.\n\nWhen content is None, the block represents a failed compaction. The server\ntreats these as no-ops. Empty string content is not allowed." +}) +export type BetaRequestContainerUploadBlock = { readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "defer_loading"?: boolean - readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> - readonly "name": "memory" - readonly "strict"?: boolean - readonly "type": "memory_20250818" + readonly "file_id": string + readonly "type": "container_upload" } -export const BetaMemoryTool_20250818 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), +export const BetaRequestContainerUploadBlock = Schema.Struct({ "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "defer_loading": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Defer Loading", - "description": - "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + "file_id": Schema.String.annotate({ "title": "File Id" }), + "type": Schema.Literal("container_upload").annotate({ "title": "Type" }) +}).annotate({ + "title": "RequestContainerUploadBlock", + "description": + "A content block that represents a file to be uploaded to the container\nFiles uploaded via this block will be available in the container's input directory." +}) +export type BetaRequestMCPToolUseBlock = { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "id": string + readonly "input": { readonly [x: string]: unknown } + readonly "name": string + readonly "server_name": string + readonly "type": "mcp_tool_use" +} +export const BetaRequestMCPToolUseBlock = Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." }) ), - "input_examples": Schema.optionalKey( - Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" }) - ), - "name": Schema.Literal("memory").annotate({ - "title": "Name", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." - }), - "strict": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Strict", - "description": "When true, guarantees schema validation on tool names and inputs" + "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$"))), + "input": Schema.Record(Schema.String, Schema.Unknown).annotate({ "title": "Input" }), + "name": Schema.String.annotate({ "title": "Name" }), + "server_name": Schema.String.annotate({ "title": "Server Name", "description": "The name of the MCP server" }), + "type": Schema.Literal("mcp_tool_use").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestMCPToolUseBlock" }) +export type BetaRequestToolReferenceBlock = { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "tool_name": string + readonly "type": "tool_reference" +} +export const BetaRequestToolReferenceBlock = Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." }) ), - "type": Schema.Literal("memory_20250818").annotate({ "title": "Type" }) -}).annotate({ "title": "MemoryTool_20250818" }) -export type BetaTextEditor_20241022 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + "tool_name": Schema.String.annotate({ "title": "Tool Name" }).check(Schema.isMinLength(1)).check( + Schema.isMaxLength(256) + ).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]{1,256}$"))), + "type": Schema.Literal("tool_reference").annotate({ "title": "Type" }) +}).annotate({ + "title": "RequestToolReferenceBlock", + "description": "Tool reference block that can be included in tool_result content." +}) +export type BetaToolSearchToolBM25_20251119 = { + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "defer_loading"?: boolean - readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> - readonly "name": "str_replace_editor" + readonly "name": "tool_search_tool_bm25" readonly "strict"?: boolean - readonly "type": "text_editor_20241022" + readonly "type": "tool_search_tool_bm25_20251119" | "tool_search_tool_bm25" } -export const BetaTextEditor_20241022 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), +export const BetaToolSearchToolBM25_20251119 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -3818,10 +5001,7 @@ export const BetaTextEditor_20241022 = Schema.Struct({ "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." }) ), - "input_examples": Schema.optionalKey( - Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" }) - ), - "name": Schema.Literal("str_replace_editor").annotate({ + "name": Schema.Literal("tool_search_tool_bm25").annotate({ "title": "Name", "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." }), @@ -3831,23 +5011,18 @@ export const BetaTextEditor_20241022 = Schema.Struct({ "description": "When true, guarantees schema validation on tool names and inputs" }) ), - "type": Schema.Literal("text_editor_20241022").annotate({ "title": "Type" }) -}).annotate({ "title": "TextEditor_20241022" }) -export type BetaTextEditor_20250124 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + "type": Schema.Literals(["tool_search_tool_bm25_20251119", "tool_search_tool_bm25"]).annotate({ "title": "Type" }) +}).annotate({ "title": "ToolSearchToolBM25_20251119" }) +export type BetaToolSearchToolRegex_20251119 = { + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "defer_loading"?: boolean - readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> - readonly "name": "str_replace_editor" + readonly "name": "tool_search_tool_regex" readonly "strict"?: boolean - readonly "type": "text_editor_20250124" + readonly "type": "tool_search_tool_regex_20251119" | "tool_search_tool_regex" } -export const BetaTextEditor_20250124 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), +export const BetaToolSearchToolRegex_20251119 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -3861,10 +5036,7 @@ export const BetaTextEditor_20250124 = Schema.Struct({ "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." }) ), - "input_examples": Schema.optionalKey( - Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" }) - ), - "name": Schema.Literal("str_replace_editor").annotate({ + "name": Schema.Literal("tool_search_tool_regex").annotate({ "title": "Name", "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." }), @@ -3874,23 +5046,231 @@ export const BetaTextEditor_20250124 = Schema.Struct({ "description": "When true, guarantees schema validation on tool names and inputs" }) ), - "type": Schema.Literal("text_editor_20250124").annotate({ "title": "Type" }) -}).annotate({ "title": "TextEditor_20250124" }) -export type BetaTextEditor_20250429 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "defer_loading"?: boolean - readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> - readonly "name": "str_replace_based_edit_tool" - readonly "strict"?: boolean - readonly "type": "text_editor_20250429" + "type": Schema.Literals(["tool_search_tool_regex_20251119", "tool_search_tool_regex"]).annotate({ "title": "Type" }) +}).annotate({ "title": "ToolSearchToolRegex_20251119" }) +export type BetaCompactionIterationUsage = { + readonly "cache_creation": BetaCacheCreation | null + readonly "cache_creation_input_tokens": number + readonly "cache_read_input_tokens": number + readonly "input_tokens": number + readonly "output_tokens": number + readonly "type": "compaction" } -export const BetaTextEditor_20250429 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" +export const BetaCompactionIterationUsage = Schema.Struct({ + "cache_creation": Schema.Union([BetaCacheCreation, Schema.Null]).annotate({ + "description": "Breakdown of cached tokens by TTL", + "default": null + }), + "cache_creation_input_tokens": Schema.Number.annotate({ + "title": "Cache Creation Input Tokens", + "description": "The number of input tokens used to create the cache entry.", + "default": 0 + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "cache_read_input_tokens": Schema.Number.annotate({ + "title": "Cache Read Input Tokens", + "description": "The number of input tokens read from the cache.", + "default": 0 + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "input_tokens": Schema.Number.annotate({ + "title": "Input Tokens", + "description": "The number of input tokens which were used." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "output_tokens": Schema.Number.annotate({ + "title": "Output Tokens", + "description": "The number of output tokens which were used." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "type": Schema.Literal("compaction").annotate({ + "title": "Type", + "description": "Usage for a compaction iteration", + "default": "compaction" + }) +}).annotate({ "title": "CompactionIterationUsage", "description": "Token usage for a compaction iteration." }) +export type BetaMessageIterationUsage = { + readonly "cache_creation": BetaCacheCreation | null + readonly "cache_creation_input_tokens": number + readonly "cache_read_input_tokens": number + readonly "input_tokens": number + readonly "output_tokens": number + readonly "type": "message" +} +export const BetaMessageIterationUsage = Schema.Struct({ + "cache_creation": Schema.Union([BetaCacheCreation, Schema.Null]).annotate({ + "description": "Breakdown of cached tokens by TTL", + "default": null + }), + "cache_creation_input_tokens": Schema.Number.annotate({ + "title": "Cache Creation Input Tokens", + "description": "The number of input tokens used to create the cache entry.", + "default": 0 + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "cache_read_input_tokens": Schema.Number.annotate({ + "title": "Cache Read Input Tokens", + "description": "The number of input tokens read from the cache.", + "default": 0 + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "input_tokens": Schema.Number.annotate({ + "title": "Input Tokens", + "description": "The number of input tokens which were used." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "output_tokens": Schema.Number.annotate({ + "title": "Output Tokens", + "description": "The number of output tokens which were used." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "type": Schema.Literal("message").annotate({ + "title": "Type", + "description": "Usage for a sampling iteration", + "default": "message" + }) +}).annotate({ "title": "MessageIterationUsage", "description": "Token usage for a sampling iteration." }) +export type BetaDiagnostics = { + readonly "cache_miss_reason": + | BetaCacheMissModelChanged + | BetaCacheMissSystemChanged + | BetaCacheMissToolsChanged + | BetaCacheMissMessagesChanged + | BetaCacheMissPreviousMessageNotFound + | BetaCacheMissUnavailable + | null +} +export const BetaDiagnostics = Schema.Struct({ + "cache_miss_reason": Schema.Union([ + Schema.Union([ + BetaCacheMissModelChanged, + BetaCacheMissSystemChanged, + BetaCacheMissToolsChanged, + BetaCacheMissMessagesChanged, + BetaCacheMissPreviousMessageNotFound, + BetaCacheMissUnavailable + ], { mode: "oneOf" }), + Schema.Null + ]).annotate({ + "title": "Cache Miss Reason", + "description": + "Explains why the prompt cache could not fully reuse the prefix from the request identified by `diagnostics.previous_message_id`. `null` means diagnosis is still pending — the response was serialized before the background comparison completed.", + "default": null + }) +}).annotate({ + "title": "Diagnostics", + "description": + "Response envelope for request-level diagnostics. Present (possibly\nnull) whenever the caller supplied `diagnostics` on the request." +}) +export type BetaRequestCodeExecutionToolResultError = { + readonly "error_code": BetaCodeExecutionToolResultErrorCode + readonly "type": "code_execution_tool_result_error" +} +export const BetaRequestCodeExecutionToolResultError = Schema.Struct({ + "error_code": BetaCodeExecutionToolResultErrorCode, + "type": Schema.Literal("code_execution_tool_result_error").annotate({ "title": "Type" }) +}).annotate({ "title": "Error" }) +export type BetaResponseCodeExecutionToolResultError = { + readonly "error_code": BetaCodeExecutionToolResultErrorCode + readonly "type": "code_execution_tool_result_error" +} +export const BetaResponseCodeExecutionToolResultError = Schema.Struct({ + "error_code": BetaCodeExecutionToolResultErrorCode, + "type": Schema.Literal("code_execution_tool_result_error").annotate({ + "title": "Type", + "default": "code_execution_tool_result_error" + }) +}).annotate({ "title": "ResponseCodeExecutionToolResultError" }) +export type BetaCountMessageTokensResponse = { + readonly "context_management": BetaContextManagementResponse | null + readonly "input_tokens": number +} +export const BetaCountMessageTokensResponse = Schema.Struct({ + "context_management": Schema.Union([BetaContextManagementResponse, Schema.Null]).annotate({ + "description": "Information about context management applied to the message." + }), + "input_tokens": Schema.Number.annotate({ + "title": "Input Tokens", + "description": "The total number of tokens across the provided list of messages, system prompt, and tools." + }).check(Schema.isInt()) +}).annotate({ "title": "CountMessageTokensResponse" }) +export type BetaFileMetadataSchema = { + readonly "created_at": string + readonly "downloadable"?: boolean + readonly "filename": string + readonly "id": string + readonly "mime_type": string + readonly "scope"?: BetaFileScope | null + readonly "size_bytes": number + readonly "type": "file" +} +export const BetaFileMetadataSchema = Schema.Struct({ + "created_at": Schema.String.annotate({ + "title": "Created At", + "description": "RFC 3339 datetime string representing when the file was created.", + "format": "date-time" + }), + "downloadable": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Downloadable", + "description": "Whether the file can be downloaded.", + "default": false + }) + ), + "filename": Schema.String.annotate({ "title": "Filename", "description": "Original filename of the uploaded file." }) + .check(Schema.isMinLength(1)).check(Schema.isMaxLength(500)), + "id": Schema.String.annotate({ + "title": "Id", + "description": "Unique object identifier.\n\nThe format and length of IDs may change over time." + }), + "mime_type": Schema.String.annotate({ "title": "Mime Type", "description": "MIME type of the file." }).check( + Schema.isMinLength(1) + ).check(Schema.isMaxLength(255)), + "scope": Schema.optionalKey( + Schema.Union([BetaFileScope, Schema.Null]).annotate({ + "description": "The scope of this file, indicating the context in which it was created (e.g., a session)." + }) + ), + "size_bytes": Schema.Number.annotate({ "title": "Size Bytes", "description": "Size of the file in bytes." }).check( + Schema.isInt() + ).check(Schema.isGreaterThanOrEqualTo(0)), + "type": Schema.Literal("file").annotate({ + "title": "Type", + "description": "Object type.\n\nFor files, this is always `\"file\"`." + }) +}).annotate({ "title": "FileMetadataSchema" }) +export type BetaCompact20260112 = { + readonly "instructions"?: string | null + readonly "pause_after_compaction"?: boolean + readonly "trigger"?: BetaInputTokensTrigger | null + readonly "type": "compact_20260112" +} +export const BetaCompact20260112 = Schema.Struct({ + "instructions": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Instructions", + "description": "Additional instructions for summarization." + }) + ), + "pause_after_compaction": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Pause After Compaction", + "description": "Whether to pause after compaction and return the compaction block to the user." + }) + ), + "trigger": Schema.optionalKey( + Schema.Union([BetaInputTokensTrigger, Schema.Null]).annotate({ + "description": "When to trigger compaction. Defaults to 150000 input tokens." }) ), + "type": Schema.Literal("compact_20260112").annotate({ "title": "Type" }) +}).annotate({ + "title": "Compact20260112", + "description": "Automatically compact older context when reaching the configured trigger threshold." +}) +export type BetaBashTool_20241022 = { + readonly "allowed_callers"?: ReadonlyArray + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "defer_loading"?: boolean + readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> + readonly "name": "bash" + readonly "strict"?: boolean + readonly "type": "bash_20241022" +} +export const BetaBashTool_20241022 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -3907,7 +5287,7 @@ export const BetaTextEditor_20250429 = Schema.Struct({ "input_examples": Schema.optionalKey( Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" }) ), - "name": Schema.Literal("str_replace_based_edit_tool").annotate({ + "name": Schema.Literal("bash").annotate({ "title": "Name", "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." }), @@ -3917,24 +5297,19 @@ export const BetaTextEditor_20250429 = Schema.Struct({ "description": "When true, guarantees schema validation on tool names and inputs" }) ), - "type": Schema.Literal("text_editor_20250429").annotate({ "title": "Type" }) -}).annotate({ "title": "TextEditor_20250429" }) -export type BetaTextEditor_20250728 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + "type": Schema.Literal("bash_20241022").annotate({ "title": "Type" }) +}).annotate({ "title": "BashTool_20241022" }) +export type BetaBashTool_20250124 = { + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "defer_loading"?: boolean readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> - readonly "max_characters"?: number | null - readonly "name": "str_replace_based_edit_tool" + readonly "name": "bash" readonly "strict"?: boolean - readonly "type": "text_editor_20250728" + readonly "type": "bash_20250124" } -export const BetaTextEditor_20250728 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), +export const BetaBashTool_20250124 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -3951,14 +5326,7 @@ export const BetaTextEditor_20250728 = Schema.Struct({ "input_examples": Schema.optionalKey( Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" }) ), - "max_characters": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), Schema.Null]).annotate({ - "title": "Max Characters", - "description": - "Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file." - }) - ), - "name": Schema.Literal("str_replace_based_edit_tool").annotate({ + "name": Schema.Literal("bash").annotate({ "title": "Name", "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." }), @@ -3968,77 +5336,27 @@ export const BetaTextEditor_20250728 = Schema.Struct({ "description": "When true, guarantees schema validation on tool names and inputs" }) ), - "type": Schema.Literal("text_editor_20250728").annotate({ "title": "Type" }) -}).annotate({ "title": "TextEditor_20250728" }) -export type BetaTool = { - readonly "type"?: null | "custom" - readonly "description"?: string - readonly "name": string - readonly "input_schema": { - readonly "properties"?: { readonly [x: string]: Schema.Json } | null - readonly "required"?: ReadonlyArray | null - readonly "type": "object" - readonly [x: string]: Schema.Json - } + "type": Schema.Literal("bash_20250124").annotate({ "title": "Type" }) +}).annotate({ "title": "BashTool_20250124" }) +export type BetaComputerUseTool_20241022 = { + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "strict"?: boolean - readonly "eager_input_streaming"?: boolean | null - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> readonly "defer_loading"?: boolean + readonly "display_height_px": number + readonly "display_number"?: number | null + readonly "display_width_px": number readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> + readonly "name": "computer" + readonly "strict"?: boolean + readonly "type": "computer_20241022" } -export const BetaTool = Schema.Struct({ - "type": Schema.optionalKey(Schema.Union([Schema.Null, Schema.Literal("custom")]).annotate({ "title": "Type" })), - "description": Schema.optionalKey(Schema.String.annotate({ - "title": "Description", - "description": - "Description of what this tool does.\n\nTool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema." - })), - "name": Schema.String.annotate({ - "title": "Name", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." - }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(128)).check( - Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]{1,128}$")) - ), - "input_schema": Schema.StructWithRest( - Schema.Struct({ - "properties": Schema.optionalKey( - Schema.Union([Schema.Record(Schema.String, Schema.Json), Schema.Null]).annotate({ "title": "Properties" }) - ), - "required": Schema.optionalKey( - Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Required" }) - ), - "type": Schema.Literal("object").annotate({ "title": "Type" }) - }), - [Schema.Record(Schema.String, Schema.Json)] - ).annotate({ - "title": "InputSchema", - "description": - "[JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.\n\nThis defines the shape of the `input` that your tool accepts and that the model will produce." - }), - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "strict": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Strict", - "description": "When true, guarantees schema validation on tool names and inputs" - }) - ), - "eager_input_streaming": Schema.optionalKey( - Schema.Union([Schema.Boolean, Schema.Null]).annotate({ - "title": "Eager Input Streaming", - "description": - "Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers." - }) - ), - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) +export const BetaComputerUseTool_20241022 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) ), "defer_loading": Schema.optionalKey( Schema.Boolean.annotate({ @@ -4047,176 +5365,55 @@ export const BetaTool = Schema.Struct({ "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." }) ), - "input_examples": Schema.optionalKey( - Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" }) - ) -}).annotate({ "title": "Tool" }) -export type BetaMCPToolset = { - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "configs"?: { readonly [x: string]: BetaMCPToolConfig } | null - readonly "default_config"?: { readonly "defer_loading"?: boolean; readonly "enabled"?: boolean } - readonly "mcp_server_name": string - readonly "type": "mcp_toolset" -} -export const BetaMCPToolset = Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." + "display_height_px": Schema.Number.annotate({ + "title": "Display Height Px", + "description": "The height of the display in pixels." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), + "display_number": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null]).annotate({ + "title": "Display Number", + "description": "The X11 display number (e.g. 0, 1) for the display." }) ), - "configs": Schema.optionalKey( - Schema.Union([Schema.Record(Schema.String, BetaMCPToolConfig), Schema.Null]).annotate({ - "title": "Configs", - "description": "Configuration overrides for specific tools, keyed by tool name" - }) + "display_width_px": Schema.Number.annotate({ + "title": "Display Width Px", + "description": "The width of the display in pixels." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), + "input_examples": Schema.optionalKey( + Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" }) ), - "default_config": Schema.optionalKey( - Schema.Struct({ - "defer_loading": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Defer Loading" })), - "enabled": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Enabled" })) - }).annotate({ - "title": "MCPToolDefaultConfig", - "description": "Default configuration applied to all tools from this server" + "name": Schema.Literal("computer").annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." + }), + "strict": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" }) ), - "mcp_server_name": Schema.String.annotate({ - "title": "Mcp Server Name", - "description": "Name of the MCP server to configure tools for" - }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), - "type": Schema.Literal("mcp_toolset").annotate({ "title": "Type" }) -}).annotate({ - "title": "MCPToolset", - "description": - "Configuration for a group of tools from an MCP server.\n\nAllows configuring enabled status and defer_loading for all tools\nfrom an MCP server, with optional per-tool overrides." -}) -export type BetaListResponse_MessageBatch_ = { - readonly "data": ReadonlyArray - readonly "first_id": string | null - readonly "has_more": boolean - readonly "last_id": string | null -} -export const BetaListResponse_MessageBatch_ = Schema.Struct({ - "data": Schema.Array(BetaMessageBatch).annotate({ "title": "Data" }), - "first_id": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "First Id", - "description": "First ID in the `data` list. Can be used as the `before_id` for the previous page." - }), - "has_more": Schema.Boolean.annotate({ - "title": "Has More", - "description": "Indicates if there are more results in the requested page direction." - }), - "last_id": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Last Id", - "description": "Last ID in the `data` list. Can be used as the `after_id` for the next page." - }) -}).annotate({ "title": "ListResponse[MessageBatch]" }) -export type BetaListResponse_ModelInfo_ = { - readonly "data": ReadonlyArray - readonly "first_id": string | null - readonly "has_more": boolean - readonly "last_id": string | null -} -export const BetaListResponse_ModelInfo_ = Schema.Struct({ - "data": Schema.Array(BetaModelInfo).annotate({ "title": "Data" }), - "first_id": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "First Id", - "description": "First ID in the `data` list. Can be used as the `before_id` for the previous page." - }), - "has_more": Schema.Boolean.annotate({ - "title": "Has More", - "description": "Indicates if there are more results in the requested page direction." - }), - "last_id": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Last Id", - "description": "Last ID in the `data` list. Can be used as the `after_id` for the next page." - }) -}).annotate({ "title": "ListResponse[ModelInfo]" }) -export type BetaErrorResponse = { - readonly "error": - | BetaInvalidRequestError - | BetaAuthenticationError - | BetaBillingError - | BetaPermissionError - | BetaNotFoundError - | BetaRateLimitError - | BetaGatewayTimeoutError - | BetaAPIError - | BetaOverloadedError - readonly "request_id": string | null - readonly "type": "error" -} -export const BetaErrorResponse = Schema.Struct({ - "error": Schema.Union([ - BetaInvalidRequestError, - BetaAuthenticationError, - BetaBillingError, - BetaPermissionError, - BetaNotFoundError, - BetaRateLimitError, - BetaGatewayTimeoutError, - BetaAPIError, - BetaOverloadedError - ], { mode: "oneOf" }).annotate({ "title": "Error" }), - "request_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Request Id", "default": null }), - "type": Schema.Literal("error").annotate({ "title": "Type", "default": "error" }) -}).annotate({ "title": "ErrorResponse" }) -export type BetaRequestBashCodeExecutionResultBlock = { - readonly "content": ReadonlyArray - readonly "return_code": number - readonly "stderr": string - readonly "stdout": string - readonly "type": "bash_code_execution_result" -} -export const BetaRequestBashCodeExecutionResultBlock = Schema.Struct({ - "content": Schema.Array(BetaRequestBashCodeExecutionOutputBlock).annotate({ "title": "Content" }), - "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), - "stderr": Schema.String.annotate({ "title": "Stderr" }), - "stdout": Schema.String.annotate({ "title": "Stdout" }), - "type": Schema.Literal("bash_code_execution_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestBashCodeExecutionResultBlock" }) -export type BetaWebFetchTool_20250910 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "allowed_domains"?: ReadonlyArray | null - readonly "blocked_domains"?: ReadonlyArray | null + "type": Schema.Literal("computer_20241022").annotate({ "title": "Type" }) +}).annotate({ "title": "ComputerUseTool_20241022" }) +export type BetaComputerUseTool_20250124 = { + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "citations"?: BetaRequestCitationsConfig | null readonly "defer_loading"?: boolean - readonly "max_content_tokens"?: number | null - readonly "max_uses"?: number | null - readonly "name": "web_fetch" + readonly "display_height_px": number + readonly "display_number"?: number | null + readonly "display_width_px": number + readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> + readonly "name": "computer" readonly "strict"?: boolean - readonly "type": "web_fetch_20250910" + readonly "type": "computer_20250124" } -export const BetaWebFetchTool_20250910 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), - "allowed_domains": Schema.optionalKey( - Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ - "title": "Allowed Domains", - "description": "List of domains to allow fetching from" - }) - ), - "blocked_domains": Schema.optionalKey( - Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ - "title": "Blocked Domains", - "description": "List of domains to block fetching from" - }) - ), +export const BetaComputerUseTool_20250124 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "citations": Schema.optionalKey( - Schema.Union([BetaRequestCitationsConfig, Schema.Null]).annotate({ - "description": "Citations configuration for fetched documents. Citations are disabled by default." - }) - ), "defer_loading": Schema.optionalKey( Schema.Boolean.annotate({ "title": "Defer Loading", @@ -4224,20 +5421,24 @@ export const BetaWebFetchTool_20250910 = Schema.Struct({ "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." }) ), - "max_content_tokens": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ - "title": "Max Content Tokens", - "description": - "Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs." + "display_height_px": Schema.Number.annotate({ + "title": "Display Height Px", + "description": "The height of the display in pixels." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), + "display_number": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null]).annotate({ + "title": "Display Number", + "description": "The X11 display number (e.g. 0, 1) for the display." }) ), - "max_uses": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ - "title": "Max Uses", - "description": "Maximum number of times the tool can be used in the API request." - }) + "display_width_px": Schema.Number.annotate({ + "title": "Display Width Px", + "description": "The width of the display in pixels." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), + "input_examples": Schema.optionalKey( + Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" }) ), - "name": Schema.Literal("web_fetch").annotate({ + "name": Schema.Literal("computer").annotate({ "title": "Name", "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." }), @@ -4247,50 +5448,29 @@ export const BetaWebFetchTool_20250910 = Schema.Struct({ "description": "When true, guarantees schema validation on tool names and inputs" }) ), - "type": Schema.Literal("web_fetch_20250910").annotate({ "title": "Type" }) -}).annotate({ "title": "WebFetchTool_20250910" }) -export type BetaWebFetchTool_20260209 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "allowed_domains"?: ReadonlyArray | null - readonly "blocked_domains"?: ReadonlyArray | null + "type": Schema.Literal("computer_20250124").annotate({ "title": "Type" }) +}).annotate({ "title": "ComputerUseTool_20250124" }) +export type BetaComputerUseTool_20251124 = { + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "citations"?: BetaRequestCitationsConfig | null readonly "defer_loading"?: boolean - readonly "max_content_tokens"?: number | null - readonly "max_uses"?: number | null - readonly "name": "web_fetch" - readonly "strict"?: boolean - readonly "type": "web_fetch_20260209" -} -export const BetaWebFetchTool_20260209 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), - "allowed_domains": Schema.optionalKey( - Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ - "title": "Allowed Domains", - "description": "List of domains to allow fetching from" - }) - ), - "blocked_domains": Schema.optionalKey( - Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ - "title": "Blocked Domains", - "description": "List of domains to block fetching from" - }) - ), + readonly "display_height_px": number + readonly "display_number"?: number | null + readonly "display_width_px": number + readonly "enable_zoom"?: boolean + readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> + readonly "name": "computer" + readonly "strict"?: boolean + readonly "type": "computer_20251124" +} +export const BetaComputerUseTool_20251124 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "citations": Schema.optionalKey( - Schema.Union([BetaRequestCitationsConfig, Schema.Null]).annotate({ - "description": "Citations configuration for fetched documents. Citations are disabled by default." - }) - ), "defer_loading": Schema.optionalKey( Schema.Boolean.annotate({ "title": "Defer Loading", @@ -4298,20 +5478,30 @@ export const BetaWebFetchTool_20260209 = Schema.Struct({ "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." }) ), - "max_content_tokens": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ - "title": "Max Content Tokens", - "description": - "Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs." + "display_height_px": Schema.Number.annotate({ + "title": "Display Height Px", + "description": "The height of the display in pixels." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), + "display_number": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), Schema.Null]).annotate({ + "title": "Display Number", + "description": "The X11 display number (e.g. 0, 1) for the display." }) ), - "max_uses": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ - "title": "Max Uses", - "description": "Maximum number of times the tool can be used in the API request." + "display_width_px": Schema.Number.annotate({ + "title": "Display Width Px", + "description": "The width of the display in pixels." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), + "enable_zoom": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Enable Zoom", + "description": "Whether to enable an action to take a zoomed-in screenshot of the screen." }) ), - "name": Schema.Literal("web_fetch").annotate({ + "input_examples": Schema.optionalKey( + Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" }) + ), + "name": Schema.Literal("computer").annotate({ "title": "Name", "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." }), @@ -4321,860 +5511,717 @@ export const BetaWebFetchTool_20260209 = Schema.Struct({ "description": "When true, guarantees schema validation on tool names and inputs" }) ), - "type": Schema.Literal("web_fetch_20260209").annotate({ "title": "Type" }) -}).annotate({ "title": "WebFetchTool_20260209" }) -export type BetaRequestCodeExecutionResultBlock = { - readonly "content": ReadonlyArray - readonly "return_code": number - readonly "stderr": string - readonly "stdout": string - readonly "type": "code_execution_result" -} -export const BetaRequestCodeExecutionResultBlock = Schema.Struct({ - "content": Schema.Array(BetaRequestCodeExecutionOutputBlock).annotate({ "title": "Content" }), - "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), - "stderr": Schema.String.annotate({ "title": "Stderr" }), - "stdout": Schema.String.annotate({ "title": "Stdout" }), - "type": Schema.Literal("code_execution_result").annotate({ "title": "Type" }) -}).annotate({ "title": "Result Block" }) -export type BetaRequestEncryptedCodeExecutionResultBlock = { - readonly "content": ReadonlyArray - readonly "encrypted_stdout": string - readonly "return_code": number - readonly "stderr": string - readonly "type": "encrypted_code_execution_result" -} -export const BetaRequestEncryptedCodeExecutionResultBlock = Schema.Struct({ - "content": Schema.Array(BetaRequestCodeExecutionOutputBlock).annotate({ "title": "Content" }), - "encrypted_stdout": Schema.String.annotate({ "title": "Encrypted Stdout" }), - "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), - "stderr": Schema.String.annotate({ "title": "Stderr" }), - "type": Schema.Literal("encrypted_code_execution_result").annotate({ "title": "Type" }) -}).annotate({ - "title": "RequestEncryptedCodeExecutionResultBlock", - "description": "Code execution result with encrypted stdout for PFC + web_search results." -}) -export type BetaRequestMCPServerURLDefinition = { - readonly "authorization_token"?: string | null - readonly "name": string - readonly "tool_configuration"?: BetaRequestMCPServerToolConfiguration | null - readonly "type": "url" - readonly "url": string + "type": Schema.Literal("computer_20251124").annotate({ "title": "Type" }) +}).annotate({ "title": "ComputerUseTool_20251124" }) +export type BetaMemoryTool_20250818 = { + readonly "allowed_callers"?: ReadonlyArray + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "defer_loading"?: boolean + readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> + readonly "name": "memory" + readonly "strict"?: boolean + readonly "type": "memory_20250818" } -export const BetaRequestMCPServerURLDefinition = Schema.Struct({ - "authorization_token": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Authorization Token" }) +export const BetaMemoryTool_20250818 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) ), - "name": Schema.String.annotate({ "title": "Name" }), - "tool_configuration": Schema.optionalKey(Schema.Union([BetaRequestMCPServerToolConfiguration, Schema.Null])), - "type": Schema.Literal("url").annotate({ "title": "Type" }), - "url": Schema.String.annotate({ "title": "Url" }) -}).annotate({ "title": "RequestMCPServerURLDefinition" }) -export type BetaRequestMCPToolResultBlock = { + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Defer Loading", + "description": + "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + }) + ), + "input_examples": Schema.optionalKey( + Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" }) + ), + "name": Schema.Literal("memory").annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." + }), + "strict": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" + }) + ), + "type": Schema.Literal("memory_20250818").annotate({ "title": "Type" }) +}).annotate({ "title": "MemoryTool_20250818" }) +export type BetaTextEditor_20241022 = { + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "content"?: - | string - | ReadonlyArray< - { - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "citations"?: - | ReadonlyArray< - | BetaRequestCharLocationCitation - | BetaRequestPageLocationCitation - | BetaRequestContentBlockLocationCitation - | BetaRequestWebSearchResultLocationCitation - | BetaRequestSearchResultLocationCitation - > - | null - readonly "text": string - readonly "type": "text" - } - > - readonly "is_error"?: boolean - readonly "tool_use_id": string - readonly "type": "mcp_tool_result" + readonly "defer_loading"?: boolean + readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> + readonly "name": "str_replace_editor" + readonly "strict"?: boolean + readonly "type": "text_editor_20241022" } -export const BetaRequestMCPToolResultBlock = Schema.Struct({ +export const BetaTextEditor_20241022 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "content": Schema.optionalKey( - Schema.Union([ - Schema.String, - Schema.Array( - Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "citations": Schema.optionalKey( - Schema.Union([ - Schema.Array( - Schema.Union([ - BetaRequestCharLocationCitation, - BetaRequestPageLocationCitation, - BetaRequestContentBlockLocationCitation, - BetaRequestWebSearchResultLocationCitation, - BetaRequestSearchResultLocationCitation - ], { mode: "oneOf" }) - ), - Schema.Null - ]).annotate({ "title": "Citations" }) - ), - "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(1)), - "type": Schema.Literal("text").annotate({ "title": "Type" }) - }).annotate({ "title": "beta_mcp_tool_result_block_param_content_item" }) - ).annotate({ "title": "beta_mcp_tool_result_block_param_content" }) - ]).annotate({ "title": "Content" }) + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Defer Loading", + "description": + "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + }) ), - "is_error": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Is Error" })), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$")) + "input_examples": Schema.optionalKey( + Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" }) ), - "type": Schema.Literal("mcp_tool_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestMCPToolResultBlock" }) -export type BetaRequestTextBlock = { + "name": Schema.Literal("str_replace_editor").annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." + }), + "strict": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" + }) + ), + "type": Schema.Literal("text_editor_20241022").annotate({ "title": "Type" }) +}).annotate({ "title": "TextEditor_20241022" }) +export type BetaTextEditor_20250124 = { + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "citations"?: - | ReadonlyArray< - | BetaRequestCharLocationCitation - | BetaRequestPageLocationCitation - | BetaRequestContentBlockLocationCitation - | BetaRequestWebSearchResultLocationCitation - | BetaRequestSearchResultLocationCitation - > - | null - readonly "text": string - readonly "type": "text" + readonly "defer_loading"?: boolean + readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> + readonly "name": "str_replace_editor" + readonly "strict"?: boolean + readonly "type": "text_editor_20250124" } -export const BetaRequestTextBlock = Schema.Struct({ +export const BetaTextEditor_20250124 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "citations": Schema.optionalKey( - Schema.Union([ - Schema.Array( - Schema.Union([ - BetaRequestCharLocationCitation, - BetaRequestPageLocationCitation, - BetaRequestContentBlockLocationCitation, - BetaRequestWebSearchResultLocationCitation, - BetaRequestSearchResultLocationCitation - ], { mode: "oneOf" }) - ), - Schema.Null - ]).annotate({ "title": "Citations" }) + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Defer Loading", + "description": + "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + }) ), - "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(1)), - "type": Schema.Literal("text").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestTextBlock" }) -export type BetaResponseBashCodeExecutionResultBlock = { - readonly "content": ReadonlyArray - readonly "return_code": number - readonly "stderr": string - readonly "stdout": string - readonly "type": "bash_code_execution_result" -} -export const BetaResponseBashCodeExecutionResultBlock = Schema.Struct({ - "content": Schema.Array(BetaResponseBashCodeExecutionOutputBlock).annotate({ "title": "Content" }), - "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), - "stderr": Schema.String.annotate({ "title": "Stderr" }), - "stdout": Schema.String.annotate({ "title": "Stdout" }), - "type": Schema.Literal("bash_code_execution_result").annotate({ - "title": "Type", - "default": "bash_code_execution_result" - }) -}).annotate({ "title": "ResponseBashCodeExecutionResultBlock" }) -export type BetaResponseDocumentBlock = { - readonly "citations": BetaResponseCitationsConfig | null - readonly "source": BetaBase64PDFSource | BetaPlainTextSource - readonly "title": string | null - readonly "type": "document" -} -export const BetaResponseDocumentBlock = Schema.Struct({ - "citations": Schema.Union([BetaResponseCitationsConfig, Schema.Null]).annotate({ - "description": "Citation configuration for the document", - "default": null - }), - "source": Schema.Union([BetaBase64PDFSource, BetaPlainTextSource], { mode: "oneOf" }).annotate({ "title": "Source" }), - "title": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Title", - "description": "The title of the document", - "default": null - }), - "type": Schema.Literal("document").annotate({ "title": "Type", "default": "document" }) -}).annotate({ "title": "ResponseDocumentBlock" }) -export type BetaResponseContextManagement = { - readonly "applied_edits": ReadonlyArray -} -export const BetaResponseContextManagement = Schema.Struct({ - "applied_edits": Schema.Array( - Schema.Union([BetaResponseClearToolUses20250919Edit, BetaResponseClearThinking20251015Edit], { mode: "oneOf" }) - ).annotate({ "title": "Applied Edits", "description": "List of context management edits that were applied." }) -}).annotate({ "title": "ResponseContextManagement" }) -export type BetaResponseCodeExecutionResultBlock = { - readonly "content": ReadonlyArray - readonly "return_code": number - readonly "stderr": string - readonly "stdout": string - readonly "type": "code_execution_result" -} -export const BetaResponseCodeExecutionResultBlock = Schema.Struct({ - "content": Schema.Array(BetaResponseCodeExecutionOutputBlock).annotate({ "title": "Content" }), - "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), - "stderr": Schema.String.annotate({ "title": "Stderr" }), - "stdout": Schema.String.annotate({ "title": "Stdout" }), - "type": Schema.Literal("code_execution_result").annotate({ "title": "Type", "default": "code_execution_result" }) -}).annotate({ "title": "ResponseCodeExecutionResultBlock" }) -export type BetaResponseEncryptedCodeExecutionResultBlock = { - readonly "content": ReadonlyArray - readonly "encrypted_stdout": string - readonly "return_code": number - readonly "stderr": string - readonly "type": "encrypted_code_execution_result" -} -export const BetaResponseEncryptedCodeExecutionResultBlock = Schema.Struct({ - "content": Schema.Array(BetaResponseCodeExecutionOutputBlock).annotate({ "title": "Content" }), - "encrypted_stdout": Schema.String.annotate({ "title": "Encrypted Stdout" }), - "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), - "stderr": Schema.String.annotate({ "title": "Stderr" }), - "type": Schema.Literal("encrypted_code_execution_result").annotate({ - "title": "Type", - "default": "encrypted_code_execution_result" - }) -}).annotate({ - "title": "ResponseEncryptedCodeExecutionResultBlock", - "description": "Code execution result with encrypted stdout for PFC + web_search results." -}) -export type BetaResponseToolSearchToolSearchResultBlock = { - readonly "tool_references": ReadonlyArray - readonly "type": "tool_search_tool_search_result" -} -export const BetaResponseToolSearchToolSearchResultBlock = Schema.Struct({ - "tool_references": Schema.Array(BetaResponseToolReferenceBlock).annotate({ "title": "Tool References" }), - "type": Schema.Literal("tool_search_tool_search_result").annotate({ - "title": "Type", - "default": "tool_search_tool_search_result" - }) -}).annotate({ "title": "ResponseToolSearchToolSearchResultBlock" }) -export type BetaCitationsDelta = { - readonly "citation": - | BetaResponseCharLocationCitation - | BetaResponsePageLocationCitation - | BetaResponseContentBlockLocationCitation - | BetaResponseWebSearchResultLocationCitation - | BetaResponseSearchResultLocationCitation - readonly "type": "citations_delta" -} -export const BetaCitationsDelta = Schema.Struct({ - "citation": Schema.Union([ - BetaResponseCharLocationCitation, - BetaResponsePageLocationCitation, - BetaResponseContentBlockLocationCitation, - BetaResponseWebSearchResultLocationCitation, - BetaResponseSearchResultLocationCitation - ], { mode: "oneOf" }).annotate({ "title": "Citation" }), - "type": Schema.Literal("citations_delta").annotate({ "title": "Type", "default": "citations_delta" }) -}).annotate({ "title": "CitationsDelta" }) -export type BetaResponseMCPToolResultBlock = { - readonly "content": - | string - | ReadonlyArray< - { - readonly "citations": - | ReadonlyArray< - | BetaResponseCharLocationCitation - | BetaResponsePageLocationCitation - | BetaResponseContentBlockLocationCitation - | BetaResponseWebSearchResultLocationCitation - | BetaResponseSearchResultLocationCitation - > - | null - readonly "text": string - readonly "type": "text" - } - > - readonly "is_error": boolean - readonly "tool_use_id": string - readonly "type": "mcp_tool_result" -} -export const BetaResponseMCPToolResultBlock = Schema.Struct({ - "content": Schema.Union([ - Schema.String, - Schema.Array( - Schema.Struct({ - "citations": Schema.Union([ - Schema.Array( - Schema.Union([ - BetaResponseCharLocationCitation, - BetaResponsePageLocationCitation, - BetaResponseContentBlockLocationCitation, - BetaResponseWebSearchResultLocationCitation, - BetaResponseSearchResultLocationCitation - ], { mode: "oneOf" }) - ), - Schema.Null - ]).annotate({ - "title": "Citations", - "description": - "Citations supporting the text block.\n\nThe type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.", - "default": null - }), - "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(0)).check( - Schema.isMaxLength(5000000) - ), - "type": Schema.Literal("text").annotate({ "title": "Type", "default": "text" }) - }).annotate({ "title": "beta_mcp_tool_result_block_content_item" }) - ).annotate({ "title": "beta_mcp_tool_result_block_content" }) - ]).annotate({ "title": "Content" }), - "is_error": Schema.Boolean.annotate({ "title": "Is Error", "default": false }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$")) + "input_examples": Schema.optionalKey( + Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" }) ), - "type": Schema.Literal("mcp_tool_result").annotate({ "title": "Type", "default": "mcp_tool_result" }) -}).annotate({ "title": "ResponseMCPToolResultBlock" }) -export type BetaResponseTextBlock = { - readonly "citations"?: - | ReadonlyArray< - | BetaResponseCharLocationCitation - | BetaResponsePageLocationCitation - | BetaResponseContentBlockLocationCitation - | BetaResponseWebSearchResultLocationCitation - | BetaResponseSearchResultLocationCitation - > - | null - readonly "text": string - readonly "type": "text" -} -export const BetaResponseTextBlock = Schema.Struct({ - "citations": Schema.optionalKey( - Schema.Union([ - Schema.Array( - Schema.Union([ - BetaResponseCharLocationCitation, - BetaResponsePageLocationCitation, - BetaResponseContentBlockLocationCitation, - BetaResponseWebSearchResultLocationCitation, - BetaResponseSearchResultLocationCitation - ], { mode: "oneOf" }) - ), - Schema.Null - ]).annotate({ - "title": "Citations", - "description": - "Citations supporting the text block.\n\nThe type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.", - "default": null + "name": Schema.Literal("str_replace_editor").annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." + }), + "strict": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" }) ), - "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(0)).check(Schema.isMaxLength(5000000)), - "type": Schema.Literal("text").annotate({ "title": "Type", "default": "text" }) -}).annotate({ "title": "ResponseTextBlock" }) -export type BetaRequestServerToolUseBlock = { + "type": Schema.Literal("text_editor_20250124").annotate({ "title": "Type" }) +}).annotate({ "title": "TextEditor_20250124" }) +export type BetaTextEditor_20250429 = { + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120 - readonly "id": string - readonly "input": { readonly [x: string]: Schema.Json } - readonly "name": - | "web_search" - | "web_fetch" - | "code_execution" - | "bash_code_execution" - | "text_editor_code_execution" - | "tool_search_tool_regex" - | "tool_search_tool_bm25" - readonly "type": "server_tool_use" + readonly "defer_loading"?: boolean + readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> + readonly "name": "str_replace_based_edit_tool" + readonly "strict"?: boolean + readonly "type": "text_editor_20250429" } -export const BetaRequestServerToolUseBlock = Schema.Struct({ +export const BetaTextEditor_20250429 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "caller": Schema.optionalKey( - Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate({ - "title": "Caller" + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Defer Loading", + "description": + "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." }) ), - "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))), - "input": Schema.Record(Schema.String, Schema.Json).annotate({ "title": "Input" }), - "name": Schema.Literals([ - "web_search", - "web_fetch", - "code_execution", - "bash_code_execution", - "text_editor_code_execution", - "tool_search_tool_regex", - "tool_search_tool_bm25" - ]).annotate({ "title": "Name" }), - "type": Schema.Literal("server_tool_use").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestServerToolUseBlock" }) -export type BetaResponseServerToolUseBlock = { - readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120 - readonly "id": string - readonly "input": { readonly [x: string]: Schema.Json } - readonly "name": - | "web_search" - | "web_fetch" - | "code_execution" - | "bash_code_execution" - | "text_editor_code_execution" - | "tool_search_tool_regex" - | "tool_search_tool_bm25" - readonly "type": "server_tool_use" -} -export const BetaResponseServerToolUseBlock = Schema.Struct({ - "caller": Schema.optionalKey( - Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate({ - "title": "Caller" - }) - ), - "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))), - "input": Schema.Record(Schema.String, Schema.Json).annotate({ "title": "Input" }), - "name": Schema.Literals([ - "web_search", - "web_fetch", - "code_execution", - "bash_code_execution", - "text_editor_code_execution", - "tool_search_tool_regex", - "tool_search_tool_bm25" - ]).annotate({ "title": "Name" }), - "type": Schema.Literal("server_tool_use").annotate({ "title": "Type", "default": "server_tool_use" }) -}).annotate({ "title": "ResponseServerToolUseBlock" }) -export type BetaResponseToolUseBlock = { - readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120 - readonly "id": string - readonly "input": { readonly [x: string]: Schema.Json } - readonly "name": string - readonly "type": "tool_use" -} -export const BetaResponseToolUseBlock = Schema.Struct({ - "caller": Schema.optionalKey( - Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate({ - "title": "Caller" - }) + "input_examples": Schema.optionalKey( + Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" }) ), - "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$"))), - "input": Schema.Record(Schema.String, Schema.Json).annotate({ "title": "Input" }), - "name": Schema.String.annotate({ "title": "Name" }).check(Schema.isMinLength(1)), - "type": Schema.Literal("tool_use").annotate({ "title": "Type", "default": "tool_use" }) -}).annotate({ "title": "ResponseToolUseBlock" }) -export type BetaContainer = { - readonly "expires_at": string - readonly "id": string - readonly "skills": ReadonlyArray | null -} -export const BetaContainer = Schema.Struct({ - "expires_at": Schema.String.annotate({ - "title": "Expires At", - "description": "The time at which the container will expire.", - "format": "date-time" + "name": Schema.Literal("str_replace_based_edit_tool").annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." }), - "id": Schema.String.annotate({ "title": "Id", "description": "Identifier for the container used in this request" }), - "skills": Schema.Union([Schema.Array(BetaSkill), Schema.Null]).annotate({ - "title": "Skills", - "description": "Skills loaded in the container", - "default": null - }) -}).annotate({ - "title": "Container", - "description": "Information about the container used in the request (for the code execution tool)" -}) -export type BetaContainerParams = { - readonly "id"?: string | null - readonly "skills"?: ReadonlyArray | null -} -export const BetaContainerParams = Schema.Struct({ - "id": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Id", "description": "Container id" }) - ), - "skills": Schema.optionalKey( - Schema.Union([Schema.Array(BetaSkillParams).check(Schema.isMaxLength(8)), Schema.Null]).annotate({ - "title": "Skills", - "description": "List of skills to load in the container" + "strict": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" }) - ) -}).annotate({ "title": "ContainerParams", "description": "Container parameters with skills to be loaded." }) -export type BetaListSkillVersionsResponse = { - readonly "data": ReadonlyArray - readonly "has_more": boolean - readonly "next_page": string | null -} -export const BetaListSkillVersionsResponse = Schema.Struct({ - "data": Schema.Array(BetaSkillVersion).annotate({ "title": "Data", "description": "List of skill versions." }), - "has_more": Schema.Boolean.annotate({ - "title": "Has More", - "description": "Indicates if there are more results in the requested page direction." - }), - "next_page": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Next Page", - "description": "Token to provide in as `page` in the subsequent request to retrieve the next page of data." - }) -}).annotate({ "title": "ListSkillVersionsResponse" }) -export type BetaRequestTextEditorCodeExecutionToolResultError = { - readonly "error_code": BetaTextEditorCodeExecutionToolResultErrorCode - readonly "error_message"?: string | null - readonly "type": "text_editor_code_execution_tool_result_error" -} -export const BetaRequestTextEditorCodeExecutionToolResultError = Schema.Struct({ - "error_code": BetaTextEditorCodeExecutionToolResultErrorCode, - "error_message": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Error Message" }) ), - "type": Schema.Literal("text_editor_code_execution_tool_result_error").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestTextEditorCodeExecutionToolResultError" }) -export type BetaResponseTextEditorCodeExecutionToolResultError = { - readonly "error_code": BetaTextEditorCodeExecutionToolResultErrorCode - readonly "error_message": string | null - readonly "type": "text_editor_code_execution_tool_result_error" -} -export const BetaResponseTextEditorCodeExecutionToolResultError = Schema.Struct({ - "error_code": BetaTextEditorCodeExecutionToolResultErrorCode, - "error_message": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Error Message", "default": null }), - "type": Schema.Literal("text_editor_code_execution_tool_result_error").annotate({ - "title": "Type", - "default": "text_editor_code_execution_tool_result_error" - }) -}).annotate({ "title": "ResponseTextEditorCodeExecutionToolResultError" }) -export type BetaThinkingConfigParam = - | BetaThinkingConfigEnabled - | BetaThinkingConfigDisabled - | BetaThinkingConfigAdaptive -export const BetaThinkingConfigParam = Schema.Union([ - BetaThinkingConfigEnabled, - BetaThinkingConfigDisabled, - BetaThinkingConfigAdaptive -], { mode: "oneOf" }).annotate({ - "title": "Thinking", - "description": - "Configuration for enabling Claude's extended thinking.\n\nWhen enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit.\n\nSee [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details." -}) -export type BetaClearThinking20251015 = { - readonly "keep"?: BetaThinkingTurns | BetaAllThinkingTurns | "all" - readonly "type": "clear_thinking_20251015" + "type": Schema.Literal("text_editor_20250429").annotate({ "title": "Type" }) +}).annotate({ "title": "TextEditor_20250429" }) +export type BetaTextEditor_20250728 = { + readonly "allowed_callers"?: ReadonlyArray + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "defer_loading"?: boolean + readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> + readonly "max_characters"?: number | null + readonly "name": "str_replace_based_edit_tool" + readonly "strict"?: boolean + readonly "type": "text_editor_20250728" } -export const BetaClearThinking20251015 = Schema.Struct({ - "keep": Schema.optionalKey( - Schema.Union([Schema.Union([BetaThinkingTurns, BetaAllThinkingTurns], { mode: "oneOf" }), Schema.Literal("all")]) - .annotate({ - "title": "Keep", - "description": - "Number of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed." - }) +export const BetaTextEditor_20250728 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) ), - "type": Schema.Literal("clear_thinking_20251015").annotate({ "title": "Type" }) -}).annotate({ "title": "ClearThinking20251015" }) -export type BetaToolChoice = BetaToolChoiceAuto | BetaToolChoiceAny | BetaToolChoiceTool | BetaToolChoiceNone -export const BetaToolChoice = Schema.Union([ - BetaToolChoiceAuto, - BetaToolChoiceAny, - BetaToolChoiceTool, - BetaToolChoiceNone -], { mode: "oneOf" }).annotate({ - "title": "Tool Choice", - "description": - "How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all." -}) -export type BetaRequestToolSearchToolResultError = { - readonly "error_code": BetaToolSearchToolResultErrorCode - readonly "type": "tool_search_tool_result_error" -} -export const BetaRequestToolSearchToolResultError = Schema.Struct({ - "error_code": BetaToolSearchToolResultErrorCode, - "type": Schema.Literal("tool_search_tool_result_error").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestToolSearchToolResultError" }) -export type BetaResponseToolSearchToolResultError = { - readonly "error_code": BetaToolSearchToolResultErrorCode - readonly "error_message": string | null - readonly "type": "tool_search_tool_result_error" -} -export const BetaResponseToolSearchToolResultError = Schema.Struct({ - "error_code": BetaToolSearchToolResultErrorCode, - "error_message": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Error Message", "default": null }), - "type": Schema.Literal("tool_search_tool_result_error").annotate({ - "title": "Type", - "default": "tool_search_tool_result_error" - }) -}).annotate({ "title": "ResponseToolSearchToolResultError" }) -export type BetaClearToolUses20250919 = { - readonly "clear_at_least"?: BetaInputTokensClearAtLeast | null - readonly "clear_tool_inputs"?: boolean | ReadonlyArray | null - readonly "exclude_tools"?: ReadonlyArray | null - readonly "keep"?: BetaToolUsesKeep - readonly "trigger"?: BetaInputTokensTrigger | BetaToolUsesTrigger - readonly "type": "clear_tool_uses_20250919" -} -export const BetaClearToolUses20250919 = Schema.Struct({ - "clear_at_least": Schema.optionalKey( - Schema.Union([BetaInputTokensClearAtLeast, Schema.Null]).annotate({ + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Defer Loading", "description": - "Minimum number of tokens that must be cleared when triggered. Context will only be modified if at least this many tokens can be removed." + "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." }) ), - "clear_tool_inputs": Schema.optionalKey( - Schema.Union([Schema.Boolean, Schema.Array(Schema.String), Schema.Null]).annotate({ - "title": "Clear Tool Inputs", - "description": "Whether to clear all tool inputs (bool) or specific tool inputs to clear (list)" - }) + "input_examples": Schema.optionalKey( + Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" }) ), - "exclude_tools": Schema.optionalKey( - Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ - "title": "Exclude Tools", - "description": "Tool names whose uses are preserved from clearing" + "max_characters": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), Schema.Null]).annotate({ + "title": "Max Characters", + "description": + "Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file." }) ), - "keep": Schema.optionalKey( - Schema.Union([BetaToolUsesKeep], { mode: "oneOf" }).annotate({ - "title": "Keep", - "description": "Number of tool uses to retain in the conversation" + "name": Schema.Literal("str_replace_based_edit_tool").annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." + }), + "strict": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" }) ), - "trigger": Schema.optionalKey( - Schema.Union([BetaInputTokensTrigger, BetaToolUsesTrigger], { mode: "oneOf" }).annotate({ - "title": "Trigger", - "description": "Condition that triggers the context management strategy" - }) - ), - "type": Schema.Literal("clear_tool_uses_20250919").annotate({ "title": "Type" }) -}).annotate({ "title": "ClearToolUses20250919" }) -export type BetaRequestImageBlock = { + "type": Schema.Literal("text_editor_20250728").annotate({ "title": "Type" }) +}).annotate({ "title": "TextEditor_20250728" }) +export type BetaTool = { + readonly "type"?: null | "custom" + readonly "description"?: string + readonly "name": string + readonly "input_schema": { + readonly "properties"?: { readonly [x: string]: unknown } | null + readonly "required"?: ReadonlyArray | null + readonly "type": "object" + readonly [x: string]: unknown + } readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "source": BetaBase64ImageSource | BetaURLImageSource | BetaFileImageSource - readonly "type": "image" + readonly "strict"?: boolean + readonly "eager_input_streaming"?: boolean | null + readonly "allowed_callers"?: ReadonlyArray + readonly "defer_loading"?: boolean + readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: BetaJsonValue }> } -export const BetaRequestImageBlock = Schema.Struct({ +export const BetaTool = Schema.Struct({ + "type": Schema.optionalKey(Schema.Union([Schema.Null, Schema.Literal("custom")]).annotate({ "title": "Type" })), + "description": Schema.optionalKey(Schema.String.annotate({ + "title": "Description", + "description": + "Description of what this tool does.\n\nTool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema." + })), + "name": Schema.String.annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(128)).check( + Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]{1,128}$")) + ), + "input_schema": Schema.StructWithRest( + Schema.Struct({ + "properties": Schema.optionalKey( + Schema.Union([Schema.Record(Schema.String, Schema.Unknown), Schema.Null]).annotate({ "title": "Properties" }) + ), + "required": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Required" }) + ), + "type": Schema.Literal("object").annotate({ "title": "Type" }) + }), + [Schema.Record(Schema.String, Schema.Unknown)] + ).annotate({ + "title": "InputSchema", + "description": + "[JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.\n\nThis defines the shape of the `input` that your tool accepts and that the model will produce." + }), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "source": Schema.Union([BetaBase64ImageSource, BetaURLImageSource, BetaFileImageSource], { mode: "oneOf" }).annotate({ - "title": "Source" - }), - "type": Schema.Literal("image").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestImageBlock" }) -export type BetaWebSearchTool_20250305 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "allowed_domains"?: ReadonlyArray | null - readonly "blocked_domains"?: ReadonlyArray | null - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "defer_loading"?: boolean - readonly "max_uses"?: number | null - readonly "name": "web_search" - readonly "strict"?: boolean - readonly "type": "web_search_20250305" - readonly "user_location"?: BetaUserLocation | null -} -export const BetaWebSearchTool_20250305 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" + "strict": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" }) ), - "allowed_domains": Schema.optionalKey( - Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ - "title": "Allowed Domains", + "eager_input_streaming": Schema.optionalKey( + Schema.Union([Schema.Boolean, Schema.Null]).annotate({ + "title": "Eager Input Streaming", "description": - "If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`." + "Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers." }) ), - "blocked_domains": Schema.optionalKey( - Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ - "title": "Blocked Domains", + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Defer Loading", "description": - "If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`." + "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." }) ), + "input_examples": Schema.optionalKey( + Schema.Array(Schema.Record(Schema.String, BetaJsonValue)).annotate({ "title": "Input Examples" }) + ) +}).annotate({ "title": "Tool" }) +export type BetaMCPToolset = { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "configs"?: { readonly [x: string]: BetaMCPToolConfig } | null + readonly "default_config"?: { readonly "defer_loading"?: boolean; readonly "enabled"?: boolean } + readonly "mcp_server_name": string + readonly "type": "mcp_toolset" +} +export const BetaMCPToolset = Schema.Struct({ "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "defer_loading": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Defer Loading", - "description": - "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + "configs": Schema.optionalKey( + Schema.Union([Schema.Record(Schema.String, BetaMCPToolConfig), Schema.Null]).annotate({ + "title": "Configs", + "description": "Configuration overrides for specific tools, keyed by tool name" }) ), - "max_uses": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ - "title": "Max Uses", - "description": "Maximum number of times the tool can be used in the API request." + "default_config": Schema.optionalKey( + Schema.Struct({ + "defer_loading": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Defer Loading" })), + "enabled": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Enabled" })) + }).annotate({ + "title": "MCPToolDefaultConfig", + "description": "Default configuration applied to all tools from this server" }) ), - "name": Schema.Literal("web_search").annotate({ - "title": "Name", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." - }), - "strict": Schema.optionalKey( + "mcp_server_name": Schema.String.annotate({ + "title": "Mcp Server Name", + "description": "Name of the MCP server to configure tools for" + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), + "type": Schema.Literal("mcp_toolset").annotate({ "title": "Type" }) +}).annotate({ + "title": "MCPToolset", + "description": + "Configuration for a group of tools from an MCP server.\n\nAllows configuring enabled status and defer_loading for all tools\nfrom an MCP server, with optional per-tool overrides." +}) +export type BetaManagedAgentsMultiagentCoordinator = { + readonly "type": "coordinator" + readonly "agents": ReadonlyArray +} +export const BetaManagedAgentsMultiagentCoordinator = Schema.Struct({ + "type": Schema.Literal("coordinator"), + "agents": Schema.Array(BetaManagedAgentsAgentReference).annotate({ + "description": "Agents the coordinator may spawn as session threads, each resolved to a specific version." + }) +}).annotate({ "description": "Resolved coordinator topology with a concrete agent roster." }) +export type BetaManagedAgentsAgentToolConfigParams = { + readonly "name": BetaManagedAgentsAgentToolName + readonly "enabled"?: boolean + readonly "permission_policy"?: { readonly "type": "always_allow" } | { readonly "type": "always_ask" } +} +export const BetaManagedAgentsAgentToolConfigParams = Schema.Struct({ + "name": BetaManagedAgentsAgentToolName, + "enabled": Schema.optionalKey( Schema.Boolean.annotate({ - "title": "Strict", - "description": "When true, guarantees schema validation on tool names and inputs" + "description": "Whether this tool is enabled and available to Claude. Overrides the default_config setting." }) ), - "type": Schema.Literal("web_search_20250305").annotate({ "title": "Type" }), - "user_location": Schema.optionalKey( - Schema.Union([BetaUserLocation, Schema.Null]).annotate({ - "description": "Parameters for the user's location. Used to provide more relevant search results." + "permission_policy": Schema.optionalKey( + Schema.Union([ + Schema.Struct({ "type": Schema.Literal("always_allow") }).annotate({ + "description": "Permission policy for tool execution." + }), + Schema.Struct({ "type": Schema.Literal("always_ask") }).annotate({ + "description": "Permission policy for tool execution." + }) + ], { mode: "oneOf" }).annotate({ + "description": + "Permission policy for this tool. Controls whether tool calls are auto-approved or require confirmation." }) ) -}).annotate({ "title": "WebSearchTool_20250305" }) -export type BetaWebSearchTool_20260209 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "allowed_domains"?: ReadonlyArray | null - readonly "blocked_domains"?: ReadonlyArray | null - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "defer_loading"?: boolean - readonly "max_uses"?: number | null - readonly "name": "web_search" - readonly "strict"?: boolean - readonly "type": "web_search_20260209" - readonly "user_location"?: BetaUserLocation | null -} -export const BetaWebSearchTool_20260209 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" +}).annotate({ "description": "Configuration override for a specific tool within a toolset." }) +export type BetaManagedAgentsSkill = BetaManagedAgentsAnthropicSkill | BetaManagedAgentsCustomSkill +export const BetaManagedAgentsSkill = Schema.Union([BetaManagedAgentsAnthropicSkill, BetaManagedAgentsCustomSkill], { + mode: "oneOf" +}).annotate({ "description": "Resolved skill as returned in API responses." }) +export type BetaManagedAgentsSkillParams = BetaManagedAgentsAnthropicSkillParams | BetaManagedAgentsCustomSkillParams +export const BetaManagedAgentsSkillParams = Schema.Union([ + BetaManagedAgentsAnthropicSkillParams, + BetaManagedAgentsCustomSkillParams +], { mode: "oneOf" }).annotate({ "description": "Skill to load in the session container." }) +export type BetaManagedAgentsListMemoriesResult = { + readonly "data"?: ReadonlyArray + readonly "next_page"?: string +} +export const BetaManagedAgentsListMemoriesResult = Schema.Struct({ + "data": Schema.optionalKey( + Schema.Array(BetaManagedAgentsMemoryListItem).annotate({ + "description": + "One page of results. Each item is either a `memory` object or, when `depth` was set, a `memory_prefix` rollup marker. Items appear in the requested `order_by`/`order`." }) ), - "allowed_domains": Schema.optionalKey( - Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ - "title": "Allowed Domains", + "next_page": Schema.optionalKey( + Schema.String.annotate({ "description": - "If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`." + "Opaque cursor for the next page (a `page_...` value), or `null` if there are no more results. Pass as `page` on the next request." + }) + ) +}).annotate({ "description": "Response payload for [List memories](/en/api/beta/memory_stores/memories/list)." }) +export type BetaManagedAgentsListMemoryStoresResponse = { + readonly "data"?: ReadonlyArray + readonly "next_page"?: string +} +export const BetaManagedAgentsListMemoryStoresResponse = Schema.Struct({ + "data": Schema.optionalKey( + Schema.Array(BetaManagedAgentsMemoryStore).annotate({ + "description": "Memory stores on this page, newest first. Empty when there are no stores matching the filters." }) ), - "blocked_domains": Schema.optionalKey( - Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ - "title": "Blocked Domains", + "next_page": Schema.optionalKey( + Schema.String.annotate({ "description": - "If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`." + "Opaque cursor for the next page (a `page_...` value). Pass as `page` on the next request. `null` when there are no more results." }) - ), - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." + ) +}).annotate({ "description": "A page of `memory_store` results, ordered by `created_at` descending (newest first)." }) +export type BetaManagedAgentsListMemoryVersionsResult = { + readonly "data"?: ReadonlyArray + readonly "next_page"?: string +} +export const BetaManagedAgentsListMemoryVersionsResult = Schema.Struct({ + "data": Schema.optionalKey( + Schema.Array(BetaManagedAgentsMemoryVersion).annotate({ + "description": + "One page of `memory_version` objects, ordered by `created_at` descending (newest first), with `id` as tiebreak." }) ), - "defer_loading": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Defer Loading", + "next_page": Schema.optionalKey( + Schema.String.annotate({ "description": - "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + "Opaque cursor for the next page (a `page_...` value), or `null` if there are no more results. Pass as `page` on the next request." }) + ) +}).annotate({ + "description": "Response payload for [List memory versions](/en/api/beta/memory_stores/memory_versions/list)." +}) +export type BetaManagedAgentsMultiagentRosterEntryParams = + | string + | BetaManagedAgentsAgentParams + | BetaManagedAgentsMultiagentSelfParams +export const BetaManagedAgentsMultiagentRosterEntryParams = Schema.Union([ + Schema.String, + Schema.Union([BetaManagedAgentsAgentParams, BetaManagedAgentsMultiagentSelfParams], { mode: "oneOf" }) +], { mode: "oneOf" }).annotate({ + "description": "An entry in a multiagent roster: an agent ID string, a versioned agent reference, or `self`." +}) +export type BetaManagedAgentsAgentToolConfig = { + readonly "name": BetaManagedAgentsAgentToolName + readonly "enabled": boolean + readonly "permission_policy": BetaManagedAgentsPermissionPolicy +} +export const BetaManagedAgentsAgentToolConfig = Schema.Struct({ + "name": BetaManagedAgentsAgentToolName, + "enabled": Schema.Boolean, + "permission_policy": BetaManagedAgentsPermissionPolicy +}).annotate({ "description": "Configuration for a specific agent tool." }) +export type BetaManagedAgentsAgentToolsetDefaultConfig = { + readonly "enabled": boolean + readonly "permission_policy": BetaManagedAgentsPermissionPolicy +} +export const BetaManagedAgentsAgentToolsetDefaultConfig = Schema.Struct({ + "enabled": Schema.Boolean, + "permission_policy": BetaManagedAgentsPermissionPolicy +}).annotate({ "description": "Resolved default configuration for agent tools." }) +export type BetaManagedAgentsMCPToolConfig = { + readonly "name": string + readonly "enabled": boolean + readonly "permission_policy": BetaManagedAgentsPermissionPolicy +} +export const BetaManagedAgentsMCPToolConfig = Schema.Struct({ + "name": Schema.String, + "enabled": Schema.Boolean, + "permission_policy": BetaManagedAgentsPermissionPolicy +}).annotate({ "description": "Resolved configuration for a specific MCP tool." }) +export type BetaManagedAgentsMCPToolsetDefaultConfig = { + readonly "enabled": boolean + readonly "permission_policy": BetaManagedAgentsPermissionPolicy +} +export const BetaManagedAgentsMCPToolsetDefaultConfig = Schema.Struct({ + "enabled": Schema.Boolean, + "permission_policy": BetaManagedAgentsPermissionPolicy +}).annotate({ "description": "Resolved default configuration for all tools from an MCP server." }) +export type BetaManagedAgentsToolResultContentBlock = { readonly "type": "text"; readonly "text": string } | { + readonly "type": "image" + readonly "source": { readonly "type": "base64"; readonly "media_type": string; readonly "data": string } | { + readonly "type": "url" + readonly "url": string + } | { readonly "type": "file"; readonly "file_id": string } +} | { + readonly "type": "document" + readonly "source": + | { readonly "type": "base64"; readonly "media_type": string; readonly "data": string } + | { readonly "type": "text"; readonly "media_type": "text/plain"; readonly "data": string } + | { readonly "type": "url"; readonly "url": string } + | { readonly "type": "file"; readonly "file_id": string } + readonly "title"?: string + readonly "context"?: string +} | { + readonly "type": "search_result" + readonly "source": string + readonly "title": string + readonly "content": ReadonlyArray + readonly "citations": { readonly "enabled": boolean } +} +export const BetaManagedAgentsToolResultContentBlock = Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("text"), + "text": Schema.String.annotate({ "description": "The text content." }).check(Schema.isMinLength(1)) + }).annotate({ + "description": "Content block in a tool result. Can be `text`, `image`, `document`, or `search_result`." + }), + Schema.Struct({ + "type": Schema.Literal("image"), + "source": Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("base64"), + "media_type": Schema.String.annotate({ + "description": "MIME type of the image (e.g., \"image/png\", \"image/jpeg\", \"image/gif\", \"image/webp\")." + }).check(Schema.isMinLength(1)), + "data": Schema.String.annotate({ "description": "Base64-encoded image data." }).check(Schema.isMinLength(1)) + }).annotate({ "description": "Union type for image source variants." }), + Schema.Struct({ + "type": Schema.Literal("url"), + "url": Schema.String.annotate({ "description": "URL of the image to fetch." }).check(Schema.isMinLength(1)) + }).annotate({ "description": "Union type for image source variants." }), + Schema.Struct({ + "type": Schema.Literal("file"), + "file_id": Schema.String.annotate({ "description": "ID of a previously uploaded file." }).check( + Schema.isMinLength(1) + ) + }).annotate({ "description": "Union type for image source variants." }) + ], { mode: "oneOf" }).annotate({ "description": "The source of the image data." }) + }).annotate({ + "description": "Content block in a tool result. Can be `text`, `image`, `document`, or `search_result`." + }), + Schema.Struct({ + "type": Schema.Literal("document"), + "source": Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("base64"), + "media_type": Schema.String.annotate({ + "description": "MIME type of the document (e.g., \"application/pdf\")." + }).check(Schema.isMinLength(1)), + "data": Schema.String.annotate({ "description": "Base64-encoded document data." }).check(Schema.isMinLength(1)) + }).annotate({ "description": "Union type for document source variants." }), + Schema.Struct({ + "type": Schema.Literal("text"), + "media_type": Schema.Literal("text/plain").annotate({ + "description": "MIME type of the text content. Must be \"text/plain\"." + }), + "data": Schema.String.annotate({ "description": "The plain text content." }).check(Schema.isMinLength(1)) + }).annotate({ "description": "Union type for document source variants." }), + Schema.Struct({ + "type": Schema.Literal("url"), + "url": Schema.String.annotate({ "description": "URL of the document to fetch." }).check(Schema.isMinLength(1)) + }).annotate({ "description": "Union type for document source variants." }), + Schema.Struct({ + "type": Schema.Literal("file"), + "file_id": Schema.String.annotate({ "description": "ID of a previously uploaded file." }).check( + Schema.isMinLength(1) + ) + }).annotate({ "description": "Union type for document source variants." }) + ], { mode: "oneOf" }).annotate({ "description": "The source of the document data." }), + "title": Schema.optionalKey(Schema.String.annotate({ "description": "The title of the document." })), + "context": Schema.optionalKey( + Schema.String.annotate({ "description": "Additional context about the document for the model." }) + ) + }).annotate({ + "description": "Content block in a tool result. Can be `text`, `image`, `document`, or `search_result`." + }), + Schema.Struct({ + "type": Schema.Literal("search_result"), + "source": Schema.String.annotate({ "description": "The URL source of the search result." }).check( + Schema.isMinLength(1) + ), + "title": Schema.String.annotate({ "description": "The title of the search result." }).check(Schema.isMinLength(1)), + "content": Schema.Array(BetaManagedAgentsSearchResultContent).annotate({ + "description": "Array of text content blocks from the search result." + }), + "citations": Schema.Struct({ + "enabled": Schema.Boolean.annotate({ "description": "Whether citations are enabled for this search result." }) + }).annotate({ "description": "Citation settings for a search result." }) + }).annotate({ + "description": "Content block in a tool result. Can be `text`, `image`, `document`, or `search_result`." + }) +], { mode: "oneOf" }) +export type BetaManagedAgentsCreateSessionParams = { + readonly "agent": string | BetaManagedAgentsAgentParams + readonly "environment_id": string + readonly "title"?: string + readonly "metadata"?: { readonly [x: string]: string } + readonly "resources"?: ReadonlyArray + readonly "vault_ids"?: ReadonlyArray +} +export const BetaManagedAgentsCreateSessionParams = Schema.Struct({ + "agent": Schema.Union([Schema.String, Schema.Union([BetaManagedAgentsAgentParams], { mode: "oneOf" })], { + mode: "oneOf" + }).annotate({ + "description": + "Agent identifier. Accepts the `agent` ID string, which pins the latest version for the session, or an `agent` object with both id and version specified." + }), + "environment_id": Schema.String.annotate({ + "description": "ID of the `environment` defining the container configuration for this session." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(128)), + "title": Schema.optionalKey( + Schema.String.annotate({ "description": "Human-readable session title." }).check(Schema.isMaxLength(500)) ), - "max_uses": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ - "title": "Max Uses", - "description": "Maximum number of times the tool can be used in the API request." + "metadata": Schema.optionalKey( + Schema.Record(Schema.String, Schema.String).annotate({ + "description": + "Arbitrary key-value metadata attached to the session. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars." }) ), - "name": Schema.Literal("web_search").annotate({ - "title": "Name", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." - }), - "strict": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Strict", - "description": "When true, guarantees schema validation on tool names and inputs" + "resources": Schema.optionalKey( + Schema.Array(BetaManagedAgentsSessionResourceParams).annotate({ + "description": "Resources (e.g. repositories, files) to mount into the session's container." }) ), - "type": Schema.Literal("web_search_20260209").annotate({ "title": "Type" }), - "user_location": Schema.optionalKey( - Schema.Union([BetaUserLocation, Schema.Null]).annotate({ - "description": "Parameters for the user's location. Used to provide more relevant search results." + "vault_ids": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "description": "Vault IDs for stored credentials the agent can use during the session." }) ) -}).annotate({ "title": "WebSearchTool_20260209" }) -export type BetaRequestWebFetchToolResultError = { - readonly "error_code": BetaWebFetchToolResultErrorCode - readonly "type": "web_fetch_tool_result_error" -} -export const BetaRequestWebFetchToolResultError = Schema.Struct({ - "error_code": BetaWebFetchToolResultErrorCode, - "type": Schema.Literal("web_fetch_tool_result_error").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestWebFetchToolResultError" }) -export type BetaResponseWebFetchToolResultError = { - readonly "error_code": BetaWebFetchToolResultErrorCode - readonly "type": "web_fetch_tool_result_error" -} -export const BetaResponseWebFetchToolResultError = Schema.Struct({ - "error_code": BetaWebFetchToolResultErrorCode, - "type": Schema.Literal("web_fetch_tool_result_error").annotate({ - "title": "Type", - "default": "web_fetch_tool_result_error" - }) -}).annotate({ "title": "ResponseWebFetchToolResultError" }) -export type BetaRequestWebSearchToolResultError = { - readonly "error_code": BetaWebSearchToolResultErrorCode - readonly "type": "web_search_tool_result_error" -} -export const BetaRequestWebSearchToolResultError = Schema.Struct({ - "error_code": BetaWebSearchToolResultErrorCode, - "type": Schema.Literal("web_search_tool_result_error").annotate({ "title": "Type" }) -}).annotate({ "title": "Error" }) -export type BetaResponseWebSearchToolResultError = { - readonly "error_code": BetaWebSearchToolResultErrorCode - readonly "type": "web_search_tool_result_error" -} -export const BetaResponseWebSearchToolResultError = Schema.Struct({ - "error_code": BetaWebSearchToolResultErrorCode, - "type": Schema.Literal("web_search_tool_result_error").annotate({ - "title": "Type", - "default": "web_search_tool_result_error" - }) -}).annotate({ "title": "ResponseWebSearchToolResultError" }) -export type BetaListSkillsResponse = { - readonly "data": ReadonlyArray +}).annotate({ "description": "Request parameters for creating a `session`." }) +export type BetaListResponse_MessageBatch_ = { + readonly "data": ReadonlyArray + readonly "first_id": string | null readonly "has_more": boolean - readonly "next_page": string | null + readonly "last_id": string | null } -export const BetaListSkillsResponse = Schema.Struct({ - "data": Schema.Array(Betaapi__schemas__skills__Skill).annotate({ "title": "Data", "description": "List of skills." }), +export const BetaListResponse_MessageBatch_ = Schema.Struct({ + "data": Schema.Array(BetaMessageBatch).annotate({ "title": "Data" }), + "first_id": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "First Id", + "description": "First ID in the `data` list. Can be used as the `before_id` for the previous page." + }), "has_more": Schema.Boolean.annotate({ "title": "Has More", - "description": - "Whether there are more results available.\n\nIf `true`, there are additional results that can be fetched using the `next_page` token." + "description": "Indicates if there are more results in the requested page direction." }), - "next_page": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Next Page", - "description": - "Token for fetching the next page of results.\n\nIf `null`, there are no more results available. Pass this value to the `page_token` parameter in the next request to get the next page." + "last_id": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Last Id", + "description": "Last ID in the `data` list. Can be used as the `after_id` for the next page." }) -}).annotate({ "title": "ListSkillsResponse" }) -export type CodeExecutionTool_20250522 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "cache_control"?: CacheControlEphemeral | null +}).annotate({ "title": "ListResponse[MessageBatch]" }) +export type BetaErrorResponse = { + readonly "error": + | BetaInvalidRequestError + | BetaAuthenticationError + | BetaBillingError + | BetaPermissionError + | BetaNotFoundError + | BetaRateLimitError + | BetaGatewayTimeoutError + | BetaAPIError + | BetaOverloadedError + readonly "request_id": string | null + readonly "type": "error" +} +export const BetaErrorResponse = Schema.Struct({ + "error": Schema.Union([ + BetaInvalidRequestError, + BetaAuthenticationError, + BetaBillingError, + BetaPermissionError, + BetaNotFoundError, + BetaRateLimitError, + BetaGatewayTimeoutError, + BetaAPIError, + BetaOverloadedError + ], { mode: "oneOf" }).annotate({ "title": "Error" }), + "request_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Request Id", "default": null }), + "type": Schema.Literal("error").annotate({ "title": "Type", "default": "error" }) +}).annotate({ "title": "ErrorResponse" }) +export type BetaRequestBashCodeExecutionResultBlock = { + readonly "content": ReadonlyArray + readonly "return_code": number + readonly "stderr": string + readonly "stdout": string + readonly "type": "bash_code_execution_result" +} +export const BetaRequestBashCodeExecutionResultBlock = Schema.Struct({ + "content": Schema.Array(BetaRequestBashCodeExecutionOutputBlock).annotate({ "title": "Content" }), + "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), + "stderr": Schema.String.annotate({ "title": "Stderr" }), + "stdout": Schema.String.annotate({ "title": "Stdout" }), + "type": Schema.Literal("bash_code_execution_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestBashCodeExecutionResultBlock" }) +export type BetaWebFetchTool_20250910 = { + readonly "allowed_callers"?: ReadonlyArray + readonly "allowed_domains"?: ReadonlyArray | null + readonly "blocked_domains"?: ReadonlyArray | null + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "citations"?: BetaRequestCitationsConfig | null readonly "defer_loading"?: boolean - readonly "name": "code_execution" + readonly "max_content_tokens"?: number | null + readonly "max_uses"?: number | null + readonly "name": "web_fetch" readonly "strict"?: boolean - readonly "type": "code_execution_20250522" + readonly "type": "web_fetch_20250910" } -export const CodeExecutionTool_20250522 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" +export const BetaWebFetchTool_20250910 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), + "allowed_domains": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Allowed Domains", + "description": "List of domains to allow fetching from" + }) + ), + "blocked_domains": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Blocked Domains", + "description": "List of domains to block fetching from" }) ), "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), + "citations": Schema.optionalKey( + Schema.Union([BetaRequestCitationsConfig, Schema.Null]).annotate({ + "description": "Citations configuration for fetched documents. Citations are disabled by default." + }) + ), "defer_loading": Schema.optionalKey( Schema.Boolean.annotate({ "title": "Defer Loading", @@ -5182,7 +6229,20 @@ export const CodeExecutionTool_20250522 = Schema.Struct({ "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." }) ), - "name": Schema.Literal("code_execution").annotate({ + "max_content_tokens": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ + "title": "Max Content Tokens", + "description": + "Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs." + }) + ), + "max_uses": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ + "title": "Max Uses", + "description": "Maximum number of times the tool can be used in the API request." + }) + ), + "name": Schema.Literal("web_fetch").annotate({ "title": "Name", "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." }), @@ -5192,28 +6252,46 @@ export const CodeExecutionTool_20250522 = Schema.Struct({ "description": "When true, guarantees schema validation on tool names and inputs" }) ), - "type": Schema.Literal("code_execution_20250522").annotate({ "title": "Type" }) -}).annotate({ "title": "CodeExecutionTool_20250522" }) -export type CodeExecutionTool_20250825 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "cache_control"?: CacheControlEphemeral | null + "type": Schema.Literal("web_fetch_20250910").annotate({ "title": "Type" }) +}).annotate({ "title": "WebFetchTool_20250910" }) +export type BetaWebFetchTool_20260209 = { + readonly "allowed_callers"?: ReadonlyArray + readonly "allowed_domains"?: ReadonlyArray | null + readonly "blocked_domains"?: ReadonlyArray | null + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "citations"?: BetaRequestCitationsConfig | null readonly "defer_loading"?: boolean - readonly "name": "code_execution" + readonly "max_content_tokens"?: number | null + readonly "max_uses"?: number | null + readonly "name": "web_fetch" readonly "strict"?: boolean - readonly "type": "code_execution_20250825" + readonly "type": "web_fetch_20260209" } -export const CodeExecutionTool_20250825 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" +export const BetaWebFetchTool_20260209 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), + "allowed_domains": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Allowed Domains", + "description": "List of domains to allow fetching from" + }) + ), + "blocked_domains": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Blocked Domains", + "description": "List of domains to block fetching from" }) ), "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), + "citations": Schema.optionalKey( + Schema.Union([BetaRequestCitationsConfig, Schema.Null]).annotate({ + "description": "Citations configuration for fetched documents. Citations are disabled by default." + }) + ), "defer_loading": Schema.optionalKey( Schema.Boolean.annotate({ "title": "Defer Loading", @@ -5221,7 +6299,20 @@ export const CodeExecutionTool_20250825 = Schema.Struct({ "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." }) ), - "name": Schema.Literal("code_execution").annotate({ + "max_content_tokens": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ + "title": "Max Content Tokens", + "description": + "Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs." + }) + ), + "max_uses": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ + "title": "Max Uses", + "description": "Maximum number of times the tool can be used in the API request." + }) + ), + "name": Schema.Literal("web_fetch").annotate({ "title": "Name", "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." }), @@ -5231,28 +6322,47 @@ export const CodeExecutionTool_20250825 = Schema.Struct({ "description": "When true, guarantees schema validation on tool names and inputs" }) ), - "type": Schema.Literal("code_execution_20250825").annotate({ "title": "Type" }) -}).annotate({ "title": "CodeExecutionTool_20250825" }) -export type CodeExecutionTool_20260120 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "cache_control"?: CacheControlEphemeral | null + "type": Schema.Literal("web_fetch_20260209").annotate({ "title": "Type" }) +}).annotate({ "title": "WebFetchTool_20260209" }) +export type BetaWebFetchTool_20260309 = { + readonly "allowed_callers"?: ReadonlyArray + readonly "allowed_domains"?: ReadonlyArray | null + readonly "blocked_domains"?: ReadonlyArray | null + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "citations"?: BetaRequestCitationsConfig | null readonly "defer_loading"?: boolean - readonly "name": "code_execution" + readonly "max_content_tokens"?: number | null + readonly "max_uses"?: number | null + readonly "name": "web_fetch" readonly "strict"?: boolean - readonly "type": "code_execution_20260120" + readonly "type": "web_fetch_20260309" + readonly "use_cache"?: boolean } -export const CodeExecutionTool_20260120 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" +export const BetaWebFetchTool_20260309 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), + "allowed_domains": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Allowed Domains", + "description": "List of domains to allow fetching from" + }) + ), + "blocked_domains": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Blocked Domains", + "description": "List of domains to block fetching from" }) ), "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), + "citations": Schema.optionalKey( + Schema.Union([BetaRequestCitationsConfig, Schema.Null]).annotate({ + "description": "Citations configuration for fetched documents. Citations are disabled by default." + }) + ), "defer_loading": Schema.optionalKey( Schema.Boolean.annotate({ "title": "Defer Loading", @@ -5260,7 +6370,20 @@ export const CodeExecutionTool_20260120 = Schema.Struct({ "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." }) ), - "name": Schema.Literal("code_execution").annotate({ + "max_content_tokens": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ + "title": "Max Content Tokens", + "description": + "Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs." + }) + ), + "max_uses": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ + "title": "Max Uses", + "description": "Maximum number of times the tool can be used in the API request." + }) + ), + "name": Schema.Literal("web_fetch").annotate({ "title": "Name", "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." }), @@ -5270,609 +6393,1442 @@ export const CodeExecutionTool_20260120 = Schema.Struct({ "description": "When true, guarantees schema validation on tool names and inputs" }) ), - "type": Schema.Literal("code_execution_20260120").annotate({ "title": "Type" }) + "type": Schema.Literal("web_fetch_20260309").annotate({ "title": "Type" }), + "use_cache": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Use Cache", + "description": + "Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources." + }) + ) }).annotate({ - "title": "CodeExecutionTool_20260120", - "description": "Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint)." + "title": "WebFetchTool_20260309", + "description": "Web fetch tool with use_cache parameter for bypassing cached content." }) -export type RequestContainerUploadBlock = { - readonly "cache_control"?: CacheControlEphemeral | null - readonly "file_id": string - readonly "type": "container_upload" +export type BetaRequestCodeExecutionResultBlock = { + readonly "content": ReadonlyArray + readonly "return_code": number + readonly "stderr": string + readonly "stdout": string + readonly "type": "code_execution_result" } -export const RequestContainerUploadBlock = Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "file_id": Schema.String.annotate({ "title": "File Id" }), - "type": Schema.Literal("container_upload").annotate({ "title": "Type" }) -}).annotate({ - "title": "RequestContainerUploadBlock", - "description": - "A content block that represents a file to be uploaded to the container\nFiles uploaded via this block will be available in the container's input directory." -}) -export type RequestToolReferenceBlock = { - readonly "cache_control"?: CacheControlEphemeral | null - readonly "tool_name": string - readonly "type": "tool_reference" +export const BetaRequestCodeExecutionResultBlock = Schema.Struct({ + "content": Schema.Array(BetaRequestCodeExecutionOutputBlock).annotate({ "title": "Content" }), + "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), + "stderr": Schema.String.annotate({ "title": "Stderr" }), + "stdout": Schema.String.annotate({ "title": "Stdout" }), + "type": Schema.Literal("code_execution_result").annotate({ "title": "Type" }) +}).annotate({ "title": "Result Block" }) +export type BetaRequestEncryptedCodeExecutionResultBlock = { + readonly "content": ReadonlyArray + readonly "encrypted_stdout": string + readonly "return_code": number + readonly "stderr": string + readonly "type": "encrypted_code_execution_result" } -export const RequestToolReferenceBlock = Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "tool_name": Schema.String.annotate({ "title": "Tool Name" }).check(Schema.isMinLength(1)).check( - Schema.isMaxLength(256) - ).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]{1,256}$"))), - "type": Schema.Literal("tool_reference").annotate({ "title": "Type" }) +export const BetaRequestEncryptedCodeExecutionResultBlock = Schema.Struct({ + "content": Schema.Array(BetaRequestCodeExecutionOutputBlock).annotate({ "title": "Content" }), + "encrypted_stdout": Schema.String.annotate({ "title": "Encrypted Stdout" }), + "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), + "stderr": Schema.String.annotate({ "title": "Stderr" }), + "type": Schema.Literal("encrypted_code_execution_result").annotate({ "title": "Type" }) }).annotate({ - "title": "RequestToolReferenceBlock", - "description": "Tool reference block that can be included in tool_result content." + "title": "RequestEncryptedCodeExecutionResultBlock", + "description": "Code execution result with encrypted stdout for PFC + web_search results." }) -export type ToolSearchToolBM25_20251119 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "cache_control"?: CacheControlEphemeral | null - readonly "defer_loading"?: boolean - readonly "name": "tool_search_tool_bm25" - readonly "strict"?: boolean - readonly "type": "tool_search_tool_bm25_20251119" | "tool_search_tool_bm25" +export type BetaRequestMCPServerURLDefinition = { + readonly "authorization_token"?: string | null + readonly "name": string + readonly "tool_configuration"?: BetaRequestMCPServerToolConfiguration | null + readonly "type": "url" + readonly "url": string } -export const ToolSearchToolBM25_20251119 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) +export const BetaRequestMCPServerURLDefinition = Schema.Struct({ + "authorization_token": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Authorization Token" }) ), + "name": Schema.String.annotate({ "title": "Name" }), + "tool_configuration": Schema.optionalKey(Schema.Union([BetaRequestMCPServerToolConfiguration, Schema.Null])), + "type": Schema.Literal("url").annotate({ "title": "Type" }), + "url": Schema.String.annotate({ "title": "Url" }) +}).annotate({ "title": "RequestMCPServerURLDefinition" }) +export type BetaRequestMCPToolResultBlock = { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "content"?: + | string + | ReadonlyArray< + { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "citations"?: + | ReadonlyArray< + | BetaRequestCharLocationCitation + | BetaRequestPageLocationCitation + | BetaRequestContentBlockLocationCitation + | BetaRequestWebSearchResultLocationCitation + | BetaRequestSearchResultLocationCitation + > + | null + readonly "text": string + readonly "type": "text" + } + > + readonly "is_error"?: boolean + readonly "tool_use_id": string + readonly "type": "mcp_tool_result" +} +export const BetaRequestMCPToolResultBlock = Schema.Struct({ "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "defer_loading": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Defer Loading", - "description": - "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." - }) + "content": Schema.optionalKey( + Schema.Union([ + Schema.String, + Schema.Array( + Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "citations": Schema.optionalKey( + Schema.Union([ + Schema.Array( + Schema.Union([ + BetaRequestCharLocationCitation, + BetaRequestPageLocationCitation, + BetaRequestContentBlockLocationCitation, + BetaRequestWebSearchResultLocationCitation, + BetaRequestSearchResultLocationCitation + ], { mode: "oneOf" }) + ), + Schema.Null + ]).annotate({ "title": "Citations" }) + ), + "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(1)), + "type": Schema.Literal("text").annotate({ "title": "Type" }) + }).annotate({ "title": "beta_mcp_tool_result_block_param_content_item" }) + ).annotate({ "title": "beta_mcp_tool_result_block_param_content" }) + ]).annotate({ "title": "Content" }) ), - "name": Schema.Literal("tool_search_tool_bm25").annotate({ - "title": "Name", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." - }), - "strict": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Strict", - "description": "When true, guarantees schema validation on tool names and inputs" - }) + "is_error": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Is Error" })), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$")) ), - "type": Schema.Literals(["tool_search_tool_bm25_20251119", "tool_search_tool_bm25"]).annotate({ "title": "Type" }) -}).annotate({ "title": "ToolSearchToolBM25_20251119" }) -export type ToolSearchToolRegex_20251119 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "cache_control"?: CacheControlEphemeral | null - readonly "defer_loading"?: boolean - readonly "name": "tool_search_tool_regex" - readonly "strict"?: boolean - readonly "type": "tool_search_tool_regex_20251119" | "tool_search_tool_regex" + "type": Schema.Literal("mcp_tool_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestMCPToolResultBlock" }) +export type BetaRequestTextBlock = { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "citations"?: + | ReadonlyArray< + | BetaRequestCharLocationCitation + | BetaRequestPageLocationCitation + | BetaRequestContentBlockLocationCitation + | BetaRequestWebSearchResultLocationCitation + | BetaRequestSearchResultLocationCitation + > + | null + readonly "text": string + readonly "type": "text" } -export const ToolSearchToolRegex_20251119 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), +export const BetaRequestTextBlock = Schema.Struct({ "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "defer_loading": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Defer Loading", - "description": - "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." - }) - ), - "name": Schema.Literal("tool_search_tool_regex").annotate({ - "title": "Name", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." - }), - "strict": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Strict", - "description": "When true, guarantees schema validation on tool names and inputs" - }) + "citations": Schema.optionalKey( + Schema.Union([ + Schema.Array( + Schema.Union([ + BetaRequestCharLocationCitation, + BetaRequestPageLocationCitation, + BetaRequestContentBlockLocationCitation, + BetaRequestWebSearchResultLocationCitation, + BetaRequestSearchResultLocationCitation + ], { mode: "oneOf" }) + ), + Schema.Null + ]).annotate({ "title": "Citations" }) ), - "type": Schema.Literals(["tool_search_tool_regex_20251119", "tool_search_tool_regex"]).annotate({ "title": "Type" }) -}).annotate({ "title": "ToolSearchToolRegex_20251119" }) -export type RequestCodeExecutionToolResultError = { - readonly "error_code": CodeExecutionToolResultErrorCode - readonly "type": "code_execution_tool_result_error" -} -export const RequestCodeExecutionToolResultError = Schema.Struct({ - "error_code": CodeExecutionToolResultErrorCode, - "type": Schema.Literal("code_execution_tool_result_error").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestCodeExecutionToolResultError" }) -export type ResponseCodeExecutionToolResultError = { - readonly "error_code": CodeExecutionToolResultErrorCode - readonly "type": "code_execution_tool_result_error" + "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(1)), + "type": Schema.Literal("text").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestTextBlock" }) +export type BetaResponseBashCodeExecutionResultBlock = { + readonly "content": ReadonlyArray + readonly "return_code": number + readonly "stderr": string + readonly "stdout": string + readonly "type": "bash_code_execution_result" } -export const ResponseCodeExecutionToolResultError = Schema.Struct({ - "error_code": CodeExecutionToolResultErrorCode, - "type": Schema.Literal("code_execution_tool_result_error").annotate({ +export const BetaResponseBashCodeExecutionResultBlock = Schema.Struct({ + "content": Schema.Array(BetaResponseBashCodeExecutionOutputBlock).annotate({ "title": "Content" }), + "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), + "stderr": Schema.String.annotate({ "title": "Stderr" }), + "stdout": Schema.String.annotate({ "title": "Stdout" }), + "type": Schema.Literal("bash_code_execution_result").annotate({ "title": "Type", - "default": "code_execution_tool_result_error" + "default": "bash_code_execution_result" }) -}).annotate({ "title": "ResponseCodeExecutionToolResultError" }) -export type FileListResponse = { - readonly "data": ReadonlyArray - readonly "first_id"?: string | null - readonly "has_more"?: boolean - readonly "last_id"?: string | null -} -export const FileListResponse = Schema.Struct({ - "data": Schema.Array(FileMetadataSchema).annotate({ - "title": "Data", - "description": "List of file metadata objects." +}).annotate({ "title": "ResponseBashCodeExecutionResultBlock" }) +export type BetaResponseDocumentBlock = { + readonly "citations": BetaResponseCitationsConfig | null + readonly "source": BetaBase64PDFSource | BetaPlainTextSource + readonly "title": string | null + readonly "type": "document" +} +export const BetaResponseDocumentBlock = Schema.Struct({ + "citations": Schema.Union([BetaResponseCitationsConfig, Schema.Null]).annotate({ + "description": "Citation configuration for the document", + "default": null }), - "first_id": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "First Id", - "description": "ID of the first file in this page of results." - }) - ), - "has_more": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Has More", - "description": "Whether there are more results available.", - "default": false - }) + "source": Schema.Union([BetaBase64PDFSource, BetaPlainTextSource], { mode: "oneOf" }).annotate({ "title": "Source" }), + "title": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Title", + "description": "The title of the document", + "default": null + }), + "type": Schema.Literal("document").annotate({ "title": "Type", "default": "document" }) +}).annotate({ "title": "ResponseDocumentBlock" }) +export type BetaResponseContextManagement = { + readonly "applied_edits": ReadonlyArray +} +export const BetaResponseContextManagement = Schema.Struct({ + "applied_edits": Schema.Array( + Schema.Union([BetaResponseClearToolUses20250919Edit, BetaResponseClearThinking20251015Edit], { mode: "oneOf" }) + ).annotate({ "title": "Applied Edits", "description": "List of context management edits that were applied." }) +}).annotate({ "title": "ResponseContextManagement" }) +export type BetaResponseCodeExecutionResultBlock = { + readonly "content": ReadonlyArray + readonly "return_code": number + readonly "stderr": string + readonly "stdout": string + readonly "type": "code_execution_result" +} +export const BetaResponseCodeExecutionResultBlock = Schema.Struct({ + "content": Schema.Array(BetaResponseCodeExecutionOutputBlock).annotate({ "title": "Content" }), + "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), + "stderr": Schema.String.annotate({ "title": "Stderr" }), + "stdout": Schema.String.annotate({ "title": "Stdout" }), + "type": Schema.Literal("code_execution_result").annotate({ "title": "Type", "default": "code_execution_result" }) +}).annotate({ "title": "ResponseCodeExecutionResultBlock" }) +export type BetaResponseEncryptedCodeExecutionResultBlock = { + readonly "content": ReadonlyArray + readonly "encrypted_stdout": string + readonly "return_code": number + readonly "stderr": string + readonly "type": "encrypted_code_execution_result" +} +export const BetaResponseEncryptedCodeExecutionResultBlock = Schema.Struct({ + "content": Schema.Array(BetaResponseCodeExecutionOutputBlock).annotate({ "title": "Content" }), + "encrypted_stdout": Schema.String.annotate({ "title": "Encrypted Stdout" }), + "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), + "stderr": Schema.String.annotate({ "title": "Stderr" }), + "type": Schema.Literal("encrypted_code_execution_result").annotate({ + "title": "Type", + "default": "encrypted_code_execution_result" + }) +}).annotate({ + "title": "ResponseEncryptedCodeExecutionResultBlock", + "description": "Code execution result with encrypted stdout for PFC + web_search results." +}) +export type BetaResponseToolSearchToolSearchResultBlock = { + readonly "tool_references": ReadonlyArray + readonly "type": "tool_search_tool_search_result" +} +export const BetaResponseToolSearchToolSearchResultBlock = Schema.Struct({ + "tool_references": Schema.Array(BetaResponseToolReferenceBlock).annotate({ "title": "Tool References" }), + "type": Schema.Literal("tool_search_tool_search_result").annotate({ + "title": "Type", + "default": "tool_search_tool_search_result" + }) +}).annotate({ "title": "ResponseToolSearchToolSearchResultBlock" }) +export type BetaCitationsDelta = { + readonly "citation": + | BetaResponseCharLocationCitation + | BetaResponsePageLocationCitation + | BetaResponseContentBlockLocationCitation + | BetaResponseWebSearchResultLocationCitation + | BetaResponseSearchResultLocationCitation + readonly "type": "citations_delta" +} +export const BetaCitationsDelta = Schema.Struct({ + "citation": Schema.Union([ + BetaResponseCharLocationCitation, + BetaResponsePageLocationCitation, + BetaResponseContentBlockLocationCitation, + BetaResponseWebSearchResultLocationCitation, + BetaResponseSearchResultLocationCitation + ], { mode: "oneOf" }).annotate({ "title": "Citation" }), + "type": Schema.Literal("citations_delta").annotate({ "title": "Type", "default": "citations_delta" }) +}).annotate({ "title": "CitationsDelta" }) +export type BetaResponseMCPToolResultBlock = { + readonly "content": + | string + | ReadonlyArray< + { + readonly "citations": + | ReadonlyArray< + | BetaResponseCharLocationCitation + | BetaResponsePageLocationCitation + | BetaResponseContentBlockLocationCitation + | BetaResponseWebSearchResultLocationCitation + | BetaResponseSearchResultLocationCitation + > + | null + readonly "text": string + readonly "type": "text" + } + > + readonly "is_error": boolean + readonly "tool_use_id": string + readonly "type": "mcp_tool_result" +} +export const BetaResponseMCPToolResultBlock = Schema.Struct({ + "content": Schema.Union([ + Schema.String, + Schema.Array( + Schema.Struct({ + "citations": Schema.Union([ + Schema.Array( + Schema.Union([ + BetaResponseCharLocationCitation, + BetaResponsePageLocationCitation, + BetaResponseContentBlockLocationCitation, + BetaResponseWebSearchResultLocationCitation, + BetaResponseSearchResultLocationCitation + ], { mode: "oneOf" }) + ), + Schema.Null + ]).annotate({ + "title": "Citations", + "description": + "Citations supporting the text block.\n\nThe type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.", + "default": null + }), + "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(0)).check( + Schema.isMaxLength(5000000) + ), + "type": Schema.Literal("text").annotate({ "title": "Type", "default": "text" }) + }).annotate({ "title": "beta_mcp_tool_result_block_content_item" }) + ).annotate({ "title": "beta_mcp_tool_result_block_content" }) + ]).annotate({ "title": "Content" }), + "is_error": Schema.Boolean.annotate({ "title": "Is Error", "default": false }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$")) ), - "last_id": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Last Id", - "description": "ID of the last file in this page of results." - }) - ) -}).annotate({ "title": "FileListResponse" }) -export type BashTool_20250124 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "cache_control"?: CacheControlEphemeral | null - readonly "defer_loading"?: boolean - readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }> - readonly "name": "bash" - readonly "strict"?: boolean - readonly "type": "bash_20250124" + "type": Schema.Literal("mcp_tool_result").annotate({ "title": "Type", "default": "mcp_tool_result" }) +}).annotate({ "title": "ResponseMCPToolResultBlock" }) +export type BetaResponseTextBlock = { + readonly "citations"?: + | ReadonlyArray< + | BetaResponseCharLocationCitation + | BetaResponsePageLocationCitation + | BetaResponseContentBlockLocationCitation + | BetaResponseWebSearchResultLocationCitation + | BetaResponseSearchResultLocationCitation + > + | null + readonly "text": string + readonly "type": "text" } -export const BashTool_20250124 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" +export const BetaResponseTextBlock = Schema.Struct({ + "citations": Schema.optionalKey( + Schema.Union([ + Schema.Array( + Schema.Union([ + BetaResponseCharLocationCitation, + BetaResponsePageLocationCitation, + BetaResponseContentBlockLocationCitation, + BetaResponseWebSearchResultLocationCitation, + BetaResponseSearchResultLocationCitation + ], { mode: "oneOf" }) + ), + Schema.Null + ]).annotate({ + "title": "Citations", + "description": + "Citations supporting the text block.\n\nThe type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.", + "default": null }) ), + "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(0)).check(Schema.isMaxLength(5000000)), + "type": Schema.Literal("text").annotate({ "title": "Type", "default": "text" }) +}).annotate({ "title": "ResponseTextBlock" }) +export type BetaSelfHostedWorkListResponse = { + readonly "data": ReadonlyArray + readonly "next_page": string | null +} +export const BetaSelfHostedWorkListResponse = Schema.Struct({ + "data": Schema.Array(BetaSelfHostedWork).annotate({ "title": "Data", "description": "List of work items" }), + "next_page": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Next Page", + "description": "Opaque cursor for fetching the next page of results" + }) +}).annotate({ + "title": "SelfHostedWorkListResponse", + "description": "Response when listing work items with cursor-based pagination." +}) +export type BetaRequestServerToolUseBlock = { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120 + readonly "id": string + readonly "input": { readonly [x: string]: unknown } + readonly "name": + | "advisor" + | "web_search" + | "web_fetch" + | "code_execution" + | "bash_code_execution" + | "text_editor_code_execution" + | "tool_search_tool_regex" + | "tool_search_tool_bm25" + readonly "type": "server_tool_use" +} +export const BetaRequestServerToolUseBlock = Schema.Struct({ "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "defer_loading": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Defer Loading", - "description": - "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." - }) - ), - "input_examples": Schema.optionalKey( - Schema.Array(Schema.Record(Schema.String, JsonValue)).annotate({ "title": "Input Examples" }) - ), - "name": Schema.Literal("bash").annotate({ - "title": "Name", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." - }), - "strict": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Strict", - "description": "When true, guarantees schema validation on tool names and inputs" + "caller": Schema.optionalKey( + Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate({ + "title": "Caller" }) ), - "type": Schema.Literal("bash_20250124").annotate({ "title": "Type" }) -}).annotate({ "title": "BashTool_20250124" }) -export type MemoryTool_20250818 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "cache_control"?: CacheControlEphemeral | null - readonly "defer_loading"?: boolean - readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }> - readonly "name": "memory" - readonly "strict"?: boolean - readonly "type": "memory_20250818" + "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))), + "input": Schema.Record(Schema.String, Schema.Unknown).annotate({ "title": "Input" }), + "name": Schema.Literals([ + "advisor", + "web_search", + "web_fetch", + "code_execution", + "bash_code_execution", + "text_editor_code_execution", + "tool_search_tool_regex", + "tool_search_tool_bm25" + ]).annotate({ "title": "Name" }), + "type": Schema.Literal("server_tool_use").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestServerToolUseBlock" }) +export type BetaResponseServerToolUseBlock = { + readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120 + readonly "id": string + readonly "input": { readonly [x: string]: unknown } + readonly "name": + | "advisor" + | "web_search" + | "web_fetch" + | "code_execution" + | "bash_code_execution" + | "text_editor_code_execution" + | "tool_search_tool_regex" + | "tool_search_tool_bm25" + readonly "type": "server_tool_use" } -export const MemoryTool_20250818 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." +export const BetaResponseServerToolUseBlock = Schema.Struct({ + "caller": Schema.optionalKey( + Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate({ + "title": "Caller" }) ), - "defer_loading": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Defer Loading", - "description": - "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))), + "input": Schema.Record(Schema.String, Schema.Unknown).annotate({ "title": "Input" }), + "name": Schema.Literals([ + "advisor", + "web_search", + "web_fetch", + "code_execution", + "bash_code_execution", + "text_editor_code_execution", + "tool_search_tool_regex", + "tool_search_tool_bm25" + ]).annotate({ "title": "Name" }), + "type": Schema.Literal("server_tool_use").annotate({ "title": "Type", "default": "server_tool_use" }) +}).annotate({ "title": "ResponseServerToolUseBlock" }) +export type BetaResponseToolUseBlock = { + readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120 + readonly "id": string + readonly "input": { readonly [x: string]: unknown } + readonly "name": string + readonly "type": "tool_use" +} +export const BetaResponseToolUseBlock = Schema.Struct({ + "caller": Schema.optionalKey( + Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate({ + "title": "Caller" }) ), - "input_examples": Schema.optionalKey( - Schema.Array(Schema.Record(Schema.String, JsonValue)).annotate({ "title": "Input Examples" }) - ), - "name": Schema.Literal("memory").annotate({ - "title": "Name", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." + "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$"))), + "input": Schema.Record(Schema.String, Schema.Unknown).annotate({ "title": "Input" }), + "name": Schema.String.annotate({ "title": "Name" }).check(Schema.isMinLength(1)), + "type": Schema.Literal("tool_use").annotate({ "title": "Type", "default": "tool_use" }) +}).annotate({ "title": "ResponseToolUseBlock" }) +export type BetaContainer = { + readonly "expires_at": string + readonly "id": string + readonly "skills": ReadonlyArray | null +} +export const BetaContainer = Schema.Struct({ + "expires_at": Schema.String.annotate({ + "title": "Expires At", + "description": "The time at which the container will expire.", + "format": "date-time" }), - "strict": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Strict", - "description": "When true, guarantees schema validation on tool names and inputs" - }) - ), - "type": Schema.Literal("memory_20250818").annotate({ "title": "Type" }) -}).annotate({ "title": "MemoryTool_20250818" }) -export type TextEditor_20250124 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "cache_control"?: CacheControlEphemeral | null - readonly "defer_loading"?: boolean - readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }> - readonly "name": "str_replace_editor" - readonly "strict"?: boolean - readonly "type": "text_editor_20250124" + "id": Schema.String.annotate({ "title": "Id", "description": "Identifier for the container used in this request" }), + "skills": Schema.Union([Schema.Array(BetaSkill), Schema.Null]).annotate({ + "title": "Skills", + "description": "Skills loaded in the container", + "default": null + }) +}).annotate({ + "title": "Container", + "description": "Information about the container used in the request (for the code execution tool)" +}) +export type BetaContainerParams = { + readonly "id"?: string | null + readonly "skills"?: ReadonlyArray | null } -export const TextEditor_20250124 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) +export const BetaContainerParams = Schema.Struct({ + "id": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Id", "description": "Container id" }) ), - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." + "skills": Schema.optionalKey( + Schema.Union([Schema.Array(BetaSkillParams).check(Schema.isMaxLength(8)), Schema.Null]).annotate({ + "title": "Skills", + "description": "List of skills to load in the container" }) + ) +}).annotate({ "title": "ContainerParams", "description": "Container parameters with skills to be loaded." }) +export type BetaListSkillVersionsResponse = { + readonly "data": ReadonlyArray + readonly "has_more": boolean + readonly "next_page": string | null +} +export const BetaListSkillVersionsResponse = Schema.Struct({ + "data": Schema.Array(BetaSkillVersion).annotate({ "title": "Data", "description": "List of skill versions." }), + "has_more": Schema.Boolean.annotate({ + "title": "Has More", + "description": "Indicates if there are more results in the requested page direction." + }), + "next_page": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Next Page", + "description": "Token to provide in as `page` in the subsequent request to retrieve the next page of data." + }) +}).annotate({ "title": "ListSkillVersionsResponse" }) +export type BetaRequestTextEditorCodeExecutionToolResultError = { + readonly "error_code": BetaTextEditorCodeExecutionToolResultErrorCode + readonly "error_message"?: string | null + readonly "type": "text_editor_code_execution_tool_result_error" +} +export const BetaRequestTextEditorCodeExecutionToolResultError = Schema.Struct({ + "error_code": BetaTextEditorCodeExecutionToolResultErrorCode, + "error_message": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Error Message" }) ), - "defer_loading": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Defer Loading", + "type": Schema.Literal("text_editor_code_execution_tool_result_error").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestTextEditorCodeExecutionToolResultError" }) +export type BetaResponseTextEditorCodeExecutionToolResultError = { + readonly "error_code": BetaTextEditorCodeExecutionToolResultErrorCode + readonly "error_message": string | null + readonly "type": "text_editor_code_execution_tool_result_error" +} +export const BetaResponseTextEditorCodeExecutionToolResultError = Schema.Struct({ + "error_code": BetaTextEditorCodeExecutionToolResultErrorCode, + "error_message": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Error Message", "default": null }), + "type": Schema.Literal("text_editor_code_execution_tool_result_error").annotate({ + "title": "Type", + "default": "text_editor_code_execution_tool_result_error" + }) +}).annotate({ "title": "ResponseTextEditorCodeExecutionToolResultError" }) +export type BetaThinkingConfigAdaptive = { + readonly "display"?: BetaThinkingDisplayMode | null + readonly "type": "adaptive" +} +export const BetaThinkingConfigAdaptive = Schema.Struct({ + "display": Schema.optionalKey( + Schema.Union([BetaThinkingDisplayMode, Schema.Null]).annotate({ "description": - "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + "Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`." }) ), - "input_examples": Schema.optionalKey( - Schema.Array(Schema.Record(Schema.String, JsonValue)).annotate({ "title": "Input Examples" }) - ), - "name": Schema.Literal("str_replace_editor").annotate({ - "title": "Name", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." - }), - "strict": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Strict", - "description": "When true, guarantees schema validation on tool names and inputs" + "type": Schema.Literal("adaptive").annotate({ "title": "Type" }) +}).annotate({ "title": "ThinkingConfigAdaptive" }) +export type BetaThinkingConfigEnabled = { + readonly "budget_tokens": number + readonly "display"?: BetaThinkingDisplayMode | null + readonly "type": "enabled" +} +export const BetaThinkingConfigEnabled = Schema.Struct({ + "budget_tokens": Schema.Number.annotate({ + "title": "Budget Tokens", + "description": + "Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.\n\nMust be ≥1024 and less than `max_tokens`.\n\nSee [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1024)), + "display": Schema.optionalKey( + Schema.Union([BetaThinkingDisplayMode, Schema.Null]).annotate({ + "description": + "Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`." }) ), - "type": Schema.Literal("text_editor_20250124").annotate({ "title": "Type" }) -}).annotate({ "title": "TextEditor_20250124" }) -export type TextEditor_20250429 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "cache_control"?: CacheControlEphemeral | null - readonly "defer_loading"?: boolean - readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }> - readonly "name": "str_replace_based_edit_tool" - readonly "strict"?: boolean - readonly "type": "text_editor_20250429" + "type": Schema.Literal("enabled").annotate({ "title": "Type" }) +}).annotate({ "title": "ThinkingConfigEnabled" }) +export type BetaClearThinking20251015 = { + readonly "keep"?: BetaThinkingTurns | BetaAllThinkingTurns | "all" + readonly "type": "clear_thinking_20251015" } -export const TextEditor_20250429 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) +export const BetaClearThinking20251015 = Schema.Struct({ + "keep": Schema.optionalKey( + Schema.Union([Schema.Union([BetaThinkingTurns, BetaAllThinkingTurns], { mode: "oneOf" }), Schema.Literal("all")]) + .annotate({ + "title": "Keep", + "description": + "Number of most recent assistant turns to keep thinking blocks for. Older turns will have their thinking blocks removed." + }) ), - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." + "type": Schema.Literal("clear_thinking_20251015").annotate({ "title": "Type" }) +}).annotate({ "title": "ClearThinking20251015" }) +export type BetaModelCapabilities = { + readonly "batch": { readonly "supported": boolean } + readonly "citations": { readonly "supported": boolean } + readonly "code_execution": { readonly "supported": boolean } + readonly "context_management": { + readonly "clear_thinking_20251015": BetaCapabilitySupport | null + readonly "clear_tool_uses_20250919": BetaCapabilitySupport | null + readonly "compact_20260112": BetaCapabilitySupport | null + readonly "supported": boolean + } + readonly "effort": { + readonly "high": { readonly "supported": boolean } + readonly "low": { readonly "supported": boolean } + readonly "max": { readonly "supported": boolean } + readonly "medium": { readonly "supported": boolean } + readonly "supported": boolean + readonly "xhigh": BetaCapabilitySupport | null + } + readonly "image_input": { readonly "supported": boolean } + readonly "pdf_input": { readonly "supported": boolean } + readonly "structured_outputs": { readonly "supported": boolean } + readonly "thinking": { readonly "supported": boolean; readonly "types": BetaThinkingTypes } +} +export const BetaModelCapabilities = Schema.Struct({ + "batch": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports the Batch API." }), + "citations": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports citation generation." }), + "code_execution": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports code execution tools." }), + "context_management": Schema.Struct({ + "clear_thinking_20251015": Schema.Union([BetaCapabilitySupport, Schema.Null]).annotate({ + "description": "Whether the clear_thinking_20251015 strategy is supported." + }), + "clear_tool_uses_20250919": Schema.Union([BetaCapabilitySupport, Schema.Null]).annotate({ + "description": "Whether the clear_tool_uses_20250919 strategy is supported." + }), + "compact_20260112": Schema.Union([BetaCapabilitySupport, Schema.Null]).annotate({ + "description": "Whether the compact_20260112 strategy is supported." + }), + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." }) - ), - "defer_loading": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Defer Loading", - "description": - "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + }).annotate({ + "title": "ContextManagementCapability", + "description": "Context management support and available strategies." + }), + "effort": Schema.Struct({ + "high": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports high effort level." }), + "low": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports low effort level." }), + "max": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports max effort level." }), + "medium": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports medium effort level." }), + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }), + "xhigh": Schema.Union([BetaCapabilitySupport, Schema.Null]).annotate({ + "description": "Whether the model supports xhigh effort level." }) - ), - "input_examples": Schema.optionalKey( - Schema.Array(Schema.Record(Schema.String, JsonValue)).annotate({ "title": "Input Examples" }) - ), - "name": Schema.Literal("str_replace_based_edit_tool").annotate({ - "title": "Name", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." + }).annotate({ + "title": "EffortCapability", + "description": "Effort (reasoning_effort) support and available levels." }), - "strict": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Strict", - "description": "When true, guarantees schema validation on tool names and inputs" + "image_input": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model accepts image content blocks." }), + "pdf_input": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model accepts PDF content blocks." }), + "structured_outputs": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." }) - ), - "type": Schema.Literal("text_editor_20250429").annotate({ "title": "Type" }) -}).annotate({ "title": "TextEditor_20250429" }) -export type TextEditor_20250728 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "cache_control"?: CacheControlEphemeral | null - readonly "defer_loading"?: boolean - readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }> - readonly "max_characters"?: number | null - readonly "name": "str_replace_based_edit_tool" - readonly "strict"?: boolean - readonly "type": "text_editor_20250728" + }).annotate({ + "title": "CapabilitySupport", + "description": "Whether the model supports structured output / JSON mode / strict tool schemas." + }), + "thinking": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }), + "types": BetaThinkingTypes + }).annotate({ + "title": "ThinkingCapability", + "description": "Thinking capability and supported type configurations." + }) +}).annotate({ "title": "ModelCapabilities", "description": "Model capability information." }) +export type BetaManagedAgentsAddSessionResource = { + readonly "type": "file" + readonly "id": string + readonly "file_id": string + readonly "mount_path": string + readonly "created_at": BetaTimestamp + readonly "updated_at": BetaTimestamp } -export const TextEditor_20250728 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "defer_loading": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Defer Loading", - "description": - "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." - }) - ), - "input_examples": Schema.optionalKey( - Schema.Array(Schema.Record(Schema.String, JsonValue)).annotate({ "title": "Input Examples" }) +export const BetaManagedAgentsAddSessionResource = Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("file"), + "id": Schema.String, + "file_id": Schema.String, + "mount_path": Schema.String, + "created_at": BetaTimestamp, + "updated_at": BetaTimestamp + }).annotate({ "description": "The added session resource." }) +], { mode: "oneOf" }) +export type BetaManagedAgentsCreateCredentialRequestBody = { + readonly "auth": { + readonly "type": "mcp_oauth" + readonly "mcp_server_url": string + readonly "access_token": string + readonly "expires_at"?: BetaTimestamp + readonly "refresh"?: { + readonly "refresh_token": string + readonly "token_endpoint": string + readonly "client_id": string + readonly "scope"?: string + readonly "resource"?: string + readonly "token_endpoint_auth": { readonly "type": "none" } | { + readonly "type": "client_secret_basic" + readonly "client_secret": string + } | { readonly "type": "client_secret_post"; readonly "client_secret": string } + } + } | { readonly "type": "static_bearer"; readonly "token": string; readonly "mcp_server_url": string } + readonly "display_name"?: string + readonly "metadata"?: { readonly [x: string]: string } +} +export const BetaManagedAgentsCreateCredentialRequestBody = Schema.Struct({ + "auth": Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("mcp_oauth"), + "mcp_server_url": Schema.String.annotate({ + "description": "URL of the MCP server this credential authenticates against." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(2047)), + "access_token": Schema.String.annotate({ "description": "OAuth access token." }).check(Schema.isMinLength(1)) + .check(Schema.isMaxLength(8192)), + "expires_at": Schema.optionalKey(BetaTimestamp), + "refresh": Schema.optionalKey( + Schema.Struct({ + "refresh_token": Schema.String.annotate({ "description": "OAuth refresh token." }).check( + Schema.isMinLength(1) + ).check(Schema.isMaxLength(4096)), + "token_endpoint": Schema.String.annotate({ + "description": "Token endpoint URL used to refresh the access token." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(2047)), + "client_id": Schema.String.annotate({ "description": "OAuth client ID." }).check(Schema.isMinLength(1)).check( + Schema.isMaxLength(1024) + ), + "scope": Schema.optionalKey( + Schema.String.annotate({ "description": "OAuth scope for the refresh request." }).check( + Schema.isMinLength(1) + ).check(Schema.isMaxLength(8192)) + ), + "resource": Schema.optionalKey( + Schema.String.annotate({ "description": "OAuth resource indicator." }).check(Schema.isMinLength(1)).check( + Schema.isMaxLength(2047) + ) + ), + "token_endpoint_auth": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("none") }).annotate({ + "description": "Token endpoint requires no client authentication." + }), + Schema.Struct({ + "type": Schema.Literal("client_secret_basic"), + "client_secret": Schema.String.annotate({ "description": "OAuth client secret." }).check( + Schema.isMinLength(1) + ).check(Schema.isMaxLength(512)) + }).annotate({ "description": "Token endpoint uses HTTP Basic authentication with client credentials." }), + Schema.Struct({ + "type": Schema.Literal("client_secret_post"), + "client_secret": Schema.String.annotate({ "description": "OAuth client secret." }).check( + Schema.isMinLength(1) + ).check(Schema.isMaxLength(512)) + }).annotate({ "description": "Token endpoint uses POST body authentication with client credentials." }) + ], { mode: "oneOf" }) + }).annotate({ "description": "OAuth refresh token parameters for creating a credential with refresh support." }) + ) + }).annotate({ "description": "Authentication details for creating a credential." }), + Schema.Struct({ + "type": Schema.Literal("static_bearer"), + "token": Schema.String.annotate({ "description": "Static bearer token value." }).check(Schema.isMinLength(1)) + .check(Schema.isMaxLength(8192)), + "mcp_server_url": Schema.String.annotate({ + "description": "URL of the MCP server this credential authenticates against." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(2047)) + }).annotate({ "description": "Authentication details for creating a credential." }) + ], { mode: "oneOf" }).annotate({ "description": "Authentication configuration for the credential." }), + "display_name": Schema.optionalKey( + Schema.String.annotate({ "description": "Human-readable name for the credential. Up to 255 characters." }).check( + Schema.isMaxLength(255) + ) ), - "max_characters": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), Schema.Null]).annotate({ - "title": "Max Characters", + "metadata": Schema.optionalKey( + Schema.Record(Schema.String, Schema.String).annotate({ "description": - "Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file." + "Arbitrary key-value metadata to attach to the credential. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars." }) + ) +}) +export type BetaManagedAgentsCredential = { + readonly "type": "vault_credential" + readonly "id": string + readonly "vault_id": string + readonly "display_name"?: string + readonly "metadata": { readonly [x: string]: string } + readonly "created_at": BetaTimestamp + readonly "updated_at": BetaTimestamp + readonly "archived_at": string + readonly "auth": { + readonly "type": "mcp_oauth" + readonly "mcp_server_url": string + readonly "expires_at"?: BetaTimestamp + readonly "refresh"?: { + readonly "token_endpoint": string + readonly "client_id": string + readonly "resource"?: string + readonly "scope"?: string + readonly "token_endpoint_auth": { readonly "type": "none" } | { readonly "type": "client_secret_basic" } | { + readonly "type": "client_secret_post" + } + } + } | { readonly "type": "static_bearer"; readonly "mcp_server_url": string } +} +export const BetaManagedAgentsCredential = Schema.Struct({ + "type": Schema.Literal("vault_credential"), + "id": Schema.String.annotate({ "description": "Unique identifier for the credential." }), + "vault_id": Schema.String.annotate({ "description": "Identifier of the vault this credential belongs to." }), + "display_name": Schema.optionalKey( + Schema.String.annotate({ "description": "Human-readable name for the credential." }) ), - "name": Schema.Literal("str_replace_based_edit_tool").annotate({ - "title": "Name", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." + "metadata": Schema.Record(Schema.String, Schema.String).annotate({ + "description": "Arbitrary key-value metadata attached to the credential." }), - "strict": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Strict", - "description": "When true, guarantees schema validation on tool names and inputs" - }) - ), - "type": Schema.Literal("text_editor_20250728").annotate({ "title": "Type" }) -}).annotate({ "title": "TextEditor_20250728" }) -export type Tool = { - readonly "type"?: null | "custom" + "created_at": BetaTimestamp, + "updated_at": BetaTimestamp, + "archived_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "auth": Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("mcp_oauth"), + "mcp_server_url": Schema.String.annotate({ + "description": "URL of the MCP server this credential authenticates against." + }), + "expires_at": Schema.optionalKey(BetaTimestamp), + "refresh": Schema.optionalKey( + Schema.Struct({ + "token_endpoint": Schema.String.annotate({ + "description": "Token endpoint URL used to refresh the access token." + }), + "client_id": Schema.String.annotate({ "description": "OAuth client ID." }), + "resource": Schema.optionalKey(Schema.String.annotate({ "description": "OAuth resource indicator." })), + "scope": Schema.optionalKey( + Schema.String.annotate({ "description": "OAuth scope for the refresh request." }) + ), + "token_endpoint_auth": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("none") }).annotate({ + "description": "Token endpoint requires no client authentication." + }), + Schema.Struct({ "type": Schema.Literal("client_secret_basic") }).annotate({ + "description": "Token endpoint uses HTTP Basic authentication with client credentials." + }), + Schema.Struct({ "type": Schema.Literal("client_secret_post") }).annotate({ + "description": "Token endpoint uses POST body authentication with client credentials." + }) + ], { mode: "oneOf" }) + }).annotate({ "description": "OAuth refresh token configuration returned in credential responses." }) + ) + }).annotate({ "description": "Authentication details for a credential." }), + Schema.Struct({ + "type": Schema.Literal("static_bearer"), + "mcp_server_url": Schema.String.annotate({ + "description": "URL of the MCP server this credential authenticates against." + }) + }).annotate({ "description": "Authentication details for a credential." }) + ], { mode: "oneOf" }).annotate({ "description": "Authentication configuration for this credential." }) +}).annotate({ "description": "A credential stored in a vault. Sensitive fields are never returned in responses." }) +export type BetaManagedAgentsGetSessionResource = { + readonly "type": "github_repository" + readonly "id": string + readonly "url": string + readonly "mount_path": string + readonly "checkout"?: BetaManagedAgentsRepositoryCheckout + readonly "created_at": BetaTimestamp + readonly "updated_at": BetaTimestamp +} | { + readonly "type": "file" + readonly "id": string + readonly "file_id": string + readonly "mount_path": string + readonly "created_at": BetaTimestamp + readonly "updated_at": BetaTimestamp +} | { + readonly "type": "memory_store" + readonly "memory_store_id": string + readonly "access"?: "read_write" | "read_only" + readonly "name"?: string readonly "description"?: string - readonly "name": string - readonly "input_schema": { - readonly "properties"?: { readonly [x: string]: Schema.Json } | null - readonly "required"?: ReadonlyArray | null - readonly "type": "object" - readonly [x: string]: Schema.Json - } - readonly "cache_control"?: CacheControlEphemeral | null - readonly "strict"?: boolean - readonly "eager_input_streaming"?: boolean | null - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "defer_loading"?: boolean - readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }> + readonly "instructions"?: string + readonly "mount_path"?: string } -export const Tool = Schema.Struct({ - "type": Schema.optionalKey(Schema.Union([Schema.Null, Schema.Literal("custom")]).annotate({ "title": "Type" })), - "description": Schema.optionalKey(Schema.String.annotate({ - "title": "Description", - "description": - "Description of what this tool does.\n\nTool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema." - })), - "name": Schema.String.annotate({ - "title": "Name", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." - }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(128)).check( - Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]{1,128}$")) - ), - "input_schema": Schema.StructWithRest( - Schema.Struct({ - "properties": Schema.optionalKey( - Schema.Union([Schema.Record(Schema.String, Schema.Json), Schema.Null]).annotate({ "title": "Properties" }) - ), - "required": Schema.optionalKey( - Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Required" }) - ), - "type": Schema.Literal("object").annotate({ "title": "Type" }) +export const BetaManagedAgentsGetSessionResource = Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("github_repository"), + "id": Schema.String, + "url": Schema.String, + "mount_path": Schema.String, + "checkout": Schema.optionalKey(BetaManagedAgentsRepositoryCheckout), + "created_at": BetaTimestamp, + "updated_at": BetaTimestamp + }).annotate({ "description": "The requested session resource." }), + Schema.Struct({ + "type": Schema.Literal("file"), + "id": Schema.String, + "file_id": Schema.String, + "mount_path": Schema.String, + "created_at": BetaTimestamp, + "updated_at": BetaTimestamp + }).annotate({ "description": "The requested session resource." }), + Schema.Struct({ + "type": Schema.Literal("memory_store"), + "memory_store_id": Schema.String.annotate({ + "description": "The memory store ID (memstore_...). Must belong to the caller's organization and workspace." }), - [Schema.Record(Schema.String, Schema.Json)] - ).annotate({ - "title": "InputSchema", - "description": - "[JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.\n\nThis defines the shape of the `input` that your tool accepts and that the model will produce." + "access": Schema.optionalKey( + Schema.Literals(["read_write", "read_only"]).annotate({ + "description": "Access mode for an attached memory store." + }) + ), + "name": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource." + }) + ), + "description": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description." + }) + ), + "instructions": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars." + }).check(Schema.isMaxLength(4096)) + ), + "mount_path": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only." + }) + ) + }).annotate({ "description": "The requested session resource." }) +], { mode: "oneOf" }) +export type BetaManagedAgentsSessionResource = { + readonly "type": "github_repository" + readonly "id": string + readonly "url": string + readonly "mount_path": string + readonly "checkout"?: BetaManagedAgentsRepositoryCheckout + readonly "created_at": BetaTimestamp + readonly "updated_at": BetaTimestamp +} | { + readonly "type": "file" + readonly "id": string + readonly "file_id": string + readonly "mount_path": string + readonly "created_at": BetaTimestamp + readonly "updated_at": BetaTimestamp +} | { + readonly "type": "memory_store" + readonly "memory_store_id": string + readonly "access"?: "read_write" | "read_only" + readonly "name"?: string + readonly "description"?: string + readonly "instructions"?: string + readonly "mount_path"?: string +} +export const BetaManagedAgentsSessionResource = Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("github_repository"), + "id": Schema.String, + "url": Schema.String, + "mount_path": Schema.String, + "checkout": Schema.optionalKey(BetaManagedAgentsRepositoryCheckout), + "created_at": BetaTimestamp, + "updated_at": BetaTimestamp }), - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "strict": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Strict", - "description": "When true, guarantees schema validation on tool names and inputs" - }) + Schema.Struct({ + "type": Schema.Literal("file"), + "id": Schema.String, + "file_id": Schema.String, + "mount_path": Schema.String, + "created_at": BetaTimestamp, + "updated_at": BetaTimestamp + }), + Schema.Struct({ + "type": Schema.Literal("memory_store"), + "memory_store_id": Schema.String.annotate({ + "description": "The memory store ID (memstore_...). Must belong to the caller's organization and workspace." + }), + "access": Schema.optionalKey( + Schema.Literals(["read_write", "read_only"]).annotate({ + "description": "Access mode for an attached memory store." + }) + ), + "name": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource." + }) + ), + "description": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description." + }) + ), + "instructions": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars." + }).check(Schema.isMaxLength(4096)) + ), + "mount_path": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only." + }) + ) + }).annotate({ "description": "A memory store attached to an agent session." }) +], { mode: "oneOf" }) +export type BetaManagedAgentsUpdateCredentialRequestBody = { + readonly "display_name"?: string + readonly "metadata"?: { readonly [x: string]: string } + readonly "auth"?: { + readonly "type": "mcp_oauth" + readonly "access_token"?: string + readonly "expires_at"?: BetaTimestamp + readonly "refresh"?: { + readonly "refresh_token"?: string + readonly "scope"?: string + readonly "token_endpoint_auth"?: { readonly "type": "client_secret_basic"; readonly "client_secret"?: string } | { + readonly "type": "client_secret_post" + readonly "client_secret"?: string + } + } + } | { readonly "type": "static_bearer"; readonly "token"?: string } +} +export const BetaManagedAgentsUpdateCredentialRequestBody = Schema.Struct({ + "display_name": Schema.optionalKey( + Schema.String.annotate({ "description": "Updated human-readable name for the credential. 1-255 characters." }) + .check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)) ), - "eager_input_streaming": Schema.optionalKey( - Schema.Union([Schema.Boolean, Schema.Null]).annotate({ - "title": "Eager Input Streaming", + "metadata": Schema.optionalKey( + Schema.Record(Schema.String, Schema.String).annotate({ "description": - "Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers." - }) - ), - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" + "Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved." }) ), - "defer_loading": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Defer Loading", + "auth": Schema.optionalKey( + Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("mcp_oauth"), + "access_token": Schema.optionalKey( + Schema.String.annotate({ "description": "Updated OAuth access token." }).check(Schema.isMinLength(1)).check( + Schema.isMaxLength(8192) + ) + ), + "expires_at": Schema.optionalKey(BetaTimestamp), + "refresh": Schema.optionalKey( + Schema.Struct({ + "refresh_token": Schema.optionalKey( + Schema.String.annotate({ "description": "Updated OAuth refresh token." }).check(Schema.isMinLength(1)) + .check(Schema.isMaxLength(4096)) + ), + "scope": Schema.optionalKey( + Schema.String.annotate({ "description": "Updated OAuth scope for the refresh request." }).check( + Schema.isMaxLength(8192) + ) + ), + "token_endpoint_auth": Schema.optionalKey( + Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("client_secret_basic"), + "client_secret": Schema.optionalKey( + Schema.String.annotate({ "description": "Updated OAuth client secret." }).check( + Schema.isMinLength(1) + ).check(Schema.isMaxLength(512)) + ) + }).annotate({ "description": "Updated HTTP Basic authentication parameters for the token endpoint." }), + Schema.Struct({ + "type": Schema.Literal("client_secret_post"), + "client_secret": Schema.optionalKey( + Schema.String.annotate({ "description": "Updated OAuth client secret." }).check( + Schema.isMinLength(1) + ).check(Schema.isMaxLength(512)) + ) + }).annotate({ "description": "Updated POST body authentication parameters for the token endpoint." }) + ], { mode: "oneOf" }) + ) + }).annotate({ "description": "Parameters for updating OAuth refresh token configuration." }) + ) + }).annotate({ "description": "Updated authentication details for a credential." }), + Schema.Struct({ + "type": Schema.Literal("static_bearer"), + "token": Schema.optionalKey( + Schema.String.annotate({ "description": "Updated static bearer token value." }).check(Schema.isMinLength(1)) + .check(Schema.isMaxLength(8192)) + ) + }).annotate({ "description": "Updated authentication details for a credential." }) + ], { mode: "oneOf" }).annotate({ "description": - "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + "Updated authentication configuration. The `type` is immutable; the variant sent must match the stored credential's type." }) - ), - "input_examples": Schema.optionalKey( - Schema.Array(Schema.Record(Schema.String, JsonValue)).annotate({ "title": "Input Examples" }) ) -}).annotate({ "title": "Tool" }) -export type ListResponse_MessageBatch_ = { - readonly "data": ReadonlyArray - readonly "first_id": string | null - readonly "has_more": boolean - readonly "last_id": string | null +}) +export type BetaManagedAgentsUpdateSessionResource = { + readonly "type": "github_repository" + readonly "id": string + readonly "url": string + readonly "mount_path": string + readonly "checkout"?: BetaManagedAgentsRepositoryCheckout + readonly "created_at": BetaTimestamp + readonly "updated_at": BetaTimestamp +} | { + readonly "type": "file" + readonly "id": string + readonly "file_id": string + readonly "mount_path": string + readonly "created_at": BetaTimestamp + readonly "updated_at": BetaTimestamp +} | { + readonly "type": "memory_store" + readonly "memory_store_id": string + readonly "access"?: "read_write" | "read_only" + readonly "name"?: string + readonly "description"?: string + readonly "instructions"?: string + readonly "mount_path"?: string } -export const ListResponse_MessageBatch_ = Schema.Struct({ - "data": Schema.Array(MessageBatch).annotate({ "title": "Data" }), - "first_id": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "First Id", - "description": "First ID in the `data` list. Can be used as the `before_id` for the previous page." - }), - "has_more": Schema.Boolean.annotate({ - "title": "Has More", - "description": "Indicates if there are more results in the requested page direction." +export const BetaManagedAgentsUpdateSessionResource = Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("github_repository"), + "id": Schema.String, + "url": Schema.String, + "mount_path": Schema.String, + "checkout": Schema.optionalKey(BetaManagedAgentsRepositoryCheckout), + "created_at": BetaTimestamp, + "updated_at": BetaTimestamp + }).annotate({ "description": "The updated session resource." }), + Schema.Struct({ + "type": Schema.Literal("file"), + "id": Schema.String, + "file_id": Schema.String, + "mount_path": Schema.String, + "created_at": BetaTimestamp, + "updated_at": BetaTimestamp + }).annotate({ "description": "The updated session resource." }), + Schema.Struct({ + "type": Schema.Literal("memory_store"), + "memory_store_id": Schema.String.annotate({ + "description": "The memory store ID (memstore_...). Must belong to the caller's organization and workspace." + }), + "access": Schema.optionalKey( + Schema.Literals(["read_write", "read_only"]).annotate({ + "description": "Access mode for an attached memory store." + }) + ), + "name": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Display name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource." + }) + ), + "description": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Description of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description." + }) + ), + "instructions": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Per-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars." + }).check(Schema.isMaxLength(4096)) + ), + "mount_path": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Filesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only." + }) + ) + }).annotate({ "description": "The updated session resource." }) +], { mode: "oneOf" }) +export type BetaManagedAgentsVault = { + readonly "type": "vault" + readonly "id": string + readonly "display_name": string + readonly "metadata": { readonly [x: string]: string } + readonly "created_at": BetaTimestamp + readonly "updated_at": BetaTimestamp + readonly "archived_at": string +} +export const BetaManagedAgentsVault = Schema.Struct({ + "type": Schema.Literal("vault"), + "id": Schema.String.annotate({ "description": "Unique identifier for the vault." }), + "display_name": Schema.String.annotate({ "description": "Human-readable name for the vault." }), + "metadata": Schema.Record(Schema.String, Schema.String).annotate({ + "description": "Arbitrary key-value metadata attached to the vault." }), - "last_id": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Last Id", - "description": "Last ID in the `data` list. Can be used as the `after_id` for the next page." - }) -}).annotate({ "title": "ListResponse[MessageBatch]" }) -export type ListResponse_ModelInfo_ = { - readonly "data": ReadonlyArray - readonly "first_id": string | null - readonly "has_more": boolean - readonly "last_id": string | null -} -export const ListResponse_ModelInfo_ = Schema.Struct({ - "data": Schema.Array(ModelInfo).annotate({ "title": "Data" }), - "first_id": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "First Id", - "description": "First ID in the `data` list. Can be used as the `before_id` for the previous page." - }), - "has_more": Schema.Boolean.annotate({ - "title": "Has More", - "description": "Indicates if there are more results in the requested page direction." - }), - "last_id": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Last Id", - "description": "Last ID in the `data` list. Can be used as the `after_id` for the next page." + "created_at": BetaTimestamp, + "updated_at": BetaTimestamp, + "archived_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) +}).annotate({ "description": "A vault that stores credentials for use by agents during sessions." }) +export type BetaToolChoice = BetaToolChoiceAuto | BetaToolChoiceAny | BetaToolChoiceTool | BetaToolChoiceNone +export const BetaToolChoice = Schema.Union([ + BetaToolChoiceAuto, + BetaToolChoiceAny, + BetaToolChoiceTool, + BetaToolChoiceNone +], { mode: "oneOf" }).annotate({ + "title": "Tool Choice", + "description": + "How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all." +}) +export type BetaRequestToolSearchToolResultError = { + readonly "error_code": BetaToolSearchToolResultErrorCode + readonly "type": "tool_search_tool_result_error" +} +export const BetaRequestToolSearchToolResultError = Schema.Struct({ + "error_code": BetaToolSearchToolResultErrorCode, + "type": Schema.Literal("tool_search_tool_result_error").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestToolSearchToolResultError" }) +export type BetaResponseToolSearchToolResultError = { + readonly "error_code": BetaToolSearchToolResultErrorCode + readonly "error_message": string | null + readonly "type": "tool_search_tool_result_error" +} +export const BetaResponseToolSearchToolResultError = Schema.Struct({ + "error_code": BetaToolSearchToolResultErrorCode, + "error_message": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Error Message", "default": null }), + "type": Schema.Literal("tool_search_tool_result_error").annotate({ + "title": "Type", + "default": "tool_search_tool_result_error" }) -}).annotate({ "title": "ListResponse[ModelInfo]" }) -export type ErrorResponse = { - readonly "error": - | InvalidRequestError - | AuthenticationError - | BillingError - | PermissionError - | NotFoundError - | RateLimitError - | GatewayTimeoutError - | APIError - | OverloadedError - readonly "request_id": string | null - readonly "type": "error" +}).annotate({ "title": "ResponseToolSearchToolResultError" }) +export type BetaClearToolUses20250919 = { + readonly "clear_at_least"?: BetaInputTokensClearAtLeast | null + readonly "clear_tool_inputs"?: boolean | ReadonlyArray | null + readonly "exclude_tools"?: ReadonlyArray | null + readonly "keep"?: BetaToolUsesKeep + readonly "trigger"?: BetaInputTokensTrigger | BetaToolUsesTrigger + readonly "type": "clear_tool_uses_20250919" } -export const ErrorResponse = Schema.Struct({ - "error": Schema.Union([ - InvalidRequestError, - AuthenticationError, - BillingError, - PermissionError, - NotFoundError, - RateLimitError, - GatewayTimeoutError, - APIError, - OverloadedError - ], { mode: "oneOf" }).annotate({ "title": "Error" }), - "request_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Request Id", "default": null }), - "type": Schema.Literal("error").annotate({ "title": "Type", "default": "error" }) -}).annotate({ "title": "ErrorResponse" }) -export type RequestBashCodeExecutionResultBlock = { - readonly "content": ReadonlyArray - readonly "return_code": number - readonly "stderr": string - readonly "stdout": string - readonly "type": "bash_code_execution_result" +export const BetaClearToolUses20250919 = Schema.Struct({ + "clear_at_least": Schema.optionalKey( + Schema.Union([BetaInputTokensClearAtLeast, Schema.Null]).annotate({ + "description": + "Minimum number of tokens that must be cleared when triggered. Context will only be modified if at least this many tokens can be removed." + }) + ), + "clear_tool_inputs": Schema.optionalKey( + Schema.Union([Schema.Boolean, Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Clear Tool Inputs", + "description": "Whether to clear all tool inputs (bool) or specific tool inputs to clear (list)" + }) + ), + "exclude_tools": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Exclude Tools", + "description": "Tool names whose uses are preserved from clearing" + }) + ), + "keep": Schema.optionalKey( + Schema.Union([BetaToolUsesKeep], { mode: "oneOf" }).annotate({ + "title": "Keep", + "description": "Number of tool uses to retain in the conversation" + }) + ), + "trigger": Schema.optionalKey( + Schema.Union([BetaInputTokensTrigger, BetaToolUsesTrigger], { mode: "oneOf" }).annotate({ + "title": "Trigger", + "description": "Condition that triggers the context management strategy" + }) + ), + "type": Schema.Literal("clear_tool_uses_20250919").annotate({ "title": "Type" }) +}).annotate({ "title": "ClearToolUses20250919" }) +export type BetaRequestImageBlock = { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "source": BetaBase64ImageSource | BetaURLImageSource | BetaFileImageSource + readonly "type": "image" } -export const RequestBashCodeExecutionResultBlock = Schema.Struct({ - "content": Schema.Array(RequestBashCodeExecutionOutputBlock).annotate({ "title": "Content" }), - "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), - "stderr": Schema.String.annotate({ "title": "Stderr" }), - "stdout": Schema.String.annotate({ "title": "Stdout" }), - "type": Schema.Literal("bash_code_execution_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestBashCodeExecutionResultBlock" }) -export type WebFetchTool_20250910 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> +export const BetaRequestImageBlock = Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "source": Schema.Union([BetaBase64ImageSource, BetaURLImageSource, BetaFileImageSource], { mode: "oneOf" }).annotate({ + "title": "Source" + }), + "type": Schema.Literal("image").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestImageBlock" }) +export type BetaCloudConfig = { + readonly "networking": BetaUnrestrictedNetwork | BetaLimitedNetwork + readonly "packages": { + readonly "apt": ReadonlyArray + readonly "cargo": ReadonlyArray + readonly "gem": ReadonlyArray + readonly "go": ReadonlyArray + readonly "npm": ReadonlyArray + readonly "pip": ReadonlyArray + readonly "type"?: "packages" + } + readonly "type": "cloud" +} +export const BetaCloudConfig = Schema.Struct({ + "networking": Schema.Union([BetaUnrestrictedNetwork, BetaLimitedNetwork], { mode: "oneOf" }).annotate({ + "title": "Networking", + "description": "Network configuration policy." + }), + "packages": Schema.Struct({ + "apt": Schema.Array(Schema.String).annotate({ "title": "Apt", "description": "Ubuntu/Debian packages to install" }), + "cargo": Schema.Array(Schema.String).annotate({ "title": "Cargo", "description": "Rust packages to install" }), + "gem": Schema.Array(Schema.String).annotate({ "title": "Gem", "description": "Ruby packages to install" }), + "go": Schema.Array(Schema.String).annotate({ "title": "Go", "description": "Go packages to install" }), + "npm": Schema.Array(Schema.String).annotate({ "title": "Npm", "description": "Node.js packages to install" }), + "pip": Schema.Array(Schema.String).annotate({ "title": "Pip", "description": "Python packages to install" }), + "type": Schema.optionalKey( + Schema.Literal("packages").annotate({ + "title": "Type", + "description": "Package configuration type", + "default": "packages" + }) + ) + }).annotate({ "title": "Packages", "description": "Package manager configuration." }), + "type": Schema.Literal("cloud").annotate({ "title": "Type", "description": "Environment type" }) +}).annotate({ "title": "CloudConfig", "description": "`cloud` environment configuration." }) +export type BetaCloudConfigParams = { + readonly "networking"?: BetaUnrestrictedNetwork | BetaLimitedNetworkParams | null + readonly "packages"?: BetaPackagesParams | null + readonly "type": "cloud" +} +export const BetaCloudConfigParams = Schema.Struct({ + "networking": Schema.optionalKey( + Schema.Union([Schema.Union([BetaUnrestrictedNetwork, BetaLimitedNetworkParams], { mode: "oneOf" }), Schema.Null]) + .annotate({ + "title": "Networking", + "description": "Network configuration policy. Omit on update to preserve the existing value." + }) + ), + "packages": Schema.optionalKey( + Schema.Union([BetaPackagesParams, Schema.Null]).annotate({ + "description": "Package manager configuration. Omit on update to preserve the existing value." + }) + ), + "type": Schema.Literal("cloud").annotate({ "title": "Type", "description": "Environment type" }) +}).annotate({ + "title": "CloudConfigParams", + "description": + "Request params for `cloud` environment configuration.\n\nFields default to null; on update, omitted fields preserve the\nexisting value." +}) +export type BetaWebSearchTool_20250305 = { + readonly "allowed_callers"?: ReadonlyArray readonly "allowed_domains"?: ReadonlyArray | null readonly "blocked_domains"?: ReadonlyArray | null - readonly "cache_control"?: CacheControlEphemeral | null - readonly "citations"?: RequestCitationsConfig | null + readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "defer_loading"?: boolean - readonly "max_content_tokens"?: number | null readonly "max_uses"?: number | null - readonly "name": "web_fetch" + readonly "name": "web_search" readonly "strict"?: boolean - readonly "type": "web_fetch_20250910" + readonly "type": "web_search_20250305" + readonly "user_location"?: BetaUserLocation | null } -export const WebFetchTool_20250910 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), +export const BetaWebSearchTool_20250305 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "allowed_domains": Schema.optionalKey( Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Allowed Domains", - "description": "List of domains to allow fetching from" + "description": + "If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`." }) ), "blocked_domains": Schema.optionalKey( Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Blocked Domains", - "description": "List of domains to block fetching from" + "description": + "If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`." }) ), "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "citations": Schema.optionalKey( - Schema.Union([RequestCitationsConfig, Schema.Null]).annotate({ - "description": "Citations configuration for fetched documents. Citations are disabled by default." - }) - ), "defer_loading": Schema.optionalKey( Schema.Boolean.annotate({ "title": "Defer Loading", @@ -5880,20 +7836,13 @@ export const WebFetchTool_20250910 = Schema.Struct({ "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." }) ), - "max_content_tokens": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ - "title": "Max Content Tokens", - "description": - "Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs." - }) - ), "max_uses": Schema.optionalKey( Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ "title": "Max Uses", "description": "Maximum number of times the tool can be used in the API request." }) ), - "name": Schema.Literal("web_fetch").annotate({ + "name": Schema.Literal("web_search").annotate({ "title": "Name", "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." }), @@ -5903,50 +7852,47 @@ export const WebFetchTool_20250910 = Schema.Struct({ "description": "When true, guarantees schema validation on tool names and inputs" }) ), - "type": Schema.Literal("web_fetch_20250910").annotate({ "title": "Type" }) -}).annotate({ "title": "WebFetchTool_20250910" }) -export type WebFetchTool_20260209 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> + "type": Schema.Literal("web_search_20250305").annotate({ "title": "Type" }), + "user_location": Schema.optionalKey( + Schema.Union([BetaUserLocation, Schema.Null]).annotate({ + "description": "Parameters for the user's location. Used to provide more relevant search results." + }) + ) +}).annotate({ "title": "WebSearchTool_20250305" }) +export type BetaWebSearchTool_20260209 = { + readonly "allowed_callers"?: ReadonlyArray readonly "allowed_domains"?: ReadonlyArray | null readonly "blocked_domains"?: ReadonlyArray | null - readonly "cache_control"?: CacheControlEphemeral | null - readonly "citations"?: RequestCitationsConfig | null + readonly "cache_control"?: BetaCacheControlEphemeral | null readonly "defer_loading"?: boolean - readonly "max_content_tokens"?: number | null readonly "max_uses"?: number | null - readonly "name": "web_fetch" + readonly "name": "web_search" readonly "strict"?: boolean - readonly "type": "web_fetch_20260209" + readonly "type": "web_search_20260209" + readonly "user_location"?: BetaUserLocation | null } -export const WebFetchTool_20260209 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), +export const BetaWebSearchTool_20260209 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), "allowed_domains": Schema.optionalKey( Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Allowed Domains", - "description": "List of domains to allow fetching from" + "description": + "If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`." }) ), "blocked_domains": Schema.optionalKey( Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Blocked Domains", - "description": "List of domains to block fetching from" + "description": + "If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`." }) ), "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "citations": Schema.optionalKey( - Schema.Union([RequestCitationsConfig, Schema.Null]).annotate({ - "description": "Citations configuration for fetched documents. Citations are disabled by default." - }) - ), "defer_loading": Schema.optionalKey( Schema.Boolean.annotate({ "title": "Defer Loading", @@ -5954,20 +7900,13 @@ export const WebFetchTool_20260209 = Schema.Struct({ "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." }) ), - "max_content_tokens": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ - "title": "Max Content Tokens", - "description": - "Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs." - }) - ), "max_uses": Schema.optionalKey( Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ "title": "Max Uses", "description": "Maximum number of times the tool can be used in the API request." }) ), - "name": Schema.Literal("web_fetch").annotate({ + "name": Schema.Literal("web_search").annotate({ "title": "Name", "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." }), @@ -5977,446 +7916,233 @@ export const WebFetchTool_20260209 = Schema.Struct({ "description": "When true, guarantees schema validation on tool names and inputs" }) ), - "type": Schema.Literal("web_fetch_20260209").annotate({ "title": "Type" }) -}).annotate({ "title": "WebFetchTool_20260209" }) -export type RequestCodeExecutionResultBlock = { - readonly "content": ReadonlyArray - readonly "return_code": number - readonly "stderr": string - readonly "stdout": string - readonly "type": "code_execution_result" + "type": Schema.Literal("web_search_20260209").annotate({ "title": "Type" }), + "user_location": Schema.optionalKey( + Schema.Union([BetaUserLocation, Schema.Null]).annotate({ + "description": "Parameters for the user's location. Used to provide more relevant search results." + }) + ) +}).annotate({ "title": "WebSearchTool_20260209" }) +export type BetaUserProfile = { + readonly "id": string + readonly "type": "user_profile" + readonly "external_id"?: string + readonly "name"?: string + readonly "relationship": "external" | "resold" | "internal" + readonly "trust_grants": { readonly [x: string]: BetaUserProfileTrustGrant } + readonly "created_at": string + readonly "metadata": { readonly [x: string]: string } + readonly "updated_at": string } -export const RequestCodeExecutionResultBlock = Schema.Struct({ - "content": Schema.Array(RequestCodeExecutionOutputBlock).annotate({ "title": "Content" }), - "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), - "stderr": Schema.String.annotate({ "title": "Stderr" }), - "stdout": Schema.String.annotate({ "title": "Stdout" }), - "type": Schema.Literal("code_execution_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestCodeExecutionResultBlock" }) -export type RequestEncryptedCodeExecutionResultBlock = { - readonly "content": ReadonlyArray - readonly "encrypted_stdout": string - readonly "return_code": number - readonly "stderr": string - readonly "type": "encrypted_code_execution_result" -} -export const RequestEncryptedCodeExecutionResultBlock = Schema.Struct({ - "content": Schema.Array(RequestCodeExecutionOutputBlock).annotate({ "title": "Content" }), - "encrypted_stdout": Schema.String.annotate({ "title": "Encrypted Stdout" }), - "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), - "stderr": Schema.String.annotate({ "title": "Stderr" }), - "type": Schema.Literal("encrypted_code_execution_result").annotate({ "title": "Type" }) -}).annotate({ - "title": "RequestEncryptedCodeExecutionResultBlock", - "description": "Code execution result with encrypted stdout for PFC + web_search results." -}) -export type RequestTextBlock = { - readonly "cache_control"?: CacheControlEphemeral | null - readonly "citations"?: - | ReadonlyArray< - | RequestCharLocationCitation - | RequestPageLocationCitation - | RequestContentBlockLocationCitation - | RequestWebSearchResultLocationCitation - | RequestSearchResultLocationCitation - > - | null - readonly "text": string - readonly "type": "text" -} -export const RequestTextBlock = Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) +export const BetaUserProfile = Schema.Struct({ + "id": Schema.String.annotate({ "description": "Unique identifier for this user profile, prefixed `uprof_`." }), + "type": Schema.Literal("user_profile").annotate({ "description": "Object type. Always `user_profile`." }), + "external_id": Schema.optionalKey( + Schema.String.annotate({ "description": "Platform's own identifier for this user. Not enforced unique." }) ), - "citations": Schema.optionalKey( - Schema.Union([ - Schema.Array( - Schema.Union([ - RequestCharLocationCitation, - RequestPageLocationCitation, - RequestContentBlockLocationCitation, - RequestWebSearchResultLocationCitation, - RequestSearchResultLocationCitation - ], { mode: "oneOf" }) - ), - Schema.Null - ]).annotate({ "title": "Citations" }) + "name": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Display name of the entity this profile represents. For `resold` this is the resold-to company's name." + }) ), - "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(1)), - "type": Schema.Literal("text").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestTextBlock" }) -export type ResponseBashCodeExecutionResultBlock = { - readonly "content": ReadonlyArray - readonly "return_code": number - readonly "stderr": string - readonly "stdout": string - readonly "type": "bash_code_execution_result" -} -export const ResponseBashCodeExecutionResultBlock = Schema.Struct({ - "content": Schema.Array(ResponseBashCodeExecutionOutputBlock).annotate({ "title": "Content" }), - "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), - "stderr": Schema.String.annotate({ "title": "Stderr" }), - "stdout": Schema.String.annotate({ "title": "Stdout" }), - "type": Schema.Literal("bash_code_execution_result").annotate({ - "title": "Type", - "default": "bash_code_execution_result" - }) -}).annotate({ "title": "ResponseBashCodeExecutionResultBlock" }) -export type ResponseDocumentBlock = { - readonly "citations": ResponseCitationsConfig | null - readonly "source": Base64PDFSource | PlainTextSource - readonly "title": string | null - readonly "type": "document" -} -export const ResponseDocumentBlock = Schema.Struct({ - "citations": Schema.Union([ResponseCitationsConfig, Schema.Null]).annotate({ - "description": "Citation configuration for the document", - "default": null + "relationship": Schema.Literals(["external", "resold", "internal"]).annotate({ + "description": + "How the entity behind a user profile relates to the platform that owns the API key. `external`: an individual end-user of the platform. `resold`: a company the platform resells Claude access to. `internal`: the platform's own usage." }), - "source": Schema.Union([Base64PDFSource, PlainTextSource], { mode: "oneOf" }).annotate({ "title": "Source" }), - "title": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Title", - "description": "The title of the document", - "default": null + "trust_grants": Schema.Record(Schema.String, BetaUserProfileTrustGrant).annotate({ + "description": + "Trust grants for this profile, keyed by grant name. Key omitted when no grant is active or in flight." }), - "type": Schema.Literal("document").annotate({ "title": "Type", "default": "document" }) -}).annotate({ "title": "ResponseDocumentBlock" }) -export type ResponseCodeExecutionResultBlock = { - readonly "content": ReadonlyArray - readonly "return_code": number - readonly "stderr": string - readonly "stdout": string - readonly "type": "code_execution_result" + "created_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "metadata": Schema.Record(Schema.String, Schema.String).annotate({ + "description": "Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars." + }), + "updated_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) +}) +export type BetaRequestWebFetchToolResultError = { + readonly "error_code": BetaWebFetchToolResultErrorCode + readonly "type": "web_fetch_tool_result_error" } -export const ResponseCodeExecutionResultBlock = Schema.Struct({ - "content": Schema.Array(ResponseCodeExecutionOutputBlock).annotate({ "title": "Content" }), - "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), - "stderr": Schema.String.annotate({ "title": "Stderr" }), - "stdout": Schema.String.annotate({ "title": "Stdout" }), - "type": Schema.Literal("code_execution_result").annotate({ "title": "Type", "default": "code_execution_result" }) -}).annotate({ "title": "ResponseCodeExecutionResultBlock" }) -export type ResponseEncryptedCodeExecutionResultBlock = { - readonly "content": ReadonlyArray - readonly "encrypted_stdout": string - readonly "return_code": number - readonly "stderr": string - readonly "type": "encrypted_code_execution_result" +export const BetaRequestWebFetchToolResultError = Schema.Struct({ + "error_code": BetaWebFetchToolResultErrorCode, + "type": Schema.Literal("web_fetch_tool_result_error").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestWebFetchToolResultError" }) +export type BetaResponseWebFetchToolResultError = { + readonly "error_code": BetaWebFetchToolResultErrorCode + readonly "type": "web_fetch_tool_result_error" } -export const ResponseEncryptedCodeExecutionResultBlock = Schema.Struct({ - "content": Schema.Array(ResponseCodeExecutionOutputBlock).annotate({ "title": "Content" }), - "encrypted_stdout": Schema.String.annotate({ "title": "Encrypted Stdout" }), - "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), - "stderr": Schema.String.annotate({ "title": "Stderr" }), - "type": Schema.Literal("encrypted_code_execution_result").annotate({ +export const BetaResponseWebFetchToolResultError = Schema.Struct({ + "error_code": BetaWebFetchToolResultErrorCode, + "type": Schema.Literal("web_fetch_tool_result_error").annotate({ "title": "Type", - "default": "encrypted_code_execution_result" + "default": "web_fetch_tool_result_error" }) -}).annotate({ - "title": "ResponseEncryptedCodeExecutionResultBlock", - "description": "Code execution result with encrypted stdout for PFC + web_search results." -}) -export type ResponseToolSearchToolSearchResultBlock = { - readonly "tool_references": ReadonlyArray - readonly "type": "tool_search_tool_search_result" +}).annotate({ "title": "ResponseWebFetchToolResultError" }) +export type BetaRequestWebSearchToolResultError = { + readonly "error_code": BetaWebSearchToolResultErrorCode + readonly "type": "web_search_tool_result_error" } -export const ResponseToolSearchToolSearchResultBlock = Schema.Struct({ - "tool_references": Schema.Array(ResponseToolReferenceBlock).annotate({ "title": "Tool References" }), - "type": Schema.Literal("tool_search_tool_search_result").annotate({ +export const BetaRequestWebSearchToolResultError = Schema.Struct({ + "error_code": BetaWebSearchToolResultErrorCode, + "type": Schema.Literal("web_search_tool_result_error").annotate({ "title": "Type" }) +}).annotate({ "title": "Error" }) +export type BetaResponseWebSearchToolResultError = { + readonly "error_code": BetaWebSearchToolResultErrorCode + readonly "type": "web_search_tool_result_error" +} +export const BetaResponseWebSearchToolResultError = Schema.Struct({ + "error_code": BetaWebSearchToolResultErrorCode, + "type": Schema.Literal("web_search_tool_result_error").annotate({ "title": "Type", - "default": "tool_search_tool_search_result" + "default": "web_search_tool_result_error" }) -}).annotate({ "title": "ResponseToolSearchToolSearchResultBlock" }) -export type CitationsDelta = { - readonly "citation": - | ResponseCharLocationCitation - | ResponsePageLocationCitation - | ResponseContentBlockLocationCitation - | ResponseWebSearchResultLocationCitation - | ResponseSearchResultLocationCitation - readonly "type": "citations_delta" +}).annotate({ "title": "ResponseWebSearchToolResultError" }) +export type BetaWebhookEventData = + | BetaWebhookSessionCreatedEventData + | BetaWebhookSessionPendingEventData + | BetaWebhookSessionRunningEventData + | BetaWebhookSessionIdledEventData + | BetaWebhookSessionRequiresActionEventData + | BetaWebhookSessionArchivedEventData + | BetaWebhookSessionDeletedEventData + | BetaWebhookSessionStatusRescheduledEventData + | BetaWebhookSessionStatusRunStartedEventData + | BetaWebhookSessionStatusIdledEventData + | BetaWebhookSessionStatusTerminatedEventData + | BetaWebhookSessionThreadCreatedEventData + | BetaWebhookSessionThreadIdledEventData + | BetaWebhookSessionThreadTerminatedEventData + | BetaWebhookSessionOutcomeEvaluationEndedEventData + | BetaWebhookVaultCreatedEventData + | BetaWebhookVaultArchivedEventData + | BetaWebhookVaultDeletedEventData + | BetaWebhookVaultCredentialCreatedEventData + | BetaWebhookVaultCredentialArchivedEventData + | BetaWebhookVaultCredentialDeletedEventData + | BetaWebhookVaultCredentialRefreshFailedEventData +export const BetaWebhookEventData = Schema.Union([ + BetaWebhookSessionCreatedEventData, + BetaWebhookSessionPendingEventData, + BetaWebhookSessionRunningEventData, + BetaWebhookSessionIdledEventData, + BetaWebhookSessionRequiresActionEventData, + BetaWebhookSessionArchivedEventData, + BetaWebhookSessionDeletedEventData, + BetaWebhookSessionStatusRescheduledEventData, + BetaWebhookSessionStatusRunStartedEventData, + BetaWebhookSessionStatusIdledEventData, + BetaWebhookSessionStatusTerminatedEventData, + BetaWebhookSessionThreadCreatedEventData, + BetaWebhookSessionThreadIdledEventData, + BetaWebhookSessionThreadTerminatedEventData, + BetaWebhookSessionOutcomeEvaluationEndedEventData, + BetaWebhookVaultCreatedEventData, + BetaWebhookVaultArchivedEventData, + BetaWebhookVaultDeletedEventData, + BetaWebhookVaultCredentialCreatedEventData, + BetaWebhookVaultCredentialArchivedEventData, + BetaWebhookVaultCredentialDeletedEventData, + BetaWebhookVaultCredentialRefreshFailedEventData +], { mode: "oneOf" }).annotate({ "title": "BetaWebhookEventData" }) +export type BetaListSkillsResponse = { + readonly "data": ReadonlyArray + readonly "has_more": boolean + readonly "next_page": string | null } -export const CitationsDelta = Schema.Struct({ - "citation": Schema.Union([ - ResponseCharLocationCitation, - ResponsePageLocationCitation, - ResponseContentBlockLocationCitation, - ResponseWebSearchResultLocationCitation, - ResponseSearchResultLocationCitation - ], { mode: "oneOf" }).annotate({ "title": "Citation" }), - "type": Schema.Literal("citations_delta").annotate({ "title": "Type", "default": "citations_delta" }) -}).annotate({ "title": "CitationsDelta" }) -export type ResponseTextBlock = { - readonly "citations"?: - | ReadonlyArray< - | ResponseCharLocationCitation - | ResponsePageLocationCitation - | ResponseContentBlockLocationCitation - | ResponseWebSearchResultLocationCitation - | ResponseSearchResultLocationCitation - > - | null - readonly "text": string - readonly "type": "text" +export const BetaListSkillsResponse = Schema.Struct({ + "data": Schema.Array(Betaapi__schemas__skills__Skill).annotate({ "title": "Data", "description": "List of skills." }), + "has_more": Schema.Boolean.annotate({ + "title": "Has More", + "description": + "Whether there are more results available.\n\nIf `true`, there are additional results that can be fetched using the `next_page` token." + }), + "next_page": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Next Page", + "description": + "Token for fetching the next page of results.\n\nIf `null`, there are no more results available. Pass this value to the `page_token` parameter in the next request to get the next page." + }) +}).annotate({ "title": "ListSkillsResponse" }) +export type CodeExecutionTool_20250522 = { + readonly "allowed_callers"?: ReadonlyArray + readonly "cache_control"?: CacheControlEphemeral | null + readonly "defer_loading"?: boolean + readonly "name": "code_execution" + readonly "strict"?: boolean + readonly "type": "code_execution_20250522" } -export const ResponseTextBlock = Schema.Struct({ - "citations": Schema.optionalKey( - Schema.Union([ - Schema.Array( - Schema.Union([ - ResponseCharLocationCitation, - ResponsePageLocationCitation, - ResponseContentBlockLocationCitation, - ResponseWebSearchResultLocationCitation, - ResponseSearchResultLocationCitation - ], { mode: "oneOf" }) - ), - Schema.Null - ]).annotate({ - "title": "Citations", +export const CodeExecutionTool_20250522 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Defer Loading", "description": - "Citations supporting the text block.\n\nThe type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.", - "default": null + "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." }) ), - "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(0)).check(Schema.isMaxLength(5000000)), - "type": Schema.Literal("text").annotate({ "title": "Type", "default": "text" }) -}).annotate({ "title": "ResponseTextBlock" }) -export type RequestServerToolUseBlock = { - readonly "cache_control"?: CacheControlEphemeral | null - readonly "caller"?: DirectCaller | ServerToolCaller | ServerToolCaller_20260120 - readonly "id": string - readonly "input": { readonly [x: string]: Schema.Json } - readonly "name": - | "web_search" - | "web_fetch" - | "code_execution" - | "bash_code_execution" - | "text_editor_code_execution" - | "tool_search_tool_regex" - | "tool_search_tool_bm25" - readonly "type": "server_tool_use" + "name": Schema.Literal("code_execution").annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." + }), + "strict": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" + }) + ), + "type": Schema.Literal("code_execution_20250522").annotate({ "title": "Type" }) +}).annotate({ "title": "CodeExecutionTool_20250522" }) +export type CodeExecutionTool_20250825 = { + readonly "allowed_callers"?: ReadonlyArray + readonly "cache_control"?: CacheControlEphemeral | null + readonly "defer_loading"?: boolean + readonly "name": "code_execution" + readonly "strict"?: boolean + readonly "type": "code_execution_20250825" } -export const RequestServerToolUseBlock = Schema.Struct({ +export const CodeExecutionTool_20250825 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "caller": Schema.optionalKey( - Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({ - "title": "Caller" + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Defer Loading", + "description": + "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." }) ), - "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))), - "input": Schema.Record(Schema.String, Schema.Json).annotate({ "title": "Input" }), - "name": Schema.Literals([ - "web_search", - "web_fetch", - "code_execution", - "bash_code_execution", - "text_editor_code_execution", - "tool_search_tool_regex", - "tool_search_tool_bm25" - ]).annotate({ "title": "Name" }), - "type": Schema.Literal("server_tool_use").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestServerToolUseBlock" }) -export type ResponseServerToolUseBlock = { - readonly "caller": DirectCaller | ServerToolCaller | ServerToolCaller_20260120 - readonly "id": string - readonly "input": { readonly [x: string]: Schema.Json } - readonly "name": - | "web_search" - | "web_fetch" - | "code_execution" - | "bash_code_execution" - | "text_editor_code_execution" - | "tool_search_tool_regex" - | "tool_search_tool_bm25" - readonly "type": "server_tool_use" -} -export const ResponseServerToolUseBlock = Schema.Struct({ - "caller": Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({ - "title": "Caller", - "default": { "type": "direct" } - }), - "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))), - "input": Schema.Record(Schema.String, Schema.Json).annotate({ "title": "Input" }), - "name": Schema.Literals([ - "web_search", - "web_fetch", - "code_execution", - "bash_code_execution", - "text_editor_code_execution", - "tool_search_tool_regex", - "tool_search_tool_bm25" - ]).annotate({ "title": "Name" }), - "type": Schema.Literal("server_tool_use").annotate({ "title": "Type", "default": "server_tool_use" }) -}).annotate({ "title": "ResponseServerToolUseBlock" }) -export type ResponseToolUseBlock = { - readonly "caller": DirectCaller | ServerToolCaller | ServerToolCaller_20260120 - readonly "id": string - readonly "input": { readonly [x: string]: Schema.Json } - readonly "name": string - readonly "type": "tool_use" -} -export const ResponseToolUseBlock = Schema.Struct({ - "caller": Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({ - "title": "Caller", - "default": { "type": "direct" } - }), - "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$"))), - "input": Schema.Record(Schema.String, Schema.Json).annotate({ "title": "Input" }), - "name": Schema.String.annotate({ "title": "Name" }).check(Schema.isMinLength(1)), - "type": Schema.Literal("tool_use").annotate({ "title": "Type", "default": "tool_use" }) -}).annotate({ "title": "ResponseToolUseBlock" }) -export type ListSkillsResponse = { - readonly "data": ReadonlyArray - readonly "has_more": boolean - readonly "next_page": string | null -} -export const ListSkillsResponse = Schema.Struct({ - "data": Schema.Array(Skill).annotate({ "title": "Data", "description": "List of skills." }), - "has_more": Schema.Boolean.annotate({ - "title": "Has More", - "description": - "Whether there are more results available.\n\nIf `true`, there are additional results that can be fetched using the `next_page` token." - }), - "next_page": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Next Page", - "description": - "Token for fetching the next page of results.\n\nIf `null`, there are no more results available. Pass this value to the `page_token` parameter in the next request to get the next page." - }) -}).annotate({ "title": "ListSkillsResponse" }) -export type ListSkillVersionsResponse = { - readonly "data": ReadonlyArray - readonly "has_more": boolean - readonly "next_page": string | null -} -export const ListSkillVersionsResponse = Schema.Struct({ - "data": Schema.Array(SkillVersion).annotate({ "title": "Data", "description": "List of skill versions." }), - "has_more": Schema.Boolean.annotate({ - "title": "Has More", - "description": "Indicates if there are more results in the requested page direction." + "name": Schema.Literal("code_execution").annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." }), - "next_page": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Next Page", - "description": "Token to provide in as `page` in the subsequent request to retrieve the next page of data." - }) -}).annotate({ "title": "ListSkillVersionsResponse" }) -export type RequestTextEditorCodeExecutionToolResultError = { - readonly "error_code": TextEditorCodeExecutionToolResultErrorCode - readonly "error_message"?: string | null - readonly "type": "text_editor_code_execution_tool_result_error" -} -export const RequestTextEditorCodeExecutionToolResultError = Schema.Struct({ - "error_code": TextEditorCodeExecutionToolResultErrorCode, - "error_message": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Error Message" }) - ), - "type": Schema.Literal("text_editor_code_execution_tool_result_error").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestTextEditorCodeExecutionToolResultError" }) -export type ResponseTextEditorCodeExecutionToolResultError = { - readonly "error_code": TextEditorCodeExecutionToolResultErrorCode - readonly "error_message": string | null - readonly "type": "text_editor_code_execution_tool_result_error" -} -export const ResponseTextEditorCodeExecutionToolResultError = Schema.Struct({ - "error_code": TextEditorCodeExecutionToolResultErrorCode, - "error_message": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Error Message", "default": null }), - "type": Schema.Literal("text_editor_code_execution_tool_result_error").annotate({ - "title": "Type", - "default": "text_editor_code_execution_tool_result_error" - }) -}).annotate({ "title": "ResponseTextEditorCodeExecutionToolResultError" }) -export type ThinkingConfigParam = ThinkingConfigEnabled | ThinkingConfigDisabled | ThinkingConfigAdaptive -export const ThinkingConfigParam = Schema.Union( - [ThinkingConfigEnabled, ThinkingConfigDisabled, ThinkingConfigAdaptive], - { mode: "oneOf" } -).annotate({ - "title": "Thinking", - "description": - "Configuration for enabling Claude's extended thinking.\n\nWhen enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit.\n\nSee [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details." -}) -export type ToolChoice = ToolChoiceAuto | ToolChoiceAny | ToolChoiceTool | ToolChoiceNone -export const ToolChoice = Schema.Union([ToolChoiceAuto, ToolChoiceAny, ToolChoiceTool, ToolChoiceNone], { - mode: "oneOf" -}).annotate({ - "title": "Tool Choice", - "description": - "How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all." -}) -export type RequestToolSearchToolResultError = { - readonly "error_code": ToolSearchToolResultErrorCode - readonly "type": "tool_search_tool_result_error" -} -export const RequestToolSearchToolResultError = Schema.Struct({ - "error_code": ToolSearchToolResultErrorCode, - "type": Schema.Literal("tool_search_tool_result_error").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestToolSearchToolResultError" }) -export type ResponseToolSearchToolResultError = { - readonly "error_code": ToolSearchToolResultErrorCode - readonly "error_message": string | null - readonly "type": "tool_search_tool_result_error" -} -export const ResponseToolSearchToolResultError = Schema.Struct({ - "error_code": ToolSearchToolResultErrorCode, - "error_message": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Error Message", "default": null }), - "type": Schema.Literal("tool_search_tool_result_error").annotate({ - "title": "Type", - "default": "tool_search_tool_result_error" - }) -}).annotate({ "title": "ResponseToolSearchToolResultError" }) -export type RequestImageBlock = { - readonly "cache_control"?: CacheControlEphemeral | null - readonly "source": Base64ImageSource | URLImageSource - readonly "type": "image" -} -export const RequestImageBlock = Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." + "strict": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" }) ), - "source": Schema.Union([Base64ImageSource, URLImageSource], { mode: "oneOf" }).annotate({ "title": "Source" }), - "type": Schema.Literal("image").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestImageBlock" }) -export type WebSearchTool_20250305 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "allowed_domains"?: ReadonlyArray | null - readonly "blocked_domains"?: ReadonlyArray | null + "type": Schema.Literal("code_execution_20250825").annotate({ "title": "Type" }) +}).annotate({ "title": "CodeExecutionTool_20250825" }) +export type CodeExecutionTool_20260120 = { + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: CacheControlEphemeral | null readonly "defer_loading"?: boolean - readonly "max_uses"?: number | null - readonly "name": "web_search" + readonly "name": "code_execution" readonly "strict"?: boolean - readonly "type": "web_search_20250305" - readonly "user_location"?: UserLocation | null + readonly "type": "code_execution_20260120" } -export const WebSearchTool_20250305 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" - }) - ), - "allowed_domains": Schema.optionalKey( - Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ - "title": "Allowed Domains", - "description": - "If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`." - }) - ), - "blocked_domains": Schema.optionalKey( - Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ - "title": "Blocked Domains", - "description": - "If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`." - }) - ), +export const CodeExecutionTool_20260120 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -6430,13 +8156,7 @@ export const WebSearchTool_20250305 = Schema.Struct({ "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." }) ), - "max_uses": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ - "title": "Max Uses", - "description": "Maximum number of times the tool can be used in the API request." - }) - ), - "name": Schema.Literal("web_search").annotate({ + "name": Schema.Literal("code_execution").annotate({ "title": "Name", "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." }), @@ -6446,45 +8166,95 @@ export const WebSearchTool_20250305 = Schema.Struct({ "description": "When true, guarantees schema validation on tool names and inputs" }) ), - "type": Schema.Literal("web_search_20250305").annotate({ "title": "Type" }), - "user_location": Schema.optionalKey( - Schema.Union([UserLocation, Schema.Null]).annotate({ - "description": "Parameters for the user's location. Used to provide more relevant search results." - }) - ) -}).annotate({ "title": "WebSearchTool_20250305" }) -export type WebSearchTool_20260209 = { - readonly "allowed_callers"?: ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> - readonly "allowed_domains"?: ReadonlyArray | null - readonly "blocked_domains"?: ReadonlyArray | null + "type": Schema.Literal("code_execution_20260120").annotate({ "title": "Type" }) +}).annotate({ + "title": "CodeExecutionTool_20260120", + "description": "Code execution tool with REPL state persistence (daemon mode + gVisor checkpoint)." +}) +export type RequestContainerUploadBlock = { + readonly "cache_control"?: CacheControlEphemeral | null + readonly "file_id": string + readonly "type": "container_upload" +} +export const RequestContainerUploadBlock = Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "file_id": Schema.String.annotate({ "title": "File Id" }), + "type": Schema.Literal("container_upload").annotate({ "title": "Type" }) +}).annotate({ + "title": "RequestContainerUploadBlock", + "description": + "A content block that represents a file to be uploaded to the container\nFiles uploaded via this block will be available in the container's input directory." +}) +export type RequestToolReferenceBlock = { + readonly "cache_control"?: CacheControlEphemeral | null + readonly "tool_name": string + readonly "type": "tool_reference" +} +export const RequestToolReferenceBlock = Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "tool_name": Schema.String.annotate({ "title": "Tool Name" }).check(Schema.isMinLength(1)).check( + Schema.isMaxLength(256) + ).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]{1,256}$"))), + "type": Schema.Literal("tool_reference").annotate({ "title": "Type" }) +}).annotate({ + "title": "RequestToolReferenceBlock", + "description": "Tool reference block that can be included in tool_result content." +}) +export type ToolSearchToolBM25_20251119 = { + readonly "allowed_callers"?: ReadonlyArray readonly "cache_control"?: CacheControlEphemeral | null readonly "defer_loading"?: boolean - readonly "max_uses"?: number | null - readonly "name": "web_search" + readonly "name": "tool_search_tool_bm25" readonly "strict"?: boolean - readonly "type": "web_search_20260209" - readonly "user_location"?: UserLocation | null + readonly "type": "tool_search_tool_bm25_20251119" | "tool_search_tool_bm25" } -export const WebSearchTool_20260209 = Schema.Struct({ - "allowed_callers": Schema.optionalKey( - Schema.Array(Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"])).annotate({ - "title": "Allowed Callers" +export const ToolSearchToolBM25_20251119 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." }) ), - "allowed_domains": Schema.optionalKey( - Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ - "title": "Allowed Domains", + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Defer Loading", "description": - "If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`." + "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." }) ), - "blocked_domains": Schema.optionalKey( - Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ - "title": "Blocked Domains", - "description": - "If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`." + "name": Schema.Literal("tool_search_tool_bm25").annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." + }), + "strict": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" }) ), + "type": Schema.Literals(["tool_search_tool_bm25_20251119", "tool_search_tool_bm25"]).annotate({ "title": "Type" }) +}).annotate({ "title": "ToolSearchToolBM25_20251119" }) +export type ToolSearchToolRegex_20251119 = { + readonly "allowed_callers"?: ReadonlyArray + readonly "cache_control"?: CacheControlEphemeral | null + readonly "defer_loading"?: boolean + readonly "name": "tool_search_tool_regex" + readonly "strict"?: boolean + readonly "type": "tool_search_tool_regex_20251119" | "tool_search_tool_regex" +} +export const ToolSearchToolRegex_20251119 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", @@ -6498,13 +8268,7 @@ export const WebSearchTool_20260209 = Schema.Struct({ "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." }) ), - "max_uses": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ - "title": "Max Uses", - "description": "Maximum number of times the tool can be used in the API request." - }) - ), - "name": Schema.Literal("web_search").annotate({ + "name": Schema.Literal("tool_search_tool_regex").annotate({ "title": "Name", "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." }), @@ -6514,5265 +8278,15082 @@ export const WebSearchTool_20260209 = Schema.Struct({ "description": "When true, guarantees schema validation on tool names and inputs" }) ), - "type": Schema.Literal("web_search_20260209").annotate({ "title": "Type" }), - "user_location": Schema.optionalKey( - Schema.Union([UserLocation, Schema.Null]).annotate({ - "description": "Parameters for the user's location. Used to provide more relevant search results." - }) - ) -}).annotate({ "title": "WebSearchTool_20260209" }) -export type RequestWebFetchToolResultError = { - readonly "error_code": WebFetchToolResultErrorCode - readonly "type": "web_fetch_tool_result_error" -} -export const RequestWebFetchToolResultError = Schema.Struct({ - "error_code": WebFetchToolResultErrorCode, - "type": Schema.Literal("web_fetch_tool_result_error").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestWebFetchToolResultError" }) -export type ResponseWebFetchToolResultError = { - readonly "error_code": WebFetchToolResultErrorCode - readonly "type": "web_fetch_tool_result_error" -} -export const ResponseWebFetchToolResultError = Schema.Struct({ - "error_code": WebFetchToolResultErrorCode, - "type": Schema.Literal("web_fetch_tool_result_error").annotate({ - "title": "Type", - "default": "web_fetch_tool_result_error" - }) -}).annotate({ "title": "ResponseWebFetchToolResultError" }) -export type RequestWebSearchToolResultError = { - readonly "error_code": WebSearchToolResultErrorCode - readonly "type": "web_search_tool_result_error" + "type": Schema.Literals(["tool_search_tool_regex_20251119", "tool_search_tool_regex"]).annotate({ "title": "Type" }) +}).annotate({ "title": "ToolSearchToolRegex_20251119" }) +export type RequestCodeExecutionToolResultError = { + readonly "error_code": CodeExecutionToolResultErrorCode + readonly "type": "code_execution_tool_result_error" } -export const RequestWebSearchToolResultError = Schema.Struct({ - "error_code": WebSearchToolResultErrorCode, - "type": Schema.Literal("web_search_tool_result_error").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestWebSearchToolResultError" }) -export type ResponseWebSearchToolResultError = { - readonly "error_code": WebSearchToolResultErrorCode - readonly "type": "web_search_tool_result_error" +export const RequestCodeExecutionToolResultError = Schema.Struct({ + "error_code": CodeExecutionToolResultErrorCode, + "type": Schema.Literal("code_execution_tool_result_error").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestCodeExecutionToolResultError" }) +export type ResponseCodeExecutionToolResultError = { + readonly "error_code": CodeExecutionToolResultErrorCode + readonly "type": "code_execution_tool_result_error" } -export const ResponseWebSearchToolResultError = Schema.Struct({ - "error_code": WebSearchToolResultErrorCode, - "type": Schema.Literal("web_search_tool_result_error").annotate({ +export const ResponseCodeExecutionToolResultError = Schema.Struct({ + "error_code": CodeExecutionToolResultErrorCode, + "type": Schema.Literal("code_execution_tool_result_error").annotate({ "title": "Type", - "default": "web_search_tool_result_error" + "default": "code_execution_tool_result_error" }) -}).annotate({ "title": "ResponseWebSearchToolResultError" }) -export type MessageDelta = { - readonly "container": Container | null - readonly "stop_reason": StopReason | null - readonly "stop_sequence": string | null -} -export const MessageDelta = Schema.Struct({ - "container": Schema.Union([Container, Schema.Null]).annotate({ - "description": - "Information about the container used in this request.\n\nThis will be non-null if a container tool (e.g. code execution) was used.", - "default": null - }), - "stop_reason": Schema.Union([StopReason, Schema.Null]).annotate({ "title": "Stop Reason", "default": null }), - "stop_sequence": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Stop Sequence", "default": null }) -}).annotate({ "title": "MessageDelta" }) -export type CompletionRequest = { - readonly "model": Model - readonly "prompt": string - readonly "max_tokens_to_sample": number - readonly "stop_sequences"?: ReadonlyArray - readonly "temperature"?: number - readonly "top_p"?: number - readonly "top_k"?: number - readonly "metadata"?: { readonly "user_id"?: string | null } - readonly "stream"?: boolean +}).annotate({ "title": "ResponseCodeExecutionToolResultError" }) +export type BashTool_20250124 = { + readonly "allowed_callers"?: ReadonlyArray + readonly "cache_control"?: CacheControlEphemeral | null + readonly "defer_loading"?: boolean + readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }> + readonly "name": "bash" + readonly "strict"?: boolean + readonly "type": "bash_20250124" } -export const CompletionRequest = Schema.Struct({ - "model": Model, - "prompt": Schema.String.annotate({ - "title": "Prompt", - "description": - "The prompt that you want Claude to complete.\n\nFor proper response generation you will need to format your prompt using alternating `\\n\\nHuman:` and `\\n\\nAssistant:` conversational turns. For example:\n\n```\n\"\\n\\nHuman: {userQuestion}\\n\\nAssistant:\"\n```\n\nSee [prompt validation](https://docs.claude.com/en/api/prompt-validation) and our guide to [prompt design](https://docs.claude.com/en/docs/intro-to-prompting) for more details." - }).check(Schema.isMinLength(1)), - "max_tokens_to_sample": Schema.Number.annotate({ - "title": "Max Tokens To Sample", - "description": - "The maximum number of tokens to generate before stopping.\n\nNote that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), - "stop_sequences": Schema.optionalKey( - Schema.Array(Schema.String).annotate({ - "title": "Stop Sequences", - "description": - "Sequences that will cause the model to stop generating.\n\nOur models stop on `\"\\n\\nHuman:\"`, and may include additional built-in stop sequences in the future. By providing the stop_sequences parameter, you may include additional strings that will cause the model to stop generating." +export const BashTool_20250124 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." }) ), - "temperature": Schema.optionalKey( - Schema.Number.annotate({ - "title": "Temperature", - "description": - "Amount of randomness injected into the response.\n\nDefaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.\n\nNote that even with `temperature` of `0.0`, the results will not be fully deterministic." - }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)) - ), - "top_p": Schema.optionalKey( - Schema.Number.annotate({ - "title": "Top P", - "description": - "Use nucleus sampling.\n\nIn nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.\n\nRecommended for advanced use cases only. You usually only need to use `temperature`." - }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)) - ), - "top_k": Schema.optionalKey( - Schema.Number.annotate({ - "title": "Top K", + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Defer Loading", "description": - "Only sample from the top K options for each subsequent token.\n\nUsed to remove \"long tail\" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).\n\nRecommended for advanced use cases only. You usually only need to use `temperature`." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)) + "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + }) ), - "metadata": Schema.optionalKey( - Schema.Struct({ - "user_id": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMaxLength(256)), Schema.Null]).annotate({ - "title": "User Id", - "description": - "An external identifier for the user who is associated with the request.\n\nThis should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number." - }) - ) - }).annotate({ "title": "Metadata", "description": "An object describing metadata about the request." }) + "input_examples": Schema.optionalKey( + Schema.Array(Schema.Record(Schema.String, JsonValue)).annotate({ "title": "Input Examples" }) ), - "stream": Schema.optionalKey( + "name": Schema.Literal("bash").annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." + }), + "strict": Schema.optionalKey( Schema.Boolean.annotate({ - "title": "Stream", - "description": - "Whether to incrementally stream the response using server-sent events.\n\nSee [streaming](https://docs.claude.com/en/api/streaming) for details." + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" }) - ) -}).annotate({ "title": "CompletionRequest" }) -export type CompletionResponse = { - readonly "completion": string - readonly "id": string - readonly "model": Model - readonly "stop_reason": string | null - readonly "type": "completion" -} -export const CompletionResponse = Schema.Struct({ - "completion": Schema.String.annotate({ - "title": "Completion", - "description": "The resulting completion up to and excluding the stop sequences." - }), - "id": Schema.String.annotate({ - "title": "Id", - "description": "Unique object identifier.\n\nThe format and length of IDs may change over time." - }), - "model": Model, - "stop_reason": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Stop Reason", - "description": - "The reason that we stopped.\n\nThis may be one the following values:\n* `\"stop_sequence\"`: we reached a stop sequence — either provided by you via the `stop_sequences` parameter, or a stop sequence built into the model\n* `\"max_tokens\"`: we exceeded `max_tokens_to_sample` or the model's maximum" - }), - "type": Schema.Literal("completion").annotate({ - "title": "Type", - "description": "Object type.\n\nFor Text Completions, this is always `\"completion\"`.", - "default": "completion" - }) -}).annotate({ "title": "CompletionResponse" }) -export type BetaRequestToolSearchToolSearchResultBlock = { - readonly "tool_references": ReadonlyArray - readonly "type": "tool_search_tool_search_result" -} -export const BetaRequestToolSearchToolSearchResultBlock = Schema.Struct({ - "tool_references": Schema.Array(BetaRequestToolReferenceBlock).annotate({ "title": "Tool References" }), - "type": Schema.Literal("tool_search_tool_search_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestToolSearchToolSearchResultBlock" }) -export type BetaIterationsUsage = ReadonlyArray | null -export const BetaIterationsUsage = Schema.Union([ - Schema.Array(Schema.Union([BetaMessageIterationUsage, BetaCompactionIterationUsage])), - Schema.Null -]).annotate({ - "title": "Iterations", - "description": - "Per-iteration token usage breakdown.\n\nEach entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:\n- Determine which iterations exceeded long context thresholds (>=200k tokens)\n- Calculate the true context window size from the last iteration\n- Understand token accumulation across server-side tool use loops", - "default": null -}) -export type BetaErroredResult = { readonly "error": BetaErrorResponse; readonly "type": "errored" } -export const BetaErroredResult = Schema.Struct({ - "error": BetaErrorResponse, - "type": Schema.Literal("errored").annotate({ "title": "Type", "default": "errored" }) -}).annotate({ "title": "ErroredResult" }) -export type BetaRequestBashCodeExecutionToolResultBlock = { - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "content": BetaRequestBashCodeExecutionToolResultError | BetaRequestBashCodeExecutionResultBlock - readonly "tool_use_id": string - readonly "type": "bash_code_execution_tool_result" + ), + "type": Schema.Literal("bash_20250124").annotate({ "title": "Type" }) +}).annotate({ "title": "BashTool_20250124" }) +export type MemoryTool_20250818 = { + readonly "allowed_callers"?: ReadonlyArray + readonly "cache_control"?: CacheControlEphemeral | null + readonly "defer_loading"?: boolean + readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }> + readonly "name": "memory" + readonly "strict"?: boolean + readonly "type": "memory_20250818" } -export const BetaRequestBashCodeExecutionToolResultBlock = Schema.Struct({ +export const MemoryTool_20250818 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "content": Schema.Union([BetaRequestBashCodeExecutionToolResultError, BetaRequestBashCodeExecutionResultBlock]) - .annotate({ "title": "Content" }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Defer Loading", + "description": + "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + }) ), - "type": Schema.Literal("bash_code_execution_tool_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestBashCodeExecutionToolResultBlock" }) -export type BetaRequestCodeExecutionToolResultBlock = { - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "content": - | BetaRequestCodeExecutionToolResultError - | BetaRequestCodeExecutionResultBlock - | BetaRequestEncryptedCodeExecutionResultBlock - readonly "tool_use_id": string - readonly "type": "code_execution_tool_result" + "input_examples": Schema.optionalKey( + Schema.Array(Schema.Record(Schema.String, JsonValue)).annotate({ "title": "Input Examples" }) + ), + "name": Schema.Literal("memory").annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." + }), + "strict": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" + }) + ), + "type": Schema.Literal("memory_20250818").annotate({ "title": "Type" }) +}).annotate({ "title": "MemoryTool_20250818" }) +export type TextEditor_20250124 = { + readonly "allowed_callers"?: ReadonlyArray + readonly "cache_control"?: CacheControlEphemeral | null + readonly "defer_loading"?: boolean + readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }> + readonly "name": "str_replace_editor" + readonly "strict"?: boolean + readonly "type": "text_editor_20250124" } -export const BetaRequestCodeExecutionToolResultBlock = Schema.Struct({ +export const TextEditor_20250124 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "content": Schema.Union([ - BetaRequestCodeExecutionToolResultError, - BetaRequestCodeExecutionResultBlock, - BetaRequestEncryptedCodeExecutionResultBlock - ]).annotate({ "title": "Content" }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Defer Loading", + "description": + "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + }) ), - "type": Schema.Literal("code_execution_tool_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestCodeExecutionToolResultBlock" }) -export type BetaRequestSearchResultBlock = { - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "citations"?: BetaRequestCitationsConfig - readonly "content": ReadonlyArray - readonly "source": string - readonly "title": string - readonly "type": "search_result" + "input_examples": Schema.optionalKey( + Schema.Array(Schema.Record(Schema.String, JsonValue)).annotate({ "title": "Input Examples" }) + ), + "name": Schema.Literal("str_replace_editor").annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." + }), + "strict": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" + }) + ), + "type": Schema.Literal("text_editor_20250124").annotate({ "title": "Type" }) +}).annotate({ "title": "TextEditor_20250124" }) +export type TextEditor_20250429 = { + readonly "allowed_callers"?: ReadonlyArray + readonly "cache_control"?: CacheControlEphemeral | null + readonly "defer_loading"?: boolean + readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }> + readonly "name": "str_replace_based_edit_tool" + readonly "strict"?: boolean + readonly "type": "text_editor_20250429" } -export const BetaRequestSearchResultBlock = Schema.Struct({ +export const TextEditor_20250429 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "citations": Schema.optionalKey(BetaRequestCitationsConfig), - "content": Schema.Array(BetaRequestTextBlock).annotate({ "title": "Content" }), - "source": Schema.String.annotate({ "title": "Source" }), - "title": Schema.String.annotate({ "title": "Title" }), - "type": Schema.Literal("search_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestSearchResultBlock" }) -export type BetaResponseBashCodeExecutionToolResultBlock = { - readonly "content": BetaResponseBashCodeExecutionToolResultError | BetaResponseBashCodeExecutionResultBlock - readonly "tool_use_id": string - readonly "type": "bash_code_execution_tool_result" -} -export const BetaResponseBashCodeExecutionToolResultBlock = Schema.Struct({ - "content": Schema.Union([BetaResponseBashCodeExecutionToolResultError, BetaResponseBashCodeExecutionResultBlock]) - .annotate({ "title": "Content" }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Defer Loading", + "description": + "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + }) ), - "type": Schema.Literal("bash_code_execution_tool_result").annotate({ - "title": "Type", - "default": "bash_code_execution_tool_result" - }) -}).annotate({ "title": "ResponseBashCodeExecutionToolResultBlock" }) -export type BetaResponseWebFetchResultBlock = { - readonly "content": BetaResponseDocumentBlock - readonly "retrieved_at": string | null - readonly "type": "web_fetch_result" - readonly "url": string -} -export const BetaResponseWebFetchResultBlock = Schema.Struct({ - "content": BetaResponseDocumentBlock, - "retrieved_at": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Retrieved At", - "description": "ISO 8601 timestamp when the content was retrieved", - "default": null + "input_examples": Schema.optionalKey( + Schema.Array(Schema.Record(Schema.String, JsonValue)).annotate({ "title": "Input Examples" }) + ), + "name": Schema.Literal("str_replace_based_edit_tool").annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." }), - "type": Schema.Literal("web_fetch_result").annotate({ "title": "Type", "default": "web_fetch_result" }), - "url": Schema.String.annotate({ "title": "Url", "description": "Fetched content URL" }) -}).annotate({ "title": "ResponseWebFetchResultBlock" }) -export type BetaResponseCodeExecutionToolResultBlock = { - readonly "content": - | BetaResponseCodeExecutionToolResultError - | BetaResponseCodeExecutionResultBlock - | BetaResponseEncryptedCodeExecutionResultBlock - readonly "tool_use_id": string - readonly "type": "code_execution_tool_result" -} -export const BetaResponseCodeExecutionToolResultBlock = Schema.Struct({ - "content": Schema.Union([ - BetaResponseCodeExecutionToolResultError, - BetaResponseCodeExecutionResultBlock, - BetaResponseEncryptedCodeExecutionResultBlock - ]).annotate({ "title": "Content" }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + "strict": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" + }) ), - "type": Schema.Literal("code_execution_tool_result").annotate({ - "title": "Type", - "default": "code_execution_tool_result" - }) -}).annotate({ "title": "ResponseCodeExecutionToolResultBlock" }) -export type BetaContentBlockDeltaEvent = { - readonly "delta": - | BetaTextContentBlockDelta - | BetaInputJsonContentBlockDelta - | BetaCitationsDelta - | BetaThinkingContentBlockDelta - | BetaSignatureContentBlockDelta - | BetaCompactionContentBlockDelta - readonly "index": number - readonly "type": "content_block_delta" + "type": Schema.Literal("text_editor_20250429").annotate({ "title": "Type" }) +}).annotate({ "title": "TextEditor_20250429" }) +export type TextEditor_20250728 = { + readonly "allowed_callers"?: ReadonlyArray + readonly "cache_control"?: CacheControlEphemeral | null + readonly "defer_loading"?: boolean + readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }> + readonly "max_characters"?: number | null + readonly "name": "str_replace_based_edit_tool" + readonly "strict"?: boolean + readonly "type": "text_editor_20250728" } -export const BetaContentBlockDeltaEvent = Schema.Struct({ - "delta": Schema.Union([ - BetaTextContentBlockDelta, - BetaInputJsonContentBlockDelta, - BetaCitationsDelta, - BetaThinkingContentBlockDelta, - BetaSignatureContentBlockDelta, - BetaCompactionContentBlockDelta - ], { mode: "oneOf" }).annotate({ "title": "Delta" }), - "index": Schema.Number.annotate({ "title": "Index" }).check(Schema.isInt()), - "type": Schema.Literal("content_block_delta").annotate({ "title": "Type", "default": "content_block_delta" }) -}).annotate({ "title": "ContentBlockDeltaEvent" }) -export type BetaMessageDelta = { - readonly "container"?: BetaContainer | null - readonly "stop_reason": BetaStopReason | null - readonly "stop_sequence": string | null -} -export const BetaMessageDelta = Schema.Struct({ - "container": Schema.optionalKey( - Schema.Union([BetaContainer, Schema.Null]).annotate({ - "description": - "Information about the container used in this request.\n\nThis will be non-null if a container tool (e.g. code execution) was used.", - "default": null - }) - ), - "stop_reason": Schema.Union([BetaStopReason, Schema.Null]).annotate({ "title": "Stop Reason", "default": null }), - "stop_sequence": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Stop Sequence", "default": null }) -}).annotate({ "title": "MessageDelta" }) -export type BetaRequestTextEditorCodeExecutionToolResultBlock = { - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "content": - | BetaRequestTextEditorCodeExecutionToolResultError - | BetaRequestTextEditorCodeExecutionViewResultBlock - | BetaRequestTextEditorCodeExecutionCreateResultBlock - | BetaRequestTextEditorCodeExecutionStrReplaceResultBlock - readonly "tool_use_id": string - readonly "type": "text_editor_code_execution_tool_result" -} -export const BetaRequestTextEditorCodeExecutionToolResultBlock = Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "content": Schema.Union([ - BetaRequestTextEditorCodeExecutionToolResultError, - BetaRequestTextEditorCodeExecutionViewResultBlock, - BetaRequestTextEditorCodeExecutionCreateResultBlock, - BetaRequestTextEditorCodeExecutionStrReplaceResultBlock - ]).annotate({ "title": "Content" }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) - ), - "type": Schema.Literal("text_editor_code_execution_tool_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestTextEditorCodeExecutionToolResultBlock" }) -export type BetaResponseTextEditorCodeExecutionToolResultBlock = { - readonly "content": - | BetaResponseTextEditorCodeExecutionToolResultError - | BetaResponseTextEditorCodeExecutionViewResultBlock - | BetaResponseTextEditorCodeExecutionCreateResultBlock - | BetaResponseTextEditorCodeExecutionStrReplaceResultBlock - readonly "tool_use_id": string - readonly "type": "text_editor_code_execution_tool_result" -} -export const BetaResponseTextEditorCodeExecutionToolResultBlock = Schema.Struct({ - "content": Schema.Union([ - BetaResponseTextEditorCodeExecutionToolResultError, - BetaResponseTextEditorCodeExecutionViewResultBlock, - BetaResponseTextEditorCodeExecutionCreateResultBlock, - BetaResponseTextEditorCodeExecutionStrReplaceResultBlock - ]).annotate({ "title": "Content" }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) - ), - "type": Schema.Literal("text_editor_code_execution_tool_result").annotate({ - "title": "Type", - "default": "text_editor_code_execution_tool_result" - }) -}).annotate({ "title": "ResponseTextEditorCodeExecutionToolResultBlock" }) -export type BetaResponseToolSearchToolResultBlock = { - readonly "content": BetaResponseToolSearchToolResultError | BetaResponseToolSearchToolSearchResultBlock - readonly "tool_use_id": string - readonly "type": "tool_search_tool_result" -} -export const BetaResponseToolSearchToolResultBlock = Schema.Struct({ - "content": Schema.Union([BetaResponseToolSearchToolResultError, BetaResponseToolSearchToolSearchResultBlock]) - .annotate({ "title": "Content" }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) - ), - "type": Schema.Literal("tool_search_tool_result").annotate({ "title": "Type", "default": "tool_search_tool_result" }) -}).annotate({ "title": "ResponseToolSearchToolResultBlock" }) -export type BetaContextManagementConfig = { - readonly "edits"?: ReadonlyArray -} -export const BetaContextManagementConfig = Schema.Struct({ - "edits": Schema.optionalKey( - Schema.Array( - Schema.Union([BetaClearToolUses20250919, BetaClearThinking20251015, BetaCompact20260112], { mode: "oneOf" }) - ).annotate({ "title": "Edits", "description": "List of context management edits to apply" }).check( - Schema.isMinLength(0) - ) - ) -}).annotate({ "title": "ContextManagementConfig" }) -export type BetaContentBlockSource = { - readonly "content": string | ReadonlyArray - readonly "type": "content" -} -export const BetaContentBlockSource = Schema.Struct({ - "content": Schema.Union([ - Schema.String, - Schema.Array( - Schema.Union([BetaRequestTextBlock, BetaRequestImageBlock], { mode: "oneOf" }).annotate({ - "title": "beta_content_block_source_content_item" - }) - ).annotate({ "title": "beta_content_block_source_content" }) - ]).annotate({ "title": "Content" }), - "type": Schema.Literal("content").annotate({ "title": "Type" }) -}).annotate({ "title": "ContentBlockSource" }) -export type BetaRequestWebSearchToolResultBlock = { - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120 - readonly "content": ReadonlyArray | BetaRequestWebSearchToolResultError - readonly "tool_use_id": string - readonly "type": "web_search_tool_result" -} -export const BetaRequestWebSearchToolResultBlock = Schema.Struct({ +export const TextEditor_20250728 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "caller": Schema.optionalKey( - Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate({ - "title": "Caller" + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Defer Loading", + "description": + "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." }) ), - "content": Schema.Union([ - Schema.Array(BetaRequestWebSearchResultBlock).annotate({ "title": "Result Block" }), - BetaRequestWebSearchToolResultError - ]).annotate({ "title": "Content" }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + "input_examples": Schema.optionalKey( + Schema.Array(Schema.Record(Schema.String, JsonValue)).annotate({ "title": "Input Examples" }) ), - "type": Schema.Literal("web_search_tool_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestWebSearchToolResultBlock" }) -export type BetaResponseWebSearchToolResultBlock = { - readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120 - readonly "content": BetaResponseWebSearchToolResultError | ReadonlyArray - readonly "tool_use_id": string - readonly "type": "web_search_tool_result" -} -export const BetaResponseWebSearchToolResultBlock = Schema.Struct({ - "caller": Schema.optionalKey( - Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate({ - "title": "Caller" + "max_characters": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), Schema.Null]).annotate({ + "title": "Max Characters", + "description": + "Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file." }) ), - "content": Schema.Union([BetaResponseWebSearchToolResultError, Schema.Array(BetaResponseWebSearchResultBlock)]) - .annotate({ "title": "Content" }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + "name": Schema.Literal("str_replace_based_edit_tool").annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." + }), + "strict": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" + }) ), - "type": Schema.Literal("web_search_tool_result").annotate({ "title": "Type", "default": "web_search_tool_result" }) -}).annotate({ "title": "ResponseWebSearchToolResultBlock" }) -export type RequestToolSearchToolSearchResultBlock = { - readonly "tool_references": ReadonlyArray - readonly "type": "tool_search_tool_search_result" -} -export const RequestToolSearchToolSearchResultBlock = Schema.Struct({ - "tool_references": Schema.Array(RequestToolReferenceBlock).annotate({ "title": "Tool References" }), - "type": Schema.Literal("tool_search_tool_search_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestToolSearchToolSearchResultBlock" }) -export type ErroredResult = { readonly "error": ErrorResponse; readonly "type": "errored" } -export const ErroredResult = Schema.Struct({ - "error": ErrorResponse, - "type": Schema.Literal("errored").annotate({ "title": "Type", "default": "errored" }) -}).annotate({ "title": "ErroredResult" }) -export type RequestBashCodeExecutionToolResultBlock = { + "type": Schema.Literal("text_editor_20250728").annotate({ "title": "Type" }) +}).annotate({ "title": "TextEditor_20250728" }) +export type Tool = { + readonly "type"?: null | "custom" + readonly "description"?: string + readonly "name": string + readonly "input_schema": { + readonly "properties"?: { readonly [x: string]: unknown } | null + readonly "required"?: ReadonlyArray | null + readonly "type": "object" + readonly [x: string]: unknown + } readonly "cache_control"?: CacheControlEphemeral | null - readonly "content": RequestBashCodeExecutionToolResultError | RequestBashCodeExecutionResultBlock - readonly "tool_use_id": string - readonly "type": "bash_code_execution_tool_result" + readonly "strict"?: boolean + readonly "eager_input_streaming"?: boolean | null + readonly "allowed_callers"?: ReadonlyArray + readonly "defer_loading"?: boolean + readonly "input_examples"?: ReadonlyArray<{ readonly [x: string]: JsonValue }> } -export const RequestBashCodeExecutionToolResultBlock = Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) +export const Tool = Schema.Struct({ + "type": Schema.optionalKey(Schema.Union([Schema.Null, Schema.Literal("custom")]).annotate({ "title": "Type" })), + "description": Schema.optionalKey(Schema.String.annotate({ + "title": "Description", + "description": + "Description of what this tool does.\n\nTool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema." + })), + "name": Schema.String.annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(128)).check( + Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]{1,128}$")) ), - "content": Schema.Union([RequestBashCodeExecutionToolResultError, RequestBashCodeExecutionResultBlock]).annotate({ - "title": "Content" + "input_schema": Schema.StructWithRest( + Schema.Struct({ + "properties": Schema.optionalKey( + Schema.Union([Schema.Record(Schema.String, Schema.Unknown), Schema.Null]).annotate({ "title": "Properties" }) + ), + "required": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ "title": "Required" }) + ), + "type": Schema.Literal("object").annotate({ "title": "Type" }) + }), + [Schema.Record(Schema.String, Schema.Unknown)] + ).annotate({ + "title": "InputSchema", + "description": + "[JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.\n\nThis defines the shape of the `input` that your tool accepts and that the model will produce." }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) - ), - "type": Schema.Literal("bash_code_execution_tool_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestBashCodeExecutionToolResultBlock" }) -export type RequestCodeExecutionToolResultBlock = { - readonly "cache_control"?: CacheControlEphemeral | null - readonly "content": - | RequestCodeExecutionToolResultError - | RequestCodeExecutionResultBlock - | RequestEncryptedCodeExecutionResultBlock - readonly "tool_use_id": string - readonly "type": "code_execution_tool_result" -} -export const RequestCodeExecutionToolResultBlock = Schema.Struct({ "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "content": Schema.Union([ - RequestCodeExecutionToolResultError, - RequestCodeExecutionResultBlock, - RequestEncryptedCodeExecutionResultBlock - ]).annotate({ "title": "Content" }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + "strict": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" + }) ), - "type": Schema.Literal("code_execution_tool_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestCodeExecutionToolResultBlock" }) -export type RequestSearchResultBlock = { - readonly "cache_control"?: CacheControlEphemeral | null - readonly "citations"?: RequestCitationsConfig - readonly "content": ReadonlyArray - readonly "source": string - readonly "title": string - readonly "type": "search_result" -} -export const RequestSearchResultBlock = Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." + "eager_input_streaming": Schema.optionalKey( + Schema.Union([Schema.Boolean, Schema.Null]).annotate({ + "title": "Eager Input Streaming", + "description": + "Enable eager input streaming for this tool. When true, tool input parameters will be streamed incrementally as they are generated, and types will be inferred on-the-fly rather than buffering the full JSON output. When false, streaming is disabled for this tool even if the fine-grained-tool-streaming beta is active. When null (default), uses the default behavior based on beta headers." }) ), - "citations": Schema.optionalKey(RequestCitationsConfig), - "content": Schema.Array(RequestTextBlock).annotate({ "title": "Content" }), - "source": Schema.String.annotate({ "title": "Source" }), - "title": Schema.String.annotate({ "title": "Title" }), - "type": Schema.Literal("search_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestSearchResultBlock" }) -export type ResponseBashCodeExecutionToolResultBlock = { - readonly "content": ResponseBashCodeExecutionToolResultError | ResponseBashCodeExecutionResultBlock - readonly "tool_use_id": string - readonly "type": "bash_code_execution_tool_result" -} -export const ResponseBashCodeExecutionToolResultBlock = Schema.Struct({ - "content": Schema.Union([ResponseBashCodeExecutionToolResultError, ResponseBashCodeExecutionResultBlock]).annotate({ - "title": "Content" - }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Defer Loading", + "description": + "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + }) ), - "type": Schema.Literal("bash_code_execution_tool_result").annotate({ - "title": "Type", - "default": "bash_code_execution_tool_result" - }) -}).annotate({ "title": "ResponseBashCodeExecutionToolResultBlock" }) -export type ResponseWebFetchResultBlock = { - readonly "content": ResponseDocumentBlock - readonly "retrieved_at": string | null - readonly "type": "web_fetch_result" - readonly "url": string + "input_examples": Schema.optionalKey( + Schema.Array(Schema.Record(Schema.String, JsonValue)).annotate({ "title": "Input Examples" }) + ) +}).annotate({ "title": "Tool" }) +export type ListResponse_MessageBatch_ = { + readonly "data": ReadonlyArray + readonly "first_id": string | null + readonly "has_more": boolean + readonly "last_id": string | null } -export const ResponseWebFetchResultBlock = Schema.Struct({ - "content": ResponseDocumentBlock, - "retrieved_at": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Retrieved At", - "description": "ISO 8601 timestamp when the content was retrieved", - "default": null +export const ListResponse_MessageBatch_ = Schema.Struct({ + "data": Schema.Array(MessageBatch).annotate({ "title": "Data" }), + "first_id": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "First Id", + "description": "First ID in the `data` list. Can be used as the `before_id` for the previous page." }), - "type": Schema.Literal("web_fetch_result").annotate({ "title": "Type", "default": "web_fetch_result" }), - "url": Schema.String.annotate({ "title": "Url", "description": "Fetched content URL" }) -}).annotate({ "title": "ResponseWebFetchResultBlock" }) -export type ResponseCodeExecutionToolResultBlock = { - readonly "content": - | ResponseCodeExecutionToolResultError - | ResponseCodeExecutionResultBlock - | ResponseEncryptedCodeExecutionResultBlock - readonly "tool_use_id": string - readonly "type": "code_execution_tool_result" -} -export const ResponseCodeExecutionToolResultBlock = Schema.Struct({ - "content": Schema.Union([ - ResponseCodeExecutionToolResultError, - ResponseCodeExecutionResultBlock, - ResponseEncryptedCodeExecutionResultBlock - ]).annotate({ "title": "Content" }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) - ), - "type": Schema.Literal("code_execution_tool_result").annotate({ - "title": "Type", - "default": "code_execution_tool_result" + "has_more": Schema.Boolean.annotate({ + "title": "Has More", + "description": "Indicates if there are more results in the requested page direction." + }), + "last_id": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Last Id", + "description": "Last ID in the `data` list. Can be used as the `after_id` for the next page." }) -}).annotate({ "title": "ResponseCodeExecutionToolResultBlock" }) -export type ContentBlockDeltaEvent = { - readonly "delta": - | TextContentBlockDelta - | InputJsonContentBlockDelta - | CitationsDelta - | ThinkingContentBlockDelta - | SignatureContentBlockDelta - readonly "index": number - readonly "type": "content_block_delta" +}).annotate({ "title": "ListResponse[MessageBatch]" }) +export type ErrorResponse = { + readonly "error": + | InvalidRequestError + | AuthenticationError + | BillingError + | PermissionError + | NotFoundError + | RateLimitError + | GatewayTimeoutError + | APIError + | OverloadedError + readonly "request_id": string | null + readonly "type": "error" } -export const ContentBlockDeltaEvent = Schema.Struct({ - "delta": Schema.Union([ - TextContentBlockDelta, - InputJsonContentBlockDelta, - CitationsDelta, - ThinkingContentBlockDelta, - SignatureContentBlockDelta - ], { mode: "oneOf" }).annotate({ "title": "Delta" }), - "index": Schema.Number.annotate({ "title": "Index" }).check(Schema.isInt()), - "type": Schema.Literal("content_block_delta").annotate({ "title": "Type", "default": "content_block_delta" }) -}).annotate({ "title": "ContentBlockDeltaEvent" }) -export type RequestTextEditorCodeExecutionToolResultBlock = { +export const ErrorResponse = Schema.Struct({ + "error": Schema.Union([ + InvalidRequestError, + AuthenticationError, + BillingError, + PermissionError, + NotFoundError, + RateLimitError, + GatewayTimeoutError, + APIError, + OverloadedError + ], { mode: "oneOf" }).annotate({ "title": "Error" }), + "request_id": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Request Id", "default": null }), + "type": Schema.Literal("error").annotate({ "title": "Type", "default": "error" }) +}).annotate({ "title": "ErrorResponse" }) +export type RequestBashCodeExecutionResultBlock = { + readonly "content": ReadonlyArray + readonly "return_code": number + readonly "stderr": string + readonly "stdout": string + readonly "type": "bash_code_execution_result" +} +export const RequestBashCodeExecutionResultBlock = Schema.Struct({ + "content": Schema.Array(RequestBashCodeExecutionOutputBlock).annotate({ "title": "Content" }), + "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), + "stderr": Schema.String.annotate({ "title": "Stderr" }), + "stdout": Schema.String.annotate({ "title": "Stdout" }), + "type": Schema.Literal("bash_code_execution_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestBashCodeExecutionResultBlock" }) +export type WebFetchTool_20250910 = { + readonly "allowed_callers"?: ReadonlyArray + readonly "allowed_domains"?: ReadonlyArray | null + readonly "blocked_domains"?: ReadonlyArray | null readonly "cache_control"?: CacheControlEphemeral | null - readonly "content": - | RequestTextEditorCodeExecutionToolResultError - | RequestTextEditorCodeExecutionViewResultBlock - | RequestTextEditorCodeExecutionCreateResultBlock - | RequestTextEditorCodeExecutionStrReplaceResultBlock - readonly "tool_use_id": string - readonly "type": "text_editor_code_execution_tool_result" + readonly "citations"?: RequestCitationsConfig | null + readonly "defer_loading"?: boolean + readonly "max_content_tokens"?: number | null + readonly "max_uses"?: number | null + readonly "name": "web_fetch" + readonly "strict"?: boolean + readonly "type": "web_fetch_20250910" } -export const RequestTextEditorCodeExecutionToolResultBlock = Schema.Struct({ +export const WebFetchTool_20250910 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), + "allowed_domains": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Allowed Domains", + "description": "List of domains to allow fetching from" + }) + ), + "blocked_domains": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Blocked Domains", + "description": "List of domains to block fetching from" + }) + ), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "content": Schema.Union([ - RequestTextEditorCodeExecutionToolResultError, - RequestTextEditorCodeExecutionViewResultBlock, - RequestTextEditorCodeExecutionCreateResultBlock, - RequestTextEditorCodeExecutionStrReplaceResultBlock - ]).annotate({ "title": "Content" }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + "citations": Schema.optionalKey( + Schema.Union([RequestCitationsConfig, Schema.Null]).annotate({ + "description": "Citations configuration for fetched documents. Citations are disabled by default." + }) ), - "type": Schema.Literal("text_editor_code_execution_tool_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestTextEditorCodeExecutionToolResultBlock" }) -export type ResponseTextEditorCodeExecutionToolResultBlock = { - readonly "content": - | ResponseTextEditorCodeExecutionToolResultError - | ResponseTextEditorCodeExecutionViewResultBlock - | ResponseTextEditorCodeExecutionCreateResultBlock - | ResponseTextEditorCodeExecutionStrReplaceResultBlock - readonly "tool_use_id": string - readonly "type": "text_editor_code_execution_tool_result" -} -export const ResponseTextEditorCodeExecutionToolResultBlock = Schema.Struct({ - "content": Schema.Union([ - ResponseTextEditorCodeExecutionToolResultError, - ResponseTextEditorCodeExecutionViewResultBlock, - ResponseTextEditorCodeExecutionCreateResultBlock, - ResponseTextEditorCodeExecutionStrReplaceResultBlock - ]).annotate({ "title": "Content" }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Defer Loading", + "description": + "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + }) ), - "type": Schema.Literal("text_editor_code_execution_tool_result").annotate({ - "title": "Type", - "default": "text_editor_code_execution_tool_result" - }) -}).annotate({ "title": "ResponseTextEditorCodeExecutionToolResultBlock" }) -export type ResponseToolSearchToolResultBlock = { - readonly "content": ResponseToolSearchToolResultError | ResponseToolSearchToolSearchResultBlock - readonly "tool_use_id": string - readonly "type": "tool_search_tool_result" -} -export const ResponseToolSearchToolResultBlock = Schema.Struct({ - "content": Schema.Union([ResponseToolSearchToolResultError, ResponseToolSearchToolSearchResultBlock]).annotate({ - "title": "Content" - }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + "max_content_tokens": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ + "title": "Max Content Tokens", + "description": + "Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs." + }) ), - "type": Schema.Literal("tool_search_tool_result").annotate({ "title": "Type", "default": "tool_search_tool_result" }) -}).annotate({ "title": "ResponseToolSearchToolResultBlock" }) -export type ContentBlockSource = { - readonly "content": string | ReadonlyArray - readonly "type": "content" -} -export const ContentBlockSource = Schema.Struct({ - "content": Schema.Union([ - Schema.String, - Schema.Array( - Schema.Union([RequestTextBlock, RequestImageBlock], { mode: "oneOf" }).annotate({ - "title": "content_block_source_content_item" - }) - ).annotate({ "title": "content_block_source_content" }) - ]).annotate({ "title": "Content" }), - "type": Schema.Literal("content").annotate({ "title": "Type" }) -}).annotate({ "title": "ContentBlockSource" }) -export type RequestWebSearchToolResultBlock = { + "max_uses": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ + "title": "Max Uses", + "description": "Maximum number of times the tool can be used in the API request." + }) + ), + "name": Schema.Literal("web_fetch").annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." + }), + "strict": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" + }) + ), + "type": Schema.Literal("web_fetch_20250910").annotate({ "title": "Type" }) +}).annotate({ "title": "WebFetchTool_20250910" }) +export type WebFetchTool_20260209 = { + readonly "allowed_callers"?: ReadonlyArray + readonly "allowed_domains"?: ReadonlyArray | null + readonly "blocked_domains"?: ReadonlyArray | null readonly "cache_control"?: CacheControlEphemeral | null - readonly "caller"?: DirectCaller | ServerToolCaller | ServerToolCaller_20260120 - readonly "content": ReadonlyArray | RequestWebSearchToolResultError - readonly "tool_use_id": string - readonly "type": "web_search_tool_result" + readonly "citations"?: RequestCitationsConfig | null + readonly "defer_loading"?: boolean + readonly "max_content_tokens"?: number | null + readonly "max_uses"?: number | null + readonly "name": "web_fetch" + readonly "strict"?: boolean + readonly "type": "web_fetch_20260209" } -export const RequestWebSearchToolResultBlock = Schema.Struct({ +export const WebFetchTool_20260209 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), + "allowed_domains": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Allowed Domains", + "description": "List of domains to allow fetching from" + }) + ), + "blocked_domains": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Blocked Domains", + "description": "List of domains to block fetching from" + }) + ), "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "caller": Schema.optionalKey( - Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({ - "title": "Caller" + "citations": Schema.optionalKey( + Schema.Union([RequestCitationsConfig, Schema.Null]).annotate({ + "description": "Citations configuration for fetched documents. Citations are disabled by default." }) ), - "content": Schema.Union([ - Schema.Array(RequestWebSearchResultBlock).annotate({ "title": "web_search_tool_result_block_item" }), - RequestWebSearchToolResultError - ]).annotate({ "title": "Content" }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Defer Loading", + "description": + "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + }) ), - "type": Schema.Literal("web_search_tool_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestWebSearchToolResultBlock" }) -export type ResponseWebSearchToolResultBlock = { - readonly "caller": DirectCaller | ServerToolCaller | ServerToolCaller_20260120 - readonly "content": ResponseWebSearchToolResultError | ReadonlyArray - readonly "tool_use_id": string - readonly "type": "web_search_tool_result" -} -export const ResponseWebSearchToolResultBlock = Schema.Struct({ - "caller": Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({ - "title": "Caller", - "default": { "type": "direct" } - }), - "content": Schema.Union([ResponseWebSearchToolResultError, Schema.Array(ResponseWebSearchResultBlock)]).annotate({ - "title": "Content" + "max_content_tokens": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ + "title": "Max Content Tokens", + "description": + "Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs." + }) + ), + "max_uses": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ + "title": "Max Uses", + "description": "Maximum number of times the tool can be used in the API request." + }) + ), + "name": Schema.Literal("web_fetch").annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + "strict": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" + }) ), - "type": Schema.Literal("web_search_tool_result").annotate({ "title": "Type", "default": "web_search_tool_result" }) -}).annotate({ "title": "ResponseWebSearchToolResultBlock" }) -export type MessageDeltaEvent = { - readonly "delta": MessageDelta - readonly "type": "message_delta" - readonly "usage": { - readonly "cache_creation_input_tokens": number | null - readonly "cache_read_input_tokens": number | null - readonly "input_tokens": number | null - readonly "output_tokens": number - readonly "server_tool_use"?: ServerToolUsage | null - } -} -export const MessageDeltaEvent = Schema.Struct({ - "delta": MessageDelta, - "type": Schema.Literal("message_delta").annotate({ "title": "Type", "default": "message_delta" }), - "usage": Schema.Struct({ - "cache_creation_input_tokens": Schema.Union([ - Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null - ]).annotate({ - "title": "Cache Creation Input Tokens", - "description": "The cumulative number of input tokens used to create the cache entry.", - "default": null - }), - "cache_read_input_tokens": Schema.Union([ - Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null - ]).annotate({ - "title": "Cache Read Input Tokens", - "description": "The cumulative number of input tokens read from the cache.", - "default": null - }), - "input_tokens": Schema.Union([ - Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null - ]).annotate({ - "title": "Input Tokens", - "description": "The cumulative number of input tokens which were used.", - "default": null - }), - "output_tokens": Schema.Number.annotate({ - "title": "Output Tokens", - "description": "The cumulative number of output tokens which were used." - }).check(Schema.isInt()), - "server_tool_use": Schema.optionalKey( - Schema.Union([ServerToolUsage, Schema.Null]).annotate({ - "description": "The number of server tool requests.", - "default": null - }) - ) - }).annotate({ - "title": "MessageDeltaUsage", - "description": - "Billing and rate-limit usage.\n\nAnthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.\n\nUnder the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.\n\nFor example, `output_tokens` will be non-zero, even for an empty string response from Claude.\n\nTotal input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`." - }) -}).annotate({ "title": "MessageDeltaEvent" }) -export type BetaRequestToolSearchToolResultBlock = { - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "content": BetaRequestToolSearchToolResultError | BetaRequestToolSearchToolSearchResultBlock - readonly "tool_use_id": string - readonly "type": "tool_search_tool_result" + "type": Schema.Literal("web_fetch_20260209").annotate({ "title": "Type" }) +}).annotate({ "title": "WebFetchTool_20260209" }) +export type WebFetchTool_20260309 = { + readonly "allowed_callers"?: ReadonlyArray + readonly "allowed_domains"?: ReadonlyArray | null + readonly "blocked_domains"?: ReadonlyArray | null + readonly "cache_control"?: CacheControlEphemeral | null + readonly "citations"?: RequestCitationsConfig | null + readonly "defer_loading"?: boolean + readonly "max_content_tokens"?: number | null + readonly "max_uses"?: number | null + readonly "name": "web_fetch" + readonly "strict"?: boolean + readonly "type": "web_fetch_20260309" + readonly "use_cache"?: boolean } -export const BetaRequestToolSearchToolResultBlock = Schema.Struct({ +export const WebFetchTool_20260309 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), + "allowed_domains": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Allowed Domains", + "description": "List of domains to allow fetching from" + }) + ), + "blocked_domains": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Blocked Domains", + "description": "List of domains to block fetching from" + }) + ), "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "content": Schema.Union([BetaRequestToolSearchToolResultError, BetaRequestToolSearchToolSearchResultBlock]).annotate({ - "title": "Content" - }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + "citations": Schema.optionalKey( + Schema.Union([RequestCitationsConfig, Schema.Null]).annotate({ + "description": "Citations configuration for fetched documents. Citations are disabled by default." + }) ), - "type": Schema.Literal("tool_search_tool_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestToolSearchToolResultBlock" }) -export type BetaResponseWebFetchToolResultBlock = { - readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120 - readonly "content": BetaResponseWebFetchToolResultError | BetaResponseWebFetchResultBlock - readonly "tool_use_id": string - readonly "type": "web_fetch_tool_result" -} -export const BetaResponseWebFetchToolResultBlock = Schema.Struct({ - "caller": Schema.optionalKey( - Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate({ - "title": "Caller" + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Defer Loading", + "description": + "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." }) ), - "content": Schema.Union([BetaResponseWebFetchToolResultError, BetaResponseWebFetchResultBlock]).annotate({ - "title": "Content" - }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + "max_content_tokens": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ + "title": "Max Content Tokens", + "description": + "Maximum number of tokens used by including web page text content in the context. The limit is approximate and does not apply to binary content such as PDFs." + }) ), - "type": Schema.Literal("web_fetch_tool_result").annotate({ "title": "Type", "default": "web_fetch_tool_result" }) -}).annotate({ "title": "ResponseWebFetchToolResultBlock" }) -export type BetaMessageDeltaEvent = { - readonly "context_management"?: BetaResponseContextManagement | null - readonly "delta": BetaMessageDelta - readonly "type": "message_delta" - readonly "usage": { - readonly "cache_creation_input_tokens": number | null - readonly "cache_read_input_tokens": number | null - readonly "input_tokens": number | null - readonly "iterations"?: BetaIterationsUsage - readonly "output_tokens": number - readonly "server_tool_use"?: BetaServerToolUsage | null - } -} -export const BetaMessageDeltaEvent = Schema.Struct({ - "context_management": Schema.optionalKey( - Schema.Union([BetaResponseContextManagement, Schema.Null]).annotate({ - "description": "Information about context management strategies applied during the request", - "default": null + "max_uses": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ + "title": "Max Uses", + "description": "Maximum number of times the tool can be used in the API request." }) ), - "delta": BetaMessageDelta, - "type": Schema.Literal("message_delta").annotate({ "title": "Type", "default": "message_delta" }), - "usage": Schema.Struct({ - "cache_creation_input_tokens": Schema.Union([ - Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null - ]).annotate({ - "title": "Cache Creation Input Tokens", - "description": "The cumulative number of input tokens used to create the cache entry.", - "default": null - }), - "cache_read_input_tokens": Schema.Union([ - Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null - ]).annotate({ - "title": "Cache Read Input Tokens", - "description": "The cumulative number of input tokens read from the cache.", - "default": null - }), - "input_tokens": Schema.Union([ - Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null - ]).annotate({ - "title": "Input Tokens", - "description": "The cumulative number of input tokens which were used.", - "default": null - }), - "iterations": Schema.optionalKey(BetaIterationsUsage), - "output_tokens": Schema.Number.annotate({ - "title": "Output Tokens", - "description": "The cumulative number of output tokens which were used." - }).check(Schema.isInt()), - "server_tool_use": Schema.optionalKey( - Schema.Union([BetaServerToolUsage, Schema.Null]).annotate({ - "description": "The number of server tool requests.", - "default": null - }) - ) - }).annotate({ - "title": "MessageDeltaUsage", - "description": - "Billing and rate-limit usage.\n\nAnthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.\n\nUnder the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.\n\nFor example, `output_tokens` will be non-zero, even for an empty string response from Claude.\n\nTotal input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`." - }) -}).annotate({ "title": "MessageDeltaEvent" }) -export type BetaRequestDocumentBlock = { - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "citations"?: BetaRequestCitationsConfig | null - readonly "context"?: string | null - readonly "source": - | BetaBase64PDFSource - | BetaPlainTextSource - | BetaContentBlockSource - | BetaURLPDFSource - | BetaFileDocumentSource - readonly "title"?: string | null - readonly "type": "document" -} -export const BetaRequestDocumentBlock = Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." + "name": Schema.Literal("web_fetch").annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." + }), + "strict": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" }) ), - "citations": Schema.optionalKey(Schema.Union([BetaRequestCitationsConfig, Schema.Null])), - "context": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMinLength(1)), Schema.Null]).annotate({ "title": "Context" }) - ), - "source": Schema.Union([ - BetaBase64PDFSource, - BetaPlainTextSource, - BetaContentBlockSource, - BetaURLPDFSource, - BetaFileDocumentSource - ], { mode: "oneOf" }).annotate({ "title": "Source" }), - "title": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(500)), Schema.Null]).annotate({ - "title": "Title" + "type": Schema.Literal("web_fetch_20260309").annotate({ "title": "Type" }), + "use_cache": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Use Cache", + "description": + "Whether to use cached content. Set to false to bypass the cache and fetch fresh content. Only set to false when the user explicitly requests fresh content or when fetching rapidly-changing sources." }) - ), - "type": Schema.Literal("document").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestDocumentBlock" }) -export type RequestToolSearchToolResultBlock = { + ) +}).annotate({ + "title": "WebFetchTool_20260309", + "description": "Web fetch tool with use_cache parameter for bypassing cached content." +}) +export type RequestCodeExecutionResultBlock = { + readonly "content": ReadonlyArray + readonly "return_code": number + readonly "stderr": string + readonly "stdout": string + readonly "type": "code_execution_result" +} +export const RequestCodeExecutionResultBlock = Schema.Struct({ + "content": Schema.Array(RequestCodeExecutionOutputBlock).annotate({ "title": "Content" }), + "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), + "stderr": Schema.String.annotate({ "title": "Stderr" }), + "stdout": Schema.String.annotate({ "title": "Stdout" }), + "type": Schema.Literal("code_execution_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestCodeExecutionResultBlock" }) +export type RequestEncryptedCodeExecutionResultBlock = { + readonly "content": ReadonlyArray + readonly "encrypted_stdout": string + readonly "return_code": number + readonly "stderr": string + readonly "type": "encrypted_code_execution_result" +} +export const RequestEncryptedCodeExecutionResultBlock = Schema.Struct({ + "content": Schema.Array(RequestCodeExecutionOutputBlock).annotate({ "title": "Content" }), + "encrypted_stdout": Schema.String.annotate({ "title": "Encrypted Stdout" }), + "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), + "stderr": Schema.String.annotate({ "title": "Stderr" }), + "type": Schema.Literal("encrypted_code_execution_result").annotate({ "title": "Type" }) +}).annotate({ + "title": "RequestEncryptedCodeExecutionResultBlock", + "description": "Code execution result with encrypted stdout for PFC + web_search results." +}) +export type RequestTextBlock = { readonly "cache_control"?: CacheControlEphemeral | null - readonly "content": RequestToolSearchToolResultError | RequestToolSearchToolSearchResultBlock - readonly "tool_use_id": string - readonly "type": "tool_search_tool_result" + readonly "citations"?: + | ReadonlyArray< + | RequestCharLocationCitation + | RequestPageLocationCitation + | RequestContentBlockLocationCitation + | RequestWebSearchResultLocationCitation + | RequestSearchResultLocationCitation + > + | null + readonly "text": string + readonly "type": "text" } -export const RequestToolSearchToolResultBlock = Schema.Struct({ +export const RequestTextBlock = Schema.Struct({ "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "content": Schema.Union([RequestToolSearchToolResultError, RequestToolSearchToolSearchResultBlock]).annotate({ - "title": "Content" - }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + "citations": Schema.optionalKey( + Schema.Union([ + Schema.Array( + Schema.Union([ + RequestCharLocationCitation, + RequestPageLocationCitation, + RequestContentBlockLocationCitation, + RequestWebSearchResultLocationCitation, + RequestSearchResultLocationCitation + ], { mode: "oneOf" }) + ), + Schema.Null + ]).annotate({ "title": "Citations" }) ), - "type": Schema.Literal("tool_search_tool_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestToolSearchToolResultBlock" }) -export type ResponseWebFetchToolResultBlock = { - readonly "caller": DirectCaller | ServerToolCaller | ServerToolCaller_20260120 - readonly "content": ResponseWebFetchToolResultError | ResponseWebFetchResultBlock - readonly "tool_use_id": string - readonly "type": "web_fetch_tool_result" + "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(1)), + "type": Schema.Literal("text").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestTextBlock" }) +export type ResponseBashCodeExecutionResultBlock = { + readonly "content": ReadonlyArray + readonly "return_code": number + readonly "stderr": string + readonly "stdout": string + readonly "type": "bash_code_execution_result" } -export const ResponseWebFetchToolResultBlock = Schema.Struct({ - "caller": Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({ - "title": "Caller", - "default": { "type": "direct" } +export const ResponseBashCodeExecutionResultBlock = Schema.Struct({ + "content": Schema.Array(ResponseBashCodeExecutionOutputBlock).annotate({ "title": "Content" }), + "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), + "stderr": Schema.String.annotate({ "title": "Stderr" }), + "stdout": Schema.String.annotate({ "title": "Stdout" }), + "type": Schema.Literal("bash_code_execution_result").annotate({ + "title": "Type", + "default": "bash_code_execution_result" + }) +}).annotate({ "title": "ResponseBashCodeExecutionResultBlock" }) +export type ResponseDocumentBlock = { + readonly "citations": ResponseCitationsConfig | null + readonly "source": Base64PDFSource | PlainTextSource + readonly "title": string | null + readonly "type": "document" +} +export const ResponseDocumentBlock = Schema.Struct({ + "citations": Schema.Union([ResponseCitationsConfig, Schema.Null]).annotate({ + "description": "Citation configuration for the document", + "default": null }), - "content": Schema.Union([ResponseWebFetchToolResultError, ResponseWebFetchResultBlock]).annotate({ - "title": "Content" + "source": Schema.Union([Base64PDFSource, PlainTextSource], { mode: "oneOf" }).annotate({ "title": "Source" }), + "title": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Title", + "description": "The title of the document", + "default": null }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) - ), - "type": Schema.Literal("web_fetch_tool_result").annotate({ "title": "Type", "default": "web_fetch_tool_result" }) -}).annotate({ "title": "ResponseWebFetchToolResultBlock" }) -export type RequestDocumentBlock = { - readonly "cache_control"?: CacheControlEphemeral | null - readonly "citations"?: RequestCitationsConfig | null - readonly "context"?: string | null - readonly "source": Base64PDFSource | PlainTextSource | ContentBlockSource | URLPDFSource - readonly "title"?: string | null - readonly "type": "document" + "type": Schema.Literal("document").annotate({ "title": "Type", "default": "document" }) +}).annotate({ "title": "ResponseDocumentBlock" }) +export type ResponseCodeExecutionResultBlock = { + readonly "content": ReadonlyArray + readonly "return_code": number + readonly "stderr": string + readonly "stdout": string + readonly "type": "code_execution_result" } -export const RequestDocumentBlock = Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "citations": Schema.optionalKey(Schema.Union([RequestCitationsConfig, Schema.Null])), - "context": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMinLength(1)), Schema.Null]).annotate({ "title": "Context" }) - ), - "source": Schema.Union([Base64PDFSource, PlainTextSource, ContentBlockSource, URLPDFSource], { mode: "oneOf" }) - .annotate({ "title": "Source" }), - "title": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(500)), Schema.Null]).annotate({ - "title": "Title" - }) - ), - "type": Schema.Literal("document").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestDocumentBlock" }) -export type BetaContentBlockStartEvent = { - readonly "content_block": - | BetaResponseTextBlock - | BetaResponseThinkingBlock - | BetaResponseRedactedThinkingBlock - | BetaResponseToolUseBlock - | BetaResponseServerToolUseBlock - | BetaResponseWebSearchToolResultBlock - | BetaResponseWebFetchToolResultBlock - | BetaResponseCodeExecutionToolResultBlock - | BetaResponseBashCodeExecutionToolResultBlock - | BetaResponseTextEditorCodeExecutionToolResultBlock - | BetaResponseToolSearchToolResultBlock - | BetaResponseMCPToolUseBlock - | BetaResponseMCPToolResultBlock - | BetaResponseContainerUploadBlock - | BetaResponseCompactionBlock - readonly "index": number - readonly "type": "content_block_start" +export const ResponseCodeExecutionResultBlock = Schema.Struct({ + "content": Schema.Array(ResponseCodeExecutionOutputBlock).annotate({ "title": "Content" }), + "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), + "stderr": Schema.String.annotate({ "title": "Stderr" }), + "stdout": Schema.String.annotate({ "title": "Stdout" }), + "type": Schema.Literal("code_execution_result").annotate({ "title": "Type", "default": "code_execution_result" }) +}).annotate({ "title": "ResponseCodeExecutionResultBlock" }) +export type ResponseEncryptedCodeExecutionResultBlock = { + readonly "content": ReadonlyArray + readonly "encrypted_stdout": string + readonly "return_code": number + readonly "stderr": string + readonly "type": "encrypted_code_execution_result" } -export const BetaContentBlockStartEvent = Schema.Struct({ - "content_block": Schema.Union([ - BetaResponseTextBlock, - BetaResponseThinkingBlock, - BetaResponseRedactedThinkingBlock, - BetaResponseToolUseBlock, - BetaResponseServerToolUseBlock, - BetaResponseWebSearchToolResultBlock, - BetaResponseWebFetchToolResultBlock, - BetaResponseCodeExecutionToolResultBlock, - BetaResponseBashCodeExecutionToolResultBlock, - BetaResponseTextEditorCodeExecutionToolResultBlock, - BetaResponseToolSearchToolResultBlock, - BetaResponseMCPToolUseBlock, - BetaResponseMCPToolResultBlock, - BetaResponseContainerUploadBlock, - BetaResponseCompactionBlock - ], { mode: "oneOf" }).annotate({ "title": "Content Block" }), - "index": Schema.Number.annotate({ "title": "Index" }).check(Schema.isInt()), - "type": Schema.Literal("content_block_start").annotate({ "title": "Type", "default": "content_block_start" }) -}).annotate({ "title": "ContentBlockStartEvent" }) -export type BetaContentBlock = - | BetaResponseTextBlock - | BetaResponseThinkingBlock - | BetaResponseRedactedThinkingBlock - | BetaResponseToolUseBlock - | BetaResponseServerToolUseBlock - | BetaResponseWebSearchToolResultBlock - | BetaResponseWebFetchToolResultBlock - | BetaResponseCodeExecutionToolResultBlock - | BetaResponseBashCodeExecutionToolResultBlock - | BetaResponseTextEditorCodeExecutionToolResultBlock - | BetaResponseToolSearchToolResultBlock - | BetaResponseMCPToolUseBlock - | BetaResponseMCPToolResultBlock - | BetaResponseContainerUploadBlock - | BetaResponseCompactionBlock -export const BetaContentBlock = Schema.Union([ - BetaResponseTextBlock, - BetaResponseThinkingBlock, - BetaResponseRedactedThinkingBlock, - BetaResponseToolUseBlock, - BetaResponseServerToolUseBlock, - BetaResponseWebSearchToolResultBlock, - BetaResponseWebFetchToolResultBlock, - BetaResponseCodeExecutionToolResultBlock, - BetaResponseBashCodeExecutionToolResultBlock, - BetaResponseTextEditorCodeExecutionToolResultBlock, - BetaResponseToolSearchToolResultBlock, - BetaResponseMCPToolUseBlock, - BetaResponseMCPToolResultBlock, - BetaResponseContainerUploadBlock, - BetaResponseCompactionBlock -], { mode: "oneOf" }) -export type BetaRequestWebFetchResultBlock = { - readonly "content": BetaRequestDocumentBlock - readonly "retrieved_at"?: string | null - readonly "type": "web_fetch_result" - readonly "url": string +export const ResponseEncryptedCodeExecutionResultBlock = Schema.Struct({ + "content": Schema.Array(ResponseCodeExecutionOutputBlock).annotate({ "title": "Content" }), + "encrypted_stdout": Schema.String.annotate({ "title": "Encrypted Stdout" }), + "return_code": Schema.Number.annotate({ "title": "Return Code" }).check(Schema.isInt()), + "stderr": Schema.String.annotate({ "title": "Stderr" }), + "type": Schema.Literal("encrypted_code_execution_result").annotate({ + "title": "Type", + "default": "encrypted_code_execution_result" + }) +}).annotate({ + "title": "ResponseEncryptedCodeExecutionResultBlock", + "description": "Code execution result with encrypted stdout for PFC + web_search results." +}) +export type ResponseToolSearchToolSearchResultBlock = { + readonly "tool_references": ReadonlyArray + readonly "type": "tool_search_tool_search_result" } -export const BetaRequestWebFetchResultBlock = Schema.Struct({ - "content": BetaRequestDocumentBlock, - "retrieved_at": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Retrieved At", - "description": "ISO 8601 timestamp when the content was retrieved" - }) - ), - "type": Schema.Literal("web_fetch_result").annotate({ "title": "Type" }), - "url": Schema.String.annotate({ "title": "Url", "description": "Fetched content URL" }) -}).annotate({ "title": "RequestWebFetchResultBlock" }) -export type ContentBlockStartEvent = { - readonly "content_block": - | ResponseTextBlock - | ResponseThinkingBlock - | ResponseRedactedThinkingBlock - | ResponseToolUseBlock - | ResponseServerToolUseBlock - | ResponseWebSearchToolResultBlock - | ResponseWebFetchToolResultBlock - | ResponseCodeExecutionToolResultBlock - | ResponseBashCodeExecutionToolResultBlock - | ResponseTextEditorCodeExecutionToolResultBlock - | ResponseToolSearchToolResultBlock - | ResponseContainerUploadBlock - readonly "index": number - readonly "type": "content_block_start" +export const ResponseToolSearchToolSearchResultBlock = Schema.Struct({ + "tool_references": Schema.Array(ResponseToolReferenceBlock).annotate({ "title": "Tool References" }), + "type": Schema.Literal("tool_search_tool_search_result").annotate({ + "title": "Type", + "default": "tool_search_tool_search_result" + }) +}).annotate({ "title": "ResponseToolSearchToolSearchResultBlock" }) +export type CitationsDelta = { + readonly "citation": + | ResponseCharLocationCitation + | ResponsePageLocationCitation + | ResponseContentBlockLocationCitation + | ResponseWebSearchResultLocationCitation + | ResponseSearchResultLocationCitation + readonly "type": "citations_delta" } -export const ContentBlockStartEvent = Schema.Struct({ - "content_block": Schema.Union([ - ResponseTextBlock, - ResponseThinkingBlock, - ResponseRedactedThinkingBlock, - ResponseToolUseBlock, - ResponseServerToolUseBlock, - ResponseWebSearchToolResultBlock, - ResponseWebFetchToolResultBlock, - ResponseCodeExecutionToolResultBlock, - ResponseBashCodeExecutionToolResultBlock, - ResponseTextEditorCodeExecutionToolResultBlock, - ResponseToolSearchToolResultBlock, - ResponseContainerUploadBlock - ], { mode: "oneOf" }).annotate({ "title": "Content Block" }), - "index": Schema.Number.annotate({ "title": "Index" }).check(Schema.isInt()), - "type": Schema.Literal("content_block_start").annotate({ "title": "Type", "default": "content_block_start" }) -}).annotate({ "title": "ContentBlockStartEvent" }) -export type ContentBlock = - | ResponseTextBlock - | ResponseThinkingBlock - | ResponseRedactedThinkingBlock - | ResponseToolUseBlock - | ResponseServerToolUseBlock - | ResponseWebSearchToolResultBlock - | ResponseWebFetchToolResultBlock - | ResponseCodeExecutionToolResultBlock - | ResponseBashCodeExecutionToolResultBlock - | ResponseTextEditorCodeExecutionToolResultBlock - | ResponseToolSearchToolResultBlock - | ResponseContainerUploadBlock -export const ContentBlock = Schema.Union([ - ResponseTextBlock, - ResponseThinkingBlock, - ResponseRedactedThinkingBlock, - ResponseToolUseBlock, - ResponseServerToolUseBlock, - ResponseWebSearchToolResultBlock, - ResponseWebFetchToolResultBlock, - ResponseCodeExecutionToolResultBlock, - ResponseBashCodeExecutionToolResultBlock, - ResponseTextEditorCodeExecutionToolResultBlock, - ResponseToolSearchToolResultBlock, - ResponseContainerUploadBlock -], { mode: "oneOf" }) -export type RequestWebFetchResultBlock = { - readonly "content": RequestDocumentBlock - readonly "retrieved_at"?: string | null - readonly "type": "web_fetch_result" - readonly "url": string +export const CitationsDelta = Schema.Struct({ + "citation": Schema.Union([ + ResponseCharLocationCitation, + ResponsePageLocationCitation, + ResponseContentBlockLocationCitation, + ResponseWebSearchResultLocationCitation, + ResponseSearchResultLocationCitation + ], { mode: "oneOf" }).annotate({ "title": "Citation" }), + "type": Schema.Literal("citations_delta").annotate({ "title": "Type", "default": "citations_delta" }) +}).annotate({ "title": "CitationsDelta" }) +export type ResponseTextBlock = { + readonly "citations"?: + | ReadonlyArray< + | ResponseCharLocationCitation + | ResponsePageLocationCitation + | ResponseContentBlockLocationCitation + | ResponseWebSearchResultLocationCitation + | ResponseSearchResultLocationCitation + > + | null + readonly "text": string + readonly "type": "text" } -export const RequestWebFetchResultBlock = Schema.Struct({ - "content": RequestDocumentBlock, - "retrieved_at": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Retrieved At", - "description": "ISO 8601 timestamp when the content was retrieved" +export const ResponseTextBlock = Schema.Struct({ + "citations": Schema.optionalKey( + Schema.Union([ + Schema.Array( + Schema.Union([ + ResponseCharLocationCitation, + ResponsePageLocationCitation, + ResponseContentBlockLocationCitation, + ResponseWebSearchResultLocationCitation, + ResponseSearchResultLocationCitation + ], { mode: "oneOf" }) + ), + Schema.Null + ]).annotate({ + "title": "Citations", + "description": + "Citations supporting the text block.\n\nThe type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.", + "default": null }) ), - "type": Schema.Literal("web_fetch_result").annotate({ "title": "Type" }), - "url": Schema.String.annotate({ "title": "Url", "description": "Fetched content URL" }) -}).annotate({ "title": "RequestWebFetchResultBlock" }) -export type BetaMessage = { + "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(0)).check(Schema.isMaxLength(5000000)), + "type": Schema.Literal("text").annotate({ "title": "Type", "default": "text" }) +}).annotate({ "title": "ResponseTextBlock" }) +export type RequestServerToolUseBlock = { + readonly "cache_control"?: CacheControlEphemeral | null + readonly "caller"?: DirectCaller | ServerToolCaller | ServerToolCaller_20260120 readonly "id": string - readonly "type": "message" - readonly "role": "assistant" - readonly "content": ReadonlyArray - readonly "model": Model - readonly "stop_reason": BetaStopReason | null - readonly "stop_sequence": string | null - readonly "usage": { - readonly "cache_creation": BetaCacheCreation | null - readonly "cache_creation_input_tokens": number | null - readonly "cache_read_input_tokens": number | null - readonly "inference_geo": string | null - readonly "input_tokens": number - readonly "iterations"?: BetaIterationsUsage - readonly "output_tokens": number - readonly "server_tool_use"?: BetaServerToolUsage | null - readonly "service_tier": "standard" | "priority" | "batch" | null - readonly "speed"?: BetaSpeed | null - } - readonly "context_management"?: BetaResponseContextManagement | null - readonly "container"?: BetaContainer | null -} -export const BetaMessage = Schema.Struct({ - "id": Schema.String.annotate({ - "title": "Id", - "description": "Unique object identifier.\n\nThe format and length of IDs may change over time." - }), - "type": Schema.Literal("message").annotate({ - "title": "Type", - "description": "Object type.\n\nFor Messages, this is always `\"message\"`.", - "default": "message" - }), - "role": Schema.Literal("assistant").annotate({ - "title": "Role", - "description": "Conversational role of the generated message.\n\nThis will always be `\"assistant\"`.", - "default": "assistant" - }), - "content": Schema.Array(BetaContentBlock).annotate({ - "title": "Content", - "description": - "Content generated by the model.\n\nThis is an array of content blocks, each of which has a `type` that determines its shape.\n\nExample:\n\n```json\n[{\"type\": \"text\", \"text\": \"Hi, I'm Claude.\"}]\n```\n\nIf the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.\n\nFor example, if the input `messages` were:\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"}\n]\n```\n\nThen the response `content` might be:\n\n```json\n[{\"type\": \"text\", \"text\": \"B)\"}]\n```" - }), - "model": Model, - "stop_reason": Schema.Union([BetaStopReason, Schema.Null]).annotate({ - "title": "Stop Reason", - "description": - "The reason that we stopped.\n\nThis may be one the following values:\n* `\"end_turn\"`: the model reached a natural stopping point\n* `\"max_tokens\"`: we exceeded the requested `max_tokens` or the model's maximum\n* `\"stop_sequence\"`: one of your provided custom `stop_sequences` was generated\n* `\"tool_use\"`: the model invoked one or more tools\n* `\"pause_turn\"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue.\n* `\"refusal\"`: when streaming classifiers intervene to handle potential policy violations\n\nIn non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise." - }), - "stop_sequence": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Stop Sequence", - "description": - "Which custom stop sequence was generated, if any.\n\nThis value will be a non-null string if one of your custom stop sequences was generated.", - "default": null - }), - "usage": Schema.Struct({ - "cache_creation": Schema.Union([BetaCacheCreation, Schema.Null]).annotate({ - "description": "Breakdown of cached tokens by TTL", - "default": null - }), - "cache_creation_input_tokens": Schema.Union([ - Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null - ]).annotate({ - "title": "Cache Creation Input Tokens", - "description": "The number of input tokens used to create the cache entry.", - "default": null - }), - "cache_read_input_tokens": Schema.Union([ - Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null - ]).annotate({ - "title": "Cache Read Input Tokens", - "description": "The number of input tokens read from the cache.", - "default": null - }), - "inference_geo": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Inference Geo", - "description": "The geographic region where inference was performed for this request.", - "default": null - }), - "input_tokens": Schema.Number.annotate({ - "title": "Input Tokens", - "description": "The number of input tokens which were used." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - "iterations": Schema.optionalKey(BetaIterationsUsage), - "output_tokens": Schema.Number.annotate({ - "title": "Output Tokens", - "description": "The number of output tokens which were used." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - "server_tool_use": Schema.optionalKey( - Schema.Union([BetaServerToolUsage, Schema.Null]).annotate({ - "description": "The number of server tool requests.", - "default": null - }) - ), - "service_tier": Schema.Union([Schema.Literals(["standard", "priority", "batch"]), Schema.Null]).annotate({ - "title": "Service Tier", - "description": "If the request used the priority, standard, or batch tier.", - "default": null - }), - "speed": Schema.optionalKey( - Schema.Union([BetaSpeed, Schema.Null]).annotate({ - "description": "The inference speed mode used for this request.", - "default": null - }) - ) - }).annotate({ - "title": "Usage", - "description": - "Billing and rate-limit usage.\n\nAnthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.\n\nUnder the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.\n\nFor example, `output_tokens` will be non-zero, even for an empty string response from Claude.\n\nTotal input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`." - }), - "context_management": Schema.optionalKey( - Schema.Union([BetaResponseContextManagement, Schema.Null]).annotate({ - "description": - "Context management response.\n\nInformation about context management strategies applied during the request.", - "default": null - }) - ), - "container": Schema.optionalKey( - Schema.Union([BetaContainer, Schema.Null]).annotate({ - "description": - "Information about the container used in this request.\n\nThis will be non-null if a container tool (e.g. code execution) was used.", - "default": null - }) - ) -}).annotate({ "title": "Message" }) -export type BetaRequestWebFetchToolResultBlock = { - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120 - readonly "content": BetaRequestWebFetchToolResultError | BetaRequestWebFetchResultBlock - readonly "tool_use_id": string - readonly "type": "web_fetch_tool_result" + readonly "input": { readonly [x: string]: unknown } + readonly "name": + | "web_search" + | "web_fetch" + | "code_execution" + | "bash_code_execution" + | "text_editor_code_execution" + | "tool_search_tool_regex" + | "tool_search_tool_bm25" + readonly "type": "server_tool_use" } -export const BetaRequestWebFetchToolResultBlock = Schema.Struct({ +export const RequestServerToolUseBlock = Schema.Struct({ "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), "caller": Schema.optionalKey( - Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate({ + Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({ "title": "Caller" }) ), - "content": Schema.Union([BetaRequestWebFetchToolResultError, BetaRequestWebFetchResultBlock]).annotate({ - "title": "Content" - }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) - ), - "type": Schema.Literal("web_fetch_tool_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestWebFetchToolResultBlock" }) -export type Message = { + "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))), + "input": Schema.Record(Schema.String, Schema.Unknown).annotate({ "title": "Input" }), + "name": Schema.Literals([ + "web_search", + "web_fetch", + "code_execution", + "bash_code_execution", + "text_editor_code_execution", + "tool_search_tool_regex", + "tool_search_tool_bm25" + ]).annotate({ "title": "Name" }), + "type": Schema.Literal("server_tool_use").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestServerToolUseBlock" }) +export type ResponseServerToolUseBlock = { + readonly "caller": DirectCaller | ServerToolCaller | ServerToolCaller_20260120 readonly "id": string - readonly "type": "message" - readonly "role": "assistant" - readonly "content": ReadonlyArray - readonly "model": Model - readonly "stop_reason": StopReason | null - readonly "stop_sequence": string | null - readonly "usage": { - readonly "cache_creation": CacheCreation | null - readonly "cache_creation_input_tokens": number | null - readonly "cache_read_input_tokens": number | null - readonly "inference_geo": string | null - readonly "input_tokens": number - readonly "output_tokens": number - readonly "server_tool_use"?: ServerToolUsage | null - readonly "service_tier": "standard" | "priority" | "batch" | null - } - readonly "container": Container | null + readonly "input": { readonly [x: string]: unknown } + readonly "name": + | "web_search" + | "web_fetch" + | "code_execution" + | "bash_code_execution" + | "text_editor_code_execution" + | "tool_search_tool_regex" + | "tool_search_tool_bm25" + readonly "type": "server_tool_use" } -export const Message = Schema.Struct({ - "id": Schema.String.annotate({ - "title": "Id", - "description": "Unique object identifier.\n\nThe format and length of IDs may change over time." - }), - "type": Schema.Literal("message").annotate({ - "title": "Type", - "description": "Object type.\n\nFor Messages, this is always `\"message\"`.", - "default": "message" - }), - "role": Schema.Literal("assistant").annotate({ - "title": "Role", - "description": "Conversational role of the generated message.\n\nThis will always be `\"assistant\"`.", - "default": "assistant" - }), - "content": Schema.Array(ContentBlock).annotate({ - "title": "Content", - "description": - "Content generated by the model.\n\nThis is an array of content blocks, each of which has a `type` that determines its shape.\n\nExample:\n\n```json\n[{\"type\": \"text\", \"text\": \"Hi, I'm Claude.\"}]\n```\n\nIf the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.\n\nFor example, if the input `messages` were:\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"}\n]\n```\n\nThen the response `content` might be:\n\n```json\n[{\"type\": \"text\", \"text\": \"B)\"}]\n```" +export const ResponseServerToolUseBlock = Schema.Struct({ + "caller": Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({ + "title": "Caller", + "default": { "type": "direct" } }), - "model": Model, - "stop_reason": Schema.Union([StopReason, Schema.Null]).annotate({ - "title": "Stop Reason", - "description": - "The reason that we stopped.\n\nThis may be one the following values:\n* `\"end_turn\"`: the model reached a natural stopping point\n* `\"max_tokens\"`: we exceeded the requested `max_tokens` or the model's maximum\n* `\"stop_sequence\"`: one of your provided custom `stop_sequences` was generated\n* `\"tool_use\"`: the model invoked one or more tools\n* `\"pause_turn\"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue.\n* `\"refusal\"`: when streaming classifiers intervene to handle potential policy violations\n\nIn non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise." + "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$"))), + "input": Schema.Record(Schema.String, Schema.Unknown).annotate({ "title": "Input" }), + "name": Schema.Literals([ + "web_search", + "web_fetch", + "code_execution", + "bash_code_execution", + "text_editor_code_execution", + "tool_search_tool_regex", + "tool_search_tool_bm25" + ]).annotate({ "title": "Name" }), + "type": Schema.Literal("server_tool_use").annotate({ "title": "Type", "default": "server_tool_use" }) +}).annotate({ "title": "ResponseServerToolUseBlock" }) +export type ResponseToolUseBlock = { + readonly "caller": DirectCaller | ServerToolCaller | ServerToolCaller_20260120 + readonly "id": string + readonly "input": { readonly [x: string]: unknown } + readonly "name": string + readonly "type": "tool_use" +} +export const ResponseToolUseBlock = Schema.Struct({ + "caller": Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({ + "title": "Caller", + "default": { "type": "direct" } }), - "stop_sequence": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Stop Sequence", + "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$"))), + "input": Schema.Record(Schema.String, Schema.Unknown).annotate({ "title": "Input" }), + "name": Schema.String.annotate({ "title": "Name" }).check(Schema.isMinLength(1)), + "type": Schema.Literal("tool_use").annotate({ "title": "Type", "default": "tool_use" }) +}).annotate({ "title": "ResponseToolUseBlock" }) +export type RequestTextEditorCodeExecutionToolResultError = { + readonly "error_code": TextEditorCodeExecutionToolResultErrorCode + readonly "error_message"?: string | null + readonly "type": "text_editor_code_execution_tool_result_error" +} +export const RequestTextEditorCodeExecutionToolResultError = Schema.Struct({ + "error_code": TextEditorCodeExecutionToolResultErrorCode, + "error_message": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Error Message" }) + ), + "type": Schema.Literal("text_editor_code_execution_tool_result_error").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestTextEditorCodeExecutionToolResultError" }) +export type ResponseTextEditorCodeExecutionToolResultError = { + readonly "error_code": TextEditorCodeExecutionToolResultErrorCode + readonly "error_message": string | null + readonly "type": "text_editor_code_execution_tool_result_error" +} +export const ResponseTextEditorCodeExecutionToolResultError = Schema.Struct({ + "error_code": TextEditorCodeExecutionToolResultErrorCode, + "error_message": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Error Message", "default": null }), + "type": Schema.Literal("text_editor_code_execution_tool_result_error").annotate({ + "title": "Type", + "default": "text_editor_code_execution_tool_result_error" + }) +}).annotate({ "title": "ResponseTextEditorCodeExecutionToolResultError" }) +export type ThinkingConfigAdaptive = { readonly "display"?: ThinkingDisplayMode | null; readonly "type": "adaptive" } +export const ThinkingConfigAdaptive = Schema.Struct({ + "display": Schema.optionalKey( + Schema.Union([ThinkingDisplayMode, Schema.Null]).annotate({ + "description": + "Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`." + }) + ), + "type": Schema.Literal("adaptive").annotate({ "title": "Type" }) +}).annotate({ "title": "ThinkingConfigAdaptive" }) +export type ThinkingConfigEnabled = { + readonly "budget_tokens": number + readonly "display"?: ThinkingDisplayMode | null + readonly "type": "enabled" +} +export const ThinkingConfigEnabled = Schema.Struct({ + "budget_tokens": Schema.Number.annotate({ + "title": "Budget Tokens", "description": - "Which custom stop sequence was generated, if any.\n\nThis value will be a non-null string if one of your custom stop sequences was generated.", - "default": null - }), - "usage": Schema.Struct({ - "cache_creation": Schema.Union([CacheCreation, Schema.Null]).annotate({ - "description": "Breakdown of cached tokens by TTL", - "default": null - }), - "cache_creation_input_tokens": Schema.Union([ - Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null - ]).annotate({ - "title": "Cache Creation Input Tokens", - "description": "The number of input tokens used to create the cache entry.", - "default": null + "Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.\n\nMust be ≥1024 and less than `max_tokens`.\n\nSee [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1024)), + "display": Schema.optionalKey( + Schema.Union([ThinkingDisplayMode, Schema.Null]).annotate({ + "description": + "Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`." + }) + ), + "type": Schema.Literal("enabled").annotate({ "title": "Type" }) +}).annotate({ "title": "ThinkingConfigEnabled" }) +export type ModelCapabilities = { + readonly "batch": { readonly "supported": boolean } + readonly "citations": { readonly "supported": boolean } + readonly "code_execution": { readonly "supported": boolean } + readonly "context_management": { + readonly "clear_thinking_20251015": CapabilitySupport | null + readonly "clear_tool_uses_20250919": CapabilitySupport | null + readonly "compact_20260112": CapabilitySupport | null + readonly "supported": boolean + } + readonly "effort": { + readonly "high": { readonly "supported": boolean } + readonly "low": { readonly "supported": boolean } + readonly "max": { readonly "supported": boolean } + readonly "medium": { readonly "supported": boolean } + readonly "supported": boolean + readonly "xhigh": CapabilitySupport | null + } + readonly "image_input": { readonly "supported": boolean } + readonly "pdf_input": { readonly "supported": boolean } + readonly "structured_outputs": { readonly "supported": boolean } + readonly "thinking": { readonly "supported": boolean; readonly "types": ThinkingTypes } +} +export const ModelCapabilities = Schema.Struct({ + "batch": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports the Batch API." }), + "citations": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports citation generation." }), + "code_execution": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports code execution tools." }), + "context_management": Schema.Struct({ + "clear_thinking_20251015": Schema.Union([CapabilitySupport, Schema.Null]).annotate({ + "description": "Whether the clear_thinking_20251015 strategy is supported." }), - "cache_read_input_tokens": Schema.Union([ - Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - Schema.Null - ]).annotate({ - "title": "Cache Read Input Tokens", - "description": "The number of input tokens read from the cache.", - "default": null + "clear_tool_uses_20250919": Schema.Union([CapabilitySupport, Schema.Null]).annotate({ + "description": "Whether the clear_tool_uses_20250919 strategy is supported." }), - "inference_geo": Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Inference Geo", - "description": "The geographic region where inference was performed for this request.", - "default": null + "compact_20260112": Schema.Union([CapabilitySupport, Schema.Null]).annotate({ + "description": "Whether the compact_20260112 strategy is supported." }), - "input_tokens": Schema.Number.annotate({ - "title": "Input Tokens", - "description": "The number of input tokens which were used." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - "output_tokens": Schema.Number.annotate({ - "title": "Output Tokens", - "description": "The number of output tokens which were used." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), - "server_tool_use": Schema.optionalKey( - Schema.Union([ServerToolUsage, Schema.Null]).annotate({ - "description": "The number of server tool requests.", - "default": null + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ + "title": "ContextManagementCapability", + "description": "Context management support and available strategies." + }), + "effort": Schema.Struct({ + "high": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." }) - ), - "service_tier": Schema.Union([Schema.Literals(["standard", "priority", "batch"]), Schema.Null]).annotate({ - "title": "Service Tier", - "description": "If the request used the priority, standard, or batch tier.", - "default": null + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports high effort level." }), + "low": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports low effort level." }), + "max": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports max effort level." }), + "medium": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model supports medium effort level." }), + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }), + "xhigh": Schema.Union([CapabilitySupport, Schema.Null]).annotate({ + "description": "Whether the model supports xhigh effort level." }) }).annotate({ - "title": "Usage", - "description": - "Billing and rate-limit usage.\n\nAnthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.\n\nUnder the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.\n\nFor example, `output_tokens` will be non-zero, even for an empty string response from Claude.\n\nTotal input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`." + "title": "EffortCapability", + "description": "Effort (reasoning_effort) support and available levels." }), - "container": Schema.Union([Container, Schema.Null]).annotate({ - "description": - "Information about the container used in this request.\n\nThis will be non-null if a container tool (e.g. code execution) was used.", - "default": null + "image_input": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model accepts image content blocks." }), + "pdf_input": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ "title": "CapabilitySupport", "description": "Whether the model accepts PDF content blocks." }), + "structured_outputs": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }) + }).annotate({ + "title": "CapabilitySupport", + "description": "Whether the model supports structured output / JSON mode / strict tool schemas." + }), + "thinking": Schema.Struct({ + "supported": Schema.Boolean.annotate({ + "title": "Supported", + "description": "Whether this capability is supported by the model." + }), + "types": ThinkingTypes + }).annotate({ + "title": "ThinkingCapability", + "description": "Thinking capability and supported type configurations." }) -}).annotate({ "title": "Message" }) -export type RequestWebFetchToolResultBlock = { +}).annotate({ "title": "ModelCapabilities", "description": "Model capability information." }) +export type ToolChoice = ToolChoiceAuto | ToolChoiceAny | ToolChoiceTool | ToolChoiceNone +export const ToolChoice = Schema.Union([ToolChoiceAuto, ToolChoiceAny, ToolChoiceTool, ToolChoiceNone], { + mode: "oneOf" +}).annotate({ + "title": "Tool Choice", + "description": + "How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all." +}) +export type RequestToolSearchToolResultError = { + readonly "error_code": ToolSearchToolResultErrorCode + readonly "type": "tool_search_tool_result_error" +} +export const RequestToolSearchToolResultError = Schema.Struct({ + "error_code": ToolSearchToolResultErrorCode, + "type": Schema.Literal("tool_search_tool_result_error").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestToolSearchToolResultError" }) +export type ResponseToolSearchToolResultError = { + readonly "error_code": ToolSearchToolResultErrorCode + readonly "error_message": string | null + readonly "type": "tool_search_tool_result_error" +} +export const ResponseToolSearchToolResultError = Schema.Struct({ + "error_code": ToolSearchToolResultErrorCode, + "error_message": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Error Message", "default": null }), + "type": Schema.Literal("tool_search_tool_result_error").annotate({ + "title": "Type", + "default": "tool_search_tool_result_error" + }) +}).annotate({ "title": "ResponseToolSearchToolResultError" }) +export type RequestImageBlock = { readonly "cache_control"?: CacheControlEphemeral | null - readonly "caller"?: DirectCaller | ServerToolCaller | ServerToolCaller_20260120 - readonly "content": RequestWebFetchToolResultError | RequestWebFetchResultBlock - readonly "tool_use_id": string - readonly "type": "web_fetch_tool_result" + readonly "source": Base64ImageSource | URLImageSource + readonly "type": "image" } -export const RequestWebFetchToolResultBlock = Schema.Struct({ +export const RequestImageBlock = Schema.Struct({ "cache_control": Schema.optionalKey( Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", "description": "Create a cache control breakpoint at this content block." }) ), - "caller": Schema.optionalKey( - Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({ - "title": "Caller" + "source": Schema.Union([Base64ImageSource, URLImageSource], { mode: "oneOf" }).annotate({ "title": "Source" }), + "type": Schema.Literal("image").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestImageBlock" }) +export type WebSearchTool_20250305 = { + readonly "allowed_callers"?: ReadonlyArray + readonly "allowed_domains"?: ReadonlyArray | null + readonly "blocked_domains"?: ReadonlyArray | null + readonly "cache_control"?: CacheControlEphemeral | null + readonly "defer_loading"?: boolean + readonly "max_uses"?: number | null + readonly "name": "web_search" + readonly "strict"?: boolean + readonly "type": "web_search_20250305" + readonly "user_location"?: UserLocation | null +} +export const WebSearchTool_20250305 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), + "allowed_domains": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Allowed Domains", + "description": + "If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`." }) ), - "content": Schema.Union([RequestWebFetchToolResultError, RequestWebFetchResultBlock]).annotate({ - "title": "Content" + "blocked_domains": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Blocked Domains", + "description": + "If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`." + }) + ), + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Defer Loading", + "description": + "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + }) + ), + "max_uses": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ + "title": "Max Uses", + "description": "Maximum number of times the tool can be used in the API request." + }) + ), + "name": Schema.Literal("web_search").annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." }), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + "strict": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" + }) ), - "type": Schema.Literal("web_fetch_tool_result").annotate({ "title": "Type" }) -}).annotate({ "title": "RequestWebFetchToolResultBlock" }) -export type BetaMessageStartEvent = { readonly "message": BetaMessage; readonly "type": "message_start" } -export const BetaMessageStartEvent = Schema.Struct({ - "message": BetaMessage, - "type": Schema.Literal("message_start").annotate({ "title": "Type", "default": "message_start" }) -}).annotate({ "title": "MessageStartEvent" }) -export type BetaSucceededResult = { readonly "message": BetaMessage; readonly "type": "succeeded" } -export const BetaSucceededResult = Schema.Struct({ - "message": BetaMessage, - "type": Schema.Literal("succeeded").annotate({ "title": "Type", "default": "succeeded" }) -}).annotate({ "title": "SucceededResult" }) -export type BetaInputContentBlock = - | { - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "citations"?: - | ReadonlyArray< - | BetaRequestCharLocationCitation - | BetaRequestPageLocationCitation - | BetaRequestContentBlockLocationCitation - | BetaRequestWebSearchResultLocationCitation - | BetaRequestSearchResultLocationCitation - > - | null - readonly "text": string - readonly "type": "text" - } - | { - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "source": BetaBase64ImageSource | BetaURLImageSource | BetaFileImageSource - readonly "type": "image" - } - | { - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "citations"?: BetaRequestCitationsConfig | null - readonly "context"?: string | null - readonly "source": - | BetaBase64PDFSource - | BetaPlainTextSource - | BetaContentBlockSource - | BetaURLPDFSource - | BetaFileDocumentSource - readonly "title"?: string | null - readonly "type": "document" - } - | { - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "citations"?: BetaRequestCitationsConfig - readonly "content": ReadonlyArray - readonly "source": string - readonly "title": string - readonly "type": "search_result" - } - | { readonly "signature": string; readonly "thinking": string; readonly "type": "thinking" } - | { readonly "data": string; readonly "type": "redacted_thinking" } - | { - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120 - readonly "id": string - readonly "input": { readonly [x: string]: Schema.Json } - readonly "name": string - readonly "type": "tool_use" - } - | { - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "content"?: - | string - | ReadonlyArray< - | BetaRequestTextBlock - | BetaRequestImageBlock - | BetaRequestSearchResultBlock - | BetaRequestDocumentBlock - | BetaRequestToolReferenceBlock - > - readonly "is_error"?: boolean - readonly "tool_use_id": string - readonly "type": "tool_result" - } - | BetaRequestServerToolUseBlock - | BetaRequestWebSearchToolResultBlock - | BetaRequestWebFetchToolResultBlock - | BetaRequestCodeExecutionToolResultBlock - | BetaRequestBashCodeExecutionToolResultBlock - | BetaRequestTextEditorCodeExecutionToolResultBlock - | BetaRequestToolSearchToolResultBlock - | BetaRequestMCPToolUseBlock - | BetaRequestMCPToolResultBlock - | BetaRequestContainerUploadBlock - | BetaRequestCompactionBlock -export const BetaInputContentBlock = Schema.Union([ - Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "citations": Schema.optionalKey( - Schema.Union([ - Schema.Array( - Schema.Union([ - BetaRequestCharLocationCitation, - BetaRequestPageLocationCitation, - BetaRequestContentBlockLocationCitation, - BetaRequestWebSearchResultLocationCitation, - BetaRequestSearchResultLocationCitation - ], { mode: "oneOf" }) - ), - Schema.Null - ]).annotate({ "title": "Citations" }) - ), - "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(1)), - "type": Schema.Literal("text").annotate({ "title": "Type" }) - }).annotate({ "title": "RequestTextBlock", "description": "Regular text content." }), - Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "source": Schema.Union([BetaBase64ImageSource, BetaURLImageSource, BetaFileImageSource], { mode: "oneOf" }) - .annotate({ "title": "Source" }), - "type": Schema.Literal("image").annotate({ "title": "Type" }) - }).annotate({ - "title": "RequestImageBlock", - "description": "Image content specified directly as base64 data or as a reference via a URL." - }), - Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "citations": Schema.optionalKey(Schema.Union([BetaRequestCitationsConfig, Schema.Null])), - "context": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMinLength(1)), Schema.Null]).annotate({ "title": "Context" }) - ), - "source": Schema.Union([ - BetaBase64PDFSource, - BetaPlainTextSource, - BetaContentBlockSource, - BetaURLPDFSource, - BetaFileDocumentSource - ], { mode: "oneOf" }).annotate({ "title": "Source" }), - "title": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(500)), Schema.Null]).annotate({ - "title": "Title" - }) - ), - "type": Schema.Literal("document").annotate({ "title": "Type" }) - }).annotate({ - "title": "RequestDocumentBlock", - "description": "Document content, either specified directly as base64 data, as text, or as a reference via a URL." + "type": Schema.Literal("web_search_20250305").annotate({ "title": "Type" }), + "user_location": Schema.optionalKey( + Schema.Union([UserLocation, Schema.Null]).annotate({ + "description": "Parameters for the user's location. Used to provide more relevant search results." + }) + ) +}).annotate({ "title": "WebSearchTool_20250305" }) +export type WebSearchTool_20260209 = { + readonly "allowed_callers"?: ReadonlyArray + readonly "allowed_domains"?: ReadonlyArray | null + readonly "blocked_domains"?: ReadonlyArray | null + readonly "cache_control"?: CacheControlEphemeral | null + readonly "defer_loading"?: boolean + readonly "max_uses"?: number | null + readonly "name": "web_search" + readonly "strict"?: boolean + readonly "type": "web_search_20260209" + readonly "user_location"?: UserLocation | null +} +export const WebSearchTool_20260209 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(AllowedCaller).annotate({ "title": "Allowed Callers" })), + "allowed_domains": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Allowed Domains", + "description": + "If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`." + }) + ), + "blocked_domains": Schema.optionalKey( + Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ + "title": "Blocked Domains", + "description": + "If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`." + }) + ), + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Defer Loading", + "description": + "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + }) + ), + "max_uses": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ + "title": "Max Uses", + "description": "Maximum number of times the tool can be used in the API request." + }) + ), + "name": Schema.Literal("web_search").annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." }), - Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "citations": Schema.optionalKey(BetaRequestCitationsConfig), - "content": Schema.Array(BetaRequestTextBlock).annotate({ "title": "Content" }), - "source": Schema.String.annotate({ "title": "Source" }), - "title": Schema.String.annotate({ "title": "Title" }), - "type": Schema.Literal("search_result").annotate({ "title": "Type" }) - }).annotate({ - "title": "RequestSearchResultBlock", - "description": "A search result block containing source, title, and content from search operations." + "strict": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" + }) + ), + "type": Schema.Literal("web_search_20260209").annotate({ "title": "Type" }), + "user_location": Schema.optionalKey( + Schema.Union([UserLocation, Schema.Null]).annotate({ + "description": "Parameters for the user's location. Used to provide more relevant search results." + }) + ) +}).annotate({ "title": "WebSearchTool_20260209" }) +export type RequestWebFetchToolResultError = { + readonly "error_code": WebFetchToolResultErrorCode + readonly "type": "web_fetch_tool_result_error" +} +export const RequestWebFetchToolResultError = Schema.Struct({ + "error_code": WebFetchToolResultErrorCode, + "type": Schema.Literal("web_fetch_tool_result_error").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestWebFetchToolResultError" }) +export type ResponseWebFetchToolResultError = { + readonly "error_code": WebFetchToolResultErrorCode + readonly "type": "web_fetch_tool_result_error" +} +export const ResponseWebFetchToolResultError = Schema.Struct({ + "error_code": WebFetchToolResultErrorCode, + "type": Schema.Literal("web_fetch_tool_result_error").annotate({ + "title": "Type", + "default": "web_fetch_tool_result_error" + }) +}).annotate({ "title": "ResponseWebFetchToolResultError" }) +export type RequestWebSearchToolResultError = { + readonly "error_code": WebSearchToolResultErrorCode + readonly "type": "web_search_tool_result_error" +} +export const RequestWebSearchToolResultError = Schema.Struct({ + "error_code": WebSearchToolResultErrorCode, + "type": Schema.Literal("web_search_tool_result_error").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestWebSearchToolResultError" }) +export type ResponseWebSearchToolResultError = { + readonly "error_code": WebSearchToolResultErrorCode + readonly "type": "web_search_tool_result_error" +} +export const ResponseWebSearchToolResultError = Schema.Struct({ + "error_code": WebSearchToolResultErrorCode, + "type": Schema.Literal("web_search_tool_result_error").annotate({ + "title": "Type", + "default": "web_search_tool_result_error" + }) +}).annotate({ "title": "ResponseWebSearchToolResultError" }) +export type BetaManagedAgentsError = + | BetaInvalidRequestError + | BetaAuthenticationError + | BetaBillingError + | BetaPermissionError + | BetaNotFoundError + | BetaRateLimitError + | BetaGatewayTimeoutError + | BetaAPIError + | BetaOverloadedError + | BetaManagedAgentsMemoryPreconditionFailedError + | BetaManagedAgentsMemoryPathConflictError + | BetaManagedAgentsConflictError +export const BetaManagedAgentsError = Schema.Union([ + BetaInvalidRequestError, + BetaAuthenticationError, + BetaBillingError, + BetaPermissionError, + BetaNotFoundError, + BetaRateLimitError, + BetaGatewayTimeoutError, + BetaAPIError, + BetaOverloadedError, + BetaManagedAgentsMemoryPreconditionFailedError, + BetaManagedAgentsMemoryPathConflictError, + BetaManagedAgentsConflictError +], { mode: "oneOf" }) +export type MessageDelta = { + readonly "container": Container | null + readonly "stop_details": RefusalStopDetails | null + readonly "stop_reason": StopReason | null + readonly "stop_sequence": string | null +} +export const MessageDelta = Schema.Struct({ + "container": Schema.Union([Container, Schema.Null]).annotate({ + "description": + "Information about the container used in this request.\n\nThis will be non-null if a container tool (e.g. code execution) was used.", + "default": null }), - Schema.Struct({ - "signature": Schema.String.annotate({ "title": "Signature" }), - "thinking": Schema.String.annotate({ "title": "Thinking" }), - "type": Schema.Literal("thinking").annotate({ "title": "Type" }) - }).annotate({ "title": "RequestThinkingBlock", "description": "A block specifying internal thinking by the model." }), - Schema.Struct({ - "data": Schema.String.annotate({ "title": "Data" }), - "type": Schema.Literal("redacted_thinking").annotate({ "title": "Type" }) - }).annotate({ - "title": "RequestRedactedThinkingBlock", - "description": "A block specifying internal, redacted thinking by the model." + "stop_details": Schema.Union([RefusalStopDetails, Schema.Null]).annotate({ + "description": + "Structured information about why model output stopped.\n\nThis is `null` when the `stop_reason` has no additional detail to report.", + "default": null }), - Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "caller": Schema.optionalKey( - Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate( - { "title": "Caller" } - ) - ), - "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$"))), - "input": Schema.Record(Schema.String, Schema.Json).annotate({ "title": "Input" }), - "name": Schema.String.annotate({ "title": "Name" }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(200)), - "type": Schema.Literal("tool_use").annotate({ "title": "Type" }) - }).annotate({ "title": "RequestToolUseBlock", "description": "A block indicating a tool use by the model." }), - Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "content": Schema.optionalKey( - Schema.Union([ - Schema.String, - Schema.Array( - Schema.Union([ - BetaRequestTextBlock, - BetaRequestImageBlock, - BetaRequestSearchResultBlock, - BetaRequestDocumentBlock, - BetaRequestToolReferenceBlock - ], { mode: "oneOf" }).annotate({ "title": "Block" }) - ) - ]).annotate({ "title": "Content" }) - ), - "is_error": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Is Error" })), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$")) - ), - "type": Schema.Literal("tool_result").annotate({ "title": "Type" }) - }).annotate({ - "title": "RequestToolResultBlock", - "description": "A block specifying the results of a tool use by the model." + "stop_reason": Schema.Union([StopReason, Schema.Null]).annotate({ "title": "Stop Reason", "default": null }), + "stop_sequence": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Stop Sequence", "default": null }) +}).annotate({ "title": "MessageDelta" }) +export type BetaAdvisorMessageIterationUsage = { + readonly "cache_creation": BetaCacheCreation | null + readonly "cache_creation_input_tokens": number + readonly "cache_read_input_tokens": number + readonly "input_tokens": number + readonly "model": Model + readonly "output_tokens": number + readonly "type": "advisor_message" +} +export const BetaAdvisorMessageIterationUsage = Schema.Struct({ + "cache_creation": Schema.Union([BetaCacheCreation, Schema.Null]).annotate({ + "description": "Breakdown of cached tokens by TTL", + "default": null }), - BetaRequestServerToolUseBlock, - BetaRequestWebSearchToolResultBlock, - BetaRequestWebFetchToolResultBlock, - BetaRequestCodeExecutionToolResultBlock, - BetaRequestBashCodeExecutionToolResultBlock, - BetaRequestTextEditorCodeExecutionToolResultBlock, - BetaRequestToolSearchToolResultBlock, - BetaRequestMCPToolUseBlock, - BetaRequestMCPToolResultBlock, - BetaRequestContainerUploadBlock, - BetaRequestCompactionBlock -], { mode: "oneOf" }) -export type MessageStartEvent = { readonly "message": Message; readonly "type": "message_start" } -export const MessageStartEvent = Schema.Struct({ - "message": Message, - "type": Schema.Literal("message_start").annotate({ "title": "Type", "default": "message_start" }) -}).annotate({ "title": "MessageStartEvent" }) -export type SucceededResult = { readonly "message": Message; readonly "type": "succeeded" } -export const SucceededResult = Schema.Struct({ - "message": Message, - "type": Schema.Literal("succeeded").annotate({ "title": "Type", "default": "succeeded" }) -}).annotate({ "title": "SucceededResult" }) -export type InputContentBlock = - | { - readonly "cache_control"?: CacheControlEphemeral | null - readonly "citations"?: - | ReadonlyArray< - | RequestCharLocationCitation - | RequestPageLocationCitation - | RequestContentBlockLocationCitation - | RequestWebSearchResultLocationCitation - | RequestSearchResultLocationCitation - > - | null - readonly "text": string - readonly "type": "text" - } - | { - readonly "cache_control"?: CacheControlEphemeral | null - readonly "source": Base64ImageSource | URLImageSource - readonly "type": "image" - } - | { - readonly "cache_control"?: CacheControlEphemeral | null - readonly "citations"?: RequestCitationsConfig | null - readonly "context"?: string | null - readonly "source": Base64PDFSource | PlainTextSource | ContentBlockSource | URLPDFSource - readonly "title"?: string | null - readonly "type": "document" - } - | { - readonly "cache_control"?: CacheControlEphemeral | null - readonly "citations"?: RequestCitationsConfig - readonly "content": ReadonlyArray - readonly "source": string - readonly "title": string - readonly "type": "search_result" - } - | { readonly "signature": string; readonly "thinking": string; readonly "type": "thinking" } - | { readonly "data": string; readonly "type": "redacted_thinking" } - | { - readonly "cache_control"?: CacheControlEphemeral | null - readonly "caller"?: DirectCaller | ServerToolCaller | ServerToolCaller_20260120 - readonly "id": string - readonly "input": { readonly [x: string]: Schema.Json } - readonly "name": string - readonly "type": "tool_use" - } - | { - readonly "cache_control"?: CacheControlEphemeral | null - readonly "content"?: - | string - | ReadonlyArray< - | RequestTextBlock - | RequestImageBlock - | RequestSearchResultBlock - | RequestDocumentBlock - | RequestToolReferenceBlock - > - readonly "is_error"?: boolean - readonly "tool_use_id": string - readonly "type": "tool_result" - } - | RequestServerToolUseBlock - | RequestWebSearchToolResultBlock - | RequestWebFetchToolResultBlock - | RequestCodeExecutionToolResultBlock - | RequestBashCodeExecutionToolResultBlock - | RequestTextEditorCodeExecutionToolResultBlock - | RequestToolSearchToolResultBlock - | RequestContainerUploadBlock -export const InputContentBlock = Schema.Union([ - Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "citations": Schema.optionalKey( - Schema.Union([ - Schema.Array( - Schema.Union([ - RequestCharLocationCitation, - RequestPageLocationCitation, - RequestContentBlockLocationCitation, - RequestWebSearchResultLocationCitation, - RequestSearchResultLocationCitation - ], { mode: "oneOf" }) - ), - Schema.Null - ]).annotate({ "title": "Citations" }) - ), - "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(1)), - "type": Schema.Literal("text").annotate({ "title": "Type" }) - }).annotate({ "title": "RequestTextBlock", "description": "Regular text content." }), - Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "source": Schema.Union([Base64ImageSource, URLImageSource], { mode: "oneOf" }).annotate({ "title": "Source" }), - "type": Schema.Literal("image").annotate({ "title": "Type" }) - }).annotate({ - "title": "RequestImageBlock", - "description": "Image content specified directly as base64 data or as a reference via a URL." + "cache_creation_input_tokens": Schema.Number.annotate({ + "title": "Cache Creation Input Tokens", + "description": "The number of input tokens used to create the cache entry.", + "default": 0 + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "cache_read_input_tokens": Schema.Number.annotate({ + "title": "Cache Read Input Tokens", + "description": "The number of input tokens read from the cache.", + "default": 0 + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "input_tokens": Schema.Number.annotate({ + "title": "Input Tokens", + "description": "The number of input tokens which were used." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "model": Model, + "output_tokens": Schema.Number.annotate({ + "title": "Output Tokens", + "description": "The number of output tokens which were used." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "type": Schema.Literal("advisor_message").annotate({ + "title": "Type", + "description": "Usage for an advisor sub-inference iteration", + "default": "advisor_message" + }) +}).annotate({ + "title": "AdvisorMessageIterationUsage", + "description": "Token usage for an advisor sub-inference iteration." +}) +export type BetaAdvisorTool_20260301 = { + readonly "allowed_callers"?: ReadonlyArray + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "caching"?: BetaCacheControlEphemeral | null + readonly "defer_loading"?: boolean + readonly "max_uses"?: number | null + readonly "model": Model + readonly "name": "advisor" + readonly "strict"?: boolean + readonly "type": "advisor_20260301" +} +export const BetaAdvisorTool_20260301 = Schema.Struct({ + "allowed_callers": Schema.optionalKey(Schema.Array(BetaAllowedCaller).annotate({ "title": "Allowed Callers" })), + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "caching": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Caching", + "description": + "Caching for the advisor's own prompt. When set, each advisor call writes a cache entry at the given TTL so subsequent calls in the same conversation read the stable prefix. When omitted, the advisor prompt is not cached." + }) + ), + "defer_loading": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Defer Loading", + "description": + "If true, tool will not be included in initial system prompt. Only loaded when returned via tool_reference from tool search." + }) + ), + "max_uses": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThan(0)), Schema.Null]).annotate({ + "title": "Max Uses", + "description": "Maximum number of times the tool can be used in the API request." + }) + ), + "model": Model, + "name": Schema.Literal("advisor").annotate({ + "title": "Name", + "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks." }), - Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "citations": Schema.optionalKey(Schema.Union([RequestCitationsConfig, Schema.Null])), - "context": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMinLength(1)), Schema.Null]).annotate({ "title": "Context" }) - ), - "source": Schema.Union([Base64PDFSource, PlainTextSource, ContentBlockSource, URLPDFSource], { mode: "oneOf" }) - .annotate({ "title": "Source" }), - "title": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(500)), Schema.Null]).annotate({ - "title": "Title" - }) - ), - "type": Schema.Literal("document").annotate({ "title": "Type" }) - }).annotate({ - "title": "RequestDocumentBlock", - "description": "Document content, either specified directly as base64 data, as text, or as a reference via a URL." - }), - Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "citations": Schema.optionalKey(RequestCitationsConfig), - "content": Schema.Array(RequestTextBlock).annotate({ "title": "Content" }), - "source": Schema.String.annotate({ "title": "Source" }), - "title": Schema.String.annotate({ "title": "Title" }), - "type": Schema.Literal("search_result").annotate({ "title": "Type" }) - }).annotate({ - "title": "RequestSearchResultBlock", - "description": "A search result block containing source, title, and content from search operations." - }), - Schema.Struct({ - "signature": Schema.String.annotate({ "title": "Signature" }), - "thinking": Schema.String.annotate({ "title": "Thinking" }), - "type": Schema.Literal("thinking").annotate({ "title": "Type" }) - }).annotate({ "title": "RequestThinkingBlock", "description": "A block specifying internal thinking by the model." }), - Schema.Struct({ - "data": Schema.String.annotate({ "title": "Data" }), - "type": Schema.Literal("redacted_thinking").annotate({ "title": "Type" }) - }).annotate({ - "title": "RequestRedactedThinkingBlock", - "description": "A block specifying internal, redacted thinking by the model." - }), - Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "caller": Schema.optionalKey( - Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({ - "title": "Caller" - }) - ), - "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$"))), - "input": Schema.Record(Schema.String, Schema.Json).annotate({ "title": "Input" }), - "name": Schema.String.annotate({ "title": "Name" }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(200)), - "type": Schema.Literal("tool_use").annotate({ "title": "Type" }) - }).annotate({ "title": "RequestToolUseBlock", "description": "A block indicating a tool use by the model." }), - Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": "Create a cache control breakpoint at this content block." - }) - ), - "content": Schema.optionalKey( - Schema.Union([ - Schema.String, - Schema.Array( - Schema.Union([ - RequestTextBlock, - RequestImageBlock, - RequestSearchResultBlock, - RequestDocumentBlock, - RequestToolReferenceBlock - ], { mode: "oneOf" }).annotate({ "title": "Block" }) - ) - ]).annotate({ "title": "Content" }) - ), - "is_error": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Is Error" })), - "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( - Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$")) - ), - "type": Schema.Literal("tool_result").annotate({ "title": "Type" }) - }).annotate({ - "title": "RequestToolResultBlock", - "description": "A block specifying the results of a tool use by the model." - }), - RequestServerToolUseBlock, - RequestWebSearchToolResultBlock, - RequestWebFetchToolResultBlock, - RequestCodeExecutionToolResultBlock, - RequestBashCodeExecutionToolResultBlock, - RequestTextEditorCodeExecutionToolResultBlock, - RequestToolSearchToolResultBlock, - RequestContainerUploadBlock -], { mode: "oneOf" }) -export type BetaInputMessage = { - readonly "content": string | ReadonlyArray - readonly "role": "user" | "assistant" -} -export const BetaInputMessage = Schema.Struct({ - "content": Schema.Union([Schema.String, Schema.Array(BetaInputContentBlock)]).annotate({ "title": "Content" }), - "role": Schema.Literals(["user", "assistant"]).annotate({ "title": "Role" }) -}).annotate({ "title": "InputMessage" }) -export type InputMessage = { - readonly "content": string | ReadonlyArray - readonly "role": "user" | "assistant" -} -export const InputMessage = Schema.Struct({ - "content": Schema.Union([Schema.String, Schema.Array(InputContentBlock)]).annotate({ "title": "Content" }), - "role": Schema.Literals(["user", "assistant"]).annotate({ "title": "Role" }) -}).annotate({ "title": "InputMessage" }) -export type BetaCountMessageTokensParams = { - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "context_management"?: BetaContextManagementConfig | null - readonly "mcp_servers"?: ReadonlyArray - readonly "messages": ReadonlyArray + "strict": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Strict", + "description": "When true, guarantees schema validation on tool names and inputs" + }) + ), + "type": Schema.Literal("advisor_20260301").annotate({ "title": "Type" }) +}).annotate({ "title": "AdvisorTool_20260301" }) +export type CompletionRequest = { readonly "model": Model - readonly "output_config"?: { - readonly "effort"?: BetaEffortLevel | null - readonly "format"?: BetaJsonOutputFormat | null - } - readonly "output_format"?: BetaJsonOutputFormat | null - readonly "speed"?: BetaSpeed | null - readonly "system"?: string | ReadonlyArray - readonly "thinking"?: BetaThinkingConfigParam - readonly "tool_choice"?: BetaToolChoice - readonly "tools"?: ReadonlyArray< - | BetaTool - | BetaBashTool_20241022 - | BetaBashTool_20250124 - | BetaCodeExecutionTool_20250522 - | BetaCodeExecutionTool_20250825 - | BetaCodeExecutionTool_20260120 - | BetaComputerUseTool_20241022 - | BetaMemoryTool_20250818 - | BetaComputerUseTool_20250124 - | BetaTextEditor_20241022 - | BetaComputerUseTool_20251124 - | BetaTextEditor_20250124 - | BetaTextEditor_20250429 - | BetaTextEditor_20250728 - | BetaWebSearchTool_20250305 - | BetaWebFetchTool_20250910 - | BetaWebSearchTool_20260209 - | BetaWebFetchTool_20260209 - | BetaToolSearchToolBM25_20251119 - | BetaToolSearchToolRegex_20251119 - | BetaMCPToolset - > + readonly "prompt": string + readonly "max_tokens_to_sample": number + readonly "stop_sequences"?: ReadonlyArray + readonly "temperature"?: number + readonly "top_p"?: number + readonly "top_k"?: number + readonly "metadata"?: { readonly "user_id"?: string | null } + readonly "stream"?: boolean } -export const BetaCountMessageTokensParams = Schema.Struct({ - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", +export const CompletionRequest = Schema.Struct({ + "model": Model, + "prompt": Schema.String.annotate({ + "title": "Prompt", + "description": + "The prompt that you want Claude to complete.\n\nFor proper response generation you will need to format your prompt using alternating `\\n\\nHuman:` and `\\n\\nAssistant:` conversational turns. For example:\n\n```\n\"\\n\\nHuman: {userQuestion}\\n\\nAssistant:\"\n```\n\nSee [prompt validation](https://docs.claude.com/en/api/prompt-validation) and our guide to [prompt design](https://docs.claude.com/en/docs/intro-to-prompting) for more details." + }).check(Schema.isMinLength(1)), + "max_tokens_to_sample": Schema.Number.annotate({ + "title": "Max Tokens To Sample", + "description": + "The maximum number of tokens to generate before stopping.\n\nNote that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), + "stop_sequences": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "title": "Stop Sequences", "description": - "Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request." + "Sequences that will cause the model to stop generating.\n\nOur models stop on `\"\\n\\nHuman:\"`, and may include additional built-in stop sequences in the future. By providing the stop_sequences parameter, you may include additional strings that will cause the model to stop generating." }) ), - "context_management": Schema.optionalKey( - Schema.Union([BetaContextManagementConfig, Schema.Null]).annotate({ + "temperature": Schema.optionalKey( + Schema.Number.annotate({ + "title": "Temperature", "description": - "Context management configuration.\n\nThis allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not." - }) + "Amount of randomness injected into the response.\n\nDefaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.\n\nNote that even with `temperature` of `0.0`, the results will not be fully deterministic." + }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)) ), - "mcp_servers": Schema.optionalKey( - Schema.Array(BetaRequestMCPServerURLDefinition).annotate({ - "title": "Mcp Servers", - "description": "MCP servers to be utilized in this request" - }).check(Schema.isMaxLength(20)) + "top_p": Schema.optionalKey( + Schema.Number.annotate({ + "title": "Top P", + "description": + "Use nucleus sampling.\n\nIn nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`.\n\nRecommended for advanced use cases only." + }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)) ), - "messages": Schema.Array(BetaInputMessage).annotate({ - "title": "Messages", - "description": - "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:\n\n```json\n[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"Hello there.\"},\n {\"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\"},\n {\"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\"},\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"},\n]\n```\n\nEach input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `\"text\"`. The following input messages are equivalent:\n\n```json\n{\"role\": \"user\", \"content\": \"Hello, Claude\"}\n```\n\n```json\n{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Hello, Claude\"}]}\n```\n\nSee [input examples](https://docs.claude.com/en/api/messages-examples).\n\nNote that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `\"system\"` role for input messages in the Messages API.\n\nThere is a limit of 100,000 messages in a single request." - }), - "model": Model, - "output_config": Schema.optionalKey( + "top_k": Schema.optionalKey( + Schema.Number.annotate({ + "title": "Top K", + "description": + "Only sample from the top K options for each subsequent token.\n\nUsed to remove \"long tail\" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).\n\nRecommended for advanced use cases only." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)) + ), + "metadata": Schema.optionalKey( Schema.Struct({ - "effort": Schema.optionalKey( - Schema.Union([BetaEffortLevel, Schema.Null]).annotate({ - "description": - "How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer.\n\nValid values are `low`, `medium`, `high`, or `max`." - }) - ), - "format": Schema.optionalKey( - Schema.Union([BetaJsonOutputFormat, Schema.Null]).annotate({ + "user_id": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMaxLength(512)), Schema.Null]).annotate({ + "title": "User Id", "description": - "A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)" + "An external identifier for the user who is associated with the request.\n\nThis should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number." }) ) - }).annotate({ - "title": "OutputConfig", - "description": "Configuration options for the model's output, such as the output format." - }) - ), - "output_format": Schema.optionalKey( - Schema.Union([BetaJsonOutputFormat, Schema.Null]).annotate({ - "description": - "Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)\n\nA schema to specify Claude's output format in responses. This parameter will be removed in a future release." - }) - ), - "speed": Schema.optionalKey( - Schema.Union([BetaSpeed, Schema.Null]).annotate({ - "description": - "The inference speed mode for this request. `\"fast\"` enables high output-tokens-per-second inference." - }) + }).annotate({ "title": "Metadata", "description": "An object describing metadata about the request." }) ), - "system": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Array(BetaRequestTextBlock)]).annotate({ - "title": "System", + "stream": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Stream", "description": - "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts)." - }) - ), - "thinking": Schema.optionalKey(BetaThinkingConfigParam), - "tool_choice": Schema.optionalKey(BetaToolChoice), - "tools": Schema.optionalKey( - Schema.Array( - Schema.Union([ - BetaTool, - BetaBashTool_20241022, - BetaBashTool_20250124, - BetaCodeExecutionTool_20250522, - BetaCodeExecutionTool_20250825, - BetaCodeExecutionTool_20260120, - BetaComputerUseTool_20241022, - BetaMemoryTool_20250818, - BetaComputerUseTool_20250124, - BetaTextEditor_20241022, - BetaComputerUseTool_20251124, - BetaTextEditor_20250124, - BetaTextEditor_20250429, - BetaTextEditor_20250728, - BetaWebSearchTool_20250305, - BetaWebFetchTool_20250910, - BetaWebSearchTool_20260209, - BetaWebFetchTool_20260209, - BetaToolSearchToolBM25_20251119, - BetaToolSearchToolRegex_20251119, - BetaMCPToolset - ], { mode: "oneOf" }) - ).annotate({ - "title": "Tools", - "description": - "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.\n\nThere are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview\\#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).\n\nEach tool definition includes:\n\n* `name`: Name of the tool.\n* `description`: Optional, but strongly-recommended description of the tool.\n* `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce `tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an input, and return the following back to the model in a subsequent `user` message:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.\n\nSee our [guide](https://docs.claude.com/en/docs/tool-use) for more details." + "Whether to incrementally stream the response using server-sent events.\n\nSee [streaming](https://docs.claude.com/en/api/streaming) for details." }) ) -}).annotate({ "title": "CountMessageTokensParams" }) -export type BetaCreateMessageParams = { +}).annotate({ "title": "CompletionRequest" }) +export type CompletionResponse = { + readonly "completion": string + readonly "id": string readonly "model": Model - readonly "messages": ReadonlyArray - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "container"?: BetaContainerParams | string | null - readonly "context_management"?: BetaContextManagementConfig | null - readonly "inference_geo"?: string | null - readonly "max_tokens": number - readonly "mcp_servers"?: ReadonlyArray - readonly "metadata"?: { readonly "user_id"?: string | null } - readonly "output_config"?: { - readonly "effort"?: BetaEffortLevel | null - readonly "format"?: BetaJsonOutputFormat | null - } - readonly "output_format"?: BetaJsonOutputFormat | null - readonly "service_tier"?: "auto" | "standard_only" - readonly "speed"?: BetaSpeed | null - readonly "stop_sequences"?: ReadonlyArray - readonly "stream"?: boolean - readonly "system"?: string | ReadonlyArray - readonly "temperature"?: number - readonly "thinking"?: BetaThinkingConfigParam - readonly "tool_choice"?: BetaToolChoice - readonly "tools"?: ReadonlyArray< - | BetaTool - | BetaBashTool_20241022 - | BetaBashTool_20250124 - | BetaCodeExecutionTool_20250522 - | BetaCodeExecutionTool_20250825 - | BetaCodeExecutionTool_20260120 - | BetaComputerUseTool_20241022 - | BetaMemoryTool_20250818 - | BetaComputerUseTool_20250124 - | BetaTextEditor_20241022 - | BetaComputerUseTool_20251124 - | BetaTextEditor_20250124 - | BetaTextEditor_20250429 - | BetaTextEditor_20250728 - | BetaWebSearchTool_20250305 - | BetaWebFetchTool_20250910 - | BetaWebSearchTool_20260209 - | BetaWebFetchTool_20260209 - | BetaToolSearchToolBM25_20251119 - | BetaToolSearchToolRegex_20251119 - | BetaMCPToolset - > - readonly "top_k"?: number - readonly "top_p"?: number + readonly "stop_reason": string | null + readonly "type": "completion" } -export const BetaCreateMessageParams = Schema.Struct({ +export const CompletionResponse = Schema.Struct({ + "completion": Schema.String.annotate({ + "title": "Completion", + "description": "The resulting completion up to and excluding the stop sequences." + }), + "id": Schema.String.annotate({ + "title": "Id", + "description": "Unique object identifier.\n\nThe format and length of IDs may change over time." + }), "model": Model, - "messages": Schema.Array(BetaInputMessage).annotate({ - "title": "Messages", + "stop_reason": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Stop Reason", "description": - "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:\n\n```json\n[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"Hello there.\"},\n {\"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\"},\n {\"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\"},\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"},\n]\n```\n\nEach input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `\"text\"`. The following input messages are equivalent:\n\n```json\n{\"role\": \"user\", \"content\": \"Hello, Claude\"}\n```\n\n```json\n{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Hello, Claude\"}]}\n```\n\nSee [input examples](https://docs.claude.com/en/api/messages-examples).\n\nNote that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `\"system\"` role for input messages in the Messages API.\n\nThere is a limit of 100,000 messages in a single request." + "The reason that we stopped.\n\nThis may be one the following values:\n* `\"stop_sequence\"`: we reached a stop sequence — either provided by you via the `stop_sequences` parameter, or a stop sequence built into the model\n* `\"max_tokens\"`: we exceeded `max_tokens_to_sample` or the model's maximum" }), - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": - "Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request." - }) - ), - "container": Schema.optionalKey( - Schema.Union([BetaContainerParams, Schema.String, Schema.Null]).annotate({ - "title": "Container", - "description": "Container identifier for reuse across requests." - }) - ), - "context_management": Schema.optionalKey( - Schema.Union([BetaContextManagementConfig, Schema.Null]).annotate({ + "type": Schema.Literal("completion").annotate({ + "title": "Type", + "description": "Object type.\n\nFor Text Completions, this is always `\"completion\"`.", + "default": "completion" + }) +}).annotate({ "title": "CompletionResponse" }) +export type BetaManagedAgentsModelConfig = { + readonly "id": BetaManagedAgentsModel + readonly "speed"?: "standard" | "fast" +} +export const BetaManagedAgentsModelConfig = Schema.Struct({ + "id": BetaManagedAgentsModel, + "speed": Schema.optionalKey( + Schema.Literals(["standard", "fast"]).annotate({ "description": - "Context management configuration.\n\nThis allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not." + "Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time." }) - ), - "inference_geo": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Inference Geo", + ) +}).annotate({ "description": "Model identifier and configuration." }) +export type BetaManagedAgentsModelConfigParams = { + readonly "id": BetaManagedAgentsModel + readonly "speed"?: "standard" | "fast" +} +export const BetaManagedAgentsModelConfigParams = Schema.Struct({ + "id": BetaManagedAgentsModel, + "speed": Schema.optionalKey( + Schema.Literals(["standard", "fast"]).annotate({ "description": - "Specifies the geographic region for inference processing. If not specified, the workspace's `default_inference_geo` is used." - }) - ), - "max_tokens": Schema.Number.annotate({ - "title": "Max Tokens", - "description": - "The maximum number of tokens to generate before stopping.\n\nNote that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.\n\nDifferent models have different maximum values for this parameter. See [models](https://docs.claude.com/en/docs/models-overview) for details." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), - "mcp_servers": Schema.optionalKey( - Schema.Array(BetaRequestMCPServerURLDefinition).annotate({ - "title": "Mcp Servers", - "description": "MCP servers to be utilized in this request" - }).check(Schema.isMaxLength(20)) - ), - "metadata": Schema.optionalKey( - Schema.Struct({ - "user_id": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMaxLength(256)), Schema.Null]).annotate({ - "title": "User Id", - "description": - "An external identifier for the user who is associated with the request.\n\nThis should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number." - }) - ) - }).annotate({ "title": "Metadata", "description": "An object describing metadata about the request." }) - ), - "output_config": Schema.optionalKey( - Schema.Struct({ - "effort": Schema.optionalKey( - Schema.Union([BetaEffortLevel, Schema.Null]).annotate({ - "description": - "How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer.\n\nValid values are `low`, `medium`, `high`, or `max`." - }) - ), - "format": Schema.optionalKey( - Schema.Union([BetaJsonOutputFormat, Schema.Null]).annotate({ - "description": - "A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)" - }) - ) - }).annotate({ - "title": "OutputConfig", - "description": "Configuration options for the model's output, such as the output format." + "Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time." }) - ), - "output_format": Schema.optionalKey( - Schema.Union([BetaJsonOutputFormat, Schema.Null]).annotate({ - "description": - "Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)\n\nA schema to specify Claude's output format in responses. This parameter will be removed in a future release." + ) +}).annotate({ "description": "An object that defines additional configuration control over model use" }) +export type BetaRequestAdvisorToolResultBlock = { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "content": + | BetaRequestAdvisorToolResultError + | BetaRequestAdvisorResultBlock + | BetaRequestAdvisorRedactedResultBlock + readonly "tool_use_id": string + readonly "type": "advisor_tool_result" +} +export const BetaRequestAdvisorToolResultBlock = Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." }) ), - "service_tier": Schema.optionalKey( - Schema.Literals(["auto", "standard_only"]).annotate({ - "title": "Service Tier", - "description": - "Determines whether to use priority capacity (if available) or standard capacity for this request.\n\nAnthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details." - }) + "content": Schema.Union([ + BetaRequestAdvisorToolResultError, + BetaRequestAdvisorResultBlock, + BetaRequestAdvisorRedactedResultBlock + ]).annotate({ "title": "Content" }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) ), - "speed": Schema.optionalKey( - Schema.Union([BetaSpeed, Schema.Null]).annotate({ - "description": - "The inference speed mode for this request. `\"fast\"` enables high output-tokens-per-second inference." - }) + "type": Schema.Literal("advisor_tool_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestAdvisorToolResultBlock" }) +export type BetaResponseAdvisorToolResultBlock = { + readonly "content": + | BetaResponseAdvisorToolResultError + | BetaResponseAdvisorResultBlock + | BetaResponseAdvisorRedactedResultBlock + readonly "tool_use_id": string + readonly "type": "advisor_tool_result" +} +export const BetaResponseAdvisorToolResultBlock = Schema.Struct({ + "content": Schema.Union([ + BetaResponseAdvisorToolResultError, + BetaResponseAdvisorResultBlock, + BetaResponseAdvisorRedactedResultBlock + ]).annotate({ "title": "Content" }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) ), - "stop_sequences": Schema.optionalKey( - Schema.Array(Schema.String).annotate({ - "title": "Stop Sequences", - "description": - "Custom text sequences that will cause the model to stop generating.\n\nOur models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `\"end_turn\"`.\n\nIf you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `\"stop_sequence\"` and the response `stop_sequence` value will contain the matched stop sequence." + "type": Schema.Literal("advisor_tool_result").annotate({ "title": "Type", "default": "advisor_tool_result" }) +}).annotate({ "title": "ResponseAdvisorToolResultBlock" }) +export type BetaRequestToolSearchToolSearchResultBlock = { + readonly "tool_references": ReadonlyArray + readonly "type": "tool_search_tool_search_result" +} +export const BetaRequestToolSearchToolSearchResultBlock = Schema.Struct({ + "tool_references": Schema.Array(BetaRequestToolReferenceBlock).annotate({ "title": "Tool References" }), + "type": Schema.Literal("tool_search_tool_search_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestToolSearchToolSearchResultBlock" }) +export type BetaFileListResponse = { + readonly "data": ReadonlyArray + readonly "first_id"?: string | null + readonly "has_more"?: boolean + readonly "last_id"?: string | null +} +export const BetaFileListResponse = Schema.Struct({ + "data": Schema.Array(BetaFileMetadataSchema).annotate({ + "title": "Data", + "description": "List of file metadata objects." + }), + "first_id": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "First Id", + "description": "ID of the first file in this page of results." }) ), - "stream": Schema.optionalKey( + "has_more": Schema.optionalKey( Schema.Boolean.annotate({ - "title": "Stream", - "description": - "Whether to incrementally stream the response using server-sent events.\n\nSee [streaming](https://docs.claude.com/en/api/messages-streaming) for details." + "title": "Has More", + "description": "Whether there are more results available.", + "default": false }) ), - "system": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Array(BetaRequestTextBlock)]).annotate({ - "title": "System", - "description": - "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts)." + "last_id": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Last Id", + "description": "ID of the last file in this page of results." }) - ), - "temperature": Schema.optionalKey( - Schema.Number.annotate({ - "title": "Temperature", - "description": - "Amount of randomness injected into the response.\n\nDefaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.\n\nNote that even with `temperature` of `0.0`, the results will not be fully deterministic." - }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)) - ), - "thinking": Schema.optionalKey(BetaThinkingConfigParam), - "tool_choice": Schema.optionalKey(BetaToolChoice), - "tools": Schema.optionalKey( - Schema.Array( - Schema.Union([ - BetaTool, - BetaBashTool_20241022, - BetaBashTool_20250124, - BetaCodeExecutionTool_20250522, - BetaCodeExecutionTool_20250825, - BetaCodeExecutionTool_20260120, - BetaComputerUseTool_20241022, - BetaMemoryTool_20250818, - BetaComputerUseTool_20250124, - BetaTextEditor_20241022, - BetaComputerUseTool_20251124, - BetaTextEditor_20250124, - BetaTextEditor_20250429, - BetaTextEditor_20250728, - BetaWebSearchTool_20250305, - BetaWebFetchTool_20250910, - BetaWebSearchTool_20260209, - BetaWebFetchTool_20260209, - BetaToolSearchToolBM25_20251119, - BetaToolSearchToolRegex_20251119, - BetaMCPToolset - ], { mode: "oneOf" }) - ).annotate({ - "title": "Tools", - "description": - "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.\n\nThere are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview\\#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).\n\nEach tool definition includes:\n\n* `name`: Name of the tool.\n* `description`: Optional, but strongly-recommended description of the tool.\n* `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce `tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an input, and return the following back to the model in a subsequent `user` message:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.\n\nSee our [guide](https://docs.claude.com/en/docs/tool-use) for more details." - }) - ), - "top_k": Schema.optionalKey( - Schema.Number.annotate({ - "title": "Top K", - "description": - "Only sample from the top K options for each subsequent token.\n\nUsed to remove \"long tail\" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).\n\nRecommended for advanced use cases only. You usually only need to use `temperature`." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)) - ), - "top_p": Schema.optionalKey( - Schema.Number.annotate({ - "title": "Top P", - "description": - "Use nucleus sampling.\n\nIn nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.\n\nRecommended for advanced use cases only. You usually only need to use `temperature`." - }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)) ) -}).annotate({ "title": "CreateMessageParams" }) -export type BetaMessageBatchIndividualRequestParams = { - readonly "custom_id": string - readonly "params": { - readonly "model": Model - readonly "messages": ReadonlyArray - readonly "cache_control"?: BetaCacheControlEphemeral | null - readonly "container"?: BetaContainerParams | string | null - readonly "context_management"?: BetaContextManagementConfig | null - readonly "inference_geo"?: string | null - readonly "max_tokens": number - readonly "mcp_servers"?: ReadonlyArray - readonly "metadata"?: { readonly "user_id"?: string | null } - readonly "output_config"?: { - readonly "effort"?: BetaEffortLevel | null - readonly "format"?: BetaJsonOutputFormat | null - } - readonly "output_format"?: BetaJsonOutputFormat | null - readonly "service_tier"?: "auto" | "standard_only" - readonly "speed"?: BetaSpeed | null - readonly "stop_sequences"?: ReadonlyArray - readonly "stream"?: boolean - readonly "system"?: string | ReadonlyArray - readonly "temperature"?: number - readonly "thinking"?: BetaThinkingConfigParam - readonly "tool_choice"?: BetaToolChoice - readonly "tools"?: ReadonlyArray< - | BetaTool - | BetaBashTool_20241022 - | BetaBashTool_20250124 - | BetaCodeExecutionTool_20250522 - | BetaCodeExecutionTool_20250825 - | BetaCodeExecutionTool_20260120 - | BetaComputerUseTool_20241022 - | BetaMemoryTool_20250818 - | BetaComputerUseTool_20250124 - | BetaTextEditor_20241022 - | BetaComputerUseTool_20251124 - | BetaTextEditor_20250124 - | BetaTextEditor_20250429 - | BetaTextEditor_20250728 - | BetaWebSearchTool_20250305 - | BetaWebFetchTool_20250910 - | BetaWebSearchTool_20260209 - | BetaWebFetchTool_20260209 - | BetaToolSearchToolBM25_20251119 - | BetaToolSearchToolRegex_20251119 - | BetaMCPToolset - > - readonly "top_k"?: number - readonly "top_p"?: number +}).annotate({ "title": "FileListResponse" }) +export type BetaManagedAgentsAgentToolParams = { + readonly "type": "agent_toolset_20260401" + readonly "default_config"?: { + readonly "enabled"?: boolean + readonly "permission_policy"?: { readonly "type": "always_allow" } | { readonly "type": "always_ask" } + } + readonly "configs"?: ReadonlyArray +} | { + readonly "type": "mcp_toolset" + readonly "mcp_server_name": string + readonly "default_config"?: { + readonly "enabled"?: boolean + readonly "permission_policy"?: { readonly "type": "always_allow" } | { readonly "type": "always_ask" } + } + readonly "configs"?: ReadonlyArray +} | { + readonly "type": "custom" + readonly "name": string + readonly "description": string + readonly "input_schema": { + readonly "type"?: "object" + readonly "properties"?: { readonly [x: string]: unknown } + readonly "required"?: ReadonlyArray } } -export const BetaMessageBatchIndividualRequestParams = Schema.Struct({ - "custom_id": Schema.String.annotate({ - "title": "Custom Id", - "description": - "Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order.\n\nMust be unique for each request within the Message Batch." - }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(64)).check( - Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]{1,64}$")) - ), - "params": Schema.Struct({ - "model": Model, - "messages": Schema.Array(BetaInputMessage).annotate({ - "title": "Messages", - "description": - "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:\n\n```json\n[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"Hello there.\"},\n {\"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\"},\n {\"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\"},\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"},\n]\n```\n\nEach input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `\"text\"`. The following input messages are equivalent:\n\n```json\n{\"role\": \"user\", \"content\": \"Hello, Claude\"}\n```\n\n```json\n{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Hello, Claude\"}]}\n```\n\nSee [input examples](https://docs.claude.com/en/api/messages-examples).\n\nNote that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `\"system\"` role for input messages in the Messages API.\n\nThere is a limit of 100,000 messages in a single request." - }), - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": - "Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request." - }) - ), - "container": Schema.optionalKey( - Schema.Union([BetaContainerParams, Schema.String, Schema.Null]).annotate({ - "title": "Container", - "description": "Container identifier for reuse across requests." - }) - ), - "context_management": Schema.optionalKey( - Schema.Union([BetaContextManagementConfig, Schema.Null]).annotate({ - "description": - "Context management configuration.\n\nThis allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not." - }) - ), - "inference_geo": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Inference Geo", - "description": - "Specifies the geographic region for inference processing. If not specified, the workspace's `default_inference_geo` is used." - }) - ), - "max_tokens": Schema.Number.annotate({ - "title": "Max Tokens", - "description": - "The maximum number of tokens to generate before stopping.\n\nNote that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.\n\nDifferent models have different maximum values for this parameter. See [models](https://docs.claude.com/en/docs/models-overview) for details." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), - "mcp_servers": Schema.optionalKey( - Schema.Array(BetaRequestMCPServerURLDefinition).annotate({ - "title": "Mcp Servers", - "description": "MCP servers to be utilized in this request" - }).check(Schema.isMaxLength(20)) - ), - "metadata": Schema.optionalKey( +export const BetaManagedAgentsAgentToolParams = Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("agent_toolset_20260401"), + "default_config": Schema.optionalKey( Schema.Struct({ - "user_id": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMaxLength(256)), Schema.Null]).annotate({ - "title": "User Id", + "enabled": Schema.optionalKey( + Schema.Boolean.annotate({ "description": - "An external identifier for the user who is associated with the request.\n\nThis should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number." + "Whether tools are enabled and available to Claude by default. Defaults to true if not specified." + }) + ), + "permission_policy": Schema.optionalKey( + Schema.Union([ + Schema.Struct({ "type": Schema.Literal("always_allow") }).annotate({ + "description": "Permission policy for tool execution." + }), + Schema.Struct({ "type": Schema.Literal("always_ask") }).annotate({ + "description": "Permission policy for tool execution." + }) + ], { mode: "oneOf" }).annotate({ + "description": + "Default permission policy for tools. Controls whether tool calls are auto-approved or require confirmation." }) ) - }).annotate({ "title": "Metadata", "description": "An object describing metadata about the request." }) + }).annotate({ "description": "Default configuration for all tools in a toolset." }) ), - "output_config": Schema.optionalKey( + "configs": Schema.optionalKey( + Schema.Array(BetaManagedAgentsAgentToolConfigParams).annotate({ + "description": "Per-tool configuration overrides." + }) + ) + }).annotate({ "description": "Union type for tool configurations in the tools array." }), + Schema.Struct({ + "type": Schema.Literal("mcp_toolset"), + "mcp_server_name": Schema.String.annotate({ + "description": "Name of the MCP server. Must match a server name from the mcp_servers array. 1-255 characters." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(255)), + "default_config": Schema.optionalKey( Schema.Struct({ - "effort": Schema.optionalKey( - Schema.Union([BetaEffortLevel, Schema.Null]).annotate({ - "description": - "How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer.\n\nValid values are `low`, `medium`, `high`, or `max`." + "enabled": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": "Whether tools are enabled by default. Defaults to true if not specified." }) ), - "format": Schema.optionalKey( - Schema.Union([BetaJsonOutputFormat, Schema.Null]).annotate({ - "description": - "A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)" - }) + "permission_policy": Schema.optionalKey( + Schema.Union([ + Schema.Struct({ "type": Schema.Literal("always_allow") }).annotate({ + "description": "Permission policy for tool execution." + }), + Schema.Struct({ "type": Schema.Literal("always_ask") }).annotate({ + "description": "Permission policy for tool execution." + }) + ], { mode: "oneOf" }).annotate({ "description": "Default permission policy for tools from this server." }) ) - }).annotate({ - "title": "OutputConfig", - "description": "Configuration options for the model's output, such as the output format." - }) + }).annotate({ "description": "Default configuration for all tools from an MCP server." }) ), - "output_format": Schema.optionalKey( - Schema.Union([BetaJsonOutputFormat, Schema.Null]).annotate({ - "description": - "Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)\n\nA schema to specify Claude's output format in responses. This parameter will be removed in a future release." + "configs": Schema.optionalKey( + Schema.Array(BetaManagedAgentsMCPToolConfigParams).annotate({ + "description": "Per-tool configuration overrides." }) - ), - "service_tier": Schema.optionalKey( - Schema.Literals(["auto", "standard_only"]).annotate({ - "title": "Service Tier", + ) + }).annotate({ "description": "Union type for tool configurations in the tools array." }), + Schema.Struct({ + "type": Schema.Literal("custom"), + "name": Schema.String.annotate({ + "description": "Unique name for the tool. 1-128 characters; letters, digits, underscores, and hyphens." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(128)), + "description": Schema.String.annotate({ + "description": + "Description of what the tool does, shown to the agent to help it decide when to use the tool. 1-1024 characters." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(1024)), + "input_schema": Schema.Struct({ + "type": Schema.optionalKey( + Schema.Literal("object").annotate({ "description": "Must be 'object' for tool input schemas." }) + ), + "properties": Schema.optionalKey( + Schema.Record(Schema.String, Schema.Unknown).annotate({ + "description": "JSON Schema properties defining the tool's input parameters." + }) + ), + "required": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "List of required property names." }) + ) + }).annotate({ "description": "JSON Schema for custom tool input parameters." }) + }).annotate({ "description": "Union type for tool configurations in the tools array." }) +], { mode: "oneOf" }) +export type BetaManagedAgentsMultiagentCoordinatorParams = { + readonly "type": "coordinator" + readonly "agents": ReadonlyArray +} +export const BetaManagedAgentsMultiagentCoordinatorParams = Schema.Struct({ + "type": Schema.Literal("coordinator"), + "agents": Schema.Array(BetaManagedAgentsMultiagentRosterEntryParams).annotate({ + "description": + "Agents the coordinator may spawn as session threads. 1–20 entries. Each entry is an agent ID string, a versioned `{\"type\":\"agent\",\"id\",\"version\"}` reference, or `{\"type\":\"self\"}` to allow recursive self-invocation. Entries must reference distinct agents (after resolving `self` and string forms); at most one `self`. Referenced agents must exist, must not be archived, and must not themselves have `multiagent` set (depth limit 1)." + }) +}).annotate({ + "description": + "A coordinator topology: the session's primary thread orchestrates work by spawning session threads, each running an agent drawn from the `agents` roster." +}) +export type BetaManagedAgentsAgentTool = { + readonly "type": "agent_toolset_20260401" + readonly "default_config": BetaManagedAgentsAgentToolsetDefaultConfig + readonly "configs": ReadonlyArray +} | { + readonly "type": "mcp_toolset" + readonly "mcp_server_name": string + readonly "default_config": BetaManagedAgentsMCPToolsetDefaultConfig + readonly "configs": ReadonlyArray +} | { + readonly "type": "custom" + readonly "name": string + readonly "description": string + readonly "input_schema": BetaManagedAgentsCustomToolInputSchema +} +export const BetaManagedAgentsAgentTool = Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("agent_toolset_20260401"), + "default_config": BetaManagedAgentsAgentToolsetDefaultConfig, + "configs": Schema.Array(BetaManagedAgentsAgentToolConfig) + }).annotate({ "description": "Union type for tool configurations returned in API responses." }), + Schema.Struct({ + "type": Schema.Literal("mcp_toolset"), + "mcp_server_name": Schema.String, + "default_config": BetaManagedAgentsMCPToolsetDefaultConfig, + "configs": Schema.Array(BetaManagedAgentsMCPToolConfig) + }).annotate({ "description": "Union type for tool configurations returned in API responses." }), + Schema.Struct({ + "type": Schema.Literal("custom"), + "name": Schema.String, + "description": Schema.String, + "input_schema": BetaManagedAgentsCustomToolInputSchema + }).annotate({ "description": "Union type for tool configurations returned in API responses." }) +], { mode: "oneOf" }) +export type BetaManagedAgentsEventParams = + | { readonly "type": "user.message"; readonly "content": ReadonlyArray } + | { readonly "type": "user.interrupt"; readonly "session_thread_id"?: string } + | { + readonly "type": "user.tool_confirmation" + readonly "tool_use_id": string + readonly "result": "allow" | "deny" + readonly "deny_message"?: string + } + | { + readonly "type": "user.custom_tool_result" + readonly "custom_tool_use_id": string + readonly "content"?: ReadonlyArray + readonly "is_error"?: boolean + } + | { + readonly "type": "user.define_outcome" + readonly "description": string + readonly "rubric": BetaManagedAgentsFileRubricParams | BetaManagedAgentsTextRubricParams + readonly "max_iterations"?: number + } + | { + readonly "type": "user.tool_result" + readonly "tool_use_id": string + readonly "content"?: ReadonlyArray + readonly "is_error"?: boolean + } +export const BetaManagedAgentsEventParams = Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("user.message"), + "content": Schema.Array(BetaManagedAgentsUserContentBlock).annotate({ + "description": "Array of content blocks for the user message." + }) + }).annotate({ "description": "Union type for event parameters that can be sent to a session." }), + Schema.Struct({ + "type": Schema.Literal("user.interrupt"), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ "description": - "Determines whether to use priority capacity (if available) or standard capacity for this request.\n\nAnthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details." + "If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread." }) - ), - "speed": Schema.optionalKey( - Schema.Union([BetaSpeed, Schema.Null]).annotate({ - "description": - "The inference speed mode for this request. `\"fast\"` enables high output-tokens-per-second inference." + ) + }).annotate({ "description": "Union type for event parameters that can be sent to a session." }), + Schema.Struct({ + "type": Schema.Literal("user.tool_confirmation"), + "tool_use_id": Schema.String.annotate({ + "description": + "The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(128)), + "result": Schema.Literals(["allow", "deny"]).annotate({ "description": "UserToolConfirmationResult enum" }), + "deny_message": Schema.optionalKey( + Schema.String.annotate({ + "description": "Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'." + }).check(Schema.isMaxLength(10000)) + ) + }).annotate({ "description": "Union type for event parameters that can be sent to a session." }), + Schema.Struct({ + "type": Schema.Literal("user.custom_tool_result"), + "custom_tool_use_id": Schema.String.annotate({ + "description": + "The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(128)), + "content": Schema.optionalKey( + Schema.Array(BetaManagedAgentsToolResultContentBlock).annotate({ + "description": "The result content returned by the tool." }) ), - "stop_sequences": Schema.optionalKey( - Schema.Array(Schema.String).annotate({ - "title": "Stop Sequences", - "description": - "Custom text sequences that will cause the model to stop generating.\n\nOur models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `\"end_turn\"`.\n\nIf you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `\"stop_sequence\"` and the response `stop_sequence` value will contain the matched stop sequence." + "is_error": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether the tool execution resulted in an error." }) + ) + }).annotate({ "description": "Union type for event parameters that can be sent to a session." }), + Schema.Struct({ + "type": Schema.Literal("user.define_outcome"), + "description": Schema.String.annotate({ + "description": "What the agent should produce. This is the task specification." + }), + "rubric": Schema.Union([BetaManagedAgentsFileRubricParams, BetaManagedAgentsTextRubricParams], { mode: "oneOf" }) + .annotate({ "description": "Rubric for grading the quality of an outcome." }), + "max_iterations": Schema.optionalKey( + Schema.Number.annotate({ + "description": "Eval→revision cycles before giving up. Default 3, max 20.", + "format": "int32" + }).check(Schema.isInt()) + ) + }).annotate({ "description": "Union type for event parameters that can be sent to a session." }), + Schema.Struct({ + "type": Schema.Literal("user.tool_result"), + "tool_use_id": Schema.String.annotate({ + "description": + "The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(128)), + "content": Schema.optionalKey( + Schema.Array(BetaManagedAgentsToolResultContentBlock).annotate({ + "description": "The result content returned by the tool." }) ), - "stream": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Stream", + "is_error": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether the tool execution resulted in an error." }) + ) + }).annotate({ "description": "Union type for event parameters that can be sent to a session." }) +], { mode: "oneOf" }) +export type BetaManagedAgentsInputEvent = { + readonly "type": "user.message" + readonly "id": string + readonly "content": ReadonlyArray + readonly "processed_at"?: string +} | { + readonly "type": "user.interrupt" + readonly "id": string + readonly "processed_at"?: string + readonly "session_thread_id"?: string +} | { + readonly "type": "user.tool_confirmation" + readonly "id": string + readonly "tool_use_id": string + readonly "result": "allow" | "deny" + readonly "deny_message"?: string + readonly "processed_at"?: string + readonly "session_thread_id"?: string +} | { + readonly "type": "user.custom_tool_result" + readonly "id": string + readonly "custom_tool_use_id": string + readonly "content"?: ReadonlyArray + readonly "is_error"?: boolean + readonly "processed_at"?: string + readonly "session_thread_id"?: string +} | { + readonly "type": "user.define_outcome" + readonly "id": string + readonly "processed_at": string + readonly "outcome_id": string + readonly "description": string + readonly "max_iterations": number + readonly "rubric": BetaManagedAgentsFileRubric | BetaManagedAgentsTextRubric +} | { + readonly "type": "user.tool_result" + readonly "id": string + readonly "tool_use_id": string + readonly "content"?: ReadonlyArray + readonly "is_error"?: boolean + readonly "processed_at"?: string + readonly "session_thread_id"?: string +} +export const BetaManagedAgentsInputEvent = Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("user.message"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "content": Schema.Array(BetaManagedAgentsUserContentBlock).annotate({ + "description": "Array of content blocks comprising the user message." + }), + "processed_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ) + }).annotate({ "description": "Union type for events that can be sent to a session." }), + Schema.Struct({ + "type": Schema.Literal("user.interrupt"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ "description": - "Whether to incrementally stream the response using server-sent events.\n\nSee [streaming](https://docs.claude.com/en/api/messages-streaming) for details." + "If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread." }) + ) + }).annotate({ "description": "Union type for events that can be sent to a session." }), + Schema.Struct({ + "type": Schema.Literal("user.tool_confirmation"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "tool_use_id": Schema.String.annotate({ + "description": + "The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field." + }), + "result": Schema.Literals(["allow", "deny"]).annotate({ "description": "UserToolConfirmationResult enum" }), + "deny_message": Schema.optionalKey( + Schema.String.annotate({ + "description": "Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'." + }).check(Schema.isMaxLength(10000)) ), - "system": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Array(BetaRequestTextBlock)]).annotate({ - "title": "System", + "processed_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ "description": - "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts)." + "When set, the confirmation routes to this subagent's thread rather than the primary. Echo this from the `session_thread_id` on the `agent.tool_use` or `agent.mcp_tool_use` event that prompted the approval." + }) + ) + }).annotate({ "description": "Union type for events that can be sent to a session." }), + Schema.Struct({ + "type": Schema.Literal("user.custom_tool_result"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "custom_tool_use_id": Schema.String.annotate({ + "description": + "The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field." + }), + "content": Schema.optionalKey( + Schema.Array(BetaManagedAgentsToolResultContentBlock).annotate({ + "description": "The result content returned by the tool." }) ), - "temperature": Schema.optionalKey( - Schema.Number.annotate({ - "title": "Temperature", - "description": - "Amount of randomness injected into the response.\n\nDefaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.\n\nNote that even with `temperature` of `0.0`, the results will not be fully deterministic." - }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)) + "is_error": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether the tool execution resulted in an error." }) ), - "thinking": Schema.optionalKey(BetaThinkingConfigParam), - "tool_choice": Schema.optionalKey(BetaToolChoice), - "tools": Schema.optionalKey( - Schema.Array( - Schema.Union([ - BetaTool, - BetaBashTool_20241022, - BetaBashTool_20250124, - BetaCodeExecutionTool_20250522, - BetaCodeExecutionTool_20250825, - BetaCodeExecutionTool_20260120, - BetaComputerUseTool_20241022, - BetaMemoryTool_20250818, - BetaComputerUseTool_20250124, - BetaTextEditor_20241022, - BetaComputerUseTool_20251124, - BetaTextEditor_20250124, - BetaTextEditor_20250429, - BetaTextEditor_20250728, - BetaWebSearchTool_20250305, - BetaWebFetchTool_20250910, - BetaWebSearchTool_20260209, - BetaWebFetchTool_20260209, - BetaToolSearchToolBM25_20251119, - BetaToolSearchToolRegex_20251119, - BetaMCPToolset - ], { mode: "oneOf" }) - ).annotate({ - "title": "Tools", + "processed_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ "description": - "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.\n\nThere are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview\\#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).\n\nEach tool definition includes:\n\n* `name`: Name of the tool.\n* `description`: Optional, but strongly-recommended description of the tool.\n* `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce `tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an input, and return the following back to the model in a subsequent `user` message:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.\n\nSee our [guide](https://docs.claude.com/en/docs/tool-use) for more details." + "Routes this result to a subagent thread. Copy from the `agent.custom_tool_use` event's `session_thread_id`." + }) + ) + }).annotate({ "description": "Union type for events that can be sent to a session." }), + Schema.Struct({ + "type": Schema.Literal("user.define_outcome"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "outcome_id": Schema.String.annotate({ + "description": + "Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list." + }), + "description": Schema.String.annotate({ + "description": "What the agent should produce. Copied from the input event." + }), + "max_iterations": Schema.Number.annotate({ + "description": "Evaluate-then-revise cycles before giving up. Default 3, max 20.", + "format": "int32" + }).check(Schema.isInt()), + "rubric": Schema.Union([BetaManagedAgentsFileRubric, BetaManagedAgentsTextRubric], { mode: "oneOf" }).annotate({ + "description": "Rubric for grading the quality of an outcome." + }) + }).annotate({ "description": "Union type for events that can be sent to a session." }), + Schema.Struct({ + "type": Schema.Literal("user.tool_result"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "tool_use_id": Schema.String.annotate({ + "description": + "The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field." + }), + "content": Schema.optionalKey( + Schema.Array(BetaManagedAgentsToolResultContentBlock).annotate({ + "description": "The result content returned by the tool." }) ), - "top_k": Schema.optionalKey( - Schema.Number.annotate({ - "title": "Top K", - "description": - "Only sample from the top K options for each subsequent token.\n\nUsed to remove \"long tail\" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).\n\nRecommended for advanced use cases only. You usually only need to use `temperature`." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)) + "is_error": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether the tool execution resulted in an error." }) ), - "top_p": Schema.optionalKey( - Schema.Number.annotate({ - "title": "Top P", + "processed_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ "description": - "Use nucleus sampling.\n\nIn nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.\n\nRecommended for advanced use cases only. You usually only need to use `temperature`." - }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)) + "Routes this result to a subagent thread. Copy from the `agent.tool_use` event's `session_thread_id`." + }) ) - }).annotate({ - "title": "CreateMessageParams", - "description": - "Messages API creation parameters for the individual request.\n\nSee the [Messages API reference](https://docs.claude.com/en/api/messages) for full documentation on available parameters." - }) -}).annotate({ "title": "MessageBatchIndividualRequestParams" }) -export type CountMessageTokensParams = { - readonly "cache_control"?: CacheControlEphemeral | null - readonly "messages": ReadonlyArray - readonly "model": Model - readonly "output_config"?: { readonly "effort"?: EffortLevel | null; readonly "format"?: JsonOutputFormat | null } - readonly "system"?: string | ReadonlyArray - readonly "thinking"?: ThinkingConfigParam - readonly "tool_choice"?: ToolChoice - readonly "tools"?: ReadonlyArray< - | Tool - | BashTool_20250124 - | CodeExecutionTool_20250522 - | CodeExecutionTool_20250825 - | CodeExecutionTool_20260120 - | MemoryTool_20250818 - | TextEditor_20250124 - | TextEditor_20250429 - | TextEditor_20250728 - | WebSearchTool_20250305 - | WebFetchTool_20250910 - | WebSearchTool_20260209 - | WebFetchTool_20260209 - | ToolSearchToolBM25_20251119 - | ToolSearchToolRegex_20251119 - > + }).annotate({ "description": "Union type for events that can be sent to a session." }) +], { mode: "oneOf" }) +export type BetaErroredResult = { readonly "error": BetaErrorResponse; readonly "type": "errored" } +export const BetaErroredResult = Schema.Struct({ + "error": BetaErrorResponse, + "type": Schema.Literal("errored").annotate({ "title": "Type", "default": "errored" }) +}).annotate({ "title": "ErroredResult" }) +export type BetaRequestBashCodeExecutionToolResultBlock = { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "content": BetaRequestBashCodeExecutionToolResultError | BetaRequestBashCodeExecutionResultBlock + readonly "tool_use_id": string + readonly "type": "bash_code_execution_tool_result" } -export const CountMessageTokensParams = Schema.Struct({ +export const BetaRequestBashCodeExecutionToolResultBlock = Schema.Struct({ "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ "title": "Cache Control", - "description": - "Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request." + "description": "Create a cache control breakpoint at this content block." }) ), - "messages": Schema.Array(InputMessage).annotate({ - "title": "Messages", - "description": - "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:\n\n```json\n[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"Hello there.\"},\n {\"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\"},\n {\"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\"},\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"},\n]\n```\n\nEach input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `\"text\"`. The following input messages are equivalent:\n\n```json\n{\"role\": \"user\", \"content\": \"Hello, Claude\"}\n```\n\n```json\n{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Hello, Claude\"}]}\n```\n\nSee [input examples](https://docs.claude.com/en/api/messages-examples).\n\nNote that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `\"system\"` role for input messages in the Messages API.\n\nThere is a limit of 100,000 messages in a single request." - }), - "model": Model, - "output_config": Schema.optionalKey( - Schema.Struct({ - "effort": Schema.optionalKey( - Schema.Union([EffortLevel, Schema.Null]).annotate({ - "description": - "How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer.\n\nValid values are `low`, `medium`, `high`, or `max`." - }) - ), - "format": Schema.optionalKey( - Schema.Union([JsonOutputFormat, Schema.Null]).annotate({ - "description": - "A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)" - }) - ) - }).annotate({ - "title": "OutputConfig", - "description": "Configuration options for the model's output, such as the output format." - }) + "content": Schema.Union([BetaRequestBashCodeExecutionToolResultError, BetaRequestBashCodeExecutionResultBlock]) + .annotate({ "title": "Content" }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) ), - "system": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Array(RequestTextBlock)]).annotate({ - "title": "System", - "description": - "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts)." + "type": Schema.Literal("bash_code_execution_tool_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestBashCodeExecutionToolResultBlock" }) +export type BetaRequestCodeExecutionToolResultBlock = { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "content": + | BetaRequestCodeExecutionToolResultError + | BetaRequestCodeExecutionResultBlock + | BetaRequestEncryptedCodeExecutionResultBlock + readonly "tool_use_id": string + readonly "type": "code_execution_tool_result" +} +export const BetaRequestCodeExecutionToolResultBlock = Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." }) ), - "thinking": Schema.optionalKey(ThinkingConfigParam), - "tool_choice": Schema.optionalKey(ToolChoice), - "tools": Schema.optionalKey( - Schema.Array( - Schema.Union([ - Tool, - BashTool_20250124, - CodeExecutionTool_20250522, - CodeExecutionTool_20250825, - CodeExecutionTool_20260120, - MemoryTool_20250818, - TextEditor_20250124, - TextEditor_20250429, - TextEditor_20250728, - WebSearchTool_20250305, - WebFetchTool_20250910, - WebSearchTool_20260209, - WebFetchTool_20260209, - ToolSearchToolBM25_20251119, - ToolSearchToolRegex_20251119 - ], { mode: "oneOf" }) - ).annotate({ - "title": "Tools", - "description": - "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.\n\nThere are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview\\#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).\n\nEach tool definition includes:\n\n* `name`: Name of the tool.\n* `description`: Optional, but strongly-recommended description of the tool.\n* `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce `tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an input, and return the following back to the model in a subsequent `user` message:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.\n\nSee our [guide](https://docs.claude.com/en/docs/tool-use) for more details." + "content": Schema.Union([ + BetaRequestCodeExecutionToolResultError, + BetaRequestCodeExecutionResultBlock, + BetaRequestEncryptedCodeExecutionResultBlock + ]).annotate({ "title": "Content" }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + ), + "type": Schema.Literal("code_execution_tool_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestCodeExecutionToolResultBlock" }) +export type BetaRequestSearchResultBlock = { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "citations"?: BetaRequestCitationsConfig + readonly "content": ReadonlyArray + readonly "source": string + readonly "title": string + readonly "type": "search_result" +} +export const BetaRequestSearchResultBlock = Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." }) - ) -}).annotate({ "title": "CountMessageTokensParams" }) -export type CreateMessageParams = { - readonly "model": Model - readonly "messages": ReadonlyArray - readonly "cache_control"?: CacheControlEphemeral | null - readonly "container"?: string | null - readonly "inference_geo"?: string | null - readonly "max_tokens": number - readonly "metadata"?: { readonly "user_id"?: string | null } - readonly "output_config"?: { readonly "effort"?: EffortLevel | null; readonly "format"?: JsonOutputFormat | null } - readonly "service_tier"?: "auto" | "standard_only" - readonly "stop_sequences"?: ReadonlyArray - readonly "stream"?: boolean - readonly "system"?: string | ReadonlyArray - readonly "temperature"?: number - readonly "thinking"?: ThinkingConfigParam - readonly "tool_choice"?: ToolChoice - readonly "tools"?: ReadonlyArray< - | Tool - | BashTool_20250124 - | CodeExecutionTool_20250522 - | CodeExecutionTool_20250825 - | CodeExecutionTool_20260120 - | MemoryTool_20250818 - | TextEditor_20250124 - | TextEditor_20250429 - | TextEditor_20250728 - | WebSearchTool_20250305 - | WebFetchTool_20250910 - | WebSearchTool_20260209 - | WebFetchTool_20260209 - | ToolSearchToolBM25_20251119 - | ToolSearchToolRegex_20251119 - > - readonly "top_k"?: number - readonly "top_p"?: number + ), + "citations": Schema.optionalKey(BetaRequestCitationsConfig), + "content": Schema.Array(BetaRequestTextBlock).annotate({ "title": "Content" }), + "source": Schema.String.annotate({ "title": "Source" }), + "title": Schema.String.annotate({ "title": "Title" }), + "type": Schema.Literal("search_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestSearchResultBlock" }) +export type BetaResponseBashCodeExecutionToolResultBlock = { + readonly "content": BetaResponseBashCodeExecutionToolResultError | BetaResponseBashCodeExecutionResultBlock + readonly "tool_use_id": string + readonly "type": "bash_code_execution_tool_result" } -export const CreateMessageParams = Schema.Struct({ - "model": Model, - "messages": Schema.Array(InputMessage).annotate({ - "title": "Messages", - "description": - "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:\n\n```json\n[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"Hello there.\"},\n {\"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\"},\n {\"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\"},\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"},\n]\n```\n\nEach input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `\"text\"`. The following input messages are equivalent:\n\n```json\n{\"role\": \"user\", \"content\": \"Hello, Claude\"}\n```\n\n```json\n{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Hello, Claude\"}]}\n```\n\nSee [input examples](https://docs.claude.com/en/api/messages-examples).\n\nNote that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `\"system\"` role for input messages in the Messages API.\n\nThere is a limit of 100,000 messages in a single request." +export const BetaResponseBashCodeExecutionToolResultBlock = Schema.Struct({ + "content": Schema.Union([BetaResponseBashCodeExecutionToolResultError, BetaResponseBashCodeExecutionResultBlock]) + .annotate({ "title": "Content" }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + ), + "type": Schema.Literal("bash_code_execution_tool_result").annotate({ + "title": "Type", + "default": "bash_code_execution_tool_result" + }) +}).annotate({ "title": "ResponseBashCodeExecutionToolResultBlock" }) +export type BetaResponseWebFetchResultBlock = { + readonly "content": BetaResponseDocumentBlock + readonly "retrieved_at": string | null + readonly "type": "web_fetch_result" + readonly "url": string +} +export const BetaResponseWebFetchResultBlock = Schema.Struct({ + "content": BetaResponseDocumentBlock, + "retrieved_at": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Retrieved At", + "description": "ISO 8601 timestamp when the content was retrieved", + "default": null }), - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": - "Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request." - }) + "type": Schema.Literal("web_fetch_result").annotate({ "title": "Type", "default": "web_fetch_result" }), + "url": Schema.String.annotate({ "title": "Url", "description": "Fetched content URL" }) +}).annotate({ "title": "ResponseWebFetchResultBlock" }) +export type BetaResponseCodeExecutionToolResultBlock = { + readonly "content": + | BetaResponseCodeExecutionToolResultError + | BetaResponseCodeExecutionResultBlock + | BetaResponseEncryptedCodeExecutionResultBlock + readonly "tool_use_id": string + readonly "type": "code_execution_tool_result" +} +export const BetaResponseCodeExecutionToolResultBlock = Schema.Struct({ + "content": Schema.Union([ + BetaResponseCodeExecutionToolResultError, + BetaResponseCodeExecutionResultBlock, + BetaResponseEncryptedCodeExecutionResultBlock + ]).annotate({ "title": "Content" }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) ), + "type": Schema.Literal("code_execution_tool_result").annotate({ + "title": "Type", + "default": "code_execution_tool_result" + }) +}).annotate({ "title": "ResponseCodeExecutionToolResultBlock" }) +export type BetaContentBlockDeltaEvent = { + readonly "delta": + | BetaTextContentBlockDelta + | BetaInputJsonContentBlockDelta + | BetaCitationsDelta + | BetaThinkingContentBlockDelta + | BetaSignatureContentBlockDelta + | BetaCompactionContentBlockDelta + readonly "index": number + readonly "type": "content_block_delta" +} +export const BetaContentBlockDeltaEvent = Schema.Struct({ + "delta": Schema.Union([ + BetaTextContentBlockDelta, + BetaInputJsonContentBlockDelta, + BetaCitationsDelta, + BetaThinkingContentBlockDelta, + BetaSignatureContentBlockDelta, + BetaCompactionContentBlockDelta + ], { mode: "oneOf" }).annotate({ "title": "Delta" }), + "index": Schema.Number.annotate({ "title": "Index" }).check(Schema.isInt()), + "type": Schema.Literal("content_block_delta").annotate({ "title": "Type", "default": "content_block_delta" }) +}).annotate({ "title": "ContentBlockDeltaEvent" }) +export type BetaMessageDelta = { + readonly "container"?: BetaContainer | null + readonly "stop_details": BetaRefusalStopDetails | null + readonly "stop_reason": BetaStopReason | null + readonly "stop_sequence": string | null +} +export const BetaMessageDelta = Schema.Struct({ "container": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Container", - "description": "Container identifier for reuse across requests." - }) - ), - "inference_geo": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Inference Geo", + Schema.Union([BetaContainer, Schema.Null]).annotate({ "description": - "Specifies the geographic region for inference processing. If not specified, the workspace's `default_inference_geo` is used." + "Information about the container used in this request.\n\nThis will be non-null if a container tool (e.g. code execution) was used.", + "default": null }) ), - "max_tokens": Schema.Number.annotate({ - "title": "Max Tokens", + "stop_details": Schema.Union([BetaRefusalStopDetails, Schema.Null]).annotate({ "description": - "The maximum number of tokens to generate before stopping.\n\nNote that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.\n\nDifferent models have different maximum values for this parameter. See [models](https://docs.claude.com/en/docs/models-overview) for details." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), - "metadata": Schema.optionalKey( - Schema.Struct({ - "user_id": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMaxLength(256)), Schema.Null]).annotate({ - "title": "User Id", - "description": - "An external identifier for the user who is associated with the request.\n\nThis should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number." - }) - ) - }).annotate({ "title": "Metadata", "description": "An object describing metadata about the request." }) - ), - "output_config": Schema.optionalKey( - Schema.Struct({ - "effort": Schema.optionalKey( - Schema.Union([EffortLevel, Schema.Null]).annotate({ - "description": - "How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer.\n\nValid values are `low`, `medium`, `high`, or `max`." - }) - ), - "format": Schema.optionalKey( - Schema.Union([JsonOutputFormat, Schema.Null]).annotate({ - "description": - "A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)" - }) - ) - }).annotate({ - "title": "OutputConfig", - "description": "Configuration options for the model's output, such as the output format." - }) - ), - "service_tier": Schema.optionalKey( - Schema.Literals(["auto", "standard_only"]).annotate({ - "title": "Service Tier", - "description": - "Determines whether to use priority capacity (if available) or standard capacity for this request.\n\nAnthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details." - }) - ), - "stop_sequences": Schema.optionalKey( - Schema.Array(Schema.String).annotate({ - "title": "Stop Sequences", - "description": - "Custom text sequences that will cause the model to stop generating.\n\nOur models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `\"end_turn\"`.\n\nIf you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `\"stop_sequence\"` and the response `stop_sequence` value will contain the matched stop sequence." - }) - ), - "stream": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Stream", - "description": - "Whether to incrementally stream the response using server-sent events.\n\nSee [streaming](https://docs.claude.com/en/api/messages-streaming) for details." + "Structured information about why model output stopped.\n\nThis is `null` when the `stop_reason` has no additional detail to report.", + "default": null + }), + "stop_reason": Schema.Union([BetaStopReason, Schema.Null]).annotate({ "title": "Stop Reason", "default": null }), + "stop_sequence": Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Stop Sequence", "default": null }) +}).annotate({ "title": "MessageDelta" }) +export type BetaRequestTextEditorCodeExecutionToolResultBlock = { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "content": + | BetaRequestTextEditorCodeExecutionToolResultError + | BetaRequestTextEditorCodeExecutionViewResultBlock + | BetaRequestTextEditorCodeExecutionCreateResultBlock + | BetaRequestTextEditorCodeExecutionStrReplaceResultBlock + readonly "tool_use_id": string + readonly "type": "text_editor_code_execution_tool_result" +} +export const BetaRequestTextEditorCodeExecutionToolResultBlock = Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." }) ), - "system": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Array(RequestTextBlock)]).annotate({ - "title": "System", - "description": - "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts)." - }) + "content": Schema.Union([ + BetaRequestTextEditorCodeExecutionToolResultError, + BetaRequestTextEditorCodeExecutionViewResultBlock, + BetaRequestTextEditorCodeExecutionCreateResultBlock, + BetaRequestTextEditorCodeExecutionStrReplaceResultBlock + ]).annotate({ "title": "Content" }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) ), - "temperature": Schema.optionalKey( - Schema.Number.annotate({ - "title": "Temperature", - "description": - "Amount of randomness injected into the response.\n\nDefaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.\n\nNote that even with `temperature` of `0.0`, the results will not be fully deterministic." - }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)) + "type": Schema.Literal("text_editor_code_execution_tool_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestTextEditorCodeExecutionToolResultBlock" }) +export type BetaResponseTextEditorCodeExecutionToolResultBlock = { + readonly "content": + | BetaResponseTextEditorCodeExecutionToolResultError + | BetaResponseTextEditorCodeExecutionViewResultBlock + | BetaResponseTextEditorCodeExecutionCreateResultBlock + | BetaResponseTextEditorCodeExecutionStrReplaceResultBlock + readonly "tool_use_id": string + readonly "type": "text_editor_code_execution_tool_result" +} +export const BetaResponseTextEditorCodeExecutionToolResultBlock = Schema.Struct({ + "content": Schema.Union([ + BetaResponseTextEditorCodeExecutionToolResultError, + BetaResponseTextEditorCodeExecutionViewResultBlock, + BetaResponseTextEditorCodeExecutionCreateResultBlock, + BetaResponseTextEditorCodeExecutionStrReplaceResultBlock + ]).annotate({ "title": "Content" }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) ), - "thinking": Schema.optionalKey(ThinkingConfigParam), - "tool_choice": Schema.optionalKey(ToolChoice), - "tools": Schema.optionalKey( - Schema.Array( - Schema.Union([ - Tool, - BashTool_20250124, - CodeExecutionTool_20250522, - CodeExecutionTool_20250825, - CodeExecutionTool_20260120, - MemoryTool_20250818, - TextEditor_20250124, - TextEditor_20250429, - TextEditor_20250728, - WebSearchTool_20250305, - WebFetchTool_20250910, - WebSearchTool_20260209, - WebFetchTool_20260209, - ToolSearchToolBM25_20251119, - ToolSearchToolRegex_20251119 - ], { mode: "oneOf" }) - ).annotate({ - "title": "Tools", + "type": Schema.Literal("text_editor_code_execution_tool_result").annotate({ + "title": "Type", + "default": "text_editor_code_execution_tool_result" + }) +}).annotate({ "title": "ResponseTextEditorCodeExecutionToolResultBlock" }) +export type BetaThinkingConfigParam = + | BetaThinkingConfigEnabled + | BetaThinkingConfigDisabled + | BetaThinkingConfigAdaptive +export const BetaThinkingConfigParam = Schema.Union([ + BetaThinkingConfigEnabled, + BetaThinkingConfigDisabled, + BetaThinkingConfigAdaptive +], { mode: "oneOf" }).annotate({ + "title": "Thinking", + "description": + "Configuration for enabling Claude's extended thinking.\n\nWhen enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit.\n\nSee [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details." +}) +export type BetaModelInfo = { + readonly "capabilities": BetaModelCapabilities | null + readonly "created_at": string + readonly "display_name": string + readonly "id": string + readonly "max_input_tokens": number | null + readonly "max_tokens": number | null + readonly "type": "model" +} +export const BetaModelInfo = Schema.Struct({ + "capabilities": Schema.Union([BetaModelCapabilities, Schema.Null]).annotate({ + "description": + "Object mapping capability names to their support details. Keys are always present for all known capabilities." + }), + "created_at": Schema.String.annotate({ + "title": "Created At", + "description": + "RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown.", + "format": "date-time" + }), + "display_name": Schema.String.annotate({ + "title": "Display Name", + "description": "A human-readable name for the model." + }), + "id": Schema.String.annotate({ "title": "Id", "description": "Unique model identifier." }), + "max_input_tokens": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "Max Input Tokens", + "description": "Maximum input context window size in tokens for this model." + }), + "max_tokens": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "Max Tokens", + "description": "Maximum value for the `max_tokens` parameter when using this model." + }), + "type": Schema.Literal("model").annotate({ + "title": "Type", + "description": "Object type.\n\nFor Models, this is always `\"model\"`.", + "default": "model" + }) +}).annotate({ "title": "ModelInfo" }) +export type BetaManagedAgentsListCredentialsResponse = { + readonly "data"?: ReadonlyArray + readonly "next_page"?: string +} +export const BetaManagedAgentsListCredentialsResponse = Schema.Struct({ + "data": Schema.optionalKey( + Schema.Array(BetaManagedAgentsCredential).annotate({ "description": "List of credentials." }) + ), + "next_page": Schema.optionalKey( + Schema.String.annotate({ "description": "Pagination token for the next page, or null if no more results." }) + ) +}).annotate({ "description": "Response containing a paginated list of credentials." }) +export type BetaManagedAgentsListSessionResources = { + readonly "data": ReadonlyArray + readonly "next_page"?: string +} +export const BetaManagedAgentsListSessionResources = Schema.Struct({ + "data": Schema.Array(BetaManagedAgentsSessionResource).annotate({ + "description": "Resources for the session, ordered by `created_at`." + }), + "next_page": Schema.optionalKey( + Schema.String.annotate({ "description": "Opaque cursor for the next page. Null when no more results." }) + ) +}).annotate({ "description": "Paginated list of resources attached to a session." }) +export type BetaManagedAgentsListVaultsResponse = { + readonly "data"?: ReadonlyArray + readonly "next_page"?: string +} +export const BetaManagedAgentsListVaultsResponse = Schema.Struct({ + "data": Schema.optionalKey(Schema.Array(BetaManagedAgentsVault).annotate({ "description": "List of vaults." })), + "next_page": Schema.optionalKey( + Schema.String.annotate({ "description": "Pagination token for the next page, or null if no more results." }) + ) +}).annotate({ "description": "Response containing a paginated list of vaults." }) +export type BetaResponseToolSearchToolResultBlock = { + readonly "content": BetaResponseToolSearchToolResultError | BetaResponseToolSearchToolSearchResultBlock + readonly "tool_use_id": string + readonly "type": "tool_search_tool_result" +} +export const BetaResponseToolSearchToolResultBlock = Schema.Struct({ + "content": Schema.Union([BetaResponseToolSearchToolResultError, BetaResponseToolSearchToolSearchResultBlock]) + .annotate({ "title": "Content" }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + ), + "type": Schema.Literal("tool_search_tool_result").annotate({ "title": "Type", "default": "tool_search_tool_result" }) +}).annotate({ "title": "ResponseToolSearchToolResultBlock" }) +export type BetaContextManagementConfig = { + readonly "edits"?: ReadonlyArray +} +export const BetaContextManagementConfig = Schema.Struct({ + "edits": Schema.optionalKey( + Schema.Array( + Schema.Union([BetaClearToolUses20250919, BetaClearThinking20251015, BetaCompact20260112], { mode: "oneOf" }) + ).annotate({ "title": "Edits", "description": "List of context management edits to apply" }).check( + Schema.isMinLength(0) + ) + ) +}).annotate({ "title": "ContextManagementConfig" }) +export type BetaContentBlockSource = { + readonly "content": string | ReadonlyArray + readonly "type": "content" +} +export const BetaContentBlockSource = Schema.Struct({ + "content": Schema.Union([ + Schema.String, + Schema.Array( + Schema.Union([BetaRequestTextBlock, BetaRequestImageBlock], { mode: "oneOf" }).annotate({ + "title": "beta_content_block_source_content_item" + }) + ).annotate({ "title": "beta_content_block_source_content" }) + ]).annotate({ "title": "Content" }), + "type": Schema.Literal("content").annotate({ "title": "Type" }) +}).annotate({ "title": "ContentBlockSource" }) +export type BetaEnvironment = { + readonly "archived_at": string | null + readonly "config": BetaCloudConfig | BetaSelfHostedConfig + readonly "created_at": string + readonly "description": string + readonly "id": string + readonly "metadata": { readonly [x: string]: string } + readonly "name": string + readonly "scope"?: "organization" | "account" + readonly "type": "environment" + readonly "updated_at": string +} +export const BetaEnvironment = Schema.Struct({ + "archived_at": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Archived At", + "description": "RFC 3339 timestamp when environment was archived, or null if not archived" + }), + "config": Schema.Union([BetaCloudConfig, BetaSelfHostedConfig], { mode: "oneOf" }).annotate({ + "title": "Config", + "description": "Environment configuration (either Anthropic Cloud or self-hosted)" + }), + "created_at": Schema.String.annotate({ + "title": "Created At", + "description": "RFC 3339 timestamp when environment was created" + }), + "description": Schema.String.annotate({ + "title": "Description", + "description": "User-provided description for the environment" + }), + "id": Schema.String.annotate({ "title": "Id", "description": "Environment identifier (e.g., 'env_...')" }), + "metadata": Schema.Record(Schema.String, Schema.String).annotate({ + "title": "Metadata", + "description": "User-provided metadata key-value pairs" + }), + "name": Schema.String.annotate({ "title": "Name", "description": "Human-readable name for the environment" }), + "scope": Schema.optionalKey( + Schema.Literals(["organization", "account"]).annotate({ + "title": "Scope", "description": - "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.\n\nThere are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview\\#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).\n\nEach tool definition includes:\n\n* `name`: Name of the tool.\n* `description`: Optional, but strongly-recommended description of the tool.\n* `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce `tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an input, and return the following back to the model in a subsequent `user` message:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.\n\nSee our [guide](https://docs.claude.com/en/docs/tool-use) for more details." + "The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account." }) ), - "top_k": Schema.optionalKey( - Schema.Number.annotate({ - "title": "Top K", - "description": - "Only sample from the top K options for each subsequent token.\n\nUsed to remove \"long tail\" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).\n\nRecommended for advanced use cases only. You usually only need to use `temperature`." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)) + "type": Schema.Literal("environment").annotate({ + "title": "Type", + "description": "The type of object (always 'environment')", + "default": "environment" + }), + "updated_at": Schema.String.annotate({ + "title": "Updated At", + "description": "RFC 3339 timestamp when environment was last updated" + }) +}).annotate({ + "title": "Environment", + "description": "Unified Environment resource for both cloud and self-hosted environments." +}) +export type BetaPublicEnvironmentCreateRequest = { + readonly "config"?: BetaCloudConfigParams | BetaSelfHostedConfigParams | null + readonly "description"?: string | null + readonly "metadata"?: { readonly [x: string]: string } + readonly "name": string + readonly "scope"?: "organization" | "account" | null +} +export const BetaPublicEnvironmentCreateRequest = Schema.Struct({ + "config": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCloudConfigParams, BetaSelfHostedConfigParams], { mode: "oneOf" }), Schema.Null]) + .annotate({ "title": "Config", "description": "Environment configuration" }) ), - "top_p": Schema.optionalKey( - Schema.Number.annotate({ - "title": "Top P", + "description": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMaxLength(1024)), Schema.Null]).annotate({ + "title": "Description", + "description": "Optional description of the environment" + }) + ), + "metadata": Schema.optionalKey( + Schema.Record(Schema.String, Schema.String).annotate({ + "title": "Metadata", + "description": "User-provided metadata key-value pairs" + }) + ), + "name": Schema.String.annotate({ "title": "Name", "description": "Human-readable name for the environment" }).check( + Schema.isMinLength(1) + ).check(Schema.isMaxLength(256)), + "scope": Schema.optionalKey( + Schema.Union([Schema.Literals(["organization", "account"]), Schema.Null]).annotate({ + "title": "Scope", "description": - "Use nucleus sampling.\n\nIn nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.\n\nRecommended for advanced use cases only. You usually only need to use `temperature`." - }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)) + "The visibility scope for this environment. 'organization' makes the environment visible to all accounts. 'account' restricts visibility to the owning account only. Only applicable for self-hosted environments. If not specified, defaults based on organization type." + }) ) -}).annotate({ "title": "CreateMessageParams" }) -export type MessageBatchIndividualRequestParams = { - readonly "custom_id": string - readonly "params": { - readonly "model": Model - readonly "messages": ReadonlyArray - readonly "cache_control"?: CacheControlEphemeral | null - readonly "container"?: string | null - readonly "inference_geo"?: string | null - readonly "max_tokens": number - readonly "metadata"?: { readonly "user_id"?: string | null } - readonly "output_config"?: { readonly "effort"?: EffortLevel | null; readonly "format"?: JsonOutputFormat | null } - readonly "service_tier"?: "auto" | "standard_only" - readonly "stop_sequences"?: ReadonlyArray - readonly "stream"?: boolean - readonly "system"?: string | ReadonlyArray - readonly "temperature"?: number - readonly "thinking"?: ThinkingConfigParam - readonly "tool_choice"?: ToolChoice - readonly "tools"?: ReadonlyArray< - | Tool - | BashTool_20250124 - | CodeExecutionTool_20250522 - | CodeExecutionTool_20250825 - | CodeExecutionTool_20260120 - | MemoryTool_20250818 - | TextEditor_20250124 - | TextEditor_20250429 - | TextEditor_20250728 - | WebSearchTool_20250305 - | WebFetchTool_20250910 - | WebSearchTool_20260209 - | WebFetchTool_20260209 - | ToolSearchToolBM25_20251119 - | ToolSearchToolRegex_20251119 - > - readonly "top_k"?: number - readonly "top_p"?: number - } +}).annotate({ + "title": "PublicEnvironmentCreateRequest", + "description": "Public API request to create a new environment (without org/account fields)." +}) +export type BetaPublicEnvironmentUpdateRequest = { + readonly "config"?: BetaCloudConfigParams | BetaSelfHostedConfigParams | null + readonly "description"?: string | null + readonly "metadata"?: { readonly [x: string]: string | null } + readonly "name"?: string | null + readonly "scope"?: "organization" | "account" | null } -export const MessageBatchIndividualRequestParams = Schema.Struct({ - "custom_id": Schema.String.annotate({ - "title": "Custom Id", - "description": - "Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order.\n\nMust be unique for each request within the Message Batch." - }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(64)).check( - Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]{1,64}$")) +export const BetaPublicEnvironmentUpdateRequest = Schema.Struct({ + "config": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCloudConfigParams, BetaSelfHostedConfigParams], { mode: "oneOf" }), Schema.Null]) + .annotate({ "title": "Config", "description": "Updated environment configuration" }) ), - "params": Schema.Struct({ - "model": Model, - "messages": Schema.Array(InputMessage).annotate({ - "title": "Messages", - "description": - "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:\n\n```json\n[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"Hello there.\"},\n {\"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\"},\n {\"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\"},\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"},\n]\n```\n\nEach input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `\"text\"`. The following input messages are equivalent:\n\n```json\n{\"role\": \"user\", \"content\": \"Hello, Claude\"}\n```\n\n```json\n{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Hello, Claude\"}]}\n```\n\nSee [input examples](https://docs.claude.com/en/api/messages-examples).\n\nNote that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `\"system\"` role for input messages in the Messages API.\n\nThere is a limit of 100,000 messages in a single request." - }), - "cache_control": Schema.optionalKey( - Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ - "title": "Cache Control", - "description": - "Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request." - }) - ), - "container": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Container", - "description": "Container identifier for reuse across requests." - }) - ), - "inference_geo": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Inference Geo", - "description": - "Specifies the geographic region for inference processing. If not specified, the workspace's `default_inference_geo` is used." - }) - ), - "max_tokens": Schema.Number.annotate({ - "title": "Max Tokens", + "description": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMaxLength(1024)), Schema.Null]).annotate({ + "title": "Description", + "description": "Updated description of the environment" + }) + ), + "metadata": Schema.optionalKey( + Schema.Record(Schema.String, Schema.Union([Schema.String, Schema.Null])).annotate({ + "title": "Metadata", + "description": "User-provided metadata key-value pairs. Set a value to null or empty string to delete the key." + }) + ), + "name": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(256)), Schema.Null]).annotate({ + "title": "Name", + "description": "Updated name for the environment" + }) + ), + "scope": Schema.optionalKey( + Schema.Union([Schema.Literals(["organization", "account"]), Schema.Null]).annotate({ + "title": "Scope", "description": - "The maximum number of tokens to generate before stopping.\n\nNote that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.\n\nDifferent models have different maximum values for this parameter. See [models](https://docs.claude.com/en/docs/models-overview) for details." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), - "metadata": Schema.optionalKey( - Schema.Struct({ - "user_id": Schema.optionalKey( - Schema.Union([Schema.String.check(Schema.isMaxLength(256)), Schema.Null]).annotate({ - "title": "User Id", - "description": - "An external identifier for the user who is associated with the request.\n\nThis should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number." - }) - ) - }).annotate({ "title": "Metadata", "description": "An object describing metadata about the request." }) - ), - "output_config": Schema.optionalKey( - Schema.Struct({ - "effort": Schema.optionalKey( - Schema.Union([EffortLevel, Schema.Null]).annotate({ - "description": - "How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer.\n\nValid values are `low`, `medium`, `high`, or `max`." - }) - ), - "format": Schema.optionalKey( - Schema.Union([JsonOutputFormat, Schema.Null]).annotate({ - "description": - "A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)" - }) - ) - }).annotate({ - "title": "OutputConfig", - "description": "Configuration options for the model's output, such as the output format." - }) - ), - "service_tier": Schema.optionalKey( - Schema.Literals(["auto", "standard_only"]).annotate({ - "title": "Service Tier", - "description": - "Determines whether to use priority capacity (if available) or standard capacity for this request.\n\nAnthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details." - }) - ), - "stop_sequences": Schema.optionalKey( - Schema.Array(Schema.String).annotate({ - "title": "Stop Sequences", - "description": - "Custom text sequences that will cause the model to stop generating.\n\nOur models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `\"end_turn\"`.\n\nIf you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `\"stop_sequence\"` and the response `stop_sequence` value will contain the matched stop sequence." - }) - ), - "stream": Schema.optionalKey( - Schema.Boolean.annotate({ - "title": "Stream", - "description": - "Whether to incrementally stream the response using server-sent events.\n\nSee [streaming](https://docs.claude.com/en/api/messages-streaming) for details." - }) - ), - "system": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Array(RequestTextBlock)]).annotate({ - "title": "System", - "description": - "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts)." - }) - ), - "temperature": Schema.optionalKey( - Schema.Number.annotate({ - "title": "Temperature", - "description": - "Amount of randomness injected into the response.\n\nDefaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.\n\nNote that even with `temperature` of `0.0`, the results will not be fully deterministic." - }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)) - ), - "thinking": Schema.optionalKey(ThinkingConfigParam), - "tool_choice": Schema.optionalKey(ToolChoice), - "tools": Schema.optionalKey( - Schema.Array( - Schema.Union([ - Tool, - BashTool_20250124, - CodeExecutionTool_20250522, - CodeExecutionTool_20250825, - CodeExecutionTool_20260120, - MemoryTool_20250818, - TextEditor_20250124, - TextEditor_20250429, - TextEditor_20250728, - WebSearchTool_20250305, - WebFetchTool_20250910, - WebSearchTool_20260209, - WebFetchTool_20260209, - ToolSearchToolBM25_20251119, - ToolSearchToolRegex_20251119 - ], { mode: "oneOf" }) - ).annotate({ - "title": "Tools", - "description": - "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.\n\nThere are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview\\#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).\n\nEach tool definition includes:\n\n* `name`: Name of the tool.\n* `description`: Optional, but strongly-recommended description of the tool.\n* `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce `tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an input, and return the following back to the model in a subsequent `user` message:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.\n\nSee our [guide](https://docs.claude.com/en/docs/tool-use) for more details." - }) - ), - "top_k": Schema.optionalKey( - Schema.Number.annotate({ - "title": "Top K", - "description": - "Only sample from the top K options for each subsequent token.\n\nUsed to remove \"long tail\" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).\n\nRecommended for advanced use cases only. You usually only need to use `temperature`." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)) - ), - "top_p": Schema.optionalKey( - Schema.Number.annotate({ - "title": "Top P", - "description": - "Use nucleus sampling.\n\nIn nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`. You should either alter `temperature` or `top_p`, but not both.\n\nRecommended for advanced use cases only. You usually only need to use `temperature`." - }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)) - ) - }).annotate({ - "title": "CreateMessageParams", - "description": - "Messages API creation parameters for the individual request.\n\nSee the [Messages API reference](https://docs.claude.com/en/api/messages) for full documentation on available parameters." - }) -}).annotate({ "title": "MessageBatchIndividualRequestParams" }) -export type BetaCreateMessageBatchParams = { - readonly "requests": ReadonlyArray -} -export const BetaCreateMessageBatchParams = Schema.Struct({ - "requests": Schema.Array(BetaMessageBatchIndividualRequestParams).annotate({ - "title": "Requests", - "description": "List of requests for prompt completion. Each is an individual request to create a Message." - }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(100000)) -}).annotate({ "title": "CreateMessageBatchParams" }) -export type CreateMessageBatchParams = { readonly "requests": ReadonlyArray } -export const CreateMessageBatchParams = Schema.Struct({ - "requests": Schema.Array(MessageBatchIndividualRequestParams).annotate({ - "title": "Requests", - "description": "List of requests for prompt completion. Each is an individual request to create a Message." - }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(100000)) -}).annotate({ "title": "CreateMessageBatchParams" }) -// schemas -export type MessagesPostParams = { readonly "anthropic-version"?: string } -export const MessagesPostParams = Schema.Struct({ - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + "The visibility scope for this environment. 'organization' makes the environment visible to all accounts. 'account' restricts visibility to the owning account only." }) ) +}).annotate({ + "title": "PublicEnvironmentUpdateRequest", + "description": "Public API request to update an environment (without org/account fields)." }) -export type MessagesPostRequestJson = CreateMessageParams -export const MessagesPostRequestJson = CreateMessageParams -export type MessagesPost200 = Message -export const MessagesPost200 = Message -export type MessagesPost4XX = ErrorResponse -export const MessagesPost4XX = ErrorResponse -export type CompletePostParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string } -export const CompletePostParams = Schema.Struct({ - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) - ), - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) - ) +export type BetaListUserProfilesResponse = { + readonly "data": ReadonlyArray + readonly "next_page": string +} +export const BetaListUserProfilesResponse = Schema.Struct({ + "data": Schema.Array(BetaUserProfile).annotate({ "description": "User profiles on this page." }), + "next_page": Schema.String.annotate({ + "description": "Cursor for the next page, or `null` when there are no more results." + }) }) -export type CompletePostRequestJson = CompletionRequest -export const CompletePostRequestJson = CompletionRequest -export type CompletePost200 = CompletionResponse -export const CompletePost200 = CompletionResponse -export type CompletePost4XX = ErrorResponse -export const CompletePost4XX = ErrorResponse -export type ModelsListParams = { - readonly "before_id"?: string - readonly "after_id"?: string - readonly "limit"?: number - readonly "anthropic-version"?: string - readonly "x-api-key"?: string - readonly "anthropic-beta"?: string +export type BetaRequestWebSearchToolResultBlock = { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120 + readonly "content": ReadonlyArray | BetaRequestWebSearchToolResultError + readonly "tool_use_id": string + readonly "type": "web_search_tool_result" } -export const ModelsListParams = Schema.Struct({ - "before_id": Schema.optionalKey( - Schema.String.annotate({ - "title": "Before Id", - "description": - "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object." +export const BetaRequestWebSearchToolResultBlock = Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." }) ), - "after_id": Schema.optionalKey( - Schema.String.annotate({ - "title": "After Id", - "description": - "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object." + "caller": Schema.optionalKey( + Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate({ + "title": "Caller" }) ), - "limit": Schema.optionalKey( - Schema.Number.annotate({ - "title": "Limit", - "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`.", - "default": 20 - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(1000)) + "content": Schema.Union([ + Schema.Array(BetaRequestWebSearchResultBlock).annotate({ "title": "Result Block" }), + BetaRequestWebSearchToolResultError + ]).annotate({ "title": "Content" }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + "type": Schema.Literal("web_search_tool_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestWebSearchToolResultBlock" }) +export type BetaResponseWebSearchToolResultBlock = { + readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120 + readonly "content": BetaResponseWebSearchToolResultError | ReadonlyArray + readonly "tool_use_id": string + readonly "type": "web_search_tool_result" +} +export const BetaResponseWebSearchToolResultBlock = Schema.Struct({ + "caller": Schema.optionalKey( + Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate({ + "title": "Caller" }) ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })), - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) - ) -}) -export type ModelsList200 = ListResponse_ModelInfo_ -export const ModelsList200 = ListResponse_ModelInfo_ -export type ModelsList4XX = ErrorResponse -export const ModelsList4XX = ErrorResponse -export type ModelsGetParams = { - readonly "anthropic-version"?: string - readonly "x-api-key"?: string - readonly "anthropic-beta"?: string + "content": Schema.Union([BetaResponseWebSearchToolResultError, Schema.Array(BetaResponseWebSearchResultBlock)]) + .annotate({ "title": "Content" }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + ), + "type": Schema.Literal("web_search_tool_result").annotate({ "title": "Type", "default": "web_search_tool_result" }) +}).annotate({ "title": "ResponseWebSearchToolResultBlock" }) +export type RequestToolSearchToolSearchResultBlock = { + readonly "tool_references": ReadonlyArray + readonly "type": "tool_search_tool_search_result" } -export const ModelsGetParams = Schema.Struct({ - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." +export const RequestToolSearchToolSearchResultBlock = Schema.Struct({ + "tool_references": Schema.Array(RequestToolReferenceBlock).annotate({ "title": "Tool References" }), + "type": Schema.Literal("tool_search_tool_search_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestToolSearchToolSearchResultBlock" }) +export type ErroredResult = { readonly "error": ErrorResponse; readonly "type": "errored" } +export const ErroredResult = Schema.Struct({ + "error": ErrorResponse, + "type": Schema.Literal("errored").annotate({ "title": "Type", "default": "errored" }) +}).annotate({ "title": "ErroredResult" }) +export type RequestBashCodeExecutionToolResultBlock = { + readonly "cache_control"?: CacheControlEphemeral | null + readonly "content": RequestBashCodeExecutionToolResultError | RequestBashCodeExecutionResultBlock + readonly "tool_use_id": string + readonly "type": "bash_code_execution_tool_result" +} +export const RequestBashCodeExecutionToolResultBlock = Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." }) ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })), - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) - ) -}) -export type ModelsGet200 = ModelInfo -export const ModelsGet200 = ModelInfo -export type ModelsGet4XX = ErrorResponse -export const ModelsGet4XX = ErrorResponse -export type MessageBatchesListParams = { - readonly "before_id"?: string - readonly "after_id"?: string - readonly "limit"?: number - readonly "anthropic-version"?: string - readonly "x-api-key"?: string + "content": Schema.Union([RequestBashCodeExecutionToolResultError, RequestBashCodeExecutionResultBlock]).annotate({ + "title": "Content" + }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + ), + "type": Schema.Literal("bash_code_execution_tool_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestBashCodeExecutionToolResultBlock" }) +export type RequestCodeExecutionToolResultBlock = { + readonly "cache_control"?: CacheControlEphemeral | null + readonly "content": + | RequestCodeExecutionToolResultError + | RequestCodeExecutionResultBlock + | RequestEncryptedCodeExecutionResultBlock + readonly "tool_use_id": string + readonly "type": "code_execution_tool_result" } -export const MessageBatchesListParams = Schema.Struct({ - "before_id": Schema.optionalKey( - Schema.String.annotate({ - "title": "Before Id", - "description": - "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object." +export const RequestCodeExecutionToolResultBlock = Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." }) ), - "after_id": Schema.optionalKey( - Schema.String.annotate({ - "title": "After Id", - "description": - "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object." + "content": Schema.Union([ + RequestCodeExecutionToolResultError, + RequestCodeExecutionResultBlock, + RequestEncryptedCodeExecutionResultBlock + ]).annotate({ "title": "Content" }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + ), + "type": Schema.Literal("code_execution_tool_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestCodeExecutionToolResultBlock" }) +export type RequestSearchResultBlock = { + readonly "cache_control"?: CacheControlEphemeral | null + readonly "citations"?: RequestCitationsConfig + readonly "content": ReadonlyArray + readonly "source": string + readonly "title": string + readonly "type": "search_result" +} +export const RequestSearchResultBlock = Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." }) ), - "limit": Schema.optionalKey( - Schema.Number.annotate({ - "title": "Limit", - "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`.", - "default": 20 - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(1000)) + "citations": Schema.optionalKey(RequestCitationsConfig), + "content": Schema.Array(RequestTextBlock).annotate({ "title": "Content" }), + "source": Schema.String.annotate({ "title": "Source" }), + "title": Schema.String.annotate({ "title": "Title" }), + "type": Schema.Literal("search_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestSearchResultBlock" }) +export type ResponseBashCodeExecutionToolResultBlock = { + readonly "content": ResponseBashCodeExecutionToolResultError | ResponseBashCodeExecutionResultBlock + readonly "tool_use_id": string + readonly "type": "bash_code_execution_tool_result" +} +export const ResponseBashCodeExecutionToolResultBlock = Schema.Struct({ + "content": Schema.Union([ResponseBashCodeExecutionToolResultError, ResponseBashCodeExecutionResultBlock]).annotate({ + "title": "Content" + }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) + "type": Schema.Literal("bash_code_execution_tool_result").annotate({ + "title": "Type", + "default": "bash_code_execution_tool_result" + }) +}).annotate({ "title": "ResponseBashCodeExecutionToolResultBlock" }) +export type ResponseWebFetchResultBlock = { + readonly "content": ResponseDocumentBlock + readonly "retrieved_at": string | null + readonly "type": "web_fetch_result" + readonly "url": string +} +export const ResponseWebFetchResultBlock = Schema.Struct({ + "content": ResponseDocumentBlock, + "retrieved_at": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Retrieved At", + "description": "ISO 8601 timestamp when the content was retrieved", + "default": null + }), + "type": Schema.Literal("web_fetch_result").annotate({ "title": "Type", "default": "web_fetch_result" }), + "url": Schema.String.annotate({ "title": "Url", "description": "Fetched content URL" }) +}).annotate({ "title": "ResponseWebFetchResultBlock" }) +export type ResponseCodeExecutionToolResultBlock = { + readonly "content": + | ResponseCodeExecutionToolResultError + | ResponseCodeExecutionResultBlock + | ResponseEncryptedCodeExecutionResultBlock + readonly "tool_use_id": string + readonly "type": "code_execution_tool_result" +} +export const ResponseCodeExecutionToolResultBlock = Schema.Struct({ + "content": Schema.Union([ + ResponseCodeExecutionToolResultError, + ResponseCodeExecutionResultBlock, + ResponseEncryptedCodeExecutionResultBlock + ]).annotate({ "title": "Content" }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type MessageBatchesList200 = ListResponse_MessageBatch_ -export const MessageBatchesList200 = ListResponse_MessageBatch_ -export type MessageBatchesList4XX = ErrorResponse -export const MessageBatchesList4XX = ErrorResponse -export type MessageBatchesPostParams = { readonly "anthropic-version"?: string } -export const MessageBatchesPostParams = Schema.Struct({ - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) - ) -}) -export type MessageBatchesPostRequestJson = CreateMessageBatchParams -export const MessageBatchesPostRequestJson = CreateMessageBatchParams -export type MessageBatchesPost200 = MessageBatch -export const MessageBatchesPost200 = MessageBatch -export type MessageBatchesPost4XX = ErrorResponse -export const MessageBatchesPost4XX = ErrorResponse -export type MessageBatchesRetrieveParams = { readonly "anthropic-version"?: string; readonly "x-api-key"?: string } -export const MessageBatchesRetrieveParams = Schema.Struct({ - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + "type": Schema.Literal("code_execution_tool_result").annotate({ + "title": "Type", + "default": "code_execution_tool_result" + }) +}).annotate({ "title": "ResponseCodeExecutionToolResultBlock" }) +export type ContentBlockDeltaEvent = { + readonly "delta": + | TextContentBlockDelta + | InputJsonContentBlockDelta + | CitationsDelta + | ThinkingContentBlockDelta + | SignatureContentBlockDelta + readonly "index": number + readonly "type": "content_block_delta" +} +export const ContentBlockDeltaEvent = Schema.Struct({ + "delta": Schema.Union([ + TextContentBlockDelta, + InputJsonContentBlockDelta, + CitationsDelta, + ThinkingContentBlockDelta, + SignatureContentBlockDelta + ], { mode: "oneOf" }).annotate({ "title": "Delta" }), + "index": Schema.Number.annotate({ "title": "Index" }).check(Schema.isInt()), + "type": Schema.Literal("content_block_delta").annotate({ "title": "Type", "default": "content_block_delta" }) +}).annotate({ "title": "ContentBlockDeltaEvent" }) +export type RequestTextEditorCodeExecutionToolResultBlock = { + readonly "cache_control"?: CacheControlEphemeral | null + readonly "content": + | RequestTextEditorCodeExecutionToolResultError + | RequestTextEditorCodeExecutionViewResultBlock + | RequestTextEditorCodeExecutionCreateResultBlock + | RequestTextEditorCodeExecutionStrReplaceResultBlock + readonly "tool_use_id": string + readonly "type": "text_editor_code_execution_tool_result" +} +export const RequestTextEditorCodeExecutionToolResultBlock = Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." }) ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type MessageBatchesRetrieve200 = MessageBatch -export const MessageBatchesRetrieve200 = MessageBatch -export type MessageBatchesRetrieve4XX = ErrorResponse -export const MessageBatchesRetrieve4XX = ErrorResponse -export type MessageBatchesDeleteParams = { readonly "anthropic-version"?: string; readonly "x-api-key"?: string } -export const MessageBatchesDeleteParams = Schema.Struct({ - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) + "content": Schema.Union([ + RequestTextEditorCodeExecutionToolResultError, + RequestTextEditorCodeExecutionViewResultBlock, + RequestTextEditorCodeExecutionCreateResultBlock, + RequestTextEditorCodeExecutionStrReplaceResultBlock + ]).annotate({ "title": "Content" }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type MessageBatchesDelete200 = DeleteMessageBatchResponse -export const MessageBatchesDelete200 = DeleteMessageBatchResponse -export type MessageBatchesDelete4XX = ErrorResponse -export const MessageBatchesDelete4XX = ErrorResponse -export type MessageBatchesCancelParams = { readonly "anthropic-version"?: string } -export const MessageBatchesCancelParams = Schema.Struct({ - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) - ) -}) -export type MessageBatchesCancel200 = MessageBatch -export const MessageBatchesCancel200 = MessageBatch -export type MessageBatchesCancel4XX = ErrorResponse -export const MessageBatchesCancel4XX = ErrorResponse -export type MessageBatchesResultsParams = { readonly "anthropic-version"?: string; readonly "x-api-key"?: string } -export const MessageBatchesResultsParams = Schema.Struct({ - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) + "type": Schema.Literal("text_editor_code_execution_tool_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestTextEditorCodeExecutionToolResultBlock" }) +export type ResponseTextEditorCodeExecutionToolResultBlock = { + readonly "content": + | ResponseTextEditorCodeExecutionToolResultError + | ResponseTextEditorCodeExecutionViewResultBlock + | ResponseTextEditorCodeExecutionCreateResultBlock + | ResponseTextEditorCodeExecutionStrReplaceResultBlock + readonly "tool_use_id": string + readonly "type": "text_editor_code_execution_tool_result" +} +export const ResponseTextEditorCodeExecutionToolResultBlock = Schema.Struct({ + "content": Schema.Union([ + ResponseTextEditorCodeExecutionToolResultError, + ResponseTextEditorCodeExecutionViewResultBlock, + ResponseTextEditorCodeExecutionCreateResultBlock, + ResponseTextEditorCodeExecutionStrReplaceResultBlock + ]).annotate({ "title": "Content" }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type MessageBatchesResults4XX = ErrorResponse -export const MessageBatchesResults4XX = ErrorResponse -export type MessagesCountTokensPostParams = { readonly "anthropic-version"?: string } -export const MessagesCountTokensPostParams = Schema.Struct({ - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) - ) + "type": Schema.Literal("text_editor_code_execution_tool_result").annotate({ + "title": "Type", + "default": "text_editor_code_execution_tool_result" + }) +}).annotate({ "title": "ResponseTextEditorCodeExecutionToolResultBlock" }) +export type ThinkingConfigParam = ThinkingConfigEnabled | ThinkingConfigDisabled | ThinkingConfigAdaptive +export const ThinkingConfigParam = Schema.Union( + [ThinkingConfigEnabled, ThinkingConfigDisabled, ThinkingConfigAdaptive], + { mode: "oneOf" } +).annotate({ + "title": "Thinking", + "description": + "Configuration for enabling Claude's extended thinking.\n\nWhen enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit.\n\nSee [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for details." }) -export type MessagesCountTokensPostRequestJson = CountMessageTokensParams -export const MessagesCountTokensPostRequestJson = CountMessageTokensParams -export type MessagesCountTokensPost200 = CountMessageTokensResponse -export const MessagesCountTokensPost200 = CountMessageTokensResponse -export type MessagesCountTokensPost4XX = ErrorResponse -export const MessagesCountTokensPost4XX = ErrorResponse -export type ListFilesV1FilesGetParams = { - readonly "before_id"?: string - readonly "after_id"?: string - readonly "limit"?: number - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string +export type ModelInfo = { + readonly "capabilities": ModelCapabilities | null + readonly "created_at": string + readonly "display_name": string + readonly "id": string + readonly "max_input_tokens": number | null + readonly "max_tokens": number | null + readonly "type": "model" } -export const ListFilesV1FilesGetParams = Schema.Struct({ - "before_id": Schema.optionalKey( - Schema.String.annotate({ - "title": "Before Id", - "description": - "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object." - }) - ), - "after_id": Schema.optionalKey( - Schema.String.annotate({ - "title": "After Id", - "description": - "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object." - }) - ), - "limit": Schema.optionalKey( - Schema.Number.annotate({ - "title": "Limit", - "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`.", - "default": 20 - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(1000)) - ), - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) - ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) - ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", +export const ModelInfo = Schema.Struct({ + "capabilities": Schema.Union([ModelCapabilities, Schema.Null]).annotate({ "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type ListFilesV1FilesGet200 = FileListResponse -export const ListFilesV1FilesGet200 = FileListResponse -export type ListFilesV1FilesGet4XX = ErrorResponse -export const ListFilesV1FilesGet4XX = ErrorResponse -export type UploadFileV1FilesPostParams = { readonly "anthropic-beta"?: string; readonly "anthropic-version"?: string } -export const UploadFileV1FilesPostParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) + "Object mapping capability names to their support details. Keys are always present for all known capabilities." + }), + "created_at": Schema.String.annotate({ + "title": "Created At", + "description": + "RFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown.", + "format": "date-time" + }), + "display_name": Schema.String.annotate({ + "title": "Display Name", + "description": "A human-readable name for the model." + }), + "id": Schema.String.annotate({ "title": "Id", "description": "Unique model identifier." }), + "max_input_tokens": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "Max Input Tokens", + "description": "Maximum input context window size in tokens for this model." + }), + "max_tokens": Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "Max Tokens", + "description": "Maximum value for the `max_tokens` parameter when using this model." + }), + "type": Schema.Literal("model").annotate({ + "title": "Type", + "description": "Object type.\n\nFor Models, this is always `\"model\"`.", + "default": "model" + }) +}).annotate({ "title": "ModelInfo" }) +export type ResponseToolSearchToolResultBlock = { + readonly "content": ResponseToolSearchToolResultError | ResponseToolSearchToolSearchResultBlock + readonly "tool_use_id": string + readonly "type": "tool_search_tool_result" +} +export const ResponseToolSearchToolResultBlock = Schema.Struct({ + "content": Schema.Union([ResponseToolSearchToolResultError, ResponseToolSearchToolSearchResultBlock]).annotate({ + "title": "Content" + }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) - ) -}) -export type UploadFileV1FilesPostRequestFormData = { readonly "file": string } -export const UploadFileV1FilesPostRequestFormData = Schema.Struct({ - "file": Schema.String.annotate({ "description": "The file to upload", "format": "binary" }) -}) -export type UploadFileV1FilesPost200 = FileMetadataSchema -export const UploadFileV1FilesPost200 = FileMetadataSchema -export type UploadFileV1FilesPost4XX = ErrorResponse -export const UploadFileV1FilesPost4XX = ErrorResponse -export type GetFileMetadataV1FilesFileIdGetParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string + "type": Schema.Literal("tool_search_tool_result").annotate({ "title": "Type", "default": "tool_search_tool_result" }) +}).annotate({ "title": "ResponseToolSearchToolResultBlock" }) +export type ContentBlockSource = { + readonly "content": string | ReadonlyArray + readonly "type": "content" } -export const GetFileMetadataV1FilesFileIdGetParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." +export const ContentBlockSource = Schema.Struct({ + "content": Schema.Union([ + Schema.String, + Schema.Array( + Schema.Union([RequestTextBlock, RequestImageBlock], { mode: "oneOf" }).annotate({ + "title": "content_block_source_content_item" + }) + ).annotate({ "title": "content_block_source_content" }) + ]).annotate({ "title": "Content" }), + "type": Schema.Literal("content").annotate({ "title": "Type" }) +}).annotate({ "title": "ContentBlockSource" }) +export type RequestWebSearchToolResultBlock = { + readonly "cache_control"?: CacheControlEphemeral | null + readonly "caller"?: DirectCaller | ServerToolCaller | ServerToolCaller_20260120 + readonly "content": ReadonlyArray | RequestWebSearchToolResultError + readonly "tool_use_id": string + readonly "type": "web_search_tool_result" +} +export const RequestWebSearchToolResultBlock = Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." }) ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + "caller": Schema.optionalKey( + Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({ + "title": "Caller" }) ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type GetFileMetadataV1FilesFileIdGet200 = FileMetadataSchema -export const GetFileMetadataV1FilesFileIdGet200 = FileMetadataSchema -export type GetFileMetadataV1FilesFileIdGet4XX = ErrorResponse -export const GetFileMetadataV1FilesFileIdGet4XX = ErrorResponse -export type DeleteFileV1FilesFileIdDeleteParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string + "content": Schema.Union([ + Schema.Array(RequestWebSearchResultBlock).annotate({ "title": "web_search_tool_result_block_item" }), + RequestWebSearchToolResultError + ]).annotate({ "title": "Content" }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + ), + "type": Schema.Literal("web_search_tool_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestWebSearchToolResultBlock" }) +export type ResponseWebSearchToolResultBlock = { + readonly "caller": DirectCaller | ServerToolCaller | ServerToolCaller_20260120 + readonly "content": ResponseWebSearchToolResultError | ReadonlyArray + readonly "tool_use_id": string + readonly "type": "web_search_tool_result" } -export const DeleteFileV1FilesFileIdDeleteParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) +export const ResponseWebSearchToolResultBlock = Schema.Struct({ + "caller": Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({ + "title": "Caller", + "default": { "type": "direct" } + }), + "content": Schema.Union([ResponseWebSearchToolResultError, Schema.Array(ResponseWebSearchResultBlock)]).annotate({ + "title": "Content" + }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + "type": Schema.Literal("web_search_tool_result").annotate({ "title": "Type", "default": "web_search_tool_result" }) +}).annotate({ "title": "ResponseWebSearchToolResultBlock" }) +export type BetaManagedAgentsErrorResponse = { readonly "type": "error"; readonly "error": BetaManagedAgentsError } +export const BetaManagedAgentsErrorResponse = Schema.Struct({ + "type": Schema.Literal("error").annotate({ "description": "Always \"error\" for error responses" }), + "error": BetaManagedAgentsError +}) +export type MessageDeltaEvent = { + readonly "delta": MessageDelta + readonly "type": "message_delta" + readonly "usage": { + readonly "cache_creation_input_tokens": number | null + readonly "cache_read_input_tokens": number | null + readonly "input_tokens": number | null + readonly "output_tokens": number + readonly "server_tool_use"?: ServerToolUsage | null + } +} +export const MessageDeltaEvent = Schema.Struct({ + "delta": MessageDelta, + "type": Schema.Literal("message_delta").annotate({ "title": "Type", "default": "message_delta" }), + "usage": Schema.Struct({ + "cache_creation_input_tokens": Schema.Union([ + Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + Schema.Null + ]).annotate({ + "title": "Cache Creation Input Tokens", + "description": "The cumulative number of input tokens used to create the cache entry.", + "default": null + }), + "cache_read_input_tokens": Schema.Union([ + Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + Schema.Null + ]).annotate({ + "title": "Cache Read Input Tokens", + "description": "The cumulative number of input tokens read from the cache.", + "default": null + }), + "input_tokens": Schema.Union([ + Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + Schema.Null + ]).annotate({ + "title": "Input Tokens", + "description": "The cumulative number of input tokens which were used.", + "default": null + }), + "output_tokens": Schema.Number.annotate({ + "title": "Output Tokens", + "description": "The cumulative number of output tokens which were used." + }).check(Schema.isInt()), + "server_tool_use": Schema.optionalKey( + Schema.Union([ServerToolUsage, Schema.Null]).annotate({ + "description": "The number of server tool requests.", + "default": null + }) + ) + }).annotate({ + "title": "MessageDeltaUsage", + "description": + "Billing and rate-limit usage.\n\nAnthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.\n\nUnder the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.\n\nFor example, `output_tokens` will be non-zero, even for an empty string response from Claude.\n\nTotal input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`." + }) +}).annotate({ "title": "MessageDeltaEvent" }) +export type BetaIterationsUsage = + | ReadonlyArray + | null +export const BetaIterationsUsage = Schema.Union([ + Schema.Array( + Schema.Union([BetaMessageIterationUsage, BetaCompactionIterationUsage, BetaAdvisorMessageIterationUsage], { + mode: "oneOf" }) ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) + Schema.Null +]).annotate({ + "title": "Iterations", + "description": + "Per-iteration token usage breakdown.\n\nEach entry represents one sampling iteration, with its own input/output token counts and cache statistics. This allows you to:\n- Determine which iterations exceeded long context thresholds (>=200k tokens)\n- Calculate the true context window size from the last iteration\n- Understand token accumulation across server-side tool use loops", + "default": null }) -export type DeleteFileV1FilesFileIdDelete200 = FileDeleteResponse -export const DeleteFileV1FilesFileIdDelete200 = FileDeleteResponse -export type DeleteFileV1FilesFileIdDelete4XX = ErrorResponse -export const DeleteFileV1FilesFileIdDelete4XX = ErrorResponse -export type DownloadFileV1FilesFileIdContentGetParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string +export type BetaRequestToolSearchToolResultBlock = { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "content": BetaRequestToolSearchToolResultError | BetaRequestToolSearchToolSearchResultBlock + readonly "tool_use_id": string + readonly "type": "tool_search_tool_result" } -export const DownloadFileV1FilesFileIdContentGetParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", +export const BetaRequestToolSearchToolResultBlock = Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "content": Schema.Union([BetaRequestToolSearchToolResultError, BetaRequestToolSearchToolSearchResultBlock]).annotate({ + "title": "Content" + }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + ), + "type": Schema.Literal("tool_search_tool_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestToolSearchToolResultBlock" }) +export type BetaManagedAgentsUpdateSessionParams = { + readonly "title"?: string + readonly "metadata"?: { readonly [x: string]: string } + readonly "vault_ids"?: ReadonlyArray + readonly "agent"?: { + readonly "tools"?: ReadonlyArray + readonly "mcp_servers"?: ReadonlyArray + } +} +export const BetaManagedAgentsUpdateSessionParams = Schema.Struct({ + "title": Schema.optionalKey( + Schema.String.annotate({ "description": "Human-readable session title." }).check(Schema.isMinLength(1)).check( + Schema.isMaxLength(500) + ) + ), + "metadata": Schema.optionalKey( + Schema.Record(Schema.String, Schema.String).annotate({ "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + "Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve." }) ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", + "vault_ids": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + "Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use." }) ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type ListSkillsV1SkillsGetParams = { - readonly "page"?: string | null - readonly "limit"?: number - readonly "source"?: string | null - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string -} -export const ListSkillsV1SkillsGetParams = Schema.Struct({ - "page": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Page", + "agent": Schema.optionalKey( + Schema.Struct({ + "tools": Schema.optionalKey( + Schema.Array(BetaManagedAgentsAgentToolParams).annotate({ + "description": + "Replacement tool list. Full replacement: the provided array becomes the new value. Send an empty array to clear; omit to preserve." + }) + ), + "mcp_servers": Schema.optionalKey( + Schema.Array(BetaManagedAgentsMCPServerParams).annotate({ + "description": + "Replacement MCP server list. Full replacement: the provided array becomes the new value. Send an empty array to clear; omit to preserve." + }) + ) + }).annotate({ "description": - "Pagination token for fetching a specific page of results.\n\nPass the value from a previous response's `next_page` field to get the next page of results." + "Mid-session agent configuration update. Only `tools` and `mcp_servers` are updatable. Full replacement: the provided array becomes the new value. To preserve existing entries, GET the session, modify the array, and POST it back." }) + ) +}).annotate({ + "description": "Request parameters for updating a `session`. Omit a field to preserve its current value." +}) +export type BetaManagedAgentsCreateAgentParams = { + readonly "name": string + readonly "model": + | string + | "claude-opus-4-7" + | "claude-opus-4-6" + | "claude-sonnet-4-6" + | "claude-haiku-4-5" + | "claude-haiku-4-5-20251001" + | "claude-opus-4-5" + | "claude-opus-4-5-20251101" + | "claude-sonnet-4-5" + | "claude-sonnet-4-5-20250929" + | BetaManagedAgentsModelConfigParams + readonly "description"?: string + readonly "system"?: string + readonly "tools"?: ReadonlyArray + readonly "mcp_servers"?: ReadonlyArray + readonly "skills"?: ReadonlyArray + readonly "metadata"?: { readonly [x: string]: string } + readonly "multiagent"?: BetaManagedAgentsMultiagentCoordinatorParams +} +export const BetaManagedAgentsCreateAgentParams = Schema.Struct({ + "name": Schema.String.annotate({ "description": "Human-readable name for the agent. 1-256 characters." }).check( + Schema.isMinLength(1) + ).check(Schema.isMaxLength(256)), + "model": Schema.Union([ + Schema.Union([ + Schema.String, + Schema.Literal("claude-opus-4-7").annotate({ + "description": "Frontier intelligence for long-running agents and coding" + }), + Schema.Literal("claude-opus-4-6").annotate({ + "description": "Most intelligent model for building agents and coding" + }), + Schema.Literal("claude-sonnet-4-6").annotate({ "description": "Best combination of speed and intelligence" }), + Schema.Literal("claude-haiku-4-5").annotate({ "description": "Fastest model with near-frontier intelligence" }), + Schema.Literal("claude-haiku-4-5-20251001").annotate({ + "description": "Fastest model with near-frontier intelligence" + }), + Schema.Literal("claude-opus-4-5").annotate({ + "description": "Premium model combining maximum intelligence with practical performance" + }), + Schema.Literal("claude-opus-4-5-20251101").annotate({ + "description": "Premium model combining maximum intelligence with practical performance" + }), + Schema.Literal("claude-sonnet-4-5").annotate({ "description": "High-performance model for agents and coding" }), + Schema.Literal("claude-sonnet-4-5-20250929").annotate({ + "description": "High-performance model for agents and coding" + }) + ]).annotate({ + "title": "BetaManagedAgentsModel", + "description": + "The model that will power your agent.\\n\\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options." + }), + BetaManagedAgentsModelConfigParams + ], { mode: "oneOf" }).annotate({ + "description": + "Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control" + }), + "description": Schema.optionalKey( + Schema.String.annotate({ "description": "Description of what the agent does. Up to 2048 characters." }).check( + Schema.isMaxLength(2048) + ) ), - "limit": Schema.optionalKey( - Schema.Number.annotate({ - "title": "Limit", - "description": "Number of results to return per page.\n\nMaximum value is 100. Defaults to 20.", - "default": 20 - }).check(Schema.isInt()) + "system": Schema.optionalKey( + Schema.String.annotate({ "description": "System prompt for the agent. Up to 100,000 characters." }).check( + Schema.isMaxLength(100000) + ) ), - "source": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Source", - "description": - "Filter skills by source.\n\nIf provided, only skills from the specified source will be returned:\n* `\"custom\"`: only return user-created skills\n* `\"anthropic\"`: only return Anthropic-created skills" + "tools": Schema.optionalKey( + Schema.Array(BetaManagedAgentsAgentToolParams).annotate({ + "description": "Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed." }) ), - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + "mcp_servers": Schema.optionalKey( + Schema.Array(BetaManagedAgentsMCPServerParams).annotate({ + "description": "MCP servers this agent connects to. Maximum 20. Names must be unique within the array." }) ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + "skills": Schema.optionalKey( + Schema.Array(BetaManagedAgentsSkillParams).annotate({ "description": "Skills available to the agent. Maximum 20." }) + ), + "metadata": Schema.optionalKey( + Schema.Record(Schema.String, Schema.String).annotate({ + "description": "Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars." }) ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", + "multiagent": Schema.optionalKey( + Schema.Union([BetaManagedAgentsMultiagentCoordinatorParams], { mode: "oneOf" }).annotate({ + "description": "Multiagent orchestration configuration. Currently supports the `coordinator` topology." + }) + ) +}).annotate({ "description": "Request parameters for creating an `agent`." }) +export type BetaManagedAgentsUpdateAgentParams = { + readonly "version": number + readonly "name"?: string + readonly "description"?: string + readonly "model"?: + | string + | "claude-opus-4-7" + | "claude-opus-4-6" + | "claude-sonnet-4-6" + | "claude-haiku-4-5" + | "claude-haiku-4-5-20251001" + | "claude-opus-4-5" + | "claude-opus-4-5-20251101" + | "claude-sonnet-4-5" + | "claude-sonnet-4-5-20250929" + | BetaManagedAgentsModelConfigParams + readonly "system"?: string + readonly "tools"?: ReadonlyArray + readonly "mcp_servers"?: ReadonlyArray + readonly "skills"?: ReadonlyArray + readonly "metadata"?: { readonly [x: string]: string } + readonly "multiagent"?: BetaManagedAgentsMultiagentCoordinatorParams +} +export const BetaManagedAgentsUpdateAgentParams = Schema.Struct({ + "version": Schema.Number.annotate({ "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type ListSkillsV1SkillsGet200 = ListSkillsResponse -export const ListSkillsV1SkillsGet200 = ListSkillsResponse -export type ListSkillsV1SkillsGet4XX = ErrorResponse -export const ListSkillsV1SkillsGet4XX = ErrorResponse -export type CreateSkillV1SkillsPostParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string -} -export const CreateSkillV1SkillsPostParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( + "The agent's current version, used to prevent concurrent overwrites. Obtain this value from a create or retrieve response. The request fails if this does not match the server's current version.", + "format": "int32" + }).check(Schema.isInt()), + "name": Schema.optionalKey( Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) + "description": "Human-readable name. 1-256 characters. Omit to preserve. Cannot be cleared." + }).check(Schema.isMaxLength(256)) ), - "anthropic-version": Schema.optionalKey( + "description": Schema.optionalKey( Schema.String.annotate({ - "title": "Anthropic-Version", + "description": "Description. Up to 2048 characters. Omit to preserve; send empty string or null to clear." + }).check(Schema.isMaxLength(2048)) + ), + "model": Schema.optionalKey( + Schema.Union([ + Schema.Union([ + Schema.String, + Schema.Literal("claude-opus-4-7").annotate({ + "description": "Frontier intelligence for long-running agents and coding" + }), + Schema.Literal("claude-opus-4-6").annotate({ + "description": "Most intelligent model for building agents and coding" + }), + Schema.Literal("claude-sonnet-4-6").annotate({ "description": "Best combination of speed and intelligence" }), + Schema.Literal("claude-haiku-4-5").annotate({ "description": "Fastest model with near-frontier intelligence" }), + Schema.Literal("claude-haiku-4-5-20251001").annotate({ + "description": "Fastest model with near-frontier intelligence" + }), + Schema.Literal("claude-opus-4-5").annotate({ + "description": "Premium model combining maximum intelligence with practical performance" + }), + Schema.Literal("claude-opus-4-5-20251101").annotate({ + "description": "Premium model combining maximum intelligence with practical performance" + }), + Schema.Literal("claude-sonnet-4-5").annotate({ "description": "High-performance model for agents and coding" }), + Schema.Literal("claude-sonnet-4-5-20250929").annotate({ + "description": "High-performance model for agents and coding" + }) + ]).annotate({ + "title": "BetaManagedAgentsModel", + "description": + "The model that will power your agent.\\n\\nSee [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options." + }), + BetaManagedAgentsModelConfigParams + ], { mode: "oneOf" }).annotate({ "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + "Model identifier. Accepts the [model string](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison), e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration control. Omit to preserve. Cannot be cleared." }) - ) -}) -export type CreateSkillV1SkillsPostRequestFormData = Body_create_skill_v1_skills_post -export const CreateSkillV1SkillsPostRequestFormData = Body_create_skill_v1_skills_post -export type CreateSkillV1SkillsPost200 = CreateSkillResponse -export const CreateSkillV1SkillsPost200 = CreateSkillResponse -export type CreateSkillV1SkillsPost4XX = ErrorResponse -export const CreateSkillV1SkillsPost4XX = ErrorResponse -export type GetSkillV1SkillsSkillIdGetParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string -} -export const GetSkillV1SkillsSkillIdGetParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( + ), + "system": Schema.optionalKey( Schema.String.annotate({ - "title": "Anthropic-Beta", + "description": "System prompt. Up to 100,000 characters. Omit to preserve; send empty string or null to clear." + }).check(Schema.isMaxLength(100000)) + ), + "tools": Schema.optionalKey( + Schema.Array(BetaManagedAgentsAgentToolParams).annotate({ "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + "Tool configurations available to the agent. Full replacement. Omit to preserve; send empty array or null to clear. Maximum of 128 tools across all toolsets allowed." }) ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", + "mcp_servers": Schema.optionalKey( + Schema.Array(BetaManagedAgentsMCPServerParams).annotate({ "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + "MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names must be unique. Maximum 20." }) ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type GetSkillV1SkillsSkillIdGet200 = GetSkillResponse -export const GetSkillV1SkillsSkillIdGet200 = GetSkillResponse -export type GetSkillV1SkillsSkillIdGet4XX = ErrorResponse -export const GetSkillV1SkillsSkillIdGet4XX = ErrorResponse -export type DeleteSkillV1SkillsSkillIdDeleteParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string -} -export const DeleteSkillV1SkillsSkillIdDeleteParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + "skills": Schema.optionalKey( + Schema.Array(BetaManagedAgentsSkillParams).annotate({ + "description": "Skills. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 20." }) ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", + "metadata": Schema.optionalKey( + Schema.Record(Schema.String, Schema.String).annotate({ "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + "Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars." }) ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) + "multiagent": Schema.optionalKey( + Schema.Union([BetaManagedAgentsMultiagentCoordinatorParams], { mode: "oneOf" }).annotate({ + "description": "Multiagent orchestration configuration. Currently supports the `coordinator` topology." + }) + ) +}).annotate({ + "description": "Request parameters for updating an `agent`. Omit a field to preserve its current value." }) -export type DeleteSkillV1SkillsSkillIdDelete200 = DeleteSkillResponse -export const DeleteSkillV1SkillsSkillIdDelete200 = DeleteSkillResponse -export type DeleteSkillV1SkillsSkillIdDelete4XX = ErrorResponse -export const DeleteSkillV1SkillsSkillIdDelete4XX = ErrorResponse -export type ListSkillVersionsV1SkillsSkillIdVersionsGetParams = { - readonly "page"?: string | null - readonly "limit"?: number | null - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string +export type BetaManagedAgentsAgent = { + readonly "type": "agent" + readonly "id": string + readonly "version": number + readonly "name": string + readonly "description": string + readonly "model": BetaManagedAgentsModelConfig + readonly "system": string + readonly "tools": ReadonlyArray + readonly "mcp_servers": ReadonlyArray + readonly "skills": ReadonlyArray + readonly "metadata": { readonly [x: string]: string } + readonly "created_at": BetaTimestamp + readonly "updated_at": BetaTimestamp + readonly "archived_at": string + readonly "multiagent": BetaManagedAgentsMultiagentCoordinator +} +export const BetaManagedAgentsAgent = Schema.Struct({ + "type": Schema.Literal("agent"), + "id": Schema.String, + "version": Schema.Number.annotate({ + "description": "The agent's current version. Starts at 1 and increments when the agent is modified.", + "format": "int32" + }).check(Schema.isInt()), + "name": Schema.String, + "description": Schema.String, + "model": BetaManagedAgentsModelConfig, + "system": Schema.String, + "tools": Schema.Array(BetaManagedAgentsAgentTool), + "mcp_servers": Schema.Array(BetaManagedAgentsMCPServer), + "skills": Schema.Array(BetaManagedAgentsSkill), + "metadata": Schema.Record(Schema.String, Schema.String), + "created_at": BetaTimestamp, + "updated_at": BetaTimestamp, + "archived_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "multiagent": Schema.Union([BetaManagedAgentsMultiagentCoordinator], { mode: "oneOf" }).annotate({ + "description": "Resolved multiagent orchestration configuration as returned in API responses." + }) +}).annotate({ "description": "A Managed Agents `agent`." }) +export type BetaManagedAgentsSessionThread = { + readonly "type": "session_thread" + readonly "id": string + readonly "session_id": string + readonly "status": "running" | "idle" | "rescheduling" | "terminated" + readonly "agent": { + readonly "type": "agent" + readonly "id": string + readonly "version": number + readonly "name": string + readonly "description": string + readonly "model": BetaManagedAgentsModelConfig + readonly "system": string + readonly "tools": ReadonlyArray + readonly "mcp_servers": ReadonlyArray + readonly "skills": ReadonlyArray + } + readonly "parent_thread_id": string + readonly "created_at": string + readonly "updated_at": string + readonly "archived_at": string + readonly "usage": { + readonly "input_tokens"?: number + readonly "output_tokens"?: number + readonly "cache_read_input_tokens"?: number + readonly "cache_creation"?: { + readonly "ephemeral_1h_input_tokens"?: number + readonly "ephemeral_5m_input_tokens"?: number + } + } + readonly "stats": { + readonly "duration_seconds"?: number + readonly "startup_seconds"?: number + readonly "active_seconds"?: number + } } -export const ListSkillVersionsV1SkillsSkillIdVersionsGetParams = Schema.Struct({ - "page": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Page", - "description": "Optionally set to the `next_page` token from the previous response." - }) - ), - "limit": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ - "title": "Limit", - "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`." - }) - ), - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) - ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) - ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", +export const BetaManagedAgentsSessionThread = Schema.Struct({ + "type": Schema.Literal("session_thread"), + "id": Schema.String.annotate({ "description": "Unique identifier for this thread." }), + "session_id": Schema.String.annotate({ "description": "The session this thread belongs to." }), + "status": Schema.Literals(["running", "idle", "rescheduling", "terminated"]).annotate({ + "description": "SessionThreadStatus enum" + }), + "agent": Schema.Struct({ + "type": Schema.Literal("agent"), + "id": Schema.String, + "version": Schema.Number.annotate({ "format": "int32" }).check(Schema.isInt()), + "name": Schema.String, + "description": Schema.String, + "model": BetaManagedAgentsModelConfig, + "system": Schema.String, + "tools": Schema.Array(BetaManagedAgentsAgentTool), + "mcp_servers": Schema.Array(BetaManagedAgentsMCPServer), + "skills": Schema.Array(BetaManagedAgentsSkill) + }).annotate({ "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) + "Resolved `agent` definition for a single `session_thread`. Snapshot of the agent at thread creation time. The multiagent roster is not repeated here; read it from `Session.agent`." + }), + "parent_thread_id": Schema.String.annotate({ + "description": "Parent thread that spawned this thread. Null for the primary thread." + }), + "created_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "updated_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "archived_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "usage": Schema.Struct({ + "input_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Total input tokens consumed across all turns.", "format": "int32" }) + .check(Schema.isInt()) + ), + "output_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Total output tokens generated across all turns.", "format": "int32" }) + .check(Schema.isInt()) + ), + "cache_read_input_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Total tokens read from prompt cache.", "format": "int32" }).check( + Schema.isInt() + ) + ), + "cache_creation": Schema.optionalKey( + Schema.Struct({ + "ephemeral_1h_input_tokens": Schema.optionalKey( + Schema.Number.annotate({ + "description": "Tokens used to create 1-hour ephemeral cache entries.", + "format": "int32" + }).check(Schema.isInt()) + ), + "ephemeral_5m_input_tokens": Schema.optionalKey( + Schema.Number.annotate({ + "description": "Tokens used to create 5-minute ephemeral cache entries.", + "format": "int32" + }).check(Schema.isInt()) + ) + }).annotate({ "description": "Prompt-cache creation token usage broken down by cache lifetime." }) + ) + }).annotate({ "description": "Cumulative token usage for a session thread across all turns." }), + "stats": Schema.Struct({ + "duration_seconds": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "Elapsed time since thread creation in seconds. For archived threads, frozen at the final update.", + "format": "double" + }).check(Schema.isFinite()) + ), + "startup_seconds": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "Time in seconds for the thread to begin running. Zero for child threads, which start immediately.", + "format": "double" + }).check(Schema.isFinite()) + ), + "active_seconds": Schema.optionalKey( + Schema.Number.annotate({ + "description": "Cumulative time in seconds the thread spent actively running. Excludes idle time.", + "format": "double" + }).check(Schema.isFinite()) + ) + }).annotate({ "description": "Timing statistics for a session thread." }) +}).annotate({ + "description": + "An execution thread within a `session`. Each session has one primary thread plus zero or more child threads spawned by the coordinator." }) -export type ListSkillVersionsV1SkillsSkillIdVersionsGet200 = ListSkillVersionsResponse -export const ListSkillVersionsV1SkillsSkillIdVersionsGet200 = ListSkillVersionsResponse -export type ListSkillVersionsV1SkillsSkillIdVersionsGet4XX = ErrorResponse -export const ListSkillVersionsV1SkillsSkillIdVersionsGet4XX = ErrorResponse -export type CreateSkillVersionV1SkillsSkillIdVersionsPostParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string +export type BetaManagedAgentsSessionThreadAgent = { + readonly "type": "agent" + readonly "id": string + readonly "version": number + readonly "name": string + readonly "description": string + readonly "model": BetaManagedAgentsModelConfig + readonly "system": string + readonly "tools": ReadonlyArray + readonly "mcp_servers": ReadonlyArray + readonly "skills": ReadonlyArray +} +export const BetaManagedAgentsSessionThreadAgent = Schema.Struct({ + "type": Schema.Literal("agent"), + "id": Schema.String, + "version": Schema.Number.annotate({ "format": "int32" }).check(Schema.isInt()), + "name": Schema.String, + "description": Schema.String, + "model": BetaManagedAgentsModelConfig, + "system": Schema.String, + "tools": Schema.Array(BetaManagedAgentsAgentTool), + "mcp_servers": Schema.Array(BetaManagedAgentsMCPServer), + "skills": Schema.Array(BetaManagedAgentsSkill) +}).annotate({ + "description": + "Resolved `agent` definition for a single `session_thread`. Snapshot of the agent at thread creation time. The multiagent roster is not repeated here; read it from `Session.agent`." +}) +export type BetaManagedAgentsSendSessionEventsParams = { + readonly "events": ReadonlyArray +} +export const BetaManagedAgentsSendSessionEventsParams = Schema.Struct({ + "events": Schema.Array(BetaManagedAgentsEventParams).annotate({ "description": "Events to send to the `session`." }) +}).annotate({ "description": "Request parameters for sending events to a `session`." }) +export type BetaManagedAgentsSendSessionEvents = { readonly "data"?: ReadonlyArray } +export const BetaManagedAgentsSendSessionEvents = Schema.Struct({ + "data": Schema.optionalKey(Schema.Array(BetaManagedAgentsInputEvent).annotate({ "description": "Sent events" })) +}).annotate({ "description": "Events that were successfully sent to the session." }) +export type BetaResponseWebFetchToolResultBlock = { + readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120 + readonly "content": BetaResponseWebFetchToolResultError | BetaResponseWebFetchResultBlock + readonly "tool_use_id": string + readonly "type": "web_fetch_tool_result" } -export const CreateSkillVersionV1SkillsSkillIdVersionsPostParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." +export const BetaResponseWebFetchToolResultBlock = Schema.Struct({ + "caller": Schema.optionalKey( + Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate({ + "title": "Caller" }) ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) - ) -}) -export type CreateSkillVersionV1SkillsSkillIdVersionsPostRequestFormData = - Body_create_skill_version_v1_skills__skill_id__versions_post -export const CreateSkillVersionV1SkillsSkillIdVersionsPostRequestFormData = - Body_create_skill_version_v1_skills__skill_id__versions_post -export type CreateSkillVersionV1SkillsSkillIdVersionsPost200 = CreateSkillVersionResponse -export const CreateSkillVersionV1SkillsSkillIdVersionsPost200 = CreateSkillVersionResponse -export type CreateSkillVersionV1SkillsSkillIdVersionsPost4XX = ErrorResponse -export const CreateSkillVersionV1SkillsSkillIdVersionsPost4XX = ErrorResponse -export type GetSkillVersionV1SkillsSkillIdVersionsVersionGetParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string + "content": Schema.Union([BetaResponseWebFetchToolResultError, BetaResponseWebFetchResultBlock]).annotate({ + "title": "Content" + }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + ), + "type": Schema.Literal("web_fetch_tool_result").annotate({ "title": "Type", "default": "web_fetch_tool_result" }) +}).annotate({ "title": "ResponseWebFetchToolResultBlock" }) +export type BetaListResponse_ModelInfo_ = { + readonly "data": ReadonlyArray + readonly "first_id": string | null + readonly "has_more": boolean + readonly "last_id": string | null } -export const GetSkillVersionV1SkillsSkillIdVersionsVersionGetParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." +export const BetaListResponse_ModelInfo_ = Schema.Struct({ + "data": Schema.Array(BetaModelInfo).annotate({ "title": "Data" }), + "first_id": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "First Id", + "description": "First ID in the `data` list. Can be used as the `before_id` for the previous page." + }), + "has_more": Schema.Boolean.annotate({ + "title": "Has More", + "description": "Indicates if there are more results in the requested page direction." + }), + "last_id": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Last Id", + "description": "Last ID in the `data` list. Can be used as the `after_id` for the next page." + }) +}).annotate({ "title": "ListResponse[ModelInfo]" }) +export type BetaRequestDocumentBlock = { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "citations"?: BetaRequestCitationsConfig | null + readonly "context"?: string | null + readonly "source": + | BetaBase64PDFSource + | BetaPlainTextSource + | BetaContentBlockSource + | BetaURLPDFSource + | BetaFileDocumentSource + readonly "title"?: string | null + readonly "type": "document" +} +export const BetaRequestDocumentBlock = Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." }) ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + "citations": Schema.optionalKey(Schema.Union([BetaRequestCitationsConfig, Schema.Null])), + "context": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMinLength(1)), Schema.Null]).annotate({ "title": "Context" }) + ), + "source": Schema.Union([ + BetaBase64PDFSource, + BetaPlainTextSource, + BetaContentBlockSource, + BetaURLPDFSource, + BetaFileDocumentSource + ], { mode: "oneOf" }).annotate({ "title": "Source" }), + "title": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(500)), Schema.Null]).annotate({ + "title": "Title" }) ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", + "type": Schema.Literal("document").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestDocumentBlock" }) +export type BetaEnvironmentListResponse = { + readonly "data": ReadonlyArray + readonly "next_page": string | null +} +export const BetaEnvironmentListResponse = Schema.Struct({ + "data": Schema.Array(BetaEnvironment).annotate({ "title": "Data", "description": "List of environments." }), + "next_page": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Next Page", "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) + "Token for fetching the next page of results. If `null`, there are no more results available. Pass this value to the `page` parameter in the next request." + }) +}).annotate({ + "title": "EnvironmentListResponse", + "description": + "Response when listing environments.\n\nThis response model uses opaque cursor-based pagination. Use the `page`\nquery parameter with the value from `next_page` to fetch the next page." }) -export type GetSkillVersionV1SkillsSkillIdVersionsVersionGet200 = GetSkillVersionResponse -export const GetSkillVersionV1SkillsSkillIdVersionsVersionGet200 = GetSkillVersionResponse -export type GetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX = ErrorResponse -export const GetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX = ErrorResponse -export type DeleteSkillVersionV1SkillsSkillIdVersionsVersionDeleteParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string +export type RequestToolSearchToolResultBlock = { + readonly "cache_control"?: CacheControlEphemeral | null + readonly "content": RequestToolSearchToolResultError | RequestToolSearchToolSearchResultBlock + readonly "tool_use_id": string + readonly "type": "tool_search_tool_result" } -export const DeleteSkillVersionV1SkillsSkillIdVersionsVersionDeleteParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." +export const RequestToolSearchToolResultBlock = Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." }) ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) + "content": Schema.Union([RequestToolSearchToolResultError, RequestToolSearchToolSearchResultBlock]).annotate({ + "title": "Content" + }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type DeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete200 = DeleteSkillVersionResponse -export const DeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete200 = DeleteSkillVersionResponse -export type DeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX = ErrorResponse -export const DeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX = ErrorResponse -export type BetaMessagesPostParams = { readonly "anthropic-beta"?: string; readonly "anthropic-version"?: string } -export const BetaMessagesPostParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) + "type": Schema.Literal("tool_search_tool_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestToolSearchToolResultBlock" }) +export type ResponseWebFetchToolResultBlock = { + readonly "caller": DirectCaller | ServerToolCaller | ServerToolCaller_20260120 + readonly "content": ResponseWebFetchToolResultError | ResponseWebFetchResultBlock + readonly "tool_use_id": string + readonly "type": "web_fetch_tool_result" +} +export const ResponseWebFetchToolResultBlock = Schema.Struct({ + "caller": Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({ + "title": "Caller", + "default": { "type": "direct" } + }), + "content": Schema.Union([ResponseWebFetchToolResultError, ResponseWebFetchResultBlock]).annotate({ + "title": "Content" + }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) - ) -}) -export type BetaMessagesPostRequestJson = BetaCreateMessageParams -export const BetaMessagesPostRequestJson = BetaCreateMessageParams -export type BetaMessagesPost200 = BetaMessage -export const BetaMessagesPost200 = BetaMessage -export type BetaMessagesPost4XX = BetaErrorResponse -export const BetaMessagesPost4XX = BetaErrorResponse -export type BetaModelsListParams = { - readonly "before_id"?: string - readonly "after_id"?: string - readonly "limit"?: number - readonly "anthropic-version"?: string - readonly "x-api-key"?: string - readonly "anthropic-beta"?: string + "type": Schema.Literal("web_fetch_tool_result").annotate({ "title": "Type", "default": "web_fetch_tool_result" }) +}).annotate({ "title": "ResponseWebFetchToolResultBlock" }) +export type ListResponse_ModelInfo_ = { + readonly "data": ReadonlyArray + readonly "first_id": string | null + readonly "has_more": boolean + readonly "last_id": string | null } -export const BetaModelsListParams = Schema.Struct({ - "before_id": Schema.optionalKey( - Schema.String.annotate({ - "title": "Before Id", - "description": - "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object." - }) - ), - "after_id": Schema.optionalKey( - Schema.String.annotate({ - "title": "After Id", - "description": - "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object." +export const ListResponse_ModelInfo_ = Schema.Struct({ + "data": Schema.Array(ModelInfo).annotate({ "title": "Data" }), + "first_id": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "First Id", + "description": "First ID in the `data` list. Can be used as the `before_id` for the previous page." + }), + "has_more": Schema.Boolean.annotate({ + "title": "Has More", + "description": "Indicates if there are more results in the requested page direction." + }), + "last_id": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Last Id", + "description": "Last ID in the `data` list. Can be used as the `after_id` for the next page." + }) +}).annotate({ "title": "ListResponse[ModelInfo]" }) +export type RequestDocumentBlock = { + readonly "cache_control"?: CacheControlEphemeral | null + readonly "citations"?: RequestCitationsConfig | null + readonly "context"?: string | null + readonly "source": Base64PDFSource | PlainTextSource | ContentBlockSource | URLPDFSource + readonly "title"?: string | null + readonly "type": "document" +} +export const RequestDocumentBlock = Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." }) ), - "limit": Schema.optionalKey( - Schema.Number.annotate({ - "title": "Limit", - "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`.", - "default": 20 - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(1000)) + "citations": Schema.optionalKey(Schema.Union([RequestCitationsConfig, Schema.Null])), + "context": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMinLength(1)), Schema.Null]).annotate({ "title": "Context" }) ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + "source": Schema.Union([Base64PDFSource, PlainTextSource, ContentBlockSource, URLPDFSource], { mode: "oneOf" }) + .annotate({ "title": "Source" }), + "title": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(500)), Schema.Null]).annotate({ + "title": "Title" }) ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })), - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) - ) -}) -export type BetaModelsList200 = BetaListResponse_ModelInfo_ -export const BetaModelsList200 = BetaListResponse_ModelInfo_ -export type BetaModelsList4XX = BetaErrorResponse -export const BetaModelsList4XX = BetaErrorResponse -export type BetaModelsGetParams = { - readonly "anthropic-version"?: string - readonly "x-api-key"?: string - readonly "anthropic-beta"?: string + "type": Schema.Literal("document").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestDocumentBlock" }) +export type BetaMessageDeltaEvent = { + readonly "context_management"?: BetaResponseContextManagement | null + readonly "delta": BetaMessageDelta + readonly "type": "message_delta" + readonly "usage": { + readonly "cache_creation_input_tokens": number | null + readonly "cache_read_input_tokens": number | null + readonly "input_tokens": number | null + readonly "iterations"?: BetaIterationsUsage + readonly "output_tokens": number + readonly "server_tool_use"?: BetaServerToolUsage | null + } } -export const BetaModelsGetParams = Schema.Struct({ - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." +export const BetaMessageDeltaEvent = Schema.Struct({ + "context_management": Schema.optionalKey( + Schema.Union([BetaResponseContextManagement, Schema.Null]).annotate({ + "description": "Information about context management strategies applied during the request", + "default": null }) ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", + "delta": BetaMessageDelta, + "type": Schema.Literal("message_delta").annotate({ "title": "Type", "default": "message_delta" }), + "usage": Schema.Struct({ + "cache_creation_input_tokens": Schema.Union([ + Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + Schema.Null + ]).annotate({ + "title": "Cache Creation Input Tokens", + "description": "The cumulative number of input tokens used to create the cache entry.", + "default": null + }), + "cache_read_input_tokens": Schema.Union([ + Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + Schema.Null + ]).annotate({ + "title": "Cache Read Input Tokens", + "description": "The cumulative number of input tokens read from the cache.", + "default": null + }), + "input_tokens": Schema.Union([ + Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + Schema.Null + ]).annotate({ + "title": "Input Tokens", + "description": "The cumulative number of input tokens which were used.", + "default": null + }), + "iterations": Schema.optionalKey(BetaIterationsUsage), + "output_tokens": Schema.Number.annotate({ + "title": "Output Tokens", + "description": "The cumulative number of output tokens which were used." + }).check(Schema.isInt()), + "server_tool_use": Schema.optionalKey( + Schema.Union([BetaServerToolUsage, Schema.Null]).annotate({ + "description": "The number of server tool requests.", + "default": null + }) + ) + }).annotate({ + "title": "MessageDeltaUsage", "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })), - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) + "Billing and rate-limit usage.\n\nAnthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.\n\nUnder the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.\n\nFor example, `output_tokens` will be non-zero, even for an empty string response from Claude.\n\nTotal input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`." + }) +}).annotate({ "title": "MessageDeltaEvent" }) +export type BetaManagedAgentsListAgentVersions = { + readonly "data"?: ReadonlyArray + readonly "next_page"?: string +} +export const BetaManagedAgentsListAgentVersions = Schema.Struct({ + "data": Schema.optionalKey(Schema.Array(BetaManagedAgentsAgent).annotate({ "description": "Agent versions." })), + "next_page": Schema.optionalKey( + Schema.String.annotate({ "description": "Opaque cursor for the next page. Null when no more results." }) ) -}) -export type BetaModelsGet200 = BetaModelInfo -export const BetaModelsGet200 = BetaModelInfo -export type BetaModelsGet4XX = BetaErrorResponse -export const BetaModelsGet4XX = BetaErrorResponse -export type BetaMessageBatchesListParams = { - readonly "before_id"?: string - readonly "after_id"?: string - readonly "limit"?: number - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string +}).annotate({ "description": "Paginated list of agent versions." }) +export type BetaManagedAgentsListAgents = { + readonly "data"?: ReadonlyArray + readonly "next_page"?: string +} +export const BetaManagedAgentsListAgents = Schema.Struct({ + "data": Schema.optionalKey(Schema.Array(BetaManagedAgentsAgent).annotate({ "description": "List of agents." })), + "next_page": Schema.optionalKey( + Schema.String.annotate({ "description": "Opaque cursor for the next page. Null when no more results." }) + ) +}).annotate({ "description": "Paginated list of agents." }) +export type BetaManagedAgentsListSessionThreads = { + readonly "data"?: ReadonlyArray + readonly "next_page"?: string } -export const BetaMessageBatchesListParams = Schema.Struct({ - "before_id": Schema.optionalKey( - Schema.String.annotate({ - "title": "Before Id", - "description": - "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object." - }) - ), - "after_id": Schema.optionalKey( - Schema.String.annotate({ - "title": "After Id", - "description": - "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object." - }) - ), - "limit": Schema.optionalKey( - Schema.Number.annotate({ - "title": "Limit", - "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`.", - "default": 20 - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(1000)) - ), - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." +export const BetaManagedAgentsListSessionThreads = Schema.Struct({ + "data": Schema.optionalKey( + Schema.Array(BetaManagedAgentsSessionThread).annotate({ + "description": "Threads in the session, primary first then children in spawn order." }) ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) - ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type BetaMessageBatchesList200 = BetaListResponse_MessageBatch_ -export const BetaMessageBatchesList200 = BetaListResponse_MessageBatch_ -export type BetaMessageBatchesList4XX = BetaErrorResponse -export const BetaMessageBatchesList4XX = BetaErrorResponse -export type BetaMessageBatchesPostParams = { readonly "anthropic-beta"?: string; readonly "anthropic-version"?: string } -export const BetaMessageBatchesPostParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) - ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) + "next_page": Schema.optionalKey( + Schema.String.annotate({ "description": "Opaque cursor for the next page. Null when no more results." }) ) -}) -export type BetaMessageBatchesPostRequestJson = BetaCreateMessageBatchParams -export const BetaMessageBatchesPostRequestJson = BetaCreateMessageBatchParams -export type BetaMessageBatchesPost200 = BetaMessageBatch -export const BetaMessageBatchesPost200 = BetaMessageBatch -export type BetaMessageBatchesPost4XX = BetaErrorResponse -export const BetaMessageBatchesPost4XX = BetaErrorResponse -export type BetaMessageBatchesRetrieveParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string +}).annotate({ "description": "Paginated list of threads within a `session`." }) +export type BetaManagedAgentsSessionMultiagentCoordinator = { + readonly "type": "coordinator" + readonly "agents": ReadonlyArray +} +export const BetaManagedAgentsSessionMultiagentCoordinator = Schema.Struct({ + "type": Schema.Literal("coordinator"), + "agents": Schema.Array(BetaManagedAgentsSessionThreadAgent).annotate({ + "description": "Full `agent` definitions the coordinator may spawn as session threads." + }) +}).annotate({ "description": "Resolved coordinator topology with full agent definitions for each roster member." }) +export type BetaContentBlockStartEvent = { + readonly "content_block": + | BetaResponseTextBlock + | BetaResponseThinkingBlock + | BetaResponseRedactedThinkingBlock + | BetaResponseToolUseBlock + | BetaResponseServerToolUseBlock + | BetaResponseWebSearchToolResultBlock + | BetaResponseWebFetchToolResultBlock + | BetaResponseAdvisorToolResultBlock + | BetaResponseCodeExecutionToolResultBlock + | BetaResponseBashCodeExecutionToolResultBlock + | BetaResponseTextEditorCodeExecutionToolResultBlock + | BetaResponseToolSearchToolResultBlock + | BetaResponseMCPToolUseBlock + | BetaResponseMCPToolResultBlock + | BetaResponseContainerUploadBlock + | BetaResponseCompactionBlock + readonly "index": number + readonly "type": "content_block_start" } -export const BetaMessageBatchesRetrieveParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) - ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) - ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type BetaMessageBatchesRetrieve200 = BetaMessageBatch -export const BetaMessageBatchesRetrieve200 = BetaMessageBatch -export type BetaMessageBatchesRetrieve4XX = BetaErrorResponse -export const BetaMessageBatchesRetrieve4XX = BetaErrorResponse -export type BetaMessageBatchesDeleteParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string +export const BetaContentBlockStartEvent = Schema.Struct({ + "content_block": Schema.Union([ + BetaResponseTextBlock, + BetaResponseThinkingBlock, + BetaResponseRedactedThinkingBlock, + BetaResponseToolUseBlock, + BetaResponseServerToolUseBlock, + BetaResponseWebSearchToolResultBlock, + BetaResponseWebFetchToolResultBlock, + BetaResponseAdvisorToolResultBlock, + BetaResponseCodeExecutionToolResultBlock, + BetaResponseBashCodeExecutionToolResultBlock, + BetaResponseTextEditorCodeExecutionToolResultBlock, + BetaResponseToolSearchToolResultBlock, + BetaResponseMCPToolUseBlock, + BetaResponseMCPToolResultBlock, + BetaResponseContainerUploadBlock, + BetaResponseCompactionBlock + ], { mode: "oneOf" }).annotate({ "title": "Content Block" }), + "index": Schema.Number.annotate({ "title": "Index" }).check(Schema.isInt()), + "type": Schema.Literal("content_block_start").annotate({ "title": "Type", "default": "content_block_start" }) +}).annotate({ "title": "ContentBlockStartEvent" }) +export type BetaContentBlock = + | BetaResponseTextBlock + | BetaResponseThinkingBlock + | BetaResponseRedactedThinkingBlock + | BetaResponseToolUseBlock + | BetaResponseServerToolUseBlock + | BetaResponseWebSearchToolResultBlock + | BetaResponseWebFetchToolResultBlock + | BetaResponseAdvisorToolResultBlock + | BetaResponseCodeExecutionToolResultBlock + | BetaResponseBashCodeExecutionToolResultBlock + | BetaResponseTextEditorCodeExecutionToolResultBlock + | BetaResponseToolSearchToolResultBlock + | BetaResponseMCPToolUseBlock + | BetaResponseMCPToolResultBlock + | BetaResponseContainerUploadBlock + | BetaResponseCompactionBlock +export const BetaContentBlock = Schema.Union([ + BetaResponseTextBlock, + BetaResponseThinkingBlock, + BetaResponseRedactedThinkingBlock, + BetaResponseToolUseBlock, + BetaResponseServerToolUseBlock, + BetaResponseWebSearchToolResultBlock, + BetaResponseWebFetchToolResultBlock, + BetaResponseAdvisorToolResultBlock, + BetaResponseCodeExecutionToolResultBlock, + BetaResponseBashCodeExecutionToolResultBlock, + BetaResponseTextEditorCodeExecutionToolResultBlock, + BetaResponseToolSearchToolResultBlock, + BetaResponseMCPToolUseBlock, + BetaResponseMCPToolResultBlock, + BetaResponseContainerUploadBlock, + BetaResponseCompactionBlock +], { mode: "oneOf" }) +export type BetaRequestWebFetchResultBlock = { + readonly "content": BetaRequestDocumentBlock + readonly "retrieved_at"?: string | null + readonly "type": "web_fetch_result" + readonly "url": string } -export const BetaMessageBatchesDeleteParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) - ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." +export const BetaRequestWebFetchResultBlock = Schema.Struct({ + "content": BetaRequestDocumentBlock, + "retrieved_at": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Retrieved At", + "description": "ISO 8601 timestamp when the content was retrieved" }) ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type BetaMessageBatchesDelete200 = BetaDeleteMessageBatchResponse -export const BetaMessageBatchesDelete200 = BetaDeleteMessageBatchResponse -export type BetaMessageBatchesDelete4XX = BetaErrorResponse -export const BetaMessageBatchesDelete4XX = BetaErrorResponse -export type BetaMessageBatchesCancelParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string + "type": Schema.Literal("web_fetch_result").annotate({ "title": "Type" }), + "url": Schema.String.annotate({ "title": "Url", "description": "Fetched content URL" }) +}).annotate({ "title": "RequestWebFetchResultBlock" }) +export type ContentBlockStartEvent = { + readonly "content_block": + | ResponseTextBlock + | ResponseThinkingBlock + | ResponseRedactedThinkingBlock + | ResponseToolUseBlock + | ResponseServerToolUseBlock + | ResponseWebSearchToolResultBlock + | ResponseWebFetchToolResultBlock + | ResponseCodeExecutionToolResultBlock + | ResponseBashCodeExecutionToolResultBlock + | ResponseTextEditorCodeExecutionToolResultBlock + | ResponseToolSearchToolResultBlock + | ResponseContainerUploadBlock + readonly "index": number + readonly "type": "content_block_start" } -export const BetaMessageBatchesCancelParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) - ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) - ) -}) -export type BetaMessageBatchesCancel200 = BetaMessageBatch -export const BetaMessageBatchesCancel200 = BetaMessageBatch -export type BetaMessageBatchesCancel4XX = BetaErrorResponse -export const BetaMessageBatchesCancel4XX = BetaErrorResponse -export type BetaMessageBatchesResultsParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string +export const ContentBlockStartEvent = Schema.Struct({ + "content_block": Schema.Union([ + ResponseTextBlock, + ResponseThinkingBlock, + ResponseRedactedThinkingBlock, + ResponseToolUseBlock, + ResponseServerToolUseBlock, + ResponseWebSearchToolResultBlock, + ResponseWebFetchToolResultBlock, + ResponseCodeExecutionToolResultBlock, + ResponseBashCodeExecutionToolResultBlock, + ResponseTextEditorCodeExecutionToolResultBlock, + ResponseToolSearchToolResultBlock, + ResponseContainerUploadBlock + ], { mode: "oneOf" }).annotate({ "title": "Content Block" }), + "index": Schema.Number.annotate({ "title": "Index" }).check(Schema.isInt()), + "type": Schema.Literal("content_block_start").annotate({ "title": "Type", "default": "content_block_start" }) +}).annotate({ "title": "ContentBlockStartEvent" }) +export type ContentBlock = + | ResponseTextBlock + | ResponseThinkingBlock + | ResponseRedactedThinkingBlock + | ResponseToolUseBlock + | ResponseServerToolUseBlock + | ResponseWebSearchToolResultBlock + | ResponseWebFetchToolResultBlock + | ResponseCodeExecutionToolResultBlock + | ResponseBashCodeExecutionToolResultBlock + | ResponseTextEditorCodeExecutionToolResultBlock + | ResponseToolSearchToolResultBlock + | ResponseContainerUploadBlock +export const ContentBlock = Schema.Union([ + ResponseTextBlock, + ResponseThinkingBlock, + ResponseRedactedThinkingBlock, + ResponseToolUseBlock, + ResponseServerToolUseBlock, + ResponseWebSearchToolResultBlock, + ResponseWebFetchToolResultBlock, + ResponseCodeExecutionToolResultBlock, + ResponseBashCodeExecutionToolResultBlock, + ResponseTextEditorCodeExecutionToolResultBlock, + ResponseToolSearchToolResultBlock, + ResponseContainerUploadBlock +], { mode: "oneOf" }) +export type RequestWebFetchResultBlock = { + readonly "content": RequestDocumentBlock + readonly "retrieved_at"?: string | null + readonly "type": "web_fetch_result" + readonly "url": string } -export const BetaMessageBatchesResultsParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." +export const RequestWebFetchResultBlock = Schema.Struct({ + "content": RequestDocumentBlock, + "retrieved_at": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Retrieved At", + "description": "ISO 8601 timestamp when the content was retrieved" }) ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) - ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type BetaMessageBatchesResults4XX = BetaErrorResponse -export const BetaMessageBatchesResults4XX = BetaErrorResponse -export type BetaMessagesCountTokensPostParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string -} -export const BetaMessagesCountTokensPostParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) - ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) - ) + "type": Schema.Literal("web_fetch_result").annotate({ "title": "Type" }), + "url": Schema.String.annotate({ "title": "Url", "description": "Fetched content URL" }) +}).annotate({ "title": "RequestWebFetchResultBlock" }) +export type BetaManagedAgentsSessionAgent = { + readonly "type": "agent" + readonly "id": string + readonly "version": number + readonly "name": string + readonly "description": string + readonly "model": BetaManagedAgentsModelConfig + readonly "system": string + readonly "tools": ReadonlyArray + readonly "mcp_servers": ReadonlyArray + readonly "skills": ReadonlyArray + readonly "multiagent": BetaManagedAgentsSessionMultiagentCoordinator +} +export const BetaManagedAgentsSessionAgent = Schema.Struct({ + "type": Schema.Literal("agent"), + "id": Schema.String, + "version": Schema.Number.annotate({ "format": "int32" }).check(Schema.isInt()), + "name": Schema.String, + "description": Schema.String, + "model": BetaManagedAgentsModelConfig, + "system": Schema.String, + "tools": Schema.Array(BetaManagedAgentsAgentTool), + "mcp_servers": Schema.Array(BetaManagedAgentsMCPServer), + "skills": Schema.Array(BetaManagedAgentsSkill), + "multiagent": Schema.Union([BetaManagedAgentsSessionMultiagentCoordinator], { mode: "oneOf" }).annotate({ + "description": "Resolved multiagent orchestration configuration as returned on a `session`." + }) +}).annotate({ + "description": "Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time." }) -export type BetaMessagesCountTokensPostRequestJson = BetaCountMessageTokensParams -export const BetaMessagesCountTokensPostRequestJson = BetaCountMessageTokensParams -export type BetaMessagesCountTokensPost200 = BetaCountMessageTokensResponse -export const BetaMessagesCountTokensPost200 = BetaCountMessageTokensResponse -export type BetaMessagesCountTokensPost4XX = BetaErrorResponse -export const BetaMessagesCountTokensPost4XX = BetaErrorResponse -export type BetaListFilesV1FilesGetParams = { - readonly "before_id"?: string - readonly "after_id"?: string - readonly "limit"?: number - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string -} -export const BetaListFilesV1FilesGetParams = Schema.Struct({ - "before_id": Schema.optionalKey( - Schema.String.annotate({ - "title": "Before Id", - "description": - "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object." - }) - ), - "after_id": Schema.optionalKey( - Schema.String.annotate({ - "title": "After Id", +export type BetaManagedAgentsSessionEvent = + | { + readonly "type": "user.message" + readonly "id": string + readonly "content": ReadonlyArray + readonly "processed_at"?: string + } + | { + readonly "type": "user.interrupt" + readonly "id": string + readonly "processed_at"?: string + readonly "session_thread_id"?: string + } + | { + readonly "type": "user.tool_confirmation" + readonly "id": string + readonly "tool_use_id": string + readonly "result": "allow" | "deny" + readonly "deny_message"?: string + readonly "processed_at"?: string + readonly "session_thread_id"?: string + } + | { + readonly "type": "user.custom_tool_result" + readonly "id": string + readonly "custom_tool_use_id": string + readonly "content"?: ReadonlyArray + readonly "is_error"?: boolean + readonly "processed_at"?: string + readonly "session_thread_id"?: string + } + | { + readonly "type": "agent.custom_tool_use" + readonly "id": string + readonly "name": string + readonly "input": { readonly [x: string]: unknown } + readonly "processed_at": string + readonly "session_thread_id"?: string + } + | { + readonly "type": "agent.message" + readonly "id": string + readonly "content": ReadonlyArray + readonly "processed_at": string + } + | { readonly "type": "agent.thinking"; readonly "id": string; readonly "processed_at": string } + | { + readonly "type": "agent.mcp_tool_use" + readonly "id": string + readonly "name": string + readonly "mcp_server_name": string + readonly "input": { readonly [x: string]: unknown } + readonly "processed_at": string + readonly "evaluated_permission"?: "allow" | "ask" | "deny" + readonly "session_thread_id"?: string + } + | { + readonly "type": "agent.mcp_tool_result" + readonly "id": string + readonly "mcp_tool_use_id": string + readonly "content"?: ReadonlyArray + readonly "is_error"?: boolean + readonly "processed_at": string + } + | { + readonly "type": "agent.tool_use" + readonly "id": string + readonly "name": string + readonly "input": { readonly [x: string]: unknown } + readonly "processed_at": string + readonly "evaluated_permission"?: "allow" | "ask" | "deny" + readonly "session_thread_id"?: string + } + | { + readonly "type": "agent.tool_result" + readonly "id": string + readonly "tool_use_id": string + readonly "content"?: ReadonlyArray + readonly "is_error"?: boolean + readonly "processed_at": string + } + | { + readonly "type": "agent.thread_message_received" + readonly "id": string + readonly "processed_at": string + readonly "from_agent_name"?: string + readonly "content": ReadonlyArray + readonly "from_session_thread_id": string + } + | { + readonly "type": "agent.thread_message_sent" + readonly "id": string + readonly "processed_at": string + readonly "to_agent_name"?: string + readonly "content": ReadonlyArray + readonly "to_session_thread_id": string + } + | { readonly "type": "agent.thread_context_compacted"; readonly "id": string; readonly "processed_at": string } + | { + readonly "type": "session.error" + readonly "id": string + readonly "processed_at": string + readonly "error": { + readonly "type": "unknown_error" + readonly "message": string + readonly "retry_status": { readonly "type": "retrying" } | { readonly "type": "exhausted" } | { + readonly "type": "terminal" + } + } | { + readonly "type": "model_overloaded_error" + readonly "message": string + readonly "retry_status": { readonly "type": "retrying" } | { readonly "type": "exhausted" } | { + readonly "type": "terminal" + } + } | { + readonly "type": "model_rate_limited_error" + readonly "message": string + readonly "retry_status": { readonly "type": "retrying" } | { readonly "type": "exhausted" } | { + readonly "type": "terminal" + } + } | { + readonly "type": "model_request_failed_error" + readonly "message": string + readonly "retry_status": { readonly "type": "retrying" } | { readonly "type": "exhausted" } | { + readonly "type": "terminal" + } + } | { + readonly "type": "mcp_connection_failed_error" + readonly "message": string + readonly "retry_status": { readonly "type": "retrying" } | { readonly "type": "exhausted" } | { + readonly "type": "terminal" + } + readonly "mcp_server_name": string + } | { + readonly "type": "mcp_authentication_failed_error" + readonly "message": string + readonly "retry_status": { readonly "type": "retrying" } | { readonly "type": "exhausted" } | { + readonly "type": "terminal" + } + readonly "mcp_server_name": string + } | { + readonly "type": "billing_error" + readonly "message": string + readonly "retry_status": { readonly "type": "retrying" } | { readonly "type": "exhausted" } | { + readonly "type": "terminal" + } + } + } + | { readonly "type": "session.status_rescheduled"; readonly "id": string; readonly "processed_at": string } + | { readonly "type": "session.status_running"; readonly "id": string; readonly "processed_at": string } + | { + readonly "type": "session.status_idle" + readonly "id": string + readonly "processed_at": string + readonly "stop_reason": { readonly "type": "end_turn" } | { + readonly "type": "requires_action" + readonly "event_ids": ReadonlyArray + } | { readonly "type": "retries_exhausted" } + } + | { readonly "type": "session.status_terminated"; readonly "id": string; readonly "processed_at": string } + | { + readonly "type": "session.thread_created" + readonly "id": string + readonly "processed_at": string + readonly "agent_name": string + readonly "session_thread_id": string + } + | { + readonly "type": "span.outcome_evaluation_start" + readonly "id": string + readonly "processed_at": string + readonly "iteration": number + readonly "outcome_id": string + } + | { + readonly "type": "span.outcome_evaluation_end" + readonly "id": string + readonly "processed_at": string + readonly "outcome_evaluation_start_id": string + readonly "iteration": number + readonly "result": string + readonly "explanation": string + readonly "usage": { + readonly "input_tokens": number + readonly "output_tokens": number + readonly "cache_creation_input_tokens": number + readonly "cache_read_input_tokens": number + readonly "speed"?: "standard" | "fast" + } + readonly "outcome_id": string + } + | { readonly "type": "span.model_request_start"; readonly "id": string; readonly "processed_at": string } + | { + readonly "type": "span.model_request_end" + readonly "id": string + readonly "processed_at": string + readonly "is_error": boolean + readonly "model_usage": { + readonly "input_tokens": number + readonly "output_tokens": number + readonly "cache_creation_input_tokens": number + readonly "cache_read_input_tokens": number + readonly "speed"?: "standard" | "fast" + } + readonly "model_request_start_id": string + } + | { + readonly "type": "span.outcome_evaluation_ongoing" + readonly "id": string + readonly "processed_at": string + readonly "iteration": number + readonly "outcome_id": string + } + | { + readonly "type": "user.define_outcome" + readonly "id": string + readonly "processed_at": string + readonly "outcome_id": string + readonly "description": string + readonly "max_iterations": number + readonly "rubric": BetaManagedAgentsFileRubric | BetaManagedAgentsTextRubric + } + | { readonly "type": "session.deleted"; readonly "id": string; readonly "processed_at": string } + | { + readonly "type": "session.thread_status_running" + readonly "id": string + readonly "session_thread_id": string + readonly "processed_at": string + readonly "agent_name": string + } + | { + readonly "type": "session.thread_status_idle" + readonly "id": string + readonly "session_thread_id": string + readonly "processed_at": string + readonly "agent_name": string + readonly "stop_reason": { readonly "type": "end_turn" } | { + readonly "type": "requires_action" + readonly "event_ids": ReadonlyArray + } | { readonly "type": "retries_exhausted" } + } + | { + readonly "type": "session.thread_status_terminated" + readonly "id": string + readonly "session_thread_id": string + readonly "processed_at": string + readonly "agent_name": string + } + | { + readonly "type": "user.tool_result" + readonly "id": string + readonly "tool_use_id": string + readonly "content"?: ReadonlyArray + readonly "is_error"?: boolean + readonly "processed_at"?: string + readonly "session_thread_id"?: string + } + | { + readonly "type": "session.thread_status_rescheduled" + readonly "id": string + readonly "session_thread_id": string + readonly "processed_at": string + readonly "agent_name": string + } + | { + readonly "type": "session.updated" + readonly "id": string + readonly "processed_at": string + readonly "title"?: string + readonly "metadata"?: { readonly [x: string]: string } + readonly "agent"?: { + readonly "type": "agent" + readonly "id": string + readonly "version": number + readonly "name": string + readonly "description": string + readonly "model": BetaManagedAgentsModelConfig + readonly "system": string + readonly "tools": ReadonlyArray + readonly "mcp_servers": ReadonlyArray + readonly "skills": ReadonlyArray + readonly "multiagent": BetaManagedAgentsSessionMultiagentCoordinator + } + } +export const BetaManagedAgentsSessionEvent = Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("user.message"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "content": Schema.Array(BetaManagedAgentsUserContentBlock).annotate({ + "description": "Array of content blocks comprising the user message." + }), + "processed_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("user.interrupt"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread." + }) + ) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("user.tool_confirmation"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "tool_use_id": Schema.String.annotate({ "description": - "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object." - }) - ), - "limit": Schema.optionalKey( - Schema.Number.annotate({ - "title": "Limit", - "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`.", - "default": 20 - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(1000)) - ), - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", + "The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field." + }), + "result": Schema.Literals(["allow", "deny"]).annotate({ "description": "UserToolConfirmationResult enum" }), + "deny_message": Schema.optionalKey( + Schema.String.annotate({ + "description": "Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'." + }).check(Schema.isMaxLength(10000)) + ), + "processed_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "When set, the confirmation routes to this subagent's thread rather than the primary. Echo this from the `session_thread_id` on the `agent.tool_use` or `agent.mcp_tool_use` event that prompted the approval." + }) + ) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("user.custom_tool_result"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "custom_tool_use_id": Schema.String.annotate({ "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + "The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field." + }), + "content": Schema.optionalKey( + Schema.Array(BetaManagedAgentsToolResultContentBlock).annotate({ + "description": "The result content returned by the tool." + }) + ), + "is_error": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether the tool execution resulted in an error." }) + ), + "processed_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Routes this result to a subagent thread. Copy from the `agent.custom_tool_use` event's `session_thread_id`." + }) + ) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("agent.custom_tool_use"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "name": Schema.String.annotate({ "description": "Name of the custom tool being called." }), + "input": Schema.Record(Schema.String, Schema.Unknown).annotate({ + "description": "Input parameters for the tool call." + }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "When set, this event was cross-posted from a subagent's thread to surface its custom tool use on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.custom_tool_result` event to route the result back." + }) + ) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("agent.message"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "content": Schema.Array(BetaManagedAgentsTextBlock).annotate({ + "description": "Array of text blocks comprising the agent response." + }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("agent.thinking"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("agent.mcp_tool_use"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "name": Schema.String.annotate({ "description": "Name of the MCP tool being used." }), + "mcp_server_name": Schema.String.annotate({ "description": "Name of the MCP server providing the tool." }), + "input": Schema.Record(Schema.String, Schema.Unknown).annotate({ + "description": "Input parameters for the tool call." + }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "evaluated_permission": Schema.optionalKey( + Schema.Literals(["allow", "ask", "deny"]).annotate({ "description": "AgentEvaluatedPermission enum" }) + ), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.tool_confirmation` event to route the approval back." + }) + ) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("agent.mcp_tool_result"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "mcp_tool_use_id": Schema.String.annotate({ + "description": "The id of the `agent.mcp_tool_use` event this result corresponds to." + }), + "content": Schema.optionalKey( + Schema.Array(BetaManagedAgentsToolResultContentBlock).annotate({ + "description": "The result content returned by the tool." + }) + ), + "is_error": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether the tool execution resulted in an error." }) + ), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("agent.tool_use"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "name": Schema.String.annotate({ "description": "Name of the agent tool being used." }), + "input": Schema.Record(Schema.String, Schema.Unknown).annotate({ + "description": "Input parameters for the tool call." + }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "evaluated_permission": Schema.optionalKey( + Schema.Literals(["allow", "ask", "deny"]).annotate({ "description": "AgentEvaluatedPermission enum" }) + ), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.tool_confirmation` event to route the approval back." + }) + ) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("agent.tool_result"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "tool_use_id": Schema.String.annotate({ + "description": "The id of the `agent.tool_use` event this result corresponds to." + }), + "content": Schema.optionalKey( + Schema.Array(BetaManagedAgentsToolResultContentBlock).annotate({ + "description": "The result content returned by the tool." + }) + ), + "is_error": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether the tool execution resulted in an error." }) + ), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("agent.thread_message_received"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "from_agent_name": Schema.optionalKey( + Schema.String.annotate({ + "description": "Name of the callable agent this message came from. Absent when received from the primary agent." + }) + ), + "content": Schema.Array(BetaManagedAgentsUserContentBlock).annotate({ "description": "Message content blocks." }), + "from_session_thread_id": Schema.String.annotate({ + "description": "Public `sthr_` ID of the thread that sent the message." }) - ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("agent.thread_message_sent"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "to_agent_name": Schema.optionalKey( + Schema.String.annotate({ + "description": "Name of the callable agent this message was sent to. Absent when sent to the primary agent." + }) + ), + "content": Schema.Array(BetaManagedAgentsUserContentBlock).annotate({ "description": "Message content blocks." }), + "to_session_thread_id": Schema.String.annotate({ + "description": "Public `sthr_` ID of the thread the message was sent to." }) - ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type BetaListFilesV1FilesGet200 = BetaFileListResponse -export const BetaListFilesV1FilesGet200 = BetaFileListResponse -export type BetaListFilesV1FilesGet4XX = BetaErrorResponse -export const BetaListFilesV1FilesGet4XX = BetaErrorResponse -export type BetaUploadFileV1FilesPostParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string -} -export const BetaUploadFileV1FilesPostParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) - ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) - ) -}) -export type BetaUploadFileV1FilesPostRequestFormData = { readonly "file": string } -export const BetaUploadFileV1FilesPostRequestFormData = Schema.Struct({ - "file": Schema.String.annotate({ "description": "The file to upload", "format": "binary" }) -}) -export type BetaUploadFileV1FilesPost200 = BetaFileMetadataSchema -export const BetaUploadFileV1FilesPost200 = BetaFileMetadataSchema -export type BetaUploadFileV1FilesPost4XX = BetaErrorResponse -export const BetaUploadFileV1FilesPost4XX = BetaErrorResponse -export type BetaGetFileMetadataV1FilesFileIdGetParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string -} -export const BetaGetFileMetadataV1FilesFileIdGetParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) - ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) - ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type BetaGetFileMetadataV1FilesFileIdGet200 = BetaFileMetadataSchema -export const BetaGetFileMetadataV1FilesFileIdGet200 = BetaFileMetadataSchema -export type BetaGetFileMetadataV1FilesFileIdGet4XX = BetaErrorResponse -export const BetaGetFileMetadataV1FilesFileIdGet4XX = BetaErrorResponse -export type BetaDeleteFileV1FilesFileIdDeleteParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string -} -export const BetaDeleteFileV1FilesFileIdDeleteParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) - ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) - ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type BetaDeleteFileV1FilesFileIdDelete200 = BetaFileDeleteResponse -export const BetaDeleteFileV1FilesFileIdDelete200 = BetaFileDeleteResponse -export type BetaDeleteFileV1FilesFileIdDelete4XX = BetaErrorResponse -export const BetaDeleteFileV1FilesFileIdDelete4XX = BetaErrorResponse -export type BetaDownloadFileV1FilesFileIdContentGetParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string -} -export const BetaDownloadFileV1FilesFileIdContentGetParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) - ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) - ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type BetaListSkillsV1SkillsGetParams = { - readonly "page"?: string | null - readonly "limit"?: number - readonly "source"?: string | null - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string -} -export const BetaListSkillsV1SkillsGetParams = Schema.Struct({ - "page": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Page", - "description": - "Pagination token for fetching a specific page of results.\n\nPass the value from a previous response's `next_page` field to get the next page of results." - }) - ), - "limit": Schema.optionalKey( - Schema.Number.annotate({ - "title": "Limit", - "description": "Number of results to return per page.\n\nMaximum value is 100. Defaults to 20.", - "default": 20 - }).check(Schema.isInt()) - ), - "source": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Source", + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("agent.thread_context_compacted"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("session.error"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "error": Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("unknown_error"), + "message": Schema.String.annotate({ "description": "Human-readable error description." }), + "retry_status": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("retrying") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("exhausted") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("terminal") }).annotate({ + "description": "What the client should do next in response to this error." + }) + ], { mode: "oneOf" }).annotate({ "description": "What the client should do next." }) + }).annotate({ + "description": + "An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone." + }), + Schema.Struct({ + "type": Schema.Literal("model_overloaded_error"), + "message": Schema.String.annotate({ "description": "Human-readable error description." }), + "retry_status": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("retrying") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("exhausted") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("terminal") }).annotate({ + "description": "What the client should do next in response to this error." + }) + ], { mode: "oneOf" }).annotate({ "description": "What the client should do next." }) + }).annotate({ + "description": "The model is currently overloaded. Emitted after automatic retries are exhausted." + }), + Schema.Struct({ + "type": Schema.Literal("model_rate_limited_error"), + "message": Schema.String.annotate({ "description": "Human-readable error description." }), + "retry_status": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("retrying") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("exhausted") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("terminal") }).annotate({ + "description": "What the client should do next in response to this error." + }) + ], { mode: "oneOf" }).annotate({ "description": "What the client should do next." }) + }).annotate({ "description": "The model request was rate-limited." }), + Schema.Struct({ + "type": Schema.Literal("model_request_failed_error"), + "message": Schema.String.annotate({ "description": "Human-readable error description." }), + "retry_status": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("retrying") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("exhausted") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("terminal") }).annotate({ + "description": "What the client should do next in response to this error." + }) + ], { mode: "oneOf" }).annotate({ "description": "What the client should do next." }) + }).annotate({ "description": "A model request failed for a reason other than overload or rate-limiting." }), + Schema.Struct({ + "type": Schema.Literal("mcp_connection_failed_error"), + "message": Schema.String.annotate({ "description": "Human-readable error description." }), + "retry_status": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("retrying") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("exhausted") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("terminal") }).annotate({ + "description": "What the client should do next in response to this error." + }) + ], { mode: "oneOf" }).annotate({ "description": "What the client should do next." }), + "mcp_server_name": Schema.String.annotate({ "description": "Name of the MCP server that failed to connect." }) + }).annotate({ "description": "Failed to connect to an MCP server." }), + Schema.Struct({ + "type": Schema.Literal("mcp_authentication_failed_error"), + "message": Schema.String.annotate({ "description": "Human-readable error description." }), + "retry_status": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("retrying") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("exhausted") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("terminal") }).annotate({ + "description": "What the client should do next in response to this error." + }) + ], { mode: "oneOf" }).annotate({ "description": "What the client should do next." }), + "mcp_server_name": Schema.String.annotate({ + "description": "Name of the MCP server that failed authentication." + }) + }).annotate({ "description": "Authentication to an MCP server failed." }), + Schema.Struct({ + "type": Schema.Literal("billing_error"), + "message": Schema.String.annotate({ "description": "Human-readable error description." }), + "retry_status": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("retrying") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("exhausted") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("terminal") }).annotate({ + "description": "What the client should do next in response to this error." + }) + ], { mode: "oneOf" }).annotate({ "description": "What the client should do next." }) + }).annotate({ + "description": + "The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state." + }) + ], { mode: "oneOf" }) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("session.status_rescheduled"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("session.status_running"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("session.status_idle"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "stop_reason": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("end_turn") }).annotate({ + "description": "The agent completed its turn naturally and is ready for the next user message." + }), + Schema.Struct({ + "type": Schema.Literal("requires_action"), + "event_ids": Schema.Array(Schema.String).annotate({ + "description": + "The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder." + }) + }).annotate({ + "description": + "The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running." + }), + Schema.Struct({ "type": Schema.Literal("retries_exhausted") }).annotate({ + "description": + "The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`)." + }) + ], { mode: "oneOf" }) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("session.status_terminated"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("session.thread_created"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "agent_name": Schema.String.annotate({ "description": "Name of the callable agent the thread runs." }), + "session_thread_id": Schema.String.annotate({ "description": "Public `sthr_` ID of the newly created thread." }) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("span.outcome_evaluation_start"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "iteration": Schema.Number.annotate({ "description": - "Filter skills by source.\n\nIf provided, only skills from the specified source will be returned:\n* `\"custom\"`: only return user-created skills\n* `\"anthropic\"`: only return Anthropic-created skills" - }) - ), - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", + "0-indexed revision cycle. 0 is the first evaluation; 1 is the re-evaluation after the first revision; etc.", + "format": "int32" + }).check(Schema.isInt()), + "outcome_id": Schema.String.annotate({ "description": "The `outc_` ID of the outcome being evaluated." }) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("span.outcome_evaluation_end"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "outcome_evaluation_start_id": Schema.String.annotate({ + "description": "The id of the corresponding `span.outcome_evaluation_start` event." + }), + "iteration": Schema.Number.annotate({ + "description": "0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.", + "format": "int32" + }).check(Schema.isInt()), + "result": Schema.String.annotate({ "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) - ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", + "Evaluation verdict. 'satisfied': criteria met, session goes idle. 'needs_revision': criteria not met, another revision cycle follows. 'max_iterations_reached': evaluation budget exhausted with criteria still unmet — one final acknowledgment turn follows before the session goes idle, but no further evaluation runs. 'failed': grader determined the rubric does not apply to the deliverables. 'interrupted': user sent an interrupt while evaluation was in progress." + }), + "explanation": Schema.String.annotate({ "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + "Human-readable explanation of the verdict. For `needs_revision`, describes which criteria failed and why." + }), + "usage": Schema.Struct({ + "input_tokens": Schema.Number.annotate({ + "description": "Input tokens consumed by this request.", + "format": "int32" + }).check(Schema.isInt()), + "output_tokens": Schema.Number.annotate({ + "description": "Output tokens generated by this request.", + "format": "int32" + }).check(Schema.isInt()), + "cache_creation_input_tokens": Schema.Number.annotate({ + "description": "Tokens used to create prompt cache in this request.", + "format": "int32" + }).check(Schema.isInt()), + "cache_read_input_tokens": Schema.Number.annotate({ + "description": "Tokens read from prompt cache in this request.", + "format": "int32" + }).check(Schema.isInt()), + "speed": Schema.optionalKey( + Schema.Literals(["standard", "fast"]).annotate({ + "description": + "Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time." + }) + ) + }).annotate({ "description": "Token usage for a single model request." }), + "outcome_id": Schema.String.annotate({ "description": "The `outc_` ID of the outcome being evaluated." }) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("span.model_request_start"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("span.model_request_end"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "is_error": Schema.Boolean.annotate({ "description": "Whether the model request resulted in an error." }), + "model_usage": Schema.Struct({ + "input_tokens": Schema.Number.annotate({ + "description": "Input tokens consumed by this request.", + "format": "int32" + }).check(Schema.isInt()), + "output_tokens": Schema.Number.annotate({ + "description": "Output tokens generated by this request.", + "format": "int32" + }).check(Schema.isInt()), + "cache_creation_input_tokens": Schema.Number.annotate({ + "description": "Tokens used to create prompt cache in this request.", + "format": "int32" + }).check(Schema.isInt()), + "cache_read_input_tokens": Schema.Number.annotate({ + "description": "Tokens read from prompt cache in this request.", + "format": "int32" + }).check(Schema.isInt()), + "speed": Schema.optionalKey( + Schema.Literals(["standard", "fast"]).annotate({ + "description": + "Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time." + }) + ) + }).annotate({ "description": "Token usage for a single model request." }), + "model_request_start_id": Schema.String.annotate({ + "description": "The id of the corresponding `span.model_request_start` event." }) - ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type BetaListSkillsV1SkillsGet200 = BetaListSkillsResponse -export const BetaListSkillsV1SkillsGet200 = BetaListSkillsResponse -export type BetaListSkillsV1SkillsGet4XX = BetaErrorResponse -export const BetaListSkillsV1SkillsGet4XX = BetaErrorResponse -export type BetaCreateSkillV1SkillsPostParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string -} -export const BetaCreateSkillV1SkillsPostParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("span.outcome_evaluation_ongoing"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "iteration": Schema.Number.annotate({ + "description": "0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.", + "format": "int32" + }).check(Schema.isInt()), + "outcome_id": Schema.String.annotate({ "description": "The `outc_` ID of the outcome being evaluated." }) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("user.define_outcome"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "outcome_id": Schema.String.annotate({ "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + "Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list." + }), + "description": Schema.String.annotate({ + "description": "What the agent should produce. Copied from the input event." + }), + "max_iterations": Schema.Number.annotate({ + "description": "Evaluate-then-revise cycles before giving up. Default 3, max 20.", + "format": "int32" + }).check(Schema.isInt()), + "rubric": Schema.Union([BetaManagedAgentsFileRubric, BetaManagedAgentsTextRubric], { mode: "oneOf" }).annotate({ + "description": "Rubric for grading the quality of an outcome." }) - ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("session.deleted"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("session.thread_status_running"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "session_thread_id": Schema.String.annotate({ + "description": "Public sthr_ ID of the thread that started running." + }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "agent_name": Schema.String.annotate({ "description": "Name of the agent the thread runs." }) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("session.thread_status_idle"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "session_thread_id": Schema.String.annotate({ "description": "Public sthr_ ID of the thread that went idle." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "agent_name": Schema.String.annotate({ "description": "Name of the agent the thread runs." }), + "stop_reason": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("end_turn") }).annotate({ + "description": "The agent completed its turn naturally and is ready for the next user message." + }), + Schema.Struct({ + "type": Schema.Literal("requires_action"), + "event_ids": Schema.Array(Schema.String).annotate({ + "description": + "The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder." + }) + }).annotate({ + "description": + "The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running." + }), + Schema.Struct({ "type": Schema.Literal("retries_exhausted") }).annotate({ + "description": + "The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`)." + }) + ], { mode: "oneOf" }) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("session.thread_status_terminated"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "session_thread_id": Schema.String.annotate({ "description": "Public sthr_ ID of the thread that terminated." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "agent_name": Schema.String.annotate({ "description": "Name of the agent the thread runs." }) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("user.tool_result"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "tool_use_id": Schema.String.annotate({ "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) - ) -}) -export type BetaCreateSkillV1SkillsPostRequestFormData = BetaBody_create_skill_v1_skills_post -export const BetaCreateSkillV1SkillsPostRequestFormData = BetaBody_create_skill_v1_skills_post -export type BetaCreateSkillV1SkillsPost200 = BetaCreateSkillResponse -export const BetaCreateSkillV1SkillsPost200 = BetaCreateSkillResponse -export type BetaCreateSkillV1SkillsPost4XX = BetaErrorResponse -export const BetaCreateSkillV1SkillsPost4XX = BetaErrorResponse -export type BetaGetSkillV1SkillsSkillIdGetParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string -} -export const BetaGetSkillV1SkillsSkillIdGetParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) - ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", + "The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field." + }), + "content": Schema.optionalKey( + Schema.Array(BetaManagedAgentsToolResultContentBlock).annotate({ + "description": "The result content returned by the tool." + }) + ), + "is_error": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether the tool execution resulted in an error." }) + ), + "processed_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Routes this result to a subagent thread. Copy from the `agent.tool_use` event's `session_thread_id`." + }) + ) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("session.thread_status_rescheduled"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "session_thread_id": Schema.String.annotate({ "description": "Public sthr_ ID of the thread that is retrying." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "agent_name": Schema.String.annotate({ "description": "Name of the agent the thread runs." }) + }).annotate({ "description": "Union type for all event types in a session." }), + Schema.Struct({ + "type": Schema.Literal("session.updated"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "title": Schema.optionalKey( + Schema.String.annotate({ "description": "The session's new title. Present only when the update changed it." }) + ), + "metadata": Schema.optionalKey( + Schema.Record(Schema.String, Schema.String).annotate({ + "description": + "The session's full metadata bag after the update. Present when the update set non-empty metadata; absent when metadata was unchanged or cleared to empty." + }) + ), + "agent": Schema.optionalKey( + Schema.Struct({ + "type": Schema.Literal("agent"), + "id": Schema.String, + "version": Schema.Number.annotate({ "format": "int32" }).check(Schema.isInt()), + "name": Schema.String, + "description": Schema.String, + "model": BetaManagedAgentsModelConfig, + "system": Schema.String, + "tools": Schema.Array(BetaManagedAgentsAgentTool), + "mcp_servers": Schema.Array(BetaManagedAgentsMCPServer), + "skills": Schema.Array(BetaManagedAgentsSkill), + "multiagent": Schema.Union([BetaManagedAgentsSessionMultiagentCoordinator], { mode: "oneOf" }).annotate({ + "description": "Resolved multiagent orchestration configuration as returned on a `session`." + }) + }).annotate({ + "description": + "Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time." + }) + ) + }).annotate({ "description": "Union type for all event types in a session." }) +], { mode: "oneOf" }) +export type BetaManagedAgentsStreamSessionEvents = + | { + readonly "type": "user.message" + readonly "id": string + readonly "content": ReadonlyArray + readonly "processed_at"?: string + } + | { + readonly "type": "user.interrupt" + readonly "id": string + readonly "processed_at"?: string + readonly "session_thread_id"?: string + } + | { + readonly "type": "user.tool_confirmation" + readonly "id": string + readonly "tool_use_id": string + readonly "result": "allow" | "deny" + readonly "deny_message"?: string + readonly "processed_at"?: string + readonly "session_thread_id"?: string + } + | { + readonly "type": "user.custom_tool_result" + readonly "id": string + readonly "custom_tool_use_id": string + readonly "content"?: ReadonlyArray + readonly "is_error"?: boolean + readonly "processed_at"?: string + readonly "session_thread_id"?: string + } + | { + readonly "type": "agent.custom_tool_use" + readonly "id": string + readonly "name": string + readonly "input": { readonly [x: string]: unknown } + readonly "processed_at": string + readonly "session_thread_id"?: string + } + | { + readonly "type": "agent.message" + readonly "id": string + readonly "content": ReadonlyArray + readonly "processed_at": string + } + | { readonly "type": "agent.thinking"; readonly "id": string; readonly "processed_at": string } + | { + readonly "type": "agent.mcp_tool_use" + readonly "id": string + readonly "name": string + readonly "mcp_server_name": string + readonly "input": { readonly [x: string]: unknown } + readonly "processed_at": string + readonly "evaluated_permission"?: "allow" | "ask" | "deny" + readonly "session_thread_id"?: string + } + | { + readonly "type": "agent.mcp_tool_result" + readonly "id": string + readonly "mcp_tool_use_id": string + readonly "content"?: ReadonlyArray + readonly "is_error"?: boolean + readonly "processed_at": string + } + | { + readonly "type": "agent.tool_use" + readonly "id": string + readonly "name": string + readonly "input": { readonly [x: string]: unknown } + readonly "processed_at": string + readonly "evaluated_permission"?: "allow" | "ask" | "deny" + readonly "session_thread_id"?: string + } + | { + readonly "type": "agent.tool_result" + readonly "id": string + readonly "tool_use_id": string + readonly "content"?: ReadonlyArray + readonly "is_error"?: boolean + readonly "processed_at": string + } + | { + readonly "type": "agent.thread_message_received" + readonly "id": string + readonly "processed_at": string + readonly "from_agent_name"?: string + readonly "content": ReadonlyArray + readonly "from_session_thread_id": string + } + | { + readonly "type": "agent.thread_message_sent" + readonly "id": string + readonly "processed_at": string + readonly "to_agent_name"?: string + readonly "content": ReadonlyArray + readonly "to_session_thread_id": string + } + | { readonly "type": "agent.thread_context_compacted"; readonly "id": string; readonly "processed_at": string } + | { + readonly "type": "session.error" + readonly "id": string + readonly "processed_at": string + readonly "error": { + readonly "type": "unknown_error" + readonly "message": string + readonly "retry_status": { readonly "type": "retrying" } | { readonly "type": "exhausted" } | { + readonly "type": "terminal" + } + } | { + readonly "type": "model_overloaded_error" + readonly "message": string + readonly "retry_status": { readonly "type": "retrying" } | { readonly "type": "exhausted" } | { + readonly "type": "terminal" + } + } | { + readonly "type": "model_rate_limited_error" + readonly "message": string + readonly "retry_status": { readonly "type": "retrying" } | { readonly "type": "exhausted" } | { + readonly "type": "terminal" + } + } | { + readonly "type": "model_request_failed_error" + readonly "message": string + readonly "retry_status": { readonly "type": "retrying" } | { readonly "type": "exhausted" } | { + readonly "type": "terminal" + } + } | { + readonly "type": "mcp_connection_failed_error" + readonly "message": string + readonly "retry_status": { readonly "type": "retrying" } | { readonly "type": "exhausted" } | { + readonly "type": "terminal" + } + readonly "mcp_server_name": string + } | { + readonly "type": "mcp_authentication_failed_error" + readonly "message": string + readonly "retry_status": { readonly "type": "retrying" } | { readonly "type": "exhausted" } | { + readonly "type": "terminal" + } + readonly "mcp_server_name": string + } | { + readonly "type": "billing_error" + readonly "message": string + readonly "retry_status": { readonly "type": "retrying" } | { readonly "type": "exhausted" } | { + readonly "type": "terminal" + } + } + } + | { readonly "type": "session.status_rescheduled"; readonly "id": string; readonly "processed_at": string } + | { readonly "type": "session.status_running"; readonly "id": string; readonly "processed_at": string } + | { + readonly "type": "session.status_idle" + readonly "id": string + readonly "processed_at": string + readonly "stop_reason": { readonly "type": "end_turn" } | { + readonly "type": "requires_action" + readonly "event_ids": ReadonlyArray + } | { readonly "type": "retries_exhausted" } + } + | { readonly "type": "session.status_terminated"; readonly "id": string; readonly "processed_at": string } + | { + readonly "type": "session.thread_created" + readonly "id": string + readonly "processed_at": string + readonly "agent_name": string + readonly "session_thread_id": string + } + | { + readonly "type": "span.outcome_evaluation_start" + readonly "id": string + readonly "processed_at": string + readonly "iteration": number + readonly "outcome_id": string + } + | { + readonly "type": "span.outcome_evaluation_end" + readonly "id": string + readonly "processed_at": string + readonly "outcome_evaluation_start_id": string + readonly "iteration": number + readonly "result": string + readonly "explanation": string + readonly "usage": { + readonly "input_tokens": number + readonly "output_tokens": number + readonly "cache_creation_input_tokens": number + readonly "cache_read_input_tokens": number + readonly "speed"?: "standard" | "fast" + } + readonly "outcome_id": string + } + | { readonly "type": "span.model_request_start"; readonly "id": string; readonly "processed_at": string } + | { + readonly "type": "span.model_request_end" + readonly "id": string + readonly "processed_at": string + readonly "is_error": boolean + readonly "model_usage": { + readonly "input_tokens": number + readonly "output_tokens": number + readonly "cache_creation_input_tokens": number + readonly "cache_read_input_tokens": number + readonly "speed"?: "standard" | "fast" + } + readonly "model_request_start_id": string + } + | { + readonly "type": "span.outcome_evaluation_ongoing" + readonly "id": string + readonly "processed_at": string + readonly "iteration": number + readonly "outcome_id": string + } + | { + readonly "type": "user.define_outcome" + readonly "id": string + readonly "processed_at": string + readonly "outcome_id": string + readonly "description": string + readonly "max_iterations": number + readonly "rubric": BetaManagedAgentsFileRubric | BetaManagedAgentsTextRubric + } + | { readonly "type": "session.deleted"; readonly "id": string; readonly "processed_at": string } + | { + readonly "type": "session.thread_status_running" + readonly "id": string + readonly "session_thread_id": string + readonly "processed_at": string + readonly "agent_name": string + } + | { + readonly "type": "session.thread_status_idle" + readonly "id": string + readonly "session_thread_id": string + readonly "processed_at": string + readonly "agent_name": string + readonly "stop_reason": { readonly "type": "end_turn" } | { + readonly "type": "requires_action" + readonly "event_ids": ReadonlyArray + } | { readonly "type": "retries_exhausted" } + } + | { + readonly "type": "session.thread_status_terminated" + readonly "id": string + readonly "session_thread_id": string + readonly "processed_at": string + readonly "agent_name": string + } + | { + readonly "type": "user.tool_result" + readonly "id": string + readonly "tool_use_id": string + readonly "content"?: ReadonlyArray + readonly "is_error"?: boolean + readonly "processed_at"?: string + readonly "session_thread_id"?: string + } + | { + readonly "type": "session.thread_status_rescheduled" + readonly "id": string + readonly "session_thread_id": string + readonly "processed_at": string + readonly "agent_name": string + } + | { + readonly "type": "session.updated" + readonly "id": string + readonly "processed_at": string + readonly "title"?: string + readonly "metadata"?: { readonly [x: string]: string } + readonly "agent"?: { + readonly "type": "agent" + readonly "id": string + readonly "version": number + readonly "name": string + readonly "description": string + readonly "model": BetaManagedAgentsModelConfig + readonly "system": string + readonly "tools": ReadonlyArray + readonly "mcp_servers": ReadonlyArray + readonly "skills": ReadonlyArray + readonly "multiagent": BetaManagedAgentsSessionMultiagentCoordinator + } + } +export const BetaManagedAgentsStreamSessionEvents = Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("user.message"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "content": Schema.Array(BetaManagedAgentsUserContentBlock).annotate({ + "description": "Array of content blocks comprising the user message." + }), + "processed_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("user.interrupt"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread." + }) + ) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("user.tool_confirmation"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "tool_use_id": Schema.String.annotate({ "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) - ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type BetaGetSkillV1SkillsSkillIdGet200 = BetaGetSkillResponse -export const BetaGetSkillV1SkillsSkillIdGet200 = BetaGetSkillResponse -export type BetaGetSkillV1SkillsSkillIdGet4XX = BetaErrorResponse -export const BetaGetSkillV1SkillsSkillIdGet4XX = BetaErrorResponse -export type BetaDeleteSkillV1SkillsSkillIdDeleteParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string -} -export const BetaDeleteSkillV1SkillsSkillIdDeleteParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", + "The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field." + }), + "result": Schema.Literals(["allow", "deny"]).annotate({ "description": "UserToolConfirmationResult enum" }), + "deny_message": Schema.optionalKey( + Schema.String.annotate({ + "description": "Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'." + }).check(Schema.isMaxLength(10000)) + ), + "processed_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "When set, the confirmation routes to this subagent's thread rather than the primary. Echo this from the `session_thread_id` on the `agent.tool_use` or `agent.mcp_tool_use` event that prompted the approval." + }) + ) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("user.custom_tool_result"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "custom_tool_use_id": Schema.String.annotate({ "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + "The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field." + }), + "content": Schema.optionalKey( + Schema.Array(BetaManagedAgentsToolResultContentBlock).annotate({ + "description": "The result content returned by the tool." + }) + ), + "is_error": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether the tool execution resulted in an error." }) + ), + "processed_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Routes this result to a subagent thread. Copy from the `agent.custom_tool_use` event's `session_thread_id`." + }) + ) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("agent.custom_tool_use"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "name": Schema.String.annotate({ "description": "Name of the custom tool being called." }), + "input": Schema.Record(Schema.String, Schema.Unknown).annotate({ + "description": "Input parameters for the tool call." + }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "When set, this event was cross-posted from a subagent's thread to surface its custom tool use on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.custom_tool_result` event to route the result back." + }) + ) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("agent.message"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "content": Schema.Array(BetaManagedAgentsTextBlock).annotate({ + "description": "Array of text blocks comprising the agent response." + }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("agent.thinking"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("agent.mcp_tool_use"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "name": Schema.String.annotate({ "description": "Name of the MCP tool being used." }), + "mcp_server_name": Schema.String.annotate({ "description": "Name of the MCP server providing the tool." }), + "input": Schema.Record(Schema.String, Schema.Unknown).annotate({ + "description": "Input parameters for the tool call." + }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "evaluated_permission": Schema.optionalKey( + Schema.Literals(["allow", "ask", "deny"]).annotate({ "description": "AgentEvaluatedPermission enum" }) + ), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.tool_confirmation` event to route the approval back." + }) + ) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("agent.mcp_tool_result"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "mcp_tool_use_id": Schema.String.annotate({ + "description": "The id of the `agent.mcp_tool_use` event this result corresponds to." + }), + "content": Schema.optionalKey( + Schema.Array(BetaManagedAgentsToolResultContentBlock).annotate({ + "description": "The result content returned by the tool." + }) + ), + "is_error": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether the tool execution resulted in an error." }) + ), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("agent.tool_use"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "name": Schema.String.annotate({ "description": "Name of the agent tool being used." }), + "input": Schema.Record(Schema.String, Schema.Unknown).annotate({ + "description": "Input parameters for the tool call." + }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "evaluated_permission": Schema.optionalKey( + Schema.Literals(["allow", "ask", "deny"]).annotate({ "description": "AgentEvaluatedPermission enum" }) + ), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.tool_confirmation` event to route the approval back." + }) + ) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("agent.tool_result"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "tool_use_id": Schema.String.annotate({ + "description": "The id of the `agent.tool_use` event this result corresponds to." + }), + "content": Schema.optionalKey( + Schema.Array(BetaManagedAgentsToolResultContentBlock).annotate({ + "description": "The result content returned by the tool." + }) + ), + "is_error": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether the tool execution resulted in an error." }) + ), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("agent.thread_message_received"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "from_agent_name": Schema.optionalKey( + Schema.String.annotate({ + "description": "Name of the callable agent this message came from. Absent when received from the primary agent." + }) + ), + "content": Schema.Array(BetaManagedAgentsUserContentBlock).annotate({ "description": "Message content blocks." }), + "from_session_thread_id": Schema.String.annotate({ + "description": "Public `sthr_` ID of the thread that sent the message." }) - ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("agent.thread_message_sent"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "to_agent_name": Schema.optionalKey( + Schema.String.annotate({ + "description": "Name of the callable agent this message was sent to. Absent when sent to the primary agent." + }) + ), + "content": Schema.Array(BetaManagedAgentsUserContentBlock).annotate({ "description": "Message content blocks." }), + "to_session_thread_id": Schema.String.annotate({ + "description": "Public `sthr_` ID of the thread the message was sent to." }) - ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type BetaDeleteSkillV1SkillsSkillIdDelete200 = BetaDeleteSkillResponse -export const BetaDeleteSkillV1SkillsSkillIdDelete200 = BetaDeleteSkillResponse -export type BetaDeleteSkillV1SkillsSkillIdDelete4XX = BetaErrorResponse -export const BetaDeleteSkillV1SkillsSkillIdDelete4XX = BetaErrorResponse -export type BetaListSkillVersionsV1SkillsSkillIdVersionsGetParams = { - readonly "page"?: string | null - readonly "limit"?: number | null - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string -} -export const BetaListSkillVersionsV1SkillsSkillIdVersionsGetParams = Schema.Struct({ - "page": Schema.optionalKey( - Schema.Union([Schema.String, Schema.Null]).annotate({ - "title": "Page", - "description": "Optionally set to the `next_page` token from the previous response." - }) - ), - "limit": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ - "title": "Limit", - "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`." - }) - ), - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) - ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", - "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) - ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type BetaListSkillVersionsV1SkillsSkillIdVersionsGet200 = BetaListSkillVersionsResponse -export const BetaListSkillVersionsV1SkillsSkillIdVersionsGet200 = BetaListSkillVersionsResponse -export type BetaListSkillVersionsV1SkillsSkillIdVersionsGet4XX = BetaErrorResponse -export const BetaListSkillVersionsV1SkillsSkillIdVersionsGet4XX = BetaErrorResponse -export type BetaCreateSkillVersionV1SkillsSkillIdVersionsPostParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string -} -export const BetaCreateSkillVersionV1SkillsSkillIdVersionsPostParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", - "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) - ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("agent.thread_context_compacted"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("session.error"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "error": Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("unknown_error"), + "message": Schema.String.annotate({ "description": "Human-readable error description." }), + "retry_status": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("retrying") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("exhausted") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("terminal") }).annotate({ + "description": "What the client should do next in response to this error." + }) + ], { mode: "oneOf" }).annotate({ "description": "What the client should do next." }) + }).annotate({ + "description": + "An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone." + }), + Schema.Struct({ + "type": Schema.Literal("model_overloaded_error"), + "message": Schema.String.annotate({ "description": "Human-readable error description." }), + "retry_status": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("retrying") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("exhausted") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("terminal") }).annotate({ + "description": "What the client should do next in response to this error." + }) + ], { mode: "oneOf" }).annotate({ "description": "What the client should do next." }) + }).annotate({ + "description": "The model is currently overloaded. Emitted after automatic retries are exhausted." + }), + Schema.Struct({ + "type": Schema.Literal("model_rate_limited_error"), + "message": Schema.String.annotate({ "description": "Human-readable error description." }), + "retry_status": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("retrying") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("exhausted") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("terminal") }).annotate({ + "description": "What the client should do next in response to this error." + }) + ], { mode: "oneOf" }).annotate({ "description": "What the client should do next." }) + }).annotate({ "description": "The model request was rate-limited." }), + Schema.Struct({ + "type": Schema.Literal("model_request_failed_error"), + "message": Schema.String.annotate({ "description": "Human-readable error description." }), + "retry_status": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("retrying") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("exhausted") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("terminal") }).annotate({ + "description": "What the client should do next in response to this error." + }) + ], { mode: "oneOf" }).annotate({ "description": "What the client should do next." }) + }).annotate({ "description": "A model request failed for a reason other than overload or rate-limiting." }), + Schema.Struct({ + "type": Schema.Literal("mcp_connection_failed_error"), + "message": Schema.String.annotate({ "description": "Human-readable error description." }), + "retry_status": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("retrying") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("exhausted") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("terminal") }).annotate({ + "description": "What the client should do next in response to this error." + }) + ], { mode: "oneOf" }).annotate({ "description": "What the client should do next." }), + "mcp_server_name": Schema.String.annotate({ "description": "Name of the MCP server that failed to connect." }) + }).annotate({ "description": "Failed to connect to an MCP server." }), + Schema.Struct({ + "type": Schema.Literal("mcp_authentication_failed_error"), + "message": Schema.String.annotate({ "description": "Human-readable error description." }), + "retry_status": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("retrying") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("exhausted") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("terminal") }).annotate({ + "description": "What the client should do next in response to this error." + }) + ], { mode: "oneOf" }).annotate({ "description": "What the client should do next." }), + "mcp_server_name": Schema.String.annotate({ + "description": "Name of the MCP server that failed authentication." + }) + }).annotate({ "description": "Authentication to an MCP server failed." }), + Schema.Struct({ + "type": Schema.Literal("billing_error"), + "message": Schema.String.annotate({ "description": "Human-readable error description." }), + "retry_status": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("retrying") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("exhausted") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("terminal") }).annotate({ + "description": "What the client should do next in response to this error." + }) + ], { mode: "oneOf" }).annotate({ "description": "What the client should do next." }) + }).annotate({ + "description": + "The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state." + }) + ], { mode: "oneOf" }) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("session.status_rescheduled"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("session.status_running"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("session.status_idle"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "stop_reason": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("end_turn") }).annotate({ + "description": "The agent completed its turn naturally and is ready for the next user message." + }), + Schema.Struct({ + "type": Schema.Literal("requires_action"), + "event_ids": Schema.Array(Schema.String).annotate({ + "description": + "The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder." + }) + }).annotate({ + "description": + "The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running." + }), + Schema.Struct({ "type": Schema.Literal("retries_exhausted") }).annotate({ + "description": + "The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`)." + }) + ], { mode: "oneOf" }) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("session.status_terminated"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("session.thread_created"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "agent_name": Schema.String.annotate({ "description": "Name of the callable agent the thread runs." }), + "session_thread_id": Schema.String.annotate({ "description": "Public `sthr_` ID of the newly created thread." }) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("span.outcome_evaluation_start"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "iteration": Schema.Number.annotate({ "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) - ) -}) -export type BetaCreateSkillVersionV1SkillsSkillIdVersionsPostRequestFormData = - BetaBody_create_skill_version_v1_skills__skill_id__versions_post -export const BetaCreateSkillVersionV1SkillsSkillIdVersionsPostRequestFormData = - BetaBody_create_skill_version_v1_skills__skill_id__versions_post -export type BetaCreateSkillVersionV1SkillsSkillIdVersionsPost200 = BetaCreateSkillVersionResponse -export const BetaCreateSkillVersionV1SkillsSkillIdVersionsPost200 = BetaCreateSkillVersionResponse -export type BetaCreateSkillVersionV1SkillsSkillIdVersionsPost4XX = BetaErrorResponse -export const BetaCreateSkillVersionV1SkillsSkillIdVersionsPost4XX = BetaErrorResponse -export type BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGetParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string -} -export const BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGetParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", + "0-indexed revision cycle. 0 is the first evaluation; 1 is the re-evaluation after the first revision; etc.", + "format": "int32" + }).check(Schema.isInt()), + "outcome_id": Schema.String.annotate({ "description": "The `outc_` ID of the outcome being evaluated." }) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("span.outcome_evaluation_end"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "outcome_evaluation_start_id": Schema.String.annotate({ + "description": "The id of the corresponding `span.outcome_evaluation_start` event." + }), + "iteration": Schema.Number.annotate({ + "description": "0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.", + "format": "int32" + }).check(Schema.isInt()), + "result": Schema.String.annotate({ "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." - }) - ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", + "Evaluation verdict. 'satisfied': criteria met, session goes idle. 'needs_revision': criteria not met, another revision cycle follows. 'max_iterations_reached': evaluation budget exhausted with criteria still unmet — one final acknowledgment turn follows before the session goes idle, but no further evaluation runs. 'failed': grader determined the rubric does not apply to the deliverables. 'interrupted': user sent an interrupt while evaluation was in progress." + }), + "explanation": Schema.String.annotate({ "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + "Human-readable explanation of the verdict. For `needs_revision`, describes which criteria failed and why." + }), + "usage": Schema.Struct({ + "input_tokens": Schema.Number.annotate({ + "description": "Input tokens consumed by this request.", + "format": "int32" + }).check(Schema.isInt()), + "output_tokens": Schema.Number.annotate({ + "description": "Output tokens generated by this request.", + "format": "int32" + }).check(Schema.isInt()), + "cache_creation_input_tokens": Schema.Number.annotate({ + "description": "Tokens used to create prompt cache in this request.", + "format": "int32" + }).check(Schema.isInt()), + "cache_read_input_tokens": Schema.Number.annotate({ + "description": "Tokens read from prompt cache in this request.", + "format": "int32" + }).check(Schema.isInt()), + "speed": Schema.optionalKey( + Schema.Literals(["standard", "fast"]).annotate({ + "description": + "Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time." + }) + ) + }).annotate({ "description": "Token usage for a single model request." }), + "outcome_id": Schema.String.annotate({ "description": "The `outc_` ID of the outcome being evaluated." }) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("span.model_request_start"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("span.model_request_end"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "is_error": Schema.Boolean.annotate({ "description": "Whether the model request resulted in an error." }), + "model_usage": Schema.Struct({ + "input_tokens": Schema.Number.annotate({ + "description": "Input tokens consumed by this request.", + "format": "int32" + }).check(Schema.isInt()), + "output_tokens": Schema.Number.annotate({ + "description": "Output tokens generated by this request.", + "format": "int32" + }).check(Schema.isInt()), + "cache_creation_input_tokens": Schema.Number.annotate({ + "description": "Tokens used to create prompt cache in this request.", + "format": "int32" + }).check(Schema.isInt()), + "cache_read_input_tokens": Schema.Number.annotate({ + "description": "Tokens read from prompt cache in this request.", + "format": "int32" + }).check(Schema.isInt()), + "speed": Schema.optionalKey( + Schema.Literals(["standard", "fast"]).annotate({ + "description": + "Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time." + }) + ) + }).annotate({ "description": "Token usage for a single model request." }), + "model_request_start_id": Schema.String.annotate({ + "description": "The id of the corresponding `span.model_request_start` event." }) - ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet200 = BetaGetSkillVersionResponse -export const BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet200 = BetaGetSkillVersionResponse -export type BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX = BetaErrorResponse -export const BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX = BetaErrorResponse -export type BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDeleteParams = { - readonly "anthropic-beta"?: string - readonly "anthropic-version"?: string - readonly "x-api-key"?: string -} -export const BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDeleteParams = Schema.Struct({ - "anthropic-beta": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Beta", + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("span.outcome_evaluation_ongoing"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "iteration": Schema.Number.annotate({ + "description": "0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.", + "format": "int32" + }).check(Schema.isInt()), + "outcome_id": Schema.String.annotate({ "description": "The `outc_` ID of the outcome being evaluated." }) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("user.define_outcome"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "outcome_id": Schema.String.annotate({ "description": - "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + "Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list." + }), + "description": Schema.String.annotate({ + "description": "What the agent should produce. Copied from the input event." + }), + "max_iterations": Schema.Number.annotate({ + "description": "Evaluate-then-revise cycles before giving up. Default 3, max 20.", + "format": "int32" + }).check(Schema.isInt()), + "rubric": Schema.Union([BetaManagedAgentsFileRubric, BetaManagedAgentsTextRubric], { mode: "oneOf" }).annotate({ + "description": "Rubric for grading the quality of an outcome." }) - ), - "anthropic-version": Schema.optionalKey( - Schema.String.annotate({ - "title": "Anthropic-Version", + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("session.deleted"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("session.thread_status_running"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "session_thread_id": Schema.String.annotate({ + "description": "Public sthr_ ID of the thread that started running." + }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "agent_name": Schema.String.annotate({ "description": "Name of the agent the thread runs." }) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("session.thread_status_idle"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "session_thread_id": Schema.String.annotate({ "description": "Public sthr_ ID of the thread that went idle." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "agent_name": Schema.String.annotate({ "description": "Name of the agent the thread runs." }), + "stop_reason": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("end_turn") }).annotate({ + "description": "The agent completed its turn naturally and is ready for the next user message." + }), + Schema.Struct({ + "type": Schema.Literal("requires_action"), + "event_ids": Schema.Array(Schema.String).annotate({ + "description": + "The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder." + }) + }).annotate({ + "description": + "The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running." + }), + Schema.Struct({ "type": Schema.Literal("retries_exhausted") }).annotate({ + "description": + "The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`)." + }) + ], { mode: "oneOf" }) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("session.thread_status_terminated"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "session_thread_id": Schema.String.annotate({ "description": "Public sthr_ ID of the thread that terminated." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "agent_name": Schema.String.annotate({ "description": "Name of the agent the thread runs." }) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("user.tool_result"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "tool_use_id": Schema.String.annotate({ "description": - "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." - }) - ), - "x-api-key": Schema.optionalKey(Schema.String.annotate({ - "title": "X-Api-Key", - "description": - "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." - })) -}) -export type BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete200 = BetaDeleteSkillVersionResponse -export const BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete200 = BetaDeleteSkillVersionResponse -export type BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX = BetaErrorResponse -export const BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX = BetaErrorResponse - -export interface OperationConfig { - /** - * Whether or not the response should be included in the value returned from - * an operation. - * - * If set to `true`, a tuple of `[A, HttpClientResponse]` will be returned, - * where `A` is the success type of the operation. - * - * If set to `false`, only the success type of the operation will be returned. - */ - readonly includeResponse?: boolean | undefined -} - -/** - * A utility type which optionally includes the response in the return result - * of an operation based upon the value of the `includeResponse` configuration - * option. - */ -export type WithOptionalResponse = Config extends { - readonly includeResponse: true -} ? [A, HttpClientResponse.HttpClientResponse] : - A - -export const make = ( - httpClient: HttpClient.HttpClient, - options: { - readonly transformClient?: ((client: HttpClient.HttpClient) => Effect.Effect) | undefined - } = {} -): AnthropicClient => { - const unexpectedStatus = (response: HttpClientResponse.HttpClientResponse) => - Effect.flatMap( - Effect.orElseSucceed(response.json, () => "Unexpected status code"), - (description) => - Effect.fail( - new HttpClientError.HttpClientError({ - reason: new HttpClientError.StatusCodeError({ - request: response.request, - response, - description: typeof description === "string" ? description : JSON.stringify(description) - }) - }) - ) + "The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field." + }), + "content": Schema.optionalKey( + Schema.Array(BetaManagedAgentsToolResultContentBlock).annotate({ + "description": "The result content returned by the tool." + }) + ), + "is_error": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether the tool execution resulted in an error." }) + ), + "processed_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Routes this result to a subagent thread. Copy from the `agent.tool_use` event's `session_thread_id`." + }) ) - const withResponse = (config: Config | undefined) => - ( - f: (response: HttpClientResponse.HttpClientResponse) => Effect.Effect - ): (request: HttpClientRequest.HttpClientRequest) => Effect.Effect => { - const withOptionalResponse = ( - config?.includeResponse - ? (response: HttpClientResponse.HttpClientResponse) => Effect.map(f(response), (a) => [a, response]) - : (response: HttpClientResponse.HttpClientResponse) => f(response) - ) as any - return options?.transformClient - ? (request) => - Effect.flatMap( - Effect.flatMap(options.transformClient!(httpClient), (client) => client.execute(request)), - withOptionalResponse - ) - : (request) => Effect.flatMap(httpClient.execute(request), withOptionalResponse) - } - const binaryRequest = ( - request: HttpClientRequest.HttpClientRequest - ): Stream.Stream => - HttpClient.filterStatusOk(httpClient).execute(request).pipe( - Effect.map((response) => response.stream), - Stream.unwrap + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("session.thread_status_rescheduled"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "session_thread_id": Schema.String.annotate({ "description": "Public sthr_ ID of the thread that is retrying." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "agent_name": Schema.String.annotate({ "description": "Name of the agent the thread runs." }) + }).annotate({ "description": "Server-sent event in the session stream." }), + Schema.Struct({ + "type": Schema.Literal("session.updated"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "title": Schema.optionalKey( + Schema.String.annotate({ "description": "The session's new title. Present only when the update changed it." }) + ), + "metadata": Schema.optionalKey( + Schema.Record(Schema.String, Schema.String).annotate({ + "description": + "The session's full metadata bag after the update. Present when the update set non-empty metadata; absent when metadata was unchanged or cleared to empty." + }) + ), + "agent": Schema.optionalKey( + Schema.Struct({ + "type": Schema.Literal("agent"), + "id": Schema.String, + "version": Schema.Number.annotate({ "format": "int32" }).check(Schema.isInt()), + "name": Schema.String, + "description": Schema.String, + "model": BetaManagedAgentsModelConfig, + "system": Schema.String, + "tools": Schema.Array(BetaManagedAgentsAgentTool), + "mcp_servers": Schema.Array(BetaManagedAgentsMCPServer), + "skills": Schema.Array(BetaManagedAgentsSkill), + "multiagent": Schema.Union([BetaManagedAgentsSessionMultiagentCoordinator], { mode: "oneOf" }).annotate({ + "description": "Resolved multiagent orchestration configuration as returned on a `session`." + }) + }).annotate({ + "description": + "Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time." + }) ) - const decodeSuccess = - (schema: Schema) => (response: HttpClientResponse.HttpClientResponse) => - HttpClientResponse.schemaBodyJson(schema)(response) - const decodeError = - (tag: Tag, schema: Schema) => - (response: HttpClientResponse.HttpClientResponse) => - Effect.flatMap( - HttpClientResponse.schemaBodyJson(schema)(response), - (cause) => Effect.fail(AnthropicClientError(tag, cause, response)) + }).annotate({ "description": "Server-sent event in the session stream." }) +], { mode: "oneOf" }) +export type BetaManagedAgentsStreamSessionThreadEvents = + | { + readonly "type": "user.message" + readonly "id": string + readonly "content": ReadonlyArray + readonly "processed_at"?: string + } + | { + readonly "type": "user.interrupt" + readonly "id": string + readonly "processed_at"?: string + readonly "session_thread_id"?: string + } + | { + readonly "type": "user.tool_confirmation" + readonly "id": string + readonly "tool_use_id": string + readonly "result": "allow" | "deny" + readonly "deny_message"?: string + readonly "processed_at"?: string + readonly "session_thread_id"?: string + } + | { + readonly "type": "user.custom_tool_result" + readonly "id": string + readonly "custom_tool_use_id": string + readonly "content"?: ReadonlyArray + readonly "is_error"?: boolean + readonly "processed_at"?: string + readonly "session_thread_id"?: string + } + | { + readonly "type": "agent.custom_tool_use" + readonly "id": string + readonly "name": string + readonly "input": { readonly [x: string]: unknown } + readonly "processed_at": string + readonly "session_thread_id"?: string + } + | { + readonly "type": "agent.message" + readonly "id": string + readonly "content": ReadonlyArray + readonly "processed_at": string + } + | { readonly "type": "agent.thinking"; readonly "id": string; readonly "processed_at": string } + | { + readonly "type": "agent.mcp_tool_use" + readonly "id": string + readonly "name": string + readonly "mcp_server_name": string + readonly "input": { readonly [x: string]: unknown } + readonly "processed_at": string + readonly "evaluated_permission"?: "allow" | "ask" | "deny" + readonly "session_thread_id"?: string + } + | { + readonly "type": "agent.mcp_tool_result" + readonly "id": string + readonly "mcp_tool_use_id": string + readonly "content"?: ReadonlyArray + readonly "is_error"?: boolean + readonly "processed_at": string + } + | { + readonly "type": "agent.tool_use" + readonly "id": string + readonly "name": string + readonly "input": { readonly [x: string]: unknown } + readonly "processed_at": string + readonly "evaluated_permission"?: "allow" | "ask" | "deny" + readonly "session_thread_id"?: string + } + | { + readonly "type": "agent.tool_result" + readonly "id": string + readonly "tool_use_id": string + readonly "content"?: ReadonlyArray + readonly "is_error"?: boolean + readonly "processed_at": string + } + | { + readonly "type": "agent.thread_message_received" + readonly "id": string + readonly "processed_at": string + readonly "from_agent_name"?: string + readonly "content": ReadonlyArray + readonly "from_session_thread_id": string + } + | { + readonly "type": "agent.thread_message_sent" + readonly "id": string + readonly "processed_at": string + readonly "to_agent_name"?: string + readonly "content": ReadonlyArray + readonly "to_session_thread_id": string + } + | { readonly "type": "agent.thread_context_compacted"; readonly "id": string; readonly "processed_at": string } + | { + readonly "type": "session.error" + readonly "id": string + readonly "processed_at": string + readonly "error": { + readonly "type": "unknown_error" + readonly "message": string + readonly "retry_status": { readonly "type": "retrying" } | { readonly "type": "exhausted" } | { + readonly "type": "terminal" + } + } | { + readonly "type": "model_overloaded_error" + readonly "message": string + readonly "retry_status": { readonly "type": "retrying" } | { readonly "type": "exhausted" } | { + readonly "type": "terminal" + } + } | { + readonly "type": "model_rate_limited_error" + readonly "message": string + readonly "retry_status": { readonly "type": "retrying" } | { readonly "type": "exhausted" } | { + readonly "type": "terminal" + } + } | { + readonly "type": "model_request_failed_error" + readonly "message": string + readonly "retry_status": { readonly "type": "retrying" } | { readonly "type": "exhausted" } | { + readonly "type": "terminal" + } + } | { + readonly "type": "mcp_connection_failed_error" + readonly "message": string + readonly "retry_status": { readonly "type": "retrying" } | { readonly "type": "exhausted" } | { + readonly "type": "terminal" + } + readonly "mcp_server_name": string + } | { + readonly "type": "mcp_authentication_failed_error" + readonly "message": string + readonly "retry_status": { readonly "type": "retrying" } | { readonly "type": "exhausted" } | { + readonly "type": "terminal" + } + readonly "mcp_server_name": string + } | { + readonly "type": "billing_error" + readonly "message": string + readonly "retry_status": { readonly "type": "retrying" } | { readonly "type": "exhausted" } | { + readonly "type": "terminal" + } + } + } + | { readonly "type": "session.status_rescheduled"; readonly "id": string; readonly "processed_at": string } + | { readonly "type": "session.status_running"; readonly "id": string; readonly "processed_at": string } + | { + readonly "type": "session.status_idle" + readonly "id": string + readonly "processed_at": string + readonly "stop_reason": { readonly "type": "end_turn" } | { + readonly "type": "requires_action" + readonly "event_ids": ReadonlyArray + } | { readonly "type": "retries_exhausted" } + } + | { readonly "type": "session.status_terminated"; readonly "id": string; readonly "processed_at": string } + | { + readonly "type": "session.thread_created" + readonly "id": string + readonly "processed_at": string + readonly "agent_name": string + readonly "session_thread_id": string + } + | { + readonly "type": "span.outcome_evaluation_start" + readonly "id": string + readonly "processed_at": string + readonly "iteration": number + readonly "outcome_id": string + } + | { + readonly "type": "span.outcome_evaluation_end" + readonly "id": string + readonly "processed_at": string + readonly "outcome_evaluation_start_id": string + readonly "iteration": number + readonly "result": string + readonly "explanation": string + readonly "usage": { + readonly "input_tokens": number + readonly "output_tokens": number + readonly "cache_creation_input_tokens": number + readonly "cache_read_input_tokens": number + readonly "speed"?: "standard" | "fast" + } + readonly "outcome_id": string + } + | { readonly "type": "span.model_request_start"; readonly "id": string; readonly "processed_at": string } + | { + readonly "type": "span.model_request_end" + readonly "id": string + readonly "processed_at": string + readonly "is_error": boolean + readonly "model_usage": { + readonly "input_tokens": number + readonly "output_tokens": number + readonly "cache_creation_input_tokens": number + readonly "cache_read_input_tokens": number + readonly "speed"?: "standard" | "fast" + } + readonly "model_request_start_id": string + } + | { + readonly "type": "span.outcome_evaluation_ongoing" + readonly "id": string + readonly "processed_at": string + readonly "iteration": number + readonly "outcome_id": string + } + | { + readonly "type": "user.define_outcome" + readonly "id": string + readonly "processed_at": string + readonly "outcome_id": string + readonly "description": string + readonly "max_iterations": number + readonly "rubric": BetaManagedAgentsFileRubric | BetaManagedAgentsTextRubric + } + | { readonly "type": "session.deleted"; readonly "id": string; readonly "processed_at": string } + | { + readonly "type": "session.thread_status_running" + readonly "id": string + readonly "session_thread_id": string + readonly "processed_at": string + readonly "agent_name": string + } + | { + readonly "type": "session.thread_status_idle" + readonly "id": string + readonly "session_thread_id": string + readonly "processed_at": string + readonly "agent_name": string + readonly "stop_reason": { readonly "type": "end_turn" } | { + readonly "type": "requires_action" + readonly "event_ids": ReadonlyArray + } | { readonly "type": "retries_exhausted" } + } + | { + readonly "type": "session.thread_status_terminated" + readonly "id": string + readonly "session_thread_id": string + readonly "processed_at": string + readonly "agent_name": string + } + | { + readonly "type": "user.tool_result" + readonly "id": string + readonly "tool_use_id": string + readonly "content"?: ReadonlyArray + readonly "is_error"?: boolean + readonly "processed_at"?: string + readonly "session_thread_id"?: string + } + | { + readonly "type": "session.thread_status_rescheduled" + readonly "id": string + readonly "session_thread_id": string + readonly "processed_at": string + readonly "agent_name": string + } + | { + readonly "type": "session.updated" + readonly "id": string + readonly "processed_at": string + readonly "title"?: string + readonly "metadata"?: { readonly [x: string]: string } + readonly "agent"?: { + readonly "type": "agent" + readonly "id": string + readonly "version": number + readonly "name": string + readonly "description": string + readonly "model": BetaManagedAgentsModelConfig + readonly "system": string + readonly "tools": ReadonlyArray + readonly "mcp_servers": ReadonlyArray + readonly "skills": ReadonlyArray + readonly "multiagent": BetaManagedAgentsSessionMultiagentCoordinator + } + } +export const BetaManagedAgentsStreamSessionThreadEvents = Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("user.message"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "content": Schema.Array(BetaManagedAgentsUserContentBlock).annotate({ + "description": "Array of content blocks comprising the user message." + }), + "processed_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("user.interrupt"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread." + }) + ) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("user.tool_confirmation"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "tool_use_id": Schema.String.annotate({ + "description": + "The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field." + }), + "result": Schema.Literals(["allow", "deny"]).annotate({ "description": "UserToolConfirmationResult enum" }), + "deny_message": Schema.optionalKey( + Schema.String.annotate({ + "description": "Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'." + }).check(Schema.isMaxLength(10000)) + ), + "processed_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "When set, the confirmation routes to this subagent's thread rather than the primary. Echo this from the `session_thread_id` on the `agent.tool_use` or `agent.mcp_tool_use` event that prompted the approval." + }) + ) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("user.custom_tool_result"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "custom_tool_use_id": Schema.String.annotate({ + "description": + "The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field." + }), + "content": Schema.optionalKey( + Schema.Array(BetaManagedAgentsToolResultContentBlock).annotate({ + "description": "The result content returned by the tool." + }) + ), + "is_error": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether the tool execution resulted in an error." }) + ), + "processed_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Routes this result to a subagent thread. Copy from the `agent.custom_tool_use` event's `session_thread_id`." + }) + ) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("agent.custom_tool_use"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "name": Schema.String.annotate({ "description": "Name of the custom tool being called." }), + "input": Schema.Record(Schema.String, Schema.Unknown).annotate({ + "description": "Input parameters for the tool call." + }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "When set, this event was cross-posted from a subagent's thread to surface its custom tool use on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.custom_tool_result` event to route the result back." + }) + ) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("agent.message"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "content": Schema.Array(BetaManagedAgentsTextBlock).annotate({ + "description": "Array of text blocks comprising the agent response." + }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("agent.thinking"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("agent.mcp_tool_use"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "name": Schema.String.annotate({ "description": "Name of the MCP tool being used." }), + "mcp_server_name": Schema.String.annotate({ "description": "Name of the MCP server providing the tool." }), + "input": Schema.Record(Schema.String, Schema.Unknown).annotate({ + "description": "Input parameters for the tool call." + }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "evaluated_permission": Schema.optionalKey( + Schema.Literals(["allow", "ask", "deny"]).annotate({ "description": "AgentEvaluatedPermission enum" }) + ), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.tool_confirmation` event to route the approval back." + }) + ) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("agent.mcp_tool_result"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "mcp_tool_use_id": Schema.String.annotate({ + "description": "The id of the `agent.mcp_tool_use` event this result corresponds to." + }), + "content": Schema.optionalKey( + Schema.Array(BetaManagedAgentsToolResultContentBlock).annotate({ + "description": "The result content returned by the tool." + }) + ), + "is_error": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether the tool execution resulted in an error." }) + ), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("agent.tool_use"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "name": Schema.String.annotate({ "description": "Name of the agent tool being used." }), + "input": Schema.Record(Schema.String, Schema.Unknown).annotate({ + "description": "Input parameters for the tool call." + }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "evaluated_permission": Schema.optionalKey( + Schema.Literals(["allow", "ask", "deny"]).annotate({ "description": "AgentEvaluatedPermission enum" }) + ), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Echo this on a `user.tool_confirmation` event to route the approval back." + }) + ) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("agent.tool_result"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "tool_use_id": Schema.String.annotate({ + "description": "The id of the `agent.tool_use` event this result corresponds to." + }), + "content": Schema.optionalKey( + Schema.Array(BetaManagedAgentsToolResultContentBlock).annotate({ + "description": "The result content returned by the tool." + }) + ), + "is_error": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether the tool execution resulted in an error." }) + ), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("agent.thread_message_received"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "from_agent_name": Schema.optionalKey( + Schema.String.annotate({ + "description": "Name of the callable agent this message came from. Absent when received from the primary agent." + }) + ), + "content": Schema.Array(BetaManagedAgentsUserContentBlock).annotate({ "description": "Message content blocks." }), + "from_session_thread_id": Schema.String.annotate({ + "description": "Public `sthr_` ID of the thread that sent the message." + }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("agent.thread_message_sent"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "to_agent_name": Schema.optionalKey( + Schema.String.annotate({ + "description": "Name of the callable agent this message was sent to. Absent when sent to the primary agent." + }) + ), + "content": Schema.Array(BetaManagedAgentsUserContentBlock).annotate({ "description": "Message content blocks." }), + "to_session_thread_id": Schema.String.annotate({ + "description": "Public `sthr_` ID of the thread the message was sent to." + }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("agent.thread_context_compacted"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("session.error"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "error": Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("unknown_error"), + "message": Schema.String.annotate({ "description": "Human-readable error description." }), + "retry_status": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("retrying") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("exhausted") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("terminal") }).annotate({ + "description": "What the client should do next in response to this error." + }) + ], { mode: "oneOf" }).annotate({ "description": "What the client should do next." }) + }).annotate({ + "description": + "An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone." + }), + Schema.Struct({ + "type": Schema.Literal("model_overloaded_error"), + "message": Schema.String.annotate({ "description": "Human-readable error description." }), + "retry_status": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("retrying") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("exhausted") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("terminal") }).annotate({ + "description": "What the client should do next in response to this error." + }) + ], { mode: "oneOf" }).annotate({ "description": "What the client should do next." }) + }).annotate({ + "description": "The model is currently overloaded. Emitted after automatic retries are exhausted." + }), + Schema.Struct({ + "type": Schema.Literal("model_rate_limited_error"), + "message": Schema.String.annotate({ "description": "Human-readable error description." }), + "retry_status": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("retrying") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("exhausted") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("terminal") }).annotate({ + "description": "What the client should do next in response to this error." + }) + ], { mode: "oneOf" }).annotate({ "description": "What the client should do next." }) + }).annotate({ "description": "The model request was rate-limited." }), + Schema.Struct({ + "type": Schema.Literal("model_request_failed_error"), + "message": Schema.String.annotate({ "description": "Human-readable error description." }), + "retry_status": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("retrying") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("exhausted") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("terminal") }).annotate({ + "description": "What the client should do next in response to this error." + }) + ], { mode: "oneOf" }).annotate({ "description": "What the client should do next." }) + }).annotate({ "description": "A model request failed for a reason other than overload or rate-limiting." }), + Schema.Struct({ + "type": Schema.Literal("mcp_connection_failed_error"), + "message": Schema.String.annotate({ "description": "Human-readable error description." }), + "retry_status": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("retrying") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("exhausted") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("terminal") }).annotate({ + "description": "What the client should do next in response to this error." + }) + ], { mode: "oneOf" }).annotate({ "description": "What the client should do next." }), + "mcp_server_name": Schema.String.annotate({ "description": "Name of the MCP server that failed to connect." }) + }).annotate({ "description": "Failed to connect to an MCP server." }), + Schema.Struct({ + "type": Schema.Literal("mcp_authentication_failed_error"), + "message": Schema.String.annotate({ "description": "Human-readable error description." }), + "retry_status": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("retrying") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("exhausted") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("terminal") }).annotate({ + "description": "What the client should do next in response to this error." + }) + ], { mode: "oneOf" }).annotate({ "description": "What the client should do next." }), + "mcp_server_name": Schema.String.annotate({ + "description": "Name of the MCP server that failed authentication." + }) + }).annotate({ "description": "Authentication to an MCP server failed." }), + Schema.Struct({ + "type": Schema.Literal("billing_error"), + "message": Schema.String.annotate({ "description": "Human-readable error description." }), + "retry_status": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("retrying") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("exhausted") }).annotate({ + "description": "What the client should do next in response to this error." + }), + Schema.Struct({ "type": Schema.Literal("terminal") }).annotate({ + "description": "What the client should do next in response to this error." + }) + ], { mode: "oneOf" }).annotate({ "description": "What the client should do next." }) + }).annotate({ + "description": + "The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state." + }) + ], { mode: "oneOf" }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("session.status_rescheduled"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("session.status_running"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("session.status_idle"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "stop_reason": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("end_turn") }).annotate({ + "description": "The agent completed its turn naturally and is ready for the next user message." + }), + Schema.Struct({ + "type": Schema.Literal("requires_action"), + "event_ids": Schema.Array(Schema.String).annotate({ + "description": + "The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder." + }) + }).annotate({ + "description": + "The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running." + }), + Schema.Struct({ "type": Schema.Literal("retries_exhausted") }).annotate({ + "description": + "The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`)." + }) + ], { mode: "oneOf" }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("session.status_terminated"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("session.thread_created"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "agent_name": Schema.String.annotate({ "description": "Name of the callable agent the thread runs." }), + "session_thread_id": Schema.String.annotate({ "description": "Public `sthr_` ID of the newly created thread." }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("span.outcome_evaluation_start"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "iteration": Schema.Number.annotate({ + "description": + "0-indexed revision cycle. 0 is the first evaluation; 1 is the re-evaluation after the first revision; etc.", + "format": "int32" + }).check(Schema.isInt()), + "outcome_id": Schema.String.annotate({ "description": "The `outc_` ID of the outcome being evaluated." }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("span.outcome_evaluation_end"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "outcome_evaluation_start_id": Schema.String.annotate({ + "description": "The id of the corresponding `span.outcome_evaluation_start` event." + }), + "iteration": Schema.Number.annotate({ + "description": "0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.", + "format": "int32" + }).check(Schema.isInt()), + "result": Schema.String.annotate({ + "description": + "Evaluation verdict. 'satisfied': criteria met, session goes idle. 'needs_revision': criteria not met, another revision cycle follows. 'max_iterations_reached': evaluation budget exhausted with criteria still unmet — one final acknowledgment turn follows before the session goes idle, but no further evaluation runs. 'failed': grader determined the rubric does not apply to the deliverables. 'interrupted': user sent an interrupt while evaluation was in progress." + }), + "explanation": Schema.String.annotate({ + "description": + "Human-readable explanation of the verdict. For `needs_revision`, describes which criteria failed and why." + }), + "usage": Schema.Struct({ + "input_tokens": Schema.Number.annotate({ + "description": "Input tokens consumed by this request.", + "format": "int32" + }).check(Schema.isInt()), + "output_tokens": Schema.Number.annotate({ + "description": "Output tokens generated by this request.", + "format": "int32" + }).check(Schema.isInt()), + "cache_creation_input_tokens": Schema.Number.annotate({ + "description": "Tokens used to create prompt cache in this request.", + "format": "int32" + }).check(Schema.isInt()), + "cache_read_input_tokens": Schema.Number.annotate({ + "description": "Tokens read from prompt cache in this request.", + "format": "int32" + }).check(Schema.isInt()), + "speed": Schema.optionalKey( + Schema.Literals(["standard", "fast"]).annotate({ + "description": + "Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time." + }) ) - return { - httpClient, - "messagesPost": (options) => - HttpClientRequest.post(`/v1/messages`).pipe( - HttpClientRequest.setHeaders({ "anthropic-version": options.params?.["anthropic-version"] ?? undefined }), - HttpClientRequest.bodyJsonUnsafe(options.payload), - withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(MessagesPost200), - "4xx": decodeError("MessagesPost4XX", MessagesPost4XX), - orElse: unexpectedStatus - })) - ), - "completePost": (options) => - HttpClientRequest.post(`/v1/complete`).pipe( - HttpClientRequest.setHeaders({ - "anthropic-version": options.params?.["anthropic-version"] ?? undefined, - "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined - }), + }).annotate({ "description": "Token usage for a single model request." }), + "outcome_id": Schema.String.annotate({ "description": "The `outc_` ID of the outcome being evaluated." }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("span.model_request_start"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("span.model_request_end"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "is_error": Schema.Boolean.annotate({ "description": "Whether the model request resulted in an error." }), + "model_usage": Schema.Struct({ + "input_tokens": Schema.Number.annotate({ + "description": "Input tokens consumed by this request.", + "format": "int32" + }).check(Schema.isInt()), + "output_tokens": Schema.Number.annotate({ + "description": "Output tokens generated by this request.", + "format": "int32" + }).check(Schema.isInt()), + "cache_creation_input_tokens": Schema.Number.annotate({ + "description": "Tokens used to create prompt cache in this request.", + "format": "int32" + }).check(Schema.isInt()), + "cache_read_input_tokens": Schema.Number.annotate({ + "description": "Tokens read from prompt cache in this request.", + "format": "int32" + }).check(Schema.isInt()), + "speed": Schema.optionalKey( + Schema.Literals(["standard", "fast"]).annotate({ + "description": + "Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time." + }) + ) + }).annotate({ "description": "Token usage for a single model request." }), + "model_request_start_id": Schema.String.annotate({ + "description": "The id of the corresponding `span.model_request_start` event." + }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("span.outcome_evaluation_ongoing"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "iteration": Schema.Number.annotate({ + "description": "0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.", + "format": "int32" + }).check(Schema.isInt()), + "outcome_id": Schema.String.annotate({ "description": "The `outc_` ID of the outcome being evaluated." }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("user.define_outcome"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "outcome_id": Schema.String.annotate({ + "description": + "Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list." + }), + "description": Schema.String.annotate({ + "description": "What the agent should produce. Copied from the input event." + }), + "max_iterations": Schema.Number.annotate({ + "description": "Evaluate-then-revise cycles before giving up. Default 3, max 20.", + "format": "int32" + }).check(Schema.isInt()), + "rubric": Schema.Union([BetaManagedAgentsFileRubric, BetaManagedAgentsTextRubric], { mode: "oneOf" }).annotate({ + "description": "Rubric for grading the quality of an outcome." + }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("session.deleted"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("session.thread_status_running"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "session_thread_id": Schema.String.annotate({ + "description": "Public sthr_ ID of the thread that started running." + }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "agent_name": Schema.String.annotate({ "description": "Name of the agent the thread runs." }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("session.thread_status_idle"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "session_thread_id": Schema.String.annotate({ "description": "Public sthr_ ID of the thread that went idle." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "agent_name": Schema.String.annotate({ "description": "Name of the agent the thread runs." }), + "stop_reason": Schema.Union([ + Schema.Struct({ "type": Schema.Literal("end_turn") }).annotate({ + "description": "The agent completed its turn naturally and is ready for the next user message." + }), + Schema.Struct({ + "type": Schema.Literal("requires_action"), + "event_ids": Schema.Array(Schema.String).annotate({ + "description": + "The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder." + }) + }).annotate({ + "description": + "The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running." + }), + Schema.Struct({ "type": Schema.Literal("retries_exhausted") }).annotate({ + "description": + "The turn ended because the retry budget was exhausted (`max_iterations` hit or an error escalated to `retry_status: 'exhausted'`)." + }) + ], { mode: "oneOf" }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("session.thread_status_terminated"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "session_thread_id": Schema.String.annotate({ "description": "Public sthr_ ID of the thread that terminated." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "agent_name": Schema.String.annotate({ "description": "Name of the agent the thread runs." }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("user.tool_result"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "tool_use_id": Schema.String.annotate({ + "description": + "The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field." + }), + "content": Schema.optionalKey( + Schema.Array(BetaManagedAgentsToolResultContentBlock).annotate({ + "description": "The result content returned by the tool." + }) + ), + "is_error": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether the tool execution resulted in an error." }) + ), + "processed_at": Schema.optionalKey( + Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) + ), + "session_thread_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Routes this result to a subagent thread. Copy from the `agent.tool_use` event's `session_thread_id`." + }) + ) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("session.thread_status_rescheduled"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "session_thread_id": Schema.String.annotate({ "description": "Public sthr_ ID of the thread that is retrying." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "agent_name": Schema.String.annotate({ "description": "Name of the agent the thread runs." }) + }).annotate({ "description": "Server-sent event in a single thread's stream." }), + Schema.Struct({ + "type": Schema.Literal("session.updated"), + "id": Schema.String.annotate({ "description": "Unique identifier for this event." }), + "processed_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }), + "title": Schema.optionalKey( + Schema.String.annotate({ "description": "The session's new title. Present only when the update changed it." }) + ), + "metadata": Schema.optionalKey( + Schema.Record(Schema.String, Schema.String).annotate({ + "description": + "The session's full metadata bag after the update. Present when the update set non-empty metadata; absent when metadata was unchanged or cleared to empty." + }) + ), + "agent": Schema.optionalKey( + Schema.Struct({ + "type": Schema.Literal("agent"), + "id": Schema.String, + "version": Schema.Number.annotate({ "format": "int32" }).check(Schema.isInt()), + "name": Schema.String, + "description": Schema.String, + "model": BetaManagedAgentsModelConfig, + "system": Schema.String, + "tools": Schema.Array(BetaManagedAgentsAgentTool), + "mcp_servers": Schema.Array(BetaManagedAgentsMCPServer), + "skills": Schema.Array(BetaManagedAgentsSkill), + "multiagent": Schema.Union([BetaManagedAgentsSessionMultiagentCoordinator], { mode: "oneOf" }).annotate({ + "description": "Resolved multiagent orchestration configuration as returned on a `session`." + }) + }).annotate({ + "description": + "Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time." + }) + ) + }).annotate({ "description": "Server-sent event in a single thread's stream." }) +], { mode: "oneOf" }) +export type BetaMessage = { + readonly "id": string + readonly "type": "message" + readonly "role": "assistant" + readonly "content": ReadonlyArray + readonly "model": Model + readonly "stop_reason": BetaStopReason | null + readonly "stop_sequence": string | null + readonly "stop_details": BetaRefusalStopDetails | null + readonly "usage": { + readonly "cache_creation": BetaCacheCreation | null + readonly "cache_creation_input_tokens": number | null + readonly "cache_read_input_tokens": number | null + readonly "inference_geo": string | null + readonly "input_tokens": number + readonly "iterations"?: BetaIterationsUsage + readonly "output_tokens": number + readonly "server_tool_use"?: BetaServerToolUsage | null + readonly "service_tier": "standard" | "priority" | "batch" | null + readonly "speed"?: BetaSpeed | null + } + readonly "diagnostics": BetaDiagnostics | null + readonly "context_management"?: BetaResponseContextManagement | null + readonly "container"?: BetaContainer | null +} +export const BetaMessage = Schema.Struct({ + "id": Schema.String.annotate({ + "title": "Id", + "description": "Unique object identifier.\n\nThe format and length of IDs may change over time." + }), + "type": Schema.Literal("message").annotate({ + "title": "Type", + "description": "Object type.\n\nFor Messages, this is always `\"message\"`.", + "default": "message" + }), + "role": Schema.Literal("assistant").annotate({ + "title": "Role", + "description": "Conversational role of the generated message.\n\nThis will always be `\"assistant\"`.", + "default": "assistant" + }), + "content": Schema.Array(BetaContentBlock).annotate({ + "title": "Content", + "description": + "Content generated by the model.\n\nThis is an array of content blocks, each of which has a `type` that determines its shape.\n\nExample:\n\n```json\n[{\"type\": \"text\", \"text\": \"Hi, I'm Claude.\"}]\n```\n\nIf the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.\n\nFor example, if the input `messages` were:\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"}\n]\n```\n\nThen the response `content` might be:\n\n```json\n[{\"type\": \"text\", \"text\": \"B)\"}]\n```" + }), + "model": Model, + "stop_reason": Schema.Union([BetaStopReason, Schema.Null]).annotate({ + "title": "Stop Reason", + "description": + "The reason that we stopped.\n\nThis may be one the following values:\n* `\"end_turn\"`: the model reached a natural stopping point\n* `\"max_tokens\"`: we exceeded the requested `max_tokens` or the model's maximum\n* `\"stop_sequence\"`: one of your provided custom `stop_sequences` was generated\n* `\"tool_use\"`: the model invoked one or more tools\n* `\"pause_turn\"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue.\n* `\"refusal\"`: when streaming classifiers intervene to handle potential policy violations\n\nIn non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise." + }), + "stop_sequence": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Stop Sequence", + "description": + "Which custom stop sequence was generated, if any.\n\nThis value will be a non-null string if one of your custom stop sequences was generated.", + "default": null + }), + "stop_details": Schema.Union([BetaRefusalStopDetails, Schema.Null]).annotate({ + "description": + "Structured information about why model output stopped.\n\nThis is `null` when the `stop_reason` has no additional detail to report.", + "default": null + }), + "usage": Schema.Struct({ + "cache_creation": Schema.Union([BetaCacheCreation, Schema.Null]).annotate({ + "description": "Breakdown of cached tokens by TTL", + "default": null + }), + "cache_creation_input_tokens": Schema.Union([ + Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + Schema.Null + ]).annotate({ + "title": "Cache Creation Input Tokens", + "description": "The number of input tokens used to create the cache entry.", + "default": null + }), + "cache_read_input_tokens": Schema.Union([ + Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + Schema.Null + ]).annotate({ + "title": "Cache Read Input Tokens", + "description": "The number of input tokens read from the cache.", + "default": null + }), + "inference_geo": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Inference Geo", + "description": "The geographic region where inference was performed for this request.", + "default": null + }), + "input_tokens": Schema.Number.annotate({ + "title": "Input Tokens", + "description": "The number of input tokens which were used." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "iterations": Schema.optionalKey(BetaIterationsUsage), + "output_tokens": Schema.Number.annotate({ + "title": "Output Tokens", + "description": "The number of output tokens which were used." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "server_tool_use": Schema.optionalKey( + Schema.Union([BetaServerToolUsage, Schema.Null]).annotate({ + "description": "The number of server tool requests.", + "default": null + }) + ), + "service_tier": Schema.Union([Schema.Literals(["standard", "priority", "batch"]), Schema.Null]).annotate({ + "title": "Service Tier", + "description": "If the request used the priority, standard, or batch tier.", + "default": null + }), + "speed": Schema.optionalKey( + Schema.Union([BetaSpeed, Schema.Null]).annotate({ + "description": "The inference speed mode used for this request.", + "default": null + }) + ) + }).annotate({ + "title": "Usage", + "description": + "Billing and rate-limit usage.\n\nAnthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.\n\nUnder the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.\n\nFor example, `output_tokens` will be non-zero, even for an empty string response from Claude.\n\nTotal input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`." + }), + "diagnostics": Schema.Union([BetaDiagnostics, Schema.Null]).annotate({ + "description": + "Request-level diagnostics. Present only when `diagnostics` was supplied on the request; `null` when no prompt-cache divergence was detected.", + "default": null + }), + "context_management": Schema.optionalKey( + Schema.Union([BetaResponseContextManagement, Schema.Null]).annotate({ + "description": + "Context management response.\n\nInformation about context management strategies applied during the request.", + "default": null + }) + ), + "container": Schema.optionalKey( + Schema.Union([BetaContainer, Schema.Null]).annotate({ + "description": + "Information about the container used in this request.\n\nThis will be non-null if a container tool (e.g. code execution) was used.", + "default": null + }) + ) +}).annotate({ "title": "Message" }) +export type BetaRequestWebFetchToolResultBlock = { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120 + readonly "content": BetaRequestWebFetchToolResultError | BetaRequestWebFetchResultBlock + readonly "tool_use_id": string + readonly "type": "web_fetch_tool_result" +} +export const BetaRequestWebFetchToolResultBlock = Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "caller": Schema.optionalKey( + Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate({ + "title": "Caller" + }) + ), + "content": Schema.Union([BetaRequestWebFetchToolResultError, BetaRequestWebFetchResultBlock]).annotate({ + "title": "Content" + }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + ), + "type": Schema.Literal("web_fetch_tool_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestWebFetchToolResultBlock" }) +export type Message = { + readonly "id": string + readonly "type": "message" + readonly "role": "assistant" + readonly "content": ReadonlyArray + readonly "model": Model + readonly "stop_reason": StopReason | null + readonly "stop_sequence": string | null + readonly "stop_details": RefusalStopDetails | null + readonly "usage": { + readonly "cache_creation": CacheCreation | null + readonly "cache_creation_input_tokens": number | null + readonly "cache_read_input_tokens": number | null + readonly "inference_geo": string | null + readonly "input_tokens": number + readonly "output_tokens": number + readonly "server_tool_use"?: ServerToolUsage | null + readonly "service_tier": "standard" | "priority" | "batch" | null + } + readonly "container": Container | null +} +export const Message = Schema.Struct({ + "id": Schema.String.annotate({ + "title": "Id", + "description": "Unique object identifier.\n\nThe format and length of IDs may change over time." + }), + "type": Schema.Literal("message").annotate({ + "title": "Type", + "description": "Object type.\n\nFor Messages, this is always `\"message\"`.", + "default": "message" + }), + "role": Schema.Literal("assistant").annotate({ + "title": "Role", + "description": "Conversational role of the generated message.\n\nThis will always be `\"assistant\"`.", + "default": "assistant" + }), + "content": Schema.Array(ContentBlock).annotate({ + "title": "Content", + "description": + "Content generated by the model.\n\nThis is an array of content blocks, each of which has a `type` that determines its shape.\n\nExample:\n\n```json\n[{\"type\": \"text\", \"text\": \"Hi, I'm Claude.\"}]\n```\n\nIf the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output.\n\nFor example, if the input `messages` were:\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"}\n]\n```\n\nThen the response `content` might be:\n\n```json\n[{\"type\": \"text\", \"text\": \"B)\"}]\n```" + }), + "model": Model, + "stop_reason": Schema.Union([StopReason, Schema.Null]).annotate({ + "title": "Stop Reason", + "description": + "The reason that we stopped.\n\nThis may be one the following values:\n* `\"end_turn\"`: the model reached a natural stopping point\n* `\"max_tokens\"`: we exceeded the requested `max_tokens` or the model's maximum\n* `\"stop_sequence\"`: one of your provided custom `stop_sequences` was generated\n* `\"tool_use\"`: the model invoked one or more tools\n* `\"pause_turn\"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue.\n* `\"refusal\"`: when streaming classifiers intervene to handle potential policy violations\n\nIn non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise." + }), + "stop_sequence": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Stop Sequence", + "description": + "Which custom stop sequence was generated, if any.\n\nThis value will be a non-null string if one of your custom stop sequences was generated.", + "default": null + }), + "stop_details": Schema.Union([RefusalStopDetails, Schema.Null]).annotate({ + "description": + "Structured information about why model output stopped.\n\nThis is `null` when the `stop_reason` has no additional detail to report.", + "default": null + }), + "usage": Schema.Struct({ + "cache_creation": Schema.Union([CacheCreation, Schema.Null]).annotate({ + "description": "Breakdown of cached tokens by TTL", + "default": null + }), + "cache_creation_input_tokens": Schema.Union([ + Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + Schema.Null + ]).annotate({ + "title": "Cache Creation Input Tokens", + "description": "The number of input tokens used to create the cache entry.", + "default": null + }), + "cache_read_input_tokens": Schema.Union([ + Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + Schema.Null + ]).annotate({ + "title": "Cache Read Input Tokens", + "description": "The number of input tokens read from the cache.", + "default": null + }), + "inference_geo": Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Inference Geo", + "description": "The geographic region where inference was performed for this request.", + "default": null + }), + "input_tokens": Schema.Number.annotate({ + "title": "Input Tokens", + "description": "The number of input tokens which were used." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "output_tokens": Schema.Number.annotate({ + "title": "Output Tokens", + "description": "The number of output tokens which were used." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "server_tool_use": Schema.optionalKey( + Schema.Union([ServerToolUsage, Schema.Null]).annotate({ + "description": "The number of server tool requests.", + "default": null + }) + ), + "service_tier": Schema.Union([Schema.Literals(["standard", "priority", "batch"]), Schema.Null]).annotate({ + "title": "Service Tier", + "description": "If the request used the priority, standard, or batch tier.", + "default": null + }) + }).annotate({ + "title": "Usage", + "description": + "Billing and rate-limit usage.\n\nAnthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.\n\nUnder the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response.\n\nFor example, `output_tokens` will be non-zero, even for an empty string response from Claude.\n\nTotal input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`." + }), + "container": Schema.Union([Container, Schema.Null]).annotate({ + "description": + "Information about the container used in this request.\n\nThis will be non-null if a container tool (e.g. code execution) was used.", + "default": null + }) +}).annotate({ "title": "Message" }) +export type RequestWebFetchToolResultBlock = { + readonly "cache_control"?: CacheControlEphemeral | null + readonly "caller"?: DirectCaller | ServerToolCaller | ServerToolCaller_20260120 + readonly "content": RequestWebFetchToolResultError | RequestWebFetchResultBlock + readonly "tool_use_id": string + readonly "type": "web_fetch_tool_result" +} +export const RequestWebFetchToolResultBlock = Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "caller": Schema.optionalKey( + Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({ + "title": "Caller" + }) + ), + "content": Schema.Union([RequestWebFetchToolResultError, RequestWebFetchResultBlock]).annotate({ + "title": "Content" + }), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^srvtoolu_[a-zA-Z0-9_]+$")) + ), + "type": Schema.Literal("web_fetch_tool_result").annotate({ "title": "Type" }) +}).annotate({ "title": "RequestWebFetchToolResultBlock" }) +export type BetaManagedAgentsSession = { + readonly "type": "session" + readonly "id": string + readonly "status": BetaManagedAgentsSessionStatus + readonly "created_at": BetaTimestamp + readonly "updated_at": BetaTimestamp + readonly "environment_id": string + readonly "title": string + readonly "metadata": { readonly [x: string]: string } + readonly "agent": BetaManagedAgentsSessionAgent + readonly "resources": ReadonlyArray + readonly "vault_ids": ReadonlyArray + readonly "outcome_evaluations": ReadonlyArray + readonly "usage": { + readonly "input_tokens"?: number + readonly "output_tokens"?: number + readonly "cache_read_input_tokens"?: number + readonly "cache_creation"?: { + readonly "ephemeral_1h_input_tokens"?: number + readonly "ephemeral_5m_input_tokens"?: number + } + } + readonly "stats": { readonly "duration_seconds"?: number; readonly "active_seconds"?: number } + readonly "archived_at": string +} +export const BetaManagedAgentsSession = Schema.Struct({ + "type": Schema.Literal("session"), + "id": Schema.String, + "status": BetaManagedAgentsSessionStatus, + "created_at": BetaTimestamp, + "updated_at": BetaTimestamp, + "environment_id": Schema.String, + "title": Schema.String, + "metadata": Schema.Record(Schema.String, Schema.String), + "agent": BetaManagedAgentsSessionAgent, + "resources": Schema.Array(BetaManagedAgentsSessionResource), + "vault_ids": Schema.Array(Schema.String).annotate({ + "description": "Vault IDs attached to the session at creation. Empty when no vaults were supplied." + }), + "outcome_evaluations": Schema.Array(BetaManagedAgentsOutcomeEvaluationResource).annotate({ + "description": "Per-outcome evaluation state. One entry per define_outcome event sent to the session." + }), + "usage": Schema.Struct({ + "input_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Total input tokens consumed across all turns.", "format": "int32" }) + .check(Schema.isInt()) + ), + "output_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Total output tokens generated across all turns.", "format": "int32" }) + .check(Schema.isInt()) + ), + "cache_read_input_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Total tokens read from prompt cache.", "format": "int32" }).check( + Schema.isInt() + ) + ), + "cache_creation": Schema.optionalKey( + Schema.Struct({ + "ephemeral_1h_input_tokens": Schema.optionalKey( + Schema.Number.annotate({ + "description": "Tokens used to create 1-hour ephemeral cache entries.", + "format": "int32" + }).check(Schema.isInt()) + ), + "ephemeral_5m_input_tokens": Schema.optionalKey( + Schema.Number.annotate({ + "description": "Tokens used to create 5-minute ephemeral cache entries.", + "format": "int32" + }).check(Schema.isInt()) + ) + }).annotate({ "description": "Prompt-cache creation token usage broken down by cache lifetime." }) + ) + }).annotate({ "description": "Cumulative token usage for a session across all turns." }), + "stats": Schema.Struct({ + "duration_seconds": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "Elapsed time since session creation in seconds. For terminated sessions, frozen at the final update.", + "format": "double" + }).check(Schema.isFinite()) + ), + "active_seconds": Schema.optionalKey( + Schema.Number.annotate({ + "description": "Cumulative time in seconds the session spent in running status. Excludes idle time.", + "format": "double" + }).check(Schema.isFinite()) + ) + }).annotate({ "description": "Timing statistics for a session." }), + "archived_at": Schema.String.annotate({ "description": "A timestamp in RFC 3339 format", "format": "date-time" }) +}).annotate({ "description": "A Managed Agents `session`." }) +export type BetaManagedAgentsListSessionEvents = { + readonly "data"?: ReadonlyArray + readonly "next_page"?: string +} +export const BetaManagedAgentsListSessionEvents = Schema.Struct({ + "data": Schema.optionalKey( + Schema.Array(BetaManagedAgentsSessionEvent).annotate({ + "description": "Events for the session, ordered by `created_at`." + }) + ), + "next_page": Schema.optionalKey( + Schema.String.annotate({ "description": "Opaque cursor for the next page. Null when no more results." }) + ) +}).annotate({ "description": "Paginated list of events for a `session`." }) +export type BetaManagedAgentsListSessionThreadEvents = { + readonly "data"?: ReadonlyArray + readonly "next_page"?: string +} +export const BetaManagedAgentsListSessionThreadEvents = Schema.Struct({ + "data": Schema.optionalKey( + Schema.Array(BetaManagedAgentsSessionEvent).annotate({ + "description": "Events for the thread, ordered by `created_at`." + }) + ), + "next_page": Schema.optionalKey( + Schema.String.annotate({ "description": "Opaque cursor for the next page. Null when no more results." }) + ) +}).annotate({ "description": "Paginated list of events for a single thread within a `session`." }) +export type BetaMessageStartEvent = { readonly "message": BetaMessage; readonly "type": "message_start" } +export const BetaMessageStartEvent = Schema.Struct({ + "message": BetaMessage, + "type": Schema.Literal("message_start").annotate({ "title": "Type", "default": "message_start" }) +}).annotate({ "title": "MessageStartEvent" }) +export type BetaSucceededResult = { readonly "message": BetaMessage; readonly "type": "succeeded" } +export const BetaSucceededResult = Schema.Struct({ + "message": BetaMessage, + "type": Schema.Literal("succeeded").annotate({ "title": "Type", "default": "succeeded" }) +}).annotate({ "title": "SucceededResult" }) +export type BetaInputContentBlock = + | { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "citations"?: + | ReadonlyArray< + | BetaRequestCharLocationCitation + | BetaRequestPageLocationCitation + | BetaRequestContentBlockLocationCitation + | BetaRequestWebSearchResultLocationCitation + | BetaRequestSearchResultLocationCitation + > + | null + readonly "text": string + readonly "type": "text" + } + | { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "source": BetaBase64ImageSource | BetaURLImageSource | BetaFileImageSource + readonly "type": "image" + } + | { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "citations"?: BetaRequestCitationsConfig | null + readonly "context"?: string | null + readonly "source": + | BetaBase64PDFSource + | BetaPlainTextSource + | BetaContentBlockSource + | BetaURLPDFSource + | BetaFileDocumentSource + readonly "title"?: string | null + readonly "type": "document" + } + | { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "citations"?: BetaRequestCitationsConfig + readonly "content": ReadonlyArray + readonly "source": string + readonly "title": string + readonly "type": "search_result" + } + | { readonly "signature": string; readonly "thinking": string; readonly "type": "thinking" } + | { readonly "data": string; readonly "type": "redacted_thinking" } + | { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "caller"?: BetaDirectCaller | BetaServerToolCaller | BetaServerToolCaller_20260120 + readonly "id": string + readonly "input": { readonly [x: string]: unknown } + readonly "name": string + readonly "type": "tool_use" + } + | { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "content"?: + | string + | ReadonlyArray< + | BetaRequestTextBlock + | BetaRequestImageBlock + | BetaRequestSearchResultBlock + | BetaRequestDocumentBlock + | BetaRequestToolReferenceBlock + > + readonly "is_error"?: boolean + readonly "tool_use_id": string + readonly "type": "tool_result" + } + | BetaRequestServerToolUseBlock + | BetaRequestWebSearchToolResultBlock + | BetaRequestWebFetchToolResultBlock + | BetaRequestAdvisorToolResultBlock + | BetaRequestCodeExecutionToolResultBlock + | BetaRequestBashCodeExecutionToolResultBlock + | BetaRequestTextEditorCodeExecutionToolResultBlock + | BetaRequestToolSearchToolResultBlock + | BetaRequestMCPToolUseBlock + | BetaRequestMCPToolResultBlock + | BetaRequestContainerUploadBlock + | BetaRequestCompactionBlock +export const BetaInputContentBlock = Schema.Union([ + Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "citations": Schema.optionalKey( + Schema.Union([ + Schema.Array( + Schema.Union([ + BetaRequestCharLocationCitation, + BetaRequestPageLocationCitation, + BetaRequestContentBlockLocationCitation, + BetaRequestWebSearchResultLocationCitation, + BetaRequestSearchResultLocationCitation + ], { mode: "oneOf" }) + ), + Schema.Null + ]).annotate({ "title": "Citations" }) + ), + "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(1)), + "type": Schema.Literal("text").annotate({ "title": "Type" }) + }).annotate({ "title": "RequestTextBlock", "description": "Regular text content." }), + Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "source": Schema.Union([BetaBase64ImageSource, BetaURLImageSource, BetaFileImageSource], { mode: "oneOf" }) + .annotate({ "title": "Source" }), + "type": Schema.Literal("image").annotate({ "title": "Type" }) + }).annotate({ + "title": "RequestImageBlock", + "description": "Image content specified directly as base64 data or as a reference via a URL." + }), + Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "citations": Schema.optionalKey(Schema.Union([BetaRequestCitationsConfig, Schema.Null])), + "context": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMinLength(1)), Schema.Null]).annotate({ "title": "Context" }) + ), + "source": Schema.Union([ + BetaBase64PDFSource, + BetaPlainTextSource, + BetaContentBlockSource, + BetaURLPDFSource, + BetaFileDocumentSource + ], { mode: "oneOf" }).annotate({ "title": "Source" }), + "title": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(500)), Schema.Null]).annotate({ + "title": "Title" + }) + ), + "type": Schema.Literal("document").annotate({ "title": "Type" }) + }).annotate({ + "title": "RequestDocumentBlock", + "description": "Document content, either specified directly as base64 data, as text, or as a reference via a URL." + }), + Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "citations": Schema.optionalKey(BetaRequestCitationsConfig), + "content": Schema.Array(BetaRequestTextBlock).annotate({ "title": "Content" }), + "source": Schema.String.annotate({ "title": "Source" }), + "title": Schema.String.annotate({ "title": "Title" }), + "type": Schema.Literal("search_result").annotate({ "title": "Type" }) + }).annotate({ + "title": "RequestSearchResultBlock", + "description": "A search result block containing source, title, and content from search operations." + }), + Schema.Struct({ + "signature": Schema.String.annotate({ "title": "Signature" }), + "thinking": Schema.String.annotate({ "title": "Thinking" }), + "type": Schema.Literal("thinking").annotate({ "title": "Type" }) + }).annotate({ "title": "RequestThinkingBlock", "description": "A block specifying internal thinking by the model." }), + Schema.Struct({ + "data": Schema.String.annotate({ "title": "Data" }), + "type": Schema.Literal("redacted_thinking").annotate({ "title": "Type" }) + }).annotate({ + "title": "RequestRedactedThinkingBlock", + "description": "A block specifying internal, redacted thinking by the model." + }), + Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "caller": Schema.optionalKey( + Schema.Union([BetaDirectCaller, BetaServerToolCaller, BetaServerToolCaller_20260120], { mode: "oneOf" }).annotate( + { "title": "Caller" } + ) + ), + "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$"))), + "input": Schema.Record(Schema.String, Schema.Unknown).annotate({ "title": "Input" }), + "name": Schema.String.annotate({ "title": "Name" }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(200)), + "type": Schema.Literal("tool_use").annotate({ "title": "Type" }) + }).annotate({ "title": "RequestToolUseBlock", "description": "A block indicating a tool use by the model." }), + Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "content": Schema.optionalKey( + Schema.Union([ + Schema.String, + Schema.Array( + Schema.Union([ + BetaRequestTextBlock, + BetaRequestImageBlock, + BetaRequestSearchResultBlock, + BetaRequestDocumentBlock, + BetaRequestToolReferenceBlock + ], { mode: "oneOf" }).annotate({ "title": "Block" }) + ) + ]).annotate({ "title": "Content" }) + ), + "is_error": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Is Error" })), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$")) + ), + "type": Schema.Literal("tool_result").annotate({ "title": "Type" }) + }).annotate({ + "title": "RequestToolResultBlock", + "description": "A block specifying the results of a tool use by the model." + }), + BetaRequestServerToolUseBlock, + BetaRequestWebSearchToolResultBlock, + BetaRequestWebFetchToolResultBlock, + BetaRequestAdvisorToolResultBlock, + BetaRequestCodeExecutionToolResultBlock, + BetaRequestBashCodeExecutionToolResultBlock, + BetaRequestTextEditorCodeExecutionToolResultBlock, + BetaRequestToolSearchToolResultBlock, + BetaRequestMCPToolUseBlock, + BetaRequestMCPToolResultBlock, + BetaRequestContainerUploadBlock, + BetaRequestCompactionBlock +], { mode: "oneOf" }) +export type MessageStartEvent = { readonly "message": Message; readonly "type": "message_start" } +export const MessageStartEvent = Schema.Struct({ + "message": Message, + "type": Schema.Literal("message_start").annotate({ "title": "Type", "default": "message_start" }) +}).annotate({ "title": "MessageStartEvent" }) +export type SucceededResult = { readonly "message": Message; readonly "type": "succeeded" } +export const SucceededResult = Schema.Struct({ + "message": Message, + "type": Schema.Literal("succeeded").annotate({ "title": "Type", "default": "succeeded" }) +}).annotate({ "title": "SucceededResult" }) +export type InputContentBlock = + | { + readonly "cache_control"?: CacheControlEphemeral | null + readonly "citations"?: + | ReadonlyArray< + | RequestCharLocationCitation + | RequestPageLocationCitation + | RequestContentBlockLocationCitation + | RequestWebSearchResultLocationCitation + | RequestSearchResultLocationCitation + > + | null + readonly "text": string + readonly "type": "text" + } + | { + readonly "cache_control"?: CacheControlEphemeral | null + readonly "source": Base64ImageSource | URLImageSource + readonly "type": "image" + } + | { + readonly "cache_control"?: CacheControlEphemeral | null + readonly "citations"?: RequestCitationsConfig | null + readonly "context"?: string | null + readonly "source": Base64PDFSource | PlainTextSource | ContentBlockSource | URLPDFSource + readonly "title"?: string | null + readonly "type": "document" + } + | { + readonly "cache_control"?: CacheControlEphemeral | null + readonly "citations"?: RequestCitationsConfig + readonly "content": ReadonlyArray + readonly "source": string + readonly "title": string + readonly "type": "search_result" + } + | { readonly "signature": string; readonly "thinking": string; readonly "type": "thinking" } + | { readonly "data": string; readonly "type": "redacted_thinking" } + | { + readonly "cache_control"?: CacheControlEphemeral | null + readonly "caller"?: DirectCaller | ServerToolCaller | ServerToolCaller_20260120 + readonly "id": string + readonly "input": { readonly [x: string]: unknown } + readonly "name": string + readonly "type": "tool_use" + } + | { + readonly "cache_control"?: CacheControlEphemeral | null + readonly "content"?: + | string + | ReadonlyArray< + | RequestTextBlock + | RequestImageBlock + | RequestSearchResultBlock + | RequestDocumentBlock + | RequestToolReferenceBlock + > + readonly "is_error"?: boolean + readonly "tool_use_id": string + readonly "type": "tool_result" + } + | RequestServerToolUseBlock + | RequestWebSearchToolResultBlock + | RequestWebFetchToolResultBlock + | RequestCodeExecutionToolResultBlock + | RequestBashCodeExecutionToolResultBlock + | RequestTextEditorCodeExecutionToolResultBlock + | RequestToolSearchToolResultBlock + | RequestContainerUploadBlock +export const InputContentBlock = Schema.Union([ + Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "citations": Schema.optionalKey( + Schema.Union([ + Schema.Array( + Schema.Union([ + RequestCharLocationCitation, + RequestPageLocationCitation, + RequestContentBlockLocationCitation, + RequestWebSearchResultLocationCitation, + RequestSearchResultLocationCitation + ], { mode: "oneOf" }) + ), + Schema.Null + ]).annotate({ "title": "Citations" }) + ), + "text": Schema.String.annotate({ "title": "Text" }).check(Schema.isMinLength(1)), + "type": Schema.Literal("text").annotate({ "title": "Type" }) + }).annotate({ "title": "RequestTextBlock", "description": "Regular text content." }), + Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "source": Schema.Union([Base64ImageSource, URLImageSource], { mode: "oneOf" }).annotate({ "title": "Source" }), + "type": Schema.Literal("image").annotate({ "title": "Type" }) + }).annotate({ + "title": "RequestImageBlock", + "description": "Image content specified directly as base64 data or as a reference via a URL." + }), + Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "citations": Schema.optionalKey(Schema.Union([RequestCitationsConfig, Schema.Null])), + "context": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMinLength(1)), Schema.Null]).annotate({ "title": "Context" }) + ), + "source": Schema.Union([Base64PDFSource, PlainTextSource, ContentBlockSource, URLPDFSource], { mode: "oneOf" }) + .annotate({ "title": "Source" }), + "title": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMinLength(1)).check(Schema.isMaxLength(500)), Schema.Null]).annotate({ + "title": "Title" + }) + ), + "type": Schema.Literal("document").annotate({ "title": "Type" }) + }).annotate({ + "title": "RequestDocumentBlock", + "description": "Document content, either specified directly as base64 data, as text, or as a reference via a URL." + }), + Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "citations": Schema.optionalKey(RequestCitationsConfig), + "content": Schema.Array(RequestTextBlock).annotate({ "title": "Content" }), + "source": Schema.String.annotate({ "title": "Source" }), + "title": Schema.String.annotate({ "title": "Title" }), + "type": Schema.Literal("search_result").annotate({ "title": "Type" }) + }).annotate({ + "title": "RequestSearchResultBlock", + "description": "A search result block containing source, title, and content from search operations." + }), + Schema.Struct({ + "signature": Schema.String.annotate({ "title": "Signature" }), + "thinking": Schema.String.annotate({ "title": "Thinking" }), + "type": Schema.Literal("thinking").annotate({ "title": "Type" }) + }).annotate({ "title": "RequestThinkingBlock", "description": "A block specifying internal thinking by the model." }), + Schema.Struct({ + "data": Schema.String.annotate({ "title": "Data" }), + "type": Schema.Literal("redacted_thinking").annotate({ "title": "Type" }) + }).annotate({ + "title": "RequestRedactedThinkingBlock", + "description": "A block specifying internal, redacted thinking by the model." + }), + Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "caller": Schema.optionalKey( + Schema.Union([DirectCaller, ServerToolCaller, ServerToolCaller_20260120], { mode: "oneOf" }).annotate({ + "title": "Caller" + }) + ), + "id": Schema.String.annotate({ "title": "Id" }).check(Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$"))), + "input": Schema.Record(Schema.String, Schema.Unknown).annotate({ "title": "Input" }), + "name": Schema.String.annotate({ "title": "Name" }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(200)), + "type": Schema.Literal("tool_use").annotate({ "title": "Type" }) + }).annotate({ "title": "RequestToolUseBlock", "description": "A block indicating a tool use by the model." }), + Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": "Create a cache control breakpoint at this content block." + }) + ), + "content": Schema.optionalKey( + Schema.Union([ + Schema.String, + Schema.Array( + Schema.Union([ + RequestTextBlock, + RequestImageBlock, + RequestSearchResultBlock, + RequestDocumentBlock, + RequestToolReferenceBlock + ], { mode: "oneOf" }).annotate({ "title": "Block" }) + ) + ]).annotate({ "title": "Content" }) + ), + "is_error": Schema.optionalKey(Schema.Boolean.annotate({ "title": "Is Error" })), + "tool_use_id": Schema.String.annotate({ "title": "Tool Use Id" }).check( + Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]+$")) + ), + "type": Schema.Literal("tool_result").annotate({ "title": "Type" }) + }).annotate({ + "title": "RequestToolResultBlock", + "description": "A block specifying the results of a tool use by the model." + }), + RequestServerToolUseBlock, + RequestWebSearchToolResultBlock, + RequestWebFetchToolResultBlock, + RequestCodeExecutionToolResultBlock, + RequestBashCodeExecutionToolResultBlock, + RequestTextEditorCodeExecutionToolResultBlock, + RequestToolSearchToolResultBlock, + RequestContainerUploadBlock +], { mode: "oneOf" }) +export type BetaManagedAgentsListSessions = { + readonly "data"?: ReadonlyArray + readonly "next_page"?: string +} +export const BetaManagedAgentsListSessions = Schema.Struct({ + "data": Schema.optionalKey(Schema.Array(BetaManagedAgentsSession).annotate({ "description": "List of sessions." })), + "next_page": Schema.optionalKey( + Schema.String.annotate({ "description": "Opaque cursor for the next page. Null when no more results." }) + ) +}).annotate({ "description": "Paginated list of sessions." }) +export type BetaInputMessage = { + readonly "content": string | ReadonlyArray + readonly "role": "user" | "assistant" +} +export const BetaInputMessage = Schema.Struct({ + "content": Schema.Union([Schema.String, Schema.Array(BetaInputContentBlock)]).annotate({ "title": "Content" }), + "role": Schema.Literals(["user", "assistant"]).annotate({ "title": "Role" }) +}).annotate({ "title": "InputMessage" }) +export type InputMessage = { + readonly "content": string | ReadonlyArray + readonly "role": "user" | "assistant" +} +export const InputMessage = Schema.Struct({ + "content": Schema.Union([Schema.String, Schema.Array(InputContentBlock)]).annotate({ "title": "Content" }), + "role": Schema.Literals(["user", "assistant"]).annotate({ "title": "Role" }) +}).annotate({ "title": "InputMessage" }) +export type BetaCountMessageTokensParams = { + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "context_management"?: BetaContextManagementConfig | null + readonly "mcp_servers"?: ReadonlyArray + readonly "messages": ReadonlyArray + readonly "model": Model + readonly "output_config"?: { + readonly "effort"?: BetaEffortLevel | null + readonly "format"?: BetaJsonOutputFormat | null + readonly "task_budget"?: BetaTokenTaskBudget | null + } + readonly "output_format"?: BetaJsonOutputFormat | null + readonly "speed"?: BetaSpeed | null + readonly "system"?: string | ReadonlyArray + readonly "thinking"?: BetaThinkingConfigParam + readonly "tool_choice"?: BetaToolChoice + readonly "tools"?: ReadonlyArray< + | BetaTool + | BetaBashTool_20241022 + | BetaBashTool_20250124 + | BetaCodeExecutionTool_20250522 + | BetaCodeExecutionTool_20250825 + | BetaCodeExecutionTool_20260120 + | BetaComputerUseTool_20241022 + | BetaMemoryTool_20250818 + | BetaComputerUseTool_20250124 + | BetaTextEditor_20241022 + | BetaComputerUseTool_20251124 + | BetaTextEditor_20250124 + | BetaTextEditor_20250429 + | BetaTextEditor_20250728 + | BetaWebSearchTool_20250305 + | BetaWebFetchTool_20250910 + | BetaWebSearchTool_20260209 + | BetaWebFetchTool_20260209 + | BetaWebFetchTool_20260309 + | BetaAdvisorTool_20260301 + | BetaToolSearchToolBM25_20251119 + | BetaToolSearchToolRegex_20251119 + | BetaMCPToolset + > +} +export const BetaCountMessageTokensParams = Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": + "Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request." + }) + ), + "context_management": Schema.optionalKey( + Schema.Union([BetaContextManagementConfig, Schema.Null]).annotate({ + "description": + "Context management configuration.\n\nThis allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not." + }) + ), + "mcp_servers": Schema.optionalKey( + Schema.Array(BetaRequestMCPServerURLDefinition).annotate({ + "title": "Mcp Servers", + "description": "MCP servers to be utilized in this request" + }).check(Schema.isMaxLength(20)) + ), + "messages": Schema.Array(BetaInputMessage).annotate({ + "title": "Messages", + "description": + "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:\n\n```json\n[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"Hello there.\"},\n {\"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\"},\n {\"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\"},\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"},\n]\n```\n\nEach input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `\"text\"`. The following input messages are equivalent:\n\n```json\n{\"role\": \"user\", \"content\": \"Hello, Claude\"}\n```\n\n```json\n{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Hello, Claude\"}]}\n```\n\nSee [input examples](https://docs.claude.com/en/api/messages-examples).\n\nNote that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `\"system\"` role for input messages in the Messages API.\n\nThere is a limit of 100,000 messages in a single request." + }), + "model": Model, + "output_config": Schema.optionalKey( + Schema.Struct({ + "effort": Schema.optionalKey( + Schema.Union([BetaEffortLevel, Schema.Null]).annotate({ + "description": + "How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer.\n\nValid values are `low`, `medium`, `high`, `xhigh`, or `max`." + }) + ), + "format": Schema.optionalKey( + Schema.Union([BetaJsonOutputFormat, Schema.Null]).annotate({ + "description": + "A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)" + }) + ), + "task_budget": Schema.optionalKey( + Schema.Union([BetaTokenTaskBudget, Schema.Null]).annotate({ + "description": "Configuration for token budget tracking across contexts." + }) + ) + }).annotate({ + "title": "OutputConfig", + "description": "Configuration options for the model's output, such as the output format." + }) + ), + "output_format": Schema.optionalKey( + Schema.Union([BetaJsonOutputFormat, Schema.Null]).annotate({ + "description": + "Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)\n\nA schema to specify Claude's output format in responses. This parameter will be removed in a future release." + }) + ), + "speed": Schema.optionalKey( + Schema.Union([BetaSpeed, Schema.Null]).annotate({ + "description": + "The inference speed mode for this request. `\"fast\"` enables high output-tokens-per-second inference." + }) + ), + "system": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Array(BetaRequestTextBlock)]).annotate({ + "title": "System", + "description": + "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts)." + }) + ), + "thinking": Schema.optionalKey(BetaThinkingConfigParam), + "tool_choice": Schema.optionalKey(BetaToolChoice), + "tools": Schema.optionalKey( + Schema.Array( + Schema.Union([ + BetaTool, + BetaBashTool_20241022, + BetaBashTool_20250124, + BetaCodeExecutionTool_20250522, + BetaCodeExecutionTool_20250825, + BetaCodeExecutionTool_20260120, + BetaComputerUseTool_20241022, + BetaMemoryTool_20250818, + BetaComputerUseTool_20250124, + BetaTextEditor_20241022, + BetaComputerUseTool_20251124, + BetaTextEditor_20250124, + BetaTextEditor_20250429, + BetaTextEditor_20250728, + BetaWebSearchTool_20250305, + BetaWebFetchTool_20250910, + BetaWebSearchTool_20260209, + BetaWebFetchTool_20260209, + BetaWebFetchTool_20260309, + BetaAdvisorTool_20260301, + BetaToolSearchToolBM25_20251119, + BetaToolSearchToolRegex_20251119, + BetaMCPToolset + ], { mode: "oneOf" }) + ).annotate({ + "title": "Tools", + "description": + "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.\n\nThere are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview\\#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).\n\nEach tool definition includes:\n\n* `name`: Name of the tool.\n* `description`: Optional, but strongly-recommended description of the tool.\n* `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce `tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an input, and return the following back to the model in a subsequent `user` message:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.\n\nSee our [guide](https://docs.claude.com/en/docs/tool-use) for more details." + }) + ) +}).annotate({ "title": "CountMessageTokensParams" }) +export type BetaCreateMessageParams = { + readonly "model": Model + readonly "messages": ReadonlyArray + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "container"?: BetaContainerParams | string | null + readonly "context_management"?: BetaContextManagementConfig | null + readonly "diagnostics"?: BetaDiagnosticsParam | null + readonly "inference_geo"?: string | null + readonly "max_tokens": number + readonly "mcp_servers"?: ReadonlyArray + readonly "metadata"?: { readonly "user_id"?: string | null } + readonly "output_config"?: { + readonly "effort"?: BetaEffortLevel | null + readonly "format"?: BetaJsonOutputFormat | null + readonly "task_budget"?: BetaTokenTaskBudget | null + } + readonly "output_format"?: BetaJsonOutputFormat | null + readonly "service_tier"?: "auto" | "standard_only" + readonly "speed"?: BetaSpeed | null + readonly "stop_sequences"?: ReadonlyArray + readonly "stream"?: boolean + readonly "system"?: string | ReadonlyArray + readonly "temperature"?: number + readonly "thinking"?: BetaThinkingConfigParam + readonly "tool_choice"?: BetaToolChoice + readonly "tools"?: ReadonlyArray< + | BetaTool + | BetaBashTool_20241022 + | BetaBashTool_20250124 + | BetaCodeExecutionTool_20250522 + | BetaCodeExecutionTool_20250825 + | BetaCodeExecutionTool_20260120 + | BetaComputerUseTool_20241022 + | BetaMemoryTool_20250818 + | BetaComputerUseTool_20250124 + | BetaTextEditor_20241022 + | BetaComputerUseTool_20251124 + | BetaTextEditor_20250124 + | BetaTextEditor_20250429 + | BetaTextEditor_20250728 + | BetaWebSearchTool_20250305 + | BetaWebFetchTool_20250910 + | BetaWebSearchTool_20260209 + | BetaWebFetchTool_20260209 + | BetaWebFetchTool_20260309 + | BetaAdvisorTool_20260301 + | BetaToolSearchToolBM25_20251119 + | BetaToolSearchToolRegex_20251119 + | BetaMCPToolset + > + readonly "top_k"?: number + readonly "top_p"?: number + readonly "user_profile_id"?: string | null +} +export const BetaCreateMessageParams = Schema.Struct({ + "model": Model, + "messages": Schema.Array(BetaInputMessage).annotate({ + "title": "Messages", + "description": + "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:\n\n```json\n[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"Hello there.\"},\n {\"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\"},\n {\"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\"},\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"},\n]\n```\n\nEach input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `\"text\"`. The following input messages are equivalent:\n\n```json\n{\"role\": \"user\", \"content\": \"Hello, Claude\"}\n```\n\n```json\n{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Hello, Claude\"}]}\n```\n\nSee [input examples](https://docs.claude.com/en/api/messages-examples).\n\nNote that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `\"system\"` role for input messages in the Messages API.\n\nThere is a limit of 100,000 messages in a single request." + }), + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": + "Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request." + }) + ), + "container": Schema.optionalKey( + Schema.Union([BetaContainerParams, Schema.String, Schema.Null]).annotate({ + "title": "Container", + "description": "Container identifier for reuse across requests." + }) + ), + "context_management": Schema.optionalKey( + Schema.Union([BetaContextManagementConfig, Schema.Null]).annotate({ + "description": + "Context management configuration.\n\nThis allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not." + }) + ), + "diagnostics": Schema.optionalKey( + Schema.Union([BetaDiagnosticsParam, Schema.Null]).annotate({ + "description": + "Request-level diagnostics. Supply `previous_message_id` to have the response include `diagnostics.cache_miss_reason` explaining any prompt-cache divergence from that prior request." + }) + ), + "inference_geo": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Inference Geo", + "description": + "Specifies the geographic region for inference processing. If not specified, the workspace's `default_inference_geo` is used." + }) + ), + "max_tokens": Schema.Number.annotate({ + "title": "Max Tokens", + "description": + "The maximum number of tokens to generate before stopping.\n\nNote that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.\n\nSet to `0` to populate the [prompt cache](https://docs.claude.com/en/docs/build-with-claude/prompt-caching#pre-warming-the-cache) without generating a response.\n\nDifferent models have different maximum values for this parameter. See [models](https://docs.claude.com/en/docs/models-overview) for details." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "mcp_servers": Schema.optionalKey( + Schema.Array(BetaRequestMCPServerURLDefinition).annotate({ + "title": "Mcp Servers", + "description": "MCP servers to be utilized in this request" + }).check(Schema.isMaxLength(20)) + ), + "metadata": Schema.optionalKey( + Schema.Struct({ + "user_id": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMaxLength(512)), Schema.Null]).annotate({ + "title": "User Id", + "description": + "An external identifier for the user who is associated with the request.\n\nThis should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number." + }) + ) + }).annotate({ "title": "Metadata", "description": "An object describing metadata about the request." }) + ), + "output_config": Schema.optionalKey( + Schema.Struct({ + "effort": Schema.optionalKey( + Schema.Union([BetaEffortLevel, Schema.Null]).annotate({ + "description": + "How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer.\n\nValid values are `low`, `medium`, `high`, `xhigh`, or `max`." + }) + ), + "format": Schema.optionalKey( + Schema.Union([BetaJsonOutputFormat, Schema.Null]).annotate({ + "description": + "A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)" + }) + ), + "task_budget": Schema.optionalKey( + Schema.Union([BetaTokenTaskBudget, Schema.Null]).annotate({ + "description": "Configuration for token budget tracking across contexts." + }) + ) + }).annotate({ + "title": "OutputConfig", + "description": "Configuration options for the model's output, such as the output format." + }) + ), + "output_format": Schema.optionalKey( + Schema.Union([BetaJsonOutputFormat, Schema.Null]).annotate({ + "description": + "Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)\n\nA schema to specify Claude's output format in responses. This parameter will be removed in a future release." + }) + ), + "service_tier": Schema.optionalKey( + Schema.Literals(["auto", "standard_only"]).annotate({ + "title": "Service Tier", + "description": + "Determines whether to use priority capacity (if available) or standard capacity for this request.\n\nAnthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details." + }) + ), + "speed": Schema.optionalKey( + Schema.Union([BetaSpeed, Schema.Null]).annotate({ + "description": + "The inference speed mode for this request. `\"fast\"` enables high output-tokens-per-second inference." + }) + ), + "stop_sequences": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "title": "Stop Sequences", + "description": + "Custom text sequences that will cause the model to stop generating.\n\nOur models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `\"end_turn\"`.\n\nIf you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `\"stop_sequence\"` and the response `stop_sequence` value will contain the matched stop sequence." + }) + ), + "stream": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Stream", + "description": + "Whether to incrementally stream the response using server-sent events.\n\nSee [streaming](https://docs.claude.com/en/api/messages-streaming) for details." + }) + ), + "system": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Array(BetaRequestTextBlock)]).annotate({ + "title": "System", + "description": + "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts)." + }) + ), + "temperature": Schema.optionalKey( + Schema.Number.annotate({ + "title": "Temperature", + "description": + "Amount of randomness injected into the response.\n\nDefaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.\n\nNote that even with `temperature` of `0.0`, the results will not be fully deterministic." + }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)) + ), + "thinking": Schema.optionalKey(BetaThinkingConfigParam), + "tool_choice": Schema.optionalKey(BetaToolChoice), + "tools": Schema.optionalKey( + Schema.Array( + Schema.Union([ + BetaTool, + BetaBashTool_20241022, + BetaBashTool_20250124, + BetaCodeExecutionTool_20250522, + BetaCodeExecutionTool_20250825, + BetaCodeExecutionTool_20260120, + BetaComputerUseTool_20241022, + BetaMemoryTool_20250818, + BetaComputerUseTool_20250124, + BetaTextEditor_20241022, + BetaComputerUseTool_20251124, + BetaTextEditor_20250124, + BetaTextEditor_20250429, + BetaTextEditor_20250728, + BetaWebSearchTool_20250305, + BetaWebFetchTool_20250910, + BetaWebSearchTool_20260209, + BetaWebFetchTool_20260209, + BetaWebFetchTool_20260309, + BetaAdvisorTool_20260301, + BetaToolSearchToolBM25_20251119, + BetaToolSearchToolRegex_20251119, + BetaMCPToolset + ], { mode: "oneOf" }) + ).annotate({ + "title": "Tools", + "description": + "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.\n\nThere are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview\\#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).\n\nEach tool definition includes:\n\n* `name`: Name of the tool.\n* `description`: Optional, but strongly-recommended description of the tool.\n* `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce `tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an input, and return the following back to the model in a subsequent `user` message:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.\n\nSee our [guide](https://docs.claude.com/en/docs/tool-use) for more details." + }) + ), + "top_k": Schema.optionalKey( + Schema.Number.annotate({ + "title": "Top K", + "description": + "Only sample from the top K options for each subsequent token.\n\nUsed to remove \"long tail\" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).\n\nRecommended for advanced use cases only." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)) + ), + "top_p": Schema.optionalKey( + Schema.Number.annotate({ + "title": "Top P", + "description": + "Use nucleus sampling.\n\nIn nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`.\n\nRecommended for advanced use cases only." + }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)) + ), + "user_profile_id": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "User Profile Id", + "description": + "The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization." + }) + ) +}).annotate({ "title": "CreateMessageParams" }) +export type BetaMessageBatchIndividualRequestParams = { + readonly "custom_id": string + readonly "params": { + readonly "model": Model + readonly "messages": ReadonlyArray + readonly "cache_control"?: BetaCacheControlEphemeral | null + readonly "container"?: BetaContainerParams | string | null + readonly "context_management"?: BetaContextManagementConfig | null + readonly "diagnostics"?: BetaDiagnosticsParam | null + readonly "inference_geo"?: string | null + readonly "max_tokens": number + readonly "mcp_servers"?: ReadonlyArray + readonly "metadata"?: { readonly "user_id"?: string | null } + readonly "output_config"?: { + readonly "effort"?: BetaEffortLevel | null + readonly "format"?: BetaJsonOutputFormat | null + readonly "task_budget"?: BetaTokenTaskBudget | null + } + readonly "output_format"?: BetaJsonOutputFormat | null + readonly "service_tier"?: "auto" | "standard_only" + readonly "speed"?: BetaSpeed | null + readonly "stop_sequences"?: ReadonlyArray + readonly "stream"?: boolean + readonly "system"?: string | ReadonlyArray + readonly "temperature"?: number + readonly "thinking"?: BetaThinkingConfigParam + readonly "tool_choice"?: BetaToolChoice + readonly "tools"?: ReadonlyArray< + | BetaTool + | BetaBashTool_20241022 + | BetaBashTool_20250124 + | BetaCodeExecutionTool_20250522 + | BetaCodeExecutionTool_20250825 + | BetaCodeExecutionTool_20260120 + | BetaComputerUseTool_20241022 + | BetaMemoryTool_20250818 + | BetaComputerUseTool_20250124 + | BetaTextEditor_20241022 + | BetaComputerUseTool_20251124 + | BetaTextEditor_20250124 + | BetaTextEditor_20250429 + | BetaTextEditor_20250728 + | BetaWebSearchTool_20250305 + | BetaWebFetchTool_20250910 + | BetaWebSearchTool_20260209 + | BetaWebFetchTool_20260209 + | BetaWebFetchTool_20260309 + | BetaAdvisorTool_20260301 + | BetaToolSearchToolBM25_20251119 + | BetaToolSearchToolRegex_20251119 + | BetaMCPToolset + > + readonly "top_k"?: number + readonly "top_p"?: number + readonly "user_profile_id"?: string | null + } +} +export const BetaMessageBatchIndividualRequestParams = Schema.Struct({ + "custom_id": Schema.String.annotate({ + "title": "Custom Id", + "description": + "Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order.\n\nMust be unique for each request within the Message Batch." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(64)).check( + Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]{1,64}$")) + ), + "params": Schema.Struct({ + "model": Model, + "messages": Schema.Array(BetaInputMessage).annotate({ + "title": "Messages", + "description": + "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:\n\n```json\n[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"Hello there.\"},\n {\"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\"},\n {\"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\"},\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"},\n]\n```\n\nEach input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `\"text\"`. The following input messages are equivalent:\n\n```json\n{\"role\": \"user\", \"content\": \"Hello, Claude\"}\n```\n\n```json\n{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Hello, Claude\"}]}\n```\n\nSee [input examples](https://docs.claude.com/en/api/messages-examples).\n\nNote that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `\"system\"` role for input messages in the Messages API.\n\nThere is a limit of 100,000 messages in a single request." + }), + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([BetaCacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": + "Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request." + }) + ), + "container": Schema.optionalKey( + Schema.Union([BetaContainerParams, Schema.String, Schema.Null]).annotate({ + "title": "Container", + "description": "Container identifier for reuse across requests." + }) + ), + "context_management": Schema.optionalKey( + Schema.Union([BetaContextManagementConfig, Schema.Null]).annotate({ + "description": + "Context management configuration.\n\nThis allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not." + }) + ), + "diagnostics": Schema.optionalKey( + Schema.Union([BetaDiagnosticsParam, Schema.Null]).annotate({ + "description": + "Request-level diagnostics. Supply `previous_message_id` to have the response include `diagnostics.cache_miss_reason` explaining any prompt-cache divergence from that prior request." + }) + ), + "inference_geo": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Inference Geo", + "description": + "Specifies the geographic region for inference processing. If not specified, the workspace's `default_inference_geo` is used." + }) + ), + "max_tokens": Schema.Number.annotate({ + "title": "Max Tokens", + "description": + "The maximum number of tokens to generate before stopping.\n\nNote that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.\n\nSet to `0` to populate the [prompt cache](https://docs.claude.com/en/docs/build-with-claude/prompt-caching#pre-warming-the-cache) without generating a response.\n\nDifferent models have different maximum values for this parameter. See [models](https://docs.claude.com/en/docs/models-overview) for details." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "mcp_servers": Schema.optionalKey( + Schema.Array(BetaRequestMCPServerURLDefinition).annotate({ + "title": "Mcp Servers", + "description": "MCP servers to be utilized in this request" + }).check(Schema.isMaxLength(20)) + ), + "metadata": Schema.optionalKey( + Schema.Struct({ + "user_id": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMaxLength(512)), Schema.Null]).annotate({ + "title": "User Id", + "description": + "An external identifier for the user who is associated with the request.\n\nThis should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number." + }) + ) + }).annotate({ "title": "Metadata", "description": "An object describing metadata about the request." }) + ), + "output_config": Schema.optionalKey( + Schema.Struct({ + "effort": Schema.optionalKey( + Schema.Union([BetaEffortLevel, Schema.Null]).annotate({ + "description": + "How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer.\n\nValid values are `low`, `medium`, `high`, `xhigh`, or `max`." + }) + ), + "format": Schema.optionalKey( + Schema.Union([BetaJsonOutputFormat, Schema.Null]).annotate({ + "description": + "A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)" + }) + ), + "task_budget": Schema.optionalKey( + Schema.Union([BetaTokenTaskBudget, Schema.Null]).annotate({ + "description": "Configuration for token budget tracking across contexts." + }) + ) + }).annotate({ + "title": "OutputConfig", + "description": "Configuration options for the model's output, such as the output format." + }) + ), + "output_format": Schema.optionalKey( + Schema.Union([BetaJsonOutputFormat, Schema.Null]).annotate({ + "description": + "Deprecated: Use `output_config.format` instead. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)\n\nA schema to specify Claude's output format in responses. This parameter will be removed in a future release." + }) + ), + "service_tier": Schema.optionalKey( + Schema.Literals(["auto", "standard_only"]).annotate({ + "title": "Service Tier", + "description": + "Determines whether to use priority capacity (if available) or standard capacity for this request.\n\nAnthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details." + }) + ), + "speed": Schema.optionalKey( + Schema.Union([BetaSpeed, Schema.Null]).annotate({ + "description": + "The inference speed mode for this request. `\"fast\"` enables high output-tokens-per-second inference." + }) + ), + "stop_sequences": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "title": "Stop Sequences", + "description": + "Custom text sequences that will cause the model to stop generating.\n\nOur models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `\"end_turn\"`.\n\nIf you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `\"stop_sequence\"` and the response `stop_sequence` value will contain the matched stop sequence." + }) + ), + "stream": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Stream", + "description": + "Whether to incrementally stream the response using server-sent events.\n\nSee [streaming](https://docs.claude.com/en/api/messages-streaming) for details." + }) + ), + "system": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Array(BetaRequestTextBlock)]).annotate({ + "title": "System", + "description": + "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts)." + }) + ), + "temperature": Schema.optionalKey( + Schema.Number.annotate({ + "title": "Temperature", + "description": + "Amount of randomness injected into the response.\n\nDefaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.\n\nNote that even with `temperature` of `0.0`, the results will not be fully deterministic." + }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)) + ), + "thinking": Schema.optionalKey(BetaThinkingConfigParam), + "tool_choice": Schema.optionalKey(BetaToolChoice), + "tools": Schema.optionalKey( + Schema.Array( + Schema.Union([ + BetaTool, + BetaBashTool_20241022, + BetaBashTool_20250124, + BetaCodeExecutionTool_20250522, + BetaCodeExecutionTool_20250825, + BetaCodeExecutionTool_20260120, + BetaComputerUseTool_20241022, + BetaMemoryTool_20250818, + BetaComputerUseTool_20250124, + BetaTextEditor_20241022, + BetaComputerUseTool_20251124, + BetaTextEditor_20250124, + BetaTextEditor_20250429, + BetaTextEditor_20250728, + BetaWebSearchTool_20250305, + BetaWebFetchTool_20250910, + BetaWebSearchTool_20260209, + BetaWebFetchTool_20260209, + BetaWebFetchTool_20260309, + BetaAdvisorTool_20260301, + BetaToolSearchToolBM25_20251119, + BetaToolSearchToolRegex_20251119, + BetaMCPToolset + ], { mode: "oneOf" }) + ).annotate({ + "title": "Tools", + "description": + "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.\n\nThere are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview\\#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).\n\nEach tool definition includes:\n\n* `name`: Name of the tool.\n* `description`: Optional, but strongly-recommended description of the tool.\n* `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce `tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an input, and return the following back to the model in a subsequent `user` message:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.\n\nSee our [guide](https://docs.claude.com/en/docs/tool-use) for more details." + }) + ), + "top_k": Schema.optionalKey( + Schema.Number.annotate({ + "title": "Top K", + "description": + "Only sample from the top K options for each subsequent token.\n\nUsed to remove \"long tail\" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).\n\nRecommended for advanced use cases only." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)) + ), + "top_p": Schema.optionalKey( + Schema.Number.annotate({ + "title": "Top P", + "description": + "Use nucleus sampling.\n\nIn nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`.\n\nRecommended for advanced use cases only." + }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)) + ), + "user_profile_id": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "User Profile Id", + "description": + "The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization." + }) + ) + }).annotate({ + "title": "CreateMessageParams", + "description": + "Messages API creation parameters for the individual request.\n\nSee the [Messages API reference](https://docs.claude.com/en/api/messages) for full documentation on available parameters." + }) +}).annotate({ "title": "MessageBatchIndividualRequestParams" }) +export type CountMessageTokensParams = { + readonly "cache_control"?: CacheControlEphemeral | null + readonly "messages": ReadonlyArray + readonly "model": Model + readonly "output_config"?: { readonly "effort"?: EffortLevel | null; readonly "format"?: JsonOutputFormat | null } + readonly "system"?: string | ReadonlyArray + readonly "thinking"?: ThinkingConfigParam + readonly "tool_choice"?: ToolChoice + readonly "tools"?: ReadonlyArray< + | Tool + | BashTool_20250124 + | CodeExecutionTool_20250522 + | CodeExecutionTool_20250825 + | CodeExecutionTool_20260120 + | MemoryTool_20250818 + | TextEditor_20250124 + | TextEditor_20250429 + | TextEditor_20250728 + | WebSearchTool_20250305 + | WebFetchTool_20250910 + | WebSearchTool_20260209 + | WebFetchTool_20260209 + | WebFetchTool_20260309 + | ToolSearchToolBM25_20251119 + | ToolSearchToolRegex_20251119 + > +} +export const CountMessageTokensParams = Schema.Struct({ + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": + "Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request." + }) + ), + "messages": Schema.Array(InputMessage).annotate({ + "title": "Messages", + "description": + "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:\n\n```json\n[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"Hello there.\"},\n {\"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\"},\n {\"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\"},\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"},\n]\n```\n\nEach input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `\"text\"`. The following input messages are equivalent:\n\n```json\n{\"role\": \"user\", \"content\": \"Hello, Claude\"}\n```\n\n```json\n{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Hello, Claude\"}]}\n```\n\nSee [input examples](https://docs.claude.com/en/api/messages-examples).\n\nNote that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `\"system\"` role for input messages in the Messages API.\n\nThere is a limit of 100,000 messages in a single request." + }), + "model": Model, + "output_config": Schema.optionalKey( + Schema.Struct({ + "effort": Schema.optionalKey( + Schema.Union([EffortLevel, Schema.Null]).annotate({ + "description": + "How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer.\n\nValid values are `low`, `medium`, `high`, `xhigh`, or `max`." + }) + ), + "format": Schema.optionalKey( + Schema.Union([JsonOutputFormat, Schema.Null]).annotate({ + "description": + "A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)" + }) + ) + }).annotate({ + "title": "OutputConfig", + "description": "Configuration options for the model's output, such as the output format." + }) + ), + "system": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Array(RequestTextBlock)]).annotate({ + "title": "System", + "description": + "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts)." + }) + ), + "thinking": Schema.optionalKey(ThinkingConfigParam), + "tool_choice": Schema.optionalKey(ToolChoice), + "tools": Schema.optionalKey( + Schema.Array( + Schema.Union([ + Tool, + BashTool_20250124, + CodeExecutionTool_20250522, + CodeExecutionTool_20250825, + CodeExecutionTool_20260120, + MemoryTool_20250818, + TextEditor_20250124, + TextEditor_20250429, + TextEditor_20250728, + WebSearchTool_20250305, + WebFetchTool_20250910, + WebSearchTool_20260209, + WebFetchTool_20260209, + WebFetchTool_20260309, + ToolSearchToolBM25_20251119, + ToolSearchToolRegex_20251119 + ], { mode: "oneOf" }) + ).annotate({ + "title": "Tools", + "description": + "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.\n\nThere are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview\\#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).\n\nEach tool definition includes:\n\n* `name`: Name of the tool.\n* `description`: Optional, but strongly-recommended description of the tool.\n* `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce `tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an input, and return the following back to the model in a subsequent `user` message:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.\n\nSee our [guide](https://docs.claude.com/en/docs/tool-use) for more details." + }) + ) +}).annotate({ "title": "CountMessageTokensParams" }) +export type CreateMessageParams = { + readonly "model": Model + readonly "messages": ReadonlyArray + readonly "cache_control"?: CacheControlEphemeral | null + readonly "container"?: string | null + readonly "inference_geo"?: string | null + readonly "max_tokens": number + readonly "metadata"?: { readonly "user_id"?: string | null } + readonly "output_config"?: { readonly "effort"?: EffortLevel | null; readonly "format"?: JsonOutputFormat | null } + readonly "service_tier"?: "auto" | "standard_only" + readonly "stop_sequences"?: ReadonlyArray + readonly "stream"?: boolean + readonly "system"?: string | ReadonlyArray + readonly "temperature"?: number + readonly "thinking"?: ThinkingConfigParam + readonly "tool_choice"?: ToolChoice + readonly "tools"?: ReadonlyArray< + | Tool + | BashTool_20250124 + | CodeExecutionTool_20250522 + | CodeExecutionTool_20250825 + | CodeExecutionTool_20260120 + | MemoryTool_20250818 + | TextEditor_20250124 + | TextEditor_20250429 + | TextEditor_20250728 + | WebSearchTool_20250305 + | WebFetchTool_20250910 + | WebSearchTool_20260209 + | WebFetchTool_20260209 + | WebFetchTool_20260309 + | ToolSearchToolBM25_20251119 + | ToolSearchToolRegex_20251119 + > + readonly "top_k"?: number + readonly "top_p"?: number +} +export const CreateMessageParams = Schema.Struct({ + "model": Model, + "messages": Schema.Array(InputMessage).annotate({ + "title": "Messages", + "description": + "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:\n\n```json\n[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"Hello there.\"},\n {\"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\"},\n {\"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\"},\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"},\n]\n```\n\nEach input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `\"text\"`. The following input messages are equivalent:\n\n```json\n{\"role\": \"user\", \"content\": \"Hello, Claude\"}\n```\n\n```json\n{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Hello, Claude\"}]}\n```\n\nSee [input examples](https://docs.claude.com/en/api/messages-examples).\n\nNote that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `\"system\"` role for input messages in the Messages API.\n\nThere is a limit of 100,000 messages in a single request." + }), + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": + "Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request." + }) + ), + "container": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Container", + "description": "Container identifier for reuse across requests." + }) + ), + "inference_geo": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Inference Geo", + "description": + "Specifies the geographic region for inference processing. If not specified, the workspace's `default_inference_geo` is used." + }) + ), + "max_tokens": Schema.Number.annotate({ + "title": "Max Tokens", + "description": + "The maximum number of tokens to generate before stopping.\n\nNote that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.\n\nSet to `0` to populate the [prompt cache](https://docs.claude.com/en/docs/build-with-claude/prompt-caching#pre-warming-the-cache) without generating a response.\n\nDifferent models have different maximum values for this parameter. See [models](https://docs.claude.com/en/docs/models-overview) for details." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "metadata": Schema.optionalKey( + Schema.Struct({ + "user_id": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMaxLength(512)), Schema.Null]).annotate({ + "title": "User Id", + "description": + "An external identifier for the user who is associated with the request.\n\nThis should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number." + }) + ) + }).annotate({ "title": "Metadata", "description": "An object describing metadata about the request." }) + ), + "output_config": Schema.optionalKey( + Schema.Struct({ + "effort": Schema.optionalKey( + Schema.Union([EffortLevel, Schema.Null]).annotate({ + "description": + "How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer.\n\nValid values are `low`, `medium`, `high`, `xhigh`, or `max`." + }) + ), + "format": Schema.optionalKey( + Schema.Union([JsonOutputFormat, Schema.Null]).annotate({ + "description": + "A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)" + }) + ) + }).annotate({ + "title": "OutputConfig", + "description": "Configuration options for the model's output, such as the output format." + }) + ), + "service_tier": Schema.optionalKey( + Schema.Literals(["auto", "standard_only"]).annotate({ + "title": "Service Tier", + "description": + "Determines whether to use priority capacity (if available) or standard capacity for this request.\n\nAnthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details." + }) + ), + "stop_sequences": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "title": "Stop Sequences", + "description": + "Custom text sequences that will cause the model to stop generating.\n\nOur models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `\"end_turn\"`.\n\nIf you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `\"stop_sequence\"` and the response `stop_sequence` value will contain the matched stop sequence." + }) + ), + "stream": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Stream", + "description": + "Whether to incrementally stream the response using server-sent events.\n\nSee [streaming](https://docs.claude.com/en/api/messages-streaming) for details." + }) + ), + "system": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Array(RequestTextBlock)]).annotate({ + "title": "System", + "description": + "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts)." + }) + ), + "temperature": Schema.optionalKey( + Schema.Number.annotate({ + "title": "Temperature", + "description": + "Amount of randomness injected into the response.\n\nDefaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.\n\nNote that even with `temperature` of `0.0`, the results will not be fully deterministic." + }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)) + ), + "thinking": Schema.optionalKey(ThinkingConfigParam), + "tool_choice": Schema.optionalKey(ToolChoice), + "tools": Schema.optionalKey( + Schema.Array( + Schema.Union([ + Tool, + BashTool_20250124, + CodeExecutionTool_20250522, + CodeExecutionTool_20250825, + CodeExecutionTool_20260120, + MemoryTool_20250818, + TextEditor_20250124, + TextEditor_20250429, + TextEditor_20250728, + WebSearchTool_20250305, + WebFetchTool_20250910, + WebSearchTool_20260209, + WebFetchTool_20260209, + WebFetchTool_20260309, + ToolSearchToolBM25_20251119, + ToolSearchToolRegex_20251119 + ], { mode: "oneOf" }) + ).annotate({ + "title": "Tools", + "description": + "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.\n\nThere are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview\\#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).\n\nEach tool definition includes:\n\n* `name`: Name of the tool.\n* `description`: Optional, but strongly-recommended description of the tool.\n* `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce `tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an input, and return the following back to the model in a subsequent `user` message:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.\n\nSee our [guide](https://docs.claude.com/en/docs/tool-use) for more details." + }) + ), + "top_k": Schema.optionalKey( + Schema.Number.annotate({ + "title": "Top K", + "description": + "Only sample from the top K options for each subsequent token.\n\nUsed to remove \"long tail\" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).\n\nRecommended for advanced use cases only." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)) + ), + "top_p": Schema.optionalKey( + Schema.Number.annotate({ + "title": "Top P", + "description": + "Use nucleus sampling.\n\nIn nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`.\n\nRecommended for advanced use cases only." + }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)) + ) +}).annotate({ "title": "CreateMessageParams" }) +export type MessageBatchIndividualRequestParams = { + readonly "custom_id": string + readonly "params": { + readonly "model": Model + readonly "messages": ReadonlyArray + readonly "cache_control"?: CacheControlEphemeral | null + readonly "container"?: string | null + readonly "inference_geo"?: string | null + readonly "max_tokens": number + readonly "metadata"?: { readonly "user_id"?: string | null } + readonly "output_config"?: { readonly "effort"?: EffortLevel | null; readonly "format"?: JsonOutputFormat | null } + readonly "service_tier"?: "auto" | "standard_only" + readonly "stop_sequences"?: ReadonlyArray + readonly "stream"?: boolean + readonly "system"?: string | ReadonlyArray + readonly "temperature"?: number + readonly "thinking"?: ThinkingConfigParam + readonly "tool_choice"?: ToolChoice + readonly "tools"?: ReadonlyArray< + | Tool + | BashTool_20250124 + | CodeExecutionTool_20250522 + | CodeExecutionTool_20250825 + | CodeExecutionTool_20260120 + | MemoryTool_20250818 + | TextEditor_20250124 + | TextEditor_20250429 + | TextEditor_20250728 + | WebSearchTool_20250305 + | WebFetchTool_20250910 + | WebSearchTool_20260209 + | WebFetchTool_20260209 + | WebFetchTool_20260309 + | ToolSearchToolBM25_20251119 + | ToolSearchToolRegex_20251119 + > + readonly "top_k"?: number + readonly "top_p"?: number + } +} +export const MessageBatchIndividualRequestParams = Schema.Struct({ + "custom_id": Schema.String.annotate({ + "title": "Custom Id", + "description": + "Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order.\n\nMust be unique for each request within the Message Batch." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(64)).check( + Schema.isPattern(new RegExp("^[a-zA-Z0-9_-]{1,64}$")) + ), + "params": Schema.Struct({ + "model": Model, + "messages": Schema.Array(InputMessage).annotate({ + "title": "Messages", + "description": + "Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:\n\n```json\n[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]\n```\n\nExample with multiple conversational turns:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"Hello there.\"},\n {\"role\": \"assistant\", \"content\": \"Hi, I'm Claude. How can I help you?\"},\n {\"role\": \"user\", \"content\": \"Can you explain LLMs in plain English?\"},\n]\n```\n\nExample with a partially-filled response from Claude:\n\n```json\n[\n {\"role\": \"user\", \"content\": \"What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun\"},\n {\"role\": \"assistant\", \"content\": \"The best answer is (\"},\n]\n```\n\nEach input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `\"text\"`. The following input messages are equivalent:\n\n```json\n{\"role\": \"user\", \"content\": \"Hello, Claude\"}\n```\n\n```json\n{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Hello, Claude\"}]}\n```\n\nSee [input examples](https://docs.claude.com/en/api/messages-examples).\n\nNote that if you want to include a [system prompt](https://docs.claude.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `\"system\"` role for input messages in the Messages API.\n\nThere is a limit of 100,000 messages in a single request." + }), + "cache_control": Schema.optionalKey( + Schema.Union([Schema.Union([CacheControlEphemeral], { mode: "oneOf" }), Schema.Null]).annotate({ + "title": "Cache Control", + "description": + "Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request." + }) + ), + "container": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Container", + "description": "Container identifier for reuse across requests." + }) + ), + "inference_geo": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Inference Geo", + "description": + "Specifies the geographic region for inference processing. If not specified, the workspace's `default_inference_geo` is used." + }) + ), + "max_tokens": Schema.Number.annotate({ + "title": "Max Tokens", + "description": + "The maximum number of tokens to generate before stopping.\n\nNote that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate.\n\nSet to `0` to populate the [prompt cache](https://docs.claude.com/en/docs/build-with-claude/prompt-caching#pre-warming-the-cache) without generating a response.\n\nDifferent models have different maximum values for this parameter. See [models](https://docs.claude.com/en/docs/models-overview) for details." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)), + "metadata": Schema.optionalKey( + Schema.Struct({ + "user_id": Schema.optionalKey( + Schema.Union([Schema.String.check(Schema.isMaxLength(512)), Schema.Null]).annotate({ + "title": "User Id", + "description": + "An external identifier for the user who is associated with the request.\n\nThis should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number." + }) + ) + }).annotate({ "title": "Metadata", "description": "An object describing metadata about the request." }) + ), + "output_config": Schema.optionalKey( + Schema.Struct({ + "effort": Schema.optionalKey( + Schema.Union([EffortLevel, Schema.Null]).annotate({ + "description": + "How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer.\n\nValid values are `low`, `medium`, `high`, `xhigh`, or `max`." + }) + ), + "format": Schema.optionalKey( + Schema.Union([JsonOutputFormat, Schema.Null]).annotate({ + "description": + "A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)" + }) + ) + }).annotate({ + "title": "OutputConfig", + "description": "Configuration options for the model's output, such as the output format." + }) + ), + "service_tier": Schema.optionalKey( + Schema.Literals(["auto", "standard_only"]).annotate({ + "title": "Service Tier", + "description": + "Determines whether to use priority capacity (if available) or standard capacity for this request.\n\nAnthropic offers different levels of service for your API requests. See [service-tiers](https://docs.claude.com/en/api/service-tiers) for details." + }) + ), + "stop_sequences": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "title": "Stop Sequences", + "description": + "Custom text sequences that will cause the model to stop generating.\n\nOur models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `\"end_turn\"`.\n\nIf you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `\"stop_sequence\"` and the response `stop_sequence` value will contain the matched stop sequence." + }) + ), + "stream": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Stream", + "description": + "Whether to incrementally stream the response using server-sent events.\n\nSee [streaming](https://docs.claude.com/en/api/messages-streaming) for details." + }) + ), + "system": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Array(RequestTextBlock)]).annotate({ + "title": "System", + "description": + "System prompt.\n\nA system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://docs.claude.com/en/docs/system-prompts)." + }) + ), + "temperature": Schema.optionalKey( + Schema.Number.annotate({ + "title": "Temperature", + "description": + "Amount of randomness injected into the response.\n\nDefaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0` for analytical / multiple choice, and closer to `1.0` for creative and generative tasks.\n\nNote that even with `temperature` of `0.0`, the results will not be fully deterministic." + }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)) + ), + "thinking": Schema.optionalKey(ThinkingConfigParam), + "tool_choice": Schema.optionalKey(ToolChoice), + "tools": Schema.optionalKey( + Schema.Array( + Schema.Union([ + Tool, + BashTool_20250124, + CodeExecutionTool_20250522, + CodeExecutionTool_20250825, + CodeExecutionTool_20260120, + MemoryTool_20250818, + TextEditor_20250124, + TextEditor_20250429, + TextEditor_20250728, + WebSearchTool_20250305, + WebFetchTool_20250910, + WebSearchTool_20260209, + WebFetchTool_20260209, + WebFetchTool_20260309, + ToolSearchToolBM25_20251119, + ToolSearchToolRegex_20251119 + ], { mode: "oneOf" }) + ).annotate({ + "title": "Tools", + "description": + "Definitions of tools that the model may use.\n\nIf you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks.\n\nThere are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://docs.claude.com/en/docs/agents-and-tools/tool-use/overview\\#server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)).\n\nEach tool definition includes:\n\n* `name`: Name of the tool.\n* `description`: Optional, but strongly-recommended description of the tool.\n* `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks.\n\nFor example, if you defined `tools` as:\n\n```json\n[\n {\n \"name\": \"get_stock_price\",\n \"description\": \"Get the current stock price for a given ticker symbol.\",\n \"input_schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"ticker\": {\n \"type\": \"string\",\n \"description\": \"The stock ticker symbol, e.g. AAPL for Apple Inc.\"\n }\n },\n \"required\": [\"ticker\"]\n }\n }\n]\n```\n\nAnd then asked the model \"What's the S&P 500 at today?\", the model might produce `tool_use` content blocks in the response like this:\n\n```json\n[\n {\n \"type\": \"tool_use\",\n \"id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"name\": \"get_stock_price\",\n \"input\": { \"ticker\": \"^GSPC\" }\n }\n]\n```\n\nYou might then run your `get_stock_price` tool with `{\"ticker\": \"^GSPC\"}` as an input, and return the following back to the model in a subsequent `user` message:\n\n```json\n[\n {\n \"type\": \"tool_result\",\n \"tool_use_id\": \"toolu_01D7FLrfh4GYq7yT1ULFeyMV\",\n \"content\": \"259.75 USD\"\n }\n]\n```\n\nTools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output.\n\nSee our [guide](https://docs.claude.com/en/docs/tool-use) for more details." + }) + ), + "top_k": Schema.optionalKey( + Schema.Number.annotate({ + "title": "Top K", + "description": + "Only sample from the top K options for each subsequent token.\n\nUsed to remove \"long tail\" low probability responses. [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).\n\nRecommended for advanced use cases only." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)) + ), + "top_p": Schema.optionalKey( + Schema.Number.annotate({ + "title": "Top P", + "description": + "Use nucleus sampling.\n\nIn nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by `top_p`.\n\nRecommended for advanced use cases only." + }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)) + ) + }).annotate({ + "title": "CreateMessageParams", + "description": + "Messages API creation parameters for the individual request.\n\nSee the [Messages API reference](https://docs.claude.com/en/api/messages) for full documentation on available parameters." + }) +}).annotate({ "title": "MessageBatchIndividualRequestParams" }) +export type BetaCreateMessageBatchParams = { + readonly "requests": ReadonlyArray +} +export const BetaCreateMessageBatchParams = Schema.Struct({ + "requests": Schema.Array(BetaMessageBatchIndividualRequestParams).annotate({ + "title": "Requests", + "description": "List of requests for prompt completion. Each is an individual request to create a Message." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(100000)) +}).annotate({ "title": "CreateMessageBatchParams" }) +export type CreateMessageBatchParams = { readonly "requests": ReadonlyArray } +export const CreateMessageBatchParams = Schema.Struct({ + "requests": Schema.Array(MessageBatchIndividualRequestParams).annotate({ + "title": "Requests", + "description": "List of requests for prompt completion. Each is an individual request to create a Message." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(100000)) +}).annotate({ "title": "CreateMessageBatchParams" }) +// schemas +export type MessagesPostParams = { readonly "anthropic-version"?: string } +export const MessagesPostParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ) +}) +export type MessagesPostRequestJson = CreateMessageParams +export const MessagesPostRequestJson = CreateMessageParams +export type MessagesPost200 = Message +export const MessagesPost200 = Message +export type MessagesPost4XX = ErrorResponse +export const MessagesPost4XX = ErrorResponse +export type CompletePostParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string } +export const CompletePostParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ) +}) +export type CompletePostRequestJson = CompletionRequest +export const CompletePostRequestJson = CompletionRequest +export type CompletePost200 = CompletionResponse +export const CompletePost200 = CompletionResponse +export type CompletePost4XX = ErrorResponse +export const CompletePost4XX = ErrorResponse +export type ModelsListParams = { + readonly "before_id"?: string + readonly "after_id"?: string + readonly "limit"?: number + readonly "anthropic-version"?: string + readonly "x-api-key"?: string + readonly "anthropic-beta"?: string +} +export const ModelsListParams = Schema.Struct({ + "before_id": Schema.optionalKey( + Schema.String.annotate({ + "title": "Before Id", + "description": + "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object." + }) + ), + "after_id": Schema.optionalKey( + Schema.String.annotate({ + "title": "After Id", + "description": + "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object." + }) + ), + "limit": Schema.optionalKey( + Schema.Number.annotate({ + "title": "Limit", + "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`.", + "default": 20 + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(1000)) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.String.annotate({ + "title": "X-Api-Key", + "description": + "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." + })), + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ) +}) +export type ModelsList200 = ListResponse_ModelInfo_ +export const ModelsList200 = ListResponse_ModelInfo_ +export type ModelsList4XX = ErrorResponse +export const ModelsList4XX = ErrorResponse +export type ModelsGetParams = { + readonly "anthropic-version"?: string + readonly "x-api-key"?: string + readonly "anthropic-beta"?: string +} +export const ModelsGetParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.String.annotate({ + "title": "X-Api-Key", + "description": + "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." + })), + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ) +}) +export type ModelsGet200 = ModelInfo +export const ModelsGet200 = ModelInfo +export type ModelsGet4XX = ErrorResponse +export const ModelsGet4XX = ErrorResponse +export type MessageBatchesListParams = { + readonly "before_id"?: string + readonly "after_id"?: string + readonly "limit"?: number + readonly "anthropic-version"?: string + readonly "x-api-key"?: string +} +export const MessageBatchesListParams = Schema.Struct({ + "before_id": Schema.optionalKey( + Schema.String.annotate({ + "title": "Before Id", + "description": + "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object." + }) + ), + "after_id": Schema.optionalKey( + Schema.String.annotate({ + "title": "After Id", + "description": + "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object." + }) + ), + "limit": Schema.optionalKey( + Schema.Number.annotate({ + "title": "Limit", + "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`.", + "default": 20 + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(1000)) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.String.annotate({ + "title": "X-Api-Key", + "description": + "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." + })) +}) +export type MessageBatchesList200 = ListResponse_MessageBatch_ +export const MessageBatchesList200 = ListResponse_MessageBatch_ +export type MessageBatchesList4XX = ErrorResponse +export const MessageBatchesList4XX = ErrorResponse +export type MessageBatchesPostParams = { readonly "anthropic-version"?: string } +export const MessageBatchesPostParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ) +}) +export type MessageBatchesPostRequestJson = CreateMessageBatchParams +export const MessageBatchesPostRequestJson = CreateMessageBatchParams +export type MessageBatchesPost200 = MessageBatch +export const MessageBatchesPost200 = MessageBatch +export type MessageBatchesPost4XX = ErrorResponse +export const MessageBatchesPost4XX = ErrorResponse +export type MessageBatchesRetrieveParams = { readonly "anthropic-version"?: string; readonly "x-api-key"?: string } +export const MessageBatchesRetrieveParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.String.annotate({ + "title": "X-Api-Key", + "description": + "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." + })) +}) +export type MessageBatchesRetrieve200 = MessageBatch +export const MessageBatchesRetrieve200 = MessageBatch +export type MessageBatchesRetrieve4XX = ErrorResponse +export const MessageBatchesRetrieve4XX = ErrorResponse +export type MessageBatchesDeleteParams = { readonly "anthropic-version"?: string; readonly "x-api-key"?: string } +export const MessageBatchesDeleteParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.String.annotate({ + "title": "X-Api-Key", + "description": + "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." + })) +}) +export type MessageBatchesDelete200 = DeleteMessageBatchResponse +export const MessageBatchesDelete200 = DeleteMessageBatchResponse +export type MessageBatchesDelete4XX = ErrorResponse +export const MessageBatchesDelete4XX = ErrorResponse +export type MessageBatchesCancelParams = { readonly "anthropic-version"?: string } +export const MessageBatchesCancelParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ) +}) +export type MessageBatchesCancel200 = MessageBatch +export const MessageBatchesCancel200 = MessageBatch +export type MessageBatchesCancel4XX = ErrorResponse +export const MessageBatchesCancel4XX = ErrorResponse +export type MessageBatchesResultsParams = { readonly "anthropic-version"?: string; readonly "x-api-key"?: string } +export const MessageBatchesResultsParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.String.annotate({ + "title": "X-Api-Key", + "description": + "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." + })) +}) +export type MessageBatchesResults4XX = ErrorResponse +export const MessageBatchesResults4XX = ErrorResponse +export type MessagesCountTokensPostParams = { readonly "anthropic-version"?: string } +export const MessagesCountTokensPostParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ) +}) +export type MessagesCountTokensPostRequestJson = CountMessageTokensParams +export const MessagesCountTokensPostRequestJson = CountMessageTokensParams +export type MessagesCountTokensPost200 = CountMessageTokensResponse +export const MessagesCountTokensPost200 = CountMessageTokensResponse +export type MessagesCountTokensPost4XX = ErrorResponse +export const MessagesCountTokensPost4XX = ErrorResponse +export type BetaMessagesPostParams = { readonly "anthropic-beta"?: string; readonly "anthropic-version"?: string } +export const BetaMessagesPostParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ) +}) +export type BetaMessagesPostRequestJson = BetaCreateMessageParams +export const BetaMessagesPostRequestJson = BetaCreateMessageParams +export type BetaMessagesPost200 = BetaMessage +export const BetaMessagesPost200 = BetaMessage +export type BetaMessagesPost4XX = BetaErrorResponse +export const BetaMessagesPost4XX = BetaErrorResponse +export type BetaModelsListParams = { + readonly "before_id"?: string + readonly "after_id"?: string + readonly "limit"?: number + readonly "anthropic-version"?: string + readonly "x-api-key"?: string + readonly "anthropic-beta"?: string +} +export const BetaModelsListParams = Schema.Struct({ + "before_id": Schema.optionalKey( + Schema.String.annotate({ + "title": "Before Id", + "description": + "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object." + }) + ), + "after_id": Schema.optionalKey( + Schema.String.annotate({ + "title": "After Id", + "description": + "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object." + }) + ), + "limit": Schema.optionalKey( + Schema.Number.annotate({ + "title": "Limit", + "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`.", + "default": 20 + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(1000)) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.String.annotate({ + "title": "X-Api-Key", + "description": + "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." + })), + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ) +}) +export type BetaModelsList200 = BetaListResponse_ModelInfo_ +export const BetaModelsList200 = BetaListResponse_ModelInfo_ +export type BetaModelsList4XX = BetaErrorResponse +export const BetaModelsList4XX = BetaErrorResponse +export type BetaModelsGetParams = { + readonly "anthropic-version"?: string + readonly "x-api-key"?: string + readonly "anthropic-beta"?: string +} +export const BetaModelsGetParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.String.annotate({ + "title": "X-Api-Key", + "description": + "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." + })), + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ) +}) +export type BetaModelsGet200 = BetaModelInfo +export const BetaModelsGet200 = BetaModelInfo +export type BetaModelsGet4XX = BetaErrorResponse +export const BetaModelsGet4XX = BetaErrorResponse +export type BetaMessageBatchesListParams = { + readonly "before_id"?: string + readonly "after_id"?: string + readonly "limit"?: number + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "x-api-key"?: string +} +export const BetaMessageBatchesListParams = Schema.Struct({ + "before_id": Schema.optionalKey( + Schema.String.annotate({ + "title": "Before Id", + "description": + "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object." + }) + ), + "after_id": Schema.optionalKey( + Schema.String.annotate({ + "title": "After Id", + "description": + "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object." + }) + ), + "limit": Schema.optionalKey( + Schema.Number.annotate({ + "title": "Limit", + "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`.", + "default": 20 + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(1000)) + ), + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.String.annotate({ + "title": "X-Api-Key", + "description": + "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." + })) +}) +export type BetaMessageBatchesList200 = BetaListResponse_MessageBatch_ +export const BetaMessageBatchesList200 = BetaListResponse_MessageBatch_ +export type BetaMessageBatchesList4XX = BetaErrorResponse +export const BetaMessageBatchesList4XX = BetaErrorResponse +export type BetaMessageBatchesPostParams = { readonly "anthropic-beta"?: string; readonly "anthropic-version"?: string } +export const BetaMessageBatchesPostParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ) +}) +export type BetaMessageBatchesPostRequestJson = BetaCreateMessageBatchParams +export const BetaMessageBatchesPostRequestJson = BetaCreateMessageBatchParams +export type BetaMessageBatchesPost200 = BetaMessageBatch +export const BetaMessageBatchesPost200 = BetaMessageBatch +export type BetaMessageBatchesPost4XX = BetaErrorResponse +export const BetaMessageBatchesPost4XX = BetaErrorResponse +export type BetaMessageBatchesRetrieveParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "x-api-key"?: string +} +export const BetaMessageBatchesRetrieveParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.String.annotate({ + "title": "X-Api-Key", + "description": + "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." + })) +}) +export type BetaMessageBatchesRetrieve200 = BetaMessageBatch +export const BetaMessageBatchesRetrieve200 = BetaMessageBatch +export type BetaMessageBatchesRetrieve4XX = BetaErrorResponse +export const BetaMessageBatchesRetrieve4XX = BetaErrorResponse +export type BetaMessageBatchesDeleteParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "x-api-key"?: string +} +export const BetaMessageBatchesDeleteParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.String.annotate({ + "title": "X-Api-Key", + "description": + "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." + })) +}) +export type BetaMessageBatchesDelete200 = BetaDeleteMessageBatchResponse +export const BetaMessageBatchesDelete200 = BetaDeleteMessageBatchResponse +export type BetaMessageBatchesDelete4XX = BetaErrorResponse +export const BetaMessageBatchesDelete4XX = BetaErrorResponse +export type BetaMessageBatchesCancelParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string +} +export const BetaMessageBatchesCancelParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ) +}) +export type BetaMessageBatchesCancel200 = BetaMessageBatch +export const BetaMessageBatchesCancel200 = BetaMessageBatch +export type BetaMessageBatchesCancel4XX = BetaErrorResponse +export const BetaMessageBatchesCancel4XX = BetaErrorResponse +export type BetaMessageBatchesResultsParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "x-api-key"?: string +} +export const BetaMessageBatchesResultsParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.String.annotate({ + "title": "X-Api-Key", + "description": + "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." + })) +}) +export type BetaMessageBatchesResults4XX = BetaErrorResponse +export const BetaMessageBatchesResults4XX = BetaErrorResponse +export type BetaMessagesCountTokensPostParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string +} +export const BetaMessagesCountTokensPostParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ) +}) +export type BetaMessagesCountTokensPostRequestJson = BetaCountMessageTokensParams +export const BetaMessagesCountTokensPostRequestJson = BetaCountMessageTokensParams +export type BetaMessagesCountTokensPost200 = BetaCountMessageTokensResponse +export const BetaMessagesCountTokensPost200 = BetaCountMessageTokensResponse +export type BetaMessagesCountTokensPost4XX = BetaErrorResponse +export const BetaMessagesCountTokensPost4XX = BetaErrorResponse +export type BetaListFilesV1FilesGetParams = { + readonly "before_id"?: string + readonly "after_id"?: string + readonly "limit"?: number + readonly "scope_id"?: string + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "x-api-key"?: string +} +export const BetaListFilesV1FilesGetParams = Schema.Struct({ + "before_id": Schema.optionalKey( + Schema.String.annotate({ + "title": "Before Id", + "description": + "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object." + }) + ), + "after_id": Schema.optionalKey( + Schema.String.annotate({ + "title": "After Id", + "description": + "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object." + }) + ), + "limit": Schema.optionalKey( + Schema.Number.annotate({ + "title": "Limit", + "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`.", + "default": 20 + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(1000)) + ), + "scope_id": Schema.optionalKey( + Schema.String.annotate({ + "title": "Scope Id", + "description": "Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID)." + }) + ), + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.String.annotate({ + "title": "X-Api-Key", + "description": + "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." + })) +}) +export type BetaListFilesV1FilesGet200 = BetaFileListResponse +export const BetaListFilesV1FilesGet200 = BetaFileListResponse +export type BetaListFilesV1FilesGet4XX = BetaErrorResponse +export const BetaListFilesV1FilesGet4XX = BetaErrorResponse +export type BetaUploadFileV1FilesPostParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string +} +export const BetaUploadFileV1FilesPostParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ) +}) +export type BetaUploadFileV1FilesPostRequestFormData = { readonly "file": string } +export const BetaUploadFileV1FilesPostRequestFormData = Schema.Struct({ + "file": Schema.String.annotate({ "description": "The file to upload", "format": "binary" }) +}) +export type BetaUploadFileV1FilesPost200 = BetaFileMetadataSchema +export const BetaUploadFileV1FilesPost200 = BetaFileMetadataSchema +export type BetaUploadFileV1FilesPost4XX = BetaErrorResponse +export const BetaUploadFileV1FilesPost4XX = BetaErrorResponse +export type BetaGetFileMetadataV1FilesFileIdGetParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "x-api-key"?: string +} +export const BetaGetFileMetadataV1FilesFileIdGetParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.String.annotate({ + "title": "X-Api-Key", + "description": + "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." + })) +}) +export type BetaGetFileMetadataV1FilesFileIdGet200 = BetaFileMetadataSchema +export const BetaGetFileMetadataV1FilesFileIdGet200 = BetaFileMetadataSchema +export type BetaGetFileMetadataV1FilesFileIdGet4XX = BetaErrorResponse +export const BetaGetFileMetadataV1FilesFileIdGet4XX = BetaErrorResponse +export type BetaDeleteFileV1FilesFileIdDeleteParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "x-api-key"?: string +} +export const BetaDeleteFileV1FilesFileIdDeleteParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.String.annotate({ + "title": "X-Api-Key", + "description": + "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." + })) +}) +export type BetaDeleteFileV1FilesFileIdDelete200 = BetaFileDeleteResponse +export const BetaDeleteFileV1FilesFileIdDelete200 = BetaFileDeleteResponse +export type BetaDeleteFileV1FilesFileIdDelete4XX = BetaErrorResponse +export const BetaDeleteFileV1FilesFileIdDelete4XX = BetaErrorResponse +export type BetaDownloadFileV1FilesFileIdContentGetParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "x-api-key"?: string +} +export const BetaDownloadFileV1FilesFileIdContentGetParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.String.annotate({ + "title": "X-Api-Key", + "description": + "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." + })) +}) +export type BetaListSkillsV1SkillsGetParams = { + readonly "page"?: string | null + readonly "limit"?: number + readonly "source"?: string | null + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "x-api-key"?: string +} +export const BetaListSkillsV1SkillsGetParams = Schema.Struct({ + "page": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Page", + "description": + "Pagination token for fetching a specific page of results.\n\nPass the value from a previous response's `next_page` field to get the next page of results." + }) + ), + "limit": Schema.optionalKey( + Schema.Number.annotate({ + "title": "Limit", + "description": "Number of results to return per page.\n\nMaximum value is 100. Defaults to 20.", + "default": 20 + }).check(Schema.isInt()) + ), + "source": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Source", + "description": + "Filter skills by source.\n\nIf provided, only skills from the specified source will be returned:\n* `\"custom\"`: only return user-created skills\n* `\"anthropic\"`: only return Anthropic-created skills" + }) + ), + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.String.annotate({ + "title": "X-Api-Key", + "description": + "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." + })) +}) +export type BetaListSkillsV1SkillsGet200 = BetaListSkillsResponse +export const BetaListSkillsV1SkillsGet200 = BetaListSkillsResponse +export type BetaListSkillsV1SkillsGet4XX = BetaErrorResponse +export const BetaListSkillsV1SkillsGet4XX = BetaErrorResponse +export type BetaCreateSkillV1SkillsPostParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string +} +export const BetaCreateSkillV1SkillsPostParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ) +}) +export type BetaCreateSkillV1SkillsPostRequestFormData = BetaBody_create_skill_v1_skills_post +export const BetaCreateSkillV1SkillsPostRequestFormData = BetaBody_create_skill_v1_skills_post +export type BetaCreateSkillV1SkillsPost200 = BetaCreateSkillResponse +export const BetaCreateSkillV1SkillsPost200 = BetaCreateSkillResponse +export type BetaCreateSkillV1SkillsPost4XX = BetaErrorResponse +export const BetaCreateSkillV1SkillsPost4XX = BetaErrorResponse +export type BetaGetSkillV1SkillsSkillIdGetParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "x-api-key"?: string +} +export const BetaGetSkillV1SkillsSkillIdGetParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.String.annotate({ + "title": "X-Api-Key", + "description": + "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." + })) +}) +export type BetaGetSkillV1SkillsSkillIdGet200 = BetaGetSkillResponse +export const BetaGetSkillV1SkillsSkillIdGet200 = BetaGetSkillResponse +export type BetaGetSkillV1SkillsSkillIdGet4XX = BetaErrorResponse +export const BetaGetSkillV1SkillsSkillIdGet4XX = BetaErrorResponse +export type BetaDeleteSkillV1SkillsSkillIdDeleteParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "x-api-key"?: string +} +export const BetaDeleteSkillV1SkillsSkillIdDeleteParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.String.annotate({ + "title": "X-Api-Key", + "description": + "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." + })) +}) +export type BetaDeleteSkillV1SkillsSkillIdDelete200 = BetaDeleteSkillResponse +export const BetaDeleteSkillV1SkillsSkillIdDelete200 = BetaDeleteSkillResponse +export type BetaDeleteSkillV1SkillsSkillIdDelete4XX = BetaErrorResponse +export const BetaDeleteSkillV1SkillsSkillIdDelete4XX = BetaErrorResponse +export type BetaListSkillVersionsV1SkillsSkillIdVersionsGetParams = { + readonly "page"?: string | null + readonly "limit"?: number | null + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "x-api-key"?: string +} +export const BetaListSkillVersionsV1SkillsSkillIdVersionsGetParams = Schema.Struct({ + "page": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Page", + "description": "Optionally set to the `next_page` token from the previous response." + }) + ), + "limit": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "Limit", + "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`." + }) + ), + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.String.annotate({ + "title": "X-Api-Key", + "description": + "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." + })) +}) +export type BetaListSkillVersionsV1SkillsSkillIdVersionsGet200 = BetaListSkillVersionsResponse +export const BetaListSkillVersionsV1SkillsSkillIdVersionsGet200 = BetaListSkillVersionsResponse +export type BetaListSkillVersionsV1SkillsSkillIdVersionsGet4XX = BetaErrorResponse +export const BetaListSkillVersionsV1SkillsSkillIdVersionsGet4XX = BetaErrorResponse +export type BetaCreateSkillVersionV1SkillsSkillIdVersionsPostParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string +} +export const BetaCreateSkillVersionV1SkillsSkillIdVersionsPostParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ) +}) +export type BetaCreateSkillVersionV1SkillsSkillIdVersionsPostRequestFormData = + BetaBody_create_skill_version_v1_skills__skill_id__versions_post +export const BetaCreateSkillVersionV1SkillsSkillIdVersionsPostRequestFormData = + BetaBody_create_skill_version_v1_skills__skill_id__versions_post +export type BetaCreateSkillVersionV1SkillsSkillIdVersionsPost200 = BetaCreateSkillVersionResponse +export const BetaCreateSkillVersionV1SkillsSkillIdVersionsPost200 = BetaCreateSkillVersionResponse +export type BetaCreateSkillVersionV1SkillsSkillIdVersionsPost4XX = BetaErrorResponse +export const BetaCreateSkillVersionV1SkillsSkillIdVersionsPost4XX = BetaErrorResponse +export type BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGetParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "x-api-key"?: string +} +export const BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGetParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.String.annotate({ + "title": "X-Api-Key", + "description": + "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." + })) +}) +export type BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet200 = BetaGetSkillVersionResponse +export const BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet200 = BetaGetSkillVersionResponse +export type BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX = BetaErrorResponse +export const BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX = BetaErrorResponse +export type BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDeleteParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "x-api-key"?: string +} +export const BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDeleteParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.String.annotate({ + "title": "X-Api-Key", + "description": + "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." + })) +}) +export type BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete200 = BetaDeleteSkillVersionResponse +export const BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete200 = BetaDeleteSkillVersionResponse +export type BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX = BetaErrorResponse +export const BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX = BetaErrorResponse +export type BetaDownloadSkillVersionContentV1SkillsSkillIdVersionsVersionContentGetParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "x-api-key"?: string +} +export const BetaDownloadSkillVersionContentV1SkillsSkillIdVersionsVersionContentGetParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.String.annotate({ + "title": "X-Api-Key", + "description": + "Your unique API key for authentication.\n\nThis key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace." + })) +}) +export type BetaListEnvironmentsV1EnvironmentsGetParams = { + readonly "limit"?: number + readonly "page"?: string | null + readonly "include_archived"?: boolean + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "x-api-key"?: string | null +} +export const BetaListEnvironmentsV1EnvironmentsGetParams = Schema.Struct({ + "limit": Schema.optionalKey( + Schema.Number.annotate({ + "title": "Limit", + "description": "Maximum number of environments to return", + "default": 20 + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(1000)) + ), + "page": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Page", + "description": + "Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response." + }) + ), + "include_archived": Schema.optionalKey( + Schema.Boolean.annotate({ + "title": "Include Archived", + "description": "Include archived environments in the response", + "default": false + }) + ), + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "X-Api-Key" })) +}) +export type BetaListEnvironmentsV1EnvironmentsGet200 = BetaEnvironmentListResponse +export const BetaListEnvironmentsV1EnvironmentsGet200 = BetaEnvironmentListResponse +export type BetaListEnvironmentsV1EnvironmentsGet4XX = BetaErrorResponse +export const BetaListEnvironmentsV1EnvironmentsGet4XX = BetaErrorResponse +export type BetaCreateEnvironmentV1EnvironmentsPostParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string +} +export const BetaCreateEnvironmentV1EnvironmentsPostParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ) +}) +export type BetaCreateEnvironmentV1EnvironmentsPostRequestJson = BetaPublicEnvironmentCreateRequest +export const BetaCreateEnvironmentV1EnvironmentsPostRequestJson = BetaPublicEnvironmentCreateRequest +export type BetaCreateEnvironmentV1EnvironmentsPost200 = BetaEnvironment +export const BetaCreateEnvironmentV1EnvironmentsPost200 = BetaEnvironment +export type BetaCreateEnvironmentV1EnvironmentsPost4XX = BetaErrorResponse +export const BetaCreateEnvironmentV1EnvironmentsPost4XX = BetaErrorResponse +export type BetaGetEnvironmentV1EnvironmentsEnvironmentIdGetParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "x-api-key"?: string | null +} +export const BetaGetEnvironmentV1EnvironmentsEnvironmentIdGetParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "X-Api-Key" })) +}) +export type BetaGetEnvironmentV1EnvironmentsEnvironmentIdGet200 = BetaEnvironment +export const BetaGetEnvironmentV1EnvironmentsEnvironmentIdGet200 = BetaEnvironment +export type BetaGetEnvironmentV1EnvironmentsEnvironmentIdGet4XX = BetaErrorResponse +export const BetaGetEnvironmentV1EnvironmentsEnvironmentIdGet4XX = BetaErrorResponse +export type BetaUpdateEnvironmentV1EnvironmentsEnvironmentIdPostParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string +} +export const BetaUpdateEnvironmentV1EnvironmentsEnvironmentIdPostParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ) +}) +export type BetaUpdateEnvironmentV1EnvironmentsEnvironmentIdPostRequestJson = BetaPublicEnvironmentUpdateRequest +export const BetaUpdateEnvironmentV1EnvironmentsEnvironmentIdPostRequestJson = BetaPublicEnvironmentUpdateRequest +export type BetaUpdateEnvironmentV1EnvironmentsEnvironmentIdPost200 = BetaEnvironment +export const BetaUpdateEnvironmentV1EnvironmentsEnvironmentIdPost200 = BetaEnvironment +export type BetaUpdateEnvironmentV1EnvironmentsEnvironmentIdPost4XX = BetaErrorResponse +export const BetaUpdateEnvironmentV1EnvironmentsEnvironmentIdPost4XX = BetaErrorResponse +export type BetaDeleteEnvironmentV1EnvironmentsEnvironmentIdDeleteParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "x-api-key"?: string | null +} +export const BetaDeleteEnvironmentV1EnvironmentsEnvironmentIdDeleteParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "X-Api-Key" })) +}) +export type BetaDeleteEnvironmentV1EnvironmentsEnvironmentIdDelete200 = BetaEnvironmentDeleteResponse +export const BetaDeleteEnvironmentV1EnvironmentsEnvironmentIdDelete200 = BetaEnvironmentDeleteResponse +export type BetaDeleteEnvironmentV1EnvironmentsEnvironmentIdDelete4XX = BetaErrorResponse +export const BetaDeleteEnvironmentV1EnvironmentsEnvironmentIdDelete4XX = BetaErrorResponse +export type BetaArchiveEnvironmentV1EnvironmentsEnvironmentIdArchivePostParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string +} +export const BetaArchiveEnvironmentV1EnvironmentsEnvironmentIdArchivePostParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ) +}) +export type BetaArchiveEnvironmentV1EnvironmentsEnvironmentIdArchivePost200 = BetaEnvironment +export const BetaArchiveEnvironmentV1EnvironmentsEnvironmentIdArchivePost200 = BetaEnvironment +export type BetaArchiveEnvironmentV1EnvironmentsEnvironmentIdArchivePost4XX = BetaErrorResponse +export const BetaArchiveEnvironmentV1EnvironmentsEnvironmentIdArchivePost4XX = BetaErrorResponse +export type BetaGetEnvironmentStatsV1EnvironmentsEnvironmentIdWorkStatsGetParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "x-api-key"?: string | null + readonly "authorization"?: string | null +} +export const BetaGetEnvironmentStatsV1EnvironmentsEnvironmentIdWorkStatsGetParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "X-Api-Key" })), + "authorization": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Authorization" })) +}) +export type BetaGetEnvironmentStatsV1EnvironmentsEnvironmentIdWorkStatsGet200 = BetaSelfHostedWorkQueueStats +export const BetaGetEnvironmentStatsV1EnvironmentsEnvironmentIdWorkStatsGet200 = BetaSelfHostedWorkQueueStats +export type BetaGetEnvironmentStatsV1EnvironmentsEnvironmentIdWorkStatsGet4XX = BetaErrorResponse +export const BetaGetEnvironmentStatsV1EnvironmentsEnvironmentIdWorkStatsGet4XX = BetaErrorResponse +export type BetaPollWorkV1EnvironmentsEnvironmentIdWorkPollGetParams = { + readonly "block_ms"?: number | null + readonly "reclaim_older_than_ms"?: number | null + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "Anthropic-Worker-ID"?: string | null + readonly "authorization"?: string | null +} +export const BetaPollWorkV1EnvironmentsEnvironmentIdWorkPollGetParams = Schema.Struct({ + "block_ms": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), Schema.Null]).annotate({ + "title": "Block Ms", + "description": + "How long to wait for work to arrive before returning. Must be 1-999 in milliseconds. Defaults to non-blocking (returns immediately if no work is available)." + }) + ), + "reclaim_older_than_ms": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)), Schema.Null]).annotate({ + "title": "Reclaim Older Than Ms", + "description": + "Reclaim unacknowledged work items older than this many milliseconds. If omitted, uses the default (5000ms)." + }) + ), + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "Anthropic-Worker-ID": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Anthropic-Worker-Id", + "description": + "Unique identifier for the specific worker polling, used to track aggregated environment-level work metrics in Console" + }) + ), + "authorization": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Authorization" })) +}) +export type BetaPollWorkV1EnvironmentsEnvironmentIdWorkPollGet200 = BetaSelfHostedWork | null +export const BetaPollWorkV1EnvironmentsEnvironmentIdWorkPollGet200 = Schema.Union([BetaSelfHostedWork, Schema.Null]) + .annotate({ "title": "Response Poll Work V1 Environments Environment Id Work Poll Get" }) +export type BetaPollWorkV1EnvironmentsEnvironmentIdWorkPollGet4XX = BetaErrorResponse +export const BetaPollWorkV1EnvironmentsEnvironmentIdWorkPollGet4XX = BetaErrorResponse +export type BetaAcknowledgeWorkV1EnvironmentsEnvironmentIdWorkWorkIdAckPostParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "authorization"?: string | null +} +export const BetaAcknowledgeWorkV1EnvironmentsEnvironmentIdWorkWorkIdAckPostParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "authorization": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Authorization" })) +}) +export type BetaAcknowledgeWorkV1EnvironmentsEnvironmentIdWorkWorkIdAckPost200 = BetaSelfHostedWork +export const BetaAcknowledgeWorkV1EnvironmentsEnvironmentIdWorkWorkIdAckPost200 = BetaSelfHostedWork +export type BetaAcknowledgeWorkV1EnvironmentsEnvironmentIdWorkWorkIdAckPost4XX = BetaErrorResponse +export const BetaAcknowledgeWorkV1EnvironmentsEnvironmentIdWorkWorkIdAckPost4XX = BetaErrorResponse +export type BetaRecordHeartbeatV1EnvironmentsEnvironmentIdWorkWorkIdHeartbeatPostParams = { + readonly "desired_ttl_seconds"?: number | null + readonly "expected_last_heartbeat"?: string | null + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "authorization"?: string | null +} +export const BetaRecordHeartbeatV1EnvironmentsEnvironmentIdWorkWorkIdHeartbeatPostParams = Schema.Struct({ + "desired_ttl_seconds": Schema.optionalKey( + Schema.Union([Schema.Number.check(Schema.isInt()), Schema.Null]).annotate({ + "title": "Desired Ttl Seconds", + "description": "Desired TTL in seconds" + }) + ), + "expected_last_heartbeat": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Expected Last Heartbeat", + "description": + "Expected last_heartbeat for conditional update (optimistic concurrency). Use literal 'NO_HEARTBEAT' to claim an unclaimed lease (first heartbeat). For subsequent heartbeats, echo the server's previous last_heartbeat value exactly. Returns 412 Precondition Failed if the actual value doesn't match." + }) + ), + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "authorization": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Authorization" })) +}) +export type BetaRecordHeartbeatV1EnvironmentsEnvironmentIdWorkWorkIdHeartbeatPost200 = + BetaSelfHostedWorkHeartbeatResponse +export const BetaRecordHeartbeatV1EnvironmentsEnvironmentIdWorkWorkIdHeartbeatPost200 = + BetaSelfHostedWorkHeartbeatResponse +export type BetaRecordHeartbeatV1EnvironmentsEnvironmentIdWorkWorkIdHeartbeatPost4XX = BetaErrorResponse +export const BetaRecordHeartbeatV1EnvironmentsEnvironmentIdWorkWorkIdHeartbeatPost4XX = BetaErrorResponse +export type BetaStopWorkV1EnvironmentsEnvironmentIdWorkWorkIdStopPostParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "authorization"?: string | null +} +export const BetaStopWorkV1EnvironmentsEnvironmentIdWorkWorkIdStopPostParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "authorization": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Authorization" })) +}) +export type BetaStopWorkV1EnvironmentsEnvironmentIdWorkWorkIdStopPostRequestJson = BetaSelfHostedWorkStopRequest +export const BetaStopWorkV1EnvironmentsEnvironmentIdWorkWorkIdStopPostRequestJson = BetaSelfHostedWorkStopRequest +export type BetaStopWorkV1EnvironmentsEnvironmentIdWorkWorkIdStopPost200 = BetaSelfHostedWork +export const BetaStopWorkV1EnvironmentsEnvironmentIdWorkWorkIdStopPost200 = BetaSelfHostedWork +export type BetaStopWorkV1EnvironmentsEnvironmentIdWorkWorkIdStopPost4XX = BetaErrorResponse +export const BetaStopWorkV1EnvironmentsEnvironmentIdWorkWorkIdStopPost4XX = BetaErrorResponse +export type BetaGetWorkV1EnvironmentsEnvironmentIdWorkWorkIdGetParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "x-api-key"?: string | null +} +export const BetaGetWorkV1EnvironmentsEnvironmentIdWorkWorkIdGetParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "x-api-key": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "X-Api-Key" })) +}) +export type BetaGetWorkV1EnvironmentsEnvironmentIdWorkWorkIdGet200 = BetaSelfHostedWork +export const BetaGetWorkV1EnvironmentsEnvironmentIdWorkWorkIdGet200 = BetaSelfHostedWork +export type BetaGetWorkV1EnvironmentsEnvironmentIdWorkWorkIdGet4XX = BetaErrorResponse +export const BetaGetWorkV1EnvironmentsEnvironmentIdWorkWorkIdGet4XX = BetaErrorResponse +export type BetaUpdateWorkV1EnvironmentsEnvironmentIdWorkWorkIdPostParams = { + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string +} +export const BetaUpdateWorkV1EnvironmentsEnvironmentIdWorkWorkIdPostParams = Schema.Struct({ + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ) +}) +export type BetaUpdateWorkV1EnvironmentsEnvironmentIdWorkWorkIdPostRequestJson = BetaSelfHostedWorkUpdateRequest +export const BetaUpdateWorkV1EnvironmentsEnvironmentIdWorkWorkIdPostRequestJson = BetaSelfHostedWorkUpdateRequest +export type BetaUpdateWorkV1EnvironmentsEnvironmentIdWorkWorkIdPost200 = BetaSelfHostedWork +export const BetaUpdateWorkV1EnvironmentsEnvironmentIdWorkWorkIdPost200 = BetaSelfHostedWork +export type BetaUpdateWorkV1EnvironmentsEnvironmentIdWorkWorkIdPost4XX = BetaErrorResponse +export const BetaUpdateWorkV1EnvironmentsEnvironmentIdWorkWorkIdPost4XX = BetaErrorResponse +export type BetaListWorkV1EnvironmentsEnvironmentIdWorkGetParams = { + readonly "limit"?: number + readonly "page"?: string | null + readonly "anthropic-beta"?: string + readonly "anthropic-version"?: string + readonly "authorization"?: string | null +} +export const BetaListWorkV1EnvironmentsEnvironmentIdWorkGetParams = Schema.Struct({ + "limit": Schema.optionalKey( + Schema.Number.annotate({ "title": "Limit", "description": "Maximum number of work items to return", "default": 20 }) + .check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(1000)) + ), + "page": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ + "title": "Page", + "description": "Opaque cursor from previous response for pagination" + }) + ), + "anthropic-beta": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Beta", + "description": + "Optional header to specify the beta version(s) you want to use.\n\nTo use multiple betas, use a comma separated list like `beta1,beta2` or specify the header multiple times for each beta." + }) + ), + "anthropic-version": Schema.optionalKey( + Schema.String.annotate({ + "title": "Anthropic-Version", + "description": + "The version of the Claude API you want to use.\n\nRead more about versioning and our version history [here](https://docs.claude.com/en/api/versioning)." + }) + ), + "authorization": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null]).annotate({ "title": "Authorization" })) +}) +export type BetaListWorkV1EnvironmentsEnvironmentIdWorkGet200 = BetaSelfHostedWorkListResponse +export const BetaListWorkV1EnvironmentsEnvironmentIdWorkGet200 = BetaSelfHostedWorkListResponse +export type BetaListWorkV1EnvironmentsEnvironmentIdWorkGet4XX = BetaErrorResponse +export const BetaListWorkV1EnvironmentsEnvironmentIdWorkGet4XX = BetaErrorResponse +export type BetaListSessionsParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string + readonly "limit"?: number + readonly "page"?: string + readonly "include_archived"?: boolean + readonly "created_at[gte]"?: BetaTimestamp + readonly "created_at[gt]"?: BetaTimestamp + readonly "created_at[lte]"?: BetaTimestamp + readonly "created_at[lt]"?: BetaTimestamp + readonly "agent_id"?: string + readonly "agent_version"?: number + readonly "order"?: BetaManagedAgentsListOrder + readonly "memory_store_id"?: string + readonly "statuses[]"?: ReadonlyArray +} +export const BetaListSessionsParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String), + "limit": Schema.optionalKey(Schema.Number.annotate({ "format": "int32" }).check(Schema.isInt())), + "page": Schema.optionalKey(Schema.String), + "include_archived": Schema.optionalKey(Schema.Boolean), + "created_at[gte]": Schema.optionalKey(BetaTimestamp), + "created_at[gt]": Schema.optionalKey(BetaTimestamp), + "created_at[lte]": Schema.optionalKey(BetaTimestamp), + "created_at[lt]": Schema.optionalKey(BetaTimestamp), + "agent_id": Schema.optionalKey(Schema.String), + "agent_version": Schema.optionalKey(Schema.Number.annotate({ "format": "int32" }).check(Schema.isInt())), + "order": Schema.optionalKey(BetaManagedAgentsListOrder), + "memory_store_id": Schema.optionalKey(Schema.String), + "statuses[]": Schema.optionalKey(Schema.Array(BetaManagedAgentsSessionStatus)) +}) +export type BetaListSessions200 = BetaManagedAgentsListSessions +export const BetaListSessions200 = BetaManagedAgentsListSessions +export type BetaListSessions400 = BetaErrorResponse +export const BetaListSessions400 = BetaErrorResponse +export type BetaListSessions401 = BetaErrorResponse +export const BetaListSessions401 = BetaErrorResponse +export type BetaListSessions403 = BetaErrorResponse +export const BetaListSessions403 = BetaErrorResponse +export type BetaListSessions404 = BetaErrorResponse +export const BetaListSessions404 = BetaErrorResponse +export type BetaListSessions408 = BetaErrorResponse +export const BetaListSessions408 = BetaErrorResponse +export type BetaListSessions409 = BetaErrorResponse +export const BetaListSessions409 = BetaErrorResponse +export type BetaListSessions412 = BetaErrorResponse +export const BetaListSessions412 = BetaErrorResponse +export type BetaListSessions413 = BetaErrorResponse +export const BetaListSessions413 = BetaErrorResponse +export type BetaListSessions429 = BetaErrorResponse +export const BetaListSessions429 = BetaErrorResponse +export type BetaListSessions431 = BetaErrorResponse +export const BetaListSessions431 = BetaErrorResponse +export type BetaListSessions499 = BetaErrorResponse +export const BetaListSessions499 = BetaErrorResponse +export type BetaListSessions500 = BetaErrorResponse +export const BetaListSessions500 = BetaErrorResponse +export type BetaListSessions501 = BetaErrorResponse +export const BetaListSessions501 = BetaErrorResponse +export type BetaListSessions503 = BetaErrorResponse +export const BetaListSessions503 = BetaErrorResponse +export type BetaListSessions504 = BetaErrorResponse +export const BetaListSessions504 = BetaErrorResponse +export type BetaCreateSessionParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string } +export const BetaCreateSessionParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaCreateSessionRequestJson = BetaManagedAgentsCreateSessionParams +export const BetaCreateSessionRequestJson = BetaManagedAgentsCreateSessionParams +export type BetaCreateSession200 = BetaManagedAgentsSession +export const BetaCreateSession200 = BetaManagedAgentsSession +export type BetaCreateSession400 = BetaErrorResponse +export const BetaCreateSession400 = BetaErrorResponse +export type BetaCreateSession401 = BetaErrorResponse +export const BetaCreateSession401 = BetaErrorResponse +export type BetaCreateSession403 = BetaErrorResponse +export const BetaCreateSession403 = BetaErrorResponse +export type BetaCreateSession404 = BetaErrorResponse +export const BetaCreateSession404 = BetaErrorResponse +export type BetaCreateSession408 = BetaErrorResponse +export const BetaCreateSession408 = BetaErrorResponse +export type BetaCreateSession409 = BetaErrorResponse +export const BetaCreateSession409 = BetaErrorResponse +export type BetaCreateSession412 = BetaErrorResponse +export const BetaCreateSession412 = BetaErrorResponse +export type BetaCreateSession413 = BetaErrorResponse +export const BetaCreateSession413 = BetaErrorResponse +export type BetaCreateSession429 = BetaErrorResponse +export const BetaCreateSession429 = BetaErrorResponse +export type BetaCreateSession431 = BetaErrorResponse +export const BetaCreateSession431 = BetaErrorResponse +export type BetaCreateSession499 = BetaErrorResponse +export const BetaCreateSession499 = BetaErrorResponse +export type BetaCreateSession500 = BetaErrorResponse +export const BetaCreateSession500 = BetaErrorResponse +export type BetaCreateSession501 = BetaErrorResponse +export const BetaCreateSession501 = BetaErrorResponse +export type BetaCreateSession503 = BetaErrorResponse +export const BetaCreateSession503 = BetaErrorResponse +export type BetaCreateSession504 = BetaErrorResponse +export const BetaCreateSession504 = BetaErrorResponse +export type BetaGetSessionParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string +} +export const BetaGetSessionParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaGetSession200 = BetaManagedAgentsSession +export const BetaGetSession200 = BetaManagedAgentsSession +export type BetaGetSession400 = BetaErrorResponse +export const BetaGetSession400 = BetaErrorResponse +export type BetaGetSession401 = BetaErrorResponse +export const BetaGetSession401 = BetaErrorResponse +export type BetaGetSession403 = BetaErrorResponse +export const BetaGetSession403 = BetaErrorResponse +export type BetaGetSession404 = BetaErrorResponse +export const BetaGetSession404 = BetaErrorResponse +export type BetaGetSession408 = BetaErrorResponse +export const BetaGetSession408 = BetaErrorResponse +export type BetaGetSession409 = BetaErrorResponse +export const BetaGetSession409 = BetaErrorResponse +export type BetaGetSession412 = BetaErrorResponse +export const BetaGetSession412 = BetaErrorResponse +export type BetaGetSession413 = BetaErrorResponse +export const BetaGetSession413 = BetaErrorResponse +export type BetaGetSession429 = BetaErrorResponse +export const BetaGetSession429 = BetaErrorResponse +export type BetaGetSession431 = BetaErrorResponse +export const BetaGetSession431 = BetaErrorResponse +export type BetaGetSession499 = BetaErrorResponse +export const BetaGetSession499 = BetaErrorResponse +export type BetaGetSession500 = BetaErrorResponse +export const BetaGetSession500 = BetaErrorResponse +export type BetaGetSession501 = BetaErrorResponse +export const BetaGetSession501 = BetaErrorResponse +export type BetaGetSession503 = BetaErrorResponse +export const BetaGetSession503 = BetaErrorResponse +export type BetaGetSession504 = BetaErrorResponse +export const BetaGetSession504 = BetaErrorResponse +export type BetaUpdateSessionParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string } +export const BetaUpdateSessionParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaUpdateSessionRequestJson = BetaManagedAgentsUpdateSessionParams +export const BetaUpdateSessionRequestJson = BetaManagedAgentsUpdateSessionParams +export type BetaUpdateSession200 = BetaManagedAgentsSession +export const BetaUpdateSession200 = BetaManagedAgentsSession +export type BetaUpdateSession400 = BetaErrorResponse +export const BetaUpdateSession400 = BetaErrorResponse +export type BetaUpdateSession401 = BetaErrorResponse +export const BetaUpdateSession401 = BetaErrorResponse +export type BetaUpdateSession403 = BetaErrorResponse +export const BetaUpdateSession403 = BetaErrorResponse +export type BetaUpdateSession404 = BetaErrorResponse +export const BetaUpdateSession404 = BetaErrorResponse +export type BetaUpdateSession408 = BetaErrorResponse +export const BetaUpdateSession408 = BetaErrorResponse +export type BetaUpdateSession409 = BetaErrorResponse +export const BetaUpdateSession409 = BetaErrorResponse +export type BetaUpdateSession412 = BetaErrorResponse +export const BetaUpdateSession412 = BetaErrorResponse +export type BetaUpdateSession413 = BetaErrorResponse +export const BetaUpdateSession413 = BetaErrorResponse +export type BetaUpdateSession429 = BetaErrorResponse +export const BetaUpdateSession429 = BetaErrorResponse +export type BetaUpdateSession431 = BetaErrorResponse +export const BetaUpdateSession431 = BetaErrorResponse +export type BetaUpdateSession499 = BetaErrorResponse +export const BetaUpdateSession499 = BetaErrorResponse +export type BetaUpdateSession500 = BetaErrorResponse +export const BetaUpdateSession500 = BetaErrorResponse +export type BetaUpdateSession501 = BetaErrorResponse +export const BetaUpdateSession501 = BetaErrorResponse +export type BetaUpdateSession503 = BetaErrorResponse +export const BetaUpdateSession503 = BetaErrorResponse +export type BetaUpdateSession504 = BetaErrorResponse +export const BetaUpdateSession504 = BetaErrorResponse +export type BetaDeleteSessionParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string +} +export const BetaDeleteSessionParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaDeleteSession200 = BetaManagedAgentsDeletedSession +export const BetaDeleteSession200 = BetaManagedAgentsDeletedSession +export type BetaDeleteSession400 = BetaErrorResponse +export const BetaDeleteSession400 = BetaErrorResponse +export type BetaDeleteSession401 = BetaErrorResponse +export const BetaDeleteSession401 = BetaErrorResponse +export type BetaDeleteSession403 = BetaErrorResponse +export const BetaDeleteSession403 = BetaErrorResponse +export type BetaDeleteSession404 = BetaErrorResponse +export const BetaDeleteSession404 = BetaErrorResponse +export type BetaDeleteSession408 = BetaErrorResponse +export const BetaDeleteSession408 = BetaErrorResponse +export type BetaDeleteSession409 = BetaErrorResponse +export const BetaDeleteSession409 = BetaErrorResponse +export type BetaDeleteSession412 = BetaErrorResponse +export const BetaDeleteSession412 = BetaErrorResponse +export type BetaDeleteSession413 = BetaErrorResponse +export const BetaDeleteSession413 = BetaErrorResponse +export type BetaDeleteSession429 = BetaErrorResponse +export const BetaDeleteSession429 = BetaErrorResponse +export type BetaDeleteSession431 = BetaErrorResponse +export const BetaDeleteSession431 = BetaErrorResponse +export type BetaDeleteSession499 = BetaErrorResponse +export const BetaDeleteSession499 = BetaErrorResponse +export type BetaDeleteSession500 = BetaErrorResponse +export const BetaDeleteSession500 = BetaErrorResponse +export type BetaDeleteSession501 = BetaErrorResponse +export const BetaDeleteSession501 = BetaErrorResponse +export type BetaDeleteSession503 = BetaErrorResponse +export const BetaDeleteSession503 = BetaErrorResponse +export type BetaDeleteSession504 = BetaErrorResponse +export const BetaDeleteSession504 = BetaErrorResponse +export type BetaListEventsParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string + readonly "limit"?: number + readonly "page"?: string + readonly "order"?: BetaManagedAgentsListOrder + readonly "types[]"?: ReadonlyArray + readonly "created_at[gte]"?: BetaTimestamp + readonly "created_at[gt]"?: BetaTimestamp + readonly "created_at[lte]"?: BetaTimestamp + readonly "created_at[lt]"?: BetaTimestamp +} +export const BetaListEventsParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String), + "limit": Schema.optionalKey(Schema.Number.annotate({ "format": "int32" }).check(Schema.isInt())), + "page": Schema.optionalKey(Schema.String), + "order": Schema.optionalKey(BetaManagedAgentsListOrder), + "types[]": Schema.optionalKey(Schema.Array(Schema.String)), + "created_at[gte]": Schema.optionalKey(BetaTimestamp), + "created_at[gt]": Schema.optionalKey(BetaTimestamp), + "created_at[lte]": Schema.optionalKey(BetaTimestamp), + "created_at[lt]": Schema.optionalKey(BetaTimestamp) +}) +export type BetaListEvents200 = BetaManagedAgentsListSessionEvents +export const BetaListEvents200 = BetaManagedAgentsListSessionEvents +export type BetaListEvents400 = BetaErrorResponse +export const BetaListEvents400 = BetaErrorResponse +export type BetaListEvents401 = BetaErrorResponse +export const BetaListEvents401 = BetaErrorResponse +export type BetaListEvents403 = BetaErrorResponse +export const BetaListEvents403 = BetaErrorResponse +export type BetaListEvents404 = BetaErrorResponse +export const BetaListEvents404 = BetaErrorResponse +export type BetaListEvents408 = BetaErrorResponse +export const BetaListEvents408 = BetaErrorResponse +export type BetaListEvents409 = BetaErrorResponse +export const BetaListEvents409 = BetaErrorResponse +export type BetaListEvents412 = BetaErrorResponse +export const BetaListEvents412 = BetaErrorResponse +export type BetaListEvents413 = BetaErrorResponse +export const BetaListEvents413 = BetaErrorResponse +export type BetaListEvents429 = BetaErrorResponse +export const BetaListEvents429 = BetaErrorResponse +export type BetaListEvents431 = BetaErrorResponse +export const BetaListEvents431 = BetaErrorResponse +export type BetaListEvents499 = BetaErrorResponse +export const BetaListEvents499 = BetaErrorResponse +export type BetaListEvents500 = BetaErrorResponse +export const BetaListEvents500 = BetaErrorResponse +export type BetaListEvents501 = BetaErrorResponse +export const BetaListEvents501 = BetaErrorResponse +export type BetaListEvents503 = BetaErrorResponse +export const BetaListEvents503 = BetaErrorResponse +export type BetaListEvents504 = BetaErrorResponse +export const BetaListEvents504 = BetaErrorResponse +export type BetaSendEventsParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string } +export const BetaSendEventsParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaSendEventsRequestJson = BetaManagedAgentsSendSessionEventsParams +export const BetaSendEventsRequestJson = BetaManagedAgentsSendSessionEventsParams +export type BetaSendEvents200 = BetaManagedAgentsSendSessionEvents +export const BetaSendEvents200 = BetaManagedAgentsSendSessionEvents +export type BetaSendEvents400 = BetaErrorResponse +export const BetaSendEvents400 = BetaErrorResponse +export type BetaSendEvents401 = BetaErrorResponse +export const BetaSendEvents401 = BetaErrorResponse +export type BetaSendEvents403 = BetaErrorResponse +export const BetaSendEvents403 = BetaErrorResponse +export type BetaSendEvents404 = BetaErrorResponse +export const BetaSendEvents404 = BetaErrorResponse +export type BetaSendEvents408 = BetaErrorResponse +export const BetaSendEvents408 = BetaErrorResponse +export type BetaSendEvents409 = BetaErrorResponse +export const BetaSendEvents409 = BetaErrorResponse +export type BetaSendEvents412 = BetaErrorResponse +export const BetaSendEvents412 = BetaErrorResponse +export type BetaSendEvents413 = BetaErrorResponse +export const BetaSendEvents413 = BetaErrorResponse +export type BetaSendEvents429 = BetaErrorResponse +export const BetaSendEvents429 = BetaErrorResponse +export type BetaSendEvents431 = BetaErrorResponse +export const BetaSendEvents431 = BetaErrorResponse +export type BetaSendEvents499 = BetaErrorResponse +export const BetaSendEvents499 = BetaErrorResponse +export type BetaSendEvents500 = BetaErrorResponse +export const BetaSendEvents500 = BetaErrorResponse +export type BetaSendEvents501 = BetaErrorResponse +export const BetaSendEvents501 = BetaErrorResponse +export type BetaSendEvents503 = BetaErrorResponse +export const BetaSendEvents503 = BetaErrorResponse +export type BetaSendEvents504 = BetaErrorResponse +export const BetaSendEvents504 = BetaErrorResponse +export type BetaStreamSessionEventsParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string +} +export const BetaStreamSessionEventsParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaStreamSessionEvents200 = BetaManagedAgentsStreamSessionEvents +export const BetaStreamSessionEvents200 = BetaManagedAgentsStreamSessionEvents +export type BetaStreamSessionEvents400 = BetaErrorResponse +export const BetaStreamSessionEvents400 = BetaErrorResponse +export type BetaStreamSessionEvents401 = BetaErrorResponse +export const BetaStreamSessionEvents401 = BetaErrorResponse +export type BetaStreamSessionEvents403 = BetaErrorResponse +export const BetaStreamSessionEvents403 = BetaErrorResponse +export type BetaStreamSessionEvents404 = BetaErrorResponse +export const BetaStreamSessionEvents404 = BetaErrorResponse +export type BetaStreamSessionEvents408 = BetaErrorResponse +export const BetaStreamSessionEvents408 = BetaErrorResponse +export type BetaStreamSessionEvents409 = BetaErrorResponse +export const BetaStreamSessionEvents409 = BetaErrorResponse +export type BetaStreamSessionEvents412 = BetaErrorResponse +export const BetaStreamSessionEvents412 = BetaErrorResponse +export type BetaStreamSessionEvents413 = BetaErrorResponse +export const BetaStreamSessionEvents413 = BetaErrorResponse +export type BetaStreamSessionEvents429 = BetaErrorResponse +export const BetaStreamSessionEvents429 = BetaErrorResponse +export type BetaStreamSessionEvents431 = BetaErrorResponse +export const BetaStreamSessionEvents431 = BetaErrorResponse +export type BetaStreamSessionEvents499 = BetaErrorResponse +export const BetaStreamSessionEvents499 = BetaErrorResponse +export type BetaStreamSessionEvents500 = BetaErrorResponse +export const BetaStreamSessionEvents500 = BetaErrorResponse +export type BetaStreamSessionEvents501 = BetaErrorResponse +export const BetaStreamSessionEvents501 = BetaErrorResponse +export type BetaStreamSessionEvents503 = BetaErrorResponse +export const BetaStreamSessionEvents503 = BetaErrorResponse +export type BetaStreamSessionEvents504 = BetaErrorResponse +export const BetaStreamSessionEvents504 = BetaErrorResponse +export type BetaArchiveSessionParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string } +export const BetaArchiveSessionParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaArchiveSession200 = BetaManagedAgentsSession +export const BetaArchiveSession200 = BetaManagedAgentsSession +export type BetaArchiveSession400 = BetaErrorResponse +export const BetaArchiveSession400 = BetaErrorResponse +export type BetaArchiveSession401 = BetaErrorResponse +export const BetaArchiveSession401 = BetaErrorResponse +export type BetaArchiveSession403 = BetaErrorResponse +export const BetaArchiveSession403 = BetaErrorResponse +export type BetaArchiveSession404 = BetaErrorResponse +export const BetaArchiveSession404 = BetaErrorResponse +export type BetaArchiveSession408 = BetaErrorResponse +export const BetaArchiveSession408 = BetaErrorResponse +export type BetaArchiveSession409 = BetaErrorResponse +export const BetaArchiveSession409 = BetaErrorResponse +export type BetaArchiveSession412 = BetaErrorResponse +export const BetaArchiveSession412 = BetaErrorResponse +export type BetaArchiveSession413 = BetaErrorResponse +export const BetaArchiveSession413 = BetaErrorResponse +export type BetaArchiveSession429 = BetaErrorResponse +export const BetaArchiveSession429 = BetaErrorResponse +export type BetaArchiveSession431 = BetaErrorResponse +export const BetaArchiveSession431 = BetaErrorResponse +export type BetaArchiveSession499 = BetaErrorResponse +export const BetaArchiveSession499 = BetaErrorResponse +export type BetaArchiveSession500 = BetaErrorResponse +export const BetaArchiveSession500 = BetaErrorResponse +export type BetaArchiveSession501 = BetaErrorResponse +export const BetaArchiveSession501 = BetaErrorResponse +export type BetaArchiveSession503 = BetaErrorResponse +export const BetaArchiveSession503 = BetaErrorResponse +export type BetaArchiveSession504 = BetaErrorResponse +export const BetaArchiveSession504 = BetaErrorResponse +export type BetaListSessionThreadsParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string + readonly "limit"?: number + readonly "page"?: string +} +export const BetaListSessionThreadsParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String), + "limit": Schema.optionalKey(Schema.Number.annotate({ "format": "int32" }).check(Schema.isInt())), + "page": Schema.optionalKey(Schema.String) +}) +export type BetaListSessionThreads200 = BetaManagedAgentsListSessionThreads +export const BetaListSessionThreads200 = BetaManagedAgentsListSessionThreads +export type BetaListSessionThreads400 = BetaErrorResponse +export const BetaListSessionThreads400 = BetaErrorResponse +export type BetaListSessionThreads401 = BetaErrorResponse +export const BetaListSessionThreads401 = BetaErrorResponse +export type BetaListSessionThreads403 = BetaErrorResponse +export const BetaListSessionThreads403 = BetaErrorResponse +export type BetaListSessionThreads404 = BetaErrorResponse +export const BetaListSessionThreads404 = BetaErrorResponse +export type BetaListSessionThreads408 = BetaErrorResponse +export const BetaListSessionThreads408 = BetaErrorResponse +export type BetaListSessionThreads409 = BetaErrorResponse +export const BetaListSessionThreads409 = BetaErrorResponse +export type BetaListSessionThreads412 = BetaErrorResponse +export const BetaListSessionThreads412 = BetaErrorResponse +export type BetaListSessionThreads413 = BetaErrorResponse +export const BetaListSessionThreads413 = BetaErrorResponse +export type BetaListSessionThreads429 = BetaErrorResponse +export const BetaListSessionThreads429 = BetaErrorResponse +export type BetaListSessionThreads431 = BetaErrorResponse +export const BetaListSessionThreads431 = BetaErrorResponse +export type BetaListSessionThreads499 = BetaErrorResponse +export const BetaListSessionThreads499 = BetaErrorResponse +export type BetaListSessionThreads500 = BetaErrorResponse +export const BetaListSessionThreads500 = BetaErrorResponse +export type BetaListSessionThreads501 = BetaErrorResponse +export const BetaListSessionThreads501 = BetaErrorResponse +export type BetaListSessionThreads503 = BetaErrorResponse +export const BetaListSessionThreads503 = BetaErrorResponse +export type BetaListSessionThreads504 = BetaErrorResponse +export const BetaListSessionThreads504 = BetaErrorResponse +export type BetaGetSessionThreadParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string +} +export const BetaGetSessionThreadParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaGetSessionThread200 = BetaManagedAgentsSessionThread +export const BetaGetSessionThread200 = BetaManagedAgentsSessionThread +export type BetaGetSessionThread400 = BetaErrorResponse +export const BetaGetSessionThread400 = BetaErrorResponse +export type BetaGetSessionThread401 = BetaErrorResponse +export const BetaGetSessionThread401 = BetaErrorResponse +export type BetaGetSessionThread403 = BetaErrorResponse +export const BetaGetSessionThread403 = BetaErrorResponse +export type BetaGetSessionThread404 = BetaErrorResponse +export const BetaGetSessionThread404 = BetaErrorResponse +export type BetaGetSessionThread408 = BetaErrorResponse +export const BetaGetSessionThread408 = BetaErrorResponse +export type BetaGetSessionThread409 = BetaErrorResponse +export const BetaGetSessionThread409 = BetaErrorResponse +export type BetaGetSessionThread412 = BetaErrorResponse +export const BetaGetSessionThread412 = BetaErrorResponse +export type BetaGetSessionThread413 = BetaErrorResponse +export const BetaGetSessionThread413 = BetaErrorResponse +export type BetaGetSessionThread429 = BetaErrorResponse +export const BetaGetSessionThread429 = BetaErrorResponse +export type BetaGetSessionThread431 = BetaErrorResponse +export const BetaGetSessionThread431 = BetaErrorResponse +export type BetaGetSessionThread499 = BetaErrorResponse +export const BetaGetSessionThread499 = BetaErrorResponse +export type BetaGetSessionThread500 = BetaErrorResponse +export const BetaGetSessionThread500 = BetaErrorResponse +export type BetaGetSessionThread501 = BetaErrorResponse +export const BetaGetSessionThread501 = BetaErrorResponse +export type BetaGetSessionThread503 = BetaErrorResponse +export const BetaGetSessionThread503 = BetaErrorResponse +export type BetaGetSessionThread504 = BetaErrorResponse +export const BetaGetSessionThread504 = BetaErrorResponse +export type BetaListSessionThreadEventsParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string + readonly "limit"?: number + readonly "page"?: string +} +export const BetaListSessionThreadEventsParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String), + "limit": Schema.optionalKey(Schema.Number.annotate({ "format": "int32" }).check(Schema.isInt())), + "page": Schema.optionalKey(Schema.String) +}) +export type BetaListSessionThreadEvents200 = BetaManagedAgentsListSessionThreadEvents +export const BetaListSessionThreadEvents200 = BetaManagedAgentsListSessionThreadEvents +export type BetaListSessionThreadEvents400 = BetaErrorResponse +export const BetaListSessionThreadEvents400 = BetaErrorResponse +export type BetaListSessionThreadEvents401 = BetaErrorResponse +export const BetaListSessionThreadEvents401 = BetaErrorResponse +export type BetaListSessionThreadEvents403 = BetaErrorResponse +export const BetaListSessionThreadEvents403 = BetaErrorResponse +export type BetaListSessionThreadEvents404 = BetaErrorResponse +export const BetaListSessionThreadEvents404 = BetaErrorResponse +export type BetaListSessionThreadEvents408 = BetaErrorResponse +export const BetaListSessionThreadEvents408 = BetaErrorResponse +export type BetaListSessionThreadEvents409 = BetaErrorResponse +export const BetaListSessionThreadEvents409 = BetaErrorResponse +export type BetaListSessionThreadEvents412 = BetaErrorResponse +export const BetaListSessionThreadEvents412 = BetaErrorResponse +export type BetaListSessionThreadEvents413 = BetaErrorResponse +export const BetaListSessionThreadEvents413 = BetaErrorResponse +export type BetaListSessionThreadEvents429 = BetaErrorResponse +export const BetaListSessionThreadEvents429 = BetaErrorResponse +export type BetaListSessionThreadEvents431 = BetaErrorResponse +export const BetaListSessionThreadEvents431 = BetaErrorResponse +export type BetaListSessionThreadEvents499 = BetaErrorResponse +export const BetaListSessionThreadEvents499 = BetaErrorResponse +export type BetaListSessionThreadEvents500 = BetaErrorResponse +export const BetaListSessionThreadEvents500 = BetaErrorResponse +export type BetaListSessionThreadEvents501 = BetaErrorResponse +export const BetaListSessionThreadEvents501 = BetaErrorResponse +export type BetaListSessionThreadEvents503 = BetaErrorResponse +export const BetaListSessionThreadEvents503 = BetaErrorResponse +export type BetaListSessionThreadEvents504 = BetaErrorResponse +export const BetaListSessionThreadEvents504 = BetaErrorResponse +export type BetaStreamSessionThreadEventsParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string +} +export const BetaStreamSessionThreadEventsParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaStreamSessionThreadEvents200 = BetaManagedAgentsStreamSessionThreadEvents +export const BetaStreamSessionThreadEvents200 = BetaManagedAgentsStreamSessionThreadEvents +export type BetaStreamSessionThreadEvents400 = BetaErrorResponse +export const BetaStreamSessionThreadEvents400 = BetaErrorResponse +export type BetaStreamSessionThreadEvents401 = BetaErrorResponse +export const BetaStreamSessionThreadEvents401 = BetaErrorResponse +export type BetaStreamSessionThreadEvents403 = BetaErrorResponse +export const BetaStreamSessionThreadEvents403 = BetaErrorResponse +export type BetaStreamSessionThreadEvents404 = BetaErrorResponse +export const BetaStreamSessionThreadEvents404 = BetaErrorResponse +export type BetaStreamSessionThreadEvents408 = BetaErrorResponse +export const BetaStreamSessionThreadEvents408 = BetaErrorResponse +export type BetaStreamSessionThreadEvents409 = BetaErrorResponse +export const BetaStreamSessionThreadEvents409 = BetaErrorResponse +export type BetaStreamSessionThreadEvents412 = BetaErrorResponse +export const BetaStreamSessionThreadEvents412 = BetaErrorResponse +export type BetaStreamSessionThreadEvents413 = BetaErrorResponse +export const BetaStreamSessionThreadEvents413 = BetaErrorResponse +export type BetaStreamSessionThreadEvents429 = BetaErrorResponse +export const BetaStreamSessionThreadEvents429 = BetaErrorResponse +export type BetaStreamSessionThreadEvents431 = BetaErrorResponse +export const BetaStreamSessionThreadEvents431 = BetaErrorResponse +export type BetaStreamSessionThreadEvents499 = BetaErrorResponse +export const BetaStreamSessionThreadEvents499 = BetaErrorResponse +export type BetaStreamSessionThreadEvents500 = BetaErrorResponse +export const BetaStreamSessionThreadEvents500 = BetaErrorResponse +export type BetaStreamSessionThreadEvents501 = BetaErrorResponse +export const BetaStreamSessionThreadEvents501 = BetaErrorResponse +export type BetaStreamSessionThreadEvents503 = BetaErrorResponse +export const BetaStreamSessionThreadEvents503 = BetaErrorResponse +export type BetaStreamSessionThreadEvents504 = BetaErrorResponse +export const BetaStreamSessionThreadEvents504 = BetaErrorResponse +export type BetaArchiveSessionThreadParams = { + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string +} +export const BetaArchiveSessionThreadParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaArchiveSessionThread200 = BetaManagedAgentsSessionThread +export const BetaArchiveSessionThread200 = BetaManagedAgentsSessionThread +export type BetaArchiveSessionThread400 = BetaErrorResponse +export const BetaArchiveSessionThread400 = BetaErrorResponse +export type BetaArchiveSessionThread401 = BetaErrorResponse +export const BetaArchiveSessionThread401 = BetaErrorResponse +export type BetaArchiveSessionThread403 = BetaErrorResponse +export const BetaArchiveSessionThread403 = BetaErrorResponse +export type BetaArchiveSessionThread404 = BetaErrorResponse +export const BetaArchiveSessionThread404 = BetaErrorResponse +export type BetaArchiveSessionThread408 = BetaErrorResponse +export const BetaArchiveSessionThread408 = BetaErrorResponse +export type BetaArchiveSessionThread409 = BetaErrorResponse +export const BetaArchiveSessionThread409 = BetaErrorResponse +export type BetaArchiveSessionThread412 = BetaErrorResponse +export const BetaArchiveSessionThread412 = BetaErrorResponse +export type BetaArchiveSessionThread413 = BetaErrorResponse +export const BetaArchiveSessionThread413 = BetaErrorResponse +export type BetaArchiveSessionThread429 = BetaErrorResponse +export const BetaArchiveSessionThread429 = BetaErrorResponse +export type BetaArchiveSessionThread431 = BetaErrorResponse +export const BetaArchiveSessionThread431 = BetaErrorResponse +export type BetaArchiveSessionThread499 = BetaErrorResponse +export const BetaArchiveSessionThread499 = BetaErrorResponse +export type BetaArchiveSessionThread500 = BetaErrorResponse +export const BetaArchiveSessionThread500 = BetaErrorResponse +export type BetaArchiveSessionThread501 = BetaErrorResponse +export const BetaArchiveSessionThread501 = BetaErrorResponse +export type BetaArchiveSessionThread503 = BetaErrorResponse +export const BetaArchiveSessionThread503 = BetaErrorResponse +export type BetaArchiveSessionThread504 = BetaErrorResponse +export const BetaArchiveSessionThread504 = BetaErrorResponse +export type BetaListResourcesParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string + readonly "limit"?: number + readonly "page"?: string +} +export const BetaListResourcesParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String), + "limit": Schema.optionalKey(Schema.Number.annotate({ "format": "int32" }).check(Schema.isInt())), + "page": Schema.optionalKey(Schema.String) +}) +export type BetaListResources200 = BetaManagedAgentsListSessionResources +export const BetaListResources200 = BetaManagedAgentsListSessionResources +export type BetaListResources400 = BetaErrorResponse +export const BetaListResources400 = BetaErrorResponse +export type BetaListResources401 = BetaErrorResponse +export const BetaListResources401 = BetaErrorResponse +export type BetaListResources403 = BetaErrorResponse +export const BetaListResources403 = BetaErrorResponse +export type BetaListResources404 = BetaErrorResponse +export const BetaListResources404 = BetaErrorResponse +export type BetaListResources408 = BetaErrorResponse +export const BetaListResources408 = BetaErrorResponse +export type BetaListResources409 = BetaErrorResponse +export const BetaListResources409 = BetaErrorResponse +export type BetaListResources412 = BetaErrorResponse +export const BetaListResources412 = BetaErrorResponse +export type BetaListResources413 = BetaErrorResponse +export const BetaListResources413 = BetaErrorResponse +export type BetaListResources429 = BetaErrorResponse +export const BetaListResources429 = BetaErrorResponse +export type BetaListResources431 = BetaErrorResponse +export const BetaListResources431 = BetaErrorResponse +export type BetaListResources499 = BetaErrorResponse +export const BetaListResources499 = BetaErrorResponse +export type BetaListResources500 = BetaErrorResponse +export const BetaListResources500 = BetaErrorResponse +export type BetaListResources501 = BetaErrorResponse +export const BetaListResources501 = BetaErrorResponse +export type BetaListResources503 = BetaErrorResponse +export const BetaListResources503 = BetaErrorResponse +export type BetaListResources504 = BetaErrorResponse +export const BetaListResources504 = BetaErrorResponse +export type BetaAddResourceParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string } +export const BetaAddResourceParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaAddResourceRequestJson = BetaManagedAgentsAddSessionResourceParams +export const BetaAddResourceRequestJson = BetaManagedAgentsAddSessionResourceParams +export type BetaAddResource200 = BetaManagedAgentsAddSessionResource +export const BetaAddResource200 = BetaManagedAgentsAddSessionResource +export type BetaAddResource400 = BetaErrorResponse +export const BetaAddResource400 = BetaErrorResponse +export type BetaAddResource401 = BetaErrorResponse +export const BetaAddResource401 = BetaErrorResponse +export type BetaAddResource403 = BetaErrorResponse +export const BetaAddResource403 = BetaErrorResponse +export type BetaAddResource404 = BetaErrorResponse +export const BetaAddResource404 = BetaErrorResponse +export type BetaAddResource408 = BetaErrorResponse +export const BetaAddResource408 = BetaErrorResponse +export type BetaAddResource409 = BetaErrorResponse +export const BetaAddResource409 = BetaErrorResponse +export type BetaAddResource412 = BetaErrorResponse +export const BetaAddResource412 = BetaErrorResponse +export type BetaAddResource413 = BetaErrorResponse +export const BetaAddResource413 = BetaErrorResponse +export type BetaAddResource429 = BetaErrorResponse +export const BetaAddResource429 = BetaErrorResponse +export type BetaAddResource431 = BetaErrorResponse +export const BetaAddResource431 = BetaErrorResponse +export type BetaAddResource499 = BetaErrorResponse +export const BetaAddResource499 = BetaErrorResponse +export type BetaAddResource500 = BetaErrorResponse +export const BetaAddResource500 = BetaErrorResponse +export type BetaAddResource501 = BetaErrorResponse +export const BetaAddResource501 = BetaErrorResponse +export type BetaAddResource503 = BetaErrorResponse +export const BetaAddResource503 = BetaErrorResponse +export type BetaAddResource504 = BetaErrorResponse +export const BetaAddResource504 = BetaErrorResponse +export type BetaGetResourceParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string +} +export const BetaGetResourceParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaGetResource200 = BetaManagedAgentsGetSessionResource +export const BetaGetResource200 = BetaManagedAgentsGetSessionResource +export type BetaGetResource400 = BetaErrorResponse +export const BetaGetResource400 = BetaErrorResponse +export type BetaGetResource401 = BetaErrorResponse +export const BetaGetResource401 = BetaErrorResponse +export type BetaGetResource403 = BetaErrorResponse +export const BetaGetResource403 = BetaErrorResponse +export type BetaGetResource404 = BetaErrorResponse +export const BetaGetResource404 = BetaErrorResponse +export type BetaGetResource408 = BetaErrorResponse +export const BetaGetResource408 = BetaErrorResponse +export type BetaGetResource409 = BetaErrorResponse +export const BetaGetResource409 = BetaErrorResponse +export type BetaGetResource412 = BetaErrorResponse +export const BetaGetResource412 = BetaErrorResponse +export type BetaGetResource413 = BetaErrorResponse +export const BetaGetResource413 = BetaErrorResponse +export type BetaGetResource429 = BetaErrorResponse +export const BetaGetResource429 = BetaErrorResponse +export type BetaGetResource431 = BetaErrorResponse +export const BetaGetResource431 = BetaErrorResponse +export type BetaGetResource499 = BetaErrorResponse +export const BetaGetResource499 = BetaErrorResponse +export type BetaGetResource500 = BetaErrorResponse +export const BetaGetResource500 = BetaErrorResponse +export type BetaGetResource501 = BetaErrorResponse +export const BetaGetResource501 = BetaErrorResponse +export type BetaGetResource503 = BetaErrorResponse +export const BetaGetResource503 = BetaErrorResponse +export type BetaGetResource504 = BetaErrorResponse +export const BetaGetResource504 = BetaErrorResponse +export type BetaUpdateResourceParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string } +export const BetaUpdateResourceParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaUpdateResourceRequestJson = BetaManagedAgentsUpdateSessionResourceParams +export const BetaUpdateResourceRequestJson = BetaManagedAgentsUpdateSessionResourceParams +export type BetaUpdateResource200 = BetaManagedAgentsUpdateSessionResource +export const BetaUpdateResource200 = BetaManagedAgentsUpdateSessionResource +export type BetaUpdateResource400 = BetaErrorResponse +export const BetaUpdateResource400 = BetaErrorResponse +export type BetaUpdateResource401 = BetaErrorResponse +export const BetaUpdateResource401 = BetaErrorResponse +export type BetaUpdateResource403 = BetaErrorResponse +export const BetaUpdateResource403 = BetaErrorResponse +export type BetaUpdateResource404 = BetaErrorResponse +export const BetaUpdateResource404 = BetaErrorResponse +export type BetaUpdateResource408 = BetaErrorResponse +export const BetaUpdateResource408 = BetaErrorResponse +export type BetaUpdateResource409 = BetaErrorResponse +export const BetaUpdateResource409 = BetaErrorResponse +export type BetaUpdateResource412 = BetaErrorResponse +export const BetaUpdateResource412 = BetaErrorResponse +export type BetaUpdateResource413 = BetaErrorResponse +export const BetaUpdateResource413 = BetaErrorResponse +export type BetaUpdateResource429 = BetaErrorResponse +export const BetaUpdateResource429 = BetaErrorResponse +export type BetaUpdateResource431 = BetaErrorResponse +export const BetaUpdateResource431 = BetaErrorResponse +export type BetaUpdateResource499 = BetaErrorResponse +export const BetaUpdateResource499 = BetaErrorResponse +export type BetaUpdateResource500 = BetaErrorResponse +export const BetaUpdateResource500 = BetaErrorResponse +export type BetaUpdateResource501 = BetaErrorResponse +export const BetaUpdateResource501 = BetaErrorResponse +export type BetaUpdateResource503 = BetaErrorResponse +export const BetaUpdateResource503 = BetaErrorResponse +export type BetaUpdateResource504 = BetaErrorResponse +export const BetaUpdateResource504 = BetaErrorResponse +export type BetaDeleteResourceParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string +} +export const BetaDeleteResourceParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaDeleteResource200 = BetaManagedAgentsDeleteSessionResource +export const BetaDeleteResource200 = BetaManagedAgentsDeleteSessionResource +export type BetaDeleteResource400 = BetaErrorResponse +export const BetaDeleteResource400 = BetaErrorResponse +export type BetaDeleteResource401 = BetaErrorResponse +export const BetaDeleteResource401 = BetaErrorResponse +export type BetaDeleteResource403 = BetaErrorResponse +export const BetaDeleteResource403 = BetaErrorResponse +export type BetaDeleteResource404 = BetaErrorResponse +export const BetaDeleteResource404 = BetaErrorResponse +export type BetaDeleteResource408 = BetaErrorResponse +export const BetaDeleteResource408 = BetaErrorResponse +export type BetaDeleteResource409 = BetaErrorResponse +export const BetaDeleteResource409 = BetaErrorResponse +export type BetaDeleteResource412 = BetaErrorResponse +export const BetaDeleteResource412 = BetaErrorResponse +export type BetaDeleteResource413 = BetaErrorResponse +export const BetaDeleteResource413 = BetaErrorResponse +export type BetaDeleteResource429 = BetaErrorResponse +export const BetaDeleteResource429 = BetaErrorResponse +export type BetaDeleteResource431 = BetaErrorResponse +export const BetaDeleteResource431 = BetaErrorResponse +export type BetaDeleteResource499 = BetaErrorResponse +export const BetaDeleteResource499 = BetaErrorResponse +export type BetaDeleteResource500 = BetaErrorResponse +export const BetaDeleteResource500 = BetaErrorResponse +export type BetaDeleteResource501 = BetaErrorResponse +export const BetaDeleteResource501 = BetaErrorResponse +export type BetaDeleteResource503 = BetaErrorResponse +export const BetaDeleteResource503 = BetaErrorResponse +export type BetaDeleteResource504 = BetaErrorResponse +export const BetaDeleteResource504 = BetaErrorResponse +export type BetaListAgentsParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string + readonly "limit"?: number + readonly "page"?: string + readonly "created_at[gte]"?: BetaTimestamp + readonly "created_at[lte]"?: BetaTimestamp + readonly "include_archived"?: boolean +} +export const BetaListAgentsParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String), + "limit": Schema.optionalKey(Schema.Number.annotate({ "format": "int32" }).check(Schema.isInt())), + "page": Schema.optionalKey(Schema.String), + "created_at[gte]": Schema.optionalKey(BetaTimestamp), + "created_at[lte]": Schema.optionalKey(BetaTimestamp), + "include_archived": Schema.optionalKey(Schema.Boolean) +}) +export type BetaListAgents200 = BetaManagedAgentsListAgents +export const BetaListAgents200 = BetaManagedAgentsListAgents +export type BetaListAgents400 = BetaErrorResponse +export const BetaListAgents400 = BetaErrorResponse +export type BetaListAgents401 = BetaErrorResponse +export const BetaListAgents401 = BetaErrorResponse +export type BetaListAgents403 = BetaErrorResponse +export const BetaListAgents403 = BetaErrorResponse +export type BetaListAgents404 = BetaErrorResponse +export const BetaListAgents404 = BetaErrorResponse +export type BetaListAgents408 = BetaErrorResponse +export const BetaListAgents408 = BetaErrorResponse +export type BetaListAgents409 = BetaErrorResponse +export const BetaListAgents409 = BetaErrorResponse +export type BetaListAgents412 = BetaErrorResponse +export const BetaListAgents412 = BetaErrorResponse +export type BetaListAgents413 = BetaErrorResponse +export const BetaListAgents413 = BetaErrorResponse +export type BetaListAgents429 = BetaErrorResponse +export const BetaListAgents429 = BetaErrorResponse +export type BetaListAgents431 = BetaErrorResponse +export const BetaListAgents431 = BetaErrorResponse +export type BetaListAgents499 = BetaErrorResponse +export const BetaListAgents499 = BetaErrorResponse +export type BetaListAgents500 = BetaErrorResponse +export const BetaListAgents500 = BetaErrorResponse +export type BetaListAgents501 = BetaErrorResponse +export const BetaListAgents501 = BetaErrorResponse +export type BetaListAgents503 = BetaErrorResponse +export const BetaListAgents503 = BetaErrorResponse +export type BetaListAgents504 = BetaErrorResponse +export const BetaListAgents504 = BetaErrorResponse +export type BetaCreateAgentParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string } +export const BetaCreateAgentParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaCreateAgentRequestJson = BetaManagedAgentsCreateAgentParams +export const BetaCreateAgentRequestJson = BetaManagedAgentsCreateAgentParams +export type BetaCreateAgent200 = BetaManagedAgentsAgent +export const BetaCreateAgent200 = BetaManagedAgentsAgent +export type BetaCreateAgent400 = BetaErrorResponse +export const BetaCreateAgent400 = BetaErrorResponse +export type BetaCreateAgent401 = BetaErrorResponse +export const BetaCreateAgent401 = BetaErrorResponse +export type BetaCreateAgent403 = BetaErrorResponse +export const BetaCreateAgent403 = BetaErrorResponse +export type BetaCreateAgent404 = BetaErrorResponse +export const BetaCreateAgent404 = BetaErrorResponse +export type BetaCreateAgent408 = BetaErrorResponse +export const BetaCreateAgent408 = BetaErrorResponse +export type BetaCreateAgent409 = BetaErrorResponse +export const BetaCreateAgent409 = BetaErrorResponse +export type BetaCreateAgent412 = BetaErrorResponse +export const BetaCreateAgent412 = BetaErrorResponse +export type BetaCreateAgent413 = BetaErrorResponse +export const BetaCreateAgent413 = BetaErrorResponse +export type BetaCreateAgent429 = BetaErrorResponse +export const BetaCreateAgent429 = BetaErrorResponse +export type BetaCreateAgent431 = BetaErrorResponse +export const BetaCreateAgent431 = BetaErrorResponse +export type BetaCreateAgent499 = BetaErrorResponse +export const BetaCreateAgent499 = BetaErrorResponse +export type BetaCreateAgent500 = BetaErrorResponse +export const BetaCreateAgent500 = BetaErrorResponse +export type BetaCreateAgent501 = BetaErrorResponse +export const BetaCreateAgent501 = BetaErrorResponse +export type BetaCreateAgent503 = BetaErrorResponse +export const BetaCreateAgent503 = BetaErrorResponse +export type BetaCreateAgent504 = BetaErrorResponse +export const BetaCreateAgent504 = BetaErrorResponse +export type BetaGetAgentParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string + readonly "version"?: number +} +export const BetaGetAgentParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String), + "version": Schema.optionalKey(Schema.Number.annotate({ "format": "int32" }).check(Schema.isInt())) +}) +export type BetaGetAgent200 = BetaManagedAgentsAgent +export const BetaGetAgent200 = BetaManagedAgentsAgent +export type BetaGetAgent400 = BetaErrorResponse +export const BetaGetAgent400 = BetaErrorResponse +export type BetaGetAgent401 = BetaErrorResponse +export const BetaGetAgent401 = BetaErrorResponse +export type BetaGetAgent403 = BetaErrorResponse +export const BetaGetAgent403 = BetaErrorResponse +export type BetaGetAgent404 = BetaErrorResponse +export const BetaGetAgent404 = BetaErrorResponse +export type BetaGetAgent408 = BetaErrorResponse +export const BetaGetAgent408 = BetaErrorResponse +export type BetaGetAgent409 = BetaErrorResponse +export const BetaGetAgent409 = BetaErrorResponse +export type BetaGetAgent412 = BetaErrorResponse +export const BetaGetAgent412 = BetaErrorResponse +export type BetaGetAgent413 = BetaErrorResponse +export const BetaGetAgent413 = BetaErrorResponse +export type BetaGetAgent429 = BetaErrorResponse +export const BetaGetAgent429 = BetaErrorResponse +export type BetaGetAgent431 = BetaErrorResponse +export const BetaGetAgent431 = BetaErrorResponse +export type BetaGetAgent499 = BetaErrorResponse +export const BetaGetAgent499 = BetaErrorResponse +export type BetaGetAgent500 = BetaErrorResponse +export const BetaGetAgent500 = BetaErrorResponse +export type BetaGetAgent501 = BetaErrorResponse +export const BetaGetAgent501 = BetaErrorResponse +export type BetaGetAgent503 = BetaErrorResponse +export const BetaGetAgent503 = BetaErrorResponse +export type BetaGetAgent504 = BetaErrorResponse +export const BetaGetAgent504 = BetaErrorResponse +export type BetaUpdateAgentParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string } +export const BetaUpdateAgentParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaUpdateAgentRequestJson = BetaManagedAgentsUpdateAgentParams +export const BetaUpdateAgentRequestJson = BetaManagedAgentsUpdateAgentParams +export type BetaUpdateAgent200 = BetaManagedAgentsAgent +export const BetaUpdateAgent200 = BetaManagedAgentsAgent +export type BetaUpdateAgent400 = BetaErrorResponse +export const BetaUpdateAgent400 = BetaErrorResponse +export type BetaUpdateAgent401 = BetaErrorResponse +export const BetaUpdateAgent401 = BetaErrorResponse +export type BetaUpdateAgent403 = BetaErrorResponse +export const BetaUpdateAgent403 = BetaErrorResponse +export type BetaUpdateAgent404 = BetaErrorResponse +export const BetaUpdateAgent404 = BetaErrorResponse +export type BetaUpdateAgent408 = BetaErrorResponse +export const BetaUpdateAgent408 = BetaErrorResponse +export type BetaUpdateAgent409 = BetaErrorResponse +export const BetaUpdateAgent409 = BetaErrorResponse +export type BetaUpdateAgent412 = BetaErrorResponse +export const BetaUpdateAgent412 = BetaErrorResponse +export type BetaUpdateAgent413 = BetaErrorResponse +export const BetaUpdateAgent413 = BetaErrorResponse +export type BetaUpdateAgent429 = BetaErrorResponse +export const BetaUpdateAgent429 = BetaErrorResponse +export type BetaUpdateAgent431 = BetaErrorResponse +export const BetaUpdateAgent431 = BetaErrorResponse +export type BetaUpdateAgent499 = BetaErrorResponse +export const BetaUpdateAgent499 = BetaErrorResponse +export type BetaUpdateAgent500 = BetaErrorResponse +export const BetaUpdateAgent500 = BetaErrorResponse +export type BetaUpdateAgent501 = BetaErrorResponse +export const BetaUpdateAgent501 = BetaErrorResponse +export type BetaUpdateAgent503 = BetaErrorResponse +export const BetaUpdateAgent503 = BetaErrorResponse +export type BetaUpdateAgent504 = BetaErrorResponse +export const BetaUpdateAgent504 = BetaErrorResponse +export type BetaArchiveAgentParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string } +export const BetaArchiveAgentParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaArchiveAgent200 = BetaManagedAgentsAgent +export const BetaArchiveAgent200 = BetaManagedAgentsAgent +export type BetaArchiveAgent400 = BetaErrorResponse +export const BetaArchiveAgent400 = BetaErrorResponse +export type BetaArchiveAgent401 = BetaErrorResponse +export const BetaArchiveAgent401 = BetaErrorResponse +export type BetaArchiveAgent403 = BetaErrorResponse +export const BetaArchiveAgent403 = BetaErrorResponse +export type BetaArchiveAgent404 = BetaErrorResponse +export const BetaArchiveAgent404 = BetaErrorResponse +export type BetaArchiveAgent408 = BetaErrorResponse +export const BetaArchiveAgent408 = BetaErrorResponse +export type BetaArchiveAgent409 = BetaErrorResponse +export const BetaArchiveAgent409 = BetaErrorResponse +export type BetaArchiveAgent412 = BetaErrorResponse +export const BetaArchiveAgent412 = BetaErrorResponse +export type BetaArchiveAgent413 = BetaErrorResponse +export const BetaArchiveAgent413 = BetaErrorResponse +export type BetaArchiveAgent429 = BetaErrorResponse +export const BetaArchiveAgent429 = BetaErrorResponse +export type BetaArchiveAgent431 = BetaErrorResponse +export const BetaArchiveAgent431 = BetaErrorResponse +export type BetaArchiveAgent499 = BetaErrorResponse +export const BetaArchiveAgent499 = BetaErrorResponse +export type BetaArchiveAgent500 = BetaErrorResponse +export const BetaArchiveAgent500 = BetaErrorResponse +export type BetaArchiveAgent501 = BetaErrorResponse +export const BetaArchiveAgent501 = BetaErrorResponse +export type BetaArchiveAgent503 = BetaErrorResponse +export const BetaArchiveAgent503 = BetaErrorResponse +export type BetaArchiveAgent504 = BetaErrorResponse +export const BetaArchiveAgent504 = BetaErrorResponse +export type BetaListAgentVersionsParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string + readonly "limit"?: number + readonly "page"?: string +} +export const BetaListAgentVersionsParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String), + "limit": Schema.optionalKey(Schema.Number.annotate({ "format": "int32" }).check(Schema.isInt())), + "page": Schema.optionalKey(Schema.String) +}) +export type BetaListAgentVersions200 = BetaManagedAgentsListAgentVersions +export const BetaListAgentVersions200 = BetaManagedAgentsListAgentVersions +export type BetaListAgentVersions400 = BetaErrorResponse +export const BetaListAgentVersions400 = BetaErrorResponse +export type BetaListAgentVersions401 = BetaErrorResponse +export const BetaListAgentVersions401 = BetaErrorResponse +export type BetaListAgentVersions403 = BetaErrorResponse +export const BetaListAgentVersions403 = BetaErrorResponse +export type BetaListAgentVersions404 = BetaErrorResponse +export const BetaListAgentVersions404 = BetaErrorResponse +export type BetaListAgentVersions408 = BetaErrorResponse +export const BetaListAgentVersions408 = BetaErrorResponse +export type BetaListAgentVersions409 = BetaErrorResponse +export const BetaListAgentVersions409 = BetaErrorResponse +export type BetaListAgentVersions412 = BetaErrorResponse +export const BetaListAgentVersions412 = BetaErrorResponse +export type BetaListAgentVersions413 = BetaErrorResponse +export const BetaListAgentVersions413 = BetaErrorResponse +export type BetaListAgentVersions429 = BetaErrorResponse +export const BetaListAgentVersions429 = BetaErrorResponse +export type BetaListAgentVersions431 = BetaErrorResponse +export const BetaListAgentVersions431 = BetaErrorResponse +export type BetaListAgentVersions499 = BetaErrorResponse +export const BetaListAgentVersions499 = BetaErrorResponse +export type BetaListAgentVersions500 = BetaErrorResponse +export const BetaListAgentVersions500 = BetaErrorResponse +export type BetaListAgentVersions501 = BetaErrorResponse +export const BetaListAgentVersions501 = BetaErrorResponse +export type BetaListAgentVersions503 = BetaErrorResponse +export const BetaListAgentVersions503 = BetaErrorResponse +export type BetaListAgentVersions504 = BetaErrorResponse +export const BetaListAgentVersions504 = BetaErrorResponse +export type BetaListVaultsParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string + readonly "limit"?: number + readonly "page"?: string + readonly "include_archived"?: boolean +} +export const BetaListVaultsParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String), + "limit": Schema.optionalKey(Schema.Number.annotate({ "format": "int32" }).check(Schema.isInt())), + "page": Schema.optionalKey(Schema.String), + "include_archived": Schema.optionalKey(Schema.Boolean) +}) +export type BetaListVaults200 = BetaManagedAgentsListVaultsResponse +export const BetaListVaults200 = BetaManagedAgentsListVaultsResponse +export type BetaListVaults400 = BetaErrorResponse +export const BetaListVaults400 = BetaErrorResponse +export type BetaListVaults401 = BetaErrorResponse +export const BetaListVaults401 = BetaErrorResponse +export type BetaListVaults403 = BetaErrorResponse +export const BetaListVaults403 = BetaErrorResponse +export type BetaListVaults404 = BetaErrorResponse +export const BetaListVaults404 = BetaErrorResponse +export type BetaListVaults408 = BetaErrorResponse +export const BetaListVaults408 = BetaErrorResponse +export type BetaListVaults409 = BetaErrorResponse +export const BetaListVaults409 = BetaErrorResponse +export type BetaListVaults412 = BetaErrorResponse +export const BetaListVaults412 = BetaErrorResponse +export type BetaListVaults413 = BetaErrorResponse +export const BetaListVaults413 = BetaErrorResponse +export type BetaListVaults429 = BetaErrorResponse +export const BetaListVaults429 = BetaErrorResponse +export type BetaListVaults431 = BetaErrorResponse +export const BetaListVaults431 = BetaErrorResponse +export type BetaListVaults499 = BetaErrorResponse +export const BetaListVaults499 = BetaErrorResponse +export type BetaListVaults500 = BetaErrorResponse +export const BetaListVaults500 = BetaErrorResponse +export type BetaListVaults501 = BetaErrorResponse +export const BetaListVaults501 = BetaErrorResponse +export type BetaListVaults503 = BetaErrorResponse +export const BetaListVaults503 = BetaErrorResponse +export type BetaListVaults504 = BetaErrorResponse +export const BetaListVaults504 = BetaErrorResponse +export type BetaCreateVaultParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string } +export const BetaCreateVaultParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaCreateVaultRequestJson = BetaManagedAgentsCreateVaultRequest +export const BetaCreateVaultRequestJson = BetaManagedAgentsCreateVaultRequest +export type BetaCreateVault200 = BetaManagedAgentsVault +export const BetaCreateVault200 = BetaManagedAgentsVault +export type BetaCreateVault400 = BetaErrorResponse +export const BetaCreateVault400 = BetaErrorResponse +export type BetaCreateVault401 = BetaErrorResponse +export const BetaCreateVault401 = BetaErrorResponse +export type BetaCreateVault403 = BetaErrorResponse +export const BetaCreateVault403 = BetaErrorResponse +export type BetaCreateVault404 = BetaErrorResponse +export const BetaCreateVault404 = BetaErrorResponse +export type BetaCreateVault408 = BetaErrorResponse +export const BetaCreateVault408 = BetaErrorResponse +export type BetaCreateVault409 = BetaErrorResponse +export const BetaCreateVault409 = BetaErrorResponse +export type BetaCreateVault412 = BetaErrorResponse +export const BetaCreateVault412 = BetaErrorResponse +export type BetaCreateVault413 = BetaErrorResponse +export const BetaCreateVault413 = BetaErrorResponse +export type BetaCreateVault429 = BetaErrorResponse +export const BetaCreateVault429 = BetaErrorResponse +export type BetaCreateVault431 = BetaErrorResponse +export const BetaCreateVault431 = BetaErrorResponse +export type BetaCreateVault499 = BetaErrorResponse +export const BetaCreateVault499 = BetaErrorResponse +export type BetaCreateVault500 = BetaErrorResponse +export const BetaCreateVault500 = BetaErrorResponse +export type BetaCreateVault501 = BetaErrorResponse +export const BetaCreateVault501 = BetaErrorResponse +export type BetaCreateVault503 = BetaErrorResponse +export const BetaCreateVault503 = BetaErrorResponse +export type BetaCreateVault504 = BetaErrorResponse +export const BetaCreateVault504 = BetaErrorResponse +export type BetaGetVaultParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string +} +export const BetaGetVaultParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaGetVault200 = BetaManagedAgentsVault +export const BetaGetVault200 = BetaManagedAgentsVault +export type BetaGetVault400 = BetaErrorResponse +export const BetaGetVault400 = BetaErrorResponse +export type BetaGetVault401 = BetaErrorResponse +export const BetaGetVault401 = BetaErrorResponse +export type BetaGetVault403 = BetaErrorResponse +export const BetaGetVault403 = BetaErrorResponse +export type BetaGetVault404 = BetaErrorResponse +export const BetaGetVault404 = BetaErrorResponse +export type BetaGetVault408 = BetaErrorResponse +export const BetaGetVault408 = BetaErrorResponse +export type BetaGetVault409 = BetaErrorResponse +export const BetaGetVault409 = BetaErrorResponse +export type BetaGetVault412 = BetaErrorResponse +export const BetaGetVault412 = BetaErrorResponse +export type BetaGetVault413 = BetaErrorResponse +export const BetaGetVault413 = BetaErrorResponse +export type BetaGetVault429 = BetaErrorResponse +export const BetaGetVault429 = BetaErrorResponse +export type BetaGetVault431 = BetaErrorResponse +export const BetaGetVault431 = BetaErrorResponse +export type BetaGetVault499 = BetaErrorResponse +export const BetaGetVault499 = BetaErrorResponse +export type BetaGetVault500 = BetaErrorResponse +export const BetaGetVault500 = BetaErrorResponse +export type BetaGetVault501 = BetaErrorResponse +export const BetaGetVault501 = BetaErrorResponse +export type BetaGetVault503 = BetaErrorResponse +export const BetaGetVault503 = BetaErrorResponse +export type BetaGetVault504 = BetaErrorResponse +export const BetaGetVault504 = BetaErrorResponse +export type BetaUpdateVaultParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string } +export const BetaUpdateVaultParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaUpdateVaultRequestJson = BetaManagedAgentsUpdateVaultRequestBody +export const BetaUpdateVaultRequestJson = BetaManagedAgentsUpdateVaultRequestBody +export type BetaUpdateVault200 = BetaManagedAgentsVault +export const BetaUpdateVault200 = BetaManagedAgentsVault +export type BetaUpdateVault400 = BetaErrorResponse +export const BetaUpdateVault400 = BetaErrorResponse +export type BetaUpdateVault401 = BetaErrorResponse +export const BetaUpdateVault401 = BetaErrorResponse +export type BetaUpdateVault403 = BetaErrorResponse +export const BetaUpdateVault403 = BetaErrorResponse +export type BetaUpdateVault404 = BetaErrorResponse +export const BetaUpdateVault404 = BetaErrorResponse +export type BetaUpdateVault408 = BetaErrorResponse +export const BetaUpdateVault408 = BetaErrorResponse +export type BetaUpdateVault409 = BetaErrorResponse +export const BetaUpdateVault409 = BetaErrorResponse +export type BetaUpdateVault412 = BetaErrorResponse +export const BetaUpdateVault412 = BetaErrorResponse +export type BetaUpdateVault413 = BetaErrorResponse +export const BetaUpdateVault413 = BetaErrorResponse +export type BetaUpdateVault429 = BetaErrorResponse +export const BetaUpdateVault429 = BetaErrorResponse +export type BetaUpdateVault431 = BetaErrorResponse +export const BetaUpdateVault431 = BetaErrorResponse +export type BetaUpdateVault499 = BetaErrorResponse +export const BetaUpdateVault499 = BetaErrorResponse +export type BetaUpdateVault500 = BetaErrorResponse +export const BetaUpdateVault500 = BetaErrorResponse +export type BetaUpdateVault501 = BetaErrorResponse +export const BetaUpdateVault501 = BetaErrorResponse +export type BetaUpdateVault503 = BetaErrorResponse +export const BetaUpdateVault503 = BetaErrorResponse +export type BetaUpdateVault504 = BetaErrorResponse +export const BetaUpdateVault504 = BetaErrorResponse +export type BetaDeleteVaultParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string +} +export const BetaDeleteVaultParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaDeleteVault200 = BetaManagedAgentsDeletedVault +export const BetaDeleteVault200 = BetaManagedAgentsDeletedVault +export type BetaDeleteVault400 = BetaErrorResponse +export const BetaDeleteVault400 = BetaErrorResponse +export type BetaDeleteVault401 = BetaErrorResponse +export const BetaDeleteVault401 = BetaErrorResponse +export type BetaDeleteVault403 = BetaErrorResponse +export const BetaDeleteVault403 = BetaErrorResponse +export type BetaDeleteVault404 = BetaErrorResponse +export const BetaDeleteVault404 = BetaErrorResponse +export type BetaDeleteVault408 = BetaErrorResponse +export const BetaDeleteVault408 = BetaErrorResponse +export type BetaDeleteVault409 = BetaErrorResponse +export const BetaDeleteVault409 = BetaErrorResponse +export type BetaDeleteVault412 = BetaErrorResponse +export const BetaDeleteVault412 = BetaErrorResponse +export type BetaDeleteVault413 = BetaErrorResponse +export const BetaDeleteVault413 = BetaErrorResponse +export type BetaDeleteVault429 = BetaErrorResponse +export const BetaDeleteVault429 = BetaErrorResponse +export type BetaDeleteVault431 = BetaErrorResponse +export const BetaDeleteVault431 = BetaErrorResponse +export type BetaDeleteVault499 = BetaErrorResponse +export const BetaDeleteVault499 = BetaErrorResponse +export type BetaDeleteVault500 = BetaErrorResponse +export const BetaDeleteVault500 = BetaErrorResponse +export type BetaDeleteVault501 = BetaErrorResponse +export const BetaDeleteVault501 = BetaErrorResponse +export type BetaDeleteVault503 = BetaErrorResponse +export const BetaDeleteVault503 = BetaErrorResponse +export type BetaDeleteVault504 = BetaErrorResponse +export const BetaDeleteVault504 = BetaErrorResponse +export type BetaArchiveVaultParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string } +export const BetaArchiveVaultParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaArchiveVault200 = BetaManagedAgentsVault +export const BetaArchiveVault200 = BetaManagedAgentsVault +export type BetaArchiveVault400 = BetaErrorResponse +export const BetaArchiveVault400 = BetaErrorResponse +export type BetaArchiveVault401 = BetaErrorResponse +export const BetaArchiveVault401 = BetaErrorResponse +export type BetaArchiveVault403 = BetaErrorResponse +export const BetaArchiveVault403 = BetaErrorResponse +export type BetaArchiveVault404 = BetaErrorResponse +export const BetaArchiveVault404 = BetaErrorResponse +export type BetaArchiveVault408 = BetaErrorResponse +export const BetaArchiveVault408 = BetaErrorResponse +export type BetaArchiveVault409 = BetaErrorResponse +export const BetaArchiveVault409 = BetaErrorResponse +export type BetaArchiveVault412 = BetaErrorResponse +export const BetaArchiveVault412 = BetaErrorResponse +export type BetaArchiveVault413 = BetaErrorResponse +export const BetaArchiveVault413 = BetaErrorResponse +export type BetaArchiveVault429 = BetaErrorResponse +export const BetaArchiveVault429 = BetaErrorResponse +export type BetaArchiveVault431 = BetaErrorResponse +export const BetaArchiveVault431 = BetaErrorResponse +export type BetaArchiveVault499 = BetaErrorResponse +export const BetaArchiveVault499 = BetaErrorResponse +export type BetaArchiveVault500 = BetaErrorResponse +export const BetaArchiveVault500 = BetaErrorResponse +export type BetaArchiveVault501 = BetaErrorResponse +export const BetaArchiveVault501 = BetaErrorResponse +export type BetaArchiveVault503 = BetaErrorResponse +export const BetaArchiveVault503 = BetaErrorResponse +export type BetaArchiveVault504 = BetaErrorResponse +export const BetaArchiveVault504 = BetaErrorResponse +export type BetaListCredentialsParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string + readonly "limit"?: number + readonly "page"?: string + readonly "include_archived"?: boolean +} +export const BetaListCredentialsParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String), + "limit": Schema.optionalKey(Schema.Number.annotate({ "format": "int32" }).check(Schema.isInt())), + "page": Schema.optionalKey(Schema.String), + "include_archived": Schema.optionalKey(Schema.Boolean) +}) +export type BetaListCredentials200 = BetaManagedAgentsListCredentialsResponse +export const BetaListCredentials200 = BetaManagedAgentsListCredentialsResponse +export type BetaListCredentials400 = BetaErrorResponse +export const BetaListCredentials400 = BetaErrorResponse +export type BetaListCredentials401 = BetaErrorResponse +export const BetaListCredentials401 = BetaErrorResponse +export type BetaListCredentials403 = BetaErrorResponse +export const BetaListCredentials403 = BetaErrorResponse +export type BetaListCredentials404 = BetaErrorResponse +export const BetaListCredentials404 = BetaErrorResponse +export type BetaListCredentials408 = BetaErrorResponse +export const BetaListCredentials408 = BetaErrorResponse +export type BetaListCredentials409 = BetaErrorResponse +export const BetaListCredentials409 = BetaErrorResponse +export type BetaListCredentials412 = BetaErrorResponse +export const BetaListCredentials412 = BetaErrorResponse +export type BetaListCredentials413 = BetaErrorResponse +export const BetaListCredentials413 = BetaErrorResponse +export type BetaListCredentials429 = BetaErrorResponse +export const BetaListCredentials429 = BetaErrorResponse +export type BetaListCredentials431 = BetaErrorResponse +export const BetaListCredentials431 = BetaErrorResponse +export type BetaListCredentials499 = BetaErrorResponse +export const BetaListCredentials499 = BetaErrorResponse +export type BetaListCredentials500 = BetaErrorResponse +export const BetaListCredentials500 = BetaErrorResponse +export type BetaListCredentials501 = BetaErrorResponse +export const BetaListCredentials501 = BetaErrorResponse +export type BetaListCredentials503 = BetaErrorResponse +export const BetaListCredentials503 = BetaErrorResponse +export type BetaListCredentials504 = BetaErrorResponse +export const BetaListCredentials504 = BetaErrorResponse +export type BetaCreateCredentialParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string } +export const BetaCreateCredentialParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaCreateCredentialRequestJson = BetaManagedAgentsCreateCredentialRequestBody +export const BetaCreateCredentialRequestJson = BetaManagedAgentsCreateCredentialRequestBody +export type BetaCreateCredential200 = BetaManagedAgentsCredential +export const BetaCreateCredential200 = BetaManagedAgentsCredential +export type BetaCreateCredential400 = BetaErrorResponse +export const BetaCreateCredential400 = BetaErrorResponse +export type BetaCreateCredential401 = BetaErrorResponse +export const BetaCreateCredential401 = BetaErrorResponse +export type BetaCreateCredential403 = BetaErrorResponse +export const BetaCreateCredential403 = BetaErrorResponse +export type BetaCreateCredential404 = BetaErrorResponse +export const BetaCreateCredential404 = BetaErrorResponse +export type BetaCreateCredential408 = BetaErrorResponse +export const BetaCreateCredential408 = BetaErrorResponse +export type BetaCreateCredential409 = BetaErrorResponse +export const BetaCreateCredential409 = BetaErrorResponse +export type BetaCreateCredential412 = BetaErrorResponse +export const BetaCreateCredential412 = BetaErrorResponse +export type BetaCreateCredential413 = BetaErrorResponse +export const BetaCreateCredential413 = BetaErrorResponse +export type BetaCreateCredential429 = BetaErrorResponse +export const BetaCreateCredential429 = BetaErrorResponse +export type BetaCreateCredential431 = BetaErrorResponse +export const BetaCreateCredential431 = BetaErrorResponse +export type BetaCreateCredential499 = BetaErrorResponse +export const BetaCreateCredential499 = BetaErrorResponse +export type BetaCreateCredential500 = BetaErrorResponse +export const BetaCreateCredential500 = BetaErrorResponse +export type BetaCreateCredential501 = BetaErrorResponse +export const BetaCreateCredential501 = BetaErrorResponse +export type BetaCreateCredential503 = BetaErrorResponse +export const BetaCreateCredential503 = BetaErrorResponse +export type BetaCreateCredential504 = BetaErrorResponse +export const BetaCreateCredential504 = BetaErrorResponse +export type BetaGetCredentialParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string +} +export const BetaGetCredentialParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaGetCredential200 = BetaManagedAgentsCredential +export const BetaGetCredential200 = BetaManagedAgentsCredential +export type BetaGetCredential400 = BetaErrorResponse +export const BetaGetCredential400 = BetaErrorResponse +export type BetaGetCredential401 = BetaErrorResponse +export const BetaGetCredential401 = BetaErrorResponse +export type BetaGetCredential403 = BetaErrorResponse +export const BetaGetCredential403 = BetaErrorResponse +export type BetaGetCredential404 = BetaErrorResponse +export const BetaGetCredential404 = BetaErrorResponse +export type BetaGetCredential408 = BetaErrorResponse +export const BetaGetCredential408 = BetaErrorResponse +export type BetaGetCredential409 = BetaErrorResponse +export const BetaGetCredential409 = BetaErrorResponse +export type BetaGetCredential412 = BetaErrorResponse +export const BetaGetCredential412 = BetaErrorResponse +export type BetaGetCredential413 = BetaErrorResponse +export const BetaGetCredential413 = BetaErrorResponse +export type BetaGetCredential429 = BetaErrorResponse +export const BetaGetCredential429 = BetaErrorResponse +export type BetaGetCredential431 = BetaErrorResponse +export const BetaGetCredential431 = BetaErrorResponse +export type BetaGetCredential499 = BetaErrorResponse +export const BetaGetCredential499 = BetaErrorResponse +export type BetaGetCredential500 = BetaErrorResponse +export const BetaGetCredential500 = BetaErrorResponse +export type BetaGetCredential501 = BetaErrorResponse +export const BetaGetCredential501 = BetaErrorResponse +export type BetaGetCredential503 = BetaErrorResponse +export const BetaGetCredential503 = BetaErrorResponse +export type BetaGetCredential504 = BetaErrorResponse +export const BetaGetCredential504 = BetaErrorResponse +export type BetaUpdateCredentialParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string } +export const BetaUpdateCredentialParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaUpdateCredentialRequestJson = BetaManagedAgentsUpdateCredentialRequestBody +export const BetaUpdateCredentialRequestJson = BetaManagedAgentsUpdateCredentialRequestBody +export type BetaUpdateCredential200 = BetaManagedAgentsCredential +export const BetaUpdateCredential200 = BetaManagedAgentsCredential +export type BetaUpdateCredential400 = BetaErrorResponse +export const BetaUpdateCredential400 = BetaErrorResponse +export type BetaUpdateCredential401 = BetaErrorResponse +export const BetaUpdateCredential401 = BetaErrorResponse +export type BetaUpdateCredential403 = BetaErrorResponse +export const BetaUpdateCredential403 = BetaErrorResponse +export type BetaUpdateCredential404 = BetaErrorResponse +export const BetaUpdateCredential404 = BetaErrorResponse +export type BetaUpdateCredential408 = BetaErrorResponse +export const BetaUpdateCredential408 = BetaErrorResponse +export type BetaUpdateCredential409 = BetaErrorResponse +export const BetaUpdateCredential409 = BetaErrorResponse +export type BetaUpdateCredential412 = BetaErrorResponse +export const BetaUpdateCredential412 = BetaErrorResponse +export type BetaUpdateCredential413 = BetaErrorResponse +export const BetaUpdateCredential413 = BetaErrorResponse +export type BetaUpdateCredential429 = BetaErrorResponse +export const BetaUpdateCredential429 = BetaErrorResponse +export type BetaUpdateCredential431 = BetaErrorResponse +export const BetaUpdateCredential431 = BetaErrorResponse +export type BetaUpdateCredential499 = BetaErrorResponse +export const BetaUpdateCredential499 = BetaErrorResponse +export type BetaUpdateCredential500 = BetaErrorResponse +export const BetaUpdateCredential500 = BetaErrorResponse +export type BetaUpdateCredential501 = BetaErrorResponse +export const BetaUpdateCredential501 = BetaErrorResponse +export type BetaUpdateCredential503 = BetaErrorResponse +export const BetaUpdateCredential503 = BetaErrorResponse +export type BetaUpdateCredential504 = BetaErrorResponse +export const BetaUpdateCredential504 = BetaErrorResponse +export type BetaDeleteCredentialParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string +} +export const BetaDeleteCredentialParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaDeleteCredential200 = BetaManagedAgentsDeletedCredential +export const BetaDeleteCredential200 = BetaManagedAgentsDeletedCredential +export type BetaDeleteCredential400 = BetaErrorResponse +export const BetaDeleteCredential400 = BetaErrorResponse +export type BetaDeleteCredential401 = BetaErrorResponse +export const BetaDeleteCredential401 = BetaErrorResponse +export type BetaDeleteCredential403 = BetaErrorResponse +export const BetaDeleteCredential403 = BetaErrorResponse +export type BetaDeleteCredential404 = BetaErrorResponse +export const BetaDeleteCredential404 = BetaErrorResponse +export type BetaDeleteCredential408 = BetaErrorResponse +export const BetaDeleteCredential408 = BetaErrorResponse +export type BetaDeleteCredential409 = BetaErrorResponse +export const BetaDeleteCredential409 = BetaErrorResponse +export type BetaDeleteCredential412 = BetaErrorResponse +export const BetaDeleteCredential412 = BetaErrorResponse +export type BetaDeleteCredential413 = BetaErrorResponse +export const BetaDeleteCredential413 = BetaErrorResponse +export type BetaDeleteCredential429 = BetaErrorResponse +export const BetaDeleteCredential429 = BetaErrorResponse +export type BetaDeleteCredential431 = BetaErrorResponse +export const BetaDeleteCredential431 = BetaErrorResponse +export type BetaDeleteCredential499 = BetaErrorResponse +export const BetaDeleteCredential499 = BetaErrorResponse +export type BetaDeleteCredential500 = BetaErrorResponse +export const BetaDeleteCredential500 = BetaErrorResponse +export type BetaDeleteCredential501 = BetaErrorResponse +export const BetaDeleteCredential501 = BetaErrorResponse +export type BetaDeleteCredential503 = BetaErrorResponse +export const BetaDeleteCredential503 = BetaErrorResponse +export type BetaDeleteCredential504 = BetaErrorResponse +export const BetaDeleteCredential504 = BetaErrorResponse +export type BetaArchiveCredentialParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string } +export const BetaArchiveCredentialParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaArchiveCredential200 = BetaManagedAgentsCredential +export const BetaArchiveCredential200 = BetaManagedAgentsCredential +export type BetaArchiveCredential400 = BetaErrorResponse +export const BetaArchiveCredential400 = BetaErrorResponse +export type BetaArchiveCredential401 = BetaErrorResponse +export const BetaArchiveCredential401 = BetaErrorResponse +export type BetaArchiveCredential403 = BetaErrorResponse +export const BetaArchiveCredential403 = BetaErrorResponse +export type BetaArchiveCredential404 = BetaErrorResponse +export const BetaArchiveCredential404 = BetaErrorResponse +export type BetaArchiveCredential408 = BetaErrorResponse +export const BetaArchiveCredential408 = BetaErrorResponse +export type BetaArchiveCredential409 = BetaErrorResponse +export const BetaArchiveCredential409 = BetaErrorResponse +export type BetaArchiveCredential412 = BetaErrorResponse +export const BetaArchiveCredential412 = BetaErrorResponse +export type BetaArchiveCredential413 = BetaErrorResponse +export const BetaArchiveCredential413 = BetaErrorResponse +export type BetaArchiveCredential429 = BetaErrorResponse +export const BetaArchiveCredential429 = BetaErrorResponse +export type BetaArchiveCredential431 = BetaErrorResponse +export const BetaArchiveCredential431 = BetaErrorResponse +export type BetaArchiveCredential499 = BetaErrorResponse +export const BetaArchiveCredential499 = BetaErrorResponse +export type BetaArchiveCredential500 = BetaErrorResponse +export const BetaArchiveCredential500 = BetaErrorResponse +export type BetaArchiveCredential501 = BetaErrorResponse +export const BetaArchiveCredential501 = BetaErrorResponse +export type BetaArchiveCredential503 = BetaErrorResponse +export const BetaArchiveCredential503 = BetaErrorResponse +export type BetaArchiveCredential504 = BetaErrorResponse +export const BetaArchiveCredential504 = BetaErrorResponse +export type BetaValidateCredentialParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string } +export const BetaValidateCredentialParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaValidateCredential200 = BetaManagedAgentsCredentialValidation +export const BetaValidateCredential200 = BetaManagedAgentsCredentialValidation +export type BetaValidateCredential400 = BetaErrorResponse +export const BetaValidateCredential400 = BetaErrorResponse +export type BetaValidateCredential401 = BetaErrorResponse +export const BetaValidateCredential401 = BetaErrorResponse +export type BetaValidateCredential403 = BetaErrorResponse +export const BetaValidateCredential403 = BetaErrorResponse +export type BetaValidateCredential404 = BetaErrorResponse +export const BetaValidateCredential404 = BetaErrorResponse +export type BetaValidateCredential408 = BetaErrorResponse +export const BetaValidateCredential408 = BetaErrorResponse +export type BetaValidateCredential409 = BetaErrorResponse +export const BetaValidateCredential409 = BetaErrorResponse +export type BetaValidateCredential412 = BetaErrorResponse +export const BetaValidateCredential412 = BetaErrorResponse +export type BetaValidateCredential413 = BetaErrorResponse +export const BetaValidateCredential413 = BetaErrorResponse +export type BetaValidateCredential429 = BetaErrorResponse +export const BetaValidateCredential429 = BetaErrorResponse +export type BetaValidateCredential431 = BetaErrorResponse +export const BetaValidateCredential431 = BetaErrorResponse +export type BetaValidateCredential499 = BetaErrorResponse +export const BetaValidateCredential499 = BetaErrorResponse +export type BetaValidateCredential500 = BetaErrorResponse +export const BetaValidateCredential500 = BetaErrorResponse +export type BetaValidateCredential501 = BetaErrorResponse +export const BetaValidateCredential501 = BetaErrorResponse +export type BetaValidateCredential503 = BetaErrorResponse +export const BetaValidateCredential503 = BetaErrorResponse +export type BetaValidateCredential504 = BetaErrorResponse +export const BetaValidateCredential504 = BetaErrorResponse +export type BetaListMemoriesParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string + readonly "path_prefix"?: string + readonly "depth"?: number + readonly "order_by"?: string + readonly "order"?: BetaManagedAgentsListOrder + readonly "limit"?: number + readonly "page"?: string + readonly "view"?: BetaManagedAgentsMemoryView +} +export const BetaListMemoriesParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String), + "path_prefix": Schema.optionalKey(Schema.String), + "depth": Schema.optionalKey(Schema.Number.annotate({ "format": "int32" }).check(Schema.isInt())), + "order_by": Schema.optionalKey(Schema.String), + "order": Schema.optionalKey(BetaManagedAgentsListOrder), + "limit": Schema.optionalKey(Schema.Number.annotate({ "format": "int32" }).check(Schema.isInt())), + "page": Schema.optionalKey(Schema.String), + "view": Schema.optionalKey(BetaManagedAgentsMemoryView) +}) +export type BetaListMemories200 = BetaManagedAgentsListMemoriesResult +export const BetaListMemories200 = BetaManagedAgentsListMemoriesResult +export type BetaListMemories400 = BetaManagedAgentsErrorResponse +export const BetaListMemories400 = BetaManagedAgentsErrorResponse +export type BetaListMemories401 = BetaManagedAgentsErrorResponse +export const BetaListMemories401 = BetaManagedAgentsErrorResponse +export type BetaListMemories403 = BetaManagedAgentsErrorResponse +export const BetaListMemories403 = BetaManagedAgentsErrorResponse +export type BetaListMemories404 = BetaManagedAgentsErrorResponse +export const BetaListMemories404 = BetaManagedAgentsErrorResponse +export type BetaListMemories408 = BetaManagedAgentsErrorResponse +export const BetaListMemories408 = BetaManagedAgentsErrorResponse +export type BetaListMemories409 = BetaManagedAgentsErrorResponse +export const BetaListMemories409 = BetaManagedAgentsErrorResponse +export type BetaListMemories412 = BetaManagedAgentsErrorResponse +export const BetaListMemories412 = BetaManagedAgentsErrorResponse +export type BetaListMemories413 = BetaManagedAgentsErrorResponse +export const BetaListMemories413 = BetaManagedAgentsErrorResponse +export type BetaListMemories429 = BetaManagedAgentsErrorResponse +export const BetaListMemories429 = BetaManagedAgentsErrorResponse +export type BetaListMemories431 = BetaManagedAgentsErrorResponse +export const BetaListMemories431 = BetaManagedAgentsErrorResponse +export type BetaListMemories499 = BetaManagedAgentsErrorResponse +export const BetaListMemories499 = BetaManagedAgentsErrorResponse +export type BetaListMemories500 = BetaManagedAgentsErrorResponse +export const BetaListMemories500 = BetaManagedAgentsErrorResponse +export type BetaListMemories501 = BetaManagedAgentsErrorResponse +export const BetaListMemories501 = BetaManagedAgentsErrorResponse +export type BetaListMemories503 = BetaManagedAgentsErrorResponse +export const BetaListMemories503 = BetaManagedAgentsErrorResponse +export type BetaListMemories504 = BetaManagedAgentsErrorResponse +export const BetaListMemories504 = BetaManagedAgentsErrorResponse +export type BetaCreateMemoryParams = { + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string + readonly "view"?: BetaManagedAgentsMemoryView +} +export const BetaCreateMemoryParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String), + "view": Schema.optionalKey(BetaManagedAgentsMemoryView) +}) +export type BetaCreateMemoryRequestJson = BetaManagedAgentsCreateMemoryParams +export const BetaCreateMemoryRequestJson = BetaManagedAgentsCreateMemoryParams +export type BetaCreateMemory200 = BetaManagedAgentsMemory +export const BetaCreateMemory200 = BetaManagedAgentsMemory +export type BetaCreateMemory400 = BetaManagedAgentsErrorResponse +export const BetaCreateMemory400 = BetaManagedAgentsErrorResponse +export type BetaCreateMemory401 = BetaManagedAgentsErrorResponse +export const BetaCreateMemory401 = BetaManagedAgentsErrorResponse +export type BetaCreateMemory403 = BetaManagedAgentsErrorResponse +export const BetaCreateMemory403 = BetaManagedAgentsErrorResponse +export type BetaCreateMemory404 = BetaManagedAgentsErrorResponse +export const BetaCreateMemory404 = BetaManagedAgentsErrorResponse +export type BetaCreateMemory408 = BetaManagedAgentsErrorResponse +export const BetaCreateMemory408 = BetaManagedAgentsErrorResponse +export type BetaCreateMemory409 = BetaManagedAgentsErrorResponse +export const BetaCreateMemory409 = BetaManagedAgentsErrorResponse +export type BetaCreateMemory412 = BetaManagedAgentsErrorResponse +export const BetaCreateMemory412 = BetaManagedAgentsErrorResponse +export type BetaCreateMemory413 = BetaManagedAgentsErrorResponse +export const BetaCreateMemory413 = BetaManagedAgentsErrorResponse +export type BetaCreateMemory429 = BetaManagedAgentsErrorResponse +export const BetaCreateMemory429 = BetaManagedAgentsErrorResponse +export type BetaCreateMemory431 = BetaManagedAgentsErrorResponse +export const BetaCreateMemory431 = BetaManagedAgentsErrorResponse +export type BetaCreateMemory499 = BetaManagedAgentsErrorResponse +export const BetaCreateMemory499 = BetaManagedAgentsErrorResponse +export type BetaCreateMemory500 = BetaManagedAgentsErrorResponse +export const BetaCreateMemory500 = BetaManagedAgentsErrorResponse +export type BetaCreateMemory501 = BetaManagedAgentsErrorResponse +export const BetaCreateMemory501 = BetaManagedAgentsErrorResponse +export type BetaCreateMemory503 = BetaManagedAgentsErrorResponse +export const BetaCreateMemory503 = BetaManagedAgentsErrorResponse +export type BetaCreateMemory504 = BetaManagedAgentsErrorResponse +export const BetaCreateMemory504 = BetaManagedAgentsErrorResponse +export type BetaGetMemoryParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string + readonly "view"?: BetaManagedAgentsMemoryView +} +export const BetaGetMemoryParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String), + "view": Schema.optionalKey(BetaManagedAgentsMemoryView) +}) +export type BetaGetMemory200 = BetaManagedAgentsMemory +export const BetaGetMemory200 = BetaManagedAgentsMemory +export type BetaGetMemory400 = BetaManagedAgentsErrorResponse +export const BetaGetMemory400 = BetaManagedAgentsErrorResponse +export type BetaGetMemory401 = BetaManagedAgentsErrorResponse +export const BetaGetMemory401 = BetaManagedAgentsErrorResponse +export type BetaGetMemory403 = BetaManagedAgentsErrorResponse +export const BetaGetMemory403 = BetaManagedAgentsErrorResponse +export type BetaGetMemory404 = BetaManagedAgentsErrorResponse +export const BetaGetMemory404 = BetaManagedAgentsErrorResponse +export type BetaGetMemory408 = BetaManagedAgentsErrorResponse +export const BetaGetMemory408 = BetaManagedAgentsErrorResponse +export type BetaGetMemory409 = BetaManagedAgentsErrorResponse +export const BetaGetMemory409 = BetaManagedAgentsErrorResponse +export type BetaGetMemory412 = BetaManagedAgentsErrorResponse +export const BetaGetMemory412 = BetaManagedAgentsErrorResponse +export type BetaGetMemory413 = BetaManagedAgentsErrorResponse +export const BetaGetMemory413 = BetaManagedAgentsErrorResponse +export type BetaGetMemory429 = BetaManagedAgentsErrorResponse +export const BetaGetMemory429 = BetaManagedAgentsErrorResponse +export type BetaGetMemory431 = BetaManagedAgentsErrorResponse +export const BetaGetMemory431 = BetaManagedAgentsErrorResponse +export type BetaGetMemory499 = BetaManagedAgentsErrorResponse +export const BetaGetMemory499 = BetaManagedAgentsErrorResponse +export type BetaGetMemory500 = BetaManagedAgentsErrorResponse +export const BetaGetMemory500 = BetaManagedAgentsErrorResponse +export type BetaGetMemory501 = BetaManagedAgentsErrorResponse +export const BetaGetMemory501 = BetaManagedAgentsErrorResponse +export type BetaGetMemory503 = BetaManagedAgentsErrorResponse +export const BetaGetMemory503 = BetaManagedAgentsErrorResponse +export type BetaGetMemory504 = BetaManagedAgentsErrorResponse +export const BetaGetMemory504 = BetaManagedAgentsErrorResponse +export type BetaUpdateMemoryParams = { + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string + readonly "view"?: BetaManagedAgentsMemoryView +} +export const BetaUpdateMemoryParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String), + "view": Schema.optionalKey(BetaManagedAgentsMemoryView) +}) +export type BetaUpdateMemoryRequestJson = BetaManagedAgentsUpdateMemoryParams +export const BetaUpdateMemoryRequestJson = BetaManagedAgentsUpdateMemoryParams +export type BetaUpdateMemory200 = BetaManagedAgentsMemory +export const BetaUpdateMemory200 = BetaManagedAgentsMemory +export type BetaUpdateMemory400 = BetaManagedAgentsErrorResponse +export const BetaUpdateMemory400 = BetaManagedAgentsErrorResponse +export type BetaUpdateMemory401 = BetaManagedAgentsErrorResponse +export const BetaUpdateMemory401 = BetaManagedAgentsErrorResponse +export type BetaUpdateMemory403 = BetaManagedAgentsErrorResponse +export const BetaUpdateMemory403 = BetaManagedAgentsErrorResponse +export type BetaUpdateMemory404 = BetaManagedAgentsErrorResponse +export const BetaUpdateMemory404 = BetaManagedAgentsErrorResponse +export type BetaUpdateMemory408 = BetaManagedAgentsErrorResponse +export const BetaUpdateMemory408 = BetaManagedAgentsErrorResponse +export type BetaUpdateMemory409 = BetaManagedAgentsErrorResponse +export const BetaUpdateMemory409 = BetaManagedAgentsErrorResponse +export type BetaUpdateMemory412 = BetaManagedAgentsErrorResponse +export const BetaUpdateMemory412 = BetaManagedAgentsErrorResponse +export type BetaUpdateMemory413 = BetaManagedAgentsErrorResponse +export const BetaUpdateMemory413 = BetaManagedAgentsErrorResponse +export type BetaUpdateMemory429 = BetaManagedAgentsErrorResponse +export const BetaUpdateMemory429 = BetaManagedAgentsErrorResponse +export type BetaUpdateMemory431 = BetaManagedAgentsErrorResponse +export const BetaUpdateMemory431 = BetaManagedAgentsErrorResponse +export type BetaUpdateMemory499 = BetaManagedAgentsErrorResponse +export const BetaUpdateMemory499 = BetaManagedAgentsErrorResponse +export type BetaUpdateMemory500 = BetaManagedAgentsErrorResponse +export const BetaUpdateMemory500 = BetaManagedAgentsErrorResponse +export type BetaUpdateMemory501 = BetaManagedAgentsErrorResponse +export const BetaUpdateMemory501 = BetaManagedAgentsErrorResponse +export type BetaUpdateMemory503 = BetaManagedAgentsErrorResponse +export const BetaUpdateMemory503 = BetaManagedAgentsErrorResponse +export type BetaUpdateMemory504 = BetaManagedAgentsErrorResponse +export const BetaUpdateMemory504 = BetaManagedAgentsErrorResponse +export type BetaDeleteMemoryParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string + readonly "expected_content_sha256"?: string +} +export const BetaDeleteMemoryParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String), + "expected_content_sha256": Schema.optionalKey(Schema.String) +}) +export type BetaDeleteMemory200 = BetaManagedAgentsDeletedMemory +export const BetaDeleteMemory200 = BetaManagedAgentsDeletedMemory +export type BetaDeleteMemory400 = BetaManagedAgentsErrorResponse +export const BetaDeleteMemory400 = BetaManagedAgentsErrorResponse +export type BetaDeleteMemory401 = BetaManagedAgentsErrorResponse +export const BetaDeleteMemory401 = BetaManagedAgentsErrorResponse +export type BetaDeleteMemory403 = BetaManagedAgentsErrorResponse +export const BetaDeleteMemory403 = BetaManagedAgentsErrorResponse +export type BetaDeleteMemory404 = BetaManagedAgentsErrorResponse +export const BetaDeleteMemory404 = BetaManagedAgentsErrorResponse +export type BetaDeleteMemory408 = BetaManagedAgentsErrorResponse +export const BetaDeleteMemory408 = BetaManagedAgentsErrorResponse +export type BetaDeleteMemory409 = BetaManagedAgentsErrorResponse +export const BetaDeleteMemory409 = BetaManagedAgentsErrorResponse +export type BetaDeleteMemory412 = BetaManagedAgentsErrorResponse +export const BetaDeleteMemory412 = BetaManagedAgentsErrorResponse +export type BetaDeleteMemory413 = BetaManagedAgentsErrorResponse +export const BetaDeleteMemory413 = BetaManagedAgentsErrorResponse +export type BetaDeleteMemory429 = BetaManagedAgentsErrorResponse +export const BetaDeleteMemory429 = BetaManagedAgentsErrorResponse +export type BetaDeleteMemory431 = BetaManagedAgentsErrorResponse +export const BetaDeleteMemory431 = BetaManagedAgentsErrorResponse +export type BetaDeleteMemory499 = BetaManagedAgentsErrorResponse +export const BetaDeleteMemory499 = BetaManagedAgentsErrorResponse +export type BetaDeleteMemory500 = BetaManagedAgentsErrorResponse +export const BetaDeleteMemory500 = BetaManagedAgentsErrorResponse +export type BetaDeleteMemory501 = BetaManagedAgentsErrorResponse +export const BetaDeleteMemory501 = BetaManagedAgentsErrorResponse +export type BetaDeleteMemory503 = BetaManagedAgentsErrorResponse +export const BetaDeleteMemory503 = BetaManagedAgentsErrorResponse +export type BetaDeleteMemory504 = BetaManagedAgentsErrorResponse +export const BetaDeleteMemory504 = BetaManagedAgentsErrorResponse +export type BetaListMemoryVersionsParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string + readonly "memory_id"?: string + readonly "session_id"?: string + readonly "api_key_id"?: string + readonly "operation"?: BetaManagedAgentsMemoryVersionOperation + readonly "created_at[gte]"?: BetaTimestamp + readonly "created_at[lte]"?: BetaTimestamp + readonly "limit"?: number + readonly "page"?: string + readonly "view"?: BetaManagedAgentsMemoryView +} +export const BetaListMemoryVersionsParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String), + "memory_id": Schema.optionalKey(Schema.String), + "session_id": Schema.optionalKey(Schema.String), + "api_key_id": Schema.optionalKey(Schema.String), + "operation": Schema.optionalKey(BetaManagedAgentsMemoryVersionOperation), + "created_at[gte]": Schema.optionalKey(BetaTimestamp), + "created_at[lte]": Schema.optionalKey(BetaTimestamp), + "limit": Schema.optionalKey(Schema.Number.annotate({ "format": "int32" }).check(Schema.isInt())), + "page": Schema.optionalKey(Schema.String), + "view": Schema.optionalKey(BetaManagedAgentsMemoryView) +}) +export type BetaListMemoryVersions200 = BetaManagedAgentsListMemoryVersionsResult +export const BetaListMemoryVersions200 = BetaManagedAgentsListMemoryVersionsResult +export type BetaListMemoryVersions400 = BetaManagedAgentsErrorResponse +export const BetaListMemoryVersions400 = BetaManagedAgentsErrorResponse +export type BetaListMemoryVersions401 = BetaManagedAgentsErrorResponse +export const BetaListMemoryVersions401 = BetaManagedAgentsErrorResponse +export type BetaListMemoryVersions403 = BetaManagedAgentsErrorResponse +export const BetaListMemoryVersions403 = BetaManagedAgentsErrorResponse +export type BetaListMemoryVersions404 = BetaManagedAgentsErrorResponse +export const BetaListMemoryVersions404 = BetaManagedAgentsErrorResponse +export type BetaListMemoryVersions408 = BetaManagedAgentsErrorResponse +export const BetaListMemoryVersions408 = BetaManagedAgentsErrorResponse +export type BetaListMemoryVersions409 = BetaManagedAgentsErrorResponse +export const BetaListMemoryVersions409 = BetaManagedAgentsErrorResponse +export type BetaListMemoryVersions412 = BetaManagedAgentsErrorResponse +export const BetaListMemoryVersions412 = BetaManagedAgentsErrorResponse +export type BetaListMemoryVersions413 = BetaManagedAgentsErrorResponse +export const BetaListMemoryVersions413 = BetaManagedAgentsErrorResponse +export type BetaListMemoryVersions429 = BetaManagedAgentsErrorResponse +export const BetaListMemoryVersions429 = BetaManagedAgentsErrorResponse +export type BetaListMemoryVersions431 = BetaManagedAgentsErrorResponse +export const BetaListMemoryVersions431 = BetaManagedAgentsErrorResponse +export type BetaListMemoryVersions499 = BetaManagedAgentsErrorResponse +export const BetaListMemoryVersions499 = BetaManagedAgentsErrorResponse +export type BetaListMemoryVersions500 = BetaManagedAgentsErrorResponse +export const BetaListMemoryVersions500 = BetaManagedAgentsErrorResponse +export type BetaListMemoryVersions501 = BetaManagedAgentsErrorResponse +export const BetaListMemoryVersions501 = BetaManagedAgentsErrorResponse +export type BetaListMemoryVersions503 = BetaManagedAgentsErrorResponse +export const BetaListMemoryVersions503 = BetaManagedAgentsErrorResponse +export type BetaListMemoryVersions504 = BetaManagedAgentsErrorResponse +export const BetaListMemoryVersions504 = BetaManagedAgentsErrorResponse +export type BetaGetMemoryVersionParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string + readonly "view"?: BetaManagedAgentsMemoryView +} +export const BetaGetMemoryVersionParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String), + "view": Schema.optionalKey(BetaManagedAgentsMemoryView) +}) +export type BetaGetMemoryVersion200 = BetaManagedAgentsMemoryVersion +export const BetaGetMemoryVersion200 = BetaManagedAgentsMemoryVersion +export type BetaGetMemoryVersion400 = BetaManagedAgentsErrorResponse +export const BetaGetMemoryVersion400 = BetaManagedAgentsErrorResponse +export type BetaGetMemoryVersion401 = BetaManagedAgentsErrorResponse +export const BetaGetMemoryVersion401 = BetaManagedAgentsErrorResponse +export type BetaGetMemoryVersion403 = BetaManagedAgentsErrorResponse +export const BetaGetMemoryVersion403 = BetaManagedAgentsErrorResponse +export type BetaGetMemoryVersion404 = BetaManagedAgentsErrorResponse +export const BetaGetMemoryVersion404 = BetaManagedAgentsErrorResponse +export type BetaGetMemoryVersion408 = BetaManagedAgentsErrorResponse +export const BetaGetMemoryVersion408 = BetaManagedAgentsErrorResponse +export type BetaGetMemoryVersion409 = BetaManagedAgentsErrorResponse +export const BetaGetMemoryVersion409 = BetaManagedAgentsErrorResponse +export type BetaGetMemoryVersion412 = BetaManagedAgentsErrorResponse +export const BetaGetMemoryVersion412 = BetaManagedAgentsErrorResponse +export type BetaGetMemoryVersion413 = BetaManagedAgentsErrorResponse +export const BetaGetMemoryVersion413 = BetaManagedAgentsErrorResponse +export type BetaGetMemoryVersion429 = BetaManagedAgentsErrorResponse +export const BetaGetMemoryVersion429 = BetaManagedAgentsErrorResponse +export type BetaGetMemoryVersion431 = BetaManagedAgentsErrorResponse +export const BetaGetMemoryVersion431 = BetaManagedAgentsErrorResponse +export type BetaGetMemoryVersion499 = BetaManagedAgentsErrorResponse +export const BetaGetMemoryVersion499 = BetaManagedAgentsErrorResponse +export type BetaGetMemoryVersion500 = BetaManagedAgentsErrorResponse +export const BetaGetMemoryVersion500 = BetaManagedAgentsErrorResponse +export type BetaGetMemoryVersion501 = BetaManagedAgentsErrorResponse +export const BetaGetMemoryVersion501 = BetaManagedAgentsErrorResponse +export type BetaGetMemoryVersion503 = BetaManagedAgentsErrorResponse +export const BetaGetMemoryVersion503 = BetaManagedAgentsErrorResponse +export type BetaGetMemoryVersion504 = BetaManagedAgentsErrorResponse +export const BetaGetMemoryVersion504 = BetaManagedAgentsErrorResponse +export type BetaRedactMemoryVersionParams = { + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string +} +export const BetaRedactMemoryVersionParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaRedactMemoryVersion200 = BetaManagedAgentsMemoryVersion +export const BetaRedactMemoryVersion200 = BetaManagedAgentsMemoryVersion +export type BetaRedactMemoryVersion400 = BetaManagedAgentsErrorResponse +export const BetaRedactMemoryVersion400 = BetaManagedAgentsErrorResponse +export type BetaRedactMemoryVersion401 = BetaManagedAgentsErrorResponse +export const BetaRedactMemoryVersion401 = BetaManagedAgentsErrorResponse +export type BetaRedactMemoryVersion403 = BetaManagedAgentsErrorResponse +export const BetaRedactMemoryVersion403 = BetaManagedAgentsErrorResponse +export type BetaRedactMemoryVersion404 = BetaManagedAgentsErrorResponse +export const BetaRedactMemoryVersion404 = BetaManagedAgentsErrorResponse +export type BetaRedactMemoryVersion408 = BetaManagedAgentsErrorResponse +export const BetaRedactMemoryVersion408 = BetaManagedAgentsErrorResponse +export type BetaRedactMemoryVersion409 = BetaManagedAgentsErrorResponse +export const BetaRedactMemoryVersion409 = BetaManagedAgentsErrorResponse +export type BetaRedactMemoryVersion412 = BetaManagedAgentsErrorResponse +export const BetaRedactMemoryVersion412 = BetaManagedAgentsErrorResponse +export type BetaRedactMemoryVersion413 = BetaManagedAgentsErrorResponse +export const BetaRedactMemoryVersion413 = BetaManagedAgentsErrorResponse +export type BetaRedactMemoryVersion429 = BetaManagedAgentsErrorResponse +export const BetaRedactMemoryVersion429 = BetaManagedAgentsErrorResponse +export type BetaRedactMemoryVersion431 = BetaManagedAgentsErrorResponse +export const BetaRedactMemoryVersion431 = BetaManagedAgentsErrorResponse +export type BetaRedactMemoryVersion499 = BetaManagedAgentsErrorResponse +export const BetaRedactMemoryVersion499 = BetaManagedAgentsErrorResponse +export type BetaRedactMemoryVersion500 = BetaManagedAgentsErrorResponse +export const BetaRedactMemoryVersion500 = BetaManagedAgentsErrorResponse +export type BetaRedactMemoryVersion501 = BetaManagedAgentsErrorResponse +export const BetaRedactMemoryVersion501 = BetaManagedAgentsErrorResponse +export type BetaRedactMemoryVersion503 = BetaManagedAgentsErrorResponse +export const BetaRedactMemoryVersion503 = BetaManagedAgentsErrorResponse +export type BetaRedactMemoryVersion504 = BetaManagedAgentsErrorResponse +export const BetaRedactMemoryVersion504 = BetaManagedAgentsErrorResponse +export type BetaListMemoryStoresParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string + readonly "limit"?: number + readonly "page"?: string + readonly "include_archived"?: boolean + readonly "created_at[gte]"?: BetaTimestamp + readonly "created_at[lte]"?: BetaTimestamp +} +export const BetaListMemoryStoresParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String), + "limit": Schema.optionalKey(Schema.Number.annotate({ "format": "int32" }).check(Schema.isInt())), + "page": Schema.optionalKey(Schema.String), + "include_archived": Schema.optionalKey(Schema.Boolean), + "created_at[gte]": Schema.optionalKey(BetaTimestamp), + "created_at[lte]": Schema.optionalKey(BetaTimestamp) +}) +export type BetaListMemoryStores200 = BetaManagedAgentsListMemoryStoresResponse +export const BetaListMemoryStores200 = BetaManagedAgentsListMemoryStoresResponse +export type BetaListMemoryStores400 = BetaErrorResponse +export const BetaListMemoryStores400 = BetaErrorResponse +export type BetaListMemoryStores401 = BetaErrorResponse +export const BetaListMemoryStores401 = BetaErrorResponse +export type BetaListMemoryStores403 = BetaErrorResponse +export const BetaListMemoryStores403 = BetaErrorResponse +export type BetaListMemoryStores404 = BetaErrorResponse +export const BetaListMemoryStores404 = BetaErrorResponse +export type BetaListMemoryStores408 = BetaErrorResponse +export const BetaListMemoryStores408 = BetaErrorResponse +export type BetaListMemoryStores409 = BetaErrorResponse +export const BetaListMemoryStores409 = BetaErrorResponse +export type BetaListMemoryStores412 = BetaErrorResponse +export const BetaListMemoryStores412 = BetaErrorResponse +export type BetaListMemoryStores413 = BetaErrorResponse +export const BetaListMemoryStores413 = BetaErrorResponse +export type BetaListMemoryStores429 = BetaErrorResponse +export const BetaListMemoryStores429 = BetaErrorResponse +export type BetaListMemoryStores431 = BetaErrorResponse +export const BetaListMemoryStores431 = BetaErrorResponse +export type BetaListMemoryStores499 = BetaErrorResponse +export const BetaListMemoryStores499 = BetaErrorResponse +export type BetaListMemoryStores500 = BetaErrorResponse +export const BetaListMemoryStores500 = BetaErrorResponse +export type BetaListMemoryStores501 = BetaErrorResponse +export const BetaListMemoryStores501 = BetaErrorResponse +export type BetaListMemoryStores503 = BetaErrorResponse +export const BetaListMemoryStores503 = BetaErrorResponse +export type BetaListMemoryStores504 = BetaErrorResponse +export const BetaListMemoryStores504 = BetaErrorResponse +export type BetaCreateMemoryStoreParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string } +export const BetaCreateMemoryStoreParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaCreateMemoryStoreRequestJson = BetaManagedAgentsCreateMemoryStoreRequest +export const BetaCreateMemoryStoreRequestJson = BetaManagedAgentsCreateMemoryStoreRequest +export type BetaCreateMemoryStore200 = BetaManagedAgentsCreateMemoryStoreResponse +export const BetaCreateMemoryStore200 = BetaManagedAgentsCreateMemoryStoreResponse +export type BetaCreateMemoryStore400 = BetaErrorResponse +export const BetaCreateMemoryStore400 = BetaErrorResponse +export type BetaCreateMemoryStore401 = BetaErrorResponse +export const BetaCreateMemoryStore401 = BetaErrorResponse +export type BetaCreateMemoryStore403 = BetaErrorResponse +export const BetaCreateMemoryStore403 = BetaErrorResponse +export type BetaCreateMemoryStore404 = BetaErrorResponse +export const BetaCreateMemoryStore404 = BetaErrorResponse +export type BetaCreateMemoryStore408 = BetaErrorResponse +export const BetaCreateMemoryStore408 = BetaErrorResponse +export type BetaCreateMemoryStore409 = BetaErrorResponse +export const BetaCreateMemoryStore409 = BetaErrorResponse +export type BetaCreateMemoryStore412 = BetaErrorResponse +export const BetaCreateMemoryStore412 = BetaErrorResponse +export type BetaCreateMemoryStore413 = BetaErrorResponse +export const BetaCreateMemoryStore413 = BetaErrorResponse +export type BetaCreateMemoryStore429 = BetaErrorResponse +export const BetaCreateMemoryStore429 = BetaErrorResponse +export type BetaCreateMemoryStore431 = BetaErrorResponse +export const BetaCreateMemoryStore431 = BetaErrorResponse +export type BetaCreateMemoryStore499 = BetaErrorResponse +export const BetaCreateMemoryStore499 = BetaErrorResponse +export type BetaCreateMemoryStore500 = BetaErrorResponse +export const BetaCreateMemoryStore500 = BetaErrorResponse +export type BetaCreateMemoryStore501 = BetaErrorResponse +export const BetaCreateMemoryStore501 = BetaErrorResponse +export type BetaCreateMemoryStore503 = BetaErrorResponse +export const BetaCreateMemoryStore503 = BetaErrorResponse +export type BetaCreateMemoryStore504 = BetaErrorResponse +export const BetaCreateMemoryStore504 = BetaErrorResponse +export type BetaGetMemoryStoreParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string +} +export const BetaGetMemoryStoreParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaGetMemoryStore200 = BetaManagedAgentsGetMemoryStoreResponse +export const BetaGetMemoryStore200 = BetaManagedAgentsGetMemoryStoreResponse +export type BetaGetMemoryStore400 = BetaErrorResponse +export const BetaGetMemoryStore400 = BetaErrorResponse +export type BetaGetMemoryStore401 = BetaErrorResponse +export const BetaGetMemoryStore401 = BetaErrorResponse +export type BetaGetMemoryStore403 = BetaErrorResponse +export const BetaGetMemoryStore403 = BetaErrorResponse +export type BetaGetMemoryStore404 = BetaErrorResponse +export const BetaGetMemoryStore404 = BetaErrorResponse +export type BetaGetMemoryStore408 = BetaErrorResponse +export const BetaGetMemoryStore408 = BetaErrorResponse +export type BetaGetMemoryStore409 = BetaErrorResponse +export const BetaGetMemoryStore409 = BetaErrorResponse +export type BetaGetMemoryStore412 = BetaErrorResponse +export const BetaGetMemoryStore412 = BetaErrorResponse +export type BetaGetMemoryStore413 = BetaErrorResponse +export const BetaGetMemoryStore413 = BetaErrorResponse +export type BetaGetMemoryStore429 = BetaErrorResponse +export const BetaGetMemoryStore429 = BetaErrorResponse +export type BetaGetMemoryStore431 = BetaErrorResponse +export const BetaGetMemoryStore431 = BetaErrorResponse +export type BetaGetMemoryStore499 = BetaErrorResponse +export const BetaGetMemoryStore499 = BetaErrorResponse +export type BetaGetMemoryStore500 = BetaErrorResponse +export const BetaGetMemoryStore500 = BetaErrorResponse +export type BetaGetMemoryStore501 = BetaErrorResponse +export const BetaGetMemoryStore501 = BetaErrorResponse +export type BetaGetMemoryStore503 = BetaErrorResponse +export const BetaGetMemoryStore503 = BetaErrorResponse +export type BetaGetMemoryStore504 = BetaErrorResponse +export const BetaGetMemoryStore504 = BetaErrorResponse +export type BetaUpdateMemoryStoreParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string } +export const BetaUpdateMemoryStoreParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaUpdateMemoryStoreRequestJson = BetaManagedAgentsUpdateMemoryStoreRequestBody +export const BetaUpdateMemoryStoreRequestJson = BetaManagedAgentsUpdateMemoryStoreRequestBody +export type BetaUpdateMemoryStore200 = BetaManagedAgentsUpdateMemoryStoreResponse +export const BetaUpdateMemoryStore200 = BetaManagedAgentsUpdateMemoryStoreResponse +export type BetaUpdateMemoryStore400 = BetaErrorResponse +export const BetaUpdateMemoryStore400 = BetaErrorResponse +export type BetaUpdateMemoryStore401 = BetaErrorResponse +export const BetaUpdateMemoryStore401 = BetaErrorResponse +export type BetaUpdateMemoryStore403 = BetaErrorResponse +export const BetaUpdateMemoryStore403 = BetaErrorResponse +export type BetaUpdateMemoryStore404 = BetaErrorResponse +export const BetaUpdateMemoryStore404 = BetaErrorResponse +export type BetaUpdateMemoryStore408 = BetaErrorResponse +export const BetaUpdateMemoryStore408 = BetaErrorResponse +export type BetaUpdateMemoryStore409 = BetaErrorResponse +export const BetaUpdateMemoryStore409 = BetaErrorResponse +export type BetaUpdateMemoryStore412 = BetaErrorResponse +export const BetaUpdateMemoryStore412 = BetaErrorResponse +export type BetaUpdateMemoryStore413 = BetaErrorResponse +export const BetaUpdateMemoryStore413 = BetaErrorResponse +export type BetaUpdateMemoryStore429 = BetaErrorResponse +export const BetaUpdateMemoryStore429 = BetaErrorResponse +export type BetaUpdateMemoryStore431 = BetaErrorResponse +export const BetaUpdateMemoryStore431 = BetaErrorResponse +export type BetaUpdateMemoryStore499 = BetaErrorResponse +export const BetaUpdateMemoryStore499 = BetaErrorResponse +export type BetaUpdateMemoryStore500 = BetaErrorResponse +export const BetaUpdateMemoryStore500 = BetaErrorResponse +export type BetaUpdateMemoryStore501 = BetaErrorResponse +export const BetaUpdateMemoryStore501 = BetaErrorResponse +export type BetaUpdateMemoryStore503 = BetaErrorResponse +export const BetaUpdateMemoryStore503 = BetaErrorResponse +export type BetaUpdateMemoryStore504 = BetaErrorResponse +export const BetaUpdateMemoryStore504 = BetaErrorResponse +export type BetaDeleteMemoryStoreParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string +} +export const BetaDeleteMemoryStoreParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaDeleteMemoryStore200 = BetaManagedAgentsDeleteMemoryStoreResponse +export const BetaDeleteMemoryStore200 = BetaManagedAgentsDeleteMemoryStoreResponse +export type BetaDeleteMemoryStore400 = BetaErrorResponse +export const BetaDeleteMemoryStore400 = BetaErrorResponse +export type BetaDeleteMemoryStore401 = BetaErrorResponse +export const BetaDeleteMemoryStore401 = BetaErrorResponse +export type BetaDeleteMemoryStore403 = BetaErrorResponse +export const BetaDeleteMemoryStore403 = BetaErrorResponse +export type BetaDeleteMemoryStore404 = BetaErrorResponse +export const BetaDeleteMemoryStore404 = BetaErrorResponse +export type BetaDeleteMemoryStore408 = BetaErrorResponse +export const BetaDeleteMemoryStore408 = BetaErrorResponse +export type BetaDeleteMemoryStore409 = BetaErrorResponse +export const BetaDeleteMemoryStore409 = BetaErrorResponse +export type BetaDeleteMemoryStore412 = BetaErrorResponse +export const BetaDeleteMemoryStore412 = BetaErrorResponse +export type BetaDeleteMemoryStore413 = BetaErrorResponse +export const BetaDeleteMemoryStore413 = BetaErrorResponse +export type BetaDeleteMemoryStore429 = BetaErrorResponse +export const BetaDeleteMemoryStore429 = BetaErrorResponse +export type BetaDeleteMemoryStore431 = BetaErrorResponse +export const BetaDeleteMemoryStore431 = BetaErrorResponse +export type BetaDeleteMemoryStore499 = BetaErrorResponse +export const BetaDeleteMemoryStore499 = BetaErrorResponse +export type BetaDeleteMemoryStore500 = BetaErrorResponse +export const BetaDeleteMemoryStore500 = BetaErrorResponse +export type BetaDeleteMemoryStore501 = BetaErrorResponse +export const BetaDeleteMemoryStore501 = BetaErrorResponse +export type BetaDeleteMemoryStore503 = BetaErrorResponse +export const BetaDeleteMemoryStore503 = BetaErrorResponse +export type BetaDeleteMemoryStore504 = BetaErrorResponse +export const BetaDeleteMemoryStore504 = BetaErrorResponse +export type BetaArchiveMemoryStoreParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string } +export const BetaArchiveMemoryStoreParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaArchiveMemoryStore200 = BetaManagedAgentsArchiveMemoryStoreResponse +export const BetaArchiveMemoryStore200 = BetaManagedAgentsArchiveMemoryStoreResponse +export type BetaArchiveMemoryStore400 = BetaErrorResponse +export const BetaArchiveMemoryStore400 = BetaErrorResponse +export type BetaArchiveMemoryStore401 = BetaErrorResponse +export const BetaArchiveMemoryStore401 = BetaErrorResponse +export type BetaArchiveMemoryStore403 = BetaErrorResponse +export const BetaArchiveMemoryStore403 = BetaErrorResponse +export type BetaArchiveMemoryStore404 = BetaErrorResponse +export const BetaArchiveMemoryStore404 = BetaErrorResponse +export type BetaArchiveMemoryStore408 = BetaErrorResponse +export const BetaArchiveMemoryStore408 = BetaErrorResponse +export type BetaArchiveMemoryStore409 = BetaErrorResponse +export const BetaArchiveMemoryStore409 = BetaErrorResponse +export type BetaArchiveMemoryStore412 = BetaErrorResponse +export const BetaArchiveMemoryStore412 = BetaErrorResponse +export type BetaArchiveMemoryStore413 = BetaErrorResponse +export const BetaArchiveMemoryStore413 = BetaErrorResponse +export type BetaArchiveMemoryStore429 = BetaErrorResponse +export const BetaArchiveMemoryStore429 = BetaErrorResponse +export type BetaArchiveMemoryStore431 = BetaErrorResponse +export const BetaArchiveMemoryStore431 = BetaErrorResponse +export type BetaArchiveMemoryStore499 = BetaErrorResponse +export const BetaArchiveMemoryStore499 = BetaErrorResponse +export type BetaArchiveMemoryStore500 = BetaErrorResponse +export const BetaArchiveMemoryStore500 = BetaErrorResponse +export type BetaArchiveMemoryStore501 = BetaErrorResponse +export const BetaArchiveMemoryStore501 = BetaErrorResponse +export type BetaArchiveMemoryStore503 = BetaErrorResponse +export const BetaArchiveMemoryStore503 = BetaErrorResponse +export type BetaArchiveMemoryStore504 = BetaErrorResponse +export const BetaArchiveMemoryStore504 = BetaErrorResponse +export type BetaListUserProfilesParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string + readonly "limit"?: number + readonly "page"?: string + readonly "order"?: BetaUserProfileListOrder +} +export const BetaListUserProfilesParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String), + "limit": Schema.optionalKey(Schema.Number.annotate({ "format": "int32" }).check(Schema.isInt())), + "page": Schema.optionalKey(Schema.String), + "order": Schema.optionalKey(BetaUserProfileListOrder) +}) +export type BetaListUserProfiles200 = BetaListUserProfilesResponse +export const BetaListUserProfiles200 = BetaListUserProfilesResponse +export type BetaListUserProfiles400 = BetaErrorResponse +export const BetaListUserProfiles400 = BetaErrorResponse +export type BetaListUserProfiles401 = BetaErrorResponse +export const BetaListUserProfiles401 = BetaErrorResponse +export type BetaListUserProfiles403 = BetaErrorResponse +export const BetaListUserProfiles403 = BetaErrorResponse +export type BetaListUserProfiles404 = BetaErrorResponse +export const BetaListUserProfiles404 = BetaErrorResponse +export type BetaListUserProfiles408 = BetaErrorResponse +export const BetaListUserProfiles408 = BetaErrorResponse +export type BetaListUserProfiles409 = BetaErrorResponse +export const BetaListUserProfiles409 = BetaErrorResponse +export type BetaListUserProfiles412 = BetaErrorResponse +export const BetaListUserProfiles412 = BetaErrorResponse +export type BetaListUserProfiles413 = BetaErrorResponse +export const BetaListUserProfiles413 = BetaErrorResponse +export type BetaListUserProfiles429 = BetaErrorResponse +export const BetaListUserProfiles429 = BetaErrorResponse +export type BetaListUserProfiles431 = BetaErrorResponse +export const BetaListUserProfiles431 = BetaErrorResponse +export type BetaListUserProfiles499 = BetaErrorResponse +export const BetaListUserProfiles499 = BetaErrorResponse +export type BetaListUserProfiles500 = BetaErrorResponse +export const BetaListUserProfiles500 = BetaErrorResponse +export type BetaListUserProfiles501 = BetaErrorResponse +export const BetaListUserProfiles501 = BetaErrorResponse +export type BetaListUserProfiles503 = BetaErrorResponse +export const BetaListUserProfiles503 = BetaErrorResponse +export type BetaListUserProfiles504 = BetaErrorResponse +export const BetaListUserProfiles504 = BetaErrorResponse +export type BetaCreateUserProfileParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string } +export const BetaCreateUserProfileParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaCreateUserProfileRequestJson = BetaCreateUserProfileRequest +export const BetaCreateUserProfileRequestJson = BetaCreateUserProfileRequest +export type BetaCreateUserProfile200 = BetaUserProfile +export const BetaCreateUserProfile200 = BetaUserProfile +export type BetaCreateUserProfile400 = BetaErrorResponse +export const BetaCreateUserProfile400 = BetaErrorResponse +export type BetaCreateUserProfile401 = BetaErrorResponse +export const BetaCreateUserProfile401 = BetaErrorResponse +export type BetaCreateUserProfile403 = BetaErrorResponse +export const BetaCreateUserProfile403 = BetaErrorResponse +export type BetaCreateUserProfile404 = BetaErrorResponse +export const BetaCreateUserProfile404 = BetaErrorResponse +export type BetaCreateUserProfile408 = BetaErrorResponse +export const BetaCreateUserProfile408 = BetaErrorResponse +export type BetaCreateUserProfile409 = BetaErrorResponse +export const BetaCreateUserProfile409 = BetaErrorResponse +export type BetaCreateUserProfile412 = BetaErrorResponse +export const BetaCreateUserProfile412 = BetaErrorResponse +export type BetaCreateUserProfile413 = BetaErrorResponse +export const BetaCreateUserProfile413 = BetaErrorResponse +export type BetaCreateUserProfile429 = BetaErrorResponse +export const BetaCreateUserProfile429 = BetaErrorResponse +export type BetaCreateUserProfile431 = BetaErrorResponse +export const BetaCreateUserProfile431 = BetaErrorResponse +export type BetaCreateUserProfile499 = BetaErrorResponse +export const BetaCreateUserProfile499 = BetaErrorResponse +export type BetaCreateUserProfile500 = BetaErrorResponse +export const BetaCreateUserProfile500 = BetaErrorResponse +export type BetaCreateUserProfile501 = BetaErrorResponse +export const BetaCreateUserProfile501 = BetaErrorResponse +export type BetaCreateUserProfile503 = BetaErrorResponse +export const BetaCreateUserProfile503 = BetaErrorResponse +export type BetaCreateUserProfile504 = BetaErrorResponse +export const BetaCreateUserProfile504 = BetaErrorResponse +export type BetaGetUserProfileParams = { + readonly "x-api-key"?: string + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string +} +export const BetaGetUserProfileParams = Schema.Struct({ + "x-api-key": Schema.optionalKey(Schema.String), + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaGetUserProfile200 = BetaUserProfile +export const BetaGetUserProfile200 = BetaUserProfile +export type BetaGetUserProfile400 = BetaErrorResponse +export const BetaGetUserProfile400 = BetaErrorResponse +export type BetaGetUserProfile401 = BetaErrorResponse +export const BetaGetUserProfile401 = BetaErrorResponse +export type BetaGetUserProfile403 = BetaErrorResponse +export const BetaGetUserProfile403 = BetaErrorResponse +export type BetaGetUserProfile404 = BetaErrorResponse +export const BetaGetUserProfile404 = BetaErrorResponse +export type BetaGetUserProfile408 = BetaErrorResponse +export const BetaGetUserProfile408 = BetaErrorResponse +export type BetaGetUserProfile409 = BetaErrorResponse +export const BetaGetUserProfile409 = BetaErrorResponse +export type BetaGetUserProfile412 = BetaErrorResponse +export const BetaGetUserProfile412 = BetaErrorResponse +export type BetaGetUserProfile413 = BetaErrorResponse +export const BetaGetUserProfile413 = BetaErrorResponse +export type BetaGetUserProfile429 = BetaErrorResponse +export const BetaGetUserProfile429 = BetaErrorResponse +export type BetaGetUserProfile431 = BetaErrorResponse +export const BetaGetUserProfile431 = BetaErrorResponse +export type BetaGetUserProfile499 = BetaErrorResponse +export const BetaGetUserProfile499 = BetaErrorResponse +export type BetaGetUserProfile500 = BetaErrorResponse +export const BetaGetUserProfile500 = BetaErrorResponse +export type BetaGetUserProfile501 = BetaErrorResponse +export const BetaGetUserProfile501 = BetaErrorResponse +export type BetaGetUserProfile503 = BetaErrorResponse +export const BetaGetUserProfile503 = BetaErrorResponse +export type BetaGetUserProfile504 = BetaErrorResponse +export const BetaGetUserProfile504 = BetaErrorResponse +export type BetaUpdateUserProfileParams = { readonly "anthropic-version"?: string; readonly "anthropic-beta"?: string } +export const BetaUpdateUserProfileParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaUpdateUserProfileRequestJson = BetaUpdateUserProfileRequestBody +export const BetaUpdateUserProfileRequestJson = BetaUpdateUserProfileRequestBody +export type BetaUpdateUserProfile200 = BetaUserProfile +export const BetaUpdateUserProfile200 = BetaUserProfile +export type BetaUpdateUserProfile400 = BetaErrorResponse +export const BetaUpdateUserProfile400 = BetaErrorResponse +export type BetaUpdateUserProfile401 = BetaErrorResponse +export const BetaUpdateUserProfile401 = BetaErrorResponse +export type BetaUpdateUserProfile403 = BetaErrorResponse +export const BetaUpdateUserProfile403 = BetaErrorResponse +export type BetaUpdateUserProfile404 = BetaErrorResponse +export const BetaUpdateUserProfile404 = BetaErrorResponse +export type BetaUpdateUserProfile408 = BetaErrorResponse +export const BetaUpdateUserProfile408 = BetaErrorResponse +export type BetaUpdateUserProfile409 = BetaErrorResponse +export const BetaUpdateUserProfile409 = BetaErrorResponse +export type BetaUpdateUserProfile412 = BetaErrorResponse +export const BetaUpdateUserProfile412 = BetaErrorResponse +export type BetaUpdateUserProfile413 = BetaErrorResponse +export const BetaUpdateUserProfile413 = BetaErrorResponse +export type BetaUpdateUserProfile429 = BetaErrorResponse +export const BetaUpdateUserProfile429 = BetaErrorResponse +export type BetaUpdateUserProfile431 = BetaErrorResponse +export const BetaUpdateUserProfile431 = BetaErrorResponse +export type BetaUpdateUserProfile499 = BetaErrorResponse +export const BetaUpdateUserProfile499 = BetaErrorResponse +export type BetaUpdateUserProfile500 = BetaErrorResponse +export const BetaUpdateUserProfile500 = BetaErrorResponse +export type BetaUpdateUserProfile501 = BetaErrorResponse +export const BetaUpdateUserProfile501 = BetaErrorResponse +export type BetaUpdateUserProfile503 = BetaErrorResponse +export const BetaUpdateUserProfile503 = BetaErrorResponse +export type BetaUpdateUserProfile504 = BetaErrorResponse +export const BetaUpdateUserProfile504 = BetaErrorResponse +export type BetaCreateEnrollmentUrlParams = { + readonly "anthropic-version"?: string + readonly "anthropic-beta"?: string +} +export const BetaCreateEnrollmentUrlParams = Schema.Struct({ + "anthropic-version": Schema.optionalKey(Schema.String), + "anthropic-beta": Schema.optionalKey(Schema.String) +}) +export type BetaCreateEnrollmentUrl200 = BetaEnrollmentUrl +export const BetaCreateEnrollmentUrl200 = BetaEnrollmentUrl +export type BetaCreateEnrollmentUrl400 = BetaErrorResponse +export const BetaCreateEnrollmentUrl400 = BetaErrorResponse +export type BetaCreateEnrollmentUrl401 = BetaErrorResponse +export const BetaCreateEnrollmentUrl401 = BetaErrorResponse +export type BetaCreateEnrollmentUrl403 = BetaErrorResponse +export const BetaCreateEnrollmentUrl403 = BetaErrorResponse +export type BetaCreateEnrollmentUrl404 = BetaErrorResponse +export const BetaCreateEnrollmentUrl404 = BetaErrorResponse +export type BetaCreateEnrollmentUrl408 = BetaErrorResponse +export const BetaCreateEnrollmentUrl408 = BetaErrorResponse +export type BetaCreateEnrollmentUrl409 = BetaErrorResponse +export const BetaCreateEnrollmentUrl409 = BetaErrorResponse +export type BetaCreateEnrollmentUrl412 = BetaErrorResponse +export const BetaCreateEnrollmentUrl412 = BetaErrorResponse +export type BetaCreateEnrollmentUrl413 = BetaErrorResponse +export const BetaCreateEnrollmentUrl413 = BetaErrorResponse +export type BetaCreateEnrollmentUrl429 = BetaErrorResponse +export const BetaCreateEnrollmentUrl429 = BetaErrorResponse +export type BetaCreateEnrollmentUrl431 = BetaErrorResponse +export const BetaCreateEnrollmentUrl431 = BetaErrorResponse +export type BetaCreateEnrollmentUrl499 = BetaErrorResponse +export const BetaCreateEnrollmentUrl499 = BetaErrorResponse +export type BetaCreateEnrollmentUrl500 = BetaErrorResponse +export const BetaCreateEnrollmentUrl500 = BetaErrorResponse +export type BetaCreateEnrollmentUrl501 = BetaErrorResponse +export const BetaCreateEnrollmentUrl501 = BetaErrorResponse +export type BetaCreateEnrollmentUrl503 = BetaErrorResponse +export const BetaCreateEnrollmentUrl503 = BetaErrorResponse +export type BetaCreateEnrollmentUrl504 = BetaErrorResponse +export const BetaCreateEnrollmentUrl504 = BetaErrorResponse + +export interface OperationConfig { + /** + * Whether or not the response should be included in the value returned from + * an operation. + * + * If set to `true`, a tuple of `[A, HttpClientResponse]` will be returned, + * where `A` is the success type of the operation. + * + * If set to `false`, only the success type of the operation will be returned. + */ + readonly includeResponse?: boolean | undefined +} + +/** + * A utility type which optionally includes the response in the return result + * of an operation based upon the value of the `includeResponse` configuration + * option. + */ +export type WithOptionalResponse = Config extends { + readonly includeResponse: true +} ? [A, HttpClientResponse.HttpClientResponse] : + A + +export const make = ( + httpClient: HttpClient.HttpClient, + options: { + readonly transformClient?: ((client: HttpClient.HttpClient) => Effect.Effect) | undefined + } = {} +): AnthropicClient => { + const unexpectedStatus = (response: HttpClientResponse.HttpClientResponse) => + Effect.flatMap( + Effect.orElseSucceed(response.json, () => "Unexpected status code"), + (description) => + Effect.fail( + new HttpClientError.HttpClientError({ + reason: new HttpClientError.StatusCodeError({ + request: response.request, + response, + description: typeof description === "string" ? description : JSON.stringify(description) + }) + }) + ) + ) + const withResponse = (config: Config | undefined) => + ( + f: (response: HttpClientResponse.HttpClientResponse) => Effect.Effect + ): (request: HttpClientRequest.HttpClientRequest) => Effect.Effect => { + const withOptionalResponse = ( + config?.includeResponse + ? (response: HttpClientResponse.HttpClientResponse) => Effect.map(f(response), (a) => [a, response]) + : (response: HttpClientResponse.HttpClientResponse) => f(response) + ) as any + return options?.transformClient + ? (request) => + Effect.flatMap( + Effect.flatMap(options.transformClient!(httpClient), (client) => client.execute(request)), + withOptionalResponse + ) + : (request) => Effect.flatMap(httpClient.execute(request), withOptionalResponse) + } + const binaryRequest = ( + request: HttpClientRequest.HttpClientRequest + ): Stream.Stream => + HttpClient.filterStatusOk(httpClient).execute(request).pipe( + Effect.map((response) => response.stream), + Stream.unwrap + ) + const decodeSuccess = + (schema: Schema) => (response: HttpClientResponse.HttpClientResponse) => + HttpClientResponse.schemaBodyJson(schema)(response) + const decodeError = + (tag: Tag, schema: Schema) => + (response: HttpClientResponse.HttpClientResponse) => + Effect.flatMap( + HttpClientResponse.schemaBodyJson(schema)(response), + (cause) => Effect.fail(AnthropicClientError(tag, cause, response)) + ) + return { + httpClient, + "messagesPost": (options) => + HttpClientRequest.post(`/v1/messages`).pipe( + HttpClientRequest.setHeaders({ "anthropic-version": options.params?.["anthropic-version"] ?? undefined }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(MessagesPost200), + "4xx": decodeError("MessagesPost4XX", MessagesPost4XX), + orElse: unexpectedStatus + })) + ), + "completePost": (options) => + HttpClientRequest.post(`/v1/complete`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-version": options.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(CompletePost200), + "4xx": decodeError("CompletePost4XX", CompletePost4XX), + orElse: unexpectedStatus + })) + ), + "modelsList": (options) => + HttpClientRequest.get(`/v1/models`).pipe( + HttpClientRequest.setUrlParams({ + "before_id": options?.params?.["before_id"] as any, + "after_id": options?.params?.["after_id"] as any, + "limit": options?.params?.["limit"] as any + }), + HttpClientRequest.setHeaders({ + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined, + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(ModelsList200), + "4xx": decodeError("ModelsList4XX", ModelsList4XX), + orElse: unexpectedStatus + })) + ), + "modelsGet": (modelId, options) => + HttpClientRequest.get(`/v1/models/${modelId}`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined, + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(ModelsGet200), + "4xx": decodeError("ModelsGet4XX", ModelsGet4XX), + orElse: unexpectedStatus + })) + ), + "messageBatchesList": (options) => + HttpClientRequest.get(`/v1/messages/batches`).pipe( + HttpClientRequest.setUrlParams({ + "before_id": options?.params?.["before_id"] as any, + "after_id": options?.params?.["after_id"] as any, + "limit": options?.params?.["limit"] as any + }), + HttpClientRequest.setHeaders({ + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(MessageBatchesList200), + "4xx": decodeError("MessageBatchesList4XX", MessageBatchesList4XX), + orElse: unexpectedStatus + })) + ), + "messageBatchesPost": (options) => + HttpClientRequest.post(`/v1/messages/batches`).pipe( + HttpClientRequest.setHeaders({ "anthropic-version": options.params?.["anthropic-version"] ?? undefined }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(MessageBatchesPost200), + "4xx": decodeError("MessageBatchesPost4XX", MessageBatchesPost4XX), + orElse: unexpectedStatus + })) + ), + "messageBatchesRetrieve": (messageBatchId, options) => + HttpClientRequest.get(`/v1/messages/batches/${messageBatchId}`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(MessageBatchesRetrieve200), + "4xx": decodeError("MessageBatchesRetrieve4XX", MessageBatchesRetrieve4XX), + orElse: unexpectedStatus + })) + ), + "messageBatchesDelete": (messageBatchId, options) => + HttpClientRequest.delete(`/v1/messages/batches/${messageBatchId}`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(MessageBatchesDelete200), + "4xx": decodeError("MessageBatchesDelete4XX", MessageBatchesDelete4XX), + orElse: unexpectedStatus + })) + ), + "messageBatchesCancel": (messageBatchId, options) => + HttpClientRequest.post(`/v1/messages/batches/${messageBatchId}/cancel`).pipe( + HttpClientRequest.setHeaders({ "anthropic-version": options?.params?.["anthropic-version"] ?? undefined }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(MessageBatchesCancel200), + "4xx": decodeError("MessageBatchesCancel4XX", MessageBatchesCancel4XX), + orElse: unexpectedStatus + })) + ), + "messageBatchesResults": (messageBatchId, options) => + HttpClientRequest.get(`/v1/messages/batches/${messageBatchId}/results`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "4xx": decodeError("MessageBatchesResults4XX", MessageBatchesResults4XX), + orElse: unexpectedStatus + })) + ), + "messagesCountTokensPost": (options) => + HttpClientRequest.post(`/v1/messages/count_tokens`).pipe( + HttpClientRequest.setHeaders({ "anthropic-version": options.params?.["anthropic-version"] ?? undefined }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(MessagesCountTokensPost200), + "4xx": decodeError("MessagesCountTokensPost4XX", MessagesCountTokensPost4XX), + orElse: unexpectedStatus + })) + ), + "betaMessagesPost": (options) => + HttpClientRequest.post(`/v1/messages?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options.params?.["anthropic-version"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaMessagesPost200), + "4xx": decodeError("BetaMessagesPost4XX", BetaMessagesPost4XX), + orElse: unexpectedStatus + })) + ), + "betaModelsList": (options) => + HttpClientRequest.get(`/v1/models?beta=true`).pipe( + HttpClientRequest.setUrlParams({ + "before_id": options?.params?.["before_id"] as any, + "after_id": options?.params?.["after_id"] as any, + "limit": options?.params?.["limit"] as any + }), + HttpClientRequest.setHeaders({ + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined, + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaModelsList200), + "4xx": decodeError("BetaModelsList4XX", BetaModelsList4XX), + orElse: unexpectedStatus + })) + ), + "betaModelsGet": (modelId, options) => + HttpClientRequest.get(`/v1/models/${modelId}?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined, + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaModelsGet200), + "4xx": decodeError("BetaModelsGet4XX", BetaModelsGet4XX), + orElse: unexpectedStatus + })) + ), + "betaMessageBatchesList": (options) => + HttpClientRequest.get(`/v1/messages/batches?beta=true`).pipe( + HttpClientRequest.setUrlParams({ + "before_id": options?.params?.["before_id"] as any, + "after_id": options?.params?.["after_id"] as any, + "limit": options?.params?.["limit"] as any + }), + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaMessageBatchesList200), + "4xx": decodeError("BetaMessageBatchesList4XX", BetaMessageBatchesList4XX), + orElse: unexpectedStatus + })) + ), + "betaMessageBatchesPost": (options) => + HttpClientRequest.post(`/v1/messages/batches?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options.params?.["anthropic-version"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaMessageBatchesPost200), + "4xx": decodeError("BetaMessageBatchesPost4XX", BetaMessageBatchesPost4XX), + orElse: unexpectedStatus + })) + ), + "betaMessageBatchesRetrieve": (messageBatchId, options) => + HttpClientRequest.get(`/v1/messages/batches/${messageBatchId}?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaMessageBatchesRetrieve200), + "4xx": decodeError("BetaMessageBatchesRetrieve4XX", BetaMessageBatchesRetrieve4XX), + orElse: unexpectedStatus + })) + ), + "betaMessageBatchesDelete": (messageBatchId, options) => + HttpClientRequest.delete(`/v1/messages/batches/${messageBatchId}?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaMessageBatchesDelete200), + "4xx": decodeError("BetaMessageBatchesDelete4XX", BetaMessageBatchesDelete4XX), + orElse: unexpectedStatus + })) + ), + "betaMessageBatchesCancel": (messageBatchId, options) => + HttpClientRequest.post(`/v1/messages/batches/${messageBatchId}/cancel?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaMessageBatchesCancel200), + "4xx": decodeError("BetaMessageBatchesCancel4XX", BetaMessageBatchesCancel4XX), + orElse: unexpectedStatus + })) + ), + "betaMessageBatchesResults": (messageBatchId, options) => + HttpClientRequest.get(`/v1/messages/batches/${messageBatchId}/results?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "4xx": decodeError("BetaMessageBatchesResults4XX", BetaMessageBatchesResults4XX), + orElse: unexpectedStatus + })) + ), + "betaMessagesCountTokensPost": (options) => + HttpClientRequest.post(`/v1/messages/count_tokens?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options.params?.["anthropic-version"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaMessagesCountTokensPost200), + "4xx": decodeError("BetaMessagesCountTokensPost4XX", BetaMessagesCountTokensPost4XX), + orElse: unexpectedStatus + })) + ), + "betaListFilesV1FilesGet": (options) => + HttpClientRequest.get(`/v1/files?beta=true`).pipe( + HttpClientRequest.setUrlParams({ + "before_id": options?.params?.["before_id"] as any, + "after_id": options?.params?.["after_id"] as any, + "limit": options?.params?.["limit"] as any, + "scope_id": options?.params?.["scope_id"] as any + }), + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaListFilesV1FilesGet200), + "4xx": decodeError("BetaListFilesV1FilesGet4XX", BetaListFilesV1FilesGet4XX), + orElse: unexpectedStatus + })) + ), + "betaUploadFileV1FilesPost": (options) => + HttpClientRequest.post(`/v1/files?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options.params?.["anthropic-version"] ?? undefined + }), + HttpClientRequest.bodyFormData(options.payload as any), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaUploadFileV1FilesPost200), + "4xx": decodeError("BetaUploadFileV1FilesPost4XX", BetaUploadFileV1FilesPost4XX), + orElse: unexpectedStatus + })) + ), + "betaGetFileMetadataV1FilesFileIdGet": (fileId, options) => + HttpClientRequest.get(`/v1/files/${fileId}?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaGetFileMetadataV1FilesFileIdGet200), + "4xx": decodeError("BetaGetFileMetadataV1FilesFileIdGet4XX", BetaGetFileMetadataV1FilesFileIdGet4XX), + orElse: unexpectedStatus + })) + ), + "betaDeleteFileV1FilesFileIdDelete": (fileId, options) => + HttpClientRequest.delete(`/v1/files/${fileId}?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaDeleteFileV1FilesFileIdDelete200), + "4xx": decodeError("BetaDeleteFileV1FilesFileIdDelete4XX", BetaDeleteFileV1FilesFileIdDelete4XX), + orElse: unexpectedStatus + })) + ), + "betaDownloadFileV1FilesFileIdContentGet": (fileId, options) => + HttpClientRequest.get(`/v1/files/${fileId}/content?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + orElse: unexpectedStatus + })) + ), + "betaDownloadFileV1FilesFileIdContentGetStream": (fileId, options) => + HttpClientRequest.get(`/v1/files/${fileId}/content?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + binaryRequest + ), + "betaListSkillsV1SkillsGet": (options) => + HttpClientRequest.get(`/v1/skills?beta=true`).pipe( + HttpClientRequest.setUrlParams({ + "page": options?.params?.["page"] as any, + "limit": options?.params?.["limit"] as any, + "source": options?.params?.["source"] as any + }), + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaListSkillsV1SkillsGet200), + "4xx": decodeError("BetaListSkillsV1SkillsGet4XX", BetaListSkillsV1SkillsGet4XX), + orElse: unexpectedStatus + })) + ), + "betaCreateSkillV1SkillsPost": (options) => + HttpClientRequest.post(`/v1/skills?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options.params?.["anthropic-version"] ?? undefined + }), + HttpClientRequest.bodyFormData(options.payload as any), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaCreateSkillV1SkillsPost200), + "4xx": decodeError("BetaCreateSkillV1SkillsPost4XX", BetaCreateSkillV1SkillsPost4XX), + orElse: unexpectedStatus + })) + ), + "betaGetSkillV1SkillsSkillIdGet": (skillId, options) => + HttpClientRequest.get(`/v1/skills/${skillId}?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaGetSkillV1SkillsSkillIdGet200), + "4xx": decodeError("BetaGetSkillV1SkillsSkillIdGet4XX", BetaGetSkillV1SkillsSkillIdGet4XX), + orElse: unexpectedStatus + })) + ), + "betaDeleteSkillV1SkillsSkillIdDelete": (skillId, options) => + HttpClientRequest.delete(`/v1/skills/${skillId}?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaDeleteSkillV1SkillsSkillIdDelete200), + "4xx": decodeError("BetaDeleteSkillV1SkillsSkillIdDelete4XX", BetaDeleteSkillV1SkillsSkillIdDelete4XX), + orElse: unexpectedStatus + })) + ), + "betaListSkillVersionsV1SkillsSkillIdVersionsGet": (skillId, options) => + HttpClientRequest.get(`/v1/skills/${skillId}/versions?beta=true`).pipe( + HttpClientRequest.setUrlParams({ + "page": options?.params?.["page"] as any, + "limit": options?.params?.["limit"] as any + }), + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaListSkillVersionsV1SkillsSkillIdVersionsGet200), + "4xx": decodeError( + "BetaListSkillVersionsV1SkillsSkillIdVersionsGet4XX", + BetaListSkillVersionsV1SkillsSkillIdVersionsGet4XX + ), + orElse: unexpectedStatus + })) + ), + "betaCreateSkillVersionV1SkillsSkillIdVersionsPost": (skillId, options) => + HttpClientRequest.post(`/v1/skills/${skillId}/versions?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options.params?.["anthropic-version"] ?? undefined + }), + HttpClientRequest.bodyFormData(options.payload as any), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaCreateSkillVersionV1SkillsSkillIdVersionsPost200), + "4xx": decodeError( + "BetaCreateSkillVersionV1SkillsSkillIdVersionsPost4XX", + BetaCreateSkillVersionV1SkillsSkillIdVersionsPost4XX + ), + orElse: unexpectedStatus + })) + ), + "betaGetSkillVersionV1SkillsSkillIdVersionsVersionGet": (skillId, version, options) => + HttpClientRequest.get(`/v1/skills/${skillId}/versions/${version}?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet200), + "4xx": decodeError( + "BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX", + BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX + ), + orElse: unexpectedStatus + })) + ), + "betaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete": (skillId, version, options) => + HttpClientRequest.delete(`/v1/skills/${skillId}/versions/${version}?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete200), + "4xx": decodeError( + "BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX", + BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX + ), + orElse: unexpectedStatus + })) + ), + "betaDownloadSkillVersionContentV1SkillsSkillIdVersionsVersionContentGet": (skillId, version, options) => + HttpClientRequest.get(`/v1/skills/${skillId}/versions/${version}/content?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + orElse: unexpectedStatus + })) + ), + "betaListEnvironmentsV1EnvironmentsGet": (options) => + HttpClientRequest.get(`/v1/environments?beta=true`).pipe( + HttpClientRequest.setUrlParams({ + "limit": options?.params?.["limit"] as any, + "page": options?.params?.["page"] as any, + "include_archived": options?.params?.["include_archived"] as any + }), + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaListEnvironmentsV1EnvironmentsGet200), + "4xx": decodeError("BetaListEnvironmentsV1EnvironmentsGet4XX", BetaListEnvironmentsV1EnvironmentsGet4XX), + orElse: unexpectedStatus + })) + ), + "betaCreateEnvironmentV1EnvironmentsPost": (options) => + HttpClientRequest.post(`/v1/environments?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options.params?.["anthropic-version"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaCreateEnvironmentV1EnvironmentsPost200), + "4xx": decodeError("BetaCreateEnvironmentV1EnvironmentsPost4XX", BetaCreateEnvironmentV1EnvironmentsPost4XX), + orElse: unexpectedStatus + })) + ), + "betaGetEnvironmentV1EnvironmentsEnvironmentIdGet": (environmentId, options) => + HttpClientRequest.get(`/v1/environments/${environmentId}?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaGetEnvironmentV1EnvironmentsEnvironmentIdGet200), + "4xx": decodeError( + "BetaGetEnvironmentV1EnvironmentsEnvironmentIdGet4XX", + BetaGetEnvironmentV1EnvironmentsEnvironmentIdGet4XX + ), + orElse: unexpectedStatus + })) + ), + "betaUpdateEnvironmentV1EnvironmentsEnvironmentIdPost": (environmentId, options) => + HttpClientRequest.post(`/v1/environments/${environmentId}?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options.params?.["anthropic-version"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaUpdateEnvironmentV1EnvironmentsEnvironmentIdPost200), + "4xx": decodeError( + "BetaUpdateEnvironmentV1EnvironmentsEnvironmentIdPost4XX", + BetaUpdateEnvironmentV1EnvironmentsEnvironmentIdPost4XX + ), + orElse: unexpectedStatus + })) + ), + "betaDeleteEnvironmentV1EnvironmentsEnvironmentIdDelete": (environmentId, options) => + HttpClientRequest.delete(`/v1/environments/${environmentId}?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaDeleteEnvironmentV1EnvironmentsEnvironmentIdDelete200), + "4xx": decodeError( + "BetaDeleteEnvironmentV1EnvironmentsEnvironmentIdDelete4XX", + BetaDeleteEnvironmentV1EnvironmentsEnvironmentIdDelete4XX + ), + orElse: unexpectedStatus + })) + ), + "betaArchiveEnvironmentV1EnvironmentsEnvironmentIdArchivePost": (environmentId, options) => + HttpClientRequest.post(`/v1/environments/${environmentId}/archive?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaArchiveEnvironmentV1EnvironmentsEnvironmentIdArchivePost200), + "4xx": decodeError( + "BetaArchiveEnvironmentV1EnvironmentsEnvironmentIdArchivePost4XX", + BetaArchiveEnvironmentV1EnvironmentsEnvironmentIdArchivePost4XX + ), + orElse: unexpectedStatus + })) + ), + "betaGetEnvironmentStatsV1EnvironmentsEnvironmentIdWorkStatsGet": (environmentId, options) => + HttpClientRequest.get(`/v1/environments/${environmentId}/work/stats?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined, + "authorization": options?.params?.["authorization"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaGetEnvironmentStatsV1EnvironmentsEnvironmentIdWorkStatsGet200), + "4xx": decodeError( + "BetaGetEnvironmentStatsV1EnvironmentsEnvironmentIdWorkStatsGet4XX", + BetaGetEnvironmentStatsV1EnvironmentsEnvironmentIdWorkStatsGet4XX + ), + orElse: unexpectedStatus + })) + ), + "betaPollWorkV1EnvironmentsEnvironmentIdWorkPollGet": (environmentId, options) => + HttpClientRequest.get(`/v1/environments/${environmentId}/work/poll?beta=true`).pipe( + HttpClientRequest.setUrlParams({ + "block_ms": options?.params?.["block_ms"] as any, + "reclaim_older_than_ms": options?.params?.["reclaim_older_than_ms"] as any + }), + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "Anthropic-Worker-ID": options?.params?.["Anthropic-Worker-ID"] ?? undefined, + "authorization": options?.params?.["authorization"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaPollWorkV1EnvironmentsEnvironmentIdWorkPollGet200), + "4xx": decodeError( + "BetaPollWorkV1EnvironmentsEnvironmentIdWorkPollGet4XX", + BetaPollWorkV1EnvironmentsEnvironmentIdWorkPollGet4XX + ), + orElse: unexpectedStatus + })) + ), + "betaAcknowledgeWorkV1EnvironmentsEnvironmentIdWorkWorkIdAckPost": (environmentId, workId, options) => + HttpClientRequest.post(`/v1/environments/${environmentId}/work/${workId}/ack?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "authorization": options?.params?.["authorization"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaAcknowledgeWorkV1EnvironmentsEnvironmentIdWorkWorkIdAckPost200), + "4xx": decodeError( + "BetaAcknowledgeWorkV1EnvironmentsEnvironmentIdWorkWorkIdAckPost4XX", + BetaAcknowledgeWorkV1EnvironmentsEnvironmentIdWorkWorkIdAckPost4XX + ), + orElse: unexpectedStatus + })) + ), + "betaRecordHeartbeatV1EnvironmentsEnvironmentIdWorkWorkIdHeartbeatPost": (environmentId, workId, options) => + HttpClientRequest.post(`/v1/environments/${environmentId}/work/${workId}/heartbeat?beta=true`).pipe( + HttpClientRequest.setUrlParams({ + "desired_ttl_seconds": options?.params?.["desired_ttl_seconds"] as any, + "expected_last_heartbeat": options?.params?.["expected_last_heartbeat"] as any + }), + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "authorization": options?.params?.["authorization"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaRecordHeartbeatV1EnvironmentsEnvironmentIdWorkWorkIdHeartbeatPost200), + "4xx": decodeError( + "BetaRecordHeartbeatV1EnvironmentsEnvironmentIdWorkWorkIdHeartbeatPost4XX", + BetaRecordHeartbeatV1EnvironmentsEnvironmentIdWorkWorkIdHeartbeatPost4XX + ), + orElse: unexpectedStatus + })) + ), + "betaStopWorkV1EnvironmentsEnvironmentIdWorkWorkIdStopPost": (environmentId, workId, options) => + HttpClientRequest.post(`/v1/environments/${environmentId}/work/${workId}/stop?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options.params?.["anthropic-version"] ?? undefined, + "authorization": options.params?.["authorization"] ?? undefined + }), HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(CompletePost200), - "4xx": decodeError("CompletePost4XX", CompletePost4XX), + "2xx": decodeSuccess(BetaStopWorkV1EnvironmentsEnvironmentIdWorkWorkIdStopPost200), + "4xx": decodeError( + "BetaStopWorkV1EnvironmentsEnvironmentIdWorkWorkIdStopPost4XX", + BetaStopWorkV1EnvironmentsEnvironmentIdWorkWorkIdStopPost4XX + ), orElse: unexpectedStatus })) ), - "modelsList": (options) => - HttpClientRequest.get(`/v1/models`).pipe( + "betaGetWorkV1EnvironmentsEnvironmentIdWorkWorkIdGet": (environmentId, workId, options) => + HttpClientRequest.get(`/v1/environments/${environmentId}/work/${workId}?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaGetWorkV1EnvironmentsEnvironmentIdWorkWorkIdGet200), + "4xx": decodeError( + "BetaGetWorkV1EnvironmentsEnvironmentIdWorkWorkIdGet4XX", + BetaGetWorkV1EnvironmentsEnvironmentIdWorkWorkIdGet4XX + ), + orElse: unexpectedStatus + })) + ), + "betaUpdateWorkV1EnvironmentsEnvironmentIdWorkWorkIdPost": (environmentId, workId, options) => + HttpClientRequest.post(`/v1/environments/${environmentId}/work/${workId}?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options.params?.["anthropic-version"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaUpdateWorkV1EnvironmentsEnvironmentIdWorkWorkIdPost200), + "4xx": decodeError( + "BetaUpdateWorkV1EnvironmentsEnvironmentIdWorkWorkIdPost4XX", + BetaUpdateWorkV1EnvironmentsEnvironmentIdWorkWorkIdPost4XX + ), + orElse: unexpectedStatus + })) + ), + "betaListWorkV1EnvironmentsEnvironmentIdWorkGet": (environmentId, options) => + HttpClientRequest.get(`/v1/environments/${environmentId}/work?beta=true`).pipe( HttpClientRequest.setUrlParams({ - "before_id": options?.params?.["before_id"] as any, - "after_id": options?.params?.["after_id"] as any, - "limit": options?.params?.["limit"] as any + "limit": options?.params?.["limit"] as any, + "page": options?.params?.["page"] as any }), HttpClientRequest.setHeaders({ + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "authorization": options?.params?.["authorization"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaListWorkV1EnvironmentsEnvironmentIdWorkGet200), + "4xx": decodeError( + "BetaListWorkV1EnvironmentsEnvironmentIdWorkGet4XX", + BetaListWorkV1EnvironmentsEnvironmentIdWorkGet4XX + ), + orElse: unexpectedStatus + })) + ), + "BetaListSessions": (options) => + HttpClientRequest.get(`/v1/sessions?beta=true`).pipe( + HttpClientRequest.setUrlParams({ + "limit": options?.params?.["limit"] as any, + "page": options?.params?.["page"] as any, + "include_archived": options?.params?.["include_archived"] as any, + "created_at[gte]": options?.params?.["created_at[gte]"] as any, + "created_at[gt]": options?.params?.["created_at[gt]"] as any, + "created_at[lte]": options?.params?.["created_at[lte]"] as any, + "created_at[lt]": options?.params?.["created_at[lt]"] as any, + "agent_id": options?.params?.["agent_id"] as any, + "agent_version": options?.params?.["agent_version"] as any, + "order": options?.params?.["order"] as any, + "memory_store_id": options?.params?.["memory_store_id"] as any, + "statuses[]": options?.params?.["statuses[]"] as any + }), + HttpClientRequest.setHeaders({ "x-api-key": options?.params?.["x-api-key"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(ModelsList200), - "4xx": decodeError("ModelsList4XX", ModelsList4XX), + "2xx": decodeSuccess(BetaListSessions200), + "400": decodeError("BetaListSessions400", BetaListSessions400), + "401": decodeError("BetaListSessions401", BetaListSessions401), + "403": decodeError("BetaListSessions403", BetaListSessions403), + "404": decodeError("BetaListSessions404", BetaListSessions404), + "408": decodeError("BetaListSessions408", BetaListSessions408), + "409": decodeError("BetaListSessions409", BetaListSessions409), + "412": decodeError("BetaListSessions412", BetaListSessions412), + "413": decodeError("BetaListSessions413", BetaListSessions413), + "429": decodeError("BetaListSessions429", BetaListSessions429), + "431": decodeError("BetaListSessions431", BetaListSessions431), + "499": decodeError("BetaListSessions499", BetaListSessions499), + "500": decodeError("BetaListSessions500", BetaListSessions500), + "501": decodeError("BetaListSessions501", BetaListSessions501), + "503": decodeError("BetaListSessions503", BetaListSessions503), + "504": decodeError("BetaListSessions504", BetaListSessions504), orElse: unexpectedStatus })) ), - "modelsGet": (modelId, options) => - HttpClientRequest.get(`/v1/models/${modelId}`).pipe( + "BetaCreateSession": (options) => + HttpClientRequest.post(`/v1/sessions?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-version": options.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaCreateSession200), + "400": decodeError("BetaCreateSession400", BetaCreateSession400), + "401": decodeError("BetaCreateSession401", BetaCreateSession401), + "403": decodeError("BetaCreateSession403", BetaCreateSession403), + "404": decodeError("BetaCreateSession404", BetaCreateSession404), + "408": decodeError("BetaCreateSession408", BetaCreateSession408), + "409": decodeError("BetaCreateSession409", BetaCreateSession409), + "412": decodeError("BetaCreateSession412", BetaCreateSession412), + "413": decodeError("BetaCreateSession413", BetaCreateSession413), + "429": decodeError("BetaCreateSession429", BetaCreateSession429), + "431": decodeError("BetaCreateSession431", BetaCreateSession431), + "499": decodeError("BetaCreateSession499", BetaCreateSession499), + "500": decodeError("BetaCreateSession500", BetaCreateSession500), + "501": decodeError("BetaCreateSession501", BetaCreateSession501), + "503": decodeError("BetaCreateSession503", BetaCreateSession503), + "504": decodeError("BetaCreateSession504", BetaCreateSession504), + orElse: unexpectedStatus + })) + ), + "BetaGetSession": (sessionId, options) => + HttpClientRequest.get(`/v1/sessions/${sessionId}?beta=true`).pipe( HttpClientRequest.setHeaders({ + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaGetSession200), + "400": decodeError("BetaGetSession400", BetaGetSession400), + "401": decodeError("BetaGetSession401", BetaGetSession401), + "403": decodeError("BetaGetSession403", BetaGetSession403), + "404": decodeError("BetaGetSession404", BetaGetSession404), + "408": decodeError("BetaGetSession408", BetaGetSession408), + "409": decodeError("BetaGetSession409", BetaGetSession409), + "412": decodeError("BetaGetSession412", BetaGetSession412), + "413": decodeError("BetaGetSession413", BetaGetSession413), + "429": decodeError("BetaGetSession429", BetaGetSession429), + "431": decodeError("BetaGetSession431", BetaGetSession431), + "499": decodeError("BetaGetSession499", BetaGetSession499), + "500": decodeError("BetaGetSession500", BetaGetSession500), + "501": decodeError("BetaGetSession501", BetaGetSession501), + "503": decodeError("BetaGetSession503", BetaGetSession503), + "504": decodeError("BetaGetSession504", BetaGetSession504), + orElse: unexpectedStatus + })) + ), + "BetaUpdateSession": (sessionId, options) => + HttpClientRequest.post(`/v1/sessions/${sessionId}?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-version": options.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaUpdateSession200), + "400": decodeError("BetaUpdateSession400", BetaUpdateSession400), + "401": decodeError("BetaUpdateSession401", BetaUpdateSession401), + "403": decodeError("BetaUpdateSession403", BetaUpdateSession403), + "404": decodeError("BetaUpdateSession404", BetaUpdateSession404), + "408": decodeError("BetaUpdateSession408", BetaUpdateSession408), + "409": decodeError("BetaUpdateSession409", BetaUpdateSession409), + "412": decodeError("BetaUpdateSession412", BetaUpdateSession412), + "413": decodeError("BetaUpdateSession413", BetaUpdateSession413), + "429": decodeError("BetaUpdateSession429", BetaUpdateSession429), + "431": decodeError("BetaUpdateSession431", BetaUpdateSession431), + "499": decodeError("BetaUpdateSession499", BetaUpdateSession499), + "500": decodeError("BetaUpdateSession500", BetaUpdateSession500), + "501": decodeError("BetaUpdateSession501", BetaUpdateSession501), + "503": decodeError("BetaUpdateSession503", BetaUpdateSession503), + "504": decodeError("BetaUpdateSession504", BetaUpdateSession504), + orElse: unexpectedStatus + })) + ), + "BetaDeleteSession": (sessionId, options) => + HttpClientRequest.delete(`/v1/sessions/${sessionId}?beta=true`).pipe( + HttpClientRequest.setHeaders({ "x-api-key": options?.params?.["x-api-key"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(ModelsGet200), - "4xx": decodeError("ModelsGet4XX", ModelsGet4XX), + "2xx": decodeSuccess(BetaDeleteSession200), + "400": decodeError("BetaDeleteSession400", BetaDeleteSession400), + "401": decodeError("BetaDeleteSession401", BetaDeleteSession401), + "403": decodeError("BetaDeleteSession403", BetaDeleteSession403), + "404": decodeError("BetaDeleteSession404", BetaDeleteSession404), + "408": decodeError("BetaDeleteSession408", BetaDeleteSession408), + "409": decodeError("BetaDeleteSession409", BetaDeleteSession409), + "412": decodeError("BetaDeleteSession412", BetaDeleteSession412), + "413": decodeError("BetaDeleteSession413", BetaDeleteSession413), + "429": decodeError("BetaDeleteSession429", BetaDeleteSession429), + "431": decodeError("BetaDeleteSession431", BetaDeleteSession431), + "499": decodeError("BetaDeleteSession499", BetaDeleteSession499), + "500": decodeError("BetaDeleteSession500", BetaDeleteSession500), + "501": decodeError("BetaDeleteSession501", BetaDeleteSession501), + "503": decodeError("BetaDeleteSession503", BetaDeleteSession503), + "504": decodeError("BetaDeleteSession504", BetaDeleteSession504), orElse: unexpectedStatus })) ), - "messageBatchesList": (options) => - HttpClientRequest.get(`/v1/messages/batches`).pipe( + "BetaListEvents": (sessionId, options) => + HttpClientRequest.get(`/v1/sessions/${sessionId}/events?beta=true`).pipe( HttpClientRequest.setUrlParams({ - "before_id": options?.params?.["before_id"] as any, - "after_id": options?.params?.["after_id"] as any, - "limit": options?.params?.["limit"] as any + "limit": options?.params?.["limit"] as any, + "page": options?.params?.["page"] as any, + "order": options?.params?.["order"] as any, + "types[]": options?.params?.["types[]"] as any, + "created_at[gte]": options?.params?.["created_at[gte]"] as any, + "created_at[gt]": options?.params?.["created_at[gt]"] as any, + "created_at[lte]": options?.params?.["created_at[lte]"] as any, + "created_at[lt]": options?.params?.["created_at[lt]"] as any }), HttpClientRequest.setHeaders({ + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(MessageBatchesList200), - "4xx": decodeError("MessageBatchesList4XX", MessageBatchesList4XX), + "2xx": decodeSuccess(BetaListEvents200), + "400": decodeError("BetaListEvents400", BetaListEvents400), + "401": decodeError("BetaListEvents401", BetaListEvents401), + "403": decodeError("BetaListEvents403", BetaListEvents403), + "404": decodeError("BetaListEvents404", BetaListEvents404), + "408": decodeError("BetaListEvents408", BetaListEvents408), + "409": decodeError("BetaListEvents409", BetaListEvents409), + "412": decodeError("BetaListEvents412", BetaListEvents412), + "413": decodeError("BetaListEvents413", BetaListEvents413), + "429": decodeError("BetaListEvents429", BetaListEvents429), + "431": decodeError("BetaListEvents431", BetaListEvents431), + "499": decodeError("BetaListEvents499", BetaListEvents499), + "500": decodeError("BetaListEvents500", BetaListEvents500), + "501": decodeError("BetaListEvents501", BetaListEvents501), + "503": decodeError("BetaListEvents503", BetaListEvents503), + "504": decodeError("BetaListEvents504", BetaListEvents504), orElse: unexpectedStatus })) ), - "messageBatchesPost": (options) => - HttpClientRequest.post(`/v1/messages/batches`).pipe( - HttpClientRequest.setHeaders({ "anthropic-version": options.params?.["anthropic-version"] ?? undefined }), + "BetaSendEvents": (sessionId, options) => + HttpClientRequest.post(`/v1/sessions/${sessionId}/events?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-version": options.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined + }), HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(MessageBatchesPost200), - "4xx": decodeError("MessageBatchesPost4XX", MessageBatchesPost4XX), + "2xx": decodeSuccess(BetaSendEvents200), + "400": decodeError("BetaSendEvents400", BetaSendEvents400), + "401": decodeError("BetaSendEvents401", BetaSendEvents401), + "403": decodeError("BetaSendEvents403", BetaSendEvents403), + "404": decodeError("BetaSendEvents404", BetaSendEvents404), + "408": decodeError("BetaSendEvents408", BetaSendEvents408), + "409": decodeError("BetaSendEvents409", BetaSendEvents409), + "412": decodeError("BetaSendEvents412", BetaSendEvents412), + "413": decodeError("BetaSendEvents413", BetaSendEvents413), + "429": decodeError("BetaSendEvents429", BetaSendEvents429), + "431": decodeError("BetaSendEvents431", BetaSendEvents431), + "499": decodeError("BetaSendEvents499", BetaSendEvents499), + "500": decodeError("BetaSendEvents500", BetaSendEvents500), + "501": decodeError("BetaSendEvents501", BetaSendEvents501), + "503": decodeError("BetaSendEvents503", BetaSendEvents503), + "504": decodeError("BetaSendEvents504", BetaSendEvents504), orElse: unexpectedStatus })) ), - "messageBatchesRetrieve": (messageBatchId, options) => - HttpClientRequest.get(`/v1/messages/batches/${messageBatchId}`).pipe( + "BetaStreamSessionEvents": (sessionId, options) => + HttpClientRequest.get(`/v1/sessions/${sessionId}/events/stream?beta=true`).pipe( HttpClientRequest.setHeaders({ + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(MessageBatchesRetrieve200), - "4xx": decodeError("MessageBatchesRetrieve4XX", MessageBatchesRetrieve4XX), + "2xx": decodeSuccess(BetaStreamSessionEvents200), + "400": decodeError("BetaStreamSessionEvents400", BetaStreamSessionEvents400), + "401": decodeError("BetaStreamSessionEvents401", BetaStreamSessionEvents401), + "403": decodeError("BetaStreamSessionEvents403", BetaStreamSessionEvents403), + "404": decodeError("BetaStreamSessionEvents404", BetaStreamSessionEvents404), + "408": decodeError("BetaStreamSessionEvents408", BetaStreamSessionEvents408), + "409": decodeError("BetaStreamSessionEvents409", BetaStreamSessionEvents409), + "412": decodeError("BetaStreamSessionEvents412", BetaStreamSessionEvents412), + "413": decodeError("BetaStreamSessionEvents413", BetaStreamSessionEvents413), + "429": decodeError("BetaStreamSessionEvents429", BetaStreamSessionEvents429), + "431": decodeError("BetaStreamSessionEvents431", BetaStreamSessionEvents431), + "499": decodeError("BetaStreamSessionEvents499", BetaStreamSessionEvents499), + "500": decodeError("BetaStreamSessionEvents500", BetaStreamSessionEvents500), + "501": decodeError("BetaStreamSessionEvents501", BetaStreamSessionEvents501), + "503": decodeError("BetaStreamSessionEvents503", BetaStreamSessionEvents503), + "504": decodeError("BetaStreamSessionEvents504", BetaStreamSessionEvents504), orElse: unexpectedStatus })) ), - "messageBatchesDelete": (messageBatchId, options) => - HttpClientRequest.delete(`/v1/messages/batches/${messageBatchId}`).pipe( + "BetaArchiveSession": (sessionId, options) => + HttpClientRequest.post(`/v1/sessions/${sessionId}/archive?beta=true`).pipe( HttpClientRequest.setHeaders({ "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(MessageBatchesDelete200), - "4xx": decodeError("MessageBatchesDelete4XX", MessageBatchesDelete4XX), + "2xx": decodeSuccess(BetaArchiveSession200), + "400": decodeError("BetaArchiveSession400", BetaArchiveSession400), + "401": decodeError("BetaArchiveSession401", BetaArchiveSession401), + "403": decodeError("BetaArchiveSession403", BetaArchiveSession403), + "404": decodeError("BetaArchiveSession404", BetaArchiveSession404), + "408": decodeError("BetaArchiveSession408", BetaArchiveSession408), + "409": decodeError("BetaArchiveSession409", BetaArchiveSession409), + "412": decodeError("BetaArchiveSession412", BetaArchiveSession412), + "413": decodeError("BetaArchiveSession413", BetaArchiveSession413), + "429": decodeError("BetaArchiveSession429", BetaArchiveSession429), + "431": decodeError("BetaArchiveSession431", BetaArchiveSession431), + "499": decodeError("BetaArchiveSession499", BetaArchiveSession499), + "500": decodeError("BetaArchiveSession500", BetaArchiveSession500), + "501": decodeError("BetaArchiveSession501", BetaArchiveSession501), + "503": decodeError("BetaArchiveSession503", BetaArchiveSession503), + "504": decodeError("BetaArchiveSession504", BetaArchiveSession504), orElse: unexpectedStatus })) ), - "messageBatchesCancel": (messageBatchId, options) => - HttpClientRequest.post(`/v1/messages/batches/${messageBatchId}/cancel`).pipe( - HttpClientRequest.setHeaders({ "anthropic-version": options?.params?.["anthropic-version"] ?? undefined }), + "BetaListSessionThreads": (sessionId, options) => + HttpClientRequest.get(`/v1/sessions/${sessionId}/threads?beta=true`).pipe( + HttpClientRequest.setUrlParams({ + "limit": options?.params?.["limit"] as any, + "page": options?.params?.["page"] as any + }), + HttpClientRequest.setHeaders({ + "x-api-key": options?.params?.["x-api-key"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined + }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(MessageBatchesCancel200), - "4xx": decodeError("MessageBatchesCancel4XX", MessageBatchesCancel4XX), + "2xx": decodeSuccess(BetaListSessionThreads200), + "400": decodeError("BetaListSessionThreads400", BetaListSessionThreads400), + "401": decodeError("BetaListSessionThreads401", BetaListSessionThreads401), + "403": decodeError("BetaListSessionThreads403", BetaListSessionThreads403), + "404": decodeError("BetaListSessionThreads404", BetaListSessionThreads404), + "408": decodeError("BetaListSessionThreads408", BetaListSessionThreads408), + "409": decodeError("BetaListSessionThreads409", BetaListSessionThreads409), + "412": decodeError("BetaListSessionThreads412", BetaListSessionThreads412), + "413": decodeError("BetaListSessionThreads413", BetaListSessionThreads413), + "429": decodeError("BetaListSessionThreads429", BetaListSessionThreads429), + "431": decodeError("BetaListSessionThreads431", BetaListSessionThreads431), + "499": decodeError("BetaListSessionThreads499", BetaListSessionThreads499), + "500": decodeError("BetaListSessionThreads500", BetaListSessionThreads500), + "501": decodeError("BetaListSessionThreads501", BetaListSessionThreads501), + "503": decodeError("BetaListSessionThreads503", BetaListSessionThreads503), + "504": decodeError("BetaListSessionThreads504", BetaListSessionThreads504), orElse: unexpectedStatus })) ), - "messageBatchesResults": (messageBatchId, options) => - HttpClientRequest.get(`/v1/messages/batches/${messageBatchId}/results`).pipe( + "BetaGetSessionThread": (sessionId, threadId, options) => + HttpClientRequest.get(`/v1/sessions/${sessionId}/threads/${threadId}?beta=true`).pipe( HttpClientRequest.setHeaders({ + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "4xx": decodeError("MessageBatchesResults4XX", MessageBatchesResults4XX), - orElse: unexpectedStatus - })) - ), - "messagesCountTokensPost": (options) => - HttpClientRequest.post(`/v1/messages/count_tokens`).pipe( - HttpClientRequest.setHeaders({ "anthropic-version": options.params?.["anthropic-version"] ?? undefined }), - HttpClientRequest.bodyJsonUnsafe(options.payload), - withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(MessagesCountTokensPost200), - "4xx": decodeError("MessagesCountTokensPost4XX", MessagesCountTokensPost4XX), + "2xx": decodeSuccess(BetaGetSessionThread200), + "400": decodeError("BetaGetSessionThread400", BetaGetSessionThread400), + "401": decodeError("BetaGetSessionThread401", BetaGetSessionThread401), + "403": decodeError("BetaGetSessionThread403", BetaGetSessionThread403), + "404": decodeError("BetaGetSessionThread404", BetaGetSessionThread404), + "408": decodeError("BetaGetSessionThread408", BetaGetSessionThread408), + "409": decodeError("BetaGetSessionThread409", BetaGetSessionThread409), + "412": decodeError("BetaGetSessionThread412", BetaGetSessionThread412), + "413": decodeError("BetaGetSessionThread413", BetaGetSessionThread413), + "429": decodeError("BetaGetSessionThread429", BetaGetSessionThread429), + "431": decodeError("BetaGetSessionThread431", BetaGetSessionThread431), + "499": decodeError("BetaGetSessionThread499", BetaGetSessionThread499), + "500": decodeError("BetaGetSessionThread500", BetaGetSessionThread500), + "501": decodeError("BetaGetSessionThread501", BetaGetSessionThread501), + "503": decodeError("BetaGetSessionThread503", BetaGetSessionThread503), + "504": decodeError("BetaGetSessionThread504", BetaGetSessionThread504), orElse: unexpectedStatus })) ), - "listFilesV1FilesGet": (options) => - HttpClientRequest.get(`/v1/files`).pipe( + "BetaListSessionThreadEvents": (sessionId, threadId, options) => + HttpClientRequest.get(`/v1/sessions/${sessionId}/threads/${threadId}/events?beta=true`).pipe( HttpClientRequest.setUrlParams({ - "before_id": options?.params?.["before_id"] as any, - "after_id": options?.params?.["after_id"] as any, - "limit": options?.params?.["limit"] as any + "limit": options?.params?.["limit"] as any, + "page": options?.params?.["page"] as any }), HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(ListFilesV1FilesGet200), - "4xx": decodeError("ListFilesV1FilesGet4XX", ListFilesV1FilesGet4XX), + "2xx": decodeSuccess(BetaListSessionThreadEvents200), + "400": decodeError("BetaListSessionThreadEvents400", BetaListSessionThreadEvents400), + "401": decodeError("BetaListSessionThreadEvents401", BetaListSessionThreadEvents401), + "403": decodeError("BetaListSessionThreadEvents403", BetaListSessionThreadEvents403), + "404": decodeError("BetaListSessionThreadEvents404", BetaListSessionThreadEvents404), + "408": decodeError("BetaListSessionThreadEvents408", BetaListSessionThreadEvents408), + "409": decodeError("BetaListSessionThreadEvents409", BetaListSessionThreadEvents409), + "412": decodeError("BetaListSessionThreadEvents412", BetaListSessionThreadEvents412), + "413": decodeError("BetaListSessionThreadEvents413", BetaListSessionThreadEvents413), + "429": decodeError("BetaListSessionThreadEvents429", BetaListSessionThreadEvents429), + "431": decodeError("BetaListSessionThreadEvents431", BetaListSessionThreadEvents431), + "499": decodeError("BetaListSessionThreadEvents499", BetaListSessionThreadEvents499), + "500": decodeError("BetaListSessionThreadEvents500", BetaListSessionThreadEvents500), + "501": decodeError("BetaListSessionThreadEvents501", BetaListSessionThreadEvents501), + "503": decodeError("BetaListSessionThreadEvents503", BetaListSessionThreadEvents503), + "504": decodeError("BetaListSessionThreadEvents504", BetaListSessionThreadEvents504), orElse: unexpectedStatus })) ), - "uploadFileV1FilesPost": (options) => - HttpClientRequest.post(`/v1/files`).pipe( + "BetaStreamSessionThreadEvents": (sessionId, threadId, options) => + HttpClientRequest.get(`/v1/sessions/${sessionId}/threads/${threadId}/stream?beta=true`).pipe( HttpClientRequest.setHeaders({ - "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined, - "anthropic-version": options.params?.["anthropic-version"] ?? undefined + "x-api-key": options?.params?.["x-api-key"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), - HttpClientRequest.bodyFormData(options.payload as any), - withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(UploadFileV1FilesPost200), - "4xx": decodeError("UploadFileV1FilesPost4XX", UploadFileV1FilesPost4XX), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaStreamSessionThreadEvents200), + "400": decodeError("BetaStreamSessionThreadEvents400", BetaStreamSessionThreadEvents400), + "401": decodeError("BetaStreamSessionThreadEvents401", BetaStreamSessionThreadEvents401), + "403": decodeError("BetaStreamSessionThreadEvents403", BetaStreamSessionThreadEvents403), + "404": decodeError("BetaStreamSessionThreadEvents404", BetaStreamSessionThreadEvents404), + "408": decodeError("BetaStreamSessionThreadEvents408", BetaStreamSessionThreadEvents408), + "409": decodeError("BetaStreamSessionThreadEvents409", BetaStreamSessionThreadEvents409), + "412": decodeError("BetaStreamSessionThreadEvents412", BetaStreamSessionThreadEvents412), + "413": decodeError("BetaStreamSessionThreadEvents413", BetaStreamSessionThreadEvents413), + "429": decodeError("BetaStreamSessionThreadEvents429", BetaStreamSessionThreadEvents429), + "431": decodeError("BetaStreamSessionThreadEvents431", BetaStreamSessionThreadEvents431), + "499": decodeError("BetaStreamSessionThreadEvents499", BetaStreamSessionThreadEvents499), + "500": decodeError("BetaStreamSessionThreadEvents500", BetaStreamSessionThreadEvents500), + "501": decodeError("BetaStreamSessionThreadEvents501", BetaStreamSessionThreadEvents501), + "503": decodeError("BetaStreamSessionThreadEvents503", BetaStreamSessionThreadEvents503), + "504": decodeError("BetaStreamSessionThreadEvents504", BetaStreamSessionThreadEvents504), orElse: unexpectedStatus })) ), - "getFileMetadataV1FilesFileIdGet": (fileId, options) => - HttpClientRequest.get(`/v1/files/${fileId}`).pipe( + "BetaArchiveSessionThread": (sessionId, threadId, options) => + HttpClientRequest.post(`/v1/sessions/${sessionId}/threads/${threadId}/archive?beta=true`).pipe( HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(GetFileMetadataV1FilesFileIdGet200), - "4xx": decodeError("GetFileMetadataV1FilesFileIdGet4XX", GetFileMetadataV1FilesFileIdGet4XX), + "2xx": decodeSuccess(BetaArchiveSessionThread200), + "400": decodeError("BetaArchiveSessionThread400", BetaArchiveSessionThread400), + "401": decodeError("BetaArchiveSessionThread401", BetaArchiveSessionThread401), + "403": decodeError("BetaArchiveSessionThread403", BetaArchiveSessionThread403), + "404": decodeError("BetaArchiveSessionThread404", BetaArchiveSessionThread404), + "408": decodeError("BetaArchiveSessionThread408", BetaArchiveSessionThread408), + "409": decodeError("BetaArchiveSessionThread409", BetaArchiveSessionThread409), + "412": decodeError("BetaArchiveSessionThread412", BetaArchiveSessionThread412), + "413": decodeError("BetaArchiveSessionThread413", BetaArchiveSessionThread413), + "429": decodeError("BetaArchiveSessionThread429", BetaArchiveSessionThread429), + "431": decodeError("BetaArchiveSessionThread431", BetaArchiveSessionThread431), + "499": decodeError("BetaArchiveSessionThread499", BetaArchiveSessionThread499), + "500": decodeError("BetaArchiveSessionThread500", BetaArchiveSessionThread500), + "501": decodeError("BetaArchiveSessionThread501", BetaArchiveSessionThread501), + "503": decodeError("BetaArchiveSessionThread503", BetaArchiveSessionThread503), + "504": decodeError("BetaArchiveSessionThread504", BetaArchiveSessionThread504), orElse: unexpectedStatus })) ), - "deleteFileV1FilesFileIdDelete": (fileId, options) => - HttpClientRequest.delete(`/v1/files/${fileId}`).pipe( + "BetaListResources": (sessionId, options) => + HttpClientRequest.get(`/v1/sessions/${sessionId}/resources?beta=true`).pipe( + HttpClientRequest.setUrlParams({ + "limit": options?.params?.["limit"] as any, + "page": options?.params?.["page"] as any + }), HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(DeleteFileV1FilesFileIdDelete200), - "4xx": decodeError("DeleteFileV1FilesFileIdDelete4XX", DeleteFileV1FilesFileIdDelete4XX), + "2xx": decodeSuccess(BetaListResources200), + "400": decodeError("BetaListResources400", BetaListResources400), + "401": decodeError("BetaListResources401", BetaListResources401), + "403": decodeError("BetaListResources403", BetaListResources403), + "404": decodeError("BetaListResources404", BetaListResources404), + "408": decodeError("BetaListResources408", BetaListResources408), + "409": decodeError("BetaListResources409", BetaListResources409), + "412": decodeError("BetaListResources412", BetaListResources412), + "413": decodeError("BetaListResources413", BetaListResources413), + "429": decodeError("BetaListResources429", BetaListResources429), + "431": decodeError("BetaListResources431", BetaListResources431), + "499": decodeError("BetaListResources499", BetaListResources499), + "500": decodeError("BetaListResources500", BetaListResources500), + "501": decodeError("BetaListResources501", BetaListResources501), + "503": decodeError("BetaListResources503", BetaListResources503), + "504": decodeError("BetaListResources504", BetaListResources504), orElse: unexpectedStatus })) ), - "downloadFileV1FilesFileIdContentGet": (fileId, options) => - HttpClientRequest.get(`/v1/files/${fileId}/content`).pipe( + "BetaAddResource": (sessionId, options) => + HttpClientRequest.post(`/v1/sessions/${sessionId}/resources?beta=true`).pipe( HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaAddResource200), + "400": decodeError("BetaAddResource400", BetaAddResource400), + "401": decodeError("BetaAddResource401", BetaAddResource401), + "403": decodeError("BetaAddResource403", BetaAddResource403), + "404": decodeError("BetaAddResource404", BetaAddResource404), + "408": decodeError("BetaAddResource408", BetaAddResource408), + "409": decodeError("BetaAddResource409", BetaAddResource409), + "412": decodeError("BetaAddResource412", BetaAddResource412), + "413": decodeError("BetaAddResource413", BetaAddResource413), + "429": decodeError("BetaAddResource429", BetaAddResource429), + "431": decodeError("BetaAddResource431", BetaAddResource431), + "499": decodeError("BetaAddResource499", BetaAddResource499), + "500": decodeError("BetaAddResource500", BetaAddResource500), + "501": decodeError("BetaAddResource501", BetaAddResource501), + "503": decodeError("BetaAddResource503", BetaAddResource503), + "504": decodeError("BetaAddResource504", BetaAddResource504), + orElse: unexpectedStatus + })) + ), + "BetaGetResource": (sessionId, resourceId, options) => + HttpClientRequest.get(`/v1/sessions/${sessionId}/resources/${resourceId}?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaGetResource200), + "400": decodeError("BetaGetResource400", BetaGetResource400), + "401": decodeError("BetaGetResource401", BetaGetResource401), + "403": decodeError("BetaGetResource403", BetaGetResource403), + "404": decodeError("BetaGetResource404", BetaGetResource404), + "408": decodeError("BetaGetResource408", BetaGetResource408), + "409": decodeError("BetaGetResource409", BetaGetResource409), + "412": decodeError("BetaGetResource412", BetaGetResource412), + "413": decodeError("BetaGetResource413", BetaGetResource413), + "429": decodeError("BetaGetResource429", BetaGetResource429), + "431": decodeError("BetaGetResource431", BetaGetResource431), + "499": decodeError("BetaGetResource499", BetaGetResource499), + "500": decodeError("BetaGetResource500", BetaGetResource500), + "501": decodeError("BetaGetResource501", BetaGetResource501), + "503": decodeError("BetaGetResource503", BetaGetResource503), + "504": decodeError("BetaGetResource504", BetaGetResource504), orElse: unexpectedStatus })) ), - "downloadFileV1FilesFileIdContentGetStream": (fileId, options) => - HttpClientRequest.get(`/v1/files/${fileId}/content`).pipe( + "BetaUpdateResource": (sessionId, resourceId, options) => + HttpClientRequest.post(`/v1/sessions/${sessionId}/resources/${resourceId}?beta=true`).pipe( HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "anthropic-version": options.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaUpdateResource200), + "400": decodeError("BetaUpdateResource400", BetaUpdateResource400), + "401": decodeError("BetaUpdateResource401", BetaUpdateResource401), + "403": decodeError("BetaUpdateResource403", BetaUpdateResource403), + "404": decodeError("BetaUpdateResource404", BetaUpdateResource404), + "408": decodeError("BetaUpdateResource408", BetaUpdateResource408), + "409": decodeError("BetaUpdateResource409", BetaUpdateResource409), + "412": decodeError("BetaUpdateResource412", BetaUpdateResource412), + "413": decodeError("BetaUpdateResource413", BetaUpdateResource413), + "429": decodeError("BetaUpdateResource429", BetaUpdateResource429), + "431": decodeError("BetaUpdateResource431", BetaUpdateResource431), + "499": decodeError("BetaUpdateResource499", BetaUpdateResource499), + "500": decodeError("BetaUpdateResource500", BetaUpdateResource500), + "501": decodeError("BetaUpdateResource501", BetaUpdateResource501), + "503": decodeError("BetaUpdateResource503", BetaUpdateResource503), + "504": decodeError("BetaUpdateResource504", BetaUpdateResource504), + orElse: unexpectedStatus + })) + ), + "BetaDeleteResource": (sessionId, resourceId, options) => + HttpClientRequest.delete(`/v1/sessions/${sessionId}/resources/${resourceId}?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), - binaryRequest + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaDeleteResource200), + "400": decodeError("BetaDeleteResource400", BetaDeleteResource400), + "401": decodeError("BetaDeleteResource401", BetaDeleteResource401), + "403": decodeError("BetaDeleteResource403", BetaDeleteResource403), + "404": decodeError("BetaDeleteResource404", BetaDeleteResource404), + "408": decodeError("BetaDeleteResource408", BetaDeleteResource408), + "409": decodeError("BetaDeleteResource409", BetaDeleteResource409), + "412": decodeError("BetaDeleteResource412", BetaDeleteResource412), + "413": decodeError("BetaDeleteResource413", BetaDeleteResource413), + "429": decodeError("BetaDeleteResource429", BetaDeleteResource429), + "431": decodeError("BetaDeleteResource431", BetaDeleteResource431), + "499": decodeError("BetaDeleteResource499", BetaDeleteResource499), + "500": decodeError("BetaDeleteResource500", BetaDeleteResource500), + "501": decodeError("BetaDeleteResource501", BetaDeleteResource501), + "503": decodeError("BetaDeleteResource503", BetaDeleteResource503), + "504": decodeError("BetaDeleteResource504", BetaDeleteResource504), + orElse: unexpectedStatus + })) ), - "listSkillsV1SkillsGet": (options) => - HttpClientRequest.get(`/v1/skills`).pipe( + "BetaListAgents": (options) => + HttpClientRequest.get(`/v1/agents?beta=true`).pipe( HttpClientRequest.setUrlParams({ - "page": options?.params?.["page"] as any, "limit": options?.params?.["limit"] as any, - "source": options?.params?.["source"] as any + "page": options?.params?.["page"] as any, + "created_at[gte]": options?.params?.["created_at[gte]"] as any, + "created_at[lte]": options?.params?.["created_at[lte]"] as any, + "include_archived": options?.params?.["include_archived"] as any }), HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(ListSkillsV1SkillsGet200), - "4xx": decodeError("ListSkillsV1SkillsGet4XX", ListSkillsV1SkillsGet4XX), + "2xx": decodeSuccess(BetaListAgents200), + "400": decodeError("BetaListAgents400", BetaListAgents400), + "401": decodeError("BetaListAgents401", BetaListAgents401), + "403": decodeError("BetaListAgents403", BetaListAgents403), + "404": decodeError("BetaListAgents404", BetaListAgents404), + "408": decodeError("BetaListAgents408", BetaListAgents408), + "409": decodeError("BetaListAgents409", BetaListAgents409), + "412": decodeError("BetaListAgents412", BetaListAgents412), + "413": decodeError("BetaListAgents413", BetaListAgents413), + "429": decodeError("BetaListAgents429", BetaListAgents429), + "431": decodeError("BetaListAgents431", BetaListAgents431), + "499": decodeError("BetaListAgents499", BetaListAgents499), + "500": decodeError("BetaListAgents500", BetaListAgents500), + "501": decodeError("BetaListAgents501", BetaListAgents501), + "503": decodeError("BetaListAgents503", BetaListAgents503), + "504": decodeError("BetaListAgents504", BetaListAgents504), orElse: unexpectedStatus })) ), - "createSkillV1SkillsPost": (options) => - HttpClientRequest.post(`/v1/skills`).pipe( + "BetaCreateAgent": (options) => + HttpClientRequest.post(`/v1/agents?beta=true`).pipe( HttpClientRequest.setHeaders({ - "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined, - "anthropic-version": options.params?.["anthropic-version"] ?? undefined + "anthropic-version": options.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaCreateAgent200), + "400": decodeError("BetaCreateAgent400", BetaCreateAgent400), + "401": decodeError("BetaCreateAgent401", BetaCreateAgent401), + "403": decodeError("BetaCreateAgent403", BetaCreateAgent403), + "404": decodeError("BetaCreateAgent404", BetaCreateAgent404), + "408": decodeError("BetaCreateAgent408", BetaCreateAgent408), + "409": decodeError("BetaCreateAgent409", BetaCreateAgent409), + "412": decodeError("BetaCreateAgent412", BetaCreateAgent412), + "413": decodeError("BetaCreateAgent413", BetaCreateAgent413), + "429": decodeError("BetaCreateAgent429", BetaCreateAgent429), + "431": decodeError("BetaCreateAgent431", BetaCreateAgent431), + "499": decodeError("BetaCreateAgent499", BetaCreateAgent499), + "500": decodeError("BetaCreateAgent500", BetaCreateAgent500), + "501": decodeError("BetaCreateAgent501", BetaCreateAgent501), + "503": decodeError("BetaCreateAgent503", BetaCreateAgent503), + "504": decodeError("BetaCreateAgent504", BetaCreateAgent504), + orElse: unexpectedStatus + })) + ), + "BetaGetAgent": (agentId, options) => + HttpClientRequest.get(`/v1/agents/${agentId}?beta=true`).pipe( + HttpClientRequest.setUrlParams({ "version": options?.params?.["version"] as any }), + HttpClientRequest.setHeaders({ + "x-api-key": options?.params?.["x-api-key"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaGetAgent200), + "400": decodeError("BetaGetAgent400", BetaGetAgent400), + "401": decodeError("BetaGetAgent401", BetaGetAgent401), + "403": decodeError("BetaGetAgent403", BetaGetAgent403), + "404": decodeError("BetaGetAgent404", BetaGetAgent404), + "408": decodeError("BetaGetAgent408", BetaGetAgent408), + "409": decodeError("BetaGetAgent409", BetaGetAgent409), + "412": decodeError("BetaGetAgent412", BetaGetAgent412), + "413": decodeError("BetaGetAgent413", BetaGetAgent413), + "429": decodeError("BetaGetAgent429", BetaGetAgent429), + "431": decodeError("BetaGetAgent431", BetaGetAgent431), + "499": decodeError("BetaGetAgent499", BetaGetAgent499), + "500": decodeError("BetaGetAgent500", BetaGetAgent500), + "501": decodeError("BetaGetAgent501", BetaGetAgent501), + "503": decodeError("BetaGetAgent503", BetaGetAgent503), + "504": decodeError("BetaGetAgent504", BetaGetAgent504), + orElse: unexpectedStatus + })) + ), + "BetaUpdateAgent": (agentId, options) => + HttpClientRequest.post(`/v1/agents/${agentId}?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-version": options.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined }), - HttpClientRequest.bodyFormData(options.payload as any), + HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(CreateSkillV1SkillsPost200), - "4xx": decodeError("CreateSkillV1SkillsPost4XX", CreateSkillV1SkillsPost4XX), + "2xx": decodeSuccess(BetaUpdateAgent200), + "400": decodeError("BetaUpdateAgent400", BetaUpdateAgent400), + "401": decodeError("BetaUpdateAgent401", BetaUpdateAgent401), + "403": decodeError("BetaUpdateAgent403", BetaUpdateAgent403), + "404": decodeError("BetaUpdateAgent404", BetaUpdateAgent404), + "408": decodeError("BetaUpdateAgent408", BetaUpdateAgent408), + "409": decodeError("BetaUpdateAgent409", BetaUpdateAgent409), + "412": decodeError("BetaUpdateAgent412", BetaUpdateAgent412), + "413": decodeError("BetaUpdateAgent413", BetaUpdateAgent413), + "429": decodeError("BetaUpdateAgent429", BetaUpdateAgent429), + "431": decodeError("BetaUpdateAgent431", BetaUpdateAgent431), + "499": decodeError("BetaUpdateAgent499", BetaUpdateAgent499), + "500": decodeError("BetaUpdateAgent500", BetaUpdateAgent500), + "501": decodeError("BetaUpdateAgent501", BetaUpdateAgent501), + "503": decodeError("BetaUpdateAgent503", BetaUpdateAgent503), + "504": decodeError("BetaUpdateAgent504", BetaUpdateAgent504), orElse: unexpectedStatus })) ), - "getSkillV1SkillsSkillIdGet": (skillId, options) => - HttpClientRequest.get(`/v1/skills/${skillId}`).pipe( + "BetaArchiveAgent": (agentId, options) => + HttpClientRequest.post(`/v1/agents/${agentId}/archive?beta=true`).pipe( HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(GetSkillV1SkillsSkillIdGet200), - "4xx": decodeError("GetSkillV1SkillsSkillIdGet4XX", GetSkillV1SkillsSkillIdGet4XX), + "2xx": decodeSuccess(BetaArchiveAgent200), + "400": decodeError("BetaArchiveAgent400", BetaArchiveAgent400), + "401": decodeError("BetaArchiveAgent401", BetaArchiveAgent401), + "403": decodeError("BetaArchiveAgent403", BetaArchiveAgent403), + "404": decodeError("BetaArchiveAgent404", BetaArchiveAgent404), + "408": decodeError("BetaArchiveAgent408", BetaArchiveAgent408), + "409": decodeError("BetaArchiveAgent409", BetaArchiveAgent409), + "412": decodeError("BetaArchiveAgent412", BetaArchiveAgent412), + "413": decodeError("BetaArchiveAgent413", BetaArchiveAgent413), + "429": decodeError("BetaArchiveAgent429", BetaArchiveAgent429), + "431": decodeError("BetaArchiveAgent431", BetaArchiveAgent431), + "499": decodeError("BetaArchiveAgent499", BetaArchiveAgent499), + "500": decodeError("BetaArchiveAgent500", BetaArchiveAgent500), + "501": decodeError("BetaArchiveAgent501", BetaArchiveAgent501), + "503": decodeError("BetaArchiveAgent503", BetaArchiveAgent503), + "504": decodeError("BetaArchiveAgent504", BetaArchiveAgent504), orElse: unexpectedStatus })) ), - "deleteSkillV1SkillsSkillIdDelete": (skillId, options) => - HttpClientRequest.delete(`/v1/skills/${skillId}`).pipe( + "BetaListAgentVersions": (agentId, options) => + HttpClientRequest.get(`/v1/agents/${agentId}/versions?beta=true`).pipe( + HttpClientRequest.setUrlParams({ + "limit": options?.params?.["limit"] as any, + "page": options?.params?.["page"] as any + }), HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(DeleteSkillV1SkillsSkillIdDelete200), - "4xx": decodeError("DeleteSkillV1SkillsSkillIdDelete4XX", DeleteSkillV1SkillsSkillIdDelete4XX), + "2xx": decodeSuccess(BetaListAgentVersions200), + "400": decodeError("BetaListAgentVersions400", BetaListAgentVersions400), + "401": decodeError("BetaListAgentVersions401", BetaListAgentVersions401), + "403": decodeError("BetaListAgentVersions403", BetaListAgentVersions403), + "404": decodeError("BetaListAgentVersions404", BetaListAgentVersions404), + "408": decodeError("BetaListAgentVersions408", BetaListAgentVersions408), + "409": decodeError("BetaListAgentVersions409", BetaListAgentVersions409), + "412": decodeError("BetaListAgentVersions412", BetaListAgentVersions412), + "413": decodeError("BetaListAgentVersions413", BetaListAgentVersions413), + "429": decodeError("BetaListAgentVersions429", BetaListAgentVersions429), + "431": decodeError("BetaListAgentVersions431", BetaListAgentVersions431), + "499": decodeError("BetaListAgentVersions499", BetaListAgentVersions499), + "500": decodeError("BetaListAgentVersions500", BetaListAgentVersions500), + "501": decodeError("BetaListAgentVersions501", BetaListAgentVersions501), + "503": decodeError("BetaListAgentVersions503", BetaListAgentVersions503), + "504": decodeError("BetaListAgentVersions504", BetaListAgentVersions504), orElse: unexpectedStatus })) ), - "listSkillVersionsV1SkillsSkillIdVersionsGet": (skillId, options) => - HttpClientRequest.get(`/v1/skills/${skillId}/versions`).pipe( + "BetaListVaults": (options) => + HttpClientRequest.get(`/v1/vaults?beta=true`).pipe( HttpClientRequest.setUrlParams({ + "limit": options?.params?.["limit"] as any, "page": options?.params?.["page"] as any, - "limit": options?.params?.["limit"] as any + "include_archived": options?.params?.["include_archived"] as any }), HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(ListSkillVersionsV1SkillsSkillIdVersionsGet200), - "4xx": decodeError( - "ListSkillVersionsV1SkillsSkillIdVersionsGet4XX", - ListSkillVersionsV1SkillsSkillIdVersionsGet4XX - ), + "2xx": decodeSuccess(BetaListVaults200), + "400": decodeError("BetaListVaults400", BetaListVaults400), + "401": decodeError("BetaListVaults401", BetaListVaults401), + "403": decodeError("BetaListVaults403", BetaListVaults403), + "404": decodeError("BetaListVaults404", BetaListVaults404), + "408": decodeError("BetaListVaults408", BetaListVaults408), + "409": decodeError("BetaListVaults409", BetaListVaults409), + "412": decodeError("BetaListVaults412", BetaListVaults412), + "413": decodeError("BetaListVaults413", BetaListVaults413), + "429": decodeError("BetaListVaults429", BetaListVaults429), + "431": decodeError("BetaListVaults431", BetaListVaults431), + "499": decodeError("BetaListVaults499", BetaListVaults499), + "500": decodeError("BetaListVaults500", BetaListVaults500), + "501": decodeError("BetaListVaults501", BetaListVaults501), + "503": decodeError("BetaListVaults503", BetaListVaults503), + "504": decodeError("BetaListVaults504", BetaListVaults504), orElse: unexpectedStatus })) ), - "createSkillVersionV1SkillsSkillIdVersionsPost": (skillId, options) => - HttpClientRequest.post(`/v1/skills/${skillId}/versions`).pipe( + "BetaCreateVault": (options) => + HttpClientRequest.post(`/v1/vaults?beta=true`).pipe( HttpClientRequest.setHeaders({ - "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined, - "anthropic-version": options.params?.["anthropic-version"] ?? undefined + "anthropic-version": options.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined }), - HttpClientRequest.bodyFormData(options.payload as any), + HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(CreateSkillVersionV1SkillsSkillIdVersionsPost200), - "4xx": decodeError( - "CreateSkillVersionV1SkillsSkillIdVersionsPost4XX", - CreateSkillVersionV1SkillsSkillIdVersionsPost4XX - ), + "2xx": decodeSuccess(BetaCreateVault200), + "400": decodeError("BetaCreateVault400", BetaCreateVault400), + "401": decodeError("BetaCreateVault401", BetaCreateVault401), + "403": decodeError("BetaCreateVault403", BetaCreateVault403), + "404": decodeError("BetaCreateVault404", BetaCreateVault404), + "408": decodeError("BetaCreateVault408", BetaCreateVault408), + "409": decodeError("BetaCreateVault409", BetaCreateVault409), + "412": decodeError("BetaCreateVault412", BetaCreateVault412), + "413": decodeError("BetaCreateVault413", BetaCreateVault413), + "429": decodeError("BetaCreateVault429", BetaCreateVault429), + "431": decodeError("BetaCreateVault431", BetaCreateVault431), + "499": decodeError("BetaCreateVault499", BetaCreateVault499), + "500": decodeError("BetaCreateVault500", BetaCreateVault500), + "501": decodeError("BetaCreateVault501", BetaCreateVault501), + "503": decodeError("BetaCreateVault503", BetaCreateVault503), + "504": decodeError("BetaCreateVault504", BetaCreateVault504), orElse: unexpectedStatus })) ), - "getSkillVersionV1SkillsSkillIdVersionsVersionGet": (skillId, version, options) => - HttpClientRequest.get(`/v1/skills/${skillId}/versions/${version}`).pipe( + "BetaGetVault": (vaultId, options) => + HttpClientRequest.get(`/v1/vaults/${vaultId}?beta=true`).pipe( HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(GetSkillVersionV1SkillsSkillIdVersionsVersionGet200), - "4xx": decodeError( - "GetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX", - GetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX - ), + "2xx": decodeSuccess(BetaGetVault200), + "400": decodeError("BetaGetVault400", BetaGetVault400), + "401": decodeError("BetaGetVault401", BetaGetVault401), + "403": decodeError("BetaGetVault403", BetaGetVault403), + "404": decodeError("BetaGetVault404", BetaGetVault404), + "408": decodeError("BetaGetVault408", BetaGetVault408), + "409": decodeError("BetaGetVault409", BetaGetVault409), + "412": decodeError("BetaGetVault412", BetaGetVault412), + "413": decodeError("BetaGetVault413", BetaGetVault413), + "429": decodeError("BetaGetVault429", BetaGetVault429), + "431": decodeError("BetaGetVault431", BetaGetVault431), + "499": decodeError("BetaGetVault499", BetaGetVault499), + "500": decodeError("BetaGetVault500", BetaGetVault500), + "501": decodeError("BetaGetVault501", BetaGetVault501), + "503": decodeError("BetaGetVault503", BetaGetVault503), + "504": decodeError("BetaGetVault504", BetaGetVault504), orElse: unexpectedStatus })) ), - "deleteSkillVersionV1SkillsSkillIdVersionsVersionDelete": (skillId, version, options) => - HttpClientRequest.delete(`/v1/skills/${skillId}/versions/${version}`).pipe( + "BetaUpdateVault": (vaultId, options) => + HttpClientRequest.post(`/v1/vaults/${vaultId}?beta=true`).pipe( HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, - "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-version": options.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined }), - withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(DeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete200), - "4xx": decodeError( - "DeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX", - DeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX - ), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaUpdateVault200), + "400": decodeError("BetaUpdateVault400", BetaUpdateVault400), + "401": decodeError("BetaUpdateVault401", BetaUpdateVault401), + "403": decodeError("BetaUpdateVault403", BetaUpdateVault403), + "404": decodeError("BetaUpdateVault404", BetaUpdateVault404), + "408": decodeError("BetaUpdateVault408", BetaUpdateVault408), + "409": decodeError("BetaUpdateVault409", BetaUpdateVault409), + "412": decodeError("BetaUpdateVault412", BetaUpdateVault412), + "413": decodeError("BetaUpdateVault413", BetaUpdateVault413), + "429": decodeError("BetaUpdateVault429", BetaUpdateVault429), + "431": decodeError("BetaUpdateVault431", BetaUpdateVault431), + "499": decodeError("BetaUpdateVault499", BetaUpdateVault499), + "500": decodeError("BetaUpdateVault500", BetaUpdateVault500), + "501": decodeError("BetaUpdateVault501", BetaUpdateVault501), + "503": decodeError("BetaUpdateVault503", BetaUpdateVault503), + "504": decodeError("BetaUpdateVault504", BetaUpdateVault504), orElse: unexpectedStatus })) ), - "betaMessagesPost": (options) => - HttpClientRequest.post(`/v1/messages?beta=true`).pipe( + "BetaDeleteVault": (vaultId, options) => + HttpClientRequest.delete(`/v1/vaults/${vaultId}?beta=true`).pipe( HttpClientRequest.setHeaders({ - "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined, - "anthropic-version": options.params?.["anthropic-version"] ?? undefined + "x-api-key": options?.params?.["x-api-key"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), - HttpClientRequest.bodyJsonUnsafe(options.payload), - withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BetaMessagesPost200), - "4xx": decodeError("BetaMessagesPost4XX", BetaMessagesPost4XX), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaDeleteVault200), + "400": decodeError("BetaDeleteVault400", BetaDeleteVault400), + "401": decodeError("BetaDeleteVault401", BetaDeleteVault401), + "403": decodeError("BetaDeleteVault403", BetaDeleteVault403), + "404": decodeError("BetaDeleteVault404", BetaDeleteVault404), + "408": decodeError("BetaDeleteVault408", BetaDeleteVault408), + "409": decodeError("BetaDeleteVault409", BetaDeleteVault409), + "412": decodeError("BetaDeleteVault412", BetaDeleteVault412), + "413": decodeError("BetaDeleteVault413", BetaDeleteVault413), + "429": decodeError("BetaDeleteVault429", BetaDeleteVault429), + "431": decodeError("BetaDeleteVault431", BetaDeleteVault431), + "499": decodeError("BetaDeleteVault499", BetaDeleteVault499), + "500": decodeError("BetaDeleteVault500", BetaDeleteVault500), + "501": decodeError("BetaDeleteVault501", BetaDeleteVault501), + "503": decodeError("BetaDeleteVault503", BetaDeleteVault503), + "504": decodeError("BetaDeleteVault504", BetaDeleteVault504), orElse: unexpectedStatus })) ), - "betaModelsList": (options) => - HttpClientRequest.get(`/v1/models?beta=true`).pipe( - HttpClientRequest.setUrlParams({ - "before_id": options?.params?.["before_id"] as any, - "after_id": options?.params?.["after_id"] as any, - "limit": options?.params?.["limit"] as any - }), + "BetaArchiveVault": (vaultId, options) => + HttpClientRequest.post(`/v1/vaults/${vaultId}/archive?beta=true`).pipe( HttpClientRequest.setHeaders({ "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BetaModelsList200), - "4xx": decodeError("BetaModelsList4XX", BetaModelsList4XX), + "2xx": decodeSuccess(BetaArchiveVault200), + "400": decodeError("BetaArchiveVault400", BetaArchiveVault400), + "401": decodeError("BetaArchiveVault401", BetaArchiveVault401), + "403": decodeError("BetaArchiveVault403", BetaArchiveVault403), + "404": decodeError("BetaArchiveVault404", BetaArchiveVault404), + "408": decodeError("BetaArchiveVault408", BetaArchiveVault408), + "409": decodeError("BetaArchiveVault409", BetaArchiveVault409), + "412": decodeError("BetaArchiveVault412", BetaArchiveVault412), + "413": decodeError("BetaArchiveVault413", BetaArchiveVault413), + "429": decodeError("BetaArchiveVault429", BetaArchiveVault429), + "431": decodeError("BetaArchiveVault431", BetaArchiveVault431), + "499": decodeError("BetaArchiveVault499", BetaArchiveVault499), + "500": decodeError("BetaArchiveVault500", BetaArchiveVault500), + "501": decodeError("BetaArchiveVault501", BetaArchiveVault501), + "503": decodeError("BetaArchiveVault503", BetaArchiveVault503), + "504": decodeError("BetaArchiveVault504", BetaArchiveVault504), orElse: unexpectedStatus })) ), - "betaModelsGet": (modelId, options) => - HttpClientRequest.get(`/v1/models/${modelId}?beta=true`).pipe( + "BetaListCredentials": (vaultId, options) => + HttpClientRequest.get(`/v1/vaults/${vaultId}/credentials?beta=true`).pipe( + HttpClientRequest.setUrlParams({ + "limit": options?.params?.["limit"] as any, + "page": options?.params?.["page"] as any, + "include_archived": options?.params?.["include_archived"] as any + }), HttpClientRequest.setHeaders({ - "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, "x-api-key": options?.params?.["x-api-key"] ?? undefined, + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BetaModelsGet200), - "4xx": decodeError("BetaModelsGet4XX", BetaModelsGet4XX), + "2xx": decodeSuccess(BetaListCredentials200), + "400": decodeError("BetaListCredentials400", BetaListCredentials400), + "401": decodeError("BetaListCredentials401", BetaListCredentials401), + "403": decodeError("BetaListCredentials403", BetaListCredentials403), + "404": decodeError("BetaListCredentials404", BetaListCredentials404), + "408": decodeError("BetaListCredentials408", BetaListCredentials408), + "409": decodeError("BetaListCredentials409", BetaListCredentials409), + "412": decodeError("BetaListCredentials412", BetaListCredentials412), + "413": decodeError("BetaListCredentials413", BetaListCredentials413), + "429": decodeError("BetaListCredentials429", BetaListCredentials429), + "431": decodeError("BetaListCredentials431", BetaListCredentials431), + "499": decodeError("BetaListCredentials499", BetaListCredentials499), + "500": decodeError("BetaListCredentials500", BetaListCredentials500), + "501": decodeError("BetaListCredentials501", BetaListCredentials501), + "503": decodeError("BetaListCredentials503", BetaListCredentials503), + "504": decodeError("BetaListCredentials504", BetaListCredentials504), orElse: unexpectedStatus })) ), - "betaMessageBatchesList": (options) => - HttpClientRequest.get(`/v1/messages/batches?beta=true`).pipe( - HttpClientRequest.setUrlParams({ - "before_id": options?.params?.["before_id"] as any, - "after_id": options?.params?.["after_id"] as any, - "limit": options?.params?.["limit"] as any + "BetaCreateCredential": (vaultId, options) => + HttpClientRequest.post(`/v1/vaults/${vaultId}/credentials?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-version": options.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaCreateCredential200), + "400": decodeError("BetaCreateCredential400", BetaCreateCredential400), + "401": decodeError("BetaCreateCredential401", BetaCreateCredential401), + "403": decodeError("BetaCreateCredential403", BetaCreateCredential403), + "404": decodeError("BetaCreateCredential404", BetaCreateCredential404), + "408": decodeError("BetaCreateCredential408", BetaCreateCredential408), + "409": decodeError("BetaCreateCredential409", BetaCreateCredential409), + "412": decodeError("BetaCreateCredential412", BetaCreateCredential412), + "413": decodeError("BetaCreateCredential413", BetaCreateCredential413), + "429": decodeError("BetaCreateCredential429", BetaCreateCredential429), + "431": decodeError("BetaCreateCredential431", BetaCreateCredential431), + "499": decodeError("BetaCreateCredential499", BetaCreateCredential499), + "500": decodeError("BetaCreateCredential500", BetaCreateCredential500), + "501": decodeError("BetaCreateCredential501", BetaCreateCredential501), + "503": decodeError("BetaCreateCredential503", BetaCreateCredential503), + "504": decodeError("BetaCreateCredential504", BetaCreateCredential504), + orElse: unexpectedStatus + })) + ), + "BetaGetCredential": (vaultId, credentialId, options) => + HttpClientRequest.get(`/v1/vaults/${vaultId}/credentials/${credentialId}?beta=true`).pipe( HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BetaMessageBatchesList200), - "4xx": decodeError("BetaMessageBatchesList4XX", BetaMessageBatchesList4XX), + "2xx": decodeSuccess(BetaGetCredential200), + "400": decodeError("BetaGetCredential400", BetaGetCredential400), + "401": decodeError("BetaGetCredential401", BetaGetCredential401), + "403": decodeError("BetaGetCredential403", BetaGetCredential403), + "404": decodeError("BetaGetCredential404", BetaGetCredential404), + "408": decodeError("BetaGetCredential408", BetaGetCredential408), + "409": decodeError("BetaGetCredential409", BetaGetCredential409), + "412": decodeError("BetaGetCredential412", BetaGetCredential412), + "413": decodeError("BetaGetCredential413", BetaGetCredential413), + "429": decodeError("BetaGetCredential429", BetaGetCredential429), + "431": decodeError("BetaGetCredential431", BetaGetCredential431), + "499": decodeError("BetaGetCredential499", BetaGetCredential499), + "500": decodeError("BetaGetCredential500", BetaGetCredential500), + "501": decodeError("BetaGetCredential501", BetaGetCredential501), + "503": decodeError("BetaGetCredential503", BetaGetCredential503), + "504": decodeError("BetaGetCredential504", BetaGetCredential504), orElse: unexpectedStatus })) ), - "betaMessageBatchesPost": (options) => - HttpClientRequest.post(`/v1/messages/batches?beta=true`).pipe( + "BetaUpdateCredential": (vaultId, credentialId, options) => + HttpClientRequest.post(`/v1/vaults/${vaultId}/credentials/${credentialId}?beta=true`).pipe( HttpClientRequest.setHeaders({ - "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined, - "anthropic-version": options.params?.["anthropic-version"] ?? undefined + "anthropic-version": options.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined }), HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BetaMessageBatchesPost200), - "4xx": decodeError("BetaMessageBatchesPost4XX", BetaMessageBatchesPost4XX), + "2xx": decodeSuccess(BetaUpdateCredential200), + "400": decodeError("BetaUpdateCredential400", BetaUpdateCredential400), + "401": decodeError("BetaUpdateCredential401", BetaUpdateCredential401), + "403": decodeError("BetaUpdateCredential403", BetaUpdateCredential403), + "404": decodeError("BetaUpdateCredential404", BetaUpdateCredential404), + "408": decodeError("BetaUpdateCredential408", BetaUpdateCredential408), + "409": decodeError("BetaUpdateCredential409", BetaUpdateCredential409), + "412": decodeError("BetaUpdateCredential412", BetaUpdateCredential412), + "413": decodeError("BetaUpdateCredential413", BetaUpdateCredential413), + "429": decodeError("BetaUpdateCredential429", BetaUpdateCredential429), + "431": decodeError("BetaUpdateCredential431", BetaUpdateCredential431), + "499": decodeError("BetaUpdateCredential499", BetaUpdateCredential499), + "500": decodeError("BetaUpdateCredential500", BetaUpdateCredential500), + "501": decodeError("BetaUpdateCredential501", BetaUpdateCredential501), + "503": decodeError("BetaUpdateCredential503", BetaUpdateCredential503), + "504": decodeError("BetaUpdateCredential504", BetaUpdateCredential504), orElse: unexpectedStatus })) ), - "betaMessageBatchesRetrieve": (messageBatchId, options) => - HttpClientRequest.get(`/v1/messages/batches/${messageBatchId}?beta=true`).pipe( + "BetaDeleteCredential": (vaultId, credentialId, options) => + HttpClientRequest.delete(`/v1/vaults/${vaultId}/credentials/${credentialId}?beta=true`).pipe( HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BetaMessageBatchesRetrieve200), - "4xx": decodeError("BetaMessageBatchesRetrieve4XX", BetaMessageBatchesRetrieve4XX), + "2xx": decodeSuccess(BetaDeleteCredential200), + "400": decodeError("BetaDeleteCredential400", BetaDeleteCredential400), + "401": decodeError("BetaDeleteCredential401", BetaDeleteCredential401), + "403": decodeError("BetaDeleteCredential403", BetaDeleteCredential403), + "404": decodeError("BetaDeleteCredential404", BetaDeleteCredential404), + "408": decodeError("BetaDeleteCredential408", BetaDeleteCredential408), + "409": decodeError("BetaDeleteCredential409", BetaDeleteCredential409), + "412": decodeError("BetaDeleteCredential412", BetaDeleteCredential412), + "413": decodeError("BetaDeleteCredential413", BetaDeleteCredential413), + "429": decodeError("BetaDeleteCredential429", BetaDeleteCredential429), + "431": decodeError("BetaDeleteCredential431", BetaDeleteCredential431), + "499": decodeError("BetaDeleteCredential499", BetaDeleteCredential499), + "500": decodeError("BetaDeleteCredential500", BetaDeleteCredential500), + "501": decodeError("BetaDeleteCredential501", BetaDeleteCredential501), + "503": decodeError("BetaDeleteCredential503", BetaDeleteCredential503), + "504": decodeError("BetaDeleteCredential504", BetaDeleteCredential504), orElse: unexpectedStatus })) ), - "betaMessageBatchesDelete": (messageBatchId, options) => - HttpClientRequest.delete(`/v1/messages/batches/${messageBatchId}?beta=true`).pipe( + "BetaArchiveCredential": (vaultId, credentialId, options) => + HttpClientRequest.post(`/v1/vaults/${vaultId}/credentials/${credentialId}/archive?beta=true`).pipe( HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BetaMessageBatchesDelete200), - "4xx": decodeError("BetaMessageBatchesDelete4XX", BetaMessageBatchesDelete4XX), + "2xx": decodeSuccess(BetaArchiveCredential200), + "400": decodeError("BetaArchiveCredential400", BetaArchiveCredential400), + "401": decodeError("BetaArchiveCredential401", BetaArchiveCredential401), + "403": decodeError("BetaArchiveCredential403", BetaArchiveCredential403), + "404": decodeError("BetaArchiveCredential404", BetaArchiveCredential404), + "408": decodeError("BetaArchiveCredential408", BetaArchiveCredential408), + "409": decodeError("BetaArchiveCredential409", BetaArchiveCredential409), + "412": decodeError("BetaArchiveCredential412", BetaArchiveCredential412), + "413": decodeError("BetaArchiveCredential413", BetaArchiveCredential413), + "429": decodeError("BetaArchiveCredential429", BetaArchiveCredential429), + "431": decodeError("BetaArchiveCredential431", BetaArchiveCredential431), + "499": decodeError("BetaArchiveCredential499", BetaArchiveCredential499), + "500": decodeError("BetaArchiveCredential500", BetaArchiveCredential500), + "501": decodeError("BetaArchiveCredential501", BetaArchiveCredential501), + "503": decodeError("BetaArchiveCredential503", BetaArchiveCredential503), + "504": decodeError("BetaArchiveCredential504", BetaArchiveCredential504), orElse: unexpectedStatus })) ), - "betaMessageBatchesCancel": (messageBatchId, options) => - HttpClientRequest.post(`/v1/messages/batches/${messageBatchId}/cancel?beta=true`).pipe( + "BetaValidateCredential": (vaultId, credentialId, options) => + HttpClientRequest.post(`/v1/vaults/${vaultId}/credentials/${credentialId}/mcp_oauth_validate?beta=true`).pipe( HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, - "anthropic-version": options?.params?.["anthropic-version"] ?? undefined + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BetaMessageBatchesCancel200), - "4xx": decodeError("BetaMessageBatchesCancel4XX", BetaMessageBatchesCancel4XX), + "2xx": decodeSuccess(BetaValidateCredential200), + "400": decodeError("BetaValidateCredential400", BetaValidateCredential400), + "401": decodeError("BetaValidateCredential401", BetaValidateCredential401), + "403": decodeError("BetaValidateCredential403", BetaValidateCredential403), + "404": decodeError("BetaValidateCredential404", BetaValidateCredential404), + "408": decodeError("BetaValidateCredential408", BetaValidateCredential408), + "409": decodeError("BetaValidateCredential409", BetaValidateCredential409), + "412": decodeError("BetaValidateCredential412", BetaValidateCredential412), + "413": decodeError("BetaValidateCredential413", BetaValidateCredential413), + "429": decodeError("BetaValidateCredential429", BetaValidateCredential429), + "431": decodeError("BetaValidateCredential431", BetaValidateCredential431), + "499": decodeError("BetaValidateCredential499", BetaValidateCredential499), + "500": decodeError("BetaValidateCredential500", BetaValidateCredential500), + "501": decodeError("BetaValidateCredential501", BetaValidateCredential501), + "503": decodeError("BetaValidateCredential503", BetaValidateCredential503), + "504": decodeError("BetaValidateCredential504", BetaValidateCredential504), orElse: unexpectedStatus })) ), - "betaMessageBatchesResults": (messageBatchId, options) => - HttpClientRequest.get(`/v1/messages/batches/${messageBatchId}/results?beta=true`).pipe( + "BetaListMemories": (memoryStoreId, options) => + HttpClientRequest.get(`/v1/memory_stores/${memoryStoreId}/memories?beta=true`).pipe( + HttpClientRequest.setUrlParams({ + "path_prefix": options?.params?.["path_prefix"] as any, + "depth": options?.params?.["depth"] as any, + "order_by": options?.params?.["order_by"] as any, + "order": options?.params?.["order"] as any, + "limit": options?.params?.["limit"] as any, + "page": options?.params?.["page"] as any, + "view": options?.params?.["view"] as any + }), HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "4xx": decodeError("BetaMessageBatchesResults4XX", BetaMessageBatchesResults4XX), + "2xx": decodeSuccess(BetaListMemories200), + "400": decodeError("BetaListMemories400", BetaListMemories400), + "401": decodeError("BetaListMemories401", BetaListMemories401), + "403": decodeError("BetaListMemories403", BetaListMemories403), + "404": decodeError("BetaListMemories404", BetaListMemories404), + "408": decodeError("BetaListMemories408", BetaListMemories408), + "409": decodeError("BetaListMemories409", BetaListMemories409), + "412": decodeError("BetaListMemories412", BetaListMemories412), + "413": decodeError("BetaListMemories413", BetaListMemories413), + "429": decodeError("BetaListMemories429", BetaListMemories429), + "431": decodeError("BetaListMemories431", BetaListMemories431), + "499": decodeError("BetaListMemories499", BetaListMemories499), + "500": decodeError("BetaListMemories500", BetaListMemories500), + "501": decodeError("BetaListMemories501", BetaListMemories501), + "503": decodeError("BetaListMemories503", BetaListMemories503), + "504": decodeError("BetaListMemories504", BetaListMemories504), orElse: unexpectedStatus })) ), - "betaMessagesCountTokensPost": (options) => - HttpClientRequest.post(`/v1/messages/count_tokens?beta=true`).pipe( + "BetaCreateMemory": (memoryStoreId, options) => + HttpClientRequest.post(`/v1/memory_stores/${memoryStoreId}/memories?beta=true`).pipe( + HttpClientRequest.setUrlParams({ "view": options.params?.["view"] as any }), HttpClientRequest.setHeaders({ - "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined, - "anthropic-version": options.params?.["anthropic-version"] ?? undefined + "anthropic-version": options.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined }), HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BetaMessagesCountTokensPost200), - "4xx": decodeError("BetaMessagesCountTokensPost4XX", BetaMessagesCountTokensPost4XX), + "2xx": decodeSuccess(BetaCreateMemory200), + "400": decodeError("BetaCreateMemory400", BetaCreateMemory400), + "401": decodeError("BetaCreateMemory401", BetaCreateMemory401), + "403": decodeError("BetaCreateMemory403", BetaCreateMemory403), + "404": decodeError("BetaCreateMemory404", BetaCreateMemory404), + "408": decodeError("BetaCreateMemory408", BetaCreateMemory408), + "409": decodeError("BetaCreateMemory409", BetaCreateMemory409), + "412": decodeError("BetaCreateMemory412", BetaCreateMemory412), + "413": decodeError("BetaCreateMemory413", BetaCreateMemory413), + "429": decodeError("BetaCreateMemory429", BetaCreateMemory429), + "431": decodeError("BetaCreateMemory431", BetaCreateMemory431), + "499": decodeError("BetaCreateMemory499", BetaCreateMemory499), + "500": decodeError("BetaCreateMemory500", BetaCreateMemory500), + "501": decodeError("BetaCreateMemory501", BetaCreateMemory501), + "503": decodeError("BetaCreateMemory503", BetaCreateMemory503), + "504": decodeError("BetaCreateMemory504", BetaCreateMemory504), orElse: unexpectedStatus })) ), - "betaListFilesV1FilesGet": (options) => - HttpClientRequest.get(`/v1/files?beta=true`).pipe( - HttpClientRequest.setUrlParams({ - "before_id": options?.params?.["before_id"] as any, - "after_id": options?.params?.["after_id"] as any, - "limit": options?.params?.["limit"] as any - }), + "BetaGetMemory": (memoryStoreId, memoryId, options) => + HttpClientRequest.get(`/v1/memory_stores/${memoryStoreId}/memories/${memoryId}?beta=true`).pipe( + HttpClientRequest.setUrlParams({ "view": options?.params?.["view"] as any }), HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BetaListFilesV1FilesGet200), - "4xx": decodeError("BetaListFilesV1FilesGet4XX", BetaListFilesV1FilesGet4XX), + "2xx": decodeSuccess(BetaGetMemory200), + "400": decodeError("BetaGetMemory400", BetaGetMemory400), + "401": decodeError("BetaGetMemory401", BetaGetMemory401), + "403": decodeError("BetaGetMemory403", BetaGetMemory403), + "404": decodeError("BetaGetMemory404", BetaGetMemory404), + "408": decodeError("BetaGetMemory408", BetaGetMemory408), + "409": decodeError("BetaGetMemory409", BetaGetMemory409), + "412": decodeError("BetaGetMemory412", BetaGetMemory412), + "413": decodeError("BetaGetMemory413", BetaGetMemory413), + "429": decodeError("BetaGetMemory429", BetaGetMemory429), + "431": decodeError("BetaGetMemory431", BetaGetMemory431), + "499": decodeError("BetaGetMemory499", BetaGetMemory499), + "500": decodeError("BetaGetMemory500", BetaGetMemory500), + "501": decodeError("BetaGetMemory501", BetaGetMemory501), + "503": decodeError("BetaGetMemory503", BetaGetMemory503), + "504": decodeError("BetaGetMemory504", BetaGetMemory504), orElse: unexpectedStatus })) ), - "betaUploadFileV1FilesPost": (options) => - HttpClientRequest.post(`/v1/files?beta=true`).pipe( + "BetaUpdateMemory": (memoryStoreId, memoryId, options) => + HttpClientRequest.post(`/v1/memory_stores/${memoryStoreId}/memories/${memoryId}?beta=true`).pipe( + HttpClientRequest.setUrlParams({ "view": options.params?.["view"] as any }), HttpClientRequest.setHeaders({ - "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined, - "anthropic-version": options.params?.["anthropic-version"] ?? undefined + "anthropic-version": options.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined }), - HttpClientRequest.bodyFormData(options.payload as any), + HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BetaUploadFileV1FilesPost200), - "4xx": decodeError("BetaUploadFileV1FilesPost4XX", BetaUploadFileV1FilesPost4XX), + "2xx": decodeSuccess(BetaUpdateMemory200), + "400": decodeError("BetaUpdateMemory400", BetaUpdateMemory400), + "401": decodeError("BetaUpdateMemory401", BetaUpdateMemory401), + "403": decodeError("BetaUpdateMemory403", BetaUpdateMemory403), + "404": decodeError("BetaUpdateMemory404", BetaUpdateMemory404), + "408": decodeError("BetaUpdateMemory408", BetaUpdateMemory408), + "409": decodeError("BetaUpdateMemory409", BetaUpdateMemory409), + "412": decodeError("BetaUpdateMemory412", BetaUpdateMemory412), + "413": decodeError("BetaUpdateMemory413", BetaUpdateMemory413), + "429": decodeError("BetaUpdateMemory429", BetaUpdateMemory429), + "431": decodeError("BetaUpdateMemory431", BetaUpdateMemory431), + "499": decodeError("BetaUpdateMemory499", BetaUpdateMemory499), + "500": decodeError("BetaUpdateMemory500", BetaUpdateMemory500), + "501": decodeError("BetaUpdateMemory501", BetaUpdateMemory501), + "503": decodeError("BetaUpdateMemory503", BetaUpdateMemory503), + "504": decodeError("BetaUpdateMemory504", BetaUpdateMemory504), orElse: unexpectedStatus })) ), - "betaGetFileMetadataV1FilesFileIdGet": (fileId, options) => - HttpClientRequest.get(`/v1/files/${fileId}?beta=true`).pipe( + "BetaDeleteMemory": (memoryStoreId, memoryId, options) => + HttpClientRequest.delete(`/v1/memory_stores/${memoryStoreId}/memories/${memoryId}?beta=true`).pipe( + HttpClientRequest.setUrlParams({ + "expected_content_sha256": options?.params?.["expected_content_sha256"] as any + }), HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BetaGetFileMetadataV1FilesFileIdGet200), - "4xx": decodeError("BetaGetFileMetadataV1FilesFileIdGet4XX", BetaGetFileMetadataV1FilesFileIdGet4XX), + "2xx": decodeSuccess(BetaDeleteMemory200), + "400": decodeError("BetaDeleteMemory400", BetaDeleteMemory400), + "401": decodeError("BetaDeleteMemory401", BetaDeleteMemory401), + "403": decodeError("BetaDeleteMemory403", BetaDeleteMemory403), + "404": decodeError("BetaDeleteMemory404", BetaDeleteMemory404), + "408": decodeError("BetaDeleteMemory408", BetaDeleteMemory408), + "409": decodeError("BetaDeleteMemory409", BetaDeleteMemory409), + "412": decodeError("BetaDeleteMemory412", BetaDeleteMemory412), + "413": decodeError("BetaDeleteMemory413", BetaDeleteMemory413), + "429": decodeError("BetaDeleteMemory429", BetaDeleteMemory429), + "431": decodeError("BetaDeleteMemory431", BetaDeleteMemory431), + "499": decodeError("BetaDeleteMemory499", BetaDeleteMemory499), + "500": decodeError("BetaDeleteMemory500", BetaDeleteMemory500), + "501": decodeError("BetaDeleteMemory501", BetaDeleteMemory501), + "503": decodeError("BetaDeleteMemory503", BetaDeleteMemory503), + "504": decodeError("BetaDeleteMemory504", BetaDeleteMemory504), orElse: unexpectedStatus })) ), - "betaDeleteFileV1FilesFileIdDelete": (fileId, options) => - HttpClientRequest.delete(`/v1/files/${fileId}?beta=true`).pipe( + "BetaListMemoryVersions": (memoryStoreId, options) => + HttpClientRequest.get(`/v1/memory_stores/${memoryStoreId}/memory_versions?beta=true`).pipe( + HttpClientRequest.setUrlParams({ + "memory_id": options?.params?.["memory_id"] as any, + "session_id": options?.params?.["session_id"] as any, + "api_key_id": options?.params?.["api_key_id"] as any, + "operation": options?.params?.["operation"] as any, + "created_at[gte]": options?.params?.["created_at[gte]"] as any, + "created_at[lte]": options?.params?.["created_at[lte]"] as any, + "limit": options?.params?.["limit"] as any, + "page": options?.params?.["page"] as any, + "view": options?.params?.["view"] as any + }), HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BetaDeleteFileV1FilesFileIdDelete200), - "4xx": decodeError("BetaDeleteFileV1FilesFileIdDelete4XX", BetaDeleteFileV1FilesFileIdDelete4XX), + "2xx": decodeSuccess(BetaListMemoryVersions200), + "400": decodeError("BetaListMemoryVersions400", BetaListMemoryVersions400), + "401": decodeError("BetaListMemoryVersions401", BetaListMemoryVersions401), + "403": decodeError("BetaListMemoryVersions403", BetaListMemoryVersions403), + "404": decodeError("BetaListMemoryVersions404", BetaListMemoryVersions404), + "408": decodeError("BetaListMemoryVersions408", BetaListMemoryVersions408), + "409": decodeError("BetaListMemoryVersions409", BetaListMemoryVersions409), + "412": decodeError("BetaListMemoryVersions412", BetaListMemoryVersions412), + "413": decodeError("BetaListMemoryVersions413", BetaListMemoryVersions413), + "429": decodeError("BetaListMemoryVersions429", BetaListMemoryVersions429), + "431": decodeError("BetaListMemoryVersions431", BetaListMemoryVersions431), + "499": decodeError("BetaListMemoryVersions499", BetaListMemoryVersions499), + "500": decodeError("BetaListMemoryVersions500", BetaListMemoryVersions500), + "501": decodeError("BetaListMemoryVersions501", BetaListMemoryVersions501), + "503": decodeError("BetaListMemoryVersions503", BetaListMemoryVersions503), + "504": decodeError("BetaListMemoryVersions504", BetaListMemoryVersions504), orElse: unexpectedStatus })) ), - "betaDownloadFileV1FilesFileIdContentGet": (fileId, options) => - HttpClientRequest.get(`/v1/files/${fileId}/content?beta=true`).pipe( + "BetaGetMemoryVersion": (memoryStoreId, memoryVersionId, options) => + HttpClientRequest.get(`/v1/memory_stores/${memoryStoreId}/memory_versions/${memoryVersionId}?beta=true`).pipe( + HttpClientRequest.setUrlParams({ "view": options?.params?.["view"] as any }), HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaGetMemoryVersion200), + "400": decodeError("BetaGetMemoryVersion400", BetaGetMemoryVersion400), + "401": decodeError("BetaGetMemoryVersion401", BetaGetMemoryVersion401), + "403": decodeError("BetaGetMemoryVersion403", BetaGetMemoryVersion403), + "404": decodeError("BetaGetMemoryVersion404", BetaGetMemoryVersion404), + "408": decodeError("BetaGetMemoryVersion408", BetaGetMemoryVersion408), + "409": decodeError("BetaGetMemoryVersion409", BetaGetMemoryVersion409), + "412": decodeError("BetaGetMemoryVersion412", BetaGetMemoryVersion412), + "413": decodeError("BetaGetMemoryVersion413", BetaGetMemoryVersion413), + "429": decodeError("BetaGetMemoryVersion429", BetaGetMemoryVersion429), + "431": decodeError("BetaGetMemoryVersion431", BetaGetMemoryVersion431), + "499": decodeError("BetaGetMemoryVersion499", BetaGetMemoryVersion499), + "500": decodeError("BetaGetMemoryVersion500", BetaGetMemoryVersion500), + "501": decodeError("BetaGetMemoryVersion501", BetaGetMemoryVersion501), + "503": decodeError("BetaGetMemoryVersion503", BetaGetMemoryVersion503), + "504": decodeError("BetaGetMemoryVersion504", BetaGetMemoryVersion504), orElse: unexpectedStatus })) ), - "betaDownloadFileV1FilesFileIdContentGetStream": (fileId, options) => - HttpClientRequest.get(`/v1/files/${fileId}/content?beta=true`).pipe( + "BetaRedactMemoryVersion": (memoryStoreId, memoryVersionId, options) => + HttpClientRequest.post(`/v1/memory_stores/${memoryStoreId}/memory_versions/${memoryVersionId}/redact?beta=true`) + .pipe( + HttpClientRequest.setHeaders({ + "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaRedactMemoryVersion200), + "400": decodeError("BetaRedactMemoryVersion400", BetaRedactMemoryVersion400), + "401": decodeError("BetaRedactMemoryVersion401", BetaRedactMemoryVersion401), + "403": decodeError("BetaRedactMemoryVersion403", BetaRedactMemoryVersion403), + "404": decodeError("BetaRedactMemoryVersion404", BetaRedactMemoryVersion404), + "408": decodeError("BetaRedactMemoryVersion408", BetaRedactMemoryVersion408), + "409": decodeError("BetaRedactMemoryVersion409", BetaRedactMemoryVersion409), + "412": decodeError("BetaRedactMemoryVersion412", BetaRedactMemoryVersion412), + "413": decodeError("BetaRedactMemoryVersion413", BetaRedactMemoryVersion413), + "429": decodeError("BetaRedactMemoryVersion429", BetaRedactMemoryVersion429), + "431": decodeError("BetaRedactMemoryVersion431", BetaRedactMemoryVersion431), + "499": decodeError("BetaRedactMemoryVersion499", BetaRedactMemoryVersion499), + "500": decodeError("BetaRedactMemoryVersion500", BetaRedactMemoryVersion500), + "501": decodeError("BetaRedactMemoryVersion501", BetaRedactMemoryVersion501), + "503": decodeError("BetaRedactMemoryVersion503", BetaRedactMemoryVersion503), + "504": decodeError("BetaRedactMemoryVersion504", BetaRedactMemoryVersion504), + orElse: unexpectedStatus + })) + ), + "BetaListMemoryStores": (options) => + HttpClientRequest.get(`/v1/memory_stores?beta=true`).pipe( + HttpClientRequest.setUrlParams({ + "limit": options?.params?.["limit"] as any, + "page": options?.params?.["page"] as any, + "include_archived": options?.params?.["include_archived"] as any, + "created_at[gte]": options?.params?.["created_at[gte]"] as any, + "created_at[lte]": options?.params?.["created_at[lte]"] as any + }), HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), - binaryRequest + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaListMemoryStores200), + "400": decodeError("BetaListMemoryStores400", BetaListMemoryStores400), + "401": decodeError("BetaListMemoryStores401", BetaListMemoryStores401), + "403": decodeError("BetaListMemoryStores403", BetaListMemoryStores403), + "404": decodeError("BetaListMemoryStores404", BetaListMemoryStores404), + "408": decodeError("BetaListMemoryStores408", BetaListMemoryStores408), + "409": decodeError("BetaListMemoryStores409", BetaListMemoryStores409), + "412": decodeError("BetaListMemoryStores412", BetaListMemoryStores412), + "413": decodeError("BetaListMemoryStores413", BetaListMemoryStores413), + "429": decodeError("BetaListMemoryStores429", BetaListMemoryStores429), + "431": decodeError("BetaListMemoryStores431", BetaListMemoryStores431), + "499": decodeError("BetaListMemoryStores499", BetaListMemoryStores499), + "500": decodeError("BetaListMemoryStores500", BetaListMemoryStores500), + "501": decodeError("BetaListMemoryStores501", BetaListMemoryStores501), + "503": decodeError("BetaListMemoryStores503", BetaListMemoryStores503), + "504": decodeError("BetaListMemoryStores504", BetaListMemoryStores504), + orElse: unexpectedStatus + })) ), - "betaListSkillsV1SkillsGet": (options) => - HttpClientRequest.get(`/v1/skills?beta=true`).pipe( - HttpClientRequest.setUrlParams({ - "page": options?.params?.["page"] as any, - "limit": options?.params?.["limit"] as any, - "source": options?.params?.["source"] as any + "BetaCreateMemoryStore": (options) => + HttpClientRequest.post(`/v1/memory_stores?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-version": options.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaCreateMemoryStore200), + "400": decodeError("BetaCreateMemoryStore400", BetaCreateMemoryStore400), + "401": decodeError("BetaCreateMemoryStore401", BetaCreateMemoryStore401), + "403": decodeError("BetaCreateMemoryStore403", BetaCreateMemoryStore403), + "404": decodeError("BetaCreateMemoryStore404", BetaCreateMemoryStore404), + "408": decodeError("BetaCreateMemoryStore408", BetaCreateMemoryStore408), + "409": decodeError("BetaCreateMemoryStore409", BetaCreateMemoryStore409), + "412": decodeError("BetaCreateMemoryStore412", BetaCreateMemoryStore412), + "413": decodeError("BetaCreateMemoryStore413", BetaCreateMemoryStore413), + "429": decodeError("BetaCreateMemoryStore429", BetaCreateMemoryStore429), + "431": decodeError("BetaCreateMemoryStore431", BetaCreateMemoryStore431), + "499": decodeError("BetaCreateMemoryStore499", BetaCreateMemoryStore499), + "500": decodeError("BetaCreateMemoryStore500", BetaCreateMemoryStore500), + "501": decodeError("BetaCreateMemoryStore501", BetaCreateMemoryStore501), + "503": decodeError("BetaCreateMemoryStore503", BetaCreateMemoryStore503), + "504": decodeError("BetaCreateMemoryStore504", BetaCreateMemoryStore504), + orElse: unexpectedStatus + })) + ), + "BetaGetMemoryStore": (memoryStoreId, options) => + HttpClientRequest.get(`/v1/memory_stores/${memoryStoreId}?beta=true`).pipe( HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BetaListSkillsV1SkillsGet200), - "4xx": decodeError("BetaListSkillsV1SkillsGet4XX", BetaListSkillsV1SkillsGet4XX), + "2xx": decodeSuccess(BetaGetMemoryStore200), + "400": decodeError("BetaGetMemoryStore400", BetaGetMemoryStore400), + "401": decodeError("BetaGetMemoryStore401", BetaGetMemoryStore401), + "403": decodeError("BetaGetMemoryStore403", BetaGetMemoryStore403), + "404": decodeError("BetaGetMemoryStore404", BetaGetMemoryStore404), + "408": decodeError("BetaGetMemoryStore408", BetaGetMemoryStore408), + "409": decodeError("BetaGetMemoryStore409", BetaGetMemoryStore409), + "412": decodeError("BetaGetMemoryStore412", BetaGetMemoryStore412), + "413": decodeError("BetaGetMemoryStore413", BetaGetMemoryStore413), + "429": decodeError("BetaGetMemoryStore429", BetaGetMemoryStore429), + "431": decodeError("BetaGetMemoryStore431", BetaGetMemoryStore431), + "499": decodeError("BetaGetMemoryStore499", BetaGetMemoryStore499), + "500": decodeError("BetaGetMemoryStore500", BetaGetMemoryStore500), + "501": decodeError("BetaGetMemoryStore501", BetaGetMemoryStore501), + "503": decodeError("BetaGetMemoryStore503", BetaGetMemoryStore503), + "504": decodeError("BetaGetMemoryStore504", BetaGetMemoryStore504), orElse: unexpectedStatus })) ), - "betaCreateSkillV1SkillsPost": (options) => - HttpClientRequest.post(`/v1/skills?beta=true`).pipe( + "BetaUpdateMemoryStore": (memoryStoreId, options) => + HttpClientRequest.post(`/v1/memory_stores/${memoryStoreId}?beta=true`).pipe( HttpClientRequest.setHeaders({ - "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined, - "anthropic-version": options.params?.["anthropic-version"] ?? undefined + "anthropic-version": options.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined }), - HttpClientRequest.bodyFormData(options.payload as any), + HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BetaCreateSkillV1SkillsPost200), - "4xx": decodeError("BetaCreateSkillV1SkillsPost4XX", BetaCreateSkillV1SkillsPost4XX), + "2xx": decodeSuccess(BetaUpdateMemoryStore200), + "400": decodeError("BetaUpdateMemoryStore400", BetaUpdateMemoryStore400), + "401": decodeError("BetaUpdateMemoryStore401", BetaUpdateMemoryStore401), + "403": decodeError("BetaUpdateMemoryStore403", BetaUpdateMemoryStore403), + "404": decodeError("BetaUpdateMemoryStore404", BetaUpdateMemoryStore404), + "408": decodeError("BetaUpdateMemoryStore408", BetaUpdateMemoryStore408), + "409": decodeError("BetaUpdateMemoryStore409", BetaUpdateMemoryStore409), + "412": decodeError("BetaUpdateMemoryStore412", BetaUpdateMemoryStore412), + "413": decodeError("BetaUpdateMemoryStore413", BetaUpdateMemoryStore413), + "429": decodeError("BetaUpdateMemoryStore429", BetaUpdateMemoryStore429), + "431": decodeError("BetaUpdateMemoryStore431", BetaUpdateMemoryStore431), + "499": decodeError("BetaUpdateMemoryStore499", BetaUpdateMemoryStore499), + "500": decodeError("BetaUpdateMemoryStore500", BetaUpdateMemoryStore500), + "501": decodeError("BetaUpdateMemoryStore501", BetaUpdateMemoryStore501), + "503": decodeError("BetaUpdateMemoryStore503", BetaUpdateMemoryStore503), + "504": decodeError("BetaUpdateMemoryStore504", BetaUpdateMemoryStore504), orElse: unexpectedStatus })) ), - "betaGetSkillV1SkillsSkillIdGet": (skillId, options) => - HttpClientRequest.get(`/v1/skills/${skillId}?beta=true`).pipe( + "BetaDeleteMemoryStore": (memoryStoreId, options) => + HttpClientRequest.delete(`/v1/memory_stores/${memoryStoreId}?beta=true`).pipe( HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BetaGetSkillV1SkillsSkillIdGet200), - "4xx": decodeError("BetaGetSkillV1SkillsSkillIdGet4XX", BetaGetSkillV1SkillsSkillIdGet4XX), + "2xx": decodeSuccess(BetaDeleteMemoryStore200), + "400": decodeError("BetaDeleteMemoryStore400", BetaDeleteMemoryStore400), + "401": decodeError("BetaDeleteMemoryStore401", BetaDeleteMemoryStore401), + "403": decodeError("BetaDeleteMemoryStore403", BetaDeleteMemoryStore403), + "404": decodeError("BetaDeleteMemoryStore404", BetaDeleteMemoryStore404), + "408": decodeError("BetaDeleteMemoryStore408", BetaDeleteMemoryStore408), + "409": decodeError("BetaDeleteMemoryStore409", BetaDeleteMemoryStore409), + "412": decodeError("BetaDeleteMemoryStore412", BetaDeleteMemoryStore412), + "413": decodeError("BetaDeleteMemoryStore413", BetaDeleteMemoryStore413), + "429": decodeError("BetaDeleteMemoryStore429", BetaDeleteMemoryStore429), + "431": decodeError("BetaDeleteMemoryStore431", BetaDeleteMemoryStore431), + "499": decodeError("BetaDeleteMemoryStore499", BetaDeleteMemoryStore499), + "500": decodeError("BetaDeleteMemoryStore500", BetaDeleteMemoryStore500), + "501": decodeError("BetaDeleteMemoryStore501", BetaDeleteMemoryStore501), + "503": decodeError("BetaDeleteMemoryStore503", BetaDeleteMemoryStore503), + "504": decodeError("BetaDeleteMemoryStore504", BetaDeleteMemoryStore504), orElse: unexpectedStatus })) ), - "betaDeleteSkillV1SkillsSkillIdDelete": (skillId, options) => - HttpClientRequest.delete(`/v1/skills/${skillId}?beta=true`).pipe( + "BetaArchiveMemoryStore": (memoryStoreId, options) => + HttpClientRequest.post(`/v1/memory_stores/${memoryStoreId}/archive?beta=true`).pipe( HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BetaDeleteSkillV1SkillsSkillIdDelete200), - "4xx": decodeError("BetaDeleteSkillV1SkillsSkillIdDelete4XX", BetaDeleteSkillV1SkillsSkillIdDelete4XX), + "2xx": decodeSuccess(BetaArchiveMemoryStore200), + "400": decodeError("BetaArchiveMemoryStore400", BetaArchiveMemoryStore400), + "401": decodeError("BetaArchiveMemoryStore401", BetaArchiveMemoryStore401), + "403": decodeError("BetaArchiveMemoryStore403", BetaArchiveMemoryStore403), + "404": decodeError("BetaArchiveMemoryStore404", BetaArchiveMemoryStore404), + "408": decodeError("BetaArchiveMemoryStore408", BetaArchiveMemoryStore408), + "409": decodeError("BetaArchiveMemoryStore409", BetaArchiveMemoryStore409), + "412": decodeError("BetaArchiveMemoryStore412", BetaArchiveMemoryStore412), + "413": decodeError("BetaArchiveMemoryStore413", BetaArchiveMemoryStore413), + "429": decodeError("BetaArchiveMemoryStore429", BetaArchiveMemoryStore429), + "431": decodeError("BetaArchiveMemoryStore431", BetaArchiveMemoryStore431), + "499": decodeError("BetaArchiveMemoryStore499", BetaArchiveMemoryStore499), + "500": decodeError("BetaArchiveMemoryStore500", BetaArchiveMemoryStore500), + "501": decodeError("BetaArchiveMemoryStore501", BetaArchiveMemoryStore501), + "503": decodeError("BetaArchiveMemoryStore503", BetaArchiveMemoryStore503), + "504": decodeError("BetaArchiveMemoryStore504", BetaArchiveMemoryStore504), orElse: unexpectedStatus })) ), - "betaListSkillVersionsV1SkillsSkillIdVersionsGet": (skillId, options) => - HttpClientRequest.get(`/v1/skills/${skillId}/versions?beta=true`).pipe( + "BetaListUserProfiles": (options) => + HttpClientRequest.get(`/v1/user_profiles?beta=true`).pipe( HttpClientRequest.setUrlParams({ + "limit": options?.params?.["limit"] as any, "page": options?.params?.["page"] as any, - "limit": options?.params?.["limit"] as any + "order": options?.params?.["order"] as any }), HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BetaListSkillVersionsV1SkillsSkillIdVersionsGet200), - "4xx": decodeError( - "BetaListSkillVersionsV1SkillsSkillIdVersionsGet4XX", - BetaListSkillVersionsV1SkillsSkillIdVersionsGet4XX - ), + "2xx": decodeSuccess(BetaListUserProfiles200), + "400": decodeError("BetaListUserProfiles400", BetaListUserProfiles400), + "401": decodeError("BetaListUserProfiles401", BetaListUserProfiles401), + "403": decodeError("BetaListUserProfiles403", BetaListUserProfiles403), + "404": decodeError("BetaListUserProfiles404", BetaListUserProfiles404), + "408": decodeError("BetaListUserProfiles408", BetaListUserProfiles408), + "409": decodeError("BetaListUserProfiles409", BetaListUserProfiles409), + "412": decodeError("BetaListUserProfiles412", BetaListUserProfiles412), + "413": decodeError("BetaListUserProfiles413", BetaListUserProfiles413), + "429": decodeError("BetaListUserProfiles429", BetaListUserProfiles429), + "431": decodeError("BetaListUserProfiles431", BetaListUserProfiles431), + "499": decodeError("BetaListUserProfiles499", BetaListUserProfiles499), + "500": decodeError("BetaListUserProfiles500", BetaListUserProfiles500), + "501": decodeError("BetaListUserProfiles501", BetaListUserProfiles501), + "503": decodeError("BetaListUserProfiles503", BetaListUserProfiles503), + "504": decodeError("BetaListUserProfiles504", BetaListUserProfiles504), orElse: unexpectedStatus })) ), - "betaCreateSkillVersionV1SkillsSkillIdVersionsPost": (skillId, options) => - HttpClientRequest.post(`/v1/skills/${skillId}/versions?beta=true`).pipe( + "BetaCreateUserProfile": (options) => + HttpClientRequest.post(`/v1/user_profiles?beta=true`).pipe( HttpClientRequest.setHeaders({ - "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined, - "anthropic-version": options.params?.["anthropic-version"] ?? undefined + "anthropic-version": options.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined }), - HttpClientRequest.bodyFormData(options.payload as any), + HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BetaCreateSkillVersionV1SkillsSkillIdVersionsPost200), - "4xx": decodeError( - "BetaCreateSkillVersionV1SkillsSkillIdVersionsPost4XX", - BetaCreateSkillVersionV1SkillsSkillIdVersionsPost4XX - ), + "2xx": decodeSuccess(BetaCreateUserProfile200), + "400": decodeError("BetaCreateUserProfile400", BetaCreateUserProfile400), + "401": decodeError("BetaCreateUserProfile401", BetaCreateUserProfile401), + "403": decodeError("BetaCreateUserProfile403", BetaCreateUserProfile403), + "404": decodeError("BetaCreateUserProfile404", BetaCreateUserProfile404), + "408": decodeError("BetaCreateUserProfile408", BetaCreateUserProfile408), + "409": decodeError("BetaCreateUserProfile409", BetaCreateUserProfile409), + "412": decodeError("BetaCreateUserProfile412", BetaCreateUserProfile412), + "413": decodeError("BetaCreateUserProfile413", BetaCreateUserProfile413), + "429": decodeError("BetaCreateUserProfile429", BetaCreateUserProfile429), + "431": decodeError("BetaCreateUserProfile431", BetaCreateUserProfile431), + "499": decodeError("BetaCreateUserProfile499", BetaCreateUserProfile499), + "500": decodeError("BetaCreateUserProfile500", BetaCreateUserProfile500), + "501": decodeError("BetaCreateUserProfile501", BetaCreateUserProfile501), + "503": decodeError("BetaCreateUserProfile503", BetaCreateUserProfile503), + "504": decodeError("BetaCreateUserProfile504", BetaCreateUserProfile504), orElse: unexpectedStatus })) ), - "betaGetSkillVersionV1SkillsSkillIdVersionsVersionGet": (skillId, version, options) => - HttpClientRequest.get(`/v1/skills/${skillId}/versions/${version}?beta=true`).pipe( + "BetaGetUserProfile": (userProfileId, options) => + HttpClientRequest.get(`/v1/user_profiles/${userProfileId}?beta=true`).pipe( HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, + "x-api-key": options?.params?.["x-api-key"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet200), - "4xx": decodeError( - "BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX", - BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX - ), + "2xx": decodeSuccess(BetaGetUserProfile200), + "400": decodeError("BetaGetUserProfile400", BetaGetUserProfile400), + "401": decodeError("BetaGetUserProfile401", BetaGetUserProfile401), + "403": decodeError("BetaGetUserProfile403", BetaGetUserProfile403), + "404": decodeError("BetaGetUserProfile404", BetaGetUserProfile404), + "408": decodeError("BetaGetUserProfile408", BetaGetUserProfile408), + "409": decodeError("BetaGetUserProfile409", BetaGetUserProfile409), + "412": decodeError("BetaGetUserProfile412", BetaGetUserProfile412), + "413": decodeError("BetaGetUserProfile413", BetaGetUserProfile413), + "429": decodeError("BetaGetUserProfile429", BetaGetUserProfile429), + "431": decodeError("BetaGetUserProfile431", BetaGetUserProfile431), + "499": decodeError("BetaGetUserProfile499", BetaGetUserProfile499), + "500": decodeError("BetaGetUserProfile500", BetaGetUserProfile500), + "501": decodeError("BetaGetUserProfile501", BetaGetUserProfile501), + "503": decodeError("BetaGetUserProfile503", BetaGetUserProfile503), + "504": decodeError("BetaGetUserProfile504", BetaGetUserProfile504), orElse: unexpectedStatus })) ), - "betaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete": (skillId, version, options) => - HttpClientRequest.delete(`/v1/skills/${skillId}/versions/${version}?beta=true`).pipe( + "BetaUpdateUserProfile": (userProfileId, options) => + HttpClientRequest.post(`/v1/user_profiles/${userProfileId}?beta=true`).pipe( + HttpClientRequest.setHeaders({ + "anthropic-version": options.params?.["anthropic-version"] ?? undefined, + "anthropic-beta": options.params?.["anthropic-beta"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BetaUpdateUserProfile200), + "400": decodeError("BetaUpdateUserProfile400", BetaUpdateUserProfile400), + "401": decodeError("BetaUpdateUserProfile401", BetaUpdateUserProfile401), + "403": decodeError("BetaUpdateUserProfile403", BetaUpdateUserProfile403), + "404": decodeError("BetaUpdateUserProfile404", BetaUpdateUserProfile404), + "408": decodeError("BetaUpdateUserProfile408", BetaUpdateUserProfile408), + "409": decodeError("BetaUpdateUserProfile409", BetaUpdateUserProfile409), + "412": decodeError("BetaUpdateUserProfile412", BetaUpdateUserProfile412), + "413": decodeError("BetaUpdateUserProfile413", BetaUpdateUserProfile413), + "429": decodeError("BetaUpdateUserProfile429", BetaUpdateUserProfile429), + "431": decodeError("BetaUpdateUserProfile431", BetaUpdateUserProfile431), + "499": decodeError("BetaUpdateUserProfile499", BetaUpdateUserProfile499), + "500": decodeError("BetaUpdateUserProfile500", BetaUpdateUserProfile500), + "501": decodeError("BetaUpdateUserProfile501", BetaUpdateUserProfile501), + "503": decodeError("BetaUpdateUserProfile503", BetaUpdateUserProfile503), + "504": decodeError("BetaUpdateUserProfile504", BetaUpdateUserProfile504), + orElse: unexpectedStatus + })) + ), + "BetaCreateEnrollmentUrl": (userProfileId, options) => + HttpClientRequest.post(`/v1/user_profiles/${userProfileId}/enrollment_url?beta=true`).pipe( HttpClientRequest.setHeaders({ - "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined, "anthropic-version": options?.params?.["anthropic-version"] ?? undefined, - "x-api-key": options?.params?.["x-api-key"] ?? undefined + "anthropic-beta": options?.params?.["anthropic-beta"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete200), - "4xx": decodeError( - "BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX", - BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX - ), + "2xx": decodeSuccess(BetaCreateEnrollmentUrl200), + "400": decodeError("BetaCreateEnrollmentUrl400", BetaCreateEnrollmentUrl400), + "401": decodeError("BetaCreateEnrollmentUrl401", BetaCreateEnrollmentUrl401), + "403": decodeError("BetaCreateEnrollmentUrl403", BetaCreateEnrollmentUrl403), + "404": decodeError("BetaCreateEnrollmentUrl404", BetaCreateEnrollmentUrl404), + "408": decodeError("BetaCreateEnrollmentUrl408", BetaCreateEnrollmentUrl408), + "409": decodeError("BetaCreateEnrollmentUrl409", BetaCreateEnrollmentUrl409), + "412": decodeError("BetaCreateEnrollmentUrl412", BetaCreateEnrollmentUrl412), + "413": decodeError("BetaCreateEnrollmentUrl413", BetaCreateEnrollmentUrl413), + "429": decodeError("BetaCreateEnrollmentUrl429", BetaCreateEnrollmentUrl429), + "431": decodeError("BetaCreateEnrollmentUrl431", BetaCreateEnrollmentUrl431), + "499": decodeError("BetaCreateEnrollmentUrl499", BetaCreateEnrollmentUrl499), + "500": decodeError("BetaCreateEnrollmentUrl500", BetaCreateEnrollmentUrl500), + "501": decodeError("BetaCreateEnrollmentUrl501", BetaCreateEnrollmentUrl501), + "503": decodeError("BetaCreateEnrollmentUrl503", BetaCreateEnrollmentUrl503), + "504": decodeError("BetaCreateEnrollmentUrl504", BetaCreateEnrollmentUrl504), orElse: unexpectedStatus })) ) @@ -11782,794 +23363,2542 @@ export const make = ( export interface AnthropicClient { readonly httpClient: HttpClient.HttpClient /** - * Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation. + * Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation. + * + * The Messages API can be used for either single queries or stateless multi-turn conversations. + * + * Learn more about the Messages API in our [user guide](https://docs.claude.com/en/docs/initial-setup) + */ + readonly "messagesPost": ( + options: { + readonly params?: typeof MessagesPostParams.Encoded | undefined + readonly payload: typeof MessagesPostRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError | AnthropicClientError<"MessagesPost4XX", typeof MessagesPost4XX.Type> + > + /** + * [Legacy] Create a Text Completion. + * + * The Text Completions API is a legacy API. We recommend using the [Messages API](https://docs.claude.com/en/api/messages) going forward. + * + * Future models and features will not be compatible with Text Completions. See our [migration guide](https://docs.claude.com/en/api/migrating-from-text-completions-to-messages) for guidance in migrating from Text Completions to Messages. + */ + readonly "completePost": ( + options: { + readonly params?: typeof CompletePostParams.Encoded | undefined + readonly payload: typeof CompletePostRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError | AnthropicClientError<"CompletePost4XX", typeof CompletePost4XX.Type> + > + /** + * List available models. + * + * The Models API response can be used to determine which models are available for use in the API. More recently released models are listed first. + */ + readonly "modelsList": ( + options: + | { readonly params?: typeof ModelsListParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError | AnthropicClientError<"ModelsList4XX", typeof ModelsList4XX.Type> + > + /** + * Get a specific model. + * + * The Models API response can be used to determine information about a specific model or resolve a model alias to a model ID. + */ + readonly "modelsGet": ( + modelId: string, + options: + | { readonly params?: typeof ModelsGetParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError | AnthropicClientError<"ModelsGet4XX", typeof ModelsGet4XX.Type> + > + /** + * List all Message Batches within a Workspace. Most recently created batches are returned first. + * + * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + */ + readonly "messageBatchesList": ( + options: { + readonly params?: typeof MessageBatchesListParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"MessageBatchesList4XX", typeof MessageBatchesList4XX.Type> + > + /** + * Send a batch of Message creation requests. + * + * The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete. + * + * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + */ + readonly "messageBatchesPost": ( + options: { + readonly params?: typeof MessageBatchesPostParams.Encoded | undefined + readonly payload: typeof MessageBatchesPostRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"MessageBatchesPost4XX", typeof MessageBatchesPost4XX.Type> + > + /** + * This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response. + * + * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + */ + readonly "messageBatchesRetrieve": ( + messageBatchId: string, + options: { + readonly params?: typeof MessageBatchesRetrieveParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"MessageBatchesRetrieve4XX", typeof MessageBatchesRetrieve4XX.Type> + > + /** + * Delete a Message Batch. + * + * Message Batches can only be deleted once they've finished processing. If you'd like to delete an in-progress batch, you must first cancel it. + * + * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + */ + readonly "messageBatchesDelete": ( + messageBatchId: string, + options: { + readonly params?: typeof MessageBatchesDeleteParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"MessageBatchesDelete4XX", typeof MessageBatchesDelete4XX.Type> + > + /** + * Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation. + * + * The number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible. + * + * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + */ + readonly "messageBatchesCancel": ( + messageBatchId: string, + options: { + readonly params?: typeof MessageBatchesCancelParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"MessageBatchesCancel4XX", typeof MessageBatchesCancel4XX.Type> + > + /** + * Streams the results of a Message Batch as a `.jsonl` file. + * + * Each line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + * + * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + */ + readonly "messageBatchesResults": ( + messageBatchId: string, + options: { + readonly params?: typeof MessageBatchesResultsParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"MessageBatchesResults4XX", typeof MessageBatchesResults4XX.Type> + > + /** + * Count the number of tokens in a Message. + * + * The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it. + * + * Learn more about token counting in our [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting) + */ + readonly "messagesCountTokensPost": ( + options: { + readonly params?: typeof MessagesCountTokensPostParams.Encoded | undefined + readonly payload: typeof MessagesCountTokensPostRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"MessagesCountTokensPost4XX", typeof MessagesCountTokensPost4XX.Type> + > + /** + * Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation. + * + * The Messages API can be used for either single queries or stateless multi-turn conversations. + * + * Learn more about the Messages API in our [user guide](https://docs.claude.com/en/docs/initial-setup) + */ + readonly "betaMessagesPost": ( + options: { + readonly params?: typeof BetaMessagesPostParams.Encoded | undefined + readonly payload: typeof BetaMessagesPostRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaMessagesPost4XX", typeof BetaMessagesPost4XX.Type> + > + /** + * List available models. + * + * The Models API response can be used to determine which models are available for use in the API. More recently released models are listed first. + */ + readonly "betaModelsList": ( + options: + | { readonly params?: typeof BetaModelsListParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaModelsList4XX", typeof BetaModelsList4XX.Type> + > + /** + * Get a specific model. + * + * The Models API response can be used to determine information about a specific model or resolve a model alias to a model ID. + */ + readonly "betaModelsGet": ( + modelId: string, + options: + | { readonly params?: typeof BetaModelsGetParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaModelsGet4XX", typeof BetaModelsGet4XX.Type> + > + /** + * List all Message Batches within a Workspace. Most recently created batches are returned first. + * + * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + */ + readonly "betaMessageBatchesList": ( + options: { + readonly params?: typeof BetaMessageBatchesListParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaMessageBatchesList4XX", typeof BetaMessageBatchesList4XX.Type> + > + /** + * Send a batch of Message creation requests. + * + * The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete. + * + * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + */ + readonly "betaMessageBatchesPost": ( + options: { + readonly params?: typeof BetaMessageBatchesPostParams.Encoded | undefined + readonly payload: typeof BetaMessageBatchesPostRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaMessageBatchesPost4XX", typeof BetaMessageBatchesPost4XX.Type> + > + /** + * This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response. + * + * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + */ + readonly "betaMessageBatchesRetrieve": ( + messageBatchId: string, + options: { + readonly params?: typeof BetaMessageBatchesRetrieveParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaMessageBatchesRetrieve4XX", typeof BetaMessageBatchesRetrieve4XX.Type> + > + /** + * Delete a Message Batch. + * + * Message Batches can only be deleted once they've finished processing. If you'd like to delete an in-progress batch, you must first cancel it. + * + * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + */ + readonly "betaMessageBatchesDelete": ( + messageBatchId: string, + options: { + readonly params?: typeof BetaMessageBatchesDeleteParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaMessageBatchesDelete4XX", typeof BetaMessageBatchesDelete4XX.Type> + > + /** + * Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation. + * + * The number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible. + * + * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + */ + readonly "betaMessageBatchesCancel": ( + messageBatchId: string, + options: { + readonly params?: typeof BetaMessageBatchesCancelParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaMessageBatchesCancel4XX", typeof BetaMessageBatchesCancel4XX.Type> + > + /** + * Streams the results of a Message Batch as a `.jsonl` file. + * + * Each line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. + * + * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + */ + readonly "betaMessageBatchesResults": ( + messageBatchId: string, + options: { + readonly params?: typeof BetaMessageBatchesResultsParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaMessageBatchesResults4XX", typeof BetaMessageBatchesResults4XX.Type> + > + /** + * Count the number of tokens in a Message. + * + * The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it. + * + * Learn more about token counting in our [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting) + */ + readonly "betaMessagesCountTokensPost": ( + options: { + readonly params?: typeof BetaMessagesCountTokensPostParams.Encoded | undefined + readonly payload: typeof BetaMessagesCountTokensPostRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaMessagesCountTokensPost4XX", typeof BetaMessagesCountTokensPost4XX.Type> + > + /** + * List Files + */ + readonly "betaListFilesV1FilesGet": ( + options: { + readonly params?: typeof BetaListFilesV1FilesGetParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaListFilesV1FilesGet4XX", typeof BetaListFilesV1FilesGet4XX.Type> + > + /** + * Upload File + */ + readonly "betaUploadFileV1FilesPost": ( + options: { + readonly params?: typeof BetaUploadFileV1FilesPostParams.Encoded | undefined + readonly payload: typeof BetaUploadFileV1FilesPostRequestFormData.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaUploadFileV1FilesPost4XX", typeof BetaUploadFileV1FilesPost4XX.Type> + > + /** + * Get File Metadata + */ + readonly "betaGetFileMetadataV1FilesFileIdGet": ( + fileId: string, + options: { + readonly params?: typeof BetaGetFileMetadataV1FilesFileIdGetParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaGetFileMetadataV1FilesFileIdGet4XX", typeof BetaGetFileMetadataV1FilesFileIdGet4XX.Type> + > + /** + * Delete File + */ + readonly "betaDeleteFileV1FilesFileIdDelete": ( + fileId: string, + options: { + readonly params?: typeof BetaDeleteFileV1FilesFileIdDeleteParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaDeleteFileV1FilesFileIdDelete4XX", typeof BetaDeleteFileV1FilesFileIdDelete4XX.Type> + > + /** + * Download File + */ + readonly "betaDownloadFileV1FilesFileIdContentGet": ( + fileId: string, + options: { + readonly params?: typeof BetaDownloadFileV1FilesFileIdContentGetParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect, HttpClientError.HttpClientError | SchemaError> + /** + * Download File + */ + readonly "betaDownloadFileV1FilesFileIdContentGetStream": ( + fileId: string, + options: { readonly params?: typeof BetaDownloadFileV1FilesFileIdContentGetParams.Encoded | undefined } | undefined + ) => Stream.Stream + /** + * List Skills + */ + readonly "betaListSkillsV1SkillsGet": ( + options: { + readonly params?: typeof BetaListSkillsV1SkillsGetParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaListSkillsV1SkillsGet4XX", typeof BetaListSkillsV1SkillsGet4XX.Type> + > + /** + * Create Skill + */ + readonly "betaCreateSkillV1SkillsPost": ( + options: { + readonly params?: typeof BetaCreateSkillV1SkillsPostParams.Encoded | undefined + readonly payload: typeof BetaCreateSkillV1SkillsPostRequestFormData.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaCreateSkillV1SkillsPost4XX", typeof BetaCreateSkillV1SkillsPost4XX.Type> + > + /** + * Get Skill + */ + readonly "betaGetSkillV1SkillsSkillIdGet": ( + skillId: string, + options: { + readonly params?: typeof BetaGetSkillV1SkillsSkillIdGetParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaGetSkillV1SkillsSkillIdGet4XX", typeof BetaGetSkillV1SkillsSkillIdGet4XX.Type> + > + /** + * Delete Skill + */ + readonly "betaDeleteSkillV1SkillsSkillIdDelete": ( + skillId: string, + options: { + readonly params?: typeof BetaDeleteSkillV1SkillsSkillIdDeleteParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError< + "BetaDeleteSkillV1SkillsSkillIdDelete4XX", + typeof BetaDeleteSkillV1SkillsSkillIdDelete4XX.Type + > + > + /** + * List Skill Versions + */ + readonly "betaListSkillVersionsV1SkillsSkillIdVersionsGet": ( + skillId: string, + options: { + readonly params?: typeof BetaListSkillVersionsV1SkillsSkillIdVersionsGetParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError< + "BetaListSkillVersionsV1SkillsSkillIdVersionsGet4XX", + typeof BetaListSkillVersionsV1SkillsSkillIdVersionsGet4XX.Type + > + > + /** + * Create Skill Version + */ + readonly "betaCreateSkillVersionV1SkillsSkillIdVersionsPost": ( + skillId: string, + options: { + readonly params?: typeof BetaCreateSkillVersionV1SkillsSkillIdVersionsPostParams.Encoded | undefined + readonly payload: typeof BetaCreateSkillVersionV1SkillsSkillIdVersionsPostRequestFormData.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError< + "BetaCreateSkillVersionV1SkillsSkillIdVersionsPost4XX", + typeof BetaCreateSkillVersionV1SkillsSkillIdVersionsPost4XX.Type + > + > + /** + * Get Skill Version + */ + readonly "betaGetSkillVersionV1SkillsSkillIdVersionsVersionGet": ( + skillId: string, + version: string, + options: { + readonly params?: typeof BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGetParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError< + "BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX", + typeof BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX.Type + > + > + /** + * Delete Skill Version + */ + readonly "betaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete": ( + skillId: string, + version: string, + options: { + readonly params?: typeof BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDeleteParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError< + "BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX", + typeof BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX.Type + > + > + /** + * Download a skill version's content as a zip archive. + */ + readonly "betaDownloadSkillVersionContentV1SkillsSkillIdVersionsVersionContentGet": ( + skillId: string, + version: string, + options: { + readonly params?: + | typeof BetaDownloadSkillVersionContentV1SkillsSkillIdVersionsVersionContentGetParams.Encoded + | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect, HttpClientError.HttpClientError | SchemaError> + /** + * List environments with pagination support. + */ + readonly "betaListEnvironmentsV1EnvironmentsGet": ( + options: { + readonly params?: typeof BetaListEnvironmentsV1EnvironmentsGetParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError< + "BetaListEnvironmentsV1EnvironmentsGet4XX", + typeof BetaListEnvironmentsV1EnvironmentsGet4XX.Type + > + > + /** + * Create a new environment with the specified configuration. + */ + readonly "betaCreateEnvironmentV1EnvironmentsPost": ( + options: { + readonly params?: typeof BetaCreateEnvironmentV1EnvironmentsPostParams.Encoded | undefined + readonly payload: typeof BetaCreateEnvironmentV1EnvironmentsPostRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError< + "BetaCreateEnvironmentV1EnvironmentsPost4XX", + typeof BetaCreateEnvironmentV1EnvironmentsPost4XX.Type + > + > + /** + * Retrieve a specific environment by ID. + */ + readonly "betaGetEnvironmentV1EnvironmentsEnvironmentIdGet": ( + environmentId: string, + options: { + readonly params?: typeof BetaGetEnvironmentV1EnvironmentsEnvironmentIdGetParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError< + "BetaGetEnvironmentV1EnvironmentsEnvironmentIdGet4XX", + typeof BetaGetEnvironmentV1EnvironmentsEnvironmentIdGet4XX.Type + > + > + /** + * Update an existing environment's configuration. + */ + readonly "betaUpdateEnvironmentV1EnvironmentsEnvironmentIdPost": ( + environmentId: string, + options: { + readonly params?: typeof BetaUpdateEnvironmentV1EnvironmentsEnvironmentIdPostParams.Encoded | undefined + readonly payload: typeof BetaUpdateEnvironmentV1EnvironmentsEnvironmentIdPostRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError< + "BetaUpdateEnvironmentV1EnvironmentsEnvironmentIdPost4XX", + typeof BetaUpdateEnvironmentV1EnvironmentsEnvironmentIdPost4XX.Type + > + > + /** + * Delete an environment by ID. Returns a confirmation of the deletion. + */ + readonly "betaDeleteEnvironmentV1EnvironmentsEnvironmentIdDelete": ( + environmentId: string, + options: { + readonly params?: typeof BetaDeleteEnvironmentV1EnvironmentsEnvironmentIdDeleteParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError< + "BetaDeleteEnvironmentV1EnvironmentsEnvironmentIdDelete4XX", + typeof BetaDeleteEnvironmentV1EnvironmentsEnvironmentIdDelete4XX.Type + > + > + /** + * Archive an environment by ID. Archived environments cannot be used to create new sessions. + */ + readonly "betaArchiveEnvironmentV1EnvironmentsEnvironmentIdArchivePost": ( + environmentId: string, + options: { + readonly params?: typeof BetaArchiveEnvironmentV1EnvironmentsEnvironmentIdArchivePostParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError< + "BetaArchiveEnvironmentV1EnvironmentsEnvironmentIdArchivePost4XX", + typeof BetaArchiveEnvironmentV1EnvironmentsEnvironmentIdArchivePost4XX.Type + > + > + /** + * Get statistics about the work queue for an environment. + */ + readonly "betaGetEnvironmentStatsV1EnvironmentsEnvironmentIdWorkStatsGet": ( + environmentId: string, + options: { + readonly params?: typeof BetaGetEnvironmentStatsV1EnvironmentsEnvironmentIdWorkStatsGetParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError< + "BetaGetEnvironmentStatsV1EnvironmentsEnvironmentIdWorkStatsGet4XX", + typeof BetaGetEnvironmentStatsV1EnvironmentsEnvironmentIdWorkStatsGet4XX.Type + > + > + /** + * Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly. + * + * Long poll for work items in the queue. + */ + readonly "betaPollWorkV1EnvironmentsEnvironmentIdWorkPollGet": ( + environmentId: string, + options: { + readonly params?: typeof BetaPollWorkV1EnvironmentsEnvironmentIdWorkPollGetParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError< + "BetaPollWorkV1EnvironmentsEnvironmentIdWorkPollGet4XX", + typeof BetaPollWorkV1EnvironmentsEnvironmentIdWorkPollGet4XX.Type + > + > + /** + * Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly. + * + * Acknowledge receipt of a work item, transitioning it from 'queued' to 'starting' and removing it from the queue. + */ + readonly "betaAcknowledgeWorkV1EnvironmentsEnvironmentIdWorkWorkIdAckPost": ( + environmentId: string, + workId: string, + options: { + readonly params?: typeof BetaAcknowledgeWorkV1EnvironmentsEnvironmentIdWorkWorkIdAckPostParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError< + "BetaAcknowledgeWorkV1EnvironmentsEnvironmentIdWorkWorkIdAckPost4XX", + typeof BetaAcknowledgeWorkV1EnvironmentsEnvironmentIdWorkWorkIdAckPost4XX.Type + > + > + /** + * Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly. + * + * Record a heartbeat for a work item to maintain the lease. + */ + readonly "betaRecordHeartbeatV1EnvironmentsEnvironmentIdWorkWorkIdHeartbeatPost": ( + environmentId: string, + workId: string, + options: { + readonly params?: + | typeof BetaRecordHeartbeatV1EnvironmentsEnvironmentIdWorkWorkIdHeartbeatPostParams.Encoded + | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError< + "BetaRecordHeartbeatV1EnvironmentsEnvironmentIdWorkWorkIdHeartbeatPost4XX", + typeof BetaRecordHeartbeatV1EnvironmentsEnvironmentIdWorkWorkIdHeartbeatPost4XX.Type + > + > + /** + * Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly. + * + * Stop a work item, initiating graceful or forced shutdown. + */ + readonly "betaStopWorkV1EnvironmentsEnvironmentIdWorkWorkIdStopPost": ( + environmentId: string, + workId: string, + options: { + readonly params?: typeof BetaStopWorkV1EnvironmentsEnvironmentIdWorkWorkIdStopPostParams.Encoded | undefined + readonly payload: typeof BetaStopWorkV1EnvironmentsEnvironmentIdWorkWorkIdStopPostRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError< + "BetaStopWorkV1EnvironmentsEnvironmentIdWorkWorkIdStopPost4XX", + typeof BetaStopWorkV1EnvironmentsEnvironmentIdWorkWorkIdStopPost4XX.Type + > + > + /** + * Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly. * - * The Messages API can be used for either single queries or stateless multi-turn conversations. + * Retrieve detailed information about a specific work item. + */ + readonly "betaGetWorkV1EnvironmentsEnvironmentIdWorkWorkIdGet": ( + environmentId: string, + workId: string, + options: { + readonly params?: typeof BetaGetWorkV1EnvironmentsEnvironmentIdWorkWorkIdGetParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError< + "BetaGetWorkV1EnvironmentsEnvironmentIdWorkWorkIdGet4XX", + typeof BetaGetWorkV1EnvironmentsEnvironmentIdWorkWorkIdGet4XX.Type + > + > + /** + * Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly. * - * Learn more about the Messages API in our [user guide](https://docs.claude.com/en/docs/initial-setup) + * Update work item metadata with merge semantics. */ - readonly "messagesPost": ( + readonly "betaUpdateWorkV1EnvironmentsEnvironmentIdWorkWorkIdPost": ( + environmentId: string, + workId: string, options: { - readonly params?: typeof MessagesPostParams.Encoded | undefined - readonly payload: typeof MessagesPostRequestJson.Encoded + readonly params?: typeof BetaUpdateWorkV1EnvironmentsEnvironmentIdWorkWorkIdPostParams.Encoded | undefined + readonly payload: typeof BetaUpdateWorkV1EnvironmentsEnvironmentIdWorkWorkIdPostRequestJson.Encoded readonly config?: Config | undefined } ) => Effect.Effect< - WithOptionalResponse, - HttpClientError.HttpClientError | SchemaError | AnthropicClientError<"MessagesPost4XX", typeof MessagesPost4XX.Type> + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError< + "BetaUpdateWorkV1EnvironmentsEnvironmentIdWorkWorkIdPost4XX", + typeof BetaUpdateWorkV1EnvironmentsEnvironmentIdWorkWorkIdPost4XX.Type + > > /** - * [Legacy] Create a Text Completion. - * - * The Text Completions API is a legacy API. We recommend using the [Messages API](https://docs.claude.com/en/api/messages) going forward. + * Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly. * - * Future models and features will not be compatible with Text Completions. See our [migration guide](https://docs.claude.com/en/api/migrating-from-text-completions-to-messages) for guidance in migrating from Text Completions to Messages. + * List work items in an environment. */ - readonly "completePost": ( + readonly "betaListWorkV1EnvironmentsEnvironmentIdWorkGet": ( + environmentId: string, options: { - readonly params?: typeof CompletePostParams.Encoded | undefined - readonly payload: typeof CompletePostRequestJson.Encoded + readonly params?: typeof BetaListWorkV1EnvironmentsEnvironmentIdWorkGetParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError< + "BetaListWorkV1EnvironmentsEnvironmentIdWorkGet4XX", + typeof BetaListWorkV1EnvironmentsEnvironmentIdWorkGet4XX.Type + > + > + /** + * List Sessions + */ + readonly "BetaListSessions": ( + options: { + readonly params?: typeof BetaListSessionsParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaListSessions400", typeof BetaListSessions400.Type> + | AnthropicClientError<"BetaListSessions401", typeof BetaListSessions401.Type> + | AnthropicClientError<"BetaListSessions403", typeof BetaListSessions403.Type> + | AnthropicClientError<"BetaListSessions404", typeof BetaListSessions404.Type> + | AnthropicClientError<"BetaListSessions408", typeof BetaListSessions408.Type> + | AnthropicClientError<"BetaListSessions409", typeof BetaListSessions409.Type> + | AnthropicClientError<"BetaListSessions412", typeof BetaListSessions412.Type> + | AnthropicClientError<"BetaListSessions413", typeof BetaListSessions413.Type> + | AnthropicClientError<"BetaListSessions429", typeof BetaListSessions429.Type> + | AnthropicClientError<"BetaListSessions431", typeof BetaListSessions431.Type> + | AnthropicClientError<"BetaListSessions499", typeof BetaListSessions499.Type> + | AnthropicClientError<"BetaListSessions500", typeof BetaListSessions500.Type> + | AnthropicClientError<"BetaListSessions501", typeof BetaListSessions501.Type> + | AnthropicClientError<"BetaListSessions503", typeof BetaListSessions503.Type> + | AnthropicClientError<"BetaListSessions504", typeof BetaListSessions504.Type> + > + /** + * Create Session + */ + readonly "BetaCreateSession": ( + options: { + readonly params?: typeof BetaCreateSessionParams.Encoded | undefined + readonly payload: typeof BetaCreateSessionRequestJson.Encoded readonly config?: Config | undefined } ) => Effect.Effect< - WithOptionalResponse, - HttpClientError.HttpClientError | SchemaError | AnthropicClientError<"CompletePost4XX", typeof CompletePost4XX.Type> + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaCreateSession400", typeof BetaCreateSession400.Type> + | AnthropicClientError<"BetaCreateSession401", typeof BetaCreateSession401.Type> + | AnthropicClientError<"BetaCreateSession403", typeof BetaCreateSession403.Type> + | AnthropicClientError<"BetaCreateSession404", typeof BetaCreateSession404.Type> + | AnthropicClientError<"BetaCreateSession408", typeof BetaCreateSession408.Type> + | AnthropicClientError<"BetaCreateSession409", typeof BetaCreateSession409.Type> + | AnthropicClientError<"BetaCreateSession412", typeof BetaCreateSession412.Type> + | AnthropicClientError<"BetaCreateSession413", typeof BetaCreateSession413.Type> + | AnthropicClientError<"BetaCreateSession429", typeof BetaCreateSession429.Type> + | AnthropicClientError<"BetaCreateSession431", typeof BetaCreateSession431.Type> + | AnthropicClientError<"BetaCreateSession499", typeof BetaCreateSession499.Type> + | AnthropicClientError<"BetaCreateSession500", typeof BetaCreateSession500.Type> + | AnthropicClientError<"BetaCreateSession501", typeof BetaCreateSession501.Type> + | AnthropicClientError<"BetaCreateSession503", typeof BetaCreateSession503.Type> + | AnthropicClientError<"BetaCreateSession504", typeof BetaCreateSession504.Type> > /** - * List available models. - * - * The Models API response can be used to determine which models are available for use in the API. More recently released models are listed first. + * Get Session */ - readonly "modelsList": ( + readonly "BetaGetSession": ( + sessionId: string, options: - | { readonly params?: typeof ModelsListParams.Encoded | undefined; readonly config?: Config | undefined } + | { readonly params?: typeof BetaGetSessionParams.Encoded | undefined; readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, - HttpClientError.HttpClientError | SchemaError | AnthropicClientError<"ModelsList4XX", typeof ModelsList4XX.Type> + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaGetSession400", typeof BetaGetSession400.Type> + | AnthropicClientError<"BetaGetSession401", typeof BetaGetSession401.Type> + | AnthropicClientError<"BetaGetSession403", typeof BetaGetSession403.Type> + | AnthropicClientError<"BetaGetSession404", typeof BetaGetSession404.Type> + | AnthropicClientError<"BetaGetSession408", typeof BetaGetSession408.Type> + | AnthropicClientError<"BetaGetSession409", typeof BetaGetSession409.Type> + | AnthropicClientError<"BetaGetSession412", typeof BetaGetSession412.Type> + | AnthropicClientError<"BetaGetSession413", typeof BetaGetSession413.Type> + | AnthropicClientError<"BetaGetSession429", typeof BetaGetSession429.Type> + | AnthropicClientError<"BetaGetSession431", typeof BetaGetSession431.Type> + | AnthropicClientError<"BetaGetSession499", typeof BetaGetSession499.Type> + | AnthropicClientError<"BetaGetSession500", typeof BetaGetSession500.Type> + | AnthropicClientError<"BetaGetSession501", typeof BetaGetSession501.Type> + | AnthropicClientError<"BetaGetSession503", typeof BetaGetSession503.Type> + | AnthropicClientError<"BetaGetSession504", typeof BetaGetSession504.Type> > /** - * Get a specific model. - * - * The Models API response can be used to determine information about a specific model or resolve a model alias to a model ID. + * Update Session */ - readonly "modelsGet": ( - modelId: string, + readonly "BetaUpdateSession": ( + sessionId: string, + options: { + readonly params?: typeof BetaUpdateSessionParams.Encoded | undefined + readonly payload: typeof BetaUpdateSessionRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaUpdateSession400", typeof BetaUpdateSession400.Type> + | AnthropicClientError<"BetaUpdateSession401", typeof BetaUpdateSession401.Type> + | AnthropicClientError<"BetaUpdateSession403", typeof BetaUpdateSession403.Type> + | AnthropicClientError<"BetaUpdateSession404", typeof BetaUpdateSession404.Type> + | AnthropicClientError<"BetaUpdateSession408", typeof BetaUpdateSession408.Type> + | AnthropicClientError<"BetaUpdateSession409", typeof BetaUpdateSession409.Type> + | AnthropicClientError<"BetaUpdateSession412", typeof BetaUpdateSession412.Type> + | AnthropicClientError<"BetaUpdateSession413", typeof BetaUpdateSession413.Type> + | AnthropicClientError<"BetaUpdateSession429", typeof BetaUpdateSession429.Type> + | AnthropicClientError<"BetaUpdateSession431", typeof BetaUpdateSession431.Type> + | AnthropicClientError<"BetaUpdateSession499", typeof BetaUpdateSession499.Type> + | AnthropicClientError<"BetaUpdateSession500", typeof BetaUpdateSession500.Type> + | AnthropicClientError<"BetaUpdateSession501", typeof BetaUpdateSession501.Type> + | AnthropicClientError<"BetaUpdateSession503", typeof BetaUpdateSession503.Type> + | AnthropicClientError<"BetaUpdateSession504", typeof BetaUpdateSession504.Type> + > + /** + * Delete Session + */ + readonly "BetaDeleteSession": ( + sessionId: string, + options: { + readonly params?: typeof BetaDeleteSessionParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaDeleteSession400", typeof BetaDeleteSession400.Type> + | AnthropicClientError<"BetaDeleteSession401", typeof BetaDeleteSession401.Type> + | AnthropicClientError<"BetaDeleteSession403", typeof BetaDeleteSession403.Type> + | AnthropicClientError<"BetaDeleteSession404", typeof BetaDeleteSession404.Type> + | AnthropicClientError<"BetaDeleteSession408", typeof BetaDeleteSession408.Type> + | AnthropicClientError<"BetaDeleteSession409", typeof BetaDeleteSession409.Type> + | AnthropicClientError<"BetaDeleteSession412", typeof BetaDeleteSession412.Type> + | AnthropicClientError<"BetaDeleteSession413", typeof BetaDeleteSession413.Type> + | AnthropicClientError<"BetaDeleteSession429", typeof BetaDeleteSession429.Type> + | AnthropicClientError<"BetaDeleteSession431", typeof BetaDeleteSession431.Type> + | AnthropicClientError<"BetaDeleteSession499", typeof BetaDeleteSession499.Type> + | AnthropicClientError<"BetaDeleteSession500", typeof BetaDeleteSession500.Type> + | AnthropicClientError<"BetaDeleteSession501", typeof BetaDeleteSession501.Type> + | AnthropicClientError<"BetaDeleteSession503", typeof BetaDeleteSession503.Type> + | AnthropicClientError<"BetaDeleteSession504", typeof BetaDeleteSession504.Type> + > + /** + * List Events + */ + readonly "BetaListEvents": ( + sessionId: string, options: - | { readonly params?: typeof ModelsGetParams.Encoded | undefined; readonly config?: Config | undefined } + | { readonly params?: typeof BetaListEventsParams.Encoded | undefined; readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, - HttpClientError.HttpClientError | SchemaError | AnthropicClientError<"ModelsGet4XX", typeof ModelsGet4XX.Type> + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaListEvents400", typeof BetaListEvents400.Type> + | AnthropicClientError<"BetaListEvents401", typeof BetaListEvents401.Type> + | AnthropicClientError<"BetaListEvents403", typeof BetaListEvents403.Type> + | AnthropicClientError<"BetaListEvents404", typeof BetaListEvents404.Type> + | AnthropicClientError<"BetaListEvents408", typeof BetaListEvents408.Type> + | AnthropicClientError<"BetaListEvents409", typeof BetaListEvents409.Type> + | AnthropicClientError<"BetaListEvents412", typeof BetaListEvents412.Type> + | AnthropicClientError<"BetaListEvents413", typeof BetaListEvents413.Type> + | AnthropicClientError<"BetaListEvents429", typeof BetaListEvents429.Type> + | AnthropicClientError<"BetaListEvents431", typeof BetaListEvents431.Type> + | AnthropicClientError<"BetaListEvents499", typeof BetaListEvents499.Type> + | AnthropicClientError<"BetaListEvents500", typeof BetaListEvents500.Type> + | AnthropicClientError<"BetaListEvents501", typeof BetaListEvents501.Type> + | AnthropicClientError<"BetaListEvents503", typeof BetaListEvents503.Type> + | AnthropicClientError<"BetaListEvents504", typeof BetaListEvents504.Type> > /** - * List all Message Batches within a Workspace. Most recently created batches are returned first. - * - * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + * Send Events */ - readonly "messageBatchesList": ( + readonly "BetaSendEvents": ( + sessionId: string, options: { - readonly params?: typeof MessageBatchesListParams.Encoded | undefined + readonly params?: typeof BetaSendEventsParams.Encoded | undefined + readonly payload: typeof BetaSendEventsRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaSendEvents400", typeof BetaSendEvents400.Type> + | AnthropicClientError<"BetaSendEvents401", typeof BetaSendEvents401.Type> + | AnthropicClientError<"BetaSendEvents403", typeof BetaSendEvents403.Type> + | AnthropicClientError<"BetaSendEvents404", typeof BetaSendEvents404.Type> + | AnthropicClientError<"BetaSendEvents408", typeof BetaSendEvents408.Type> + | AnthropicClientError<"BetaSendEvents409", typeof BetaSendEvents409.Type> + | AnthropicClientError<"BetaSendEvents412", typeof BetaSendEvents412.Type> + | AnthropicClientError<"BetaSendEvents413", typeof BetaSendEvents413.Type> + | AnthropicClientError<"BetaSendEvents429", typeof BetaSendEvents429.Type> + | AnthropicClientError<"BetaSendEvents431", typeof BetaSendEvents431.Type> + | AnthropicClientError<"BetaSendEvents499", typeof BetaSendEvents499.Type> + | AnthropicClientError<"BetaSendEvents500", typeof BetaSendEvents500.Type> + | AnthropicClientError<"BetaSendEvents501", typeof BetaSendEvents501.Type> + | AnthropicClientError<"BetaSendEvents503", typeof BetaSendEvents503.Type> + | AnthropicClientError<"BetaSendEvents504", typeof BetaSendEvents504.Type> + > + /** + * Stream Events + */ + readonly "BetaStreamSessionEvents": ( + sessionId: string, + options: { + readonly params?: typeof BetaStreamSessionEventsParams.Encoded | undefined readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"MessageBatchesList4XX", typeof MessageBatchesList4XX.Type> + | AnthropicClientError<"BetaStreamSessionEvents400", typeof BetaStreamSessionEvents400.Type> + | AnthropicClientError<"BetaStreamSessionEvents401", typeof BetaStreamSessionEvents401.Type> + | AnthropicClientError<"BetaStreamSessionEvents403", typeof BetaStreamSessionEvents403.Type> + | AnthropicClientError<"BetaStreamSessionEvents404", typeof BetaStreamSessionEvents404.Type> + | AnthropicClientError<"BetaStreamSessionEvents408", typeof BetaStreamSessionEvents408.Type> + | AnthropicClientError<"BetaStreamSessionEvents409", typeof BetaStreamSessionEvents409.Type> + | AnthropicClientError<"BetaStreamSessionEvents412", typeof BetaStreamSessionEvents412.Type> + | AnthropicClientError<"BetaStreamSessionEvents413", typeof BetaStreamSessionEvents413.Type> + | AnthropicClientError<"BetaStreamSessionEvents429", typeof BetaStreamSessionEvents429.Type> + | AnthropicClientError<"BetaStreamSessionEvents431", typeof BetaStreamSessionEvents431.Type> + | AnthropicClientError<"BetaStreamSessionEvents499", typeof BetaStreamSessionEvents499.Type> + | AnthropicClientError<"BetaStreamSessionEvents500", typeof BetaStreamSessionEvents500.Type> + | AnthropicClientError<"BetaStreamSessionEvents501", typeof BetaStreamSessionEvents501.Type> + | AnthropicClientError<"BetaStreamSessionEvents503", typeof BetaStreamSessionEvents503.Type> + | AnthropicClientError<"BetaStreamSessionEvents504", typeof BetaStreamSessionEvents504.Type> > /** - * Send a batch of Message creation requests. - * - * The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete. - * - * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + * Archive Session */ - readonly "messageBatchesPost": ( + readonly "BetaArchiveSession": ( + sessionId: string, options: { - readonly params?: typeof MessageBatchesPostParams.Encoded | undefined - readonly payload: typeof MessageBatchesPostRequestJson.Encoded + readonly params?: typeof BetaArchiveSessionParams.Encoded | undefined readonly config?: Config | undefined - } + } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"MessageBatchesPost4XX", typeof MessageBatchesPost4XX.Type> + | AnthropicClientError<"BetaArchiveSession400", typeof BetaArchiveSession400.Type> + | AnthropicClientError<"BetaArchiveSession401", typeof BetaArchiveSession401.Type> + | AnthropicClientError<"BetaArchiveSession403", typeof BetaArchiveSession403.Type> + | AnthropicClientError<"BetaArchiveSession404", typeof BetaArchiveSession404.Type> + | AnthropicClientError<"BetaArchiveSession408", typeof BetaArchiveSession408.Type> + | AnthropicClientError<"BetaArchiveSession409", typeof BetaArchiveSession409.Type> + | AnthropicClientError<"BetaArchiveSession412", typeof BetaArchiveSession412.Type> + | AnthropicClientError<"BetaArchiveSession413", typeof BetaArchiveSession413.Type> + | AnthropicClientError<"BetaArchiveSession429", typeof BetaArchiveSession429.Type> + | AnthropicClientError<"BetaArchiveSession431", typeof BetaArchiveSession431.Type> + | AnthropicClientError<"BetaArchiveSession499", typeof BetaArchiveSession499.Type> + | AnthropicClientError<"BetaArchiveSession500", typeof BetaArchiveSession500.Type> + | AnthropicClientError<"BetaArchiveSession501", typeof BetaArchiveSession501.Type> + | AnthropicClientError<"BetaArchiveSession503", typeof BetaArchiveSession503.Type> + | AnthropicClientError<"BetaArchiveSession504", typeof BetaArchiveSession504.Type> > /** - * This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response. - * - * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + * List Session Threads */ - readonly "messageBatchesRetrieve": ( - messageBatchId: string, + readonly "BetaListSessionThreads": ( + sessionId: string, options: { - readonly params?: typeof MessageBatchesRetrieveParams.Encoded | undefined + readonly params?: typeof BetaListSessionThreadsParams.Encoded | undefined readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"MessageBatchesRetrieve4XX", typeof MessageBatchesRetrieve4XX.Type> + | AnthropicClientError<"BetaListSessionThreads400", typeof BetaListSessionThreads400.Type> + | AnthropicClientError<"BetaListSessionThreads401", typeof BetaListSessionThreads401.Type> + | AnthropicClientError<"BetaListSessionThreads403", typeof BetaListSessionThreads403.Type> + | AnthropicClientError<"BetaListSessionThreads404", typeof BetaListSessionThreads404.Type> + | AnthropicClientError<"BetaListSessionThreads408", typeof BetaListSessionThreads408.Type> + | AnthropicClientError<"BetaListSessionThreads409", typeof BetaListSessionThreads409.Type> + | AnthropicClientError<"BetaListSessionThreads412", typeof BetaListSessionThreads412.Type> + | AnthropicClientError<"BetaListSessionThreads413", typeof BetaListSessionThreads413.Type> + | AnthropicClientError<"BetaListSessionThreads429", typeof BetaListSessionThreads429.Type> + | AnthropicClientError<"BetaListSessionThreads431", typeof BetaListSessionThreads431.Type> + | AnthropicClientError<"BetaListSessionThreads499", typeof BetaListSessionThreads499.Type> + | AnthropicClientError<"BetaListSessionThreads500", typeof BetaListSessionThreads500.Type> + | AnthropicClientError<"BetaListSessionThreads501", typeof BetaListSessionThreads501.Type> + | AnthropicClientError<"BetaListSessionThreads503", typeof BetaListSessionThreads503.Type> + | AnthropicClientError<"BetaListSessionThreads504", typeof BetaListSessionThreads504.Type> > /** - * Delete a Message Batch. - * - * Message Batches can only be deleted once they've finished processing. If you'd like to delete an in-progress batch, you must first cancel it. - * - * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + * Get Session Thread */ - readonly "messageBatchesDelete": ( - messageBatchId: string, + readonly "BetaGetSessionThread": ( + sessionId: string, + threadId: string, options: { - readonly params?: typeof MessageBatchesDeleteParams.Encoded | undefined + readonly params?: typeof BetaGetSessionThreadParams.Encoded | undefined readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"MessageBatchesDelete4XX", typeof MessageBatchesDelete4XX.Type> + | AnthropicClientError<"BetaGetSessionThread400", typeof BetaGetSessionThread400.Type> + | AnthropicClientError<"BetaGetSessionThread401", typeof BetaGetSessionThread401.Type> + | AnthropicClientError<"BetaGetSessionThread403", typeof BetaGetSessionThread403.Type> + | AnthropicClientError<"BetaGetSessionThread404", typeof BetaGetSessionThread404.Type> + | AnthropicClientError<"BetaGetSessionThread408", typeof BetaGetSessionThread408.Type> + | AnthropicClientError<"BetaGetSessionThread409", typeof BetaGetSessionThread409.Type> + | AnthropicClientError<"BetaGetSessionThread412", typeof BetaGetSessionThread412.Type> + | AnthropicClientError<"BetaGetSessionThread413", typeof BetaGetSessionThread413.Type> + | AnthropicClientError<"BetaGetSessionThread429", typeof BetaGetSessionThread429.Type> + | AnthropicClientError<"BetaGetSessionThread431", typeof BetaGetSessionThread431.Type> + | AnthropicClientError<"BetaGetSessionThread499", typeof BetaGetSessionThread499.Type> + | AnthropicClientError<"BetaGetSessionThread500", typeof BetaGetSessionThread500.Type> + | AnthropicClientError<"BetaGetSessionThread501", typeof BetaGetSessionThread501.Type> + | AnthropicClientError<"BetaGetSessionThread503", typeof BetaGetSessionThread503.Type> + | AnthropicClientError<"BetaGetSessionThread504", typeof BetaGetSessionThread504.Type> > /** - * Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation. - * - * The number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible. - * - * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + * List Session Thread Events */ - readonly "messageBatchesCancel": ( - messageBatchId: string, + readonly "BetaListSessionThreadEvents": ( + sessionId: string, + threadId: string, options: { - readonly params?: typeof MessageBatchesCancelParams.Encoded | undefined + readonly params?: typeof BetaListSessionThreadEventsParams.Encoded | undefined readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"MessageBatchesCancel4XX", typeof MessageBatchesCancel4XX.Type> + | AnthropicClientError<"BetaListSessionThreadEvents400", typeof BetaListSessionThreadEvents400.Type> + | AnthropicClientError<"BetaListSessionThreadEvents401", typeof BetaListSessionThreadEvents401.Type> + | AnthropicClientError<"BetaListSessionThreadEvents403", typeof BetaListSessionThreadEvents403.Type> + | AnthropicClientError<"BetaListSessionThreadEvents404", typeof BetaListSessionThreadEvents404.Type> + | AnthropicClientError<"BetaListSessionThreadEvents408", typeof BetaListSessionThreadEvents408.Type> + | AnthropicClientError<"BetaListSessionThreadEvents409", typeof BetaListSessionThreadEvents409.Type> + | AnthropicClientError<"BetaListSessionThreadEvents412", typeof BetaListSessionThreadEvents412.Type> + | AnthropicClientError<"BetaListSessionThreadEvents413", typeof BetaListSessionThreadEvents413.Type> + | AnthropicClientError<"BetaListSessionThreadEvents429", typeof BetaListSessionThreadEvents429.Type> + | AnthropicClientError<"BetaListSessionThreadEvents431", typeof BetaListSessionThreadEvents431.Type> + | AnthropicClientError<"BetaListSessionThreadEvents499", typeof BetaListSessionThreadEvents499.Type> + | AnthropicClientError<"BetaListSessionThreadEvents500", typeof BetaListSessionThreadEvents500.Type> + | AnthropicClientError<"BetaListSessionThreadEvents501", typeof BetaListSessionThreadEvents501.Type> + | AnthropicClientError<"BetaListSessionThreadEvents503", typeof BetaListSessionThreadEvents503.Type> + | AnthropicClientError<"BetaListSessionThreadEvents504", typeof BetaListSessionThreadEvents504.Type> > /** - * Streams the results of a Message Batch as a `.jsonl` file. - * - * Each line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. - * - * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + * Stream Session Thread Events */ - readonly "messageBatchesResults": ( - messageBatchId: string, + readonly "BetaStreamSessionThreadEvents": ( + sessionId: string, + threadId: string, options: { - readonly params?: typeof MessageBatchesResultsParams.Encoded | undefined + readonly params?: typeof BetaStreamSessionThreadEventsParams.Encoded | undefined readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"MessageBatchesResults4XX", typeof MessageBatchesResults4XX.Type> + | AnthropicClientError<"BetaStreamSessionThreadEvents400", typeof BetaStreamSessionThreadEvents400.Type> + | AnthropicClientError<"BetaStreamSessionThreadEvents401", typeof BetaStreamSessionThreadEvents401.Type> + | AnthropicClientError<"BetaStreamSessionThreadEvents403", typeof BetaStreamSessionThreadEvents403.Type> + | AnthropicClientError<"BetaStreamSessionThreadEvents404", typeof BetaStreamSessionThreadEvents404.Type> + | AnthropicClientError<"BetaStreamSessionThreadEvents408", typeof BetaStreamSessionThreadEvents408.Type> + | AnthropicClientError<"BetaStreamSessionThreadEvents409", typeof BetaStreamSessionThreadEvents409.Type> + | AnthropicClientError<"BetaStreamSessionThreadEvents412", typeof BetaStreamSessionThreadEvents412.Type> + | AnthropicClientError<"BetaStreamSessionThreadEvents413", typeof BetaStreamSessionThreadEvents413.Type> + | AnthropicClientError<"BetaStreamSessionThreadEvents429", typeof BetaStreamSessionThreadEvents429.Type> + | AnthropicClientError<"BetaStreamSessionThreadEvents431", typeof BetaStreamSessionThreadEvents431.Type> + | AnthropicClientError<"BetaStreamSessionThreadEvents499", typeof BetaStreamSessionThreadEvents499.Type> + | AnthropicClientError<"BetaStreamSessionThreadEvents500", typeof BetaStreamSessionThreadEvents500.Type> + | AnthropicClientError<"BetaStreamSessionThreadEvents501", typeof BetaStreamSessionThreadEvents501.Type> + | AnthropicClientError<"BetaStreamSessionThreadEvents503", typeof BetaStreamSessionThreadEvents503.Type> + | AnthropicClientError<"BetaStreamSessionThreadEvents504", typeof BetaStreamSessionThreadEvents504.Type> > /** - * Count the number of tokens in a Message. - * - * The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it. - * - * Learn more about token counting in our [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting) + * Archive Session Thread */ - readonly "messagesCountTokensPost": ( + readonly "BetaArchiveSessionThread": ( + sessionId: string, + threadId: string, options: { - readonly params?: typeof MessagesCountTokensPostParams.Encoded | undefined - readonly payload: typeof MessagesCountTokensPostRequestJson.Encoded + readonly params?: typeof BetaArchiveSessionThreadParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaArchiveSessionThread400", typeof BetaArchiveSessionThread400.Type> + | AnthropicClientError<"BetaArchiveSessionThread401", typeof BetaArchiveSessionThread401.Type> + | AnthropicClientError<"BetaArchiveSessionThread403", typeof BetaArchiveSessionThread403.Type> + | AnthropicClientError<"BetaArchiveSessionThread404", typeof BetaArchiveSessionThread404.Type> + | AnthropicClientError<"BetaArchiveSessionThread408", typeof BetaArchiveSessionThread408.Type> + | AnthropicClientError<"BetaArchiveSessionThread409", typeof BetaArchiveSessionThread409.Type> + | AnthropicClientError<"BetaArchiveSessionThread412", typeof BetaArchiveSessionThread412.Type> + | AnthropicClientError<"BetaArchiveSessionThread413", typeof BetaArchiveSessionThread413.Type> + | AnthropicClientError<"BetaArchiveSessionThread429", typeof BetaArchiveSessionThread429.Type> + | AnthropicClientError<"BetaArchiveSessionThread431", typeof BetaArchiveSessionThread431.Type> + | AnthropicClientError<"BetaArchiveSessionThread499", typeof BetaArchiveSessionThread499.Type> + | AnthropicClientError<"BetaArchiveSessionThread500", typeof BetaArchiveSessionThread500.Type> + | AnthropicClientError<"BetaArchiveSessionThread501", typeof BetaArchiveSessionThread501.Type> + | AnthropicClientError<"BetaArchiveSessionThread503", typeof BetaArchiveSessionThread503.Type> + | AnthropicClientError<"BetaArchiveSessionThread504", typeof BetaArchiveSessionThread504.Type> + > + /** + * List Session Resources + */ + readonly "BetaListResources": ( + sessionId: string, + options: { + readonly params?: typeof BetaListResourcesParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaListResources400", typeof BetaListResources400.Type> + | AnthropicClientError<"BetaListResources401", typeof BetaListResources401.Type> + | AnthropicClientError<"BetaListResources403", typeof BetaListResources403.Type> + | AnthropicClientError<"BetaListResources404", typeof BetaListResources404.Type> + | AnthropicClientError<"BetaListResources408", typeof BetaListResources408.Type> + | AnthropicClientError<"BetaListResources409", typeof BetaListResources409.Type> + | AnthropicClientError<"BetaListResources412", typeof BetaListResources412.Type> + | AnthropicClientError<"BetaListResources413", typeof BetaListResources413.Type> + | AnthropicClientError<"BetaListResources429", typeof BetaListResources429.Type> + | AnthropicClientError<"BetaListResources431", typeof BetaListResources431.Type> + | AnthropicClientError<"BetaListResources499", typeof BetaListResources499.Type> + | AnthropicClientError<"BetaListResources500", typeof BetaListResources500.Type> + | AnthropicClientError<"BetaListResources501", typeof BetaListResources501.Type> + | AnthropicClientError<"BetaListResources503", typeof BetaListResources503.Type> + | AnthropicClientError<"BetaListResources504", typeof BetaListResources504.Type> + > + /** + * Add Session Resource + */ + readonly "BetaAddResource": ( + sessionId: string, + options: { + readonly params?: typeof BetaAddResourceParams.Encoded | undefined + readonly payload: typeof BetaAddResourceRequestJson.Encoded readonly config?: Config | undefined } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"MessagesCountTokensPost4XX", typeof MessagesCountTokensPost4XX.Type> + | AnthropicClientError<"BetaAddResource400", typeof BetaAddResource400.Type> + | AnthropicClientError<"BetaAddResource401", typeof BetaAddResource401.Type> + | AnthropicClientError<"BetaAddResource403", typeof BetaAddResource403.Type> + | AnthropicClientError<"BetaAddResource404", typeof BetaAddResource404.Type> + | AnthropicClientError<"BetaAddResource408", typeof BetaAddResource408.Type> + | AnthropicClientError<"BetaAddResource409", typeof BetaAddResource409.Type> + | AnthropicClientError<"BetaAddResource412", typeof BetaAddResource412.Type> + | AnthropicClientError<"BetaAddResource413", typeof BetaAddResource413.Type> + | AnthropicClientError<"BetaAddResource429", typeof BetaAddResource429.Type> + | AnthropicClientError<"BetaAddResource431", typeof BetaAddResource431.Type> + | AnthropicClientError<"BetaAddResource499", typeof BetaAddResource499.Type> + | AnthropicClientError<"BetaAddResource500", typeof BetaAddResource500.Type> + | AnthropicClientError<"BetaAddResource501", typeof BetaAddResource501.Type> + | AnthropicClientError<"BetaAddResource503", typeof BetaAddResource503.Type> + | AnthropicClientError<"BetaAddResource504", typeof BetaAddResource504.Type> > /** - * List Files + * Get Session Resource */ - readonly "listFilesV1FilesGet": ( + readonly "BetaGetResource": ( + sessionId: string, + resourceId: string, options: { - readonly params?: typeof ListFilesV1FilesGetParams.Encoded | undefined + readonly params?: typeof BetaGetResourceParams.Encoded | undefined readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"ListFilesV1FilesGet4XX", typeof ListFilesV1FilesGet4XX.Type> + | AnthropicClientError<"BetaGetResource400", typeof BetaGetResource400.Type> + | AnthropicClientError<"BetaGetResource401", typeof BetaGetResource401.Type> + | AnthropicClientError<"BetaGetResource403", typeof BetaGetResource403.Type> + | AnthropicClientError<"BetaGetResource404", typeof BetaGetResource404.Type> + | AnthropicClientError<"BetaGetResource408", typeof BetaGetResource408.Type> + | AnthropicClientError<"BetaGetResource409", typeof BetaGetResource409.Type> + | AnthropicClientError<"BetaGetResource412", typeof BetaGetResource412.Type> + | AnthropicClientError<"BetaGetResource413", typeof BetaGetResource413.Type> + | AnthropicClientError<"BetaGetResource429", typeof BetaGetResource429.Type> + | AnthropicClientError<"BetaGetResource431", typeof BetaGetResource431.Type> + | AnthropicClientError<"BetaGetResource499", typeof BetaGetResource499.Type> + | AnthropicClientError<"BetaGetResource500", typeof BetaGetResource500.Type> + | AnthropicClientError<"BetaGetResource501", typeof BetaGetResource501.Type> + | AnthropicClientError<"BetaGetResource503", typeof BetaGetResource503.Type> + | AnthropicClientError<"BetaGetResource504", typeof BetaGetResource504.Type> > /** - * Upload File + * Update Session Resource */ - readonly "uploadFileV1FilesPost": ( + readonly "BetaUpdateResource": ( + sessionId: string, + resourceId: string, options: { - readonly params?: typeof UploadFileV1FilesPostParams.Encoded | undefined - readonly payload: typeof UploadFileV1FilesPostRequestFormData.Encoded + readonly params?: typeof BetaUpdateResourceParams.Encoded | undefined + readonly payload: typeof BetaUpdateResourceRequestJson.Encoded readonly config?: Config | undefined } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"UploadFileV1FilesPost4XX", typeof UploadFileV1FilesPost4XX.Type> + | AnthropicClientError<"BetaUpdateResource400", typeof BetaUpdateResource400.Type> + | AnthropicClientError<"BetaUpdateResource401", typeof BetaUpdateResource401.Type> + | AnthropicClientError<"BetaUpdateResource403", typeof BetaUpdateResource403.Type> + | AnthropicClientError<"BetaUpdateResource404", typeof BetaUpdateResource404.Type> + | AnthropicClientError<"BetaUpdateResource408", typeof BetaUpdateResource408.Type> + | AnthropicClientError<"BetaUpdateResource409", typeof BetaUpdateResource409.Type> + | AnthropicClientError<"BetaUpdateResource412", typeof BetaUpdateResource412.Type> + | AnthropicClientError<"BetaUpdateResource413", typeof BetaUpdateResource413.Type> + | AnthropicClientError<"BetaUpdateResource429", typeof BetaUpdateResource429.Type> + | AnthropicClientError<"BetaUpdateResource431", typeof BetaUpdateResource431.Type> + | AnthropicClientError<"BetaUpdateResource499", typeof BetaUpdateResource499.Type> + | AnthropicClientError<"BetaUpdateResource500", typeof BetaUpdateResource500.Type> + | AnthropicClientError<"BetaUpdateResource501", typeof BetaUpdateResource501.Type> + | AnthropicClientError<"BetaUpdateResource503", typeof BetaUpdateResource503.Type> + | AnthropicClientError<"BetaUpdateResource504", typeof BetaUpdateResource504.Type> > /** - * Get File Metadata + * Delete Session Resource */ - readonly "getFileMetadataV1FilesFileIdGet": ( - fileId: string, + readonly "BetaDeleteResource": ( + sessionId: string, + resourceId: string, options: { - readonly params?: typeof GetFileMetadataV1FilesFileIdGetParams.Encoded | undefined + readonly params?: typeof BetaDeleteResourceParams.Encoded | undefined readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"GetFileMetadataV1FilesFileIdGet4XX", typeof GetFileMetadataV1FilesFileIdGet4XX.Type> + | AnthropicClientError<"BetaDeleteResource400", typeof BetaDeleteResource400.Type> + | AnthropicClientError<"BetaDeleteResource401", typeof BetaDeleteResource401.Type> + | AnthropicClientError<"BetaDeleteResource403", typeof BetaDeleteResource403.Type> + | AnthropicClientError<"BetaDeleteResource404", typeof BetaDeleteResource404.Type> + | AnthropicClientError<"BetaDeleteResource408", typeof BetaDeleteResource408.Type> + | AnthropicClientError<"BetaDeleteResource409", typeof BetaDeleteResource409.Type> + | AnthropicClientError<"BetaDeleteResource412", typeof BetaDeleteResource412.Type> + | AnthropicClientError<"BetaDeleteResource413", typeof BetaDeleteResource413.Type> + | AnthropicClientError<"BetaDeleteResource429", typeof BetaDeleteResource429.Type> + | AnthropicClientError<"BetaDeleteResource431", typeof BetaDeleteResource431.Type> + | AnthropicClientError<"BetaDeleteResource499", typeof BetaDeleteResource499.Type> + | AnthropicClientError<"BetaDeleteResource500", typeof BetaDeleteResource500.Type> + | AnthropicClientError<"BetaDeleteResource501", typeof BetaDeleteResource501.Type> + | AnthropicClientError<"BetaDeleteResource503", typeof BetaDeleteResource503.Type> + | AnthropicClientError<"BetaDeleteResource504", typeof BetaDeleteResource504.Type> > /** - * Delete File + * List Agents */ - readonly "deleteFileV1FilesFileIdDelete": ( - fileId: string, + readonly "BetaListAgents": ( + options: + | { readonly params?: typeof BetaListAgentsParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaListAgents400", typeof BetaListAgents400.Type> + | AnthropicClientError<"BetaListAgents401", typeof BetaListAgents401.Type> + | AnthropicClientError<"BetaListAgents403", typeof BetaListAgents403.Type> + | AnthropicClientError<"BetaListAgents404", typeof BetaListAgents404.Type> + | AnthropicClientError<"BetaListAgents408", typeof BetaListAgents408.Type> + | AnthropicClientError<"BetaListAgents409", typeof BetaListAgents409.Type> + | AnthropicClientError<"BetaListAgents412", typeof BetaListAgents412.Type> + | AnthropicClientError<"BetaListAgents413", typeof BetaListAgents413.Type> + | AnthropicClientError<"BetaListAgents429", typeof BetaListAgents429.Type> + | AnthropicClientError<"BetaListAgents431", typeof BetaListAgents431.Type> + | AnthropicClientError<"BetaListAgents499", typeof BetaListAgents499.Type> + | AnthropicClientError<"BetaListAgents500", typeof BetaListAgents500.Type> + | AnthropicClientError<"BetaListAgents501", typeof BetaListAgents501.Type> + | AnthropicClientError<"BetaListAgents503", typeof BetaListAgents503.Type> + | AnthropicClientError<"BetaListAgents504", typeof BetaListAgents504.Type> + > + /** + * Create Agent + */ + readonly "BetaCreateAgent": ( + options: { + readonly params?: typeof BetaCreateAgentParams.Encoded | undefined + readonly payload: typeof BetaCreateAgentRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaCreateAgent400", typeof BetaCreateAgent400.Type> + | AnthropicClientError<"BetaCreateAgent401", typeof BetaCreateAgent401.Type> + | AnthropicClientError<"BetaCreateAgent403", typeof BetaCreateAgent403.Type> + | AnthropicClientError<"BetaCreateAgent404", typeof BetaCreateAgent404.Type> + | AnthropicClientError<"BetaCreateAgent408", typeof BetaCreateAgent408.Type> + | AnthropicClientError<"BetaCreateAgent409", typeof BetaCreateAgent409.Type> + | AnthropicClientError<"BetaCreateAgent412", typeof BetaCreateAgent412.Type> + | AnthropicClientError<"BetaCreateAgent413", typeof BetaCreateAgent413.Type> + | AnthropicClientError<"BetaCreateAgent429", typeof BetaCreateAgent429.Type> + | AnthropicClientError<"BetaCreateAgent431", typeof BetaCreateAgent431.Type> + | AnthropicClientError<"BetaCreateAgent499", typeof BetaCreateAgent499.Type> + | AnthropicClientError<"BetaCreateAgent500", typeof BetaCreateAgent500.Type> + | AnthropicClientError<"BetaCreateAgent501", typeof BetaCreateAgent501.Type> + | AnthropicClientError<"BetaCreateAgent503", typeof BetaCreateAgent503.Type> + | AnthropicClientError<"BetaCreateAgent504", typeof BetaCreateAgent504.Type> + > + /** + * Get Agent + */ + readonly "BetaGetAgent": ( + agentId: string, + options: + | { readonly params?: typeof BetaGetAgentParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaGetAgent400", typeof BetaGetAgent400.Type> + | AnthropicClientError<"BetaGetAgent401", typeof BetaGetAgent401.Type> + | AnthropicClientError<"BetaGetAgent403", typeof BetaGetAgent403.Type> + | AnthropicClientError<"BetaGetAgent404", typeof BetaGetAgent404.Type> + | AnthropicClientError<"BetaGetAgent408", typeof BetaGetAgent408.Type> + | AnthropicClientError<"BetaGetAgent409", typeof BetaGetAgent409.Type> + | AnthropicClientError<"BetaGetAgent412", typeof BetaGetAgent412.Type> + | AnthropicClientError<"BetaGetAgent413", typeof BetaGetAgent413.Type> + | AnthropicClientError<"BetaGetAgent429", typeof BetaGetAgent429.Type> + | AnthropicClientError<"BetaGetAgent431", typeof BetaGetAgent431.Type> + | AnthropicClientError<"BetaGetAgent499", typeof BetaGetAgent499.Type> + | AnthropicClientError<"BetaGetAgent500", typeof BetaGetAgent500.Type> + | AnthropicClientError<"BetaGetAgent501", typeof BetaGetAgent501.Type> + | AnthropicClientError<"BetaGetAgent503", typeof BetaGetAgent503.Type> + | AnthropicClientError<"BetaGetAgent504", typeof BetaGetAgent504.Type> + > + /** + * Update Agent + */ + readonly "BetaUpdateAgent": ( + agentId: string, + options: { + readonly params?: typeof BetaUpdateAgentParams.Encoded | undefined + readonly payload: typeof BetaUpdateAgentRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaUpdateAgent400", typeof BetaUpdateAgent400.Type> + | AnthropicClientError<"BetaUpdateAgent401", typeof BetaUpdateAgent401.Type> + | AnthropicClientError<"BetaUpdateAgent403", typeof BetaUpdateAgent403.Type> + | AnthropicClientError<"BetaUpdateAgent404", typeof BetaUpdateAgent404.Type> + | AnthropicClientError<"BetaUpdateAgent408", typeof BetaUpdateAgent408.Type> + | AnthropicClientError<"BetaUpdateAgent409", typeof BetaUpdateAgent409.Type> + | AnthropicClientError<"BetaUpdateAgent412", typeof BetaUpdateAgent412.Type> + | AnthropicClientError<"BetaUpdateAgent413", typeof BetaUpdateAgent413.Type> + | AnthropicClientError<"BetaUpdateAgent429", typeof BetaUpdateAgent429.Type> + | AnthropicClientError<"BetaUpdateAgent431", typeof BetaUpdateAgent431.Type> + | AnthropicClientError<"BetaUpdateAgent499", typeof BetaUpdateAgent499.Type> + | AnthropicClientError<"BetaUpdateAgent500", typeof BetaUpdateAgent500.Type> + | AnthropicClientError<"BetaUpdateAgent501", typeof BetaUpdateAgent501.Type> + | AnthropicClientError<"BetaUpdateAgent503", typeof BetaUpdateAgent503.Type> + | AnthropicClientError<"BetaUpdateAgent504", typeof BetaUpdateAgent504.Type> + > + /** + * Archive Agent + */ + readonly "BetaArchiveAgent": ( + agentId: string, options: { - readonly params?: typeof DeleteFileV1FilesFileIdDeleteParams.Encoded | undefined + readonly params?: typeof BetaArchiveAgentParams.Encoded | undefined readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"DeleteFileV1FilesFileIdDelete4XX", typeof DeleteFileV1FilesFileIdDelete4XX.Type> + | AnthropicClientError<"BetaArchiveAgent400", typeof BetaArchiveAgent400.Type> + | AnthropicClientError<"BetaArchiveAgent401", typeof BetaArchiveAgent401.Type> + | AnthropicClientError<"BetaArchiveAgent403", typeof BetaArchiveAgent403.Type> + | AnthropicClientError<"BetaArchiveAgent404", typeof BetaArchiveAgent404.Type> + | AnthropicClientError<"BetaArchiveAgent408", typeof BetaArchiveAgent408.Type> + | AnthropicClientError<"BetaArchiveAgent409", typeof BetaArchiveAgent409.Type> + | AnthropicClientError<"BetaArchiveAgent412", typeof BetaArchiveAgent412.Type> + | AnthropicClientError<"BetaArchiveAgent413", typeof BetaArchiveAgent413.Type> + | AnthropicClientError<"BetaArchiveAgent429", typeof BetaArchiveAgent429.Type> + | AnthropicClientError<"BetaArchiveAgent431", typeof BetaArchiveAgent431.Type> + | AnthropicClientError<"BetaArchiveAgent499", typeof BetaArchiveAgent499.Type> + | AnthropicClientError<"BetaArchiveAgent500", typeof BetaArchiveAgent500.Type> + | AnthropicClientError<"BetaArchiveAgent501", typeof BetaArchiveAgent501.Type> + | AnthropicClientError<"BetaArchiveAgent503", typeof BetaArchiveAgent503.Type> + | AnthropicClientError<"BetaArchiveAgent504", typeof BetaArchiveAgent504.Type> > /** - * Download File + * List Agent Versions */ - readonly "downloadFileV1FilesFileIdContentGet": ( - fileId: string, + readonly "BetaListAgentVersions": ( + agentId: string, options: { - readonly params?: typeof DownloadFileV1FilesFileIdContentGetParams.Encoded | undefined + readonly params?: typeof BetaListAgentVersionsParams.Encoded | undefined readonly config?: Config | undefined } | undefined - ) => Effect.Effect, HttpClientError.HttpClientError | SchemaError> + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaListAgentVersions400", typeof BetaListAgentVersions400.Type> + | AnthropicClientError<"BetaListAgentVersions401", typeof BetaListAgentVersions401.Type> + | AnthropicClientError<"BetaListAgentVersions403", typeof BetaListAgentVersions403.Type> + | AnthropicClientError<"BetaListAgentVersions404", typeof BetaListAgentVersions404.Type> + | AnthropicClientError<"BetaListAgentVersions408", typeof BetaListAgentVersions408.Type> + | AnthropicClientError<"BetaListAgentVersions409", typeof BetaListAgentVersions409.Type> + | AnthropicClientError<"BetaListAgentVersions412", typeof BetaListAgentVersions412.Type> + | AnthropicClientError<"BetaListAgentVersions413", typeof BetaListAgentVersions413.Type> + | AnthropicClientError<"BetaListAgentVersions429", typeof BetaListAgentVersions429.Type> + | AnthropicClientError<"BetaListAgentVersions431", typeof BetaListAgentVersions431.Type> + | AnthropicClientError<"BetaListAgentVersions499", typeof BetaListAgentVersions499.Type> + | AnthropicClientError<"BetaListAgentVersions500", typeof BetaListAgentVersions500.Type> + | AnthropicClientError<"BetaListAgentVersions501", typeof BetaListAgentVersions501.Type> + | AnthropicClientError<"BetaListAgentVersions503", typeof BetaListAgentVersions503.Type> + | AnthropicClientError<"BetaListAgentVersions504", typeof BetaListAgentVersions504.Type> + > /** - * Download File + * List Vaults */ - readonly "downloadFileV1FilesFileIdContentGetStream": ( - fileId: string, - options: { readonly params?: typeof DownloadFileV1FilesFileIdContentGetParams.Encoded | undefined } | undefined - ) => Stream.Stream + readonly "BetaListVaults": ( + options: + | { readonly params?: typeof BetaListVaultsParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaListVaults400", typeof BetaListVaults400.Type> + | AnthropicClientError<"BetaListVaults401", typeof BetaListVaults401.Type> + | AnthropicClientError<"BetaListVaults403", typeof BetaListVaults403.Type> + | AnthropicClientError<"BetaListVaults404", typeof BetaListVaults404.Type> + | AnthropicClientError<"BetaListVaults408", typeof BetaListVaults408.Type> + | AnthropicClientError<"BetaListVaults409", typeof BetaListVaults409.Type> + | AnthropicClientError<"BetaListVaults412", typeof BetaListVaults412.Type> + | AnthropicClientError<"BetaListVaults413", typeof BetaListVaults413.Type> + | AnthropicClientError<"BetaListVaults429", typeof BetaListVaults429.Type> + | AnthropicClientError<"BetaListVaults431", typeof BetaListVaults431.Type> + | AnthropicClientError<"BetaListVaults499", typeof BetaListVaults499.Type> + | AnthropicClientError<"BetaListVaults500", typeof BetaListVaults500.Type> + | AnthropicClientError<"BetaListVaults501", typeof BetaListVaults501.Type> + | AnthropicClientError<"BetaListVaults503", typeof BetaListVaults503.Type> + | AnthropicClientError<"BetaListVaults504", typeof BetaListVaults504.Type> + > /** - * List Skills + * Create Vault */ - readonly "listSkillsV1SkillsGet": ( + readonly "BetaCreateVault": ( options: { - readonly params?: typeof ListSkillsV1SkillsGetParams.Encoded | undefined + readonly params?: typeof BetaCreateVaultParams.Encoded | undefined + readonly payload: typeof BetaCreateVaultRequestJson.Encoded readonly config?: Config | undefined - } | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | AnthropicClientError<"BetaCreateVault400", typeof BetaCreateVault400.Type> + | AnthropicClientError<"BetaCreateVault401", typeof BetaCreateVault401.Type> + | AnthropicClientError<"BetaCreateVault403", typeof BetaCreateVault403.Type> + | AnthropicClientError<"BetaCreateVault404", typeof BetaCreateVault404.Type> + | AnthropicClientError<"BetaCreateVault408", typeof BetaCreateVault408.Type> + | AnthropicClientError<"BetaCreateVault409", typeof BetaCreateVault409.Type> + | AnthropicClientError<"BetaCreateVault412", typeof BetaCreateVault412.Type> + | AnthropicClientError<"BetaCreateVault413", typeof BetaCreateVault413.Type> + | AnthropicClientError<"BetaCreateVault429", typeof BetaCreateVault429.Type> + | AnthropicClientError<"BetaCreateVault431", typeof BetaCreateVault431.Type> + | AnthropicClientError<"BetaCreateVault499", typeof BetaCreateVault499.Type> + | AnthropicClientError<"BetaCreateVault500", typeof BetaCreateVault500.Type> + | AnthropicClientError<"BetaCreateVault501", typeof BetaCreateVault501.Type> + | AnthropicClientError<"BetaCreateVault503", typeof BetaCreateVault503.Type> + | AnthropicClientError<"BetaCreateVault504", typeof BetaCreateVault504.Type> + > + /** + * Get Vault + */ + readonly "BetaGetVault": ( + vaultId: string, + options: + | { readonly params?: typeof BetaGetVaultParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"ListSkillsV1SkillsGet4XX", typeof ListSkillsV1SkillsGet4XX.Type> + | AnthropicClientError<"BetaGetVault400", typeof BetaGetVault400.Type> + | AnthropicClientError<"BetaGetVault401", typeof BetaGetVault401.Type> + | AnthropicClientError<"BetaGetVault403", typeof BetaGetVault403.Type> + | AnthropicClientError<"BetaGetVault404", typeof BetaGetVault404.Type> + | AnthropicClientError<"BetaGetVault408", typeof BetaGetVault408.Type> + | AnthropicClientError<"BetaGetVault409", typeof BetaGetVault409.Type> + | AnthropicClientError<"BetaGetVault412", typeof BetaGetVault412.Type> + | AnthropicClientError<"BetaGetVault413", typeof BetaGetVault413.Type> + | AnthropicClientError<"BetaGetVault429", typeof BetaGetVault429.Type> + | AnthropicClientError<"BetaGetVault431", typeof BetaGetVault431.Type> + | AnthropicClientError<"BetaGetVault499", typeof BetaGetVault499.Type> + | AnthropicClientError<"BetaGetVault500", typeof BetaGetVault500.Type> + | AnthropicClientError<"BetaGetVault501", typeof BetaGetVault501.Type> + | AnthropicClientError<"BetaGetVault503", typeof BetaGetVault503.Type> + | AnthropicClientError<"BetaGetVault504", typeof BetaGetVault504.Type> > /** - * Create Skill + * Update Vault */ - readonly "createSkillV1SkillsPost": ( + readonly "BetaUpdateVault": ( + vaultId: string, options: { - readonly params?: typeof CreateSkillV1SkillsPostParams.Encoded | undefined - readonly payload: typeof CreateSkillV1SkillsPostRequestFormData.Encoded + readonly params?: typeof BetaUpdateVaultParams.Encoded | undefined + readonly payload: typeof BetaUpdateVaultRequestJson.Encoded readonly config?: Config | undefined } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"CreateSkillV1SkillsPost4XX", typeof CreateSkillV1SkillsPost4XX.Type> + | AnthropicClientError<"BetaUpdateVault400", typeof BetaUpdateVault400.Type> + | AnthropicClientError<"BetaUpdateVault401", typeof BetaUpdateVault401.Type> + | AnthropicClientError<"BetaUpdateVault403", typeof BetaUpdateVault403.Type> + | AnthropicClientError<"BetaUpdateVault404", typeof BetaUpdateVault404.Type> + | AnthropicClientError<"BetaUpdateVault408", typeof BetaUpdateVault408.Type> + | AnthropicClientError<"BetaUpdateVault409", typeof BetaUpdateVault409.Type> + | AnthropicClientError<"BetaUpdateVault412", typeof BetaUpdateVault412.Type> + | AnthropicClientError<"BetaUpdateVault413", typeof BetaUpdateVault413.Type> + | AnthropicClientError<"BetaUpdateVault429", typeof BetaUpdateVault429.Type> + | AnthropicClientError<"BetaUpdateVault431", typeof BetaUpdateVault431.Type> + | AnthropicClientError<"BetaUpdateVault499", typeof BetaUpdateVault499.Type> + | AnthropicClientError<"BetaUpdateVault500", typeof BetaUpdateVault500.Type> + | AnthropicClientError<"BetaUpdateVault501", typeof BetaUpdateVault501.Type> + | AnthropicClientError<"BetaUpdateVault503", typeof BetaUpdateVault503.Type> + | AnthropicClientError<"BetaUpdateVault504", typeof BetaUpdateVault504.Type> > /** - * Get Skill + * Delete Vault */ - readonly "getSkillV1SkillsSkillIdGet": ( - skillId: string, + readonly "BetaDeleteVault": ( + vaultId: string, options: { - readonly params?: typeof GetSkillV1SkillsSkillIdGetParams.Encoded | undefined + readonly params?: typeof BetaDeleteVaultParams.Encoded | undefined readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"GetSkillV1SkillsSkillIdGet4XX", typeof GetSkillV1SkillsSkillIdGet4XX.Type> + | AnthropicClientError<"BetaDeleteVault400", typeof BetaDeleteVault400.Type> + | AnthropicClientError<"BetaDeleteVault401", typeof BetaDeleteVault401.Type> + | AnthropicClientError<"BetaDeleteVault403", typeof BetaDeleteVault403.Type> + | AnthropicClientError<"BetaDeleteVault404", typeof BetaDeleteVault404.Type> + | AnthropicClientError<"BetaDeleteVault408", typeof BetaDeleteVault408.Type> + | AnthropicClientError<"BetaDeleteVault409", typeof BetaDeleteVault409.Type> + | AnthropicClientError<"BetaDeleteVault412", typeof BetaDeleteVault412.Type> + | AnthropicClientError<"BetaDeleteVault413", typeof BetaDeleteVault413.Type> + | AnthropicClientError<"BetaDeleteVault429", typeof BetaDeleteVault429.Type> + | AnthropicClientError<"BetaDeleteVault431", typeof BetaDeleteVault431.Type> + | AnthropicClientError<"BetaDeleteVault499", typeof BetaDeleteVault499.Type> + | AnthropicClientError<"BetaDeleteVault500", typeof BetaDeleteVault500.Type> + | AnthropicClientError<"BetaDeleteVault501", typeof BetaDeleteVault501.Type> + | AnthropicClientError<"BetaDeleteVault503", typeof BetaDeleteVault503.Type> + | AnthropicClientError<"BetaDeleteVault504", typeof BetaDeleteVault504.Type> > /** - * Delete Skill + * Archive Vault */ - readonly "deleteSkillV1SkillsSkillIdDelete": ( - skillId: string, + readonly "BetaArchiveVault": ( + vaultId: string, options: { - readonly params?: typeof DeleteSkillV1SkillsSkillIdDeleteParams.Encoded | undefined + readonly params?: typeof BetaArchiveVaultParams.Encoded | undefined readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"DeleteSkillV1SkillsSkillIdDelete4XX", typeof DeleteSkillV1SkillsSkillIdDelete4XX.Type> + | AnthropicClientError<"BetaArchiveVault400", typeof BetaArchiveVault400.Type> + | AnthropicClientError<"BetaArchiveVault401", typeof BetaArchiveVault401.Type> + | AnthropicClientError<"BetaArchiveVault403", typeof BetaArchiveVault403.Type> + | AnthropicClientError<"BetaArchiveVault404", typeof BetaArchiveVault404.Type> + | AnthropicClientError<"BetaArchiveVault408", typeof BetaArchiveVault408.Type> + | AnthropicClientError<"BetaArchiveVault409", typeof BetaArchiveVault409.Type> + | AnthropicClientError<"BetaArchiveVault412", typeof BetaArchiveVault412.Type> + | AnthropicClientError<"BetaArchiveVault413", typeof BetaArchiveVault413.Type> + | AnthropicClientError<"BetaArchiveVault429", typeof BetaArchiveVault429.Type> + | AnthropicClientError<"BetaArchiveVault431", typeof BetaArchiveVault431.Type> + | AnthropicClientError<"BetaArchiveVault499", typeof BetaArchiveVault499.Type> + | AnthropicClientError<"BetaArchiveVault500", typeof BetaArchiveVault500.Type> + | AnthropicClientError<"BetaArchiveVault501", typeof BetaArchiveVault501.Type> + | AnthropicClientError<"BetaArchiveVault503", typeof BetaArchiveVault503.Type> + | AnthropicClientError<"BetaArchiveVault504", typeof BetaArchiveVault504.Type> > /** - * List Skill Versions + * List Credentials */ - readonly "listSkillVersionsV1SkillsSkillIdVersionsGet": ( - skillId: string, + readonly "BetaListCredentials": ( + vaultId: string, options: { - readonly params?: typeof ListSkillVersionsV1SkillsSkillIdVersionsGetParams.Encoded | undefined + readonly params?: typeof BetaListCredentialsParams.Encoded | undefined readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError< - "ListSkillVersionsV1SkillsSkillIdVersionsGet4XX", - typeof ListSkillVersionsV1SkillsSkillIdVersionsGet4XX.Type - > + | AnthropicClientError<"BetaListCredentials400", typeof BetaListCredentials400.Type> + | AnthropicClientError<"BetaListCredentials401", typeof BetaListCredentials401.Type> + | AnthropicClientError<"BetaListCredentials403", typeof BetaListCredentials403.Type> + | AnthropicClientError<"BetaListCredentials404", typeof BetaListCredentials404.Type> + | AnthropicClientError<"BetaListCredentials408", typeof BetaListCredentials408.Type> + | AnthropicClientError<"BetaListCredentials409", typeof BetaListCredentials409.Type> + | AnthropicClientError<"BetaListCredentials412", typeof BetaListCredentials412.Type> + | AnthropicClientError<"BetaListCredentials413", typeof BetaListCredentials413.Type> + | AnthropicClientError<"BetaListCredentials429", typeof BetaListCredentials429.Type> + | AnthropicClientError<"BetaListCredentials431", typeof BetaListCredentials431.Type> + | AnthropicClientError<"BetaListCredentials499", typeof BetaListCredentials499.Type> + | AnthropicClientError<"BetaListCredentials500", typeof BetaListCredentials500.Type> + | AnthropicClientError<"BetaListCredentials501", typeof BetaListCredentials501.Type> + | AnthropicClientError<"BetaListCredentials503", typeof BetaListCredentials503.Type> + | AnthropicClientError<"BetaListCredentials504", typeof BetaListCredentials504.Type> > /** - * Create Skill Version + * Create Credential */ - readonly "createSkillVersionV1SkillsSkillIdVersionsPost": ( - skillId: string, + readonly "BetaCreateCredential": ( + vaultId: string, options: { - readonly params?: typeof CreateSkillVersionV1SkillsSkillIdVersionsPostParams.Encoded | undefined - readonly payload: typeof CreateSkillVersionV1SkillsSkillIdVersionsPostRequestFormData.Encoded + readonly params?: typeof BetaCreateCredentialParams.Encoded | undefined + readonly payload: typeof BetaCreateCredentialRequestJson.Encoded readonly config?: Config | undefined } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError< - "CreateSkillVersionV1SkillsSkillIdVersionsPost4XX", - typeof CreateSkillVersionV1SkillsSkillIdVersionsPost4XX.Type - > + | AnthropicClientError<"BetaCreateCredential400", typeof BetaCreateCredential400.Type> + | AnthropicClientError<"BetaCreateCredential401", typeof BetaCreateCredential401.Type> + | AnthropicClientError<"BetaCreateCredential403", typeof BetaCreateCredential403.Type> + | AnthropicClientError<"BetaCreateCredential404", typeof BetaCreateCredential404.Type> + | AnthropicClientError<"BetaCreateCredential408", typeof BetaCreateCredential408.Type> + | AnthropicClientError<"BetaCreateCredential409", typeof BetaCreateCredential409.Type> + | AnthropicClientError<"BetaCreateCredential412", typeof BetaCreateCredential412.Type> + | AnthropicClientError<"BetaCreateCredential413", typeof BetaCreateCredential413.Type> + | AnthropicClientError<"BetaCreateCredential429", typeof BetaCreateCredential429.Type> + | AnthropicClientError<"BetaCreateCredential431", typeof BetaCreateCredential431.Type> + | AnthropicClientError<"BetaCreateCredential499", typeof BetaCreateCredential499.Type> + | AnthropicClientError<"BetaCreateCredential500", typeof BetaCreateCredential500.Type> + | AnthropicClientError<"BetaCreateCredential501", typeof BetaCreateCredential501.Type> + | AnthropicClientError<"BetaCreateCredential503", typeof BetaCreateCredential503.Type> + | AnthropicClientError<"BetaCreateCredential504", typeof BetaCreateCredential504.Type> > /** - * Get Skill Version + * Get Credential */ - readonly "getSkillVersionV1SkillsSkillIdVersionsVersionGet": ( - skillId: string, - version: string, + readonly "BetaGetCredential": ( + vaultId: string, + credentialId: string, options: { - readonly params?: typeof GetSkillVersionV1SkillsSkillIdVersionsVersionGetParams.Encoded | undefined + readonly params?: typeof BetaGetCredentialParams.Encoded | undefined readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError< - "GetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX", - typeof GetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX.Type - > + | AnthropicClientError<"BetaGetCredential400", typeof BetaGetCredential400.Type> + | AnthropicClientError<"BetaGetCredential401", typeof BetaGetCredential401.Type> + | AnthropicClientError<"BetaGetCredential403", typeof BetaGetCredential403.Type> + | AnthropicClientError<"BetaGetCredential404", typeof BetaGetCredential404.Type> + | AnthropicClientError<"BetaGetCredential408", typeof BetaGetCredential408.Type> + | AnthropicClientError<"BetaGetCredential409", typeof BetaGetCredential409.Type> + | AnthropicClientError<"BetaGetCredential412", typeof BetaGetCredential412.Type> + | AnthropicClientError<"BetaGetCredential413", typeof BetaGetCredential413.Type> + | AnthropicClientError<"BetaGetCredential429", typeof BetaGetCredential429.Type> + | AnthropicClientError<"BetaGetCredential431", typeof BetaGetCredential431.Type> + | AnthropicClientError<"BetaGetCredential499", typeof BetaGetCredential499.Type> + | AnthropicClientError<"BetaGetCredential500", typeof BetaGetCredential500.Type> + | AnthropicClientError<"BetaGetCredential501", typeof BetaGetCredential501.Type> + | AnthropicClientError<"BetaGetCredential503", typeof BetaGetCredential503.Type> + | AnthropicClientError<"BetaGetCredential504", typeof BetaGetCredential504.Type> > /** - * Delete Skill Version + * Update Credential */ - readonly "deleteSkillVersionV1SkillsSkillIdVersionsVersionDelete": ( - skillId: string, - version: string, + readonly "BetaUpdateCredential": ( + vaultId: string, + credentialId: string, options: { - readonly params?: typeof DeleteSkillVersionV1SkillsSkillIdVersionsVersionDeleteParams.Encoded | undefined + readonly params?: typeof BetaUpdateCredentialParams.Encoded | undefined + readonly payload: typeof BetaUpdateCredentialRequestJson.Encoded readonly config?: Config | undefined - } | undefined + } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError< - "DeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX", - typeof DeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX.Type - > + | AnthropicClientError<"BetaUpdateCredential400", typeof BetaUpdateCredential400.Type> + | AnthropicClientError<"BetaUpdateCredential401", typeof BetaUpdateCredential401.Type> + | AnthropicClientError<"BetaUpdateCredential403", typeof BetaUpdateCredential403.Type> + | AnthropicClientError<"BetaUpdateCredential404", typeof BetaUpdateCredential404.Type> + | AnthropicClientError<"BetaUpdateCredential408", typeof BetaUpdateCredential408.Type> + | AnthropicClientError<"BetaUpdateCredential409", typeof BetaUpdateCredential409.Type> + | AnthropicClientError<"BetaUpdateCredential412", typeof BetaUpdateCredential412.Type> + | AnthropicClientError<"BetaUpdateCredential413", typeof BetaUpdateCredential413.Type> + | AnthropicClientError<"BetaUpdateCredential429", typeof BetaUpdateCredential429.Type> + | AnthropicClientError<"BetaUpdateCredential431", typeof BetaUpdateCredential431.Type> + | AnthropicClientError<"BetaUpdateCredential499", typeof BetaUpdateCredential499.Type> + | AnthropicClientError<"BetaUpdateCredential500", typeof BetaUpdateCredential500.Type> + | AnthropicClientError<"BetaUpdateCredential501", typeof BetaUpdateCredential501.Type> + | AnthropicClientError<"BetaUpdateCredential503", typeof BetaUpdateCredential503.Type> + | AnthropicClientError<"BetaUpdateCredential504", typeof BetaUpdateCredential504.Type> > /** - * Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation. - * - * The Messages API can be used for either single queries or stateless multi-turn conversations. - * - * Learn more about the Messages API in our [user guide](https://docs.claude.com/en/docs/initial-setup) + * Delete Credential */ - readonly "betaMessagesPost": ( + readonly "BetaDeleteCredential": ( + vaultId: string, + credentialId: string, options: { - readonly params?: typeof BetaMessagesPostParams.Encoded | undefined - readonly payload: typeof BetaMessagesPostRequestJson.Encoded + readonly params?: typeof BetaDeleteCredentialParams.Encoded | undefined readonly config?: Config | undefined - } + } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"BetaMessagesPost4XX", typeof BetaMessagesPost4XX.Type> + | AnthropicClientError<"BetaDeleteCredential400", typeof BetaDeleteCredential400.Type> + | AnthropicClientError<"BetaDeleteCredential401", typeof BetaDeleteCredential401.Type> + | AnthropicClientError<"BetaDeleteCredential403", typeof BetaDeleteCredential403.Type> + | AnthropicClientError<"BetaDeleteCredential404", typeof BetaDeleteCredential404.Type> + | AnthropicClientError<"BetaDeleteCredential408", typeof BetaDeleteCredential408.Type> + | AnthropicClientError<"BetaDeleteCredential409", typeof BetaDeleteCredential409.Type> + | AnthropicClientError<"BetaDeleteCredential412", typeof BetaDeleteCredential412.Type> + | AnthropicClientError<"BetaDeleteCredential413", typeof BetaDeleteCredential413.Type> + | AnthropicClientError<"BetaDeleteCredential429", typeof BetaDeleteCredential429.Type> + | AnthropicClientError<"BetaDeleteCredential431", typeof BetaDeleteCredential431.Type> + | AnthropicClientError<"BetaDeleteCredential499", typeof BetaDeleteCredential499.Type> + | AnthropicClientError<"BetaDeleteCredential500", typeof BetaDeleteCredential500.Type> + | AnthropicClientError<"BetaDeleteCredential501", typeof BetaDeleteCredential501.Type> + | AnthropicClientError<"BetaDeleteCredential503", typeof BetaDeleteCredential503.Type> + | AnthropicClientError<"BetaDeleteCredential504", typeof BetaDeleteCredential504.Type> > /** - * List available models. - * - * The Models API response can be used to determine which models are available for use in the API. More recently released models are listed first. + * Archive Credential */ - readonly "betaModelsList": ( - options: - | { readonly params?: typeof BetaModelsListParams.Encoded | undefined; readonly config?: Config | undefined } - | undefined + readonly "BetaArchiveCredential": ( + vaultId: string, + credentialId: string, + options: { + readonly params?: typeof BetaArchiveCredentialParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"BetaModelsList4XX", typeof BetaModelsList4XX.Type> + | AnthropicClientError<"BetaArchiveCredential400", typeof BetaArchiveCredential400.Type> + | AnthropicClientError<"BetaArchiveCredential401", typeof BetaArchiveCredential401.Type> + | AnthropicClientError<"BetaArchiveCredential403", typeof BetaArchiveCredential403.Type> + | AnthropicClientError<"BetaArchiveCredential404", typeof BetaArchiveCredential404.Type> + | AnthropicClientError<"BetaArchiveCredential408", typeof BetaArchiveCredential408.Type> + | AnthropicClientError<"BetaArchiveCredential409", typeof BetaArchiveCredential409.Type> + | AnthropicClientError<"BetaArchiveCredential412", typeof BetaArchiveCredential412.Type> + | AnthropicClientError<"BetaArchiveCredential413", typeof BetaArchiveCredential413.Type> + | AnthropicClientError<"BetaArchiveCredential429", typeof BetaArchiveCredential429.Type> + | AnthropicClientError<"BetaArchiveCredential431", typeof BetaArchiveCredential431.Type> + | AnthropicClientError<"BetaArchiveCredential499", typeof BetaArchiveCredential499.Type> + | AnthropicClientError<"BetaArchiveCredential500", typeof BetaArchiveCredential500.Type> + | AnthropicClientError<"BetaArchiveCredential501", typeof BetaArchiveCredential501.Type> + | AnthropicClientError<"BetaArchiveCredential503", typeof BetaArchiveCredential503.Type> + | AnthropicClientError<"BetaArchiveCredential504", typeof BetaArchiveCredential504.Type> > /** - * Get a specific model. - * - * The Models API response can be used to determine information about a specific model or resolve a model alias to a model ID. + * Validate Credential */ - readonly "betaModelsGet": ( - modelId: string, - options: - | { readonly params?: typeof BetaModelsGetParams.Encoded | undefined; readonly config?: Config | undefined } - | undefined + readonly "BetaValidateCredential": ( + vaultId: string, + credentialId: string, + options: { + readonly params?: typeof BetaValidateCredentialParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"BetaModelsGet4XX", typeof BetaModelsGet4XX.Type> + | AnthropicClientError<"BetaValidateCredential400", typeof BetaValidateCredential400.Type> + | AnthropicClientError<"BetaValidateCredential401", typeof BetaValidateCredential401.Type> + | AnthropicClientError<"BetaValidateCredential403", typeof BetaValidateCredential403.Type> + | AnthropicClientError<"BetaValidateCredential404", typeof BetaValidateCredential404.Type> + | AnthropicClientError<"BetaValidateCredential408", typeof BetaValidateCredential408.Type> + | AnthropicClientError<"BetaValidateCredential409", typeof BetaValidateCredential409.Type> + | AnthropicClientError<"BetaValidateCredential412", typeof BetaValidateCredential412.Type> + | AnthropicClientError<"BetaValidateCredential413", typeof BetaValidateCredential413.Type> + | AnthropicClientError<"BetaValidateCredential429", typeof BetaValidateCredential429.Type> + | AnthropicClientError<"BetaValidateCredential431", typeof BetaValidateCredential431.Type> + | AnthropicClientError<"BetaValidateCredential499", typeof BetaValidateCredential499.Type> + | AnthropicClientError<"BetaValidateCredential500", typeof BetaValidateCredential500.Type> + | AnthropicClientError<"BetaValidateCredential501", typeof BetaValidateCredential501.Type> + | AnthropicClientError<"BetaValidateCredential503", typeof BetaValidateCredential503.Type> + | AnthropicClientError<"BetaValidateCredential504", typeof BetaValidateCredential504.Type> > /** - * List all Message Batches within a Workspace. Most recently created batches are returned first. - * - * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + * List memories */ - readonly "betaMessageBatchesList": ( + readonly "BetaListMemories": ( + memoryStoreId: string, options: { - readonly params?: typeof BetaMessageBatchesListParams.Encoded | undefined + readonly params?: typeof BetaListMemoriesParams.Encoded | undefined readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"BetaMessageBatchesList4XX", typeof BetaMessageBatchesList4XX.Type> + | AnthropicClientError<"BetaListMemories400", typeof BetaListMemories400.Type> + | AnthropicClientError<"BetaListMemories401", typeof BetaListMemories401.Type> + | AnthropicClientError<"BetaListMemories403", typeof BetaListMemories403.Type> + | AnthropicClientError<"BetaListMemories404", typeof BetaListMemories404.Type> + | AnthropicClientError<"BetaListMemories408", typeof BetaListMemories408.Type> + | AnthropicClientError<"BetaListMemories409", typeof BetaListMemories409.Type> + | AnthropicClientError<"BetaListMemories412", typeof BetaListMemories412.Type> + | AnthropicClientError<"BetaListMemories413", typeof BetaListMemories413.Type> + | AnthropicClientError<"BetaListMemories429", typeof BetaListMemories429.Type> + | AnthropicClientError<"BetaListMemories431", typeof BetaListMemories431.Type> + | AnthropicClientError<"BetaListMemories499", typeof BetaListMemories499.Type> + | AnthropicClientError<"BetaListMemories500", typeof BetaListMemories500.Type> + | AnthropicClientError<"BetaListMemories501", typeof BetaListMemories501.Type> + | AnthropicClientError<"BetaListMemories503", typeof BetaListMemories503.Type> + | AnthropicClientError<"BetaListMemories504", typeof BetaListMemories504.Type> > /** - * Send a batch of Message creation requests. - * - * The Message Batches API can be used to process multiple Messages API requests at once. Once a Message Batch is created, it begins processing immediately. Batches can take up to 24 hours to complete. - * - * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + * Create a memory */ - readonly "betaMessageBatchesPost": ( + readonly "BetaCreateMemory": ( + memoryStoreId: string, options: { - readonly params?: typeof BetaMessageBatchesPostParams.Encoded | undefined - readonly payload: typeof BetaMessageBatchesPostRequestJson.Encoded + readonly params?: typeof BetaCreateMemoryParams.Encoded | undefined + readonly payload: typeof BetaCreateMemoryRequestJson.Encoded readonly config?: Config | undefined } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"BetaMessageBatchesPost4XX", typeof BetaMessageBatchesPost4XX.Type> + | AnthropicClientError<"BetaCreateMemory400", typeof BetaCreateMemory400.Type> + | AnthropicClientError<"BetaCreateMemory401", typeof BetaCreateMemory401.Type> + | AnthropicClientError<"BetaCreateMemory403", typeof BetaCreateMemory403.Type> + | AnthropicClientError<"BetaCreateMemory404", typeof BetaCreateMemory404.Type> + | AnthropicClientError<"BetaCreateMemory408", typeof BetaCreateMemory408.Type> + | AnthropicClientError<"BetaCreateMemory409", typeof BetaCreateMemory409.Type> + | AnthropicClientError<"BetaCreateMemory412", typeof BetaCreateMemory412.Type> + | AnthropicClientError<"BetaCreateMemory413", typeof BetaCreateMemory413.Type> + | AnthropicClientError<"BetaCreateMemory429", typeof BetaCreateMemory429.Type> + | AnthropicClientError<"BetaCreateMemory431", typeof BetaCreateMemory431.Type> + | AnthropicClientError<"BetaCreateMemory499", typeof BetaCreateMemory499.Type> + | AnthropicClientError<"BetaCreateMemory500", typeof BetaCreateMemory500.Type> + | AnthropicClientError<"BetaCreateMemory501", typeof BetaCreateMemory501.Type> + | AnthropicClientError<"BetaCreateMemory503", typeof BetaCreateMemory503.Type> + | AnthropicClientError<"BetaCreateMemory504", typeof BetaCreateMemory504.Type> > /** - * This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the `results_url` field in the response. - * - * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + * Retrieve a memory */ - readonly "betaMessageBatchesRetrieve": ( - messageBatchId: string, - options: { - readonly params?: typeof BetaMessageBatchesRetrieveParams.Encoded | undefined - readonly config?: Config | undefined - } | undefined + readonly "BetaGetMemory": ( + memoryStoreId: string, + memoryId: string, + options: + | { readonly params?: typeof BetaGetMemoryParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"BetaMessageBatchesRetrieve4XX", typeof BetaMessageBatchesRetrieve4XX.Type> + | AnthropicClientError<"BetaGetMemory400", typeof BetaGetMemory400.Type> + | AnthropicClientError<"BetaGetMemory401", typeof BetaGetMemory401.Type> + | AnthropicClientError<"BetaGetMemory403", typeof BetaGetMemory403.Type> + | AnthropicClientError<"BetaGetMemory404", typeof BetaGetMemory404.Type> + | AnthropicClientError<"BetaGetMemory408", typeof BetaGetMemory408.Type> + | AnthropicClientError<"BetaGetMemory409", typeof BetaGetMemory409.Type> + | AnthropicClientError<"BetaGetMemory412", typeof BetaGetMemory412.Type> + | AnthropicClientError<"BetaGetMemory413", typeof BetaGetMemory413.Type> + | AnthropicClientError<"BetaGetMemory429", typeof BetaGetMemory429.Type> + | AnthropicClientError<"BetaGetMemory431", typeof BetaGetMemory431.Type> + | AnthropicClientError<"BetaGetMemory499", typeof BetaGetMemory499.Type> + | AnthropicClientError<"BetaGetMemory500", typeof BetaGetMemory500.Type> + | AnthropicClientError<"BetaGetMemory501", typeof BetaGetMemory501.Type> + | AnthropicClientError<"BetaGetMemory503", typeof BetaGetMemory503.Type> + | AnthropicClientError<"BetaGetMemory504", typeof BetaGetMemory504.Type> > /** - * Delete a Message Batch. - * - * Message Batches can only be deleted once they've finished processing. If you'd like to delete an in-progress batch, you must first cancel it. - * - * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + * Update a memory */ - readonly "betaMessageBatchesDelete": ( - messageBatchId: string, + readonly "BetaUpdateMemory": ( + memoryStoreId: string, + memoryId: string, options: { - readonly params?: typeof BetaMessageBatchesDeleteParams.Encoded | undefined + readonly params?: typeof BetaUpdateMemoryParams.Encoded | undefined + readonly payload: typeof BetaUpdateMemoryRequestJson.Encoded readonly config?: Config | undefined - } | undefined + } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"BetaMessageBatchesDelete4XX", typeof BetaMessageBatchesDelete4XX.Type> + | AnthropicClientError<"BetaUpdateMemory400", typeof BetaUpdateMemory400.Type> + | AnthropicClientError<"BetaUpdateMemory401", typeof BetaUpdateMemory401.Type> + | AnthropicClientError<"BetaUpdateMemory403", typeof BetaUpdateMemory403.Type> + | AnthropicClientError<"BetaUpdateMemory404", typeof BetaUpdateMemory404.Type> + | AnthropicClientError<"BetaUpdateMemory408", typeof BetaUpdateMemory408.Type> + | AnthropicClientError<"BetaUpdateMemory409", typeof BetaUpdateMemory409.Type> + | AnthropicClientError<"BetaUpdateMemory412", typeof BetaUpdateMemory412.Type> + | AnthropicClientError<"BetaUpdateMemory413", typeof BetaUpdateMemory413.Type> + | AnthropicClientError<"BetaUpdateMemory429", typeof BetaUpdateMemory429.Type> + | AnthropicClientError<"BetaUpdateMemory431", typeof BetaUpdateMemory431.Type> + | AnthropicClientError<"BetaUpdateMemory499", typeof BetaUpdateMemory499.Type> + | AnthropicClientError<"BetaUpdateMemory500", typeof BetaUpdateMemory500.Type> + | AnthropicClientError<"BetaUpdateMemory501", typeof BetaUpdateMemory501.Type> + | AnthropicClientError<"BetaUpdateMemory503", typeof BetaUpdateMemory503.Type> + | AnthropicClientError<"BetaUpdateMemory504", typeof BetaUpdateMemory504.Type> > /** - * Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a `canceling` state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation. - * - * The number of canceled requests is specified in `request_counts`. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible. - * - * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + * Delete a memory */ - readonly "betaMessageBatchesCancel": ( - messageBatchId: string, + readonly "BetaDeleteMemory": ( + memoryStoreId: string, + memoryId: string, options: { - readonly params?: typeof BetaMessageBatchesCancelParams.Encoded | undefined + readonly params?: typeof BetaDeleteMemoryParams.Encoded | undefined readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"BetaMessageBatchesCancel4XX", typeof BetaMessageBatchesCancel4XX.Type> + | AnthropicClientError<"BetaDeleteMemory400", typeof BetaDeleteMemory400.Type> + | AnthropicClientError<"BetaDeleteMemory401", typeof BetaDeleteMemory401.Type> + | AnthropicClientError<"BetaDeleteMemory403", typeof BetaDeleteMemory403.Type> + | AnthropicClientError<"BetaDeleteMemory404", typeof BetaDeleteMemory404.Type> + | AnthropicClientError<"BetaDeleteMemory408", typeof BetaDeleteMemory408.Type> + | AnthropicClientError<"BetaDeleteMemory409", typeof BetaDeleteMemory409.Type> + | AnthropicClientError<"BetaDeleteMemory412", typeof BetaDeleteMemory412.Type> + | AnthropicClientError<"BetaDeleteMemory413", typeof BetaDeleteMemory413.Type> + | AnthropicClientError<"BetaDeleteMemory429", typeof BetaDeleteMemory429.Type> + | AnthropicClientError<"BetaDeleteMemory431", typeof BetaDeleteMemory431.Type> + | AnthropicClientError<"BetaDeleteMemory499", typeof BetaDeleteMemory499.Type> + | AnthropicClientError<"BetaDeleteMemory500", typeof BetaDeleteMemory500.Type> + | AnthropicClientError<"BetaDeleteMemory501", typeof BetaDeleteMemory501.Type> + | AnthropicClientError<"BetaDeleteMemory503", typeof BetaDeleteMemory503.Type> + | AnthropicClientError<"BetaDeleteMemory504", typeof BetaDeleteMemory504.Type> > /** - * Streams the results of a Message Batch as a `.jsonl` file. - * - * Each line in the file is a JSON object containing the result of a single request in the Message Batch. Results are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests. - * - * Learn more about the Message Batches API in our [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing) + * List memory versions */ - readonly "betaMessageBatchesResults": ( - messageBatchId: string, + readonly "BetaListMemoryVersions": ( + memoryStoreId: string, options: { - readonly params?: typeof BetaMessageBatchesResultsParams.Encoded | undefined + readonly params?: typeof BetaListMemoryVersionsParams.Encoded | undefined readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"BetaMessageBatchesResults4XX", typeof BetaMessageBatchesResults4XX.Type> + | AnthropicClientError<"BetaListMemoryVersions400", typeof BetaListMemoryVersions400.Type> + | AnthropicClientError<"BetaListMemoryVersions401", typeof BetaListMemoryVersions401.Type> + | AnthropicClientError<"BetaListMemoryVersions403", typeof BetaListMemoryVersions403.Type> + | AnthropicClientError<"BetaListMemoryVersions404", typeof BetaListMemoryVersions404.Type> + | AnthropicClientError<"BetaListMemoryVersions408", typeof BetaListMemoryVersions408.Type> + | AnthropicClientError<"BetaListMemoryVersions409", typeof BetaListMemoryVersions409.Type> + | AnthropicClientError<"BetaListMemoryVersions412", typeof BetaListMemoryVersions412.Type> + | AnthropicClientError<"BetaListMemoryVersions413", typeof BetaListMemoryVersions413.Type> + | AnthropicClientError<"BetaListMemoryVersions429", typeof BetaListMemoryVersions429.Type> + | AnthropicClientError<"BetaListMemoryVersions431", typeof BetaListMemoryVersions431.Type> + | AnthropicClientError<"BetaListMemoryVersions499", typeof BetaListMemoryVersions499.Type> + | AnthropicClientError<"BetaListMemoryVersions500", typeof BetaListMemoryVersions500.Type> + | AnthropicClientError<"BetaListMemoryVersions501", typeof BetaListMemoryVersions501.Type> + | AnthropicClientError<"BetaListMemoryVersions503", typeof BetaListMemoryVersions503.Type> + | AnthropicClientError<"BetaListMemoryVersions504", typeof BetaListMemoryVersions504.Type> > /** - * Count the number of tokens in a Message. - * - * The Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it. - * - * Learn more about token counting in our [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting) + * Retrieve a memory version */ - readonly "betaMessagesCountTokensPost": ( + readonly "BetaGetMemoryVersion": ( + memoryStoreId: string, + memoryVersionId: string, options: { - readonly params?: typeof BetaMessagesCountTokensPostParams.Encoded | undefined - readonly payload: typeof BetaMessagesCountTokensPostRequestJson.Encoded + readonly params?: typeof BetaGetMemoryVersionParams.Encoded | undefined readonly config?: Config | undefined - } + } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"BetaMessagesCountTokensPost4XX", typeof BetaMessagesCountTokensPost4XX.Type> + | AnthropicClientError<"BetaGetMemoryVersion400", typeof BetaGetMemoryVersion400.Type> + | AnthropicClientError<"BetaGetMemoryVersion401", typeof BetaGetMemoryVersion401.Type> + | AnthropicClientError<"BetaGetMemoryVersion403", typeof BetaGetMemoryVersion403.Type> + | AnthropicClientError<"BetaGetMemoryVersion404", typeof BetaGetMemoryVersion404.Type> + | AnthropicClientError<"BetaGetMemoryVersion408", typeof BetaGetMemoryVersion408.Type> + | AnthropicClientError<"BetaGetMemoryVersion409", typeof BetaGetMemoryVersion409.Type> + | AnthropicClientError<"BetaGetMemoryVersion412", typeof BetaGetMemoryVersion412.Type> + | AnthropicClientError<"BetaGetMemoryVersion413", typeof BetaGetMemoryVersion413.Type> + | AnthropicClientError<"BetaGetMemoryVersion429", typeof BetaGetMemoryVersion429.Type> + | AnthropicClientError<"BetaGetMemoryVersion431", typeof BetaGetMemoryVersion431.Type> + | AnthropicClientError<"BetaGetMemoryVersion499", typeof BetaGetMemoryVersion499.Type> + | AnthropicClientError<"BetaGetMemoryVersion500", typeof BetaGetMemoryVersion500.Type> + | AnthropicClientError<"BetaGetMemoryVersion501", typeof BetaGetMemoryVersion501.Type> + | AnthropicClientError<"BetaGetMemoryVersion503", typeof BetaGetMemoryVersion503.Type> + | AnthropicClientError<"BetaGetMemoryVersion504", typeof BetaGetMemoryVersion504.Type> > /** - * List Files + * Redact a memory version */ - readonly "betaListFilesV1FilesGet": ( + readonly "BetaRedactMemoryVersion": ( + memoryStoreId: string, + memoryVersionId: string, options: { - readonly params?: typeof BetaListFilesV1FilesGetParams.Encoded | undefined + readonly params?: typeof BetaRedactMemoryVersionParams.Encoded | undefined readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"BetaListFilesV1FilesGet4XX", typeof BetaListFilesV1FilesGet4XX.Type> + | AnthropicClientError<"BetaRedactMemoryVersion400", typeof BetaRedactMemoryVersion400.Type> + | AnthropicClientError<"BetaRedactMemoryVersion401", typeof BetaRedactMemoryVersion401.Type> + | AnthropicClientError<"BetaRedactMemoryVersion403", typeof BetaRedactMemoryVersion403.Type> + | AnthropicClientError<"BetaRedactMemoryVersion404", typeof BetaRedactMemoryVersion404.Type> + | AnthropicClientError<"BetaRedactMemoryVersion408", typeof BetaRedactMemoryVersion408.Type> + | AnthropicClientError<"BetaRedactMemoryVersion409", typeof BetaRedactMemoryVersion409.Type> + | AnthropicClientError<"BetaRedactMemoryVersion412", typeof BetaRedactMemoryVersion412.Type> + | AnthropicClientError<"BetaRedactMemoryVersion413", typeof BetaRedactMemoryVersion413.Type> + | AnthropicClientError<"BetaRedactMemoryVersion429", typeof BetaRedactMemoryVersion429.Type> + | AnthropicClientError<"BetaRedactMemoryVersion431", typeof BetaRedactMemoryVersion431.Type> + | AnthropicClientError<"BetaRedactMemoryVersion499", typeof BetaRedactMemoryVersion499.Type> + | AnthropicClientError<"BetaRedactMemoryVersion500", typeof BetaRedactMemoryVersion500.Type> + | AnthropicClientError<"BetaRedactMemoryVersion501", typeof BetaRedactMemoryVersion501.Type> + | AnthropicClientError<"BetaRedactMemoryVersion503", typeof BetaRedactMemoryVersion503.Type> + | AnthropicClientError<"BetaRedactMemoryVersion504", typeof BetaRedactMemoryVersion504.Type> > /** - * Upload File + * List memory stores */ - readonly "betaUploadFileV1FilesPost": ( + readonly "BetaListMemoryStores": ( options: { - readonly params?: typeof BetaUploadFileV1FilesPostParams.Encoded | undefined - readonly payload: typeof BetaUploadFileV1FilesPostRequestFormData.Encoded + readonly params?: typeof BetaListMemoryStoresParams.Encoded | undefined readonly config?: Config | undefined - } + } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"BetaUploadFileV1FilesPost4XX", typeof BetaUploadFileV1FilesPost4XX.Type> + | AnthropicClientError<"BetaListMemoryStores400", typeof BetaListMemoryStores400.Type> + | AnthropicClientError<"BetaListMemoryStores401", typeof BetaListMemoryStores401.Type> + | AnthropicClientError<"BetaListMemoryStores403", typeof BetaListMemoryStores403.Type> + | AnthropicClientError<"BetaListMemoryStores404", typeof BetaListMemoryStores404.Type> + | AnthropicClientError<"BetaListMemoryStores408", typeof BetaListMemoryStores408.Type> + | AnthropicClientError<"BetaListMemoryStores409", typeof BetaListMemoryStores409.Type> + | AnthropicClientError<"BetaListMemoryStores412", typeof BetaListMemoryStores412.Type> + | AnthropicClientError<"BetaListMemoryStores413", typeof BetaListMemoryStores413.Type> + | AnthropicClientError<"BetaListMemoryStores429", typeof BetaListMemoryStores429.Type> + | AnthropicClientError<"BetaListMemoryStores431", typeof BetaListMemoryStores431.Type> + | AnthropicClientError<"BetaListMemoryStores499", typeof BetaListMemoryStores499.Type> + | AnthropicClientError<"BetaListMemoryStores500", typeof BetaListMemoryStores500.Type> + | AnthropicClientError<"BetaListMemoryStores501", typeof BetaListMemoryStores501.Type> + | AnthropicClientError<"BetaListMemoryStores503", typeof BetaListMemoryStores503.Type> + | AnthropicClientError<"BetaListMemoryStores504", typeof BetaListMemoryStores504.Type> > /** - * Get File Metadata + * Create a memory store */ - readonly "betaGetFileMetadataV1FilesFileIdGet": ( - fileId: string, + readonly "BetaCreateMemoryStore": ( options: { - readonly params?: typeof BetaGetFileMetadataV1FilesFileIdGetParams.Encoded | undefined + readonly params?: typeof BetaCreateMemoryStoreParams.Encoded | undefined + readonly payload: typeof BetaCreateMemoryStoreRequestJson.Encoded readonly config?: Config | undefined - } | undefined + } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"BetaGetFileMetadataV1FilesFileIdGet4XX", typeof BetaGetFileMetadataV1FilesFileIdGet4XX.Type> + | AnthropicClientError<"BetaCreateMemoryStore400", typeof BetaCreateMemoryStore400.Type> + | AnthropicClientError<"BetaCreateMemoryStore401", typeof BetaCreateMemoryStore401.Type> + | AnthropicClientError<"BetaCreateMemoryStore403", typeof BetaCreateMemoryStore403.Type> + | AnthropicClientError<"BetaCreateMemoryStore404", typeof BetaCreateMemoryStore404.Type> + | AnthropicClientError<"BetaCreateMemoryStore408", typeof BetaCreateMemoryStore408.Type> + | AnthropicClientError<"BetaCreateMemoryStore409", typeof BetaCreateMemoryStore409.Type> + | AnthropicClientError<"BetaCreateMemoryStore412", typeof BetaCreateMemoryStore412.Type> + | AnthropicClientError<"BetaCreateMemoryStore413", typeof BetaCreateMemoryStore413.Type> + | AnthropicClientError<"BetaCreateMemoryStore429", typeof BetaCreateMemoryStore429.Type> + | AnthropicClientError<"BetaCreateMemoryStore431", typeof BetaCreateMemoryStore431.Type> + | AnthropicClientError<"BetaCreateMemoryStore499", typeof BetaCreateMemoryStore499.Type> + | AnthropicClientError<"BetaCreateMemoryStore500", typeof BetaCreateMemoryStore500.Type> + | AnthropicClientError<"BetaCreateMemoryStore501", typeof BetaCreateMemoryStore501.Type> + | AnthropicClientError<"BetaCreateMemoryStore503", typeof BetaCreateMemoryStore503.Type> + | AnthropicClientError<"BetaCreateMemoryStore504", typeof BetaCreateMemoryStore504.Type> > /** - * Delete File + * Retrieve a memory store */ - readonly "betaDeleteFileV1FilesFileIdDelete": ( - fileId: string, + readonly "BetaGetMemoryStore": ( + memoryStoreId: string, options: { - readonly params?: typeof BetaDeleteFileV1FilesFileIdDeleteParams.Encoded | undefined + readonly params?: typeof BetaGetMemoryStoreParams.Encoded | undefined readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"BetaDeleteFileV1FilesFileIdDelete4XX", typeof BetaDeleteFileV1FilesFileIdDelete4XX.Type> + | AnthropicClientError<"BetaGetMemoryStore400", typeof BetaGetMemoryStore400.Type> + | AnthropicClientError<"BetaGetMemoryStore401", typeof BetaGetMemoryStore401.Type> + | AnthropicClientError<"BetaGetMemoryStore403", typeof BetaGetMemoryStore403.Type> + | AnthropicClientError<"BetaGetMemoryStore404", typeof BetaGetMemoryStore404.Type> + | AnthropicClientError<"BetaGetMemoryStore408", typeof BetaGetMemoryStore408.Type> + | AnthropicClientError<"BetaGetMemoryStore409", typeof BetaGetMemoryStore409.Type> + | AnthropicClientError<"BetaGetMemoryStore412", typeof BetaGetMemoryStore412.Type> + | AnthropicClientError<"BetaGetMemoryStore413", typeof BetaGetMemoryStore413.Type> + | AnthropicClientError<"BetaGetMemoryStore429", typeof BetaGetMemoryStore429.Type> + | AnthropicClientError<"BetaGetMemoryStore431", typeof BetaGetMemoryStore431.Type> + | AnthropicClientError<"BetaGetMemoryStore499", typeof BetaGetMemoryStore499.Type> + | AnthropicClientError<"BetaGetMemoryStore500", typeof BetaGetMemoryStore500.Type> + | AnthropicClientError<"BetaGetMemoryStore501", typeof BetaGetMemoryStore501.Type> + | AnthropicClientError<"BetaGetMemoryStore503", typeof BetaGetMemoryStore503.Type> + | AnthropicClientError<"BetaGetMemoryStore504", typeof BetaGetMemoryStore504.Type> > /** - * Download File - */ - readonly "betaDownloadFileV1FilesFileIdContentGet": ( - fileId: string, - options: { - readonly params?: typeof BetaDownloadFileV1FilesFileIdContentGetParams.Encoded | undefined - readonly config?: Config | undefined - } | undefined - ) => Effect.Effect, HttpClientError.HttpClientError | SchemaError> - /** - * Download File - */ - readonly "betaDownloadFileV1FilesFileIdContentGetStream": ( - fileId: string, - options: { readonly params?: typeof BetaDownloadFileV1FilesFileIdContentGetParams.Encoded | undefined } | undefined - ) => Stream.Stream - /** - * List Skills + * Update a memory store */ - readonly "betaListSkillsV1SkillsGet": ( + readonly "BetaUpdateMemoryStore": ( + memoryStoreId: string, options: { - readonly params?: typeof BetaListSkillsV1SkillsGetParams.Encoded | undefined + readonly params?: typeof BetaUpdateMemoryStoreParams.Encoded | undefined + readonly payload: typeof BetaUpdateMemoryStoreRequestJson.Encoded readonly config?: Config | undefined - } | undefined + } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"BetaListSkillsV1SkillsGet4XX", typeof BetaListSkillsV1SkillsGet4XX.Type> + | AnthropicClientError<"BetaUpdateMemoryStore400", typeof BetaUpdateMemoryStore400.Type> + | AnthropicClientError<"BetaUpdateMemoryStore401", typeof BetaUpdateMemoryStore401.Type> + | AnthropicClientError<"BetaUpdateMemoryStore403", typeof BetaUpdateMemoryStore403.Type> + | AnthropicClientError<"BetaUpdateMemoryStore404", typeof BetaUpdateMemoryStore404.Type> + | AnthropicClientError<"BetaUpdateMemoryStore408", typeof BetaUpdateMemoryStore408.Type> + | AnthropicClientError<"BetaUpdateMemoryStore409", typeof BetaUpdateMemoryStore409.Type> + | AnthropicClientError<"BetaUpdateMemoryStore412", typeof BetaUpdateMemoryStore412.Type> + | AnthropicClientError<"BetaUpdateMemoryStore413", typeof BetaUpdateMemoryStore413.Type> + | AnthropicClientError<"BetaUpdateMemoryStore429", typeof BetaUpdateMemoryStore429.Type> + | AnthropicClientError<"BetaUpdateMemoryStore431", typeof BetaUpdateMemoryStore431.Type> + | AnthropicClientError<"BetaUpdateMemoryStore499", typeof BetaUpdateMemoryStore499.Type> + | AnthropicClientError<"BetaUpdateMemoryStore500", typeof BetaUpdateMemoryStore500.Type> + | AnthropicClientError<"BetaUpdateMemoryStore501", typeof BetaUpdateMemoryStore501.Type> + | AnthropicClientError<"BetaUpdateMemoryStore503", typeof BetaUpdateMemoryStore503.Type> + | AnthropicClientError<"BetaUpdateMemoryStore504", typeof BetaUpdateMemoryStore504.Type> > /** - * Create Skill + * Delete a memory store */ - readonly "betaCreateSkillV1SkillsPost": ( + readonly "BetaDeleteMemoryStore": ( + memoryStoreId: string, options: { - readonly params?: typeof BetaCreateSkillV1SkillsPostParams.Encoded | undefined - readonly payload: typeof BetaCreateSkillV1SkillsPostRequestFormData.Encoded + readonly params?: typeof BetaDeleteMemoryStoreParams.Encoded | undefined readonly config?: Config | undefined - } + } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"BetaCreateSkillV1SkillsPost4XX", typeof BetaCreateSkillV1SkillsPost4XX.Type> + | AnthropicClientError<"BetaDeleteMemoryStore400", typeof BetaDeleteMemoryStore400.Type> + | AnthropicClientError<"BetaDeleteMemoryStore401", typeof BetaDeleteMemoryStore401.Type> + | AnthropicClientError<"BetaDeleteMemoryStore403", typeof BetaDeleteMemoryStore403.Type> + | AnthropicClientError<"BetaDeleteMemoryStore404", typeof BetaDeleteMemoryStore404.Type> + | AnthropicClientError<"BetaDeleteMemoryStore408", typeof BetaDeleteMemoryStore408.Type> + | AnthropicClientError<"BetaDeleteMemoryStore409", typeof BetaDeleteMemoryStore409.Type> + | AnthropicClientError<"BetaDeleteMemoryStore412", typeof BetaDeleteMemoryStore412.Type> + | AnthropicClientError<"BetaDeleteMemoryStore413", typeof BetaDeleteMemoryStore413.Type> + | AnthropicClientError<"BetaDeleteMemoryStore429", typeof BetaDeleteMemoryStore429.Type> + | AnthropicClientError<"BetaDeleteMemoryStore431", typeof BetaDeleteMemoryStore431.Type> + | AnthropicClientError<"BetaDeleteMemoryStore499", typeof BetaDeleteMemoryStore499.Type> + | AnthropicClientError<"BetaDeleteMemoryStore500", typeof BetaDeleteMemoryStore500.Type> + | AnthropicClientError<"BetaDeleteMemoryStore501", typeof BetaDeleteMemoryStore501.Type> + | AnthropicClientError<"BetaDeleteMemoryStore503", typeof BetaDeleteMemoryStore503.Type> + | AnthropicClientError<"BetaDeleteMemoryStore504", typeof BetaDeleteMemoryStore504.Type> > /** - * Get Skill + * Archive a memory store */ - readonly "betaGetSkillV1SkillsSkillIdGet": ( - skillId: string, + readonly "BetaArchiveMemoryStore": ( + memoryStoreId: string, options: { - readonly params?: typeof BetaGetSkillV1SkillsSkillIdGetParams.Encoded | undefined + readonly params?: typeof BetaArchiveMemoryStoreParams.Encoded | undefined readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError<"BetaGetSkillV1SkillsSkillIdGet4XX", typeof BetaGetSkillV1SkillsSkillIdGet4XX.Type> + | AnthropicClientError<"BetaArchiveMemoryStore400", typeof BetaArchiveMemoryStore400.Type> + | AnthropicClientError<"BetaArchiveMemoryStore401", typeof BetaArchiveMemoryStore401.Type> + | AnthropicClientError<"BetaArchiveMemoryStore403", typeof BetaArchiveMemoryStore403.Type> + | AnthropicClientError<"BetaArchiveMemoryStore404", typeof BetaArchiveMemoryStore404.Type> + | AnthropicClientError<"BetaArchiveMemoryStore408", typeof BetaArchiveMemoryStore408.Type> + | AnthropicClientError<"BetaArchiveMemoryStore409", typeof BetaArchiveMemoryStore409.Type> + | AnthropicClientError<"BetaArchiveMemoryStore412", typeof BetaArchiveMemoryStore412.Type> + | AnthropicClientError<"BetaArchiveMemoryStore413", typeof BetaArchiveMemoryStore413.Type> + | AnthropicClientError<"BetaArchiveMemoryStore429", typeof BetaArchiveMemoryStore429.Type> + | AnthropicClientError<"BetaArchiveMemoryStore431", typeof BetaArchiveMemoryStore431.Type> + | AnthropicClientError<"BetaArchiveMemoryStore499", typeof BetaArchiveMemoryStore499.Type> + | AnthropicClientError<"BetaArchiveMemoryStore500", typeof BetaArchiveMemoryStore500.Type> + | AnthropicClientError<"BetaArchiveMemoryStore501", typeof BetaArchiveMemoryStore501.Type> + | AnthropicClientError<"BetaArchiveMemoryStore503", typeof BetaArchiveMemoryStore503.Type> + | AnthropicClientError<"BetaArchiveMemoryStore504", typeof BetaArchiveMemoryStore504.Type> > /** - * Delete Skill + * List User Profiles */ - readonly "betaDeleteSkillV1SkillsSkillIdDelete": ( - skillId: string, + readonly "BetaListUserProfiles": ( options: { - readonly params?: typeof BetaDeleteSkillV1SkillsSkillIdDeleteParams.Encoded | undefined + readonly params?: typeof BetaListUserProfilesParams.Encoded | undefined readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError< - "BetaDeleteSkillV1SkillsSkillIdDelete4XX", - typeof BetaDeleteSkillV1SkillsSkillIdDelete4XX.Type - > + | AnthropicClientError<"BetaListUserProfiles400", typeof BetaListUserProfiles400.Type> + | AnthropicClientError<"BetaListUserProfiles401", typeof BetaListUserProfiles401.Type> + | AnthropicClientError<"BetaListUserProfiles403", typeof BetaListUserProfiles403.Type> + | AnthropicClientError<"BetaListUserProfiles404", typeof BetaListUserProfiles404.Type> + | AnthropicClientError<"BetaListUserProfiles408", typeof BetaListUserProfiles408.Type> + | AnthropicClientError<"BetaListUserProfiles409", typeof BetaListUserProfiles409.Type> + | AnthropicClientError<"BetaListUserProfiles412", typeof BetaListUserProfiles412.Type> + | AnthropicClientError<"BetaListUserProfiles413", typeof BetaListUserProfiles413.Type> + | AnthropicClientError<"BetaListUserProfiles429", typeof BetaListUserProfiles429.Type> + | AnthropicClientError<"BetaListUserProfiles431", typeof BetaListUserProfiles431.Type> + | AnthropicClientError<"BetaListUserProfiles499", typeof BetaListUserProfiles499.Type> + | AnthropicClientError<"BetaListUserProfiles500", typeof BetaListUserProfiles500.Type> + | AnthropicClientError<"BetaListUserProfiles501", typeof BetaListUserProfiles501.Type> + | AnthropicClientError<"BetaListUserProfiles503", typeof BetaListUserProfiles503.Type> + | AnthropicClientError<"BetaListUserProfiles504", typeof BetaListUserProfiles504.Type> > /** - * List Skill Versions + * Create User Profile */ - readonly "betaListSkillVersionsV1SkillsSkillIdVersionsGet": ( - skillId: string, + readonly "BetaCreateUserProfile": ( options: { - readonly params?: typeof BetaListSkillVersionsV1SkillsSkillIdVersionsGetParams.Encoded | undefined + readonly params?: typeof BetaCreateUserProfileParams.Encoded | undefined + readonly payload: typeof BetaCreateUserProfileRequestJson.Encoded readonly config?: Config | undefined - } | undefined + } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError< - "BetaListSkillVersionsV1SkillsSkillIdVersionsGet4XX", - typeof BetaListSkillVersionsV1SkillsSkillIdVersionsGet4XX.Type - > + | AnthropicClientError<"BetaCreateUserProfile400", typeof BetaCreateUserProfile400.Type> + | AnthropicClientError<"BetaCreateUserProfile401", typeof BetaCreateUserProfile401.Type> + | AnthropicClientError<"BetaCreateUserProfile403", typeof BetaCreateUserProfile403.Type> + | AnthropicClientError<"BetaCreateUserProfile404", typeof BetaCreateUserProfile404.Type> + | AnthropicClientError<"BetaCreateUserProfile408", typeof BetaCreateUserProfile408.Type> + | AnthropicClientError<"BetaCreateUserProfile409", typeof BetaCreateUserProfile409.Type> + | AnthropicClientError<"BetaCreateUserProfile412", typeof BetaCreateUserProfile412.Type> + | AnthropicClientError<"BetaCreateUserProfile413", typeof BetaCreateUserProfile413.Type> + | AnthropicClientError<"BetaCreateUserProfile429", typeof BetaCreateUserProfile429.Type> + | AnthropicClientError<"BetaCreateUserProfile431", typeof BetaCreateUserProfile431.Type> + | AnthropicClientError<"BetaCreateUserProfile499", typeof BetaCreateUserProfile499.Type> + | AnthropicClientError<"BetaCreateUserProfile500", typeof BetaCreateUserProfile500.Type> + | AnthropicClientError<"BetaCreateUserProfile501", typeof BetaCreateUserProfile501.Type> + | AnthropicClientError<"BetaCreateUserProfile503", typeof BetaCreateUserProfile503.Type> + | AnthropicClientError<"BetaCreateUserProfile504", typeof BetaCreateUserProfile504.Type> > /** - * Create Skill Version + * Get User Profile */ - readonly "betaCreateSkillVersionV1SkillsSkillIdVersionsPost": ( - skillId: string, + readonly "BetaGetUserProfile": ( + userProfileId: string, options: { - readonly params?: typeof BetaCreateSkillVersionV1SkillsSkillIdVersionsPostParams.Encoded | undefined - readonly payload: typeof BetaCreateSkillVersionV1SkillsSkillIdVersionsPostRequestFormData.Encoded + readonly params?: typeof BetaGetUserProfileParams.Encoded | undefined readonly config?: Config | undefined - } + } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError< - "BetaCreateSkillVersionV1SkillsSkillIdVersionsPost4XX", - typeof BetaCreateSkillVersionV1SkillsSkillIdVersionsPost4XX.Type - > + | AnthropicClientError<"BetaGetUserProfile400", typeof BetaGetUserProfile400.Type> + | AnthropicClientError<"BetaGetUserProfile401", typeof BetaGetUserProfile401.Type> + | AnthropicClientError<"BetaGetUserProfile403", typeof BetaGetUserProfile403.Type> + | AnthropicClientError<"BetaGetUserProfile404", typeof BetaGetUserProfile404.Type> + | AnthropicClientError<"BetaGetUserProfile408", typeof BetaGetUserProfile408.Type> + | AnthropicClientError<"BetaGetUserProfile409", typeof BetaGetUserProfile409.Type> + | AnthropicClientError<"BetaGetUserProfile412", typeof BetaGetUserProfile412.Type> + | AnthropicClientError<"BetaGetUserProfile413", typeof BetaGetUserProfile413.Type> + | AnthropicClientError<"BetaGetUserProfile429", typeof BetaGetUserProfile429.Type> + | AnthropicClientError<"BetaGetUserProfile431", typeof BetaGetUserProfile431.Type> + | AnthropicClientError<"BetaGetUserProfile499", typeof BetaGetUserProfile499.Type> + | AnthropicClientError<"BetaGetUserProfile500", typeof BetaGetUserProfile500.Type> + | AnthropicClientError<"BetaGetUserProfile501", typeof BetaGetUserProfile501.Type> + | AnthropicClientError<"BetaGetUserProfile503", typeof BetaGetUserProfile503.Type> + | AnthropicClientError<"BetaGetUserProfile504", typeof BetaGetUserProfile504.Type> > /** - * Get Skill Version + * Update User Profile */ - readonly "betaGetSkillVersionV1SkillsSkillIdVersionsVersionGet": ( - skillId: string, - version: string, + readonly "BetaUpdateUserProfile": ( + userProfileId: string, options: { - readonly params?: typeof BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGetParams.Encoded | undefined + readonly params?: typeof BetaUpdateUserProfileParams.Encoded | undefined + readonly payload: typeof BetaUpdateUserProfileRequestJson.Encoded readonly config?: Config | undefined - } | undefined + } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError< - "BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX", - typeof BetaGetSkillVersionV1SkillsSkillIdVersionsVersionGet4XX.Type - > + | AnthropicClientError<"BetaUpdateUserProfile400", typeof BetaUpdateUserProfile400.Type> + | AnthropicClientError<"BetaUpdateUserProfile401", typeof BetaUpdateUserProfile401.Type> + | AnthropicClientError<"BetaUpdateUserProfile403", typeof BetaUpdateUserProfile403.Type> + | AnthropicClientError<"BetaUpdateUserProfile404", typeof BetaUpdateUserProfile404.Type> + | AnthropicClientError<"BetaUpdateUserProfile408", typeof BetaUpdateUserProfile408.Type> + | AnthropicClientError<"BetaUpdateUserProfile409", typeof BetaUpdateUserProfile409.Type> + | AnthropicClientError<"BetaUpdateUserProfile412", typeof BetaUpdateUserProfile412.Type> + | AnthropicClientError<"BetaUpdateUserProfile413", typeof BetaUpdateUserProfile413.Type> + | AnthropicClientError<"BetaUpdateUserProfile429", typeof BetaUpdateUserProfile429.Type> + | AnthropicClientError<"BetaUpdateUserProfile431", typeof BetaUpdateUserProfile431.Type> + | AnthropicClientError<"BetaUpdateUserProfile499", typeof BetaUpdateUserProfile499.Type> + | AnthropicClientError<"BetaUpdateUserProfile500", typeof BetaUpdateUserProfile500.Type> + | AnthropicClientError<"BetaUpdateUserProfile501", typeof BetaUpdateUserProfile501.Type> + | AnthropicClientError<"BetaUpdateUserProfile503", typeof BetaUpdateUserProfile503.Type> + | AnthropicClientError<"BetaUpdateUserProfile504", typeof BetaUpdateUserProfile504.Type> > /** - * Delete Skill Version + * Create Enrollment URL */ - readonly "betaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete": ( - skillId: string, - version: string, + readonly "BetaCreateEnrollmentUrl": ( + userProfileId: string, options: { - readonly params?: typeof BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDeleteParams.Encoded | undefined + readonly params?: typeof BetaCreateEnrollmentUrlParams.Encoded | undefined readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | AnthropicClientError< - "BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX", - typeof BetaDeleteSkillVersionV1SkillsSkillIdVersionsVersionDelete4XX.Type - > + | AnthropicClientError<"BetaCreateEnrollmentUrl400", typeof BetaCreateEnrollmentUrl400.Type> + | AnthropicClientError<"BetaCreateEnrollmentUrl401", typeof BetaCreateEnrollmentUrl401.Type> + | AnthropicClientError<"BetaCreateEnrollmentUrl403", typeof BetaCreateEnrollmentUrl403.Type> + | AnthropicClientError<"BetaCreateEnrollmentUrl404", typeof BetaCreateEnrollmentUrl404.Type> + | AnthropicClientError<"BetaCreateEnrollmentUrl408", typeof BetaCreateEnrollmentUrl408.Type> + | AnthropicClientError<"BetaCreateEnrollmentUrl409", typeof BetaCreateEnrollmentUrl409.Type> + | AnthropicClientError<"BetaCreateEnrollmentUrl412", typeof BetaCreateEnrollmentUrl412.Type> + | AnthropicClientError<"BetaCreateEnrollmentUrl413", typeof BetaCreateEnrollmentUrl413.Type> + | AnthropicClientError<"BetaCreateEnrollmentUrl429", typeof BetaCreateEnrollmentUrl429.Type> + | AnthropicClientError<"BetaCreateEnrollmentUrl431", typeof BetaCreateEnrollmentUrl431.Type> + | AnthropicClientError<"BetaCreateEnrollmentUrl499", typeof BetaCreateEnrollmentUrl499.Type> + | AnthropicClientError<"BetaCreateEnrollmentUrl500", typeof BetaCreateEnrollmentUrl500.Type> + | AnthropicClientError<"BetaCreateEnrollmentUrl501", typeof BetaCreateEnrollmentUrl501.Type> + | AnthropicClientError<"BetaCreateEnrollmentUrl503", typeof BetaCreateEnrollmentUrl503.Type> + | AnthropicClientError<"BetaCreateEnrollmentUrl504", typeof BetaCreateEnrollmentUrl504.Type> > } diff --git a/packages/ai/openai/codegen.yaml b/packages/ai/openai/codegen.yaml index 19d06da166..c664f8b98e 100644 --- a/packages/ai/openai/codegen.yaml +++ b/packages/ai/openai/codegen.yaml @@ -3,7 +3,7 @@ spec: https://app.stainless.com/api/spec/documented/openai/openapi.documented.ym output: src/Generated.ts name: OpenAiClient header: | - /** + /** * @since 1.0.0 */ patches: @@ -28,14 +28,9 @@ patches: # Add both events to ResponseStreamEvent anyOf array - '[{"op":"add","path":"/components/schemas/ResponseStreamEvent/anyOf/-","value":{"$ref":"#/components/schemas/ResponseApplyPatchCallOperationDiffDeltaEvent"}}]' - '[{"op":"add","path":"/components/schemas/ResponseStreamEvent/anyOf/-","value":{"$ref":"#/components/schemas/ResponseApplyPatchCallOperationDiffDoneEvent"}}]' + # Replace unsupported $recursiveRef with a normal self-reference + - '[{"op":"replace","path":"/components/schemas/CompoundFilter/properties/filters/items/oneOf/1","value":{"$ref":"#/components/schemas/CompoundFilter"}}]' excludeAnnotations: - examples - default disableAdditionalProperties: true -replacements: - # Schema.Unknown doesn't work with Schema.toCodecJson (used by HttpClientResponse.schemaBodyJson) - # Replace with Schema.Json which properly handles arbitrary JSON values - - from: "Schema.Record(Schema.String, Schema.Unknown)" - to: "Schema.Record(Schema.String, Schema.Json)" - - from: "{ readonly [x: string]: unknown }" - to: "{ readonly [x: string]: Schema.Json }" diff --git a/packages/ai/openai/src/Generated.ts b/packages/ai/openai/src/Generated.ts index c477b35abf..3e7274b3a8 100644 --- a/packages/ai/openai/src/Generated.ts +++ b/packages/ai/openai/src/Generated.ts @@ -12,6 +12,12 @@ import * as HttpClient from "effect/unstable/http/HttpClient" import * as HttpClientError from "effect/unstable/http/HttpClientError" import * as HttpClientRequest from "effect/unstable/http/HttpClientRequest" import * as HttpClientResponse from "effect/unstable/http/HttpClientResponse" +// recursive declarations +export type CompoundFilter = { + readonly "type": "and" | "or" + readonly "filters": ReadonlyArray +} +export const CompoundFilter = Schema.suspend((): Schema.Codec => __recursive_CompoundFilter) // non-recursive definitions export type AddUploadPartRequest = { readonly "data": string } export const AddUploadPartRequest = Schema.Struct({ @@ -145,6 +151,9 @@ export type AssignedRoleDetails = { readonly "created_by": string | null readonly "created_by_user_obj": {} | null readonly "metadata": {} | null + readonly "assignment_sources": + | ReadonlyArray<{ readonly "principal_id": string; readonly "principal_type": string }> + | null } export const AssignedRoleDetails = Schema.Struct({ "id": Schema.String.annotate({ "description": "Identifier for the role." }), @@ -155,7 +164,7 @@ export const AssignedRoleDetails = Schema.Struct({ "description": Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "Description of the role." }), "created_at": Schema.Union([Schema.Number.annotate({ "format": "unixtime" }).check(Schema.isInt()), Schema.Null]) .annotate({ "description": "When the role was created." }), - "updated_at": Schema.Union([Schema.Number.annotate({ "format": "int64" }).check(Schema.isInt()), Schema.Null]) + "updated_at": Schema.Union([Schema.Number.annotate({ "format": "unixtime" }).check(Schema.isInt()), Schema.Null]) .annotate({ "description": "When the role was last updated." }), "created_by": Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "Identifier of the actor who created the role." @@ -165,7 +174,11 @@ export const AssignedRoleDetails = Schema.Struct({ }), "metadata": Schema.Union([Schema.Struct({}), Schema.Null]).annotate({ "description": "Arbitrary metadata stored on the role." - }) + }), + "assignment_sources": Schema.Union([ + Schema.Array(Schema.Struct({ "principal_id": Schema.String, "principal_type": Schema.String })), + Schema.Null + ]).annotate({ "description": "Principals from which the role assignment is inherited, when available." }) }).annotate({ "description": "Detailed information about a role assignment entry returned when listing assignments." }) export type AssistantSupportedModels = | "gpt-5" @@ -2451,6 +2464,28 @@ export const GroupDeletedResource = Schema.Struct({ "id": Schema.String.annotate({ "description": "Identifier of the deleted group." }), "deleted": Schema.Boolean.annotate({ "description": "Whether the group was deleted." }) }).annotate({ "description": "Confirmation payload returned after deleting a group." }) +export type GroupMemberUser = { + readonly "id": string + readonly "name": string + readonly "email": string | null + readonly "picture": string | null + readonly "is_service_account": boolean | null + readonly "user_type": "user" | "tenant_user" +} +export const GroupMemberUser = Schema.Struct({ + "id": Schema.String.annotate({ "description": "Identifier for the user." }), + "name": Schema.String.annotate({ "description": "Display name of the user." }), + "email": Schema.Union([Schema.String, Schema.Null]).annotate({ + "description": "Email address of the user, or `null` for users without an email." + }), + "picture": Schema.Union([Schema.String, Schema.Null]).annotate({ + "description": "URL of the user's profile picture, if available." + }), + "is_service_account": Schema.Union([Schema.Boolean, Schema.Null]).annotate({ + "description": "Whether the user is a service account." + }), + "user_type": Schema.Literals(["user", "tenant_user"]).annotate({ "description": "The type of user." }) +}).annotate({ "description": "Details about a user returned from an organization group membership lookup." }) export type GroupResourceWithSuccess = { readonly "id": string readonly "name": string @@ -2473,7 +2508,7 @@ export type GroupResponse = { readonly "name": string readonly "created_at": number readonly "is_scim_managed": boolean - readonly "group_type": string + readonly "group_type": "group" | "tenant_group" } export const GroupResponse = Schema.Struct({ "id": Schema.String.annotate({ "description": "Identifier for the group." }), @@ -2485,7 +2520,7 @@ export const GroupResponse = Schema.Struct({ "is_scim_managed": Schema.Boolean.annotate({ "description": "Whether the group is managed through SCIM and controlled by your identity provider." }), - "group_type": Schema.String.annotate({ "description": "The type of the group." }) + "group_type": Schema.Literals(["group", "tenant_group"]).annotate({ "description": "The type of the group." }) }).annotate({ "description": "Details about an organization group." }) export type GroupUser = { readonly "id": string; readonly "name": string; readonly "email": string | null } export const GroupUser = Schema.Struct({ @@ -3165,7 +3200,7 @@ export const Model = Schema.StructWithRest( "object": Schema.Literal("model").annotate({ "description": "The object type, which is always \"model\"." }), "owned_by": Schema.String.annotate({ "description": "The organization that owns the model." }) }), - [Schema.Record(Schema.String, Schema.Json)] + [Schema.Record(Schema.String, Schema.Unknown)] ).annotate({ "title": "Model", "description": "Describes an OpenAI model offering that can be used with the API." }) export type ModelIdsShared = | string @@ -3404,7 +3439,7 @@ export const OpenAIFile = Schema.StructWithRest( }) ) }), - [Schema.Record(Schema.String, Schema.Json)] + [Schema.Record(Schema.String, Schema.Unknown)] ).annotate({ "title": "OpenAIFile", "description": "The `File` object represents a document that has been uploaded to OpenAI." @@ -3445,6 +3480,25 @@ export const OrganizationCertificate = Schema.Struct({ "description": "Whether the certificate is currently active at the organization level." }) }).annotate({ "description": "Represents an individual certificate configured at the organization level." }) +export type OrganizationDataRetention = { + readonly "object": "organization.data_retention" + readonly "type": + | "zero_data_retention" + | "modified_abuse_monitoring" + | "enhanced_zero_data_retention" + | "enhanced_modified_abuse_monitoring" +} +export const OrganizationDataRetention = Schema.Struct({ + "object": Schema.Literal("organization.data_retention").annotate({ + "description": "The object type, which is always `organization.data_retention`." + }), + "type": Schema.Literals([ + "zero_data_retention", + "modified_abuse_monitoring", + "enhanced_zero_data_retention", + "enhanced_modified_abuse_monitoring" + ]).annotate({ "description": "The configured organization data retention type." }) +}).annotate({ "description": "Represents the organization's data retention control setting." }) export type OrganizationProjectCertificate = { readonly "object": "organization.project.certificate" readonly "id": string @@ -3481,6 +3535,18 @@ export const OrganizationProjectCertificate = Schema.Struct({ "description": "Whether the certificate is currently active at the project level." }) }).annotate({ "description": "Represents an individual certificate configured at the project level." }) +export type OrganizationSpendAlertDeletedResource = { + readonly "id": string + readonly "object": "organization.spend_alert.deleted" + readonly "deleted": boolean +} +export const OrganizationSpendAlertDeletedResource = Schema.Struct({ + "id": Schema.String.annotate({ "description": "The deleted spend alert ID." }), + "object": Schema.Literal("organization.spend_alert.deleted").annotate({ + "description": "Always `organization.spend_alert.deleted`." + }), + "deleted": Schema.Boolean.annotate({ "description": "Whether the spend alert was deleted." }) +}).annotate({ "description": "Confirmation payload returned after deleting an organization spend alert." }) export type ParallelToolCalls = boolean export const ParallelToolCalls = Schema.Boolean.annotate({ "description": @@ -3596,12 +3662,35 @@ export const ProjectCreateRequest = Schema.Struct({ }) ) }) +export type ProjectDataRetention = { + readonly "object": "project.data_retention" + readonly "type": + | "organization_default" + | "none" + | "zero_data_retention" + | "modified_abuse_monitoring" + | "enhanced_zero_data_retention" + | "enhanced_modified_abuse_monitoring" +} +export const ProjectDataRetention = Schema.Struct({ + "object": Schema.Literal("project.data_retention").annotate({ + "description": "The object type, which is always `project.data_retention`." + }), + "type": Schema.Literals([ + "organization_default", + "none", + "zero_data_retention", + "modified_abuse_monitoring", + "enhanced_zero_data_retention", + "enhanced_modified_abuse_monitoring" + ]).annotate({ "description": "The configured project data retention type." }) +}).annotate({ "description": "Represents a project's data retention control setting." }) export type ProjectGroup = { readonly "object": "project.group" readonly "project_id": string readonly "group_id": string readonly "group_name": string - readonly "group_type": string + readonly "group_type": "group" | "tenant_group" readonly "created_at": number } export const ProjectGroup = Schema.Struct({ @@ -3609,7 +3698,7 @@ export const ProjectGroup = Schema.Struct({ "project_id": Schema.String.annotate({ "description": "Identifier of the project." }), "group_id": Schema.String.annotate({ "description": "Identifier of the group that has access to the project." }), "group_name": Schema.String.annotate({ "description": "Display name of the group." }), - "group_type": Schema.String.annotate({ "description": "The type of the group." }), + "group_type": Schema.Literals(["group", "tenant_group"]).annotate({ "description": "The type of the group." }), "created_at": Schema.Number.annotate({ "description": "Unix timestamp (in seconds) when the group was granted project access.", "format": "unixtime" @@ -3787,6 +3876,18 @@ export const ProjectServiceAccountDeleteResponse = Schema.Struct({ "id": Schema.String, "deleted": Schema.Boolean }) +export type ProjectSpendAlertDeletedResource = { + readonly "id": string + readonly "object": "project.spend_alert.deleted" + readonly "deleted": boolean +} +export const ProjectSpendAlertDeletedResource = Schema.Struct({ + "id": Schema.String.annotate({ "description": "The deleted spend alert ID." }), + "object": Schema.Literal("project.spend_alert.deleted").annotate({ + "description": "Always `project.spend_alert.deleted`." + }), + "deleted": Schema.Boolean.annotate({ "description": "Whether the spend alert was deleted." }) +}).annotate({ "description": "Confirmation payload returned after deleting a project spend alert." }) export type ProjectUpdateRequest = { readonly "name"?: string | null readonly "external_key_id"?: string | null @@ -7016,6 +7117,22 @@ export const SpeechAudioDoneEvent = Schema.Struct({ ) }).annotate({ "description": "Token usage statistics for the request.\n" }) }).annotate({ "description": "Emitted when the speech synthesis is complete and all audio has been streamed." }) +export type SpendAlertNotificationChannel = { + readonly "type": "email" + readonly "recipients": ReadonlyArray + readonly "subject_prefix"?: string | null +} +export const SpendAlertNotificationChannel = Schema.Struct({ + "type": Schema.Literal("email").annotate({ + "description": "The notification channel type. Currently only `email` is supported." + }), + "recipients": Schema.Array(Schema.String).annotate({ + "description": "Email addresses that receive the spend alert notification." + }), + "subject_prefix": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Null]).annotate({ "description": "Optional subject prefix for alert emails." }) + ) +}).annotate({ "description": "Email notification settings for a spend alert." }) export type StaticChunkingStrategy = { readonly "max_chunk_size_tokens": number readonly "chunk_overlap_tokens": number @@ -7353,6 +7470,47 @@ export const UpdateGroupBody = Schema.Struct({ "name": Schema.String.annotate({ "description": "New display name for the group." }).check(Schema.isMinLength(1)) .check(Schema.isMaxLength(255)) }).annotate({ "description": "Request payload for updating the details of an existing group." }) +export type UpdateOrganizationDataRetentionBody = { + readonly "retention_type": + | "zero_data_retention" + | "modified_abuse_monitoring" + | "enhanced_zero_data_retention" + | "enhanced_modified_abuse_monitoring" +} +export const UpdateOrganizationDataRetentionBody = Schema.Struct({ + "retention_type": Schema.Literals([ + "zero_data_retention", + "modified_abuse_monitoring", + "enhanced_zero_data_retention", + "enhanced_modified_abuse_monitoring" + ]).annotate({ "description": "The desired organization data retention type." }) +}).annotate({ "description": "Parameters for updating organization data retention controls." }) +export type UpdateProjectDataRetentionBody = { + readonly "retention_type": + | "organization_default" + | "none" + | "zero_data_retention" + | "modified_abuse_monitoring" + | "enhanced_zero_data_retention" + | "enhanced_modified_abuse_monitoring" +} +export const UpdateProjectDataRetentionBody = Schema.Struct({ + "retention_type": Schema.Literals([ + "organization_default", + "none", + "zero_data_retention", + "modified_abuse_monitoring", + "enhanced_zero_data_retention", + "enhanced_modified_abuse_monitoring" + ]).annotate({ "description": "The desired project data retention type." }) +}).annotate({ "description": "Parameters for updating project data retention controls." }) +export type UpdateProjectServiceAccountBody = { readonly "name"?: string; readonly "role"?: "member" | "owner" } +export const UpdateProjectServiceAccountBody = Schema.Struct({ + "name": Schema.optionalKey(Schema.String.annotate({ "description": "The updated service account name." })), + "role": Schema.optionalKey( + Schema.Literals(["member", "owner"]).annotate({ "description": "The updated service account role." }) + ) +}).annotate({ "description": "Parameters for updating a project service account." }) export type UpdateVoiceConsentRequest = { readonly "name": string } export const UpdateVoiceConsentRequest = Schema.Struct({ "name": Schema.String.annotate({ "description": "The updated label for this consent recording." }) @@ -7459,7 +7617,7 @@ export const Upload = Schema.Struct({ }) ) }), - [Schema.Record(Schema.String, Schema.Json)] + [Schema.Record(Schema.String, Schema.Unknown)] ).annotate({ "description": "The `File` object represents a document that has been uploaded to OpenAI.", "title": "OpenAIFile" @@ -8448,7 +8606,7 @@ export const WebSearchToolCall = Schema.Struct({ "An object describing the specific action taken in this web search call.\nIncludes details on how the model used the web (search, open_page, find_in_page).\n" }), Schema.Struct({ - "type": Schema.Literal("open_page").annotate({ "description": "The action type. Always `open_page`.\n" }), + "type": Schema.Literal("open_page").annotate({ "description": "The action type.\n" }), "url": Schema.optionalKey( Schema.Union([Schema.String.annotate({ "format": "uri" }), Schema.Null]).annotate({ "description": "The URL opened by the model.\n" @@ -10535,16 +10693,111 @@ export const PredictionContent = Schema.Struct({ "title": "Static Content", "description": "Static predicted output content, such as the content of a text file that is\nbeing regenerated.\n" }) -export type CompoundFilter = { - readonly "type": "and" | "or" - readonly "filters": ReadonlyArray +export type VectorStoreSearchRequest = { + readonly "query": string | ReadonlyArray + readonly "rewrite_query"?: boolean + readonly "max_num_results"?: number + readonly "filters"?: ComparisonFilter | CompoundFilter + readonly "ranking_options"?: { + readonly "ranker"?: "none" | "auto" | "default-2024-11-15" + readonly "score_threshold"?: number + } } -export const CompoundFilter = Schema.Struct({ - "type": Schema.Literals(["and", "or"]).annotate({ "description": "Type of operation: `and` or `or`." }), - "filters": Schema.Array(Schema.Union([ComparisonFilter, Schema.Unknown], { mode: "oneOf" })).annotate({ - "description": "Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`." - }) -}).annotate({ "title": "Compound Filter", "description": "Combine multiple filters using `and` or `or`." }) +export const VectorStoreSearchRequest = Schema.Struct({ + "query": Schema.Union([ + Schema.String, + Schema.Array(Schema.String.annotate({ "description": "A list of queries to search for." })) + ], { mode: "oneOf" }).annotate({ "description": "A query string for a search" }), + "rewrite_query": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether to rewrite the natural language query for vector search." }) + ), + "max_num_results": Schema.optionalKey( + Schema.Number.annotate({ + "description": "The maximum number of results to return. This number should be between 1 and 50 inclusive." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(50)) + ), + "filters": Schema.optionalKey( + Schema.Union([ComparisonFilter, CompoundFilter], { mode: "oneOf" }).annotate({ + "description": "A filter to apply based on file attributes." + }) + ), + "ranking_options": Schema.optionalKey( + Schema.Struct({ + "ranker": Schema.optionalKey( + Schema.Literals(["none", "auto", "default-2024-11-15"]).annotate({ + "description": "Enable re-ranking; set to `none` to disable, which can help reduce latency." + }) + ), + "score_threshold": Schema.optionalKey( + Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check( + Schema.isLessThanOrEqualTo(1) + ) + ) + }).annotate({ "description": "Ranking options for search." }) + ) +}) +export type FileSearchTool = { + readonly "type": "file_search" + readonly "vector_store_ids": ReadonlyArray + readonly "max_num_results"?: number + readonly "ranking_options"?: { + readonly "ranker"?: "auto" | "default-2024-11-15" + readonly "score_threshold"?: number + readonly "hybrid_search"?: { readonly "embedding_weight": number; readonly "text_weight": number } + } + readonly "filters"?: ComparisonFilter | CompoundFilter | null +} +export const FileSearchTool = Schema.Struct({ + "type": Schema.Literal("file_search").annotate({ + "description": "The type of the file search tool. Always `file_search`." + }), + "vector_store_ids": Schema.Array(Schema.String).annotate({ + "description": "The IDs of the vector stores to search." + }), + "max_num_results": Schema.optionalKey( + Schema.Number.annotate({ + "description": "The maximum number of results to return. This number should be between 1 and 50 inclusive." + }).check(Schema.isInt()) + ), + "ranking_options": Schema.optionalKey( + Schema.Struct({ + "ranker": Schema.optionalKey( + Schema.Literals(["auto", "default-2024-11-15"]).annotate({ + "description": "The ranker to use for the file search." + }) + ), + "score_threshold": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results." + }).check(Schema.isFinite()) + ), + "hybrid_search": Schema.optionalKey( + Schema.Struct({ + "embedding_weight": Schema.Number.annotate({ + "description": "The weight of the embedding in the reciprocal ranking fusion." + }).check(Schema.isFinite()), + "text_weight": Schema.Number.annotate({ + "description": "The weight of the text in the reciprocal ranking fusion." + }).check(Schema.isFinite()) + }).annotate({ + "description": + "Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled." + }) + ) + }).annotate({ "description": "Ranking options for search." }) + ), + "filters": Schema.optionalKey( + Schema.Union([ + Schema.Union([ComparisonFilter, CompoundFilter]).annotate({ "description": "A filter to apply." }), + Schema.Null + ]) + ) +}).annotate({ + "title": "File search", + "description": + "A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](https://platform.openai.com/docs/guides/tools-file-search)." +}) export type CreateCompletionResponse = { readonly "id": string readonly "choices": ReadonlyArray< @@ -13230,6 +13483,66 @@ export const RunStepDeltaObject = Schema.Struct({ }) export type CreateSpeechResponseStreamEvent = SpeechAudioDeltaEvent | SpeechAudioDoneEvent export const CreateSpeechResponseStreamEvent = Schema.Union([SpeechAudioDeltaEvent, SpeechAudioDoneEvent]) +export type CreateSpendAlertBody = { + readonly "threshold_amount": number + readonly "currency": "USD" + readonly "interval": "month" + readonly "notification_channel": SpendAlertNotificationChannel +} +export const CreateSpendAlertBody = Schema.Struct({ + "threshold_amount": Schema.Number.annotate({ "description": "The alert threshold amount, in cents." }).check( + Schema.isInt() + ).check(Schema.isGreaterThanOrEqualTo(0)), + "currency": Schema.Literal("USD").annotate({ "description": "The currency for the threshold amount." }), + "interval": Schema.Literal("month").annotate({ + "description": "The time interval for evaluating spend against the threshold." + }), + "notification_channel": SpendAlertNotificationChannel +}).annotate({ "description": "Parameters for creating or updating a spend alert." }) +export type OrganizationSpendAlert = { + readonly "id": string + readonly "object": "organization.spend_alert" + readonly "threshold_amount": number + readonly "currency": "USD" + readonly "interval": "month" + readonly "notification_channel": SpendAlertNotificationChannel +} +export const OrganizationSpendAlert = Schema.Struct({ + "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints." }), + "object": Schema.Literal("organization.spend_alert").annotate({ + "description": "The object type, which is always `organization.spend_alert`." + }), + "threshold_amount": Schema.Number.annotate({ "description": "The alert threshold amount, in cents." }).check( + Schema.isInt() + ), + "currency": Schema.Literal("USD").annotate({ "description": "The currency for the threshold amount." }), + "interval": Schema.Literal("month").annotate({ + "description": "The time interval for evaluating spend against the threshold." + }), + "notification_channel": SpendAlertNotificationChannel +}).annotate({ "description": "Represents a spend alert configured at the organization level." }) +export type ProjectSpendAlert = { + readonly "id": string + readonly "object": "project.spend_alert" + readonly "threshold_amount": number + readonly "currency": "USD" + readonly "interval": "month" + readonly "notification_channel": SpendAlertNotificationChannel +} +export const ProjectSpendAlert = Schema.Struct({ + "id": Schema.String.annotate({ "description": "The identifier, which can be referenced in API endpoints." }), + "object": Schema.Literal("project.spend_alert").annotate({ + "description": "The object type, which is always `project.spend_alert`." + }), + "threshold_amount": Schema.Number.annotate({ "description": "The alert threshold amount, in cents." }).check( + Schema.isInt() + ), + "currency": Schema.Literal("USD").annotate({ "description": "The currency for the threshold amount." }), + "interval": Schema.Literal("month").annotate({ + "description": "The time interval for evaluating spend against the threshold." + }), + "notification_channel": SpendAlertNotificationChannel +}).annotate({ "description": "Represents a spend alert configured at the project level." }) export type ChunkingStrategyRequestParam = { readonly "type": "auto" } | { readonly "type": "static" readonly "static": StaticChunkingStrategy @@ -15862,111 +16175,6 @@ export const ChatCompletionRequestUserMessage = Schema.Struct({ "title": "User message", "description": "Messages sent by an end user, containing prompts or additional context\ninformation.\n" }) -export type VectorStoreSearchRequest = { - readonly "query": string | ReadonlyArray - readonly "rewrite_query"?: boolean - readonly "max_num_results"?: number - readonly "filters"?: ComparisonFilter | CompoundFilter - readonly "ranking_options"?: { - readonly "ranker"?: "none" | "auto" | "default-2024-11-15" - readonly "score_threshold"?: number - } -} -export const VectorStoreSearchRequest = Schema.Struct({ - "query": Schema.Union([ - Schema.String, - Schema.Array(Schema.String.annotate({ "description": "A list of queries to search for." })) - ], { mode: "oneOf" }).annotate({ "description": "A query string for a search" }), - "rewrite_query": Schema.optionalKey( - Schema.Boolean.annotate({ "description": "Whether to rewrite the natural language query for vector search." }) - ), - "max_num_results": Schema.optionalKey( - Schema.Number.annotate({ - "description": "The maximum number of results to return. This number should be between 1 and 50 inclusive." - }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(50)) - ), - "filters": Schema.optionalKey( - Schema.Union([ComparisonFilter, CompoundFilter], { mode: "oneOf" }).annotate({ - "description": "A filter to apply based on file attributes." - }) - ), - "ranking_options": Schema.optionalKey( - Schema.Struct({ - "ranker": Schema.optionalKey( - Schema.Literals(["none", "auto", "default-2024-11-15"]).annotate({ - "description": "Enable re-ranking; set to `none` to disable, which can help reduce latency." - }) - ), - "score_threshold": Schema.optionalKey( - Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check( - Schema.isLessThanOrEqualTo(1) - ) - ) - }).annotate({ "description": "Ranking options for search." }) - ) -}) -export type FileSearchTool = { - readonly "type": "file_search" - readonly "vector_store_ids": ReadonlyArray - readonly "max_num_results"?: number - readonly "ranking_options"?: { - readonly "ranker"?: "auto" | "default-2024-11-15" - readonly "score_threshold"?: number - readonly "hybrid_search"?: { readonly "embedding_weight": number; readonly "text_weight": number } - } - readonly "filters"?: ComparisonFilter | CompoundFilter | null -} -export const FileSearchTool = Schema.Struct({ - "type": Schema.Literal("file_search").annotate({ - "description": "The type of the file search tool. Always `file_search`." - }), - "vector_store_ids": Schema.Array(Schema.String).annotate({ - "description": "The IDs of the vector stores to search." - }), - "max_num_results": Schema.optionalKey( - Schema.Number.annotate({ - "description": "The maximum number of results to return. This number should be between 1 and 50 inclusive." - }).check(Schema.isInt()) - ), - "ranking_options": Schema.optionalKey( - Schema.Struct({ - "ranker": Schema.optionalKey( - Schema.Literals(["auto", "default-2024-11-15"]).annotate({ - "description": "The ranker to use for the file search." - }) - ), - "score_threshold": Schema.optionalKey( - Schema.Number.annotate({ - "description": - "The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results." - }).check(Schema.isFinite()) - ), - "hybrid_search": Schema.optionalKey( - Schema.Struct({ - "embedding_weight": Schema.Number.annotate({ - "description": "The weight of the embedding in the reciprocal ranking fusion." - }).check(Schema.isFinite()), - "text_weight": Schema.Number.annotate({ - "description": "The weight of the text in the reciprocal ranking fusion." - }).check(Schema.isFinite()) - }).annotate({ - "description": - "Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled." - }) - ) - }).annotate({ "description": "Ranking options for search." }) - ), - "filters": Schema.optionalKey( - Schema.Union([ - Schema.Union([ComparisonFilter, CompoundFilter]).annotate({ "description": "A filter to apply." }), - Schema.Null - ]) - ) -}).annotate({ - "title": "File search", - "description": - "A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](https://platform.openai.com/docs/guides/tools-file-search)." -}) export type EvalRunOutputItemList = { readonly "object": "list" readonly "data": ReadonlyArray @@ -18241,6 +18449,44 @@ export const RealtimeSessionCreateResponseGA = Schema.Struct({ "title": "Realtime session configuration object", "description": "A Realtime session configuration object.\n" }) +export type OrganizationSpendAlertListResource = { + readonly "object": "list" + readonly "data": ReadonlyArray + readonly "first_id": string | null + readonly "last_id": string | null + readonly "has_more": boolean +} +export const OrganizationSpendAlertListResource = Schema.Struct({ + "object": Schema.Literal("list").annotate({ "description": "Always `list`." }), + "data": Schema.Array(OrganizationSpendAlert).annotate({ + "description": "Spend alerts returned in the current page." + }), + "first_id": Schema.Union([Schema.String, Schema.Null]).annotate({ + "description": "The ID of the first spend alert in this page." + }), + "last_id": Schema.Union([Schema.String, Schema.Null]).annotate({ + "description": "The ID of the last spend alert in this page." + }), + "has_more": Schema.Boolean.annotate({ "description": "Whether more spend alerts are available when paginating." }) +}).annotate({ "description": "Paginated list of organization spend alerts." }) +export type ProjectSpendAlertListResource = { + readonly "object": "list" + readonly "data": ReadonlyArray + readonly "first_id": string | null + readonly "last_id": string | null + readonly "has_more": boolean +} +export const ProjectSpendAlertListResource = Schema.Struct({ + "object": Schema.Literal("list").annotate({ "description": "Always `list`." }), + "data": Schema.Array(ProjectSpendAlert).annotate({ "description": "Spend alerts returned in the current page." }), + "first_id": Schema.Union([Schema.String, Schema.Null]).annotate({ + "description": "The ID of the first spend alert in this page." + }), + "last_id": Schema.Union([Schema.String, Schema.Null]).annotate({ + "description": "The ID of the last spend alert in this page." + }), + "has_more": Schema.Boolean.annotate({ "description": "Whether more spend alerts are available when paginating." }) +}).annotate({ "description": "Paginated list of project spend alerts." }) export type CreateVectorStoreFileRequest = { readonly "file_id": string readonly "chunking_strategy"?: ChunkingStrategyRequestParam @@ -18291,7 +18537,7 @@ export const ListVectorStoresResponse = Schema.StructWithRest( "last_id": Schema.String, "has_more": Schema.Boolean }), - [Schema.Record(Schema.String, Schema.Json)] + [Schema.Record(Schema.String, Schema.Unknown)] ) export type ListVectorStoreFilesResponse = { readonly "object": string @@ -18309,7 +18555,7 @@ export const ListVectorStoreFilesResponse = Schema.StructWithRest( "last_id": Schema.String, "has_more": Schema.Boolean }), - [Schema.Record(Schema.String, Schema.Json)] + [Schema.Record(Schema.String, Schema.Unknown)] ) export type VectorStoreSearchResultsPage = { readonly "object": "vector_store.search_results.page" @@ -19665,7 +19911,7 @@ export const ListMessagesResponse = Schema.StructWithRest( "last_id": Schema.String, "has_more": Schema.Boolean }), - [Schema.Record(Schema.String, Schema.Json)] + [Schema.Record(Schema.String, Schema.Unknown)] ) export type MessageStreamEvent = | { readonly "event": "thread.message.created"; readonly "data": MessageObject } @@ -22410,7 +22656,7 @@ export const ListRunStepsResponse = Schema.StructWithRest( "last_id": Schema.String, "has_more": Schema.Boolean }), - [Schema.Record(Schema.String, Schema.Json)] + [Schema.Record(Schema.String, Schema.Unknown)] ) export type RunStepStreamEvent = | { readonly "event": "thread.run.step.created"; readonly "data": RunStepObject } @@ -23079,7 +23325,7 @@ export const InputItem = Schema.Union([ "An object describing the specific action taken in this web search call.\nIncludes details on how the model used the web (search, open_page, find_in_page).\n" }), Schema.Struct({ - "type": Schema.Literal("open_page").annotate({ "description": "The action type. Always `open_page`.\n" }), + "type": Schema.Literal("open_page").annotate({ "description": "The action type.\n" }), "url": Schema.optionalKey( Schema.Union([Schema.String.annotate({ "format": "uri" }), Schema.Null]).annotate({ "description": "The URL opened by the model.\n" @@ -28679,6 +28925,15 @@ export const ListPaginatedFineTuningJobsResponse = Schema.Struct({ "has_more": Schema.Boolean, "object": Schema.Literal("list") }) +// recursive definitions +const __recursive_CompoundFilter = Schema.Struct({ + "type": Schema.Literals(["and", "or"]).annotate({ "description": "Type of operation: `and` or `or`." }), + "filters": Schema.Array( + Schema.Union([ComparisonFilter, Schema.suspend((): Schema.Codec => CompoundFilter)], { + mode: "oneOf" + }) + ).annotate({ "description": "Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`." }) +}).annotate({ "title": "Compound Filter", "description": "Combine multiple filters using `and` or `or`." }) // schemas export type ListAssistantsParams = { readonly "limit"?: number @@ -28917,7 +29172,7 @@ export const CreateConversationItemsRequestJson = Schema.StructWithRest( "description": "The items to add to the conversation. You may add up to 20 items at a time.\n" }).check(Schema.isMaxLength(20)) }), - [Schema.Record(Schema.String, Schema.Json)] + [Schema.Record(Schema.String, Schema.Unknown)] ) export type CreateConversationItems200 = ConversationItemList export const CreateConversationItems200 = ConversationItemList @@ -29274,6 +29529,12 @@ export const UsageCostsParams = Schema.Struct({ }) export type UsageCosts200 = UsageResponse export const UsageCosts200 = UsageResponse +export type RetrieveOrganizationDataRetention200 = OrganizationDataRetention +export const RetrieveOrganizationDataRetention200 = OrganizationDataRetention +export type UpdateOrganizationDataRetentionRequestJson = UpdateOrganizationDataRetentionBody +export const UpdateOrganizationDataRetentionRequestJson = UpdateOrganizationDataRetentionBody +export type UpdateOrganizationDataRetention200 = OrganizationDataRetention +export const UpdateOrganizationDataRetention200 = OrganizationDataRetention export type ListGroupsParams = { readonly "limit"?: number readonly "after"?: string @@ -29292,6 +29553,8 @@ export type CreateGroupRequestJson = CreateGroupBody export const CreateGroupRequestJson = CreateGroupBody export type CreateGroup200 = GroupResponse export const CreateGroup200 = GroupResponse +export type RetrieveGroup200 = GroupResponse +export const RetrieveGroup200 = GroupResponse export type UpdateGroupRequestJson = UpdateGroupBody export const UpdateGroupRequestJson = UpdateGroupBody export type UpdateGroup200 = GroupResourceWithSuccess @@ -29316,6 +29579,8 @@ export type AssignGroupRoleRequestJson = PublicAssignOrganizationGroupRoleBody export const AssignGroupRoleRequestJson = PublicAssignOrganizationGroupRoleBody export type AssignGroupRole200 = GroupRoleAssignment export const AssignGroupRole200 = GroupRoleAssignment +export type RetrieveGroupRole200 = AssignedRoleDetails +export const RetrieveGroupRole200 = AssignedRoleDetails export type UnassignGroupRole200 = DeletedRoleAssignmentResource export const UnassignGroupRole200 = DeletedRoleAssignmentResource export type ListGroupUsersParams = { @@ -29336,6 +29601,8 @@ export type AddGroupUserRequestJson = CreateGroupUserBody export const AddGroupUserRequestJson = CreateGroupUserBody export type AddGroupUser200 = GroupUserAssignment export const AddGroupUser200 = GroupUserAssignment +export type RetrieveGroupUser200 = GroupMemberUser +export const RetrieveGroupUser200 = GroupMemberUser export type RemoveGroupUser200 = GroupUserDeletedResource export const RemoveGroupUser200 = GroupUserDeletedResource export type ListInvitesParams = { readonly "limit"?: number; readonly "after"?: string } @@ -29412,6 +29679,12 @@ export type DeactivateProjectCertificatesRequestJson = ToggleCertificatesRequest export const DeactivateProjectCertificatesRequestJson = ToggleCertificatesRequest export type DeactivateProjectCertificates200 = OrganizationProjectCertificateDeactivationResponse export const DeactivateProjectCertificates200 = OrganizationProjectCertificateDeactivationResponse +export type RetrieveProjectDataRetention200 = ProjectDataRetention +export const RetrieveProjectDataRetention200 = ProjectDataRetention +export type UpdateProjectDataRetentionRequestJson = UpdateProjectDataRetentionBody +export const UpdateProjectDataRetentionRequestJson = UpdateProjectDataRetentionBody +export type UpdateProjectDataRetention200 = ProjectDataRetention +export const UpdateProjectDataRetention200 = ProjectDataRetention export type ListProjectGroupsParams = { readonly "limit"?: number readonly "after"?: string @@ -29430,6 +29703,12 @@ export type AddProjectGroupRequestJson = InviteProjectGroupBody export const AddProjectGroupRequestJson = InviteProjectGroupBody export type AddProjectGroup200 = ProjectGroup export const AddProjectGroup200 = ProjectGroup +export type RetrieveProjectGroupParams = { readonly "group_type"?: "group" | "tenant_group" } +export const RetrieveProjectGroupParams = Schema.Struct({ + "group_type": Schema.optionalKey(Schema.Literals(["group", "tenant_group"])) +}) +export type RetrieveProjectGroup200 = ProjectGroup +export const RetrieveProjectGroup200 = ProjectGroup export type RemoveProjectGroup200 = ProjectGroupDeletedResource export const RemoveProjectGroup200 = ProjectGroupDeletedResource export type RetrieveProjectHostedToolPermissions200 = ProjectHostedToolPermissions @@ -29481,8 +29760,38 @@ export type CreateProjectServiceAccount400 = ErrorResponse export const CreateProjectServiceAccount400 = ErrorResponse export type RetrieveProjectServiceAccount200 = ProjectServiceAccount export const RetrieveProjectServiceAccount200 = ProjectServiceAccount +export type UpdateProjectServiceAccountRequestJson = UpdateProjectServiceAccountBody +export const UpdateProjectServiceAccountRequestJson = UpdateProjectServiceAccountBody +export type UpdateProjectServiceAccount200 = ProjectServiceAccount +export const UpdateProjectServiceAccount200 = ProjectServiceAccount export type DeleteProjectServiceAccount200 = ProjectServiceAccountDeleteResponse export const DeleteProjectServiceAccount200 = ProjectServiceAccountDeleteResponse +export type ListProjectSpendAlertsParams = { + readonly "limit"?: number + readonly "order"?: "asc" | "desc" + readonly "after"?: string + readonly "before"?: string +} +export const ListProjectSpendAlertsParams = Schema.Struct({ + "limit": Schema.optionalKey( + Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(100)) + ), + "order": Schema.optionalKey(Schema.Literals(["asc", "desc"])), + "after": Schema.optionalKey(Schema.String), + "before": Schema.optionalKey(Schema.String) +}) +export type ListProjectSpendAlerts200 = ProjectSpendAlertListResource +export const ListProjectSpendAlerts200 = ProjectSpendAlertListResource +export type CreateProjectSpendAlertRequestJson = CreateSpendAlertBody +export const CreateProjectSpendAlertRequestJson = CreateSpendAlertBody +export type CreateProjectSpendAlert200 = ProjectSpendAlert +export const CreateProjectSpendAlert200 = ProjectSpendAlert +export type UpdateProjectSpendAlertRequestJson = CreateSpendAlertBody +export const UpdateProjectSpendAlertRequestJson = CreateSpendAlertBody +export type UpdateProjectSpendAlert200 = ProjectSpendAlert +export const UpdateProjectSpendAlert200 = ProjectSpendAlert +export type DeleteProjectSpendAlert200 = ProjectSpendAlertDeletedResource +export const DeleteProjectSpendAlert200 = ProjectSpendAlertDeletedResource export type ListProjectUsersParams = { readonly "limit"?: number; readonly "after"?: string } export const ListProjectUsersParams = Schema.Struct({ "limit": Schema.optionalKey(Schema.Number.check(Schema.isInt())), @@ -29528,12 +29837,40 @@ export type CreateRoleRequestJson = PublicCreateOrganizationRoleBody export const CreateRoleRequestJson = PublicCreateOrganizationRoleBody export type CreateRole200 = Role export const CreateRole200 = Role +export type RetrieveRole200 = Role +export const RetrieveRole200 = Role export type UpdateRoleRequestJson = PublicUpdateOrganizationRoleBody export const UpdateRoleRequestJson = PublicUpdateOrganizationRoleBody export type UpdateRole200 = Role export const UpdateRole200 = Role export type DeleteRole200 = RoleDeletedResource export const DeleteRole200 = RoleDeletedResource +export type ListOrganizationSpendAlertsParams = { + readonly "limit"?: number + readonly "order"?: "asc" | "desc" + readonly "after"?: string + readonly "before"?: string +} +export const ListOrganizationSpendAlertsParams = Schema.Struct({ + "limit": Schema.optionalKey( + Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(100)) + ), + "order": Schema.optionalKey(Schema.Literals(["asc", "desc"])), + "after": Schema.optionalKey(Schema.String), + "before": Schema.optionalKey(Schema.String) +}) +export type ListOrganizationSpendAlerts200 = OrganizationSpendAlertListResource +export const ListOrganizationSpendAlerts200 = OrganizationSpendAlertListResource +export type CreateOrganizationSpendAlertRequestJson = CreateSpendAlertBody +export const CreateOrganizationSpendAlertRequestJson = CreateSpendAlertBody +export type CreateOrganizationSpendAlert200 = OrganizationSpendAlert +export const CreateOrganizationSpendAlert200 = OrganizationSpendAlert +export type UpdateOrganizationSpendAlertRequestJson = CreateSpendAlertBody +export const UpdateOrganizationSpendAlertRequestJson = CreateSpendAlertBody +export type UpdateOrganizationSpendAlert200 = OrganizationSpendAlert +export const UpdateOrganizationSpendAlert200 = OrganizationSpendAlert +export type DeleteOrganizationSpendAlert200 = OrganizationSpendAlertDeletedResource +export const DeleteOrganizationSpendAlert200 = OrganizationSpendAlertDeletedResource export type UsageAudioSpeechesParams = { readonly "start_time": number readonly "end_time"?: number @@ -29838,6 +30175,8 @@ export type AssignUserRoleRequestJson = PublicAssignOrganizationGroupRoleBody export const AssignUserRoleRequestJson = PublicAssignOrganizationGroupRoleBody export type AssignUserRole200 = UserRoleAssignment export const AssignUserRole200 = UserRoleAssignment +export type RetrieveUserRole200 = AssignedRoleDetails +export const RetrieveUserRole200 = AssignedRoleDetails export type UnassignUserRole200 = DeletedRoleAssignmentResource export const UnassignUserRole200 = DeletedRoleAssignmentResource export type ListProjectGroupRoleAssignmentsParams = { @@ -29858,6 +30197,8 @@ export type AssignProjectGroupRoleRequestJson = PublicAssignOrganizationGroupRol export const AssignProjectGroupRoleRequestJson = PublicAssignOrganizationGroupRoleBody export type AssignProjectGroupRole200 = GroupRoleAssignment export const AssignProjectGroupRole200 = GroupRoleAssignment +export type RetrieveProjectGroupRole200 = AssignedRoleDetails +export const RetrieveProjectGroupRole200 = AssignedRoleDetails export type UnassignProjectGroupRole200 = DeletedRoleAssignmentResource export const UnassignProjectGroupRole200 = DeletedRoleAssignmentResource export type ListProjectRolesParams = { @@ -29878,6 +30219,8 @@ export type CreateProjectRoleRequestJson = PublicCreateOrganizationRoleBody export const CreateProjectRoleRequestJson = PublicCreateOrganizationRoleBody export type CreateProjectRole200 = Role export const CreateProjectRole200 = Role +export type RetrieveProjectRole200 = Role +export const RetrieveProjectRole200 = Role export type UpdateProjectRoleRequestJson = PublicUpdateOrganizationRoleBody export const UpdateProjectRoleRequestJson = PublicUpdateOrganizationRoleBody export type UpdateProjectRole200 = Role @@ -29902,6 +30245,8 @@ export type AssignProjectUserRoleRequestJson = PublicAssignOrganizationGroupRole export const AssignProjectUserRoleRequestJson = PublicAssignOrganizationGroupRoleBody export type AssignProjectUserRole200 = UserRoleAssignment export const AssignProjectUserRole200 = UserRoleAssignment +export type RetrieveProjectUserRole200 = AssignedRoleDetails +export const RetrieveProjectUserRole200 = AssignedRoleDetails export type UnassignProjectUserRole200 = DeletedRoleAssignmentResource export const UnassignProjectUserRole200 = DeletedRoleAssignmentResource export type CreateRealtimeCallRequestFormData = RealtimeCallCreateRequest @@ -31280,6 +31625,21 @@ export const make = ( orElse: unexpectedStatus })) ), + "retrieveOrganizationDataRetention": (options) => + HttpClientRequest.get(`/organization/data_retention`).pipe( + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(RetrieveOrganizationDataRetention200), + orElse: unexpectedStatus + })) + ), + "updateOrganizationDataRetention": (options) => + HttpClientRequest.post(`/organization/data_retention`).pipe( + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(UpdateOrganizationDataRetention200), + orElse: unexpectedStatus + })) + ), "listGroups": (options) => HttpClientRequest.get(`/organization/groups`).pipe( HttpClientRequest.setUrlParams({ @@ -31300,6 +31660,13 @@ export const make = ( orElse: unexpectedStatus })) ), + "retrieveGroup": (groupId, options) => + HttpClientRequest.get(`/organization/groups/${groupId}`).pipe( + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(RetrieveGroup200), + orElse: unexpectedStatus + })) + ), "updateGroup": (groupId, options) => HttpClientRequest.post(`/organization/groups/${groupId}`).pipe( HttpClientRequest.bodyJsonUnsafe(options.payload), @@ -31335,6 +31702,13 @@ export const make = ( orElse: unexpectedStatus })) ), + "retrieveGroupRole": (groupId, roleId, options) => + HttpClientRequest.get(`/organization/groups/${groupId}/roles/${roleId}`).pipe( + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(RetrieveGroupRole200), + orElse: unexpectedStatus + })) + ), "unassignGroupRole": (groupId, roleId, options) => HttpClientRequest.delete(`/organization/groups/${groupId}/roles/${roleId}`).pipe( withResponse(options?.config)(HttpClientResponse.matchStatus({ @@ -31362,6 +31736,13 @@ export const make = ( orElse: unexpectedStatus })) ), + "retrieveGroupUser": (groupId, userId, options) => + HttpClientRequest.get(`/organization/groups/${groupId}/users/${userId}`).pipe( + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(RetrieveGroupUser200), + orElse: unexpectedStatus + })) + ), "removeGroupUser": (groupId, userId, options) => HttpClientRequest.delete(`/organization/groups/${groupId}/users/${userId}`).pipe( withResponse(options?.config)(HttpClientResponse.matchStatus({ @@ -31499,6 +31880,21 @@ export const make = ( orElse: unexpectedStatus })) ), + "retrieveProjectDataRetention": (projectId, options) => + HttpClientRequest.get(`/organization/projects/${projectId}/data_retention`).pipe( + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(RetrieveProjectDataRetention200), + orElse: unexpectedStatus + })) + ), + "updateProjectDataRetention": (projectId, options) => + HttpClientRequest.post(`/organization/projects/${projectId}/data_retention`).pipe( + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(UpdateProjectDataRetention200), + orElse: unexpectedStatus + })) + ), "listProjectGroups": (projectId, options) => HttpClientRequest.get(`/organization/projects/${projectId}/groups`).pipe( HttpClientRequest.setUrlParams({ @@ -31519,6 +31915,14 @@ export const make = ( orElse: unexpectedStatus })) ), + "retrieveProjectGroup": (projectId, groupId, options) => + HttpClientRequest.get(`/organization/projects/${projectId}/groups/${groupId}`).pipe( + HttpClientRequest.setUrlParams({ "group_type": options?.params?.["group_type"] as any }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(RetrieveProjectGroup200), + orElse: unexpectedStatus + })) + ), "removeProjectGroup": (projectId, groupId, options) => HttpClientRequest.delete(`/organization/projects/${projectId}/groups/${groupId}`).pipe( withResponse(options?.config)(HttpClientResponse.matchStatus({ @@ -31612,6 +32016,14 @@ export const make = ( orElse: unexpectedStatus })) ), + "updateProjectServiceAccount": (projectId, serviceAccountId, options) => + HttpClientRequest.post(`/organization/projects/${projectId}/service_accounts/${serviceAccountId}`).pipe( + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(UpdateProjectServiceAccount200), + orElse: unexpectedStatus + })) + ), "deleteProjectServiceAccount": (projectId, serviceAccountId, options) => HttpClientRequest.delete(`/organization/projects/${projectId}/service_accounts/${serviceAccountId}`).pipe( withResponse(options?.config)(HttpClientResponse.matchStatus({ @@ -31619,6 +32031,42 @@ export const make = ( orElse: unexpectedStatus })) ), + "listProjectSpendAlerts": (projectId, options) => + HttpClientRequest.get(`/organization/projects/${projectId}/spend_alerts`).pipe( + HttpClientRequest.setUrlParams({ + "limit": options?.params?.["limit"] as any, + "order": options?.params?.["order"] as any, + "after": options?.params?.["after"] as any, + "before": options?.params?.["before"] as any + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(ListProjectSpendAlerts200), + orElse: unexpectedStatus + })) + ), + "createProjectSpendAlert": (projectId, options) => + HttpClientRequest.post(`/organization/projects/${projectId}/spend_alerts`).pipe( + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(CreateProjectSpendAlert200), + orElse: unexpectedStatus + })) + ), + "updateProjectSpendAlert": (projectId, alertId, options) => + HttpClientRequest.post(`/organization/projects/${projectId}/spend_alerts/${alertId}`).pipe( + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(UpdateProjectSpendAlert200), + orElse: unexpectedStatus + })) + ), + "deleteProjectSpendAlert": (projectId, alertId, options) => + HttpClientRequest.delete(`/organization/projects/${projectId}/spend_alerts/${alertId}`).pipe( + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(DeleteProjectSpendAlert200), + orElse: unexpectedStatus + })) + ), "listProjectUsers": (projectId, options) => HttpClientRequest.get(`/organization/projects/${projectId}/users`).pipe( HttpClientRequest.setUrlParams({ @@ -31684,6 +32132,13 @@ export const make = ( orElse: unexpectedStatus })) ), + "retrieveRole": (roleId, options) => + HttpClientRequest.get(`/organization/roles/${roleId}`).pipe( + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(RetrieveRole200), + orElse: unexpectedStatus + })) + ), "updateRole": (roleId, options) => HttpClientRequest.post(`/organization/roles/${roleId}`).pipe( HttpClientRequest.bodyJsonUnsafe(options.payload), @@ -31699,6 +32154,42 @@ export const make = ( orElse: unexpectedStatus })) ), + "listOrganizationSpendAlerts": (options) => + HttpClientRequest.get(`/organization/spend_alerts`).pipe( + HttpClientRequest.setUrlParams({ + "limit": options?.params?.["limit"] as any, + "order": options?.params?.["order"] as any, + "after": options?.params?.["after"] as any, + "before": options?.params?.["before"] as any + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(ListOrganizationSpendAlerts200), + orElse: unexpectedStatus + })) + ), + "createOrganizationSpendAlert": (options) => + HttpClientRequest.post(`/organization/spend_alerts`).pipe( + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(CreateOrganizationSpendAlert200), + orElse: unexpectedStatus + })) + ), + "updateOrganizationSpendAlert": (alertId, options) => + HttpClientRequest.post(`/organization/spend_alerts/${alertId}`).pipe( + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(UpdateOrganizationSpendAlert200), + orElse: unexpectedStatus + })) + ), + "deleteOrganizationSpendAlert": (alertId, options) => + HttpClientRequest.delete(`/organization/spend_alerts/${alertId}`).pipe( + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(DeleteOrganizationSpendAlert200), + orElse: unexpectedStatus + })) + ), "usageAudioSpeeches": (options) => HttpClientRequest.get(`/organization/usage/audio_speeches`).pipe( HttpClientRequest.setUrlParams({ @@ -31941,6 +32432,13 @@ export const make = ( orElse: unexpectedStatus })) ), + "retrieveUserRole": (userId, roleId, options) => + HttpClientRequest.get(`/organization/users/${userId}/roles/${roleId}`).pipe( + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(RetrieveUserRole200), + orElse: unexpectedStatus + })) + ), "unassignUserRole": (userId, roleId, options) => HttpClientRequest.delete(`/organization/users/${userId}/roles/${roleId}`).pipe( withResponse(options?.config)(HttpClientResponse.matchStatus({ @@ -31968,6 +32466,13 @@ export const make = ( orElse: unexpectedStatus })) ), + "retrieveProjectGroupRole": (projectId, groupId, roleId, options) => + HttpClientRequest.get(`/projects/${projectId}/groups/${groupId}/roles/${roleId}`).pipe( + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(RetrieveProjectGroupRole200), + orElse: unexpectedStatus + })) + ), "unassignProjectGroupRole": (projectId, groupId, roleId, options) => HttpClientRequest.delete(`/projects/${projectId}/groups/${groupId}/roles/${roleId}`).pipe( withResponse(options?.config)(HttpClientResponse.matchStatus({ @@ -31995,6 +32500,13 @@ export const make = ( orElse: unexpectedStatus })) ), + "retrieveProjectRole": (projectId, roleId, options) => + HttpClientRequest.get(`/projects/${projectId}/roles/${roleId}`).pipe( + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(RetrieveProjectRole200), + orElse: unexpectedStatus + })) + ), "updateProjectRole": (projectId, roleId, options) => HttpClientRequest.post(`/projects/${projectId}/roles/${roleId}`).pipe( HttpClientRequest.bodyJsonUnsafe(options.payload), @@ -32030,6 +32542,13 @@ export const make = ( orElse: unexpectedStatus })) ), + "retrieveProjectUserRole": (projectId, userId, roleId, options) => + HttpClientRequest.get(`/projects/${projectId}/users/${userId}/roles/${roleId}`).pipe( + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(RetrieveProjectUserRole200), + orElse: unexpectedStatus + })) + ), "unassignProjectUserRole": (projectId, userId, roleId, options) => HttpClientRequest.delete(`/projects/${projectId}/users/${userId}/roles/${roleId}`).pipe( withResponse(options?.config)(HttpClientResponse.matchStatus({ @@ -33880,6 +34399,27 @@ export interface OpenAiClient { WithOptionalResponse, HttpClientError.HttpClientError | SchemaError > + /** + * Retrieves organization data retention controls. + */ + readonly "retrieveOrganizationDataRetention": ( + options: { readonly config?: Config | undefined } | undefined + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > + /** + * Updates organization data retention controls. + */ + readonly "updateOrganizationDataRetention": ( + options: { + readonly payload: typeof UpdateOrganizationDataRetentionRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > /** * Lists all groups in the organization. */ @@ -33900,6 +34440,16 @@ export interface OpenAiClient { WithOptionalResponse, HttpClientError.HttpClientError | SchemaError > + /** + * Retrieves a group. + */ + readonly "retrieveGroup": ( + groupId: string, + options: { readonly config?: Config | undefined } | undefined + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > /** * Updates a group's information. */ @@ -33943,6 +34493,17 @@ export interface OpenAiClient { WithOptionalResponse, HttpClientError.HttpClientError | SchemaError > + /** + * Retrieves an organization role assigned to a group. + */ + readonly "retrieveGroupRole": ( + groupId: string, + roleId: string, + options: { readonly config?: Config | undefined } | undefined + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > /** * Unassigns an organization role from a group within the organization. */ @@ -33976,6 +34537,17 @@ export interface OpenAiClient { WithOptionalResponse, HttpClientError.HttpClientError | SchemaError > + /** + * Retrieves a user in a group. + */ + readonly "retrieveGroupUser": ( + groupId: string, + userId: string, + options: { readonly config?: Config | undefined } | undefined + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > /** * Removes a user from a group. */ @@ -34159,6 +34731,29 @@ export interface OpenAiClient { WithOptionalResponse, HttpClientError.HttpClientError | SchemaError > + /** + * Retrieves project data retention controls. + */ + readonly "retrieveProjectDataRetention": ( + projectId: string, + options: { readonly config?: Config | undefined } | undefined + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > + /** + * Updates project data retention controls. + */ + readonly "updateProjectDataRetention": ( + projectId: string, + options: { + readonly payload: typeof UpdateProjectDataRetentionRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > /** * Lists the groups that have access to a project. */ @@ -34182,6 +34777,20 @@ export interface OpenAiClient { WithOptionalResponse, HttpClientError.HttpClientError | SchemaError > + /** + * Retrieves a project's group. + */ + readonly "retrieveProjectGroup": ( + projectId: string, + groupId: string, + options: { + readonly params?: typeof RetrieveProjectGroupParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > /** * Revokes a group's access to a project. */ @@ -34319,6 +34928,20 @@ export interface OpenAiClient { WithOptionalResponse, HttpClientError.HttpClientError | SchemaError > + /** + * Updates a service account in the project. + */ + readonly "updateProjectServiceAccount": ( + projectId: string, + serviceAccountId: string, + options: { + readonly payload: typeof UpdateProjectServiceAccountRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > /** * Deletes a service account from the project. * @@ -34333,6 +34956,57 @@ export interface OpenAiClient { WithOptionalResponse, HttpClientError.HttpClientError | SchemaError > + /** + * Lists project spend alerts. + */ + readonly "listProjectSpendAlerts": ( + projectId: string, + options: { + readonly params?: typeof ListProjectSpendAlertsParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > + /** + * Creates a project spend alert. + */ + readonly "createProjectSpendAlert": ( + projectId: string, + options: { + readonly payload: typeof CreateProjectSpendAlertRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > + /** + * Updates a project spend alert. + */ + readonly "updateProjectSpendAlert": ( + projectId: string, + alertId: string, + options: { + readonly payload: typeof UpdateProjectSpendAlertRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > + /** + * Deletes a project spend alert. + */ + readonly "deleteProjectSpendAlert": ( + projectId: string, + alertId: string, + options: { readonly config?: Config | undefined } | undefined + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > /** * Returns a list of users in the project. */ @@ -34420,6 +35094,16 @@ export interface OpenAiClient { WithOptionalResponse, HttpClientError.HttpClientError | SchemaError > + /** + * Retrieves an organization role. + */ + readonly "retrieveRole": ( + roleId: string, + options: { readonly config?: Config | undefined } | undefined + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > /** * Updates an existing organization role. */ @@ -34440,6 +35124,53 @@ export interface OpenAiClient { WithOptionalResponse, HttpClientError.HttpClientError | SchemaError > + /** + * Lists organization spend alerts. + */ + readonly "listOrganizationSpendAlerts": ( + options: { + readonly params?: typeof ListOrganizationSpendAlertsParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > + /** + * Creates an organization spend alert. + */ + readonly "createOrganizationSpendAlert": ( + options: { + readonly payload: typeof CreateOrganizationSpendAlertRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > + /** + * Updates an organization spend alert. + */ + readonly "updateOrganizationSpendAlert": ( + alertId: string, + options: { + readonly payload: typeof UpdateOrganizationSpendAlertRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > + /** + * Deletes an organization spend alert. + */ + readonly "deleteOrganizationSpendAlert": ( + alertId: string, + options: { readonly config?: Config | undefined } | undefined + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > /** * Get audio speeches usage details for the organization. */ @@ -34597,6 +35328,17 @@ export interface OpenAiClient { WithOptionalResponse, HttpClientError.HttpClientError | SchemaError > + /** + * Retrieves an organization role assigned to a user. + */ + readonly "retrieveUserRole": ( + userId: string, + roleId: string, + options: { readonly config?: Config | undefined } | undefined + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > /** * Unassigns an organization role from a user within the organization. */ @@ -34636,6 +35378,18 @@ export interface OpenAiClient { WithOptionalResponse, HttpClientError.HttpClientError | SchemaError > + /** + * Retrieves a project role assigned to a group. + */ + readonly "retrieveProjectGroupRole": ( + projectId: string, + groupId: string, + roleId: string, + options: { readonly config?: Config | undefined } | undefined + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > /** * Unassigns a project role from a group within a project. */ @@ -34671,6 +35425,17 @@ export interface OpenAiClient { WithOptionalResponse, HttpClientError.HttpClientError | SchemaError > + /** + * Retrieves a project role. + */ + readonly "retrieveProjectRole": ( + projectId: string, + roleId: string, + options: { readonly config?: Config | undefined } | undefined + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > /** * Updates an existing project role. */ @@ -34718,6 +35483,18 @@ export interface OpenAiClient { WithOptionalResponse, HttpClientError.HttpClientError | SchemaError > + /** + * Retrieves a project role assigned to a user. + */ + readonly "retrieveProjectUserRole": ( + projectId: string, + userId: string, + roleId: string, + options: { readonly config?: Config | undefined } | undefined + ) => Effect.Effect< + WithOptionalResponse, + HttpClientError.HttpClientError | SchemaError + > /** * Unassigns a project role from a user within a project. */ diff --git a/packages/ai/openrouter/codegen.yml b/packages/ai/openrouter/codegen.yml index b556693a36..7fea7aae9d 100644 --- a/packages/ai/openrouter/codegen.yml +++ b/packages/ai/openrouter/codegen.yml @@ -10,26 +10,25 @@ excludeAnnotations: - default disableAdditionalProperties: true patches: - # Replace OpenResponsesStreamEvent with a flat oneOf of $refs. - # The original uses allOf wrappers that inline OpenResponsesNonStreamingResponse - # into each variant, producing lines over 1M chars that crash dprint. - - '[{"op":"replace","path":"/components/schemas/OpenResponsesStreamEvent","value":{"oneOf":[{"$ref":"#/components/schemas/OpenResponsesCreatedEvent"},{"$ref":"#/components/schemas/OpenResponsesInProgressEvent"},{"$ref":"#/components/schemas/OpenResponsesCompletedEvent"},{"$ref":"#/components/schemas/OpenResponsesIncompleteEvent"},{"$ref":"#/components/schemas/OpenResponsesFailedEvent"},{"$ref":"#/components/schemas/OpenResponsesErrorEvent"},{"$ref":"#/components/schemas/OpenResponsesOutputItemAddedEvent"},{"$ref":"#/components/schemas/OpenResponsesOutputItemDoneEvent"},{"$ref":"#/components/schemas/OpenResponsesContentPartAddedEvent"},{"$ref":"#/components/schemas/OpenResponsesContentPartDoneEvent"},{"$ref":"#/components/schemas/OpenResponsesTextDeltaEvent"},{"$ref":"#/components/schemas/OpenResponsesTextDoneEvent"},{"$ref":"#/components/schemas/OpenResponsesRefusalDeltaEvent"},{"$ref":"#/components/schemas/OpenResponsesRefusalDoneEvent"},{"$ref":"#/components/schemas/OpenResponsesOutputTextAnnotationAddedEvent"},{"$ref":"#/components/schemas/OpenResponsesFunctionCallArgumentsDeltaEvent"},{"$ref":"#/components/schemas/OpenResponsesFunctionCallArgumentsDoneEvent"},{"$ref":"#/components/schemas/OpenResponsesReasoningDeltaEvent"},{"$ref":"#/components/schemas/OpenResponsesReasoningDoneEvent"},{"$ref":"#/components/schemas/OpenResponsesReasoningSummaryPartAddedEvent"},{"$ref":"#/components/schemas/OpenResponsesReasoningSummaryPartDoneEvent"},{"$ref":"#/components/schemas/OpenResponsesReasoningSummaryTextDeltaEvent"},{"$ref":"#/components/schemas/OpenResponsesReasoningSummaryTextDoneEvent"},{"$ref":"#/components/schemas/OpenResponsesImageGenCallInProgress"},{"$ref":"#/components/schemas/OpenResponsesImageGenCallGenerating"},{"$ref":"#/components/schemas/OpenResponsesImageGenCallPartialImage"},{"$ref":"#/components/schemas/OpenResponsesImageGenCallCompleted"}]}}]' - # Fix AssistantMessage images to include type:"image_url" discriminator and nullable - - '[{"op":"replace","path":"/components/schemas/AssistantMessage/properties/images","value":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","const":"image_url"},"image_url":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"]}},"required":["type","image_url"]}},{"type":"null"}]}}]' - # Add images to ChatStreamingMessageChunk (streaming delta) - - '[{"op":"add","path":"/components/schemas/ChatStreamingMessageChunk/properties/images","value":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","const":"image_url"},"image_url":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"]}},"required":["type","image_url"]}},{"type":"null"}]}}]' - # Add annotations to AssistantMessage (non-streaming) - - '[{"op":"add","path":"/components/schemas/AssistantMessage/properties/annotations","value":{"anyOf":[{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"url_citation"},"url_citation":{"type":"object","properties":{"url":{"type":"string"},"title":{"type":"string"},"start_index":{"type":"number"},"end_index":{"type":"number"},"content":{"type":"string"}},"required":["url"]}},"required":["type","url_citation"]},{"type":"object","properties":{"type":{"type":"string","const":"file_annotation"},"file_annotation":{"type":"object","properties":{"file_id":{"type":"string"},"quote":{"type":"string"}},"required":["file_id"]}},"required":["type","file_annotation"]},{"type":"object","properties":{"type":{"type":"string","const":"file"},"file":{"type":"object","properties":{"hash":{"type":"string"},"name":{"type":"string"},"content":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"text":{"type":"string"}},"required":["type"]}}},"required":["hash","name"]}},"required":["type","file"]}]}},{"type":"null"}]}}]' - # Add annotations to ChatStreamingMessageChunk (streaming delta) - - '[{"op":"add","path":"/components/schemas/ChatStreamingMessageChunk/properties/annotations","value":{"anyOf":[{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"url_citation"},"url_citation":{"type":"object","properties":{"url":{"type":"string"},"title":{"type":"string"},"start_index":{"type":"number"},"end_index":{"type":"number"},"content":{"type":"string"}},"required":["url"]}},"required":["type","url_citation"]},{"type":"object","properties":{"type":{"type":"string","const":"file_annotation"},"file_annotation":{"type":"object","properties":{"file_id":{"type":"string"},"quote":{"type":"string"}},"required":["file_id"]}},"required":["type","file_annotation"]},{"type":"object","properties":{"type":{"type":"string","const":"file"},"file":{"type":"object","properties":{"hash":{"type":"string"},"name":{"type":"string"},"content":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"text":{"type":"string"}},"required":["type"]}}},"required":["hash","name"]}},"required":["type","file"]}]}},{"type":"null"}]}}]' + # Flatten Responses streaming event allOf wrappers to keep generated schemas referential + - '[{"op":"replace","path":"/components/schemas/OpenResponsesCreatedEvent","value":{"type":"object","description":"Event emitted when a response is created","properties":{"response":{"$ref":"#/components/schemas/OpenResponsesResult"},"sequence_number":{"type":"integer"},"type":{"type":"string","enum":["response.created"]}},"required":["type","response","sequence_number"]}},{"op":"replace","path":"/components/schemas/OpenResponsesInProgressEvent","value":{"type":"object","description":"Event emitted when a response is in progress","properties":{"response":{"$ref":"#/components/schemas/OpenResponsesResult"},"sequence_number":{"type":"integer"},"type":{"type":"string","enum":["response.in_progress"]}},"required":["type","response","sequence_number"]}},{"op":"replace","path":"/components/schemas/StreamEventsResponseCompleted","value":{"type":"object","description":"Event emitted when a response has completed successfully","properties":{"response":{"$ref":"#/components/schemas/OpenResponsesResult"},"sequence_number":{"type":"integer"},"type":{"type":"string","enum":["response.completed"]}},"required":["type","response","sequence_number"]}},{"op":"replace","path":"/components/schemas/StreamEventsResponseIncomplete","value":{"type":"object","description":"Event emitted when a response is incomplete","properties":{"response":{"$ref":"#/components/schemas/OpenResponsesResult"},"sequence_number":{"type":"integer"},"type":{"type":"string","enum":["response.incomplete"]}},"required":["type","response","sequence_number"]}},{"op":"replace","path":"/components/schemas/StreamEventsResponseFailed","value":{"type":"object","description":"Event emitted when a response has failed","properties":{"response":{"$ref":"#/components/schemas/OpenResponsesResult"},"sequence_number":{"type":"integer"},"type":{"type":"string","enum":["response.failed"]}},"required":["type","response","sequence_number"]}},{"op":"replace","path":"/components/schemas/StreamEventsResponseOutputItemAdded","value":{"type":"object","description":"Event emitted when a new output item is added to the response","properties":{"item":{"$ref":"#/components/schemas/OutputItems"},"output_index":{"type":"integer"},"sequence_number":{"type":"integer"},"type":{"type":"string","enum":["response.output_item.added"]}},"required":["type","output_index","item","sequence_number"]}},{"op":"replace","path":"/components/schemas/StreamEventsResponseOutputItemDone","value":{"type":"object","description":"Event emitted when an output item is complete","properties":{"item":{"$ref":"#/components/schemas/OutputItems"},"output_index":{"type":"integer"},"sequence_number":{"type":"integer"},"type":{"type":"string","enum":["response.output_item.done"]}},"required":["type","output_index","item","sequence_number"]}},{"op":"replace","path":"/components/schemas/ContentPartAddedEvent","value":{"type":"object","description":"Event emitted when a new content part is added to an output item","properties":{"content_index":{"type":"integer"},"item_id":{"type":"string"},"output_index":{"type":"integer"},"part":{"anyOf":[{"$ref":"#/components/schemas/ResponseOutputText"},{"$ref":"#/components/schemas/ReasoningTextContent"},{"$ref":"#/components/schemas/OpenAIResponsesRefusalContent"}]},"sequence_number":{"type":"integer"},"type":{"type":"string","enum":["response.content_part.added"]}},"required":["type","output_index","item_id","content_index","part","sequence_number"]}},{"op":"replace","path":"/components/schemas/ContentPartDoneEvent","value":{"type":"object","description":"Event emitted when a content part is complete","properties":{"content_index":{"type":"integer"},"item_id":{"type":"string"},"output_index":{"type":"integer"},"part":{"anyOf":[{"$ref":"#/components/schemas/ResponseOutputText"},{"$ref":"#/components/schemas/ReasoningTextContent"},{"$ref":"#/components/schemas/OpenAIResponsesRefusalContent"}]},"sequence_number":{"type":"integer"},"type":{"type":"string","enum":["response.content_part.done"]}},"required":["type","output_index","item_id","content_index","part","sequence_number"]}}]' + # Fix ChatAssistantMessage images to include type:"image_url" discriminator and nullable + - '[{"op":"replace","path":"/components/schemas/ChatAssistantMessage/properties/images","value":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","const":"image_url"},"image_url":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"]}},"required":["type","image_url"]}},{"type":"null"}]}}]' + # Add images to ChatStreamDelta (streaming delta) + - '[{"op":"add","path":"/components/schemas/ChatStreamDelta/properties/images","value":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","const":"image_url"},"image_url":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"]}},"required":["type","image_url"]}},{"type":"null"}]}}]' + # Add annotations to ChatAssistantMessage (non-streaming) + - '[{"op":"add","path":"/components/schemas/ChatAssistantMessage/properties/annotations","value":{"anyOf":[{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"url_citation"},"url_citation":{"type":"object","properties":{"url":{"type":"string"},"title":{"type":"string"},"start_index":{"type":"number"},"end_index":{"type":"number"},"content":{"type":"string"}},"required":["url"]}},"required":["type","url_citation"]},{"type":"object","properties":{"type":{"type":"string","const":"file_annotation"},"file_annotation":{"type":"object","properties":{"file_id":{"type":"string"},"quote":{"type":"string"}},"required":["file_id"]}},"required":["type","file_annotation"]},{"type":"object","properties":{"type":{"type":"string","const":"file"},"file":{"type":"object","properties":{"hash":{"type":"string"},"name":{"type":"string"},"content":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"text":{"type":"string"}},"required":["type"]}}},"required":["hash","name"]}},"required":["type","file"]}]}},{"type":"null"}]}}]' + # Add annotations to ChatStreamDelta (streaming delta) + - '[{"op":"add","path":"/components/schemas/ChatStreamDelta/properties/annotations","value":{"anyOf":[{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"url_citation"},"url_citation":{"type":"object","properties":{"url":{"type":"string"},"title":{"type":"string"},"start_index":{"type":"number"},"end_index":{"type":"number"},"content":{"type":"string"}},"required":["url"]}},"required":["type","url_citation"]},{"type":"object","properties":{"type":{"type":"string","const":"file_annotation"},"file_annotation":{"type":"object","properties":{"file_id":{"type":"string"},"quote":{"type":"string"}},"required":["file_id"]}},"required":["type","file_annotation"]},{"type":"object","properties":{"type":{"type":"string","const":"file"},"file":{"type":"object","properties":{"hash":{"type":"string"},"name":{"type":"string"},"content":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"text":{"type":"string"}},"required":["type"]}}},"required":["hash","name"]}},"required":["type","file"]}]}},{"type":"null"}]}}]' # Make tool call delta fields nullable (models like kimi-k2.5, minimax-m2.5 send null) - - '[{"op":"replace","path":"/components/schemas/ChatStreamingMessageToolCall/properties/id","value":{"anyOf":[{"type":"string"},{"type":"null"}]}},{"op":"replace","path":"/components/schemas/ChatStreamingMessageToolCall/properties/type","value":{"anyOf":[{"type":"string","const":"function"},{"type":"null"}]}},{"op":"replace","path":"/components/schemas/ChatStreamingMessageToolCall/properties/function/properties/name","value":{"anyOf":[{"type":"string"},{"type":"null"}]}}]' + - '[{"op":"replace","path":"/components/schemas/ChatStreamToolCall/properties/id","value":{"anyOf":[{"type":"string"},{"type":"null"}]}},{"op":"replace","path":"/components/schemas/ChatStreamToolCall/properties/type","value":{"anyOf":[{"type":"string","const":"function"},{"type":"null"}]}},{"op":"replace","path":"/components/schemas/ChatStreamToolCall/properties/function/properties/name","value":{"anyOf":[{"type":"string"},{"type":"null"}]}}]' # Make finish_reason optional (only present on final streaming chunk) - - '[{"op":"remove","path":"/components/schemas/ChatStreamingChoice/required/1"}]' + - '[{"op":"remove","path":"/components/schemas/ChatStreamChoice/required/1"}]' replacements: - # Schema.Unknown doesn't work with Schema.toCodecJson (used by HttpClientResponse.schemaBodyJson) - # Replace with Schema.Json which properly handles arbitrary JSON values - - from: "Schema.Record(Schema.String, Schema.Unknown)" - to: "Schema.Record(Schema.String, Schema.Json)" - - from: "{ readonly [x: string]: unknown }" - to: "{ readonly [x: string]: Schema.Json }" + # Help TypeScript serialize oversized generated schema values + - from: "export const StreamEvents = Schema.Union([" + to: "export const StreamEvents: Schema.Schema = Schema.Union([" + - from: "export const ResponsesStreamingResponse = Schema.Struct({ \"data\": StreamEvents })" + to: "export const ResponsesStreamingResponse: Schema.Schema = Schema.Struct({ \"data\": StreamEvents })" + - from: "export const CreateResponses200Sse = ResponsesStreamingResponse" + to: "export const CreateResponses200Sse: Schema.Schema = ResponsesStreamingResponse" diff --git a/packages/ai/openrouter/src/Generated.ts b/packages/ai/openrouter/src/Generated.ts index 8cdb32d42d..d6bcecdb25 100644 --- a/packages/ai/openrouter/src/Generated.ts +++ b/packages/ai/openrouter/src/Generated.ts @@ -1,5 +1,5 @@ /** - * @since 4.0.0 + * @since 1.0.0 */ import * as Data from "effect/Data" @@ -13,588 +13,1583 @@ import * as HttpClientError from "effect/unstable/http/HttpClientError" import * as HttpClientRequest from "effect/unstable/http/HttpClientRequest" import * as HttpClientResponse from "effect/unstable/http/HttpClientResponse" // non-recursive definitions -export type OpenAIResponsesResponseStatus = - | "completed" - | "incomplete" - | "in_progress" - | "failed" - | "cancelled" - | "queued" -export const OpenAIResponsesResponseStatus = Schema.Literals([ - "completed", - "incomplete", - "in_progress", - "failed", - "cancelled", - "queued" -]) -export type FileCitation = { - readonly "type": "file_citation" +export type ActivityItem = { + readonly "byok_usage_inference": number + readonly "completion_tokens": number + readonly "date": string + readonly "endpoint_id": string + readonly "model": string + readonly "model_permaslug": string + readonly "prompt_tokens": number + readonly "provider_name": string + readonly "reasoning_tokens": number + readonly "requests": number + readonly "usage": number +} +export const ActivityItem = Schema.Struct({ + "byok_usage_inference": Schema.Number.annotate({ + "description": "BYOK inference cost in USD (external credits spent)", + "format": "double" + }).check(Schema.isFinite()), + "completion_tokens": Schema.Number.annotate({ "description": "Total completion tokens generated" }).check( + Schema.isInt() + ), + "date": Schema.String.annotate({ "description": "Date of the activity (YYYY-MM-DD format)" }), + "endpoint_id": Schema.String.annotate({ "description": "Unique identifier for the endpoint" }), + "model": Schema.String.annotate({ "description": "Model slug (e.g., \"openai/gpt-4.1\")" }), + "model_permaslug": Schema.String.annotate({ "description": "Model permaslug (e.g., \"openai/gpt-4.1-2025-04-14\")" }), + "prompt_tokens": Schema.Number.annotate({ "description": "Total prompt tokens used" }).check(Schema.isInt()), + "provider_name": Schema.String.annotate({ "description": "Name of the provider serving this endpoint" }), + "reasoning_tokens": Schema.Number.annotate({ "description": "Total reasoning tokens used" }).check(Schema.isInt()), + "requests": Schema.Number.annotate({ "description": "Number of requests made" }).check(Schema.isInt()), + "usage": Schema.Number.annotate({ "description": "Total cost in USD (OpenRouter credits spent)", "format": "double" }) + .check(Schema.isFinite()) +}) +export type AnthropicAdvisorToolResult = { + readonly "content": {} + readonly "tool_use_id": string + readonly "type": "advisor_tool_result" +} +export const AnthropicAdvisorToolResult = Schema.Struct({ + "content": Schema.Struct({}), + "tool_use_id": Schema.String, + "type": Schema.Literal("advisor_tool_result") +}) +export type AnthropicAllowedCallers = ReadonlyArray<"direct" | "code_execution_20250825" | "code_execution_20260120"> +export const AnthropicAllowedCallers = Schema.Array( + Schema.Literals(["direct", "code_execution_20250825", "code_execution_20260120"]) +) +export type AnthropicBase64PdfSource = { + readonly "data": string + readonly "media_type": "application/pdf" + readonly "type": "base64" +} +export const AnthropicBase64PdfSource = Schema.Struct({ + "data": Schema.String, + "media_type": Schema.Literal("application/pdf"), + "type": Schema.Literal("base64") +}) +export type AnthropicBashCodeExecutionOutput = { readonly "file_id": string - readonly "filename": string - readonly "index": number + readonly "type": "bash_code_execution_output" } -export const FileCitation = Schema.Struct({ - "type": Schema.Literal("file_citation"), +export const AnthropicBashCodeExecutionOutput = Schema.Struct({ "file_id": Schema.String, - "filename": Schema.String, - "index": Schema.Number.check(Schema.isFinite()) + "type": Schema.Literal("bash_code_execution_output") }) -export type URLCitation = { - readonly "type": "url_citation" - readonly "url": string +export type AnthropicBashCodeExecutionToolResultError = { + readonly "error_code": + | "invalid_tool_input" + | "unavailable" + | "too_many_requests" + | "execution_time_exceeded" + | "output_file_too_large" + readonly "type": "bash_code_execution_tool_result_error" +} +export const AnthropicBashCodeExecutionToolResultError = Schema.Struct({ + "error_code": Schema.Literals([ + "invalid_tool_input", + "unavailable", + "too_many_requests", + "execution_time_exceeded", + "output_file_too_large" + ]), + "type": Schema.Literal("bash_code_execution_tool_result_error") +}) +export type AnthropicCacheControlTtl = "5m" | "1h" +export const AnthropicCacheControlTtl = Schema.Literals(["5m", "1h"]) +export type AnthropicCacheCreation = { + readonly "ephemeral_1h_input_tokens": number + readonly "ephemeral_5m_input_tokens": number +} +export const AnthropicCacheCreation = Schema.Struct({ + "ephemeral_1h_input_tokens": Schema.Number.check(Schema.isInt()), + "ephemeral_5m_input_tokens": Schema.Number.check(Schema.isInt()) +}) +export type AnthropicCitationCharLocation = { + readonly "cited_text": string + readonly "document_index": number + readonly "document_title": string + readonly "end_char_index": number + readonly "file_id": string + readonly "start_char_index": number + readonly "type": "char_location" +} +export const AnthropicCitationCharLocation = Schema.Struct({ + "cited_text": Schema.String, + "document_index": Schema.Number.check(Schema.isInt()), + "document_title": Schema.String, + "end_char_index": Schema.Number.check(Schema.isInt()), + "file_id": Schema.String, + "start_char_index": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("char_location") +}) +export type AnthropicCitationCharLocationParam = { + readonly "cited_text": string + readonly "document_index": number + readonly "document_title": string + readonly "end_char_index": number + readonly "start_char_index": number + readonly "type": "char_location" +} +export const AnthropicCitationCharLocationParam = Schema.Struct({ + "cited_text": Schema.String, + "document_index": Schema.Number.check(Schema.isInt()), + "document_title": Schema.String, + "end_char_index": Schema.Number.check(Schema.isInt()), + "start_char_index": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("char_location") +}) +export type AnthropicCitationContentBlockLocation = { + readonly "cited_text": string + readonly "document_index": number + readonly "document_title": string + readonly "end_block_index": number + readonly "file_id": string + readonly "start_block_index": number + readonly "type": "content_block_location" +} +export const AnthropicCitationContentBlockLocation = Schema.Struct({ + "cited_text": Schema.String, + "document_index": Schema.Number.check(Schema.isInt()), + "document_title": Schema.String, + "end_block_index": Schema.Number.check(Schema.isInt()), + "file_id": Schema.String, + "start_block_index": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("content_block_location") +}) +export type AnthropicCitationContentBlockLocationParam = { + readonly "cited_text": string + readonly "document_index": number + readonly "document_title": string + readonly "end_block_index": number + readonly "start_block_index": number + readonly "type": "content_block_location" +} +export const AnthropicCitationContentBlockLocationParam = Schema.Struct({ + "cited_text": Schema.String, + "document_index": Schema.Number.check(Schema.isInt()), + "document_title": Schema.String, + "end_block_index": Schema.Number.check(Schema.isInt()), + "start_block_index": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("content_block_location") +}) +export type AnthropicCitationPageLocation = { + readonly "cited_text": string + readonly "document_index": number + readonly "document_title": string + readonly "end_page_number": number + readonly "file_id": string + readonly "start_page_number": number + readonly "type": "page_location" +} +export const AnthropicCitationPageLocation = Schema.Struct({ + "cited_text": Schema.String, + "document_index": Schema.Number.check(Schema.isInt()), + "document_title": Schema.String, + "end_page_number": Schema.Number.check(Schema.isInt()), + "file_id": Schema.String, + "start_page_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("page_location") +}) +export type AnthropicCitationPageLocationParam = { + readonly "cited_text": string + readonly "document_index": number + readonly "document_title": string + readonly "end_page_number": number + readonly "start_page_number": number + readonly "type": "page_location" +} +export const AnthropicCitationPageLocationParam = Schema.Struct({ + "cited_text": Schema.String, + "document_index": Schema.Number.check(Schema.isInt()), + "document_title": Schema.String, + "end_page_number": Schema.Number.check(Schema.isInt()), + "start_page_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("page_location") +}) +export type AnthropicCitationsConfig = { readonly "enabled": boolean } +export const AnthropicCitationsConfig = Schema.Struct({ "enabled": Schema.Boolean }) +export type AnthropicCitationSearchResultLocation = { + readonly "cited_text": string + readonly "end_block_index": number + readonly "search_result_index": number + readonly "source": string + readonly "start_block_index": number readonly "title": string - readonly "start_index": number - readonly "end_index": number + readonly "type": "search_result_location" } -export const URLCitation = Schema.Struct({ - "type": Schema.Literal("url_citation"), - "url": Schema.String, +export const AnthropicCitationSearchResultLocation = Schema.Struct({ + "cited_text": Schema.String, + "end_block_index": Schema.Number.check(Schema.isInt()), + "search_result_index": Schema.Number.check(Schema.isInt()), + "source": Schema.String, + "start_block_index": Schema.Number.check(Schema.isInt()), "title": Schema.String, - "start_index": Schema.Number.check(Schema.isFinite()), - "end_index": Schema.Number.check(Schema.isFinite()) + "type": Schema.Literal("search_result_location") }) -export type FilePath = { readonly "type": "file_path"; readonly "file_id": string; readonly "index": number } -export const FilePath = Schema.Struct({ - "type": Schema.Literal("file_path"), +export type AnthropicCitationWebSearchResultLocation = { + readonly "cited_text": string + readonly "encrypted_index": string + readonly "title": string + readonly "type": "web_search_result_location" + readonly "url": string +} +export const AnthropicCitationWebSearchResultLocation = Schema.Struct({ + "cited_text": Schema.String, + "encrypted_index": Schema.String, + "title": Schema.String, + "type": Schema.Literal("web_search_result_location"), + "url": Schema.String +}) +export type AnthropicCodeExecution20250825Caller = { + readonly "tool_id": string + readonly "type": "code_execution_20250825" +} +export const AnthropicCodeExecution20250825Caller = Schema.Struct({ + "tool_id": Schema.String, + "type": Schema.Literal("code_execution_20250825") +}) +export type AnthropicCodeExecution20260120Caller = { + readonly "tool_id": string + readonly "type": "code_execution_20260120" +} +export const AnthropicCodeExecution20260120Caller = Schema.Struct({ + "tool_id": Schema.String, + "type": Schema.Literal("code_execution_20260120") +}) +export type AnthropicCodeExecutionOutput = { readonly "file_id": string; readonly "type": "code_execution_output" } +export const AnthropicCodeExecutionOutput = Schema.Struct({ "file_id": Schema.String, - "index": Schema.Number.check(Schema.isFinite()) + "type": Schema.Literal("code_execution_output") }) -export type OpenAIResponsesRefusalContent = { readonly "type": "refusal"; readonly "refusal": string } -export const OpenAIResponsesRefusalContent = Schema.Struct({ - "type": Schema.Literal("refusal"), - "refusal": Schema.String +export type AnthropicCompactionBlock = { readonly "content": string; readonly "type": "compaction" } +export const AnthropicCompactionBlock = Schema.Struct({ + "content": Schema.String, + "type": Schema.Literal("compaction") }) -export type ReasoningTextContent = { readonly "type": "reasoning_text"; readonly "text": string } -export const ReasoningTextContent = Schema.Struct({ "type": Schema.Literal("reasoning_text"), "text": Schema.String }) -export type ReasoningSummaryText = { readonly "type": "summary_text"; readonly "text": string } -export const ReasoningSummaryText = Schema.Struct({ "type": Schema.Literal("summary_text"), "text": Schema.String }) -export type OutputItemFunctionCall = { - readonly "type": "function_call" - readonly "id"?: string - readonly "name": string - readonly "arguments": string - readonly "call_id": string - readonly "status"?: "completed" | "incomplete" | "in_progress" +export type AnthropicContainer = { readonly "expires_at": string; readonly "id": string } +export const AnthropicContainer = Schema.Struct({ "expires_at": Schema.String, "id": Schema.String }) +export type AnthropicContainerUpload = { readonly "file_id": string; readonly "type": "container_upload" } +export const AnthropicContainerUpload = Schema.Struct({ + "file_id": Schema.String, + "type": Schema.Literal("container_upload") +}) +export type AnthropicDirectCaller = { readonly "type": "direct" } +export const AnthropicDirectCaller = Schema.Struct({ "type": Schema.Literal("direct") }) +export type AnthropicImageMimeType = "image/jpeg" | "image/png" | "image/gif" | "image/webp" +export const AnthropicImageMimeType = Schema.Literals(["image/jpeg", "image/png", "image/gif", "image/webp"]) +export type AnthropicInputTokensClearAtLeast = { readonly "type": "input_tokens"; readonly "value": number } +export const AnthropicInputTokensClearAtLeast = Schema.Struct({ + "type": Schema.Literal("input_tokens"), + "value": Schema.Number.check(Schema.isInt()) +}) +export type AnthropicInputTokensTrigger = { readonly "type": "input_tokens"; readonly "value": number } +export const AnthropicInputTokensTrigger = Schema.Struct({ + "type": Schema.Literal("input_tokens"), + "value": Schema.Number.check(Schema.isInt()) +}) +export type AnthropicIterationCacheCreation = { + readonly "ephemeral_1h_input_tokens"?: number + readonly "ephemeral_5m_input_tokens"?: number } -export const OutputItemFunctionCall = Schema.Struct({ - "type": Schema.Literal("function_call"), - "id": Schema.optionalKey(Schema.String), - "name": Schema.String, - "arguments": Schema.String, - "call_id": Schema.String, - "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])) +export const AnthropicIterationCacheCreation = Schema.Struct({ + "ephemeral_1h_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "ephemeral_5m_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())) }) -export type ResponsesOutputItemFunctionCall = { - readonly "type": "function_call" - readonly "id"?: string - readonly "name": string - readonly "arguments": string - readonly "call_id": string - readonly "status"?: "completed" | "incomplete" | "in_progress" +export type AnthropicPlainTextSource = { + readonly "data": string + readonly "media_type": "text/plain" + readonly "type": "text" } -export const ResponsesOutputItemFunctionCall = Schema.Struct({ - "type": Schema.Literal("function_call"), - "id": Schema.optionalKey(Schema.String), - "name": Schema.String, - "arguments": Schema.String, - "call_id": Schema.String, - "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])) +export const AnthropicPlainTextSource = Schema.Struct({ + "data": Schema.String, + "media_type": Schema.Literal("text/plain"), + "type": Schema.Literal("text") }) -export type WebSearchStatus = "completed" | "searching" | "in_progress" | "failed" -export const WebSearchStatus = Schema.Literals(["completed", "searching", "in_progress", "failed"]) -export type ImageGenerationStatus = "in_progress" | "completed" | "generating" | "failed" -export const ImageGenerationStatus = Schema.Literals(["in_progress", "completed", "generating", "failed"]) -export type ResponsesErrorField = { - readonly "code": - | "server_error" - | "rate_limit_exceeded" - | "invalid_prompt" - | "vector_store_timeout" - | "invalid_image" - | "invalid_image_format" - | "invalid_base64_image" - | "invalid_image_url" - | "image_too_large" - | "image_too_small" - | "image_parse_error" - | "image_content_policy_violation" - | "invalid_image_mode" - | "image_file_too_large" - | "unsupported_image_media_type" - | "empty_image_file" - | "failed_to_download_image" - | "image_file_not_found" - readonly "message": string +export type AnthropicRedactedThinkingBlock = { readonly "data": string; readonly "type": "redacted_thinking" } +export const AnthropicRedactedThinkingBlock = Schema.Struct({ + "data": Schema.String, + "type": Schema.Literal("redacted_thinking") +}) +export type AnthropicRefusalStopDetails = { + readonly "category": "cyber" | "bio" | null + readonly "explanation": string + readonly "type": "refusal" } -export const ResponsesErrorField = Schema.Struct({ - "code": Schema.Literals([ - "server_error", - "rate_limit_exceeded", - "invalid_prompt", - "vector_store_timeout", - "invalid_image", - "invalid_image_format", - "invalid_base64_image", - "invalid_image_url", - "image_too_large", - "image_too_small", - "image_parse_error", - "image_content_policy_violation", - "invalid_image_mode", - "image_file_too_large", - "unsupported_image_media_type", - "empty_image_file", - "failed_to_download_image", - "image_file_not_found" +export const AnthropicRefusalStopDetails = Schema.Struct({ + "category": Schema.Union([Schema.Literal("cyber"), Schema.Literal("bio"), Schema.Null]), + "explanation": Schema.String, + "type": Schema.Literal("refusal") +}).annotate({ "description": "Structured information about a refusal" }) +export type AnthropicServerToolErrorCode = + | "invalid_tool_input" + | "unavailable" + | "too_many_requests" + | "execution_time_exceeded" +export const AnthropicServerToolErrorCode = Schema.Literals([ + "invalid_tool_input", + "unavailable", + "too_many_requests", + "execution_time_exceeded" +]) +export type AnthropicServerToolUsage = { readonly "web_fetch_requests": number; readonly "web_search_requests": number } +export const AnthropicServerToolUsage = Schema.Struct({ + "web_fetch_requests": Schema.Number.check(Schema.isInt()), + "web_search_requests": Schema.Number.check(Schema.isInt()) +}) +export type AnthropicServiceTier = "standard" | "priority" | "batch" | null +export const AnthropicServiceTier = Schema.Union([ + Schema.Literal("standard"), + Schema.Literal("priority"), + Schema.Literal("batch"), + Schema.Null +]) +export type AnthropicSpeed = "fast" | "standard" | null +export const AnthropicSpeed = Schema.Union([Schema.Literal("fast"), Schema.Literal("standard"), Schema.Null]) +export type AnthropicTextEditorCodeExecutionCreateResult = { + readonly "is_file_update": boolean + readonly "type": "text_editor_code_execution_create_result" +} +export const AnthropicTextEditorCodeExecutionCreateResult = Schema.Struct({ + "is_file_update": Schema.Boolean, + "type": Schema.Literal("text_editor_code_execution_create_result") +}) +export type AnthropicTextEditorCodeExecutionStrReplaceResult = { + readonly "lines": ReadonlyArray + readonly "new_lines": number + readonly "new_start": number + readonly "old_lines": number + readonly "old_start": number + readonly "type": "text_editor_code_execution_str_replace_result" +} +export const AnthropicTextEditorCodeExecutionStrReplaceResult = Schema.Struct({ + "lines": Schema.Array(Schema.String), + "new_lines": Schema.Number.check(Schema.isInt()), + "new_start": Schema.Number.check(Schema.isInt()), + "old_lines": Schema.Number.check(Schema.isInt()), + "old_start": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("text_editor_code_execution_str_replace_result") +}) +export type AnthropicTextEditorCodeExecutionToolResultError = { + readonly "error_code": + | "invalid_tool_input" + | "unavailable" + | "too_many_requests" + | "execution_time_exceeded" + | "file_not_found" + readonly "error_message": string + readonly "type": "text_editor_code_execution_tool_result_error" +} +export const AnthropicTextEditorCodeExecutionToolResultError = Schema.Struct({ + "error_code": Schema.Literals([ + "invalid_tool_input", + "unavailable", + "too_many_requests", + "execution_time_exceeded", + "file_not_found" ]), - "message": Schema.String -}).annotate({ "description": "Error information returned from the API" }) -export type OpenAIResponsesIncompleteDetails = { readonly "reason"?: "max_output_tokens" | "content_filter" } -export const OpenAIResponsesIncompleteDetails = Schema.Struct({ - "reason": Schema.optionalKey(Schema.Literals(["max_output_tokens", "content_filter"])) + "error_message": Schema.String, + "type": Schema.Literal("text_editor_code_execution_tool_result_error") }) -export type OpenAIResponsesUsage = { - readonly "input_tokens": number - readonly "input_tokens_details": { readonly "cached_tokens": number } - readonly "output_tokens": number - readonly "output_tokens_details": { readonly "reasoning_tokens": number } - readonly "total_tokens": number +export type AnthropicTextEditorCodeExecutionViewResult = { + readonly "content": string + readonly "file_type": "text" | "image" | "pdf" + readonly "num_lines": number + readonly "start_line": number + readonly "total_lines": number + readonly "type": "text_editor_code_execution_view_result" } -export const OpenAIResponsesUsage = Schema.Struct({ - "input_tokens": Schema.Number.check(Schema.isFinite()), - "input_tokens_details": Schema.Struct({ "cached_tokens": Schema.Number.check(Schema.isFinite()) }), - "output_tokens": Schema.Number.check(Schema.isFinite()), - "output_tokens_details": Schema.Struct({ "reasoning_tokens": Schema.Number.check(Schema.isFinite()) }), - "total_tokens": Schema.Number.check(Schema.isFinite()) -}) -export type ResponseInputText = { readonly "type": "input_text"; readonly "text": string } -export const ResponseInputText = Schema.Struct({ "type": Schema.Literal("input_text"), "text": Schema.String }) - .annotate({ "description": "Text input content item" }) -export type ResponseInputImage = { - readonly "type": "input_image" - readonly "detail": "auto" | "high" | "low" - readonly "image_url"?: string +export const AnthropicTextEditorCodeExecutionViewResult = Schema.Struct({ + "content": Schema.String, + "file_type": Schema.Literals(["text", "image", "pdf"]), + "num_lines": Schema.Number.check(Schema.isInt()), + "start_line": Schema.Number.check(Schema.isInt()), + "total_lines": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("text_editor_code_execution_view_result") +}) +export type AnthropicThinkingBlock = { + readonly "signature": string + readonly "thinking": string + readonly "type": "thinking" } -export const ResponseInputImage = Schema.Struct({ - "type": Schema.Literal("input_image"), - "detail": Schema.Literals(["auto", "high", "low"]), - "image_url": Schema.optionalKey(Schema.String) -}).annotate({ "description": "Image input content item" }) -export type ResponseInputFile = { - readonly "type": "input_file" - readonly "file_id"?: string - readonly "file_data"?: string - readonly "filename"?: string - readonly "file_url"?: string +export const AnthropicThinkingBlock = Schema.Struct({ + "signature": Schema.String, + "thinking": Schema.String, + "type": Schema.Literal("thinking") +}) +export type AnthropicThinkingDisplay = "summarized" | "omitted" | null +export const AnthropicThinkingDisplay = Schema.Union([ + Schema.Literal("summarized"), + Schema.Literal("omitted"), + Schema.Null +]) +export type AnthropicThinkingTurns = { readonly "type": "thinking_turns"; readonly "value": number } +export const AnthropicThinkingTurns = Schema.Struct({ + "type": Schema.Literal("thinking_turns"), + "value": Schema.Number.check(Schema.isInt()) +}) +export type AnthropicToolReference = { readonly "tool_name": string; readonly "type": "tool_reference" } +export const AnthropicToolReference = Schema.Struct({ + "tool_name": Schema.String, + "type": Schema.Literal("tool_reference") +}) +export type AnthropicToolUsesKeep = { readonly "type": "tool_uses"; readonly "value": number } +export const AnthropicToolUsesKeep = Schema.Struct({ + "type": Schema.Literal("tool_uses"), + "value": Schema.Number.check(Schema.isInt()) +}) +export type AnthropicToolUsesTrigger = { readonly "type": "tool_uses"; readonly "value": number } +export const AnthropicToolUsesTrigger = Schema.Struct({ + "type": Schema.Literal("tool_uses"), + "value": Schema.Number.check(Schema.isInt()) +}) +export type AnthropicUrlImageSource = { readonly "type": "url"; readonly "url": string } +export const AnthropicUrlImageSource = Schema.Struct({ "type": Schema.Literal("url"), "url": Schema.String }) +export type AnthropicUrlPdfSource = { readonly "type": "url"; readonly "url": string } +export const AnthropicUrlPdfSource = Schema.Struct({ "type": Schema.Literal("url"), "url": Schema.String }) +export type AnthropicWebFetchToolResultError = { + readonly "error_code": + | "invalid_tool_input" + | "url_too_long" + | "url_not_allowed" + | "url_not_accessible" + | "unsupported_content_type" + | "too_many_requests" + | "max_uses_exceeded" + | "unavailable" + readonly "type": "web_fetch_tool_result_error" } -export const ResponseInputFile = Schema.Struct({ - "type": Schema.Literal("input_file"), - "file_id": Schema.optionalKey(Schema.String), - "file_data": Schema.optionalKey(Schema.String), - "filename": Schema.optionalKey(Schema.String), - "file_url": Schema.optionalKey(Schema.String) -}).annotate({ "description": "File input content item" }) -export type ResponseInputAudio = { - readonly "type": "input_audio" - readonly "input_audio": { readonly "data": string; readonly "format": "mp3" | "wav" } +export const AnthropicWebFetchToolResultError = Schema.Struct({ + "error_code": Schema.Literals([ + "invalid_tool_input", + "url_too_long", + "url_not_allowed", + "url_not_accessible", + "unsupported_content_type", + "too_many_requests", + "max_uses_exceeded", + "unavailable" + ]), + "type": Schema.Literal("web_fetch_tool_result_error") +}) +export type AnthropicWebSearchResult = { + readonly "encrypted_content": string + readonly "page_age": string + readonly "title": string + readonly "type": "web_search_result" + readonly "url": string } -export const ResponseInputAudio = Schema.Struct({ - "type": Schema.Literal("input_audio"), - "input_audio": Schema.Struct({ "data": Schema.String, "format": Schema.Literals(["mp3", "wav"]) }) -}).annotate({ "description": "Audio input content item" }) -export type ToolCallStatus = "in_progress" | "completed" | "incomplete" -export const ToolCallStatus = Schema.Literals(["in_progress", "completed", "incomplete"]) -export type OpenResponsesRequestMetadata = {} -export const OpenResponsesRequestMetadata = Schema.Struct({}).annotate({ - "description": - "Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed." +export const AnthropicWebSearchResult = Schema.Struct({ + "encrypted_content": Schema.String, + "page_age": Schema.String, + "title": Schema.String, + "type": Schema.Literal("web_search_result"), + "url": Schema.String }) -export type ResponsesSearchContextSize = "low" | "medium" | "high" -export const ResponsesSearchContextSize = Schema.Literals(["low", "medium", "high"]).annotate({ - "description": "Size of the search context for web search tools" +export type AnthropicWebSearchResultBlockParam = { + readonly "encrypted_content": string + readonly "page_age"?: string + readonly "title": string + readonly "type": "web_search_result" + readonly "url": string +} +export const AnthropicWebSearchResultBlockParam = Schema.Struct({ + "encrypted_content": Schema.String, + "page_age": Schema.optionalKey(Schema.String), + "title": Schema.String, + "type": Schema.Literal("web_search_result"), + "url": Schema.String }) -export type WebSearchPreviewToolUserLocation = { - readonly "type": "approximate" - readonly "city"?: string - readonly "country"?: string - readonly "region"?: string - readonly "timezone"?: string +export type AnthropicWebSearchToolResultError = { + readonly "error_code": + | "invalid_tool_input" + | "unavailable" + | "max_uses_exceeded" + | "too_many_requests" + | "query_too_long" + | "request_too_large" + readonly "type": "web_search_tool_result_error" } -export const WebSearchPreviewToolUserLocation = Schema.Struct({ - "type": Schema.Literal("approximate"), - "city": Schema.optionalKey(Schema.String), - "country": Schema.optionalKey(Schema.String), - "region": Schema.optionalKey(Schema.String), - "timezone": Schema.optionalKey(Schema.String) +export const AnthropicWebSearchToolResultError = Schema.Struct({ + "error_code": Schema.Literals([ + "invalid_tool_input", + "unavailable", + "max_uses_exceeded", + "too_many_requests", + "query_too_long", + "request_too_large" + ]), + "type": Schema.Literal("web_search_tool_result_error") }) -export type ResponsesWebSearchUserLocation = { - readonly "type"?: "approximate" +export type AnthropicWebSearchToolUserLocation = { readonly "city"?: string readonly "country"?: string readonly "region"?: string readonly "timezone"?: string + readonly "type": "approximate" } -export const ResponsesWebSearchUserLocation = Schema.Struct({ - "type": Schema.optionalKey(Schema.Literal("approximate")), +export const AnthropicWebSearchToolUserLocation = Schema.Struct({ "city": Schema.optionalKey(Schema.String), "country": Schema.optionalKey(Schema.String), "region": Schema.optionalKey(Schema.String), - "timezone": Schema.optionalKey(Schema.String) -}).annotate({ "description": "User location information for web search" }) -export type OpenAIResponsesToolChoice = "auto" | "none" | "required" | { - readonly "type": "function" - readonly "name": string -} | { readonly "type": "web_search_preview_2025_03_11" | "web_search_preview" } -export const OpenAIResponsesToolChoice = Schema.Union([ - Schema.Literal("auto"), - Schema.Literal("none"), - Schema.Literal("required"), - Schema.Struct({ "type": Schema.Literal("function"), "name": Schema.String }), - Schema.Struct({ "type": Schema.Literals(["web_search_preview_2025_03_11", "web_search_preview"]) }) -]) -export type OpenAIResponsesPrompt = { readonly "id": string; readonly "variables"?: {} } -export const OpenAIResponsesPrompt = Schema.Struct({ - "id": Schema.String, - "variables": Schema.optionalKey(Schema.Struct({})) -}) -export type OpenAIResponsesReasoningEffort = "xhigh" | "high" | "medium" | "low" | "minimal" | "none" -export const OpenAIResponsesReasoningEffort = Schema.Literals(["xhigh", "high", "medium", "low", "minimal", "none"]) -export type ReasoningSummaryVerbosity = "auto" | "concise" | "detailed" -export const ReasoningSummaryVerbosity = Schema.Literals(["auto", "concise", "detailed"]) -export type OpenAIResponsesServiceTier = "auto" | "default" | "flex" | "priority" | "scale" -export const OpenAIResponsesServiceTier = Schema.Literals(["auto", "default", "flex", "priority", "scale"]) -export type OpenAIResponsesTruncation = "auto" | "disabled" -export const OpenAIResponsesTruncation = Schema.Literals(["auto", "disabled"]) -export type ResponsesFormatText = { readonly "type": "text" } -export const ResponsesFormatText = Schema.Struct({ "type": Schema.Literal("text") }).annotate({ - "description": "Plain text response format" -}) -export type ResponsesFormatJSONObject = { readonly "type": "json_object" } -export const ResponsesFormatJSONObject = Schema.Struct({ "type": Schema.Literal("json_object") }).annotate({ - "description": "JSON object response format" + "timezone": Schema.optionalKey(Schema.String), + "type": Schema.Literal("approximate") }) -export type ResponsesFormatTextJSONSchemaConfig = { - readonly "type": "json_schema" - readonly "name": string - readonly "description"?: string - readonly "strict"?: boolean - readonly "schema": {} +export type ApplyPatchCallOperationDiffDeltaEvent = { + readonly "delta": string + readonly "item_id": string + readonly "output_index": number + readonly "sequence_number": number + readonly "type": "response.apply_patch_call_operation_diff.delta" } -export const ResponsesFormatTextJSONSchemaConfig = Schema.Struct({ - "type": Schema.Literal("json_schema"), - "name": Schema.String, - "description": Schema.optionalKey(Schema.String), - "strict": Schema.optionalKey(Schema.Boolean), - "schema": Schema.Struct({}) -}).annotate({ "description": "JSON schema constrained response format" }) -export type OpenResponsesErrorEvent = { - readonly "type": "error" - readonly "code": string - readonly "message": string - readonly "param": string - readonly "sequence_number": number -} -export const OpenResponsesErrorEvent = Schema.Struct({ - "type": Schema.Literal("error"), - "code": Schema.String, - "message": Schema.String, - "param": Schema.String, - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Event emitted when an error occurs during streaming" }) -export type OpenResponsesTopLogprobs = { readonly "token"?: string; readonly "logprob"?: number } -export const OpenResponsesTopLogprobs = Schema.Struct({ - "token": Schema.optionalKey(Schema.String), - "logprob": Schema.optionalKey(Schema.Number.check(Schema.isFinite())) -}).annotate({ "description": "Alternative token with its log probability" }) -export type OpenResponsesRefusalDeltaEvent = { - readonly "type": "response.refusal.delta" - readonly "output_index": number - readonly "item_id": string - readonly "content_index": number - readonly "delta": string - readonly "sequence_number": number -} -export const OpenResponsesRefusalDeltaEvent = Schema.Struct({ - "type": Schema.Literal("response.refusal.delta"), - "output_index": Schema.Number.check(Schema.isFinite()), - "item_id": Schema.String, - "content_index": Schema.Number.check(Schema.isFinite()), - "delta": Schema.String, - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Event emitted when a refusal delta is streamed" }) -export type OpenResponsesRefusalDoneEvent = { - readonly "type": "response.refusal.done" - readonly "output_index": number - readonly "item_id": string - readonly "content_index": number - readonly "refusal": string - readonly "sequence_number": number -} -export const OpenResponsesRefusalDoneEvent = Schema.Struct({ - "type": Schema.Literal("response.refusal.done"), - "output_index": Schema.Number.check(Schema.isFinite()), - "item_id": Schema.String, - "content_index": Schema.Number.check(Schema.isFinite()), - "refusal": Schema.String, - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Event emitted when refusal streaming is complete" }) -export type OpenResponsesFunctionCallArgumentsDeltaEvent = { - readonly "type": "response.function_call_arguments.delta" - readonly "item_id": string - readonly "output_index": number - readonly "delta": string - readonly "sequence_number": number -} -export const OpenResponsesFunctionCallArgumentsDeltaEvent = Schema.Struct({ - "type": Schema.Literal("response.function_call_arguments.delta"), - "item_id": Schema.String, - "output_index": Schema.Number.check(Schema.isFinite()), - "delta": Schema.String, - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Event emitted when function call arguments are being streamed" }) -export type OpenResponsesFunctionCallArgumentsDoneEvent = { - readonly "type": "response.function_call_arguments.done" - readonly "item_id": string - readonly "output_index": number - readonly "name": string - readonly "arguments": string - readonly "sequence_number": number -} -export const OpenResponsesFunctionCallArgumentsDoneEvent = Schema.Struct({ - "type": Schema.Literal("response.function_call_arguments.done"), - "item_id": Schema.String, - "output_index": Schema.Number.check(Schema.isFinite()), - "name": Schema.String, - "arguments": Schema.String, - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Event emitted when function call arguments streaming is complete" }) -export type OpenResponsesReasoningDeltaEvent = { - readonly "type": "response.reasoning_text.delta" - readonly "output_index": number - readonly "item_id": string - readonly "content_index": number - readonly "delta": string - readonly "sequence_number": number -} -export const OpenResponsesReasoningDeltaEvent = Schema.Struct({ - "type": Schema.Literal("response.reasoning_text.delta"), - "output_index": Schema.Number.check(Schema.isFinite()), - "item_id": Schema.String, - "content_index": Schema.Number.check(Schema.isFinite()), +export const ApplyPatchCallOperationDiffDeltaEvent = Schema.Struct({ "delta": Schema.String, - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Event emitted when reasoning text delta is streamed" }) -export type OpenResponsesReasoningDoneEvent = { - readonly "type": "response.reasoning_text.done" - readonly "output_index": number - readonly "item_id": string - readonly "content_index": number - readonly "text": string - readonly "sequence_number": number -} -export const OpenResponsesReasoningDoneEvent = Schema.Struct({ - "type": Schema.Literal("response.reasoning_text.done"), - "output_index": Schema.Number.check(Schema.isFinite()), - "item_id": Schema.String, - "content_index": Schema.Number.check(Schema.isFinite()), - "text": Schema.String, - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Event emitted when reasoning text streaming is complete" }) -export type OpenResponsesReasoningSummaryTextDeltaEvent = { - readonly "type": "response.reasoning_summary_text.delta" - readonly "item_id": string - readonly "output_index": number - readonly "summary_index": number - readonly "delta": string - readonly "sequence_number": number -} -export const OpenResponsesReasoningSummaryTextDeltaEvent = Schema.Struct({ - "type": Schema.Literal("response.reasoning_summary_text.delta"), - "item_id": Schema.String, - "output_index": Schema.Number.check(Schema.isFinite()), - "summary_index": Schema.Number.check(Schema.isFinite()), - "delta": Schema.String, - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Event emitted when reasoning summary text delta is streamed" }) -export type OpenResponsesReasoningSummaryTextDoneEvent = { - readonly "type": "response.reasoning_summary_text.done" - readonly "item_id": string - readonly "output_index": number - readonly "summary_index": number - readonly "text": string - readonly "sequence_number": number -} -export const OpenResponsesReasoningSummaryTextDoneEvent = Schema.Struct({ - "type": Schema.Literal("response.reasoning_summary_text.done"), "item_id": Schema.String, - "output_index": Schema.Number.check(Schema.isFinite()), - "summary_index": Schema.Number.check(Schema.isFinite()), - "text": Schema.String, - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Event emitted when reasoning summary text streaming is complete" }) -export type OpenResponsesImageGenCallInProgress = { - readonly "type": "response.image_generation_call.in_progress" + "output_index": Schema.Number.check(Schema.isInt()), + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.apply_patch_call_operation_diff.delta") +}).annotate({ + "description": "Incremental chunk of `operation.diff` for an `apply_patch_call`. Matches OpenAI's streaming shape." +}) +export type ApplyPatchCallOperationDiffDoneEvent = { + readonly "diff": string readonly "item_id": string readonly "output_index": number readonly "sequence_number": number + readonly "type": "response.apply_patch_call_operation_diff.done" } -export const OpenResponsesImageGenCallInProgress = Schema.Struct({ - "type": Schema.Literal("response.image_generation_call.in_progress"), +export const ApplyPatchCallOperationDiffDoneEvent = Schema.Struct({ + "diff": Schema.String, "item_id": Schema.String, - "output_index": Schema.Number.check(Schema.isFinite()), - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Image generation call in progress" }) -export type OpenResponsesImageGenCallGenerating = { - readonly "type": "response.image_generation_call.generating" - readonly "item_id": string - readonly "output_index": number - readonly "sequence_number": number + "output_index": Schema.Number.check(Schema.isInt()), + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.apply_patch_call_operation_diff.done") +}).annotate({ "description": "Emitted when `operation.diff` streaming completes for an `apply_patch_call`." }) +export type ApplyPatchCallOutputItem = { + readonly "call_id": string + readonly "id"?: string + readonly "output"?: string + readonly "status": "completed" | "failed" + readonly "type": "apply_patch_call_output" } -export const OpenResponsesImageGenCallGenerating = Schema.Struct({ - "type": Schema.Literal("response.image_generation_call.generating"), - "item_id": Schema.String, - "output_index": Schema.Number.check(Schema.isFinite()), - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Image generation call is generating" }) -export type OpenResponsesImageGenCallPartialImage = { - readonly "type": "response.image_generation_call.partial_image" - readonly "item_id": string - readonly "output_index": number - readonly "sequence_number": number - readonly "partial_image_b64": string - readonly "partial_image_index": number +export const ApplyPatchCallOutputItem = Schema.Struct({ + "call_id": Schema.String, + "id": Schema.optionalKey(Schema.String), + "output": Schema.optionalKey(Schema.String), + "status": Schema.Literals(["completed", "failed"]), + "type": Schema.Literal("apply_patch_call_output") +}).annotate({ + "description": + "The client's echo of an `apply_patch_call` after applying the patch. `output` is an optional human-readable log; `status` is `completed` when the patch was applied successfully, `failed` otherwise." +}) +export type ApplyPatchCallStatus = "in_progress" | "completed" +export const ApplyPatchCallStatus = Schema.Literals(["in_progress", "completed"]).annotate({ + "description": "Lifecycle state of an `apply_patch_call` output item." +}) +export type ApplyPatchCreateFileOperation = { + readonly "diff": string + readonly "path": string + readonly "type": "create_file" } -export const OpenResponsesImageGenCallPartialImage = Schema.Struct({ - "type": Schema.Literal("response.image_generation_call.partial_image"), - "item_id": Schema.String, - "output_index": Schema.Number.check(Schema.isFinite()), - "sequence_number": Schema.Number.check(Schema.isFinite()), - "partial_image_b64": Schema.String, - "partial_image_index": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Image generation call with partial image" }) -export type OpenResponsesImageGenCallCompleted = { - readonly "type": "response.image_generation_call.completed" - readonly "item_id": string - readonly "output_index": number - readonly "sequence_number": number +export const ApplyPatchCreateFileOperation = Schema.Struct({ + "diff": Schema.String, + "path": Schema.String, + "type": Schema.Literal("create_file") +}).annotate({ + "description": + "The `create_file` variant of an `apply_patch_call.operation`. Carries a V4A diff describing the new file contents." +}) +export type ApplyPatchDeleteFileOperation = { readonly "path": string; readonly "type": "delete_file" } +export const ApplyPatchDeleteFileOperation = Schema.Struct({ + "path": Schema.String, + "type": Schema.Literal("delete_file") +}).annotate({ + "description": + "The `delete_file` variant of an `apply_patch_call.operation`. Identifies the file to remove; no diff is required." +}) +export type ApplyPatchEngineEnum = "auto" | "native" | "openrouter" +export const ApplyPatchEngineEnum = Schema.Literals(["auto", "native", "openrouter"]).annotate({ + "description": + "Which apply_patch engine to use. \"auto\" (default) uses native passthrough when the endpoint advertises native apply_patch support, otherwise falls back to OpenRouter's HITL validator. \"native\" forces native passthrough — when the endpoint does not support native, the request falls back to HITL. \"openrouter\" always runs the HITL validator. Native passthrough streams the diff incrementally via `apply_patch_call_operation_diff.delta` events; HITL buffers the diff for atomic delivery as a single delta." +}) +export type ApplyPatchServerTool = { readonly "type": "apply_patch" } +export const ApplyPatchServerTool = Schema.Struct({ "type": Schema.Literal("apply_patch") }).annotate({ + "description": "Apply patch tool configuration" +}) +export type ApplyPatchUpdateFileOperation = { + readonly "diff": string + readonly "path": string + readonly "type": "update_file" } -export const OpenResponsesImageGenCallCompleted = Schema.Struct({ - "type": Schema.Literal("response.image_generation_call.completed"), - "item_id": Schema.String, - "output_index": Schema.Number.check(Schema.isFinite()), - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Image generation call completed" }) -export type BadRequestResponseErrorData = { - readonly "code": number - readonly "message": string - readonly "metadata"?: {} +export const ApplyPatchUpdateFileOperation = Schema.Struct({ + "diff": Schema.String, + "path": Schema.String, + "type": Schema.Literal("update_file") +}).annotate({ + "description": + "The `update_file` variant of an `apply_patch_call.operation`. Carries a V4A diff describing edits to an existing file." +}) +export type AutoRouterPlugin = { + readonly "allowed_models"?: ReadonlyArray + readonly "enabled"?: boolean + readonly "id": "auto-router" } -export const BadRequestResponseErrorData = Schema.Struct({ - "code": Schema.Number.check(Schema.isInt()), - "message": Schema.String, - "metadata": Schema.optionalKey(Schema.Struct({})) -}).annotate({ "description": "Error data for BadRequestResponse" }) -export type UnauthorizedResponseErrorData = { +export const AutoRouterPlugin = Schema.Struct({ + "allowed_models": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "description": + "List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list." + }) + ), + "enabled": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": "Set to false to disable the auto-router plugin for this request. Defaults to true." + }) + ), + "id": Schema.Literal("auto-router") +}) +export type BadGatewayResponseErrorData = { readonly "code": number readonly "message": string readonly "metadata"?: {} } -export const UnauthorizedResponseErrorData = Schema.Struct({ +export const BadGatewayResponseErrorData = Schema.Struct({ "code": Schema.Number.check(Schema.isInt()), "message": Schema.String, "metadata": Schema.optionalKey(Schema.Struct({})) -}).annotate({ "description": "Error data for UnauthorizedResponse" }) -export type PaymentRequiredResponseErrorData = { +}).annotate({ "description": "Error data for BadGatewayResponse" }) +export type BadRequestResponseErrorData = { readonly "code": number readonly "message": string readonly "metadata"?: {} } -export const PaymentRequiredResponseErrorData = Schema.Struct({ +export const BadRequestResponseErrorData = Schema.Struct({ "code": Schema.Number.check(Schema.isInt()), "message": Schema.String, "metadata": Schema.optionalKey(Schema.Struct({})) -}).annotate({ "description": "Error data for PaymentRequiredResponse" }) -export type NotFoundResponseErrorData = { - readonly "code": number - readonly "message": string - readonly "metadata"?: {} +}).annotate({ "description": "Error data for BadRequestResponse" }) +export type BigNumberUnion = string +export const BigNumberUnion = Schema.String.annotate({ "description": "Price per million prompt tokens" }) +export type BulkAddWorkspaceMembersRequest = { readonly "user_ids": ReadonlyArray } +export const BulkAddWorkspaceMembersRequest = Schema.Struct({ + "user_ids": Schema.Array(Schema.String).annotate({ + "description": + "List of user IDs to add to the workspace. Members are assigned the same role they hold in the organization." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(100)) +}) +export type BulkAssignKeysRequest = { readonly "key_hashes": ReadonlyArray } +export const BulkAssignKeysRequest = Schema.Struct({ + "key_hashes": Schema.Array(Schema.String.check(Schema.isMinLength(1))).annotate({ + "description": "Array of API key hashes to assign to the guardrail" + }).check(Schema.isMinLength(1)) +}) +export type BulkAssignKeysResponse = { readonly "assigned_count": number } +export const BulkAssignKeysResponse = Schema.Struct({ + "assigned_count": Schema.Number.annotate({ "description": "Number of keys successfully assigned" }).check( + Schema.isInt() + ) +}) +export type BulkAssignMembersRequest = { readonly "member_user_ids": ReadonlyArray } +export const BulkAssignMembersRequest = Schema.Struct({ + "member_user_ids": Schema.Array(Schema.String.check(Schema.isMinLength(1))).annotate({ + "description": "Array of member user IDs to assign to the guardrail" + }).check(Schema.isMinLength(1)) +}) +export type BulkAssignMembersResponse = { readonly "assigned_count": number } +export const BulkAssignMembersResponse = Schema.Struct({ + "assigned_count": Schema.Number.annotate({ "description": "Number of members successfully assigned" }).check( + Schema.isInt() + ) +}) +export type BulkRemoveWorkspaceMembersRequest = { readonly "user_ids": ReadonlyArray } +export const BulkRemoveWorkspaceMembersRequest = Schema.Struct({ + "user_ids": Schema.Array(Schema.String).annotate({ "description": "List of user IDs to remove from the workspace" }) + .check(Schema.isMinLength(1)).check(Schema.isMaxLength(100)) +}) +export type BulkRemoveWorkspaceMembersResponse = { readonly "removed_count": number } +export const BulkRemoveWorkspaceMembersResponse = Schema.Struct({ + "removed_count": Schema.Number.annotate({ "description": "Number of members removed" }).check(Schema.isInt()) +}) +export type BulkUnassignKeysRequest = { readonly "key_hashes": ReadonlyArray } +export const BulkUnassignKeysRequest = Schema.Struct({ + "key_hashes": Schema.Array(Schema.String.check(Schema.isMinLength(1))).annotate({ + "description": "Array of API key hashes to unassign from the guardrail" + }).check(Schema.isMinLength(1)) +}) +export type BulkUnassignKeysResponse = { readonly "unassigned_count": number } +export const BulkUnassignKeysResponse = Schema.Struct({ + "unassigned_count": Schema.Number.annotate({ "description": "Number of keys successfully unassigned" }).check( + Schema.isInt() + ) +}) +export type BulkUnassignMembersRequest = { readonly "member_user_ids": ReadonlyArray } +export const BulkUnassignMembersRequest = Schema.Struct({ + "member_user_ids": Schema.Array(Schema.String.check(Schema.isMinLength(1))).annotate({ + "description": "Array of member user IDs to unassign from the guardrail" + }).check(Schema.isMinLength(1)) +}) +export type BulkUnassignMembersResponse = { readonly "unassigned_count": number } +export const BulkUnassignMembersResponse = Schema.Struct({ + "unassigned_count": Schema.Number.annotate({ "description": "Number of members successfully unassigned" }).check( + Schema.isInt() + ) +}) +export type BYOKProviderSlug = + | "ai21" + | "aion-labs" + | "akashml" + | "alibaba" + | "amazon-bedrock" + | "amazon-nova" + | "ambient" + | "anthropic" + | "arcee-ai" + | "atlas-cloud" + | "avian" + | "azure" + | "baidu" + | "baseten" + | "black-forest-labs" + | "byteplus" + | "cerebras" + | "chutes" + | "cirrascale" + | "clarifai" + | "cloudflare" + | "cohere" + | "crusoe" + | "deepinfra" + | "deepseek" + | "dekallm" + | "digitalocean" + | "featherless" + | "fireworks" + | "friendli" + | "gmicloud" + | "google-ai-studio" + | "google-vertex" + | "groq" + | "hyperbolic" + | "inception" + | "inceptron" + | "inference-net" + | "infermatic" + | "inflection" + | "io-net" + | "ionstream" + | "liquid" + | "mancer" + | "mara" + | "minimax" + | "mistral" + | "modelrun" + | "modular" + | "moonshotai" + | "morph" + | "ncompass" + | "nebius" + | "nex-agi" + | "nextbit" + | "novita" + | "nvidia" + | "open-inference" + | "openai" + | "parasail" + | "perceptron" + | "perplexity" + | "phala" + | "poolside" + | "recraft" + | "reka" + | "relace" + | "sambanova" + | "seed" + | "siliconflow" + | "sourceful" + | "stepfun" + | "streamlake" + | "switchpoint" + | "together" + | "upstage" + | "venice" + | "wandb" + | "xai" + | "xiaomi" + | "z-ai" +export const BYOKProviderSlug = Schema.Literals([ + "ai21", + "aion-labs", + "akashml", + "alibaba", + "amazon-bedrock", + "amazon-nova", + "ambient", + "anthropic", + "arcee-ai", + "atlas-cloud", + "avian", + "azure", + "baidu", + "baseten", + "black-forest-labs", + "byteplus", + "cerebras", + "chutes", + "cirrascale", + "clarifai", + "cloudflare", + "cohere", + "crusoe", + "deepinfra", + "deepseek", + "dekallm", + "digitalocean", + "featherless", + "fireworks", + "friendli", + "gmicloud", + "google-ai-studio", + "google-vertex", + "groq", + "hyperbolic", + "inception", + "inceptron", + "inference-net", + "infermatic", + "inflection", + "io-net", + "ionstream", + "liquid", + "mancer", + "mara", + "minimax", + "mistral", + "modelrun", + "modular", + "moonshotai", + "morph", + "ncompass", + "nebius", + "nex-agi", + "nextbit", + "novita", + "nvidia", + "open-inference", + "openai", + "parasail", + "perceptron", + "perplexity", + "phala", + "poolside", + "recraft", + "reka", + "relace", + "sambanova", + "seed", + "siliconflow", + "sourceful", + "stepfun", + "streamlake", + "switchpoint", + "together", + "upstage", + "venice", + "wandb", + "xai", + "xiaomi", + "z-ai" +]).annotate({ + "description": + "The upstream provider this credential authenticates against, as a lowercase slug (e.g. `openai`, `anthropic`, `amazon-bedrock`)." +}) +export type ChatAudioOutput = { + readonly "data"?: string + readonly "expires_at"?: number + readonly "id"?: string + readonly "transcript"?: string } -export const NotFoundResponseErrorData = Schema.Struct({ - "code": Schema.Number.check(Schema.isInt()), - "message": Schema.String, - "metadata": Schema.optionalKey(Schema.Struct({})) -}).annotate({ "description": "Error data for NotFoundResponse" }) -export type RequestTimeoutResponseErrorData = { - readonly "code": number - readonly "message": string - readonly "metadata"?: {} +export const ChatAudioOutput = Schema.Struct({ + "data": Schema.optionalKey(Schema.String.annotate({ "description": "Base64 encoded audio data" })), + "expires_at": Schema.optionalKey( + Schema.Number.annotate({ "description": "Audio expiration timestamp" }).check(Schema.isInt()) + ), + "id": Schema.optionalKey(Schema.String.annotate({ "description": "Audio output identifier" })), + "transcript": Schema.optionalKey(Schema.String.annotate({ "description": "Audio transcript" })) +}).annotate({ "description": "Audio output data or reference" }) +export type ChatContentAudio = { + readonly "input_audio": { readonly "data": string; readonly "format": string } + readonly "type": "input_audio" } -export const RequestTimeoutResponseErrorData = Schema.Struct({ - "code": Schema.Number.check(Schema.isInt()), - "message": Schema.String, - "metadata": Schema.optionalKey(Schema.Struct({})) -}).annotate({ "description": "Error data for RequestTimeoutResponse" }) -export type PayloadTooLargeResponseErrorData = { - readonly "code": number - readonly "message": string - readonly "metadata"?: {} +export const ChatContentAudio = Schema.Struct({ + "input_audio": Schema.Struct({ + "data": Schema.String.annotate({ "description": "Base64 encoded audio data" }), + "format": Schema.String.annotate({ + "description": + "Audio format (e.g., wav, mp3, flac, m4a, ogg, aiff, aac, pcm16, pcm24). Supported formats vary by provider." + }) + }), + "type": Schema.Literal("input_audio") +}).annotate({ "description": "Audio input content part. Supported audio formats vary by provider." }) +export type ChatContentFile = { + readonly "file": { readonly "file_data"?: string; readonly "file_id"?: string; readonly "filename"?: string } + readonly "type": "file" } -export const PayloadTooLargeResponseErrorData = Schema.Struct({ - "code": Schema.Number.check(Schema.isInt()), - "message": Schema.String, - "metadata": Schema.optionalKey(Schema.Struct({})) -}).annotate({ "description": "Error data for PayloadTooLargeResponse" }) -export type UnprocessableEntityResponseErrorData = { - readonly "code": number - readonly "message": string - readonly "metadata"?: {} +export const ChatContentFile = Schema.Struct({ + "file": Schema.Struct({ + "file_data": Schema.optionalKey( + Schema.String.annotate({ "description": "File content as base64 data URL or URL" }) + ), + "file_id": Schema.optionalKey(Schema.String.annotate({ "description": "File ID for previously uploaded files" })), + "filename": Schema.optionalKey(Schema.String.annotate({ "description": "Original filename" })) + }), + "type": Schema.Literal("file") +}).annotate({ "description": "File content part for document processing" }) +export type ChatContentImage = { + readonly "image_url": { readonly "detail"?: "auto" | "low" | "high"; readonly "url": string } + readonly "type": "image_url" } -export const UnprocessableEntityResponseErrorData = Schema.Struct({ - "code": Schema.Number.check(Schema.isInt()), - "message": Schema.String, - "metadata": Schema.optionalKey(Schema.Struct({})) -}).annotate({ "description": "Error data for UnprocessableEntityResponse" }) -export type TooManyRequestsResponseErrorData = { - readonly "code": number - readonly "message": string - readonly "metadata"?: {} +export const ChatContentImage = Schema.Struct({ + "image_url": Schema.Struct({ + "detail": Schema.optionalKey( + Schema.Literals(["auto", "low", "high"]).annotate({ "description": "Image detail level for vision models" }) + ), + "url": Schema.String.annotate({ "description": "URL of the image (data: URLs supported)" }) + }), + "type": Schema.Literal("image_url") +}).annotate({ "description": "Image content part for vision models" }) +export type ChatContentVideoInput = { readonly "url": string } +export const ChatContentVideoInput = Schema.Struct({ + "url": Schema.String.annotate({ "description": "URL of the video (data: URLs supported)" }) +}).annotate({ "description": "Video input object" }) +export type ChatDebugOptions = { readonly "echo_upstream_body"?: boolean } +export const ChatDebugOptions = Schema.Struct({ + "echo_upstream_body": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "If true, includes the transformed upstream request body in a debug chunk at the start of the stream. Only works with streaming mode." + }) + ) +}).annotate({ "description": "Debug options for inspecting request transformations (streaming only)" }) +export type ChatFinishReasonEnum = "tool_calls" | "stop" | "length" | "content_filter" | "error" | null +export const ChatFinishReasonEnum = Schema.Union([ + Schema.Literal("tool_calls"), + Schema.Literal("stop"), + Schema.Literal("length"), + Schema.Literal("content_filter"), + Schema.Literal("error"), + Schema.Null +]) +export type ChatFormatGrammarConfig = { readonly "grammar": string; readonly "type": "grammar" } +export const ChatFormatGrammarConfig = Schema.Struct({ + "grammar": Schema.String.annotate({ "description": "Custom grammar for text generation" }), + "type": Schema.Literal("grammar") +}).annotate({ "description": "Custom grammar response format" }) +export type ChatFormatPythonConfig = { readonly "type": "python" } +export const ChatFormatPythonConfig = Schema.Struct({ "type": Schema.Literal("python") }).annotate({ + "description": "Python code response format" +}) +export type ChatFormatTextConfig = { readonly "type": "text" } +export const ChatFormatTextConfig = Schema.Struct({ "type": Schema.Literal("text") }).annotate({ + "description": "Default text response format" +}) +export type ChatJsonSchemaConfig = { + readonly "description"?: string + readonly "name": string + readonly "schema"?: {} + readonly "strict"?: boolean } -export const TooManyRequestsResponseErrorData = Schema.Struct({ - "code": Schema.Number.check(Schema.isInt()), - "message": Schema.String, - "metadata": Schema.optionalKey(Schema.Struct({})) -}).annotate({ "description": "Error data for TooManyRequestsResponse" }) -export type InternalServerResponseErrorData = { - readonly "code": number - readonly "message": string - readonly "metadata"?: {} +export const ChatJsonSchemaConfig = Schema.Struct({ + "description": Schema.optionalKey(Schema.String.annotate({ "description": "Schema description for the model" })), + "name": Schema.String.annotate({ "description": "Schema name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars)" }) + .check(Schema.isMaxLength(64)), + "schema": Schema.optionalKey(Schema.Struct({}).annotate({ "description": "JSON Schema object" })), + "strict": Schema.optionalKey(Schema.Boolean.annotate({ "description": "Enable strict schema adherence" })) +}).annotate({ "description": "JSON Schema configuration object" }) +export type ChatModelNames = ReadonlyArray +export const ChatModelNames = Schema.Array( + Schema.String.annotate({ "description": "Available OpenRouter chat completion models" }) +).annotate({ "description": "Models to use for completion" }) +export type ChatNamedToolChoice = { readonly "function": { readonly "name": string }; readonly "type": "function" } +export const ChatNamedToolChoice = Schema.Struct({ + "function": Schema.Struct({ "name": Schema.String.annotate({ "description": "Function name to call" }) }), + "type": Schema.Literal("function") +}).annotate({ "description": "Named tool choice for specific function" }) +export type ChatReasoningSummaryVerbosityEnum = "auto" | "concise" | "detailed" | null +export const ChatReasoningSummaryVerbosityEnum = Schema.Union([ + Schema.Literal("auto"), + Schema.Literal("concise"), + Schema.Literal("detailed"), + Schema.Null +]) +export type ChatServerToolChoice = { readonly "type": string } +export const ChatServerToolChoice = Schema.Struct({ + "type": Schema.String.annotate({ + "description": + "OpenRouter server-tool type to force (e.g. `openrouter:web_search`, `web_search`, `web_search_preview`)." + }) +}).annotate({ + "description": + "OpenRouter extension: force a specific server tool by naming it directly in `tool_choice.type` instead of wrapping it in `{ type: \"function\", function: { name } }`." +}) +export type ChatStreamOptions = { readonly "include_usage"?: boolean } +export const ChatStreamOptions = Schema.Struct({ + "include_usage": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": "Deprecated: This field has no effect. Full usage details are always included." + }) + ) +}).annotate({ "description": "Streaming configuration options" }) +export type ChatStreamToolCall = { + readonly "function"?: { readonly "arguments"?: string; readonly "name"?: string | null } + readonly "id"?: string | null + readonly "index": number + readonly "type"?: "function" | null } -export const InternalServerResponseErrorData = Schema.Struct({ - "code": Schema.Number.check(Schema.isInt()), - "message": Schema.String, - "metadata": Schema.optionalKey(Schema.Struct({})) -}).annotate({ "description": "Error data for InternalServerResponse" }) -export type BadGatewayResponseErrorData = { - readonly "code": number - readonly "message": string - readonly "metadata"?: {} +export const ChatStreamToolCall = Schema.Struct({ + "function": Schema.optionalKey( + Schema.Struct({ + "arguments": Schema.optionalKey(Schema.String.annotate({ "description": "Function arguments as JSON string" })), + "name": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])) + }).annotate({ "description": "Function call details" }) + ), + "id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), + "index": Schema.Number.annotate({ "description": "Tool call index in the array" }).check(Schema.isInt()), + "type": Schema.optionalKey(Schema.Union([Schema.Literal("function"), Schema.Null])) +}).annotate({ "description": "Tool call delta for streaming responses" }) +export type ChatTokenLogprob = { + readonly "bytes": ReadonlyArray + readonly "logprob": number + readonly "token": string + readonly "top_logprobs": ReadonlyArray< + { readonly "bytes": ReadonlyArray; readonly "logprob": number; readonly "token": string } + > } -export const BadGatewayResponseErrorData = Schema.Struct({ - "code": Schema.Number.check(Schema.isInt()), - "message": Schema.String, - "metadata": Schema.optionalKey(Schema.Struct({})) -}).annotate({ "description": "Error data for BadGatewayResponse" }) -export type ServiceUnavailableResponseErrorData = { +export const ChatTokenLogprob = Schema.Struct({ + "bytes": Schema.Array(Schema.Number.check(Schema.isInt())).annotate({ "description": "UTF-8 bytes of the token" }), + "logprob": Schema.Number.annotate({ "description": "Log probability of the token", "format": "double" }).check( + Schema.isFinite() + ), + "token": Schema.String.annotate({ "description": "The token" }), + "top_logprobs": Schema.Array( + Schema.Struct({ + "bytes": Schema.Array(Schema.Number.check(Schema.isInt())), + "logprob": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "token": Schema.String + }) + ).annotate({ "description": "Top alternative tokens with probabilities" }) +}).annotate({ "description": "Token log probability information" }) +export type ChatToolCall = { + readonly "function": { readonly "arguments": string; readonly "name": string } + readonly "id": string + readonly "type": "function" +} +export const ChatToolCall = Schema.Struct({ + "function": Schema.Struct({ + "arguments": Schema.String.annotate({ "description": "Function arguments as JSON string" }), + "name": Schema.String.annotate({ "description": "Function name to call" }) + }), + "id": Schema.String.annotate({ "description": "Tool call identifier" }), + "type": Schema.Literal("function") +}).annotate({ "description": "Tool call made by the assistant" }) +export type CodeInterpreterServerTool = { + readonly "container": string | { + readonly "file_ids"?: ReadonlyArray + readonly "memory_limit"?: "1g" | "4g" | "16g" | "64g" | null + readonly "type": "auto" + } + readonly "type": "code_interpreter" +} +export const CodeInterpreterServerTool = Schema.Struct({ + "container": Schema.Union([ + Schema.String, + Schema.Struct({ + "file_ids": Schema.optionalKey(Schema.Array(Schema.String)), + "memory_limit": Schema.optionalKey( + Schema.Union([ + Schema.Literal("1g"), + Schema.Literal("4g"), + Schema.Literal("16g"), + Schema.Literal("64g"), + Schema.Null + ]) + ), + "type": Schema.Literal("auto") + }) + ]), + "type": Schema.Literal("code_interpreter") +}).annotate({ "description": "Code interpreter tool configuration" }) +export type CodexLocalShellTool = { readonly "type": "local_shell" } +export const CodexLocalShellTool = Schema.Struct({ "type": Schema.Literal("local_shell") }).annotate({ + "description": "Local shell tool configuration" +}) +export type CompactionItem = { + readonly "encrypted_content": string + readonly "id"?: string + readonly "type": "compaction" +} +export const CompactionItem = Schema.Struct({ + "encrypted_content": Schema.String, + "id": Schema.optionalKey(Schema.String), + "type": Schema.Literal("compaction") +}).annotate({ "description": "A context compaction marker with encrypted summary" }) +export type CompoundFilter = { readonly "filters": ReadonlyArray<{}>; readonly "type": "and" | "or" } +export const CompoundFilter = Schema.Struct({ + "filters": Schema.Array(Schema.Struct({})), + "type": Schema.Literals(["and", "or"]) +}).annotate({ "description": "A compound filter that combines multiple comparison or compound filters" }) +export type ComputerUseServerTool = { + readonly "display_height": number + readonly "display_width": number + readonly "environment": "windows" | "mac" | "linux" | "ubuntu" | "browser" + readonly "type": "computer_use_preview" +} +export const ComputerUseServerTool = Schema.Struct({ + "display_height": Schema.Number.check(Schema.isInt()), + "display_width": Schema.Number.check(Schema.isInt()), + "environment": Schema.Literals(["windows", "mac", "linux", "ubuntu", "browser"]), + "type": Schema.Literal("computer_use_preview") +}).annotate({ "description": "Computer use preview tool configuration" }) +export type ConflictResponseErrorData = { readonly "code": number readonly "message": string readonly "metadata"?: {} } -export const ServiceUnavailableResponseErrorData = Schema.Struct({ +export const ConflictResponseErrorData = Schema.Struct({ "code": Schema.Number.check(Schema.isInt()), "message": Schema.String, "metadata": Schema.optionalKey(Schema.Struct({})) -}).annotate({ "description": "Error data for ServiceUnavailableResponse" }) +}).annotate({ "description": "Error data for ConflictResponse" }) +export type ContentFilterAction = "redact" | "block" +export const ContentFilterAction = Schema.Literals(["redact", "block"]).annotate({ + "description": "Action taken when the pattern matches" +}) +export type ContentFilterBuiltinAction = "redact" | "block" | "flag" +export const ContentFilterBuiltinAction = Schema.Literals(["redact", "block", "flag"]).annotate({ + "description": "Action taken when the builtin filter triggers" +}) +export type ContentFilterBuiltinSlug = + | "email" + | "phone" + | "ssn" + | "credit-card" + | "ip-address" + | "person-name" + | "address" + | "regex-prompt-injection" +export const ContentFilterBuiltinSlug = Schema.Literals([ + "email", + "phone", + "ssn", + "credit-card", + "ip-address", + "person-name", + "address", + "regex-prompt-injection" +]).annotate({ "description": "The builtin filter identifier" }) +export type ContentPartImage = { readonly "image_url": { readonly "url": string }; readonly "type": "image_url" } +export const ContentPartImage = Schema.Struct({ + "image_url": Schema.Struct({ "url": Schema.String }), + "type": Schema.Literal("image_url") +}) +export type ContextCompressionEngine = "middle-out" +export const ContextCompressionEngine = Schema.Literal("middle-out").annotate({ + "description": "The compression engine to use. Defaults to \"middle-out\"." +}) +export type CostDetails = { + readonly "upstream_inference_completions_cost": number + readonly "upstream_inference_cost"?: number + readonly "upstream_inference_prompt_cost": number +} +export const CostDetails = Schema.Struct({ + "upstream_inference_completions_cost": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "upstream_inference_cost": Schema.optionalKey( + Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()) + ), + "upstream_inference_prompt_cost": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()) +}).annotate({ "description": "Breakdown of upstream inference costs" }) +export type CreateWorkspaceRequest = { + readonly "default_image_model"?: string + readonly "default_provider_sort"?: string + readonly "default_text_model"?: string + readonly "description"?: string + readonly "io_logging_api_key_ids"?: ReadonlyArray + readonly "io_logging_sampling_rate"?: number + readonly "is_data_discount_logging_enabled"?: boolean + readonly "is_observability_broadcast_enabled"?: boolean + readonly "is_observability_io_logging_enabled"?: boolean + readonly "name": string + readonly "slug": string +} +export const CreateWorkspaceRequest = Schema.Struct({ + "default_image_model": Schema.optionalKey( + Schema.String.annotate({ "description": "Default image model for this workspace" }) + ), + "default_provider_sort": Schema.optionalKey( + Schema.String.annotate({ "description": "Default provider sort preference (price, throughput, latency, exacto)" }) + ), + "default_text_model": Schema.optionalKey( + Schema.String.annotate({ "description": "Default text model for this workspace" }) + ), + "description": Schema.optionalKey( + Schema.String.annotate({ "description": "Description of the workspace" }).check(Schema.isMaxLength(500)) + ), + "io_logging_api_key_ids": Schema.optionalKey( + Schema.Array(Schema.Number.check(Schema.isInt())).annotate({ + "description": "Optional array of API key IDs to filter I/O logging" + }) + ), + "io_logging_sampling_rate": Schema.optionalKey( + Schema.Number.annotate({ "description": "Sampling rate for I/O logging (0.0001-1)", "format": "double" }).check( + Schema.isFinite() + ) + ), + "is_data_discount_logging_enabled": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether data discount logging is enabled" }) + ), + "is_observability_broadcast_enabled": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether broadcast is enabled" }) + ), + "is_observability_io_logging_enabled": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether private logging is enabled" }) + ), + "name": Schema.String.annotate({ "description": "Name for the new workspace" }).check(Schema.isMinLength(1)).check( + Schema.isMaxLength(100) + ), + "slug": Schema.String.annotate({ + "description": + "URL-friendly slug (lowercase alphanumeric segments separated by single hyphens, no leading/trailing hyphens)" + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(50)).check( + Schema.isPattern(new RegExp("^[a-z0-9]+(?:-[a-z0-9]+)*$")) + ) +}) +export type CreateWorkspaceResponse = { + readonly "data": { + readonly "created_at": string + readonly "created_by": string + readonly "default_image_model": string + readonly "default_provider_sort": string + readonly "default_text_model": string + readonly "description": string + readonly "id": string + readonly "io_logging_api_key_ids": ReadonlyArray + readonly "io_logging_sampling_rate": number + readonly "is_data_discount_logging_enabled": boolean + readonly "is_observability_broadcast_enabled": boolean + readonly "is_observability_io_logging_enabled": boolean + readonly "name": string + readonly "slug": string + readonly "updated_at": string + } +} +export const CreateWorkspaceResponse = Schema.Struct({ + "data": Schema.Struct({ + "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the workspace was created" }), + "created_by": Schema.String.annotate({ "description": "User ID of the workspace creator" }), + "default_image_model": Schema.String.annotate({ "description": "Default image model for this workspace" }), + "default_provider_sort": Schema.String.annotate({ + "description": "Default provider sort preference (price, throughput, latency, exacto)" + }), + "default_text_model": Schema.String.annotate({ "description": "Default text model for this workspace" }), + "description": Schema.String.annotate({ "description": "Description of the workspace" }), + "id": Schema.String.annotate({ "description": "Unique identifier for the workspace", "format": "uuid" }), + "io_logging_api_key_ids": Schema.Array(Schema.Number.check(Schema.isInt())).annotate({ + "description": "Optional array of API key IDs to filter I/O logging. Null means all keys are logged." + }), + "io_logging_sampling_rate": Schema.Number.annotate({ + "description": "Sampling rate for I/O logging (0.0001-1). 1 means 100% of requests are logged.", + "format": "double" + }).check(Schema.isFinite()), + "is_data_discount_logging_enabled": Schema.Boolean.annotate({ + "description": "Whether data discount logging is enabled for this workspace" + }), + "is_observability_broadcast_enabled": Schema.Boolean.annotate({ + "description": "Whether broadcast is enabled for this workspace" + }), + "is_observability_io_logging_enabled": Schema.Boolean.annotate({ + "description": "Whether private logging is enabled for this workspace" + }), + "name": Schema.String.annotate({ "description": "Name of the workspace" }), + "slug": Schema.String.annotate({ "description": "URL-friendly slug for the workspace" }), + "updated_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the workspace was last updated" }) + }).annotate({ "description": "The created workspace" }) +}) +export type CustomTool = { + readonly "description"?: string + readonly "format"?: { readonly "type": "text" } | { + readonly "definition": string + readonly "syntax": "lark" | "regex" + readonly "type": "grammar" + } + readonly "name": string + readonly "type": "custom" +} +export const CustomTool = Schema.Struct({ + "description": Schema.optionalKey(Schema.String), + "format": Schema.optionalKey( + Schema.Union([ + Schema.Struct({ "type": Schema.Literal("text") }), + Schema.Struct({ + "definition": Schema.String, + "syntax": Schema.Literals(["lark", "regex"]), + "type": Schema.Literal("grammar") + }) + ]) + ), + "name": Schema.String, + "type": Schema.Literal("custom") +}).annotate({ "description": "Custom tool configuration" }) +export type CustomToolCallInputDeltaEvent = { + readonly "delta": string + readonly "item_id": string + readonly "output_index": number + readonly "sequence_number": number + readonly "type": "response.custom_tool_call_input.delta" +} +export const CustomToolCallInputDeltaEvent = Schema.Struct({ + "delta": Schema.String, + "item_id": Schema.String, + "output_index": Schema.Number.check(Schema.isInt()), + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.custom_tool_call_input.delta") +}).annotate({ + "description": + "Event emitted when a custom tool call's freeform input is being streamed. Mirrors `response.function_call_arguments.delta` but for `custom` tools whose input is opaque text rather than JSON arguments." +}) +export type CustomToolCallInputDoneEvent = { + readonly "input": string + readonly "item_id": string + readonly "output_index": number + readonly "sequence_number": number + readonly "type": "response.custom_tool_call_input.done" +} +export const CustomToolCallInputDoneEvent = Schema.Struct({ + "input": Schema.String, + "item_id": Schema.String, + "output_index": Schema.Number.check(Schema.isInt()), + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.custom_tool_call_input.done") +}).annotate({ + "description": + "Event emitted when a custom tool call's freeform input streaming is complete. Mirrors `response.function_call_arguments.done` but for `custom` tools." +}) +export type CustomToolCallItem = { + readonly "call_id": string + readonly "id"?: string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + readonly "type": "custom_tool_call" +} +export const CustomToolCallItem = Schema.Struct({ + "call_id": Schema.String, + "id": Schema.optionalKey(Schema.String), + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ), + "type": Schema.Literal("custom_tool_call") +}).annotate({ + "description": + "A call to a custom (freeform-grammar) tool created by the model — distinct from `function_call`. Used for tools like Codex CLI's `apply_patch` whose payload is opaque text rather than JSON arguments." +}) +export type CustomToolCallOutputItem = { + readonly "call_id": string + readonly "id"?: string + readonly "output": + | string + | ReadonlyArray< + { readonly "text": string; readonly "type": "input_text" } | { + readonly "detail": "auto" | "high" | "low" | "original" + readonly "image_url"?: string + readonly "type": never + readonly "text": string + } | { + readonly "file_data"?: string + readonly "file_id"?: string + readonly "file_url"?: string + readonly "filename"?: string + readonly "type": never + readonly "text": string + } | { + readonly "text": string + readonly "type": never + readonly "detail": "auto" | "high" | "low" | "original" + readonly "image_url"?: string + } | { + readonly "detail": "auto" | "high" | "low" | "original" + readonly "image_url"?: string + readonly "type": "input_image" + } | { + readonly "file_data"?: string + readonly "file_id"?: string + readonly "file_url"?: string + readonly "filename"?: string + readonly "type": never + readonly "detail": "auto" | "high" | "low" | "original" + readonly "image_url"?: string + } | { + readonly "text": string + readonly "type": never + readonly "file_data"?: string + readonly "file_id"?: string + readonly "file_url"?: string + readonly "filename"?: string + } | { + readonly "detail": "auto" | "high" | "low" | "original" + readonly "image_url"?: string + readonly "type": never + readonly "file_data"?: string + readonly "file_id"?: string + readonly "file_url"?: string + readonly "filename"?: string + } | { + readonly "file_data"?: string + readonly "file_id"?: string + readonly "file_url"?: string + readonly "filename"?: string + readonly "type": "input_file" + } + > + readonly "type": "custom_tool_call_output" +} +export const CustomToolCallOutputItem = Schema.Struct({ + "call_id": Schema.String, + "id": Schema.optionalKey(Schema.String), + "output": Schema.Union([ + Schema.Union([Schema.String]), + Schema.Union([ + Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ "text": Schema.String, "type": Schema.Literal("input_text") }).annotate({ + "description": "Text input content item" + }), + Schema.Struct({ + "detail": Schema.Literals(["auto", "high", "low", "original"]), + "image_url": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "text": Schema.String + }).annotate({ "description": "Text input content item" }), + Schema.Struct({ + "file_data": Schema.optionalKey(Schema.String), + "file_id": Schema.optionalKey(Schema.String), + "file_url": Schema.optionalKey(Schema.String), + "filename": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "text": Schema.String + }).annotate({ "description": "Text input content item" }) + ], { mode: "oneOf" }), + Schema.Union([ + Schema.Struct({ + "text": Schema.String, + "type": Schema.Never, + "detail": Schema.Literals(["auto", "high", "low", "original"]), + "image_url": Schema.optionalKey(Schema.String) + }).annotate({ "description": "Image input content item" }), + Schema.Struct({ + "detail": Schema.Union([ + Schema.Literal("auto"), + Schema.Literal("high"), + Schema.Literal("low"), + Schema.Literal("original") + ]), + "image_url": Schema.optionalKey(Schema.String), + "type": Schema.Literal("input_image") + }).annotate({ "description": "Image input content item" }), + Schema.Struct({ + "file_data": Schema.optionalKey(Schema.String), + "file_id": Schema.optionalKey(Schema.String), + "file_url": Schema.optionalKey(Schema.String), + "filename": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "detail": Schema.Literals(["auto", "high", "low", "original"]), + "image_url": Schema.optionalKey(Schema.String) + }).annotate({ "description": "Image input content item" }) + ], { mode: "oneOf" }), + Schema.Union([ + Schema.Struct({ + "text": Schema.String, + "type": Schema.Never, + "file_data": Schema.optionalKey(Schema.String), + "file_id": Schema.optionalKey(Schema.String), + "file_url": Schema.optionalKey(Schema.String), + "filename": Schema.optionalKey(Schema.String) + }).annotate({ "description": "File input content item" }), + Schema.Struct({ + "detail": Schema.Literals(["auto", "high", "low", "original"]), + "image_url": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "file_data": Schema.optionalKey(Schema.String), + "file_id": Schema.optionalKey(Schema.String), + "file_url": Schema.optionalKey(Schema.String), + "filename": Schema.optionalKey(Schema.String) + }).annotate({ "description": "File input content item" }), + Schema.Struct({ + "file_data": Schema.optionalKey(Schema.String), + "file_id": Schema.optionalKey(Schema.String), + "file_url": Schema.optionalKey(Schema.String), + "filename": Schema.optionalKey(Schema.String), + "type": Schema.Literal("input_file") + }).annotate({ "description": "File input content item" }) + ], { mode: "oneOf" }) + ], { mode: "oneOf" }) + ) + ]) + ]), + "type": Schema.Literal("custom_tool_call_output") +}).annotate({ + "description": + "The output from a custom (freeform-grammar) tool call execution. Mirrors `function_call_output` but is matched to a `custom_tool_call` rather than a `function_call`." +}) +export type DatetimeServerToolConfig = { readonly "timezone"?: string } +export const DatetimeServerToolConfig = Schema.Struct({ + "timezone": Schema.optionalKey( + Schema.String.annotate({ "description": "IANA timezone name (e.g. \"America/New_York\"). Defaults to UTC." }) + ) +}).annotate({ "description": "Configuration for the openrouter:datetime server tool" }) +export type DefaultParameters = { + readonly "frequency_penalty"?: number + readonly "presence_penalty"?: number + readonly "repetition_penalty"?: number + readonly "temperature"?: number + readonly "top_k"?: number + readonly "top_p"?: number +} +export const DefaultParameters = Schema.Struct({ + "frequency_penalty": Schema.optionalKey(Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite())), + "presence_penalty": Schema.optionalKey(Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite())), + "repetition_penalty": Schema.optionalKey(Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite())), + "temperature": Schema.optionalKey(Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite())), + "top_k": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "top_p": Schema.optionalKey(Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite())) +}).annotate({ "description": "Default parameters for this model" }) +export type DeleteBYOKKeyResponse = { readonly "deleted": true } +export const DeleteBYOKKeyResponse = Schema.Struct({ + "deleted": Schema.Literal(true).annotate({ "description": "Confirmation that the BYOK credential was deleted." }) +}) +export type DeleteGuardrailResponse = { readonly "deleted": true } +export const DeleteGuardrailResponse = Schema.Struct({ + "deleted": Schema.Literal(true).annotate({ "description": "Confirmation that the guardrail was deleted" }) +}) +export type DeleteObservabilityDestinationResponse = { readonly "deleted": true } +export const DeleteObservabilityDestinationResponse = Schema.Struct({ + "deleted": Schema.Literal(true).annotate({ "description": "Always `true` on success." }) +}) +export type DeleteWorkspaceResponse = { readonly "deleted": true } +export const DeleteWorkspaceResponse = Schema.Struct({ + "deleted": Schema.Literal(true).annotate({ "description": "Confirmation that the workspace was deleted" }) +}) +export type DeprecatedRoute = "fallback" | "sort" | null +export const DeprecatedRoute = Schema.Union([Schema.Literal("fallback"), Schema.Literal("sort"), Schema.Null]).annotate( + { + "description": + "**DEPRECATED** Use providers.sort.partition instead. Backwards-compatible alias for providers.sort.partition. Accepts legacy values: \"fallback\" (maps to \"model\"), \"sort\" (maps to \"none\")." + } +) export type EdgeNetworkTimeoutResponseErrorData = { readonly "code": number readonly "message": string @@ -605,1790 +1600,867 @@ export const EdgeNetworkTimeoutResponseErrorData = Schema.Struct({ "message": Schema.String, "metadata": Schema.optionalKey(Schema.Struct({})) }).annotate({ "description": "Error data for EdgeNetworkTimeoutResponse" }) -export type ProviderOverloadedResponseErrorData = { - readonly "code": number +export type EndpointInfo = { readonly "model": string; readonly "provider": string; readonly "selected": boolean } +export const EndpointInfo = Schema.Struct({ + "model": Schema.String, + "provider": Schema.String, + "selected": Schema.Boolean +}) +export type EndpointStatus = 0 | -1 | -2 | -3 | -5 | -10 +export const EndpointStatus = Schema.Literals([0, -1, -2, -3, -5, -10]) +export type ErrorEvent = { + readonly "code": string readonly "message": string - readonly "metadata"?: {} -} -export const ProviderOverloadedResponseErrorData = Schema.Struct({ + readonly "param": string + readonly "sequence_number": number + readonly "type": "error" +} +export const ErrorEvent = Schema.Struct({ + "code": Schema.String, + "message": Schema.String, + "param": Schema.String, + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("error") +}).annotate({ "description": "Event emitted when an error occurs during streaming" }) +export type FileCitation = { + readonly "file_id": string + readonly "filename": string + readonly "index": number + readonly "type": "file_citation" +} +export const FileCitation = Schema.Struct({ + "file_id": Schema.String, + "filename": Schema.String, + "index": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("file_citation") +}) +export type FilePath = { readonly "file_id": string; readonly "index": number; readonly "type": "file_path" } +export const FilePath = Schema.Struct({ + "file_id": Schema.String, + "index": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("file_path") +}) +export type ForbiddenResponseErrorData = { + readonly "code": number + readonly "message": string + readonly "metadata"?: {} +} +export const ForbiddenResponseErrorData = Schema.Struct({ "code": Schema.Number.check(Schema.isInt()), "message": Schema.String, "metadata": Schema.optionalKey(Schema.Struct({})) -}).annotate({ "description": "Error data for ProviderOverloadedResponse" }) -export type ResponseInputVideo = { readonly "type": "input_video"; readonly "video_url": string } -export const ResponseInputVideo = Schema.Struct({ - "type": Schema.Literal("input_video"), - "video_url": Schema.String.annotate({ - "description": "A base64 data URL or remote URL that resolves to a video file" - }) -}).annotate({ "description": "Video input content item" }) -export type ResponsesOutputModality = "text" | "image" -export const ResponsesOutputModality = Schema.Literals(["text", "image"]) -export type OpenAIResponsesIncludable = - | "file_search_call.results" - | "message.input_image.image_url" - | "computer_call_output.output.image_url" - | "reasoning.encrypted_content" - | "code_interpreter_call.outputs" -export const OpenAIResponsesIncludable = Schema.Literals([ - "file_search_call.results", - "message.input_image.image_url", - "computer_call_output.output.image_url", - "reasoning.encrypted_content", - "code_interpreter_call.outputs" -]) -export type DataCollection = "deny" | "allow" -export const DataCollection = Schema.Literals(["deny", "allow"]).annotate({ - "description": - "Data collection setting. If no available model provider meets the requirement, your request will return an error.\n- allow: (default) allow providers which store user data non-transiently and may train on it\n\n- deny: use only providers which do not collect user data." +}).annotate({ "description": "Error data for ForbiddenResponse" }) +export type FormatJsonObjectConfig = { readonly "type": "json_object" } +export const FormatJsonObjectConfig = Schema.Struct({ "type": Schema.Literal("json_object") }).annotate({ + "description": "JSON object response format" }) -export type ProviderName = - | "AI21" - | "AionLabs" - | "Alibaba" - | "Ambient" - | "Amazon Bedrock" - | "Amazon Nova" - | "Anthropic" - | "Arcee AI" - | "AtlasCloud" - | "Avian" - | "Azure" - | "BaseTen" - | "BytePlus" - | "Black Forest Labs" - | "Cerebras" - | "Chutes" - | "Cirrascale" - | "Clarifai" - | "Cloudflare" - | "Cohere" - | "Crusoe" - | "DeepInfra" - | "DeepSeek" - | "Featherless" - | "Fireworks" - | "Friendli" - | "GMICloud" - | "Google" - | "Google AI Studio" - | "Groq" - | "Hyperbolic" - | "Inception" - | "Inceptron" - | "InferenceNet" - | "Infermatic" - | "Io Net" - | "Inflection" - | "Liquid" - | "Mara" - | "Mancer 2" - | "Minimax" - | "ModelRun" - | "Mistral" - | "Modular" - | "Moonshot AI" - | "Morph" - | "NCompass" - | "Nebius" - | "NextBit" - | "Novita" - | "Nvidia" - | "OpenAI" - | "OpenInference" - | "Parasail" - | "Perplexity" - | "Phala" - | "Relace" - | "SambaNova" - | "Seed" - | "SiliconFlow" - | "Sourceful" - | "StepFun" - | "Stealth" - | "StreamLake" - | "Switchpoint" - | "Together" - | "Upstage" - | "Venice" - | "WandB" - | "Xiaomi" - | "xAI" - | "Z.AI" - | "FakeProvider" -export const ProviderName = Schema.Literals([ - "AI21", - "AionLabs", - "Alibaba", - "Ambient", - "Amazon Bedrock", - "Amazon Nova", - "Anthropic", - "Arcee AI", - "AtlasCloud", - "Avian", - "Azure", - "BaseTen", - "BytePlus", - "Black Forest Labs", - "Cerebras", - "Chutes", - "Cirrascale", - "Clarifai", - "Cloudflare", - "Cohere", - "Crusoe", - "DeepInfra", - "DeepSeek", - "Featherless", - "Fireworks", - "Friendli", - "GMICloud", - "Google", - "Google AI Studio", - "Groq", - "Hyperbolic", - "Inception", - "Inceptron", - "InferenceNet", - "Infermatic", - "Io Net", - "Inflection", - "Liquid", - "Mara", - "Mancer 2", - "Minimax", - "ModelRun", - "Mistral", - "Modular", - "Moonshot AI", - "Morph", - "NCompass", - "Nebius", - "NextBit", - "Novita", - "Nvidia", - "OpenAI", - "OpenInference", - "Parasail", - "Perplexity", - "Phala", - "Relace", - "SambaNova", - "Seed", - "SiliconFlow", - "Sourceful", - "StepFun", - "Stealth", - "StreamLake", - "Switchpoint", - "Together", - "Upstage", - "Venice", - "WandB", - "Xiaomi", - "xAI", - "Z.AI", - "FakeProvider" -]) -export type Quantization = "int4" | "int8" | "fp4" | "fp6" | "fp8" | "fp16" | "bf16" | "fp32" | "unknown" -export const Quantization = Schema.Literals(["int4", "int8", "fp4", "fp6", "fp8", "fp16", "bf16", "fp32", "unknown"]) -export type ProviderSort = "price" | "throughput" | "latency" -export const ProviderSort = Schema.Literals(["price", "throughput", "latency"]) -export type BigNumberUnion = string -export const BigNumberUnion = Schema.String.annotate({ "description": "Price per million prompt tokens" }) -export type PercentileThroughputCutoffs = { - readonly "p50"?: number - readonly "p75"?: number - readonly "p90"?: number - readonly "p99"?: number +export type FormatJsonSchemaConfig = { + readonly "description"?: string + readonly "name": string + readonly "schema": {} + readonly "strict"?: boolean + readonly "type": "json_schema" } -export const PercentileThroughputCutoffs = Schema.Struct({ - "p50": Schema.optionalKey( - Schema.Number.annotate({ "description": "Minimum p50 throughput (tokens/sec)" }).check(Schema.isFinite()) - ), - "p75": Schema.optionalKey( - Schema.Number.annotate({ "description": "Minimum p75 throughput (tokens/sec)" }).check(Schema.isFinite()) - ), - "p90": Schema.optionalKey( - Schema.Number.annotate({ "description": "Minimum p90 throughput (tokens/sec)" }).check(Schema.isFinite()) - ), - "p99": Schema.optionalKey( - Schema.Number.annotate({ "description": "Minimum p99 throughput (tokens/sec)" }).check(Schema.isFinite()) - ) -}).annotate({ - "description": - "Percentile-based throughput cutoffs. All specified cutoffs must be met for an endpoint to be preferred." +export const FormatJsonSchemaConfig = Schema.Struct({ + "description": Schema.optionalKey(Schema.String), + "name": Schema.String, + "schema": Schema.Struct({}), + "strict": Schema.optionalKey(Schema.Boolean), + "type": Schema.Literal("json_schema") +}).annotate({ "description": "JSON schema constrained response format" }) +export type FormatTextConfig = { readonly "type": "text" } +export const FormatTextConfig = Schema.Struct({ "type": Schema.Literal("text") }).annotate({ + "description": "Plain text response format" }) -export type PercentileLatencyCutoffs = { - readonly "p50"?: number - readonly "p75"?: number - readonly "p90"?: number - readonly "p99"?: number +export type FrameImage = { + readonly "image_url": { readonly "url": string } + readonly "type": "image_url" + readonly "frame_type": "first_frame" | "last_frame" } -export const PercentileLatencyCutoffs = Schema.Struct({ - "p50": Schema.optionalKey( - Schema.Number.annotate({ "description": "Maximum p50 latency (seconds)" }).check(Schema.isFinite()) - ), - "p75": Schema.optionalKey( - Schema.Number.annotate({ "description": "Maximum p75 latency (seconds)" }).check(Schema.isFinite()) - ), - "p90": Schema.optionalKey( - Schema.Number.annotate({ "description": "Maximum p90 latency (seconds)" }).check(Schema.isFinite()) - ), - "p99": Schema.optionalKey( - Schema.Number.annotate({ "description": "Maximum p99 latency (seconds)" }).check(Schema.isFinite()) - ) -}).annotate({ - "description": "Percentile-based latency cutoffs. All specified cutoffs must be met for an endpoint to be preferred." -}) -export type WebSearchEngine = "native" | "exa" -export const WebSearchEngine = Schema.Literals(["native", "exa"]).annotate({ - "description": "The search engine to use for web search." -}) -export type PDFParserEngine = "mistral-ocr" | "pdf-text" | "native" -export const PDFParserEngine = Schema.Literals(["mistral-ocr", "pdf-text", "native"]).annotate({ - "description": "The engine to use for parsing PDF files." +export const FrameImage = Schema.Struct({ + "image_url": Schema.Struct({ "url": Schema.String }), + "type": Schema.Literal("image_url"), + "frame_type": Schema.Literals(["first_frame", "last_frame"]).annotate({ + "description": "Whether this image represents the first or last frame of the video" + }) }) -export type AnthropicMessagesResponse = { - readonly "id": string - readonly "type": "message" - readonly "role": "assistant" - readonly "content": ReadonlyArray< - | { - readonly "type": "text" - readonly "text": string - readonly "citations": ReadonlyArray< - { - readonly "type": "char_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_char_index": number - readonly "end_char_index": number - readonly "file_id": string - } | { - readonly "type": "page_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_page_number": number - readonly "end_page_number": number - readonly "file_id": string - } | { - readonly "type": "content_block_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_block_index": number - readonly "end_block_index": number - readonly "file_id": string - } | { - readonly "type": "web_search_result_location" - readonly "cited_text": string - readonly "encrypted_index": string - readonly "title": string - readonly "url": string - } | { - readonly "type": "search_result_location" - readonly "cited_text": string - readonly "search_result_index": number - readonly "source": string - readonly "title": string - readonly "start_block_index": number - readonly "end_block_index": number - } - > - } - | { readonly "type": "tool_use"; readonly "id": string; readonly "name": string; readonly "input"?: unknown } - | { readonly "type": "thinking"; readonly "thinking": string; readonly "signature": string } - | { readonly "type": "redacted_thinking"; readonly "data": string } - | { - readonly "type": "server_tool_use" - readonly "id": string - readonly "name": "web_search" - readonly "input"?: unknown - } - | { - readonly "type": "web_search_tool_result" - readonly "tool_use_id": string - readonly "content": - | ReadonlyArray< - { - readonly "type": "web_search_result" - readonly "encrypted_content": string - readonly "page_age": string - readonly "title": string - readonly "url": string - } - > - | { - readonly "type": "web_search_tool_result_error" - readonly "error_code": - | "invalid_tool_input" - | "unavailable" - | "max_uses_exceeded" - | "too_many_requests" - | "query_too_long" - } - } - > - readonly "model": string - readonly "stop_reason": "end_turn" | "max_tokens" | "stop_sequence" | "tool_use" | "pause_turn" | "refusal" - readonly "stop_sequence": string - readonly "usage": { - readonly "input_tokens": number - readonly "output_tokens": number - readonly "cache_creation_input_tokens": number - readonly "cache_read_input_tokens": number - readonly "cache_creation": { - readonly "ephemeral_5m_input_tokens": number - readonly "ephemeral_1h_input_tokens": number - } - readonly "inference_geo": string - readonly "server_tool_use": { readonly "web_search_requests": number } - readonly "service_tier": "standard" | "priority" | "batch" - } +export type FunctionCallArgsDeltaEvent = { + readonly "delta": string + readonly "item_id": string + readonly "output_index": number + readonly "sequence_number": number + readonly "type": "response.function_call_arguments.delta" } -export const AnthropicMessagesResponse = Schema.Struct({ - "id": Schema.String, - "type": Schema.Literal("message"), - "role": Schema.Literal("assistant"), - "content": Schema.Array(Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("text"), - "text": Schema.String, - "citations": Schema.Array(Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("char_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_char_index": Schema.Number.check(Schema.isFinite()), - "end_char_index": Schema.Number.check(Schema.isFinite()), - "file_id": Schema.String - }), - Schema.Struct({ - "type": Schema.Literal("page_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_page_number": Schema.Number.check(Schema.isFinite()), - "end_page_number": Schema.Number.check(Schema.isFinite()), - "file_id": Schema.String - }), - Schema.Struct({ - "type": Schema.Literal("content_block_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_block_index": Schema.Number.check(Schema.isFinite()), - "end_block_index": Schema.Number.check(Schema.isFinite()), - "file_id": Schema.String - }), - Schema.Struct({ - "type": Schema.Literal("web_search_result_location"), - "cited_text": Schema.String, - "encrypted_index": Schema.String, - "title": Schema.String, - "url": Schema.String - }), - Schema.Struct({ - "type": Schema.Literal("search_result_location"), - "cited_text": Schema.String, - "search_result_index": Schema.Number.check(Schema.isFinite()), - "source": Schema.String, - "title": Schema.String, - "start_block_index": Schema.Number.check(Schema.isFinite()), - "end_block_index": Schema.Number.check(Schema.isFinite()) - }) - ], { mode: "oneOf" })) - }), - Schema.Struct({ - "type": Schema.Literal("tool_use"), - "id": Schema.String, - "name": Schema.String, - "input": Schema.optionalKey(Schema.Unknown) - }), - Schema.Struct({ "type": Schema.Literal("thinking"), "thinking": Schema.String, "signature": Schema.String }), - Schema.Struct({ "type": Schema.Literal("redacted_thinking"), "data": Schema.String }), - Schema.Struct({ - "type": Schema.Literal("server_tool_use"), - "id": Schema.String, - "name": Schema.Literal("web_search"), - "input": Schema.optionalKey(Schema.Unknown) - }), - Schema.Struct({ - "type": Schema.Literal("web_search_tool_result"), - "tool_use_id": Schema.String, - "content": Schema.Union([ - Schema.Array( - Schema.Struct({ - "type": Schema.Literal("web_search_result"), - "encrypted_content": Schema.String, - "page_age": Schema.String, - "title": Schema.String, - "url": Schema.String - }) - ), - Schema.Struct({ - "type": Schema.Literal("web_search_tool_result_error"), - "error_code": Schema.Literals([ - "invalid_tool_input", - "unavailable", - "max_uses_exceeded", - "too_many_requests", - "query_too_long" - ]) - }) - ]) - }) - ], { mode: "oneOf" })), - "model": Schema.String, - "stop_reason": Schema.Literals(["end_turn", "max_tokens", "stop_sequence", "tool_use", "pause_turn", "refusal"]), - "stop_sequence": Schema.String, - "usage": Schema.Struct({ - "input_tokens": Schema.Number.check(Schema.isFinite()), - "output_tokens": Schema.Number.check(Schema.isFinite()), - "cache_creation_input_tokens": Schema.Number.check(Schema.isFinite()), - "cache_read_input_tokens": Schema.Number.check(Schema.isFinite()), - "cache_creation": Schema.Struct({ - "ephemeral_5m_input_tokens": Schema.Number.check(Schema.isFinite()), - "ephemeral_1h_input_tokens": Schema.Number.check(Schema.isFinite()) - }), - "inference_geo": Schema.String, - "server_tool_use": Schema.Struct({ "web_search_requests": Schema.Number.check(Schema.isFinite()) }), - "service_tier": Schema.Literals(["standard", "priority", "batch"]) - }) -}).annotate({ "description": "Non-streaming response from the Anthropic Messages API with OpenRouter extensions" }) -export type AnthropicMessagesStreamEvent = - | { - readonly "type": "message_start" - readonly "message": { - readonly "id": string - readonly "type": "message" - readonly "role": "assistant" - readonly "content": ReadonlyArray< - | { - readonly "type": "text" - readonly "text": string - readonly "citations": ReadonlyArray< - { - readonly "type": "char_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_char_index": number - readonly "end_char_index": number - readonly "file_id": string - } | { - readonly "type": "page_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_page_number": number - readonly "end_page_number": number - readonly "file_id": string - } | { - readonly "type": "content_block_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_block_index": number - readonly "end_block_index": number - readonly "file_id": string - } | { - readonly "type": "web_search_result_location" - readonly "cited_text": string - readonly "encrypted_index": string - readonly "title": string - readonly "url": string - } | { - readonly "type": "search_result_location" - readonly "cited_text": string - readonly "search_result_index": number - readonly "source": string - readonly "title": string - readonly "start_block_index": number - readonly "end_block_index": number - } - > - } - | { readonly "type": "tool_use"; readonly "id": string; readonly "name": string; readonly "input"?: unknown } - | { readonly "type": "thinking"; readonly "thinking": string; readonly "signature": string } - | { readonly "type": "redacted_thinking"; readonly "data": string } - | { - readonly "type": "server_tool_use" - readonly "id": string - readonly "name": "web_search" - readonly "input"?: unknown - } - | { - readonly "type": "web_search_tool_result" - readonly "tool_use_id": string - readonly "content": - | ReadonlyArray< - { - readonly "type": "web_search_result" - readonly "encrypted_content": string - readonly "page_age": string - readonly "title": string - readonly "url": string - } - > - | { - readonly "type": "web_search_tool_result_error" - readonly "error_code": - | "invalid_tool_input" - | "unavailable" - | "max_uses_exceeded" - | "too_many_requests" - | "query_too_long" - } - } - > - readonly "model": string - readonly "stop_reason": unknown - readonly "stop_sequence": unknown - readonly "usage": { - readonly "input_tokens": number - readonly "output_tokens": number - readonly "cache_creation_input_tokens": number - readonly "cache_read_input_tokens": number - readonly "cache_creation": { - readonly "ephemeral_5m_input_tokens": number - readonly "ephemeral_1h_input_tokens": number - } - readonly "inference_geo": string - readonly "server_tool_use": { readonly "web_search_requests": number } - readonly "service_tier": "standard" | "priority" | "batch" - } - } - } - | { - readonly "type": "message_delta" - readonly "delta": { - readonly "stop_reason": "end_turn" | "max_tokens" | "stop_sequence" | "tool_use" | "pause_turn" | "refusal" - readonly "stop_sequence": string - } - readonly "usage": { - readonly "input_tokens": number - readonly "output_tokens": number - readonly "cache_creation_input_tokens": number - readonly "cache_read_input_tokens": number - readonly "server_tool_use": { readonly "web_search_requests": number } - } - } - | { readonly "type": "message_stop" } - | { - readonly "type": "content_block_start" - readonly "index": number - readonly "content_block": - | { - readonly "type": "text" +export const FunctionCallArgsDeltaEvent = Schema.Struct({ + "delta": Schema.String, + "item_id": Schema.String, + "output_index": Schema.Number.check(Schema.isInt()), + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.function_call_arguments.delta") +}).annotate({ "description": "Event emitted when function call arguments are being streamed" }) +export type FunctionCallArgsDoneEvent = { + readonly "arguments": string + readonly "item_id": string + readonly "name": string + readonly "output_index": number + readonly "sequence_number": number + readonly "type": "response.function_call_arguments.done" +} +export const FunctionCallArgsDoneEvent = Schema.Struct({ + "arguments": Schema.String, + "item_id": Schema.String, + "name": Schema.String, + "output_index": Schema.Number.check(Schema.isInt()), + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.function_call_arguments.done") +}).annotate({ "description": "Event emitted when function call arguments streaming is complete" }) +export type FunctionCallOutputItem = { + readonly "call_id": string + readonly "id"?: string + readonly "output": + | string + | ReadonlyArray< + { readonly "text": string; readonly "type": "input_text" } | { + readonly "detail": "auto" | "high" | "low" | "original" + readonly "image_url"?: string + readonly "type": never readonly "text": string - readonly "citations": ReadonlyArray< - { - readonly "type": "char_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_char_index": number - readonly "end_char_index": number - readonly "file_id": string - } | { - readonly "type": "page_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_page_number": number - readonly "end_page_number": number - readonly "file_id": string - } | { - readonly "type": "content_block_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_block_index": number - readonly "end_block_index": number - readonly "file_id": string - } | { - readonly "type": "web_search_result_location" - readonly "cited_text": string - readonly "encrypted_index": string - readonly "title": string - readonly "url": string - } | { - readonly "type": "search_result_location" - readonly "cited_text": string - readonly "search_result_index": number - readonly "source": string - readonly "title": string - readonly "start_block_index": number - readonly "end_block_index": number - } - > - } - | { readonly "type": "tool_use"; readonly "id": string; readonly "name": string; readonly "input"?: unknown } - | { readonly "type": "thinking"; readonly "thinking": string; readonly "signature": string } - | { readonly "type": "redacted_thinking"; readonly "data": string } - | { - readonly "type": "server_tool_use" - readonly "id": string - readonly "name": "web_search" - readonly "input"?: unknown - } - | { - readonly "type": "web_search_tool_result" - readonly "tool_use_id": string - readonly "content": - | ReadonlyArray< - { - readonly "type": "web_search_result" - readonly "encrypted_content": string - readonly "page_age": string - readonly "title": string - readonly "url": string - } - > - | { - readonly "type": "web_search_tool_result_error" - readonly "error_code": - | "invalid_tool_input" - | "unavailable" - | "max_uses_exceeded" - | "too_many_requests" - | "query_too_long" - } - } - } - | { - readonly "type": "content_block_delta" - readonly "index": number - readonly "delta": - | { readonly "type": "text_delta"; readonly "text": string } - | { readonly "type": "input_json_delta"; readonly "partial_json": string } - | { readonly "type": "thinking_delta"; readonly "thinking": string } - | { readonly "type": "signature_delta"; readonly "signature": string } - | { - readonly "type": "citations_delta" - readonly "citation": { - readonly "type": "char_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_char_index": number - readonly "end_char_index": number - readonly "file_id": string - } | { - readonly "type": "page_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_page_number": number - readonly "end_page_number": number - readonly "file_id": string - } | { - readonly "type": "content_block_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_block_index": number - readonly "end_block_index": number - readonly "file_id": string - } | { - readonly "type": "web_search_result_location" - readonly "cited_text": string - readonly "encrypted_index": string - readonly "title": string - readonly "url": string - } | { - readonly "type": "search_result_location" - readonly "cited_text": string - readonly "search_result_index": number - readonly "source": string - readonly "title": string - readonly "start_block_index": number - readonly "end_block_index": number - } + } | { + readonly "file_data"?: string + readonly "file_id"?: string + readonly "file_url"?: string + readonly "filename"?: string + readonly "type": never + readonly "text": string + } | { + readonly "text": string + readonly "type": never + readonly "detail": "auto" | "high" | "low" | "original" + readonly "image_url"?: string + } | { + readonly "detail": "auto" | "high" | "low" | "original" + readonly "image_url"?: string + readonly "type": "input_image" + } | { + readonly "file_data"?: string + readonly "file_id"?: string + readonly "file_url"?: string + readonly "filename"?: string + readonly "type": never + readonly "detail": "auto" | "high" | "low" | "original" + readonly "image_url"?: string + } | { + readonly "text": string + readonly "type": never + readonly "file_data"?: string + readonly "file_id"?: string + readonly "file_url"?: string + readonly "filename"?: string + } | { + readonly "detail": "auto" | "high" | "low" | "original" + readonly "image_url"?: string + readonly "type": never + readonly "file_data"?: string + readonly "file_id"?: string + readonly "file_url"?: string + readonly "filename"?: string + } | { + readonly "file_data"?: string + readonly "file_id"?: string + readonly "file_url"?: string + readonly "filename"?: string + readonly "type": "input_file" } - } - | { readonly "type": "content_block_stop"; readonly "index": number } - | { readonly "type": "ping" } - | { readonly "type": "error"; readonly "error": { readonly "type": string; readonly "message": string } } -export const AnthropicMessagesStreamEvent = Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("message_start"), - "message": Schema.Struct({ - "id": Schema.String, - "type": Schema.Literal("message"), - "role": Schema.Literal("assistant"), - "content": Schema.Array(Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("text"), - "text": Schema.String, - "citations": Schema.Array(Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("char_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_char_index": Schema.Number.check(Schema.isFinite()), - "end_char_index": Schema.Number.check(Schema.isFinite()), - "file_id": Schema.String + > + readonly "status"?: "in_progress" | "completed" | "incomplete" + readonly "type": "function_call_output" +} +export const FunctionCallOutputItem = Schema.Struct({ + "call_id": Schema.String, + "id": Schema.optionalKey(Schema.String), + "output": Schema.Union([ + Schema.Union([Schema.String]), + Schema.Union([ + Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ "text": Schema.String, "type": Schema.Literal("input_text") }).annotate({ + "description": "Text input content item" }), Schema.Struct({ - "type": Schema.Literal("page_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_page_number": Schema.Number.check(Schema.isFinite()), - "end_page_number": Schema.Number.check(Schema.isFinite()), - "file_id": Schema.String - }), + "detail": Schema.Literals(["auto", "high", "low", "original"]), + "image_url": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "text": Schema.String + }).annotate({ "description": "Text input content item" }), Schema.Struct({ - "type": Schema.Literal("content_block_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_block_index": Schema.Number.check(Schema.isFinite()), - "end_block_index": Schema.Number.check(Schema.isFinite()), - "file_id": Schema.String - }), + "file_data": Schema.optionalKey(Schema.String), + "file_id": Schema.optionalKey(Schema.String), + "file_url": Schema.optionalKey(Schema.String), + "filename": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "text": Schema.String + }).annotate({ "description": "Text input content item" }) + ], { mode: "oneOf" }), + Schema.Union([ Schema.Struct({ - "type": Schema.Literal("web_search_result_location"), - "cited_text": Schema.String, - "encrypted_index": Schema.String, - "title": Schema.String, - "url": Schema.String - }), + "text": Schema.String, + "type": Schema.Never, + "detail": Schema.Literals(["auto", "high", "low", "original"]), + "image_url": Schema.optionalKey(Schema.String) + }).annotate({ "description": "Image input content item" }), Schema.Struct({ - "type": Schema.Literal("search_result_location"), - "cited_text": Schema.String, - "search_result_index": Schema.Number.check(Schema.isFinite()), - "source": Schema.String, - "title": Schema.String, - "start_block_index": Schema.Number.check(Schema.isFinite()), - "end_block_index": Schema.Number.check(Schema.isFinite()) - }) - ], { mode: "oneOf" })) - }), - Schema.Struct({ - "type": Schema.Literal("tool_use"), - "id": Schema.String, - "name": Schema.String, - "input": Schema.optionalKey(Schema.Unknown) - }), - Schema.Struct({ "type": Schema.Literal("thinking"), "thinking": Schema.String, "signature": Schema.String }), - Schema.Struct({ "type": Schema.Literal("redacted_thinking"), "data": Schema.String }), - Schema.Struct({ - "type": Schema.Literal("server_tool_use"), - "id": Schema.String, - "name": Schema.Literal("web_search"), - "input": Schema.optionalKey(Schema.Unknown) - }), - Schema.Struct({ - "type": Schema.Literal("web_search_tool_result"), - "tool_use_id": Schema.String, - "content": Schema.Union([ - Schema.Array( - Schema.Struct({ - "type": Schema.Literal("web_search_result"), - "encrypted_content": Schema.String, - "page_age": Schema.String, - "title": Schema.String, - "url": Schema.String - }) - ), + "detail": Schema.Union([ + Schema.Literal("auto"), + Schema.Literal("high"), + Schema.Literal("low"), + Schema.Literal("original") + ]), + "image_url": Schema.optionalKey(Schema.String), + "type": Schema.Literal("input_image") + }).annotate({ "description": "Image input content item" }), Schema.Struct({ - "type": Schema.Literal("web_search_tool_result_error"), - "error_code": Schema.Literals([ - "invalid_tool_input", - "unavailable", - "max_uses_exceeded", - "too_many_requests", - "query_too_long" - ]) - }) - ]) - }) - ], { mode: "oneOf" })), - "model": Schema.String, - "stop_reason": Schema.Unknown, - "stop_sequence": Schema.Unknown, - "usage": Schema.Struct({ - "input_tokens": Schema.Number.check(Schema.isFinite()), - "output_tokens": Schema.Number.check(Schema.isFinite()), - "cache_creation_input_tokens": Schema.Number.check(Schema.isFinite()), - "cache_read_input_tokens": Schema.Number.check(Schema.isFinite()), - "cache_creation": Schema.Struct({ - "ephemeral_5m_input_tokens": Schema.Number.check(Schema.isFinite()), - "ephemeral_1h_input_tokens": Schema.Number.check(Schema.isFinite()) - }), - "inference_geo": Schema.String, - "server_tool_use": Schema.Struct({ "web_search_requests": Schema.Number.check(Schema.isFinite()) }), - "service_tier": Schema.Literals(["standard", "priority", "batch"]) - }) - }) - }), - Schema.Struct({ - "type": Schema.Literal("message_delta"), - "delta": Schema.Struct({ - "stop_reason": Schema.Literals(["end_turn", "max_tokens", "stop_sequence", "tool_use", "pause_turn", "refusal"]), - "stop_sequence": Schema.String - }), - "usage": Schema.Struct({ - "input_tokens": Schema.Number.check(Schema.isFinite()), - "output_tokens": Schema.Number.check(Schema.isFinite()), - "cache_creation_input_tokens": Schema.Number.check(Schema.isFinite()), - "cache_read_input_tokens": Schema.Number.check(Schema.isFinite()), - "server_tool_use": Schema.Struct({ "web_search_requests": Schema.Number.check(Schema.isFinite()) }) - }) - }), - Schema.Struct({ "type": Schema.Literal("message_stop") }), - Schema.Struct({ - "type": Schema.Literal("content_block_start"), - "index": Schema.Number.check(Schema.isFinite()), - "content_block": Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("text"), - "text": Schema.String, - "citations": Schema.Array(Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("char_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_char_index": Schema.Number.check(Schema.isFinite()), - "end_char_index": Schema.Number.check(Schema.isFinite()), - "file_id": Schema.String - }), - Schema.Struct({ - "type": Schema.Literal("page_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_page_number": Schema.Number.check(Schema.isFinite()), - "end_page_number": Schema.Number.check(Schema.isFinite()), - "file_id": Schema.String - }), - Schema.Struct({ - "type": Schema.Literal("content_block_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_block_index": Schema.Number.check(Schema.isFinite()), - "end_block_index": Schema.Number.check(Schema.isFinite()), - "file_id": Schema.String - }), - Schema.Struct({ - "type": Schema.Literal("web_search_result_location"), - "cited_text": Schema.String, - "encrypted_index": Schema.String, - "title": Schema.String, - "url": Schema.String - }), - Schema.Struct({ - "type": Schema.Literal("search_result_location"), - "cited_text": Schema.String, - "search_result_index": Schema.Number.check(Schema.isFinite()), - "source": Schema.String, - "title": Schema.String, - "start_block_index": Schema.Number.check(Schema.isFinite()), - "end_block_index": Schema.Number.check(Schema.isFinite()) - }) - ], { mode: "oneOf" })) - }), - Schema.Struct({ - "type": Schema.Literal("tool_use"), - "id": Schema.String, - "name": Schema.String, - "input": Schema.optionalKey(Schema.Unknown) - }), - Schema.Struct({ "type": Schema.Literal("thinking"), "thinking": Schema.String, "signature": Schema.String }), - Schema.Struct({ "type": Schema.Literal("redacted_thinking"), "data": Schema.String }), - Schema.Struct({ - "type": Schema.Literal("server_tool_use"), - "id": Schema.String, - "name": Schema.Literal("web_search"), - "input": Schema.optionalKey(Schema.Unknown) - }), - Schema.Struct({ - "type": Schema.Literal("web_search_tool_result"), - "tool_use_id": Schema.String, - "content": Schema.Union([ - Schema.Array( - Schema.Struct({ - "type": Schema.Literal("web_search_result"), - "encrypted_content": Schema.String, - "page_age": Schema.String, - "title": Schema.String, - "url": Schema.String - }) - ), - Schema.Struct({ - "type": Schema.Literal("web_search_tool_result_error"), - "error_code": Schema.Literals([ - "invalid_tool_input", - "unavailable", - "max_uses_exceeded", - "too_many_requests", - "query_too_long" - ]) - }) - ]) - }) - ], { mode: "oneOf" }) - }), - Schema.Struct({ - "type": Schema.Literal("content_block_delta"), - "index": Schema.Number.check(Schema.isFinite()), - "delta": Schema.Union([ - Schema.Struct({ "type": Schema.Literal("text_delta"), "text": Schema.String }), - Schema.Struct({ "type": Schema.Literal("input_json_delta"), "partial_json": Schema.String }), - Schema.Struct({ "type": Schema.Literal("thinking_delta"), "thinking": Schema.String }), - Schema.Struct({ "type": Schema.Literal("signature_delta"), "signature": Schema.String }), - Schema.Struct({ - "type": Schema.Literal("citations_delta"), - "citation": Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("char_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_char_index": Schema.Number.check(Schema.isFinite()), - "end_char_index": Schema.Number.check(Schema.isFinite()), - "file_id": Schema.String - }), - Schema.Struct({ - "type": Schema.Literal("page_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_page_number": Schema.Number.check(Schema.isFinite()), - "end_page_number": Schema.Number.check(Schema.isFinite()), - "file_id": Schema.String - }), - Schema.Struct({ - "type": Schema.Literal("content_block_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_block_index": Schema.Number.check(Schema.isFinite()), - "end_block_index": Schema.Number.check(Schema.isFinite()), - "file_id": Schema.String - }), - Schema.Struct({ - "type": Schema.Literal("web_search_result_location"), - "cited_text": Schema.String, - "encrypted_index": Schema.String, - "title": Schema.String, - "url": Schema.String - }), - Schema.Struct({ - "type": Schema.Literal("search_result_location"), - "cited_text": Schema.String, - "search_result_index": Schema.Number.check(Schema.isFinite()), - "source": Schema.String, - "title": Schema.String, - "start_block_index": Schema.Number.check(Schema.isFinite()), - "end_block_index": Schema.Number.check(Schema.isFinite()) - }) - ], { mode: "oneOf" }) - }) - ], { mode: "oneOf" }) - }), - Schema.Struct({ "type": Schema.Literal("content_block_stop"), "index": Schema.Number.check(Schema.isFinite()) }), - Schema.Struct({ "type": Schema.Literal("ping") }), - Schema.Struct({ - "type": Schema.Literal("error"), - "error": Schema.Struct({ "type": Schema.String, "message": Schema.String }) - }) -], { mode: "oneOf" }).annotate({ "description": "Union of all possible streaming events" }) -export type OpenRouterAnthropicMessageParam = { - readonly "role": "user" | "assistant" - readonly "content": - | string - | ReadonlyArray< - | { - readonly "type": "text" - readonly "text": string - readonly "citations"?: ReadonlyArray< - { - readonly "type": "char_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_char_index": number - readonly "end_char_index": number - } | { - readonly "type": "page_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_page_number": number - readonly "end_page_number": number - } | { - readonly "type": "content_block_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_block_index": number - readonly "end_block_index": number - } | { - readonly "type": "web_search_result_location" - readonly "cited_text": string - readonly "encrypted_index": string - readonly "title": string - readonly "url": string - } | { - readonly "type": "search_result_location" - readonly "cited_text": string - readonly "search_result_index": number - readonly "source": string - readonly "title": string - readonly "start_block_index": number - readonly "end_block_index": number - } - > - readonly "cache_control"?: { readonly "type": "ephemeral"; readonly "ttl"?: "5m" | "1h" } - } - | { - readonly "type": "image" - readonly "source": { - readonly "type": "base64" - readonly "media_type": "image/jpeg" | "image/png" | "image/gif" | "image/webp" - readonly "data": string - } | { readonly "type": "url"; readonly "url": string } - readonly "cache_control"?: { readonly "type": "ephemeral"; readonly "ttl"?: "5m" | "1h" } - } - | { - readonly "type": "document" - readonly "source": - | { readonly "type": "base64"; readonly "media_type": "application/pdf"; readonly "data": string } - | { readonly "type": "text"; readonly "media_type": "text/plain"; readonly "data": string } - | { - readonly "type": "content" - readonly "content": - | string - | ReadonlyArray< - { - readonly "type": "text" - readonly "text": string - readonly "citations"?: ReadonlyArray< - { - readonly "type": "char_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_char_index": number - readonly "end_char_index": number - } | { - readonly "type": "page_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_page_number": number - readonly "end_page_number": number - } | { - readonly "type": "content_block_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_block_index": number - readonly "end_block_index": number - } | { - readonly "type": "web_search_result_location" - readonly "cited_text": string - readonly "encrypted_index": string - readonly "title": string - readonly "url": string - } | { - readonly "type": "search_result_location" - readonly "cited_text": string - readonly "search_result_index": number - readonly "source": string - readonly "title": string - readonly "start_block_index": number - readonly "end_block_index": number - } - > - readonly "cache_control"?: { readonly "type": "ephemeral"; readonly "ttl"?: "5m" | "1h" } - } | { - readonly "type": "image" - readonly "source": { - readonly "type": "base64" - readonly "media_type": "image/jpeg" | "image/png" | "image/gif" | "image/webp" - readonly "data": string - } | { readonly "type": "url"; readonly "url": string } - readonly "cache_control"?: { readonly "type": "ephemeral"; readonly "ttl"?: "5m" | "1h" } - } - > - } - | { readonly "type": "url"; readonly "url": string } - readonly "citations"?: { readonly "enabled"?: boolean } - readonly "context"?: string - readonly "title"?: string - readonly "cache_control"?: { readonly "type": "ephemeral"; readonly "ttl"?: "5m" | "1h" } - } - | { - readonly "type": "tool_use" - readonly "id": string - readonly "name": string - readonly "input"?: unknown - readonly "cache_control"?: { readonly "type": "ephemeral"; readonly "ttl"?: "5m" | "1h" } - } - | { - readonly "type": "tool_result" - readonly "tool_use_id": string - readonly "content"?: - | string - | ReadonlyArray< - { - readonly "type": "text" - readonly "text": string - readonly "citations"?: ReadonlyArray< - { - readonly "type": "char_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_char_index": number - readonly "end_char_index": number - } | { - readonly "type": "page_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_page_number": number - readonly "end_page_number": number - } | { - readonly "type": "content_block_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_block_index": number - readonly "end_block_index": number - } | { - readonly "type": "web_search_result_location" - readonly "cited_text": string - readonly "encrypted_index": string - readonly "title": string - readonly "url": string - } | { - readonly "type": "search_result_location" - readonly "cited_text": string - readonly "search_result_index": number - readonly "source": string - readonly "title": string - readonly "start_block_index": number - readonly "end_block_index": number - } - > - readonly "cache_control"?: { readonly "type": "ephemeral"; readonly "ttl"?: "5m" | "1h" } - } | { - readonly "type": "image" - readonly "source": { - readonly "type": "base64" - readonly "media_type": "image/jpeg" | "image/png" | "image/gif" | "image/webp" - readonly "data": string - } | { readonly "type": "url"; readonly "url": string } - readonly "cache_control"?: { readonly "type": "ephemeral"; readonly "ttl"?: "5m" | "1h" } - } - > - readonly "is_error"?: boolean - readonly "cache_control"?: { readonly "type": "ephemeral"; readonly "ttl"?: "5m" | "1h" } - } - | { readonly "type": "thinking"; readonly "thinking": string; readonly "signature": string } - | { readonly "type": "redacted_thinking"; readonly "data": string } - | { - readonly "type": "server_tool_use" - readonly "id": string - readonly "name": "web_search" - readonly "input"?: unknown - readonly "cache_control"?: { readonly "type": "ephemeral"; readonly "ttl"?: "5m" | "1h" } - } - | { - readonly "type": "web_search_tool_result" - readonly "tool_use_id": string - readonly "content": - | ReadonlyArray< - { - readonly "type": "web_search_result" - readonly "encrypted_content": string - readonly "title": string - readonly "url": string - readonly "page_age"?: string - } - > - | { - readonly "type": "web_search_tool_result_error" - readonly "error_code": - | "invalid_tool_input" - | "unavailable" - | "max_uses_exceeded" - | "too_many_requests" - | "query_too_long" - } - readonly "cache_control"?: { readonly "type": "ephemeral"; readonly "ttl"?: "5m" | "1h" } - } - | { - readonly "type": "search_result" - readonly "source": string - readonly "title": string - readonly "content": ReadonlyArray< - { - readonly "type": "text" - readonly "text": string - readonly "citations"?: ReadonlyArray< - { - readonly "type": "char_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_char_index": number - readonly "end_char_index": number - } | { - readonly "type": "page_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_page_number": number - readonly "end_page_number": number - } | { - readonly "type": "content_block_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_block_index": number - readonly "end_block_index": number - } | { - readonly "type": "web_search_result_location" - readonly "cited_text": string - readonly "encrypted_index": string - readonly "title": string - readonly "url": string - } | { - readonly "type": "search_result_location" - readonly "cited_text": string - readonly "search_result_index": number - readonly "source": string - readonly "title": string - readonly "start_block_index": number - readonly "end_block_index": number - } - > - readonly "cache_control"?: { readonly "type": "ephemeral"; readonly "ttl"?: "5m" | "1h" } - } - > - readonly "citations"?: { readonly "enabled"?: boolean } - readonly "cache_control"?: { readonly "type": "ephemeral"; readonly "ttl"?: "5m" | "1h" } - } - > -} -export const OpenRouterAnthropicMessageParam = Schema.Struct({ - "role": Schema.Literals(["user", "assistant"]), - "content": Schema.Union([ - Schema.String, - Schema.Array(Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("text"), - "text": Schema.String, - "citations": Schema.optionalKey(Schema.Array(Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("char_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_char_index": Schema.Number.check(Schema.isFinite()), - "end_char_index": Schema.Number.check(Schema.isFinite()) - }), - Schema.Struct({ - "type": Schema.Literal("page_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_page_number": Schema.Number.check(Schema.isFinite()), - "end_page_number": Schema.Number.check(Schema.isFinite()) - }), - Schema.Struct({ - "type": Schema.Literal("content_block_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_block_index": Schema.Number.check(Schema.isFinite()), - "end_block_index": Schema.Number.check(Schema.isFinite()) - }), - Schema.Struct({ - "type": Schema.Literal("web_search_result_location"), - "cited_text": Schema.String, - "encrypted_index": Schema.String, - "title": Schema.String, - "url": Schema.String - }), - Schema.Struct({ - "type": Schema.Literal("search_result_location"), - "cited_text": Schema.String, - "search_result_index": Schema.Number.check(Schema.isFinite()), - "source": Schema.String, - "title": Schema.String, - "start_block_index": Schema.Number.check(Schema.isFinite()), - "end_block_index": Schema.Number.check(Schema.isFinite()) - }) - ], { mode: "oneOf" }))), - "cache_control": Schema.optionalKey( - Schema.Struct({ - "type": Schema.Literal("ephemeral"), - "ttl": Schema.optionalKey(Schema.Literals(["5m", "1h"])) - }) - ) - }), - Schema.Struct({ - "type": Schema.Literal("image"), - "source": Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("base64"), - "media_type": Schema.Literals(["image/jpeg", "image/png", "image/gif", "image/webp"]), - "data": Schema.String - }), - Schema.Struct({ "type": Schema.Literal("url"), "url": Schema.String }) - ], { mode: "oneOf" }), - "cache_control": Schema.optionalKey( - Schema.Struct({ - "type": Schema.Literal("ephemeral"), - "ttl": Schema.optionalKey(Schema.Literals(["5m", "1h"])) - }) - ) - }), - Schema.Struct({ - "type": Schema.Literal("document"), - "source": Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("base64"), - "media_type": Schema.Literal("application/pdf"), - "data": Schema.String - }), - Schema.Struct({ - "type": Schema.Literal("text"), - "media_type": Schema.Literal("text/plain"), - "data": Schema.String - }), - Schema.Struct({ - "type": Schema.Literal("content"), - "content": Schema.Union([ - Schema.String, - Schema.Array(Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("text"), - "text": Schema.String, - "citations": Schema.optionalKey(Schema.Array(Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("char_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_char_index": Schema.Number.check(Schema.isFinite()), - "end_char_index": Schema.Number.check(Schema.isFinite()) - }), - Schema.Struct({ - "type": Schema.Literal("page_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_page_number": Schema.Number.check(Schema.isFinite()), - "end_page_number": Schema.Number.check(Schema.isFinite()) - }), - Schema.Struct({ - "type": Schema.Literal("content_block_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_block_index": Schema.Number.check(Schema.isFinite()), - "end_block_index": Schema.Number.check(Schema.isFinite()) - }), - Schema.Struct({ - "type": Schema.Literal("web_search_result_location"), - "cited_text": Schema.String, - "encrypted_index": Schema.String, - "title": Schema.String, - "url": Schema.String - }), - Schema.Struct({ - "type": Schema.Literal("search_result_location"), - "cited_text": Schema.String, - "search_result_index": Schema.Number.check(Schema.isFinite()), - "source": Schema.String, - "title": Schema.String, - "start_block_index": Schema.Number.check(Schema.isFinite()), - "end_block_index": Schema.Number.check(Schema.isFinite()) - }) - ], { mode: "oneOf" }))), - "cache_control": Schema.optionalKey( - Schema.Struct({ - "type": Schema.Literal("ephemeral"), - "ttl": Schema.optionalKey(Schema.Literals(["5m", "1h"])) - }) - ) - }), - Schema.Struct({ - "type": Schema.Literal("image"), - "source": Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("base64"), - "media_type": Schema.Literals(["image/jpeg", "image/png", "image/gif", "image/webp"]), - "data": Schema.String - }), - Schema.Struct({ "type": Schema.Literal("url"), "url": Schema.String }) - ], { mode: "oneOf" }), - "cache_control": Schema.optionalKey( - Schema.Struct({ - "type": Schema.Literal("ephemeral"), - "ttl": Schema.optionalKey(Schema.Literals(["5m", "1h"])) - }) - ) - }) - ], { mode: "oneOf" })) - ]) - }), - Schema.Struct({ "type": Schema.Literal("url"), "url": Schema.String }) - ], { mode: "oneOf" }), - "citations": Schema.optionalKey(Schema.Struct({ "enabled": Schema.optionalKey(Schema.Boolean) })), - "context": Schema.optionalKey(Schema.String), - "title": Schema.optionalKey(Schema.String), - "cache_control": Schema.optionalKey( - Schema.Struct({ - "type": Schema.Literal("ephemeral"), - "ttl": Schema.optionalKey(Schema.Literals(["5m", "1h"])) - }) - ) - }), - Schema.Struct({ - "type": Schema.Literal("tool_use"), - "id": Schema.String, - "name": Schema.String, - "input": Schema.optionalKey(Schema.Unknown), - "cache_control": Schema.optionalKey( - Schema.Struct({ - "type": Schema.Literal("ephemeral"), - "ttl": Schema.optionalKey(Schema.Literals(["5m", "1h"])) - }) - ) - }), - Schema.Struct({ - "type": Schema.Literal("tool_result"), - "tool_use_id": Schema.String, - "content": Schema.optionalKey(Schema.Union([ - Schema.String, - Schema.Array(Schema.Union([ + "file_data": Schema.optionalKey(Schema.String), + "file_id": Schema.optionalKey(Schema.String), + "file_url": Schema.optionalKey(Schema.String), + "filename": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "detail": Schema.Literals(["auto", "high", "low", "original"]), + "image_url": Schema.optionalKey(Schema.String) + }).annotate({ "description": "Image input content item" }) + ], { mode: "oneOf" }), + Schema.Union([ Schema.Struct({ - "type": Schema.Literal("text"), "text": Schema.String, - "citations": Schema.optionalKey(Schema.Array(Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("char_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_char_index": Schema.Number.check(Schema.isFinite()), - "end_char_index": Schema.Number.check(Schema.isFinite()) - }), - Schema.Struct({ - "type": Schema.Literal("page_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_page_number": Schema.Number.check(Schema.isFinite()), - "end_page_number": Schema.Number.check(Schema.isFinite()) - }), - Schema.Struct({ - "type": Schema.Literal("content_block_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_block_index": Schema.Number.check(Schema.isFinite()), - "end_block_index": Schema.Number.check(Schema.isFinite()) - }), - Schema.Struct({ - "type": Schema.Literal("web_search_result_location"), - "cited_text": Schema.String, - "encrypted_index": Schema.String, - "title": Schema.String, - "url": Schema.String - }), - Schema.Struct({ - "type": Schema.Literal("search_result_location"), - "cited_text": Schema.String, - "search_result_index": Schema.Number.check(Schema.isFinite()), - "source": Schema.String, - "title": Schema.String, - "start_block_index": Schema.Number.check(Schema.isFinite()), - "end_block_index": Schema.Number.check(Schema.isFinite()) - }) - ], { mode: "oneOf" }))), - "cache_control": Schema.optionalKey( - Schema.Struct({ - "type": Schema.Literal("ephemeral"), - "ttl": Schema.optionalKey(Schema.Literals(["5m", "1h"])) - }) - ) - }), - Schema.Struct({ - "type": Schema.Literal("image"), - "source": Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("base64"), - "media_type": Schema.Literals(["image/jpeg", "image/png", "image/gif", "image/webp"]), - "data": Schema.String - }), - Schema.Struct({ "type": Schema.Literal("url"), "url": Schema.String }) - ], { mode: "oneOf" }), - "cache_control": Schema.optionalKey( - Schema.Struct({ - "type": Schema.Literal("ephemeral"), - "ttl": Schema.optionalKey(Schema.Literals(["5m", "1h"])) - }) - ) - }) - ])) - ])), - "is_error": Schema.optionalKey(Schema.Boolean), - "cache_control": Schema.optionalKey( - Schema.Struct({ - "type": Schema.Literal("ephemeral"), - "ttl": Schema.optionalKey(Schema.Literals(["5m", "1h"])) - }) - ) - }), - Schema.Struct({ "type": Schema.Literal("thinking"), "thinking": Schema.String, "signature": Schema.String }), - Schema.Struct({ "type": Schema.Literal("redacted_thinking"), "data": Schema.String }), - Schema.Struct({ - "type": Schema.Literal("server_tool_use"), - "id": Schema.String, - "name": Schema.Literal("web_search"), - "input": Schema.optionalKey(Schema.Unknown), - "cache_control": Schema.optionalKey( - Schema.Struct({ - "type": Schema.Literal("ephemeral"), - "ttl": Schema.optionalKey(Schema.Literals(["5m", "1h"])) - }) - ) - }), - Schema.Struct({ - "type": Schema.Literal("web_search_tool_result"), - "tool_use_id": Schema.String, - "content": Schema.Union([ - Schema.Array( - Schema.Struct({ - "type": Schema.Literal("web_search_result"), - "encrypted_content": Schema.String, - "title": Schema.String, - "url": Schema.String, - "page_age": Schema.optionalKey(Schema.String) - }) - ), - Schema.Struct({ - "type": Schema.Literal("web_search_tool_result_error"), - "error_code": Schema.Literals([ - "invalid_tool_input", - "unavailable", - "max_uses_exceeded", - "too_many_requests", - "query_too_long" - ]) - }) - ]), - "cache_control": Schema.optionalKey( - Schema.Struct({ - "type": Schema.Literal("ephemeral"), - "ttl": Schema.optionalKey(Schema.Literals(["5m", "1h"])) - }) - ) - }), - Schema.Struct({ - "type": Schema.Literal("search_result"), - "source": Schema.String, - "title": Schema.String, - "content": Schema.Array(Schema.Struct({ - "type": Schema.Literal("text"), - "text": Schema.String, - "citations": Schema.optionalKey(Schema.Array(Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("char_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_char_index": Schema.Number.check(Schema.isFinite()), - "end_char_index": Schema.Number.check(Schema.isFinite()) - }), - Schema.Struct({ - "type": Schema.Literal("page_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_page_number": Schema.Number.check(Schema.isFinite()), - "end_page_number": Schema.Number.check(Schema.isFinite()) - }), - Schema.Struct({ - "type": Schema.Literal("content_block_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_block_index": Schema.Number.check(Schema.isFinite()), - "end_block_index": Schema.Number.check(Schema.isFinite()) - }), - Schema.Struct({ - "type": Schema.Literal("web_search_result_location"), - "cited_text": Schema.String, - "encrypted_index": Schema.String, - "title": Schema.String, - "url": Schema.String - }), + "type": Schema.Never, + "file_data": Schema.optionalKey(Schema.String), + "file_id": Schema.optionalKey(Schema.String), + "file_url": Schema.optionalKey(Schema.String), + "filename": Schema.optionalKey(Schema.String) + }).annotate({ "description": "File input content item" }), Schema.Struct({ - "type": Schema.Literal("search_result_location"), - "cited_text": Schema.String, - "search_result_index": Schema.Number.check(Schema.isFinite()), - "source": Schema.String, - "title": Schema.String, - "start_block_index": Schema.Number.check(Schema.isFinite()), - "end_block_index": Schema.Number.check(Schema.isFinite()) - }) - ], { mode: "oneOf" }))), - "cache_control": Schema.optionalKey( + "detail": Schema.Literals(["auto", "high", "low", "original"]), + "image_url": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "file_data": Schema.optionalKey(Schema.String), + "file_id": Schema.optionalKey(Schema.String), + "file_url": Schema.optionalKey(Schema.String), + "filename": Schema.optionalKey(Schema.String) + }).annotate({ "description": "File input content item" }), Schema.Struct({ - "type": Schema.Literal("ephemeral"), - "ttl": Schema.optionalKey(Schema.Literals(["5m", "1h"])) - }) - ) - })), - "citations": Schema.optionalKey(Schema.Struct({ "enabled": Schema.optionalKey(Schema.Boolean) })), - "cache_control": Schema.optionalKey( - Schema.Struct({ - "type": Schema.Literal("ephemeral"), - "ttl": Schema.optionalKey(Schema.Literals(["5m", "1h"])) - }) - ) - }) - ], { mode: "oneOf" })) - ]) -}).annotate({ "description": "Anthropic message with OpenRouter extensions" }) -export type AnthropicOutputConfig = { readonly "effort"?: "low" | "medium" | "high" | "max" } -export const AnthropicOutputConfig = Schema.Struct({ - "effort": Schema.optionalKey( - Schema.Literals(["low", "medium", "high", "max"]).annotate({ - "description": - "How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer. Valid values are `low`, `medium`, `high`, or `max`." - }) - ) -}).annotate({ - "description": - "Configuration for controlling output behavior. Currently supports the effort parameter for Claude Opus 4.5." + "file_data": Schema.optionalKey(Schema.String), + "file_id": Schema.optionalKey(Schema.String), + "file_url": Schema.optionalKey(Schema.String), + "filename": Schema.optionalKey(Schema.String), + "type": Schema.Literal("input_file") + }).annotate({ "description": "File input content item" }) + ], { mode: "oneOf" }) + ], { mode: "oneOf" }) + ) + ]) + ]), + "status": Schema.optionalKey(Schema.Literals(["in_progress", "completed", "incomplete"])), + "type": Schema.Literal("function_call_output") +}).annotate({ "description": "The output from a function call execution" }) +export type FusionPlugin = { + readonly "analysis_models"?: ReadonlyArray + readonly "enabled"?: boolean + readonly "id": "fusion" + readonly "max_tool_calls"?: number + readonly "model"?: string +} +export const FusionPlugin = Schema.Struct({ + "analysis_models": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "description": + "Slugs of models to run in parallel as the \"expert panel\" the judge analyzes. Each model receives the same user prompt with web_search + web_fetch enabled. Capped at 8 models to bound cost amplification. When omitted, defaults to the Quality preset from the /labs/fusion UI (~anthropic/claude-opus-latest, ~openai/gpt-latest, ~google/gemini-pro-latest)." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(8)) + ), + "enabled": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": "Set to false to disable the fusion plugin for this request. Defaults to true." + }) + ), + "id": Schema.Literal("fusion"), + "max_tool_calls": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "Maximum number of tool-calling steps each panelist (analysis model) and the judge model may take during their agentic web-research loop. Models with web_search/web_fetch enabled iterate until they produce a text response or hit this ceiling. Defaults to 8. Capped at 16." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(16)) + ), + "model": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Slug of the model that performs both the judge step (with web_search + web_fetch) and the final synthesis. When omitted, defaults to the first model in the Quality preset." + }) + ) }) -export type ActivityItem = { - readonly "date": string - readonly "model": string - readonly "model_permaslug": string - readonly "endpoint_id": string - readonly "provider_name": string - readonly "usage": number - readonly "byok_usage_inference": number - readonly "requests": number - readonly "prompt_tokens": number - readonly "completion_tokens": number - readonly "reasoning_tokens": number +export type FusionServerToolConfig = { + readonly "analysis_models"?: ReadonlyArray + readonly "max_completion_tokens"?: number + readonly "max_tool_calls"?: number + readonly "model"?: string + readonly "reasoning"?: { + readonly "effort"?: "xhigh" | "high" | "medium" | "low" | "minimal" | "none" + readonly "max_tokens"?: number + } + readonly "temperature"?: number } -export const ActivityItem = Schema.Struct({ - "date": Schema.String.annotate({ "description": "Date of the activity (YYYY-MM-DD format)" }), - "model": Schema.String.annotate({ "description": "Model slug (e.g., \"openai/gpt-4.1\")" }), - "model_permaslug": Schema.String.annotate({ "description": "Model permaslug (e.g., \"openai/gpt-4.1-2025-04-14\")" }), - "endpoint_id": Schema.String.annotate({ "description": "Unique identifier for the endpoint" }), - "provider_name": Schema.String.annotate({ "description": "Name of the provider serving this endpoint" }), - "usage": Schema.Number.annotate({ "description": "Total cost in USD (OpenRouter credits spent)" }).check( - Schema.isFinite() +export const FusionServerToolConfig = Schema.Struct({ + "analysis_models": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "description": + "Slugs of models to run in parallel as the analysis panel. Each model receives the user prompt with openrouter:web_search and openrouter:web_fetch enabled, then a judge model summarizes the collective output into structured analysis JSON. Capped at 8 models to bound cost amplification. Defaults to the Quality preset from /labs/fusion." + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(8)) ), - "byok_usage_inference": Schema.Number.annotate({ - "description": "BYOK inference cost in USD (external credits spent)" - }).check(Schema.isFinite()), - "requests": Schema.Number.annotate({ "description": "Number of requests made" }).check(Schema.isFinite()), - "prompt_tokens": Schema.Number.annotate({ "description": "Total prompt tokens used" }).check(Schema.isFinite()), - "completion_tokens": Schema.Number.annotate({ "description": "Total completion tokens generated" }).check( - Schema.isFinite() + "max_completion_tokens": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, the provider's default applies." + }).check(Schema.isInt()) + ), + "max_tool_calls": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "Maximum number of tool-calling steps each panelist (analysis model) and the judge model may take during their agentic web-research loop. Models with web_search/web_fetch enabled iterate until they produce a text response or hit this ceiling. Defaults to 8. Capped at 16." + }).check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(16)) + ), + "model": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Slug of the judge model that produces the structured analysis JSON. Defaults to the model used in the outer API request." + }) + ), + "reasoning": Schema.optionalKey( + Schema.Struct({ + "effort": Schema.optionalKey( + Schema.Literals(["xhigh", "high", "medium", "low", "minimal", "none"]).annotate({ + "description": "Reasoning effort level for panelist and judge inner calls." + }) + ), + "max_tokens": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "Maximum number of reasoning tokens each panelist and judge model may use. Helps bound cost when models allocate too much budget to chain-of-thought." + }).check(Schema.isInt()) + ) + }).annotate({ + "description": + "Reasoning configuration forwarded to panelist and judge inner calls. Use this to control reasoning effort and token budget for models that support extended thinking." + }) ), - "reasoning_tokens": Schema.Number.annotate({ "description": "Total reasoning tokens used" }).check(Schema.isFinite()) + "temperature": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "Sampling temperature forwarded to panelist and judge inner calls. When omitted, the provider's default applies.", + "format": "double" + }).check(Schema.isFinite()) + ) +}).annotate({ "description": "Configuration for the openrouter:fusion server tool." }) +export type GenerationContentData = { + readonly "input": { readonly "prompt": string } | { readonly "messages": ReadonlyArray } + readonly "output": { readonly "completion": string; readonly "reasoning": string } +} +export const GenerationContentData = Schema.Struct({ + "input": Schema.Union([ + Schema.Struct({ "prompt": Schema.String }), + Schema.Struct({ "messages": Schema.Array(Schema.Unknown) }) + ]).annotate({ "description": "The input to the generation — either a prompt string or an array of messages" }), + "output": Schema.Struct({ + "completion": Schema.String.annotate({ "description": "The completion output" }), + "reasoning": Schema.String.annotate({ "description": "Reasoning/thinking output, if any" }) + }).annotate({ "description": "The output from the generation" }) +}).annotate({ "description": "Stored prompt and completion content" }) +export type GetWorkspaceResponse = { + readonly "data": { + readonly "created_at": string + readonly "created_by": string + readonly "default_image_model": string + readonly "default_provider_sort": string + readonly "default_text_model": string + readonly "description": string + readonly "id": string + readonly "io_logging_api_key_ids": ReadonlyArray + readonly "io_logging_sampling_rate": number + readonly "is_data_discount_logging_enabled": boolean + readonly "is_observability_broadcast_enabled": boolean + readonly "is_observability_io_logging_enabled": boolean + readonly "name": string + readonly "slug": string + readonly "updated_at": string + } +} +export const GetWorkspaceResponse = Schema.Struct({ + "data": Schema.Struct({ + "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the workspace was created" }), + "created_by": Schema.String.annotate({ "description": "User ID of the workspace creator" }), + "default_image_model": Schema.String.annotate({ "description": "Default image model for this workspace" }), + "default_provider_sort": Schema.String.annotate({ + "description": "Default provider sort preference (price, throughput, latency, exacto)" + }), + "default_text_model": Schema.String.annotate({ "description": "Default text model for this workspace" }), + "description": Schema.String.annotate({ "description": "Description of the workspace" }), + "id": Schema.String.annotate({ "description": "Unique identifier for the workspace", "format": "uuid" }), + "io_logging_api_key_ids": Schema.Array(Schema.Number.check(Schema.isInt())).annotate({ + "description": "Optional array of API key IDs to filter I/O logging. Null means all keys are logged." + }), + "io_logging_sampling_rate": Schema.Number.annotate({ + "description": "Sampling rate for I/O logging (0.0001-1). 1 means 100% of requests are logged.", + "format": "double" + }).check(Schema.isFinite()), + "is_data_discount_logging_enabled": Schema.Boolean.annotate({ + "description": "Whether data discount logging is enabled for this workspace" + }), + "is_observability_broadcast_enabled": Schema.Boolean.annotate({ + "description": "Whether broadcast is enabled for this workspace" + }), + "is_observability_io_logging_enabled": Schema.Boolean.annotate({ + "description": "Whether private logging is enabled for this workspace" + }), + "name": Schema.String.annotate({ "description": "Name of the workspace" }), + "slug": Schema.String.annotate({ "description": "URL-friendly slug for the workspace" }), + "updated_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the workspace was last updated" }) + }).annotate({ "description": "The workspace" }) }) -export type ForbiddenResponseErrorData = { +export type GoneResponseErrorData = { readonly "code": number; readonly "message": string; readonly "metadata"?: {} } +export const GoneResponseErrorData = Schema.Struct({ + "code": Schema.Number.check(Schema.isInt()), + "message": Schema.String, + "metadata": Schema.optionalKey(Schema.Struct({})) +}).annotate({ "description": "Error data for GoneResponse" }) +export type GuardrailInterval = "daily" | "weekly" | "monthly" | null +export const GuardrailInterval = Schema.Union([ + Schema.Literal("daily"), + Schema.Literal("weekly"), + Schema.Literal("monthly"), + Schema.Null +]).annotate({ "description": "Interval at which the limit resets (daily, weekly, monthly)" }) +export type ImageConfig = {} +export const ImageConfig = Schema.Struct({}).annotate({ + "description": + "Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details." +}) +export type ImageGenCallCompletedEvent = { + readonly "item_id": string + readonly "output_index": number + readonly "sequence_number": number + readonly "type": "response.image_generation_call.completed" +} +export const ImageGenCallCompletedEvent = Schema.Struct({ + "item_id": Schema.String, + "output_index": Schema.Number.check(Schema.isInt()), + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.image_generation_call.completed") +}).annotate({ "description": "Image generation call completed" }) +export type ImageGenCallGeneratingEvent = { + readonly "item_id": string + readonly "output_index": number + readonly "sequence_number": number + readonly "type": "response.image_generation_call.generating" +} +export const ImageGenCallGeneratingEvent = Schema.Struct({ + "item_id": Schema.String, + "output_index": Schema.Number.check(Schema.isInt()), + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.image_generation_call.generating") +}).annotate({ "description": "Image generation call is generating" }) +export type ImageGenCallInProgressEvent = { + readonly "item_id": string + readonly "output_index": number + readonly "sequence_number": number + readonly "type": "response.image_generation_call.in_progress" +} +export const ImageGenCallInProgressEvent = Schema.Struct({ + "item_id": Schema.String, + "output_index": Schema.Number.check(Schema.isInt()), + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.image_generation_call.in_progress") +}).annotate({ "description": "Image generation call in progress" }) +export type ImageGenCallPartialImageEvent = { + readonly "item_id": string + readonly "output_index": number + readonly "partial_image_b64": string + readonly "partial_image_index": number + readonly "sequence_number": number + readonly "type": "response.image_generation_call.partial_image" +} +export const ImageGenCallPartialImageEvent = Schema.Struct({ + "item_id": Schema.String, + "output_index": Schema.Number.check(Schema.isInt()), + "partial_image_b64": Schema.String, + "partial_image_index": Schema.Number.check(Schema.isInt()), + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.image_generation_call.partial_image") +}).annotate({ "description": "Image generation call with partial image" }) +export type ImageGenerationServerTool = { + readonly "background"?: "transparent" | "opaque" | "auto" + readonly "input_fidelity"?: "high" | "low" | null + readonly "input_image_mask"?: { readonly "file_id"?: string; readonly "image_url"?: string } + readonly "model"?: "gpt-image-1" | "gpt-image-1-mini" + readonly "moderation"?: "auto" | "low" + readonly "output_compression"?: number + readonly "output_format"?: "png" | "webp" | "jpeg" + readonly "partial_images"?: number + readonly "quality"?: "low" | "medium" | "high" | "auto" + readonly "size"?: "1024x1024" | "1024x1536" | "1536x1024" | "auto" + readonly "type": "image_generation" +} +export const ImageGenerationServerTool = Schema.Struct({ + "background": Schema.optionalKey(Schema.Literals(["transparent", "opaque", "auto"])), + "input_fidelity": Schema.optionalKey(Schema.Union([Schema.Literal("high"), Schema.Literal("low"), Schema.Null])), + "input_image_mask": Schema.optionalKey( + Schema.Struct({ "file_id": Schema.optionalKey(Schema.String), "image_url": Schema.optionalKey(Schema.String) }) + ), + "model": Schema.optionalKey(Schema.Literals(["gpt-image-1", "gpt-image-1-mini"])), + "moderation": Schema.optionalKey(Schema.Literals(["auto", "low"])), + "output_compression": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "output_format": Schema.optionalKey(Schema.Literals(["png", "webp", "jpeg"])), + "partial_images": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "quality": Schema.optionalKey(Schema.Literals(["low", "medium", "high", "auto"])), + "size": Schema.optionalKey(Schema.Literals(["1024x1024", "1024x1536", "1536x1024", "auto"])), + "type": Schema.Literal("image_generation") +}).annotate({ "description": "Image generation tool configuration" }) +export type ImageGenerationServerToolConfig = { readonly "model"?: string } +export const ImageGenerationServerToolConfig = Schema.Struct({ + "model": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Which image generation model to use (e.g. \"openai/gpt-5-image\"). Defaults to \"openai/gpt-5-image\"." + }) + ) +}).annotate({ + "description": + "Configuration for the openrouter:image_generation server tool. Accepts all image_config params (aspect_ratio, quality, size, background, output_format, output_compression, moderation, etc.) plus a model field." +}) +export type ImageGenerationStatus = "in_progress" | "completed" | "generating" | "failed" +export const ImageGenerationStatus = Schema.Literals(["in_progress", "completed", "generating", "failed"]) +export type IncompleteDetails = { readonly "reason"?: "max_output_tokens" | "content_filter" } +export const IncompleteDetails = Schema.Struct({ + "reason": Schema.optionalKey(Schema.Literals(["max_output_tokens", "content_filter"])) +}) +export type InputAudio = { + readonly "input_audio": { readonly "data": string; readonly "format": "mp3" | "wav" } + readonly "type": "input_audio" +} +export const InputAudio = Schema.Struct({ + "input_audio": Schema.Struct({ "data": Schema.String, "format": Schema.Literals(["mp3", "wav"]) }), + "type": Schema.Literal("input_audio") +}).annotate({ "description": "Audio input content item" }) +export type InputFile = { + readonly "file_data"?: string + readonly "file_id"?: string + readonly "file_url"?: string + readonly "filename"?: string + readonly "type": "input_file" +} +export const InputFile = Schema.Struct({ + "file_data": Schema.optionalKey(Schema.String), + "file_id": Schema.optionalKey(Schema.String), + "file_url": Schema.optionalKey(Schema.String), + "filename": Schema.optionalKey(Schema.String), + "type": Schema.Literal("input_file") +}).annotate({ "description": "File input content item" }) +export type InputImage = { + readonly "detail": "auto" | "high" | "low" | "original" + readonly "image_url"?: string + readonly "type": "input_image" +} +export const InputImage = Schema.Struct({ + "detail": Schema.Literals(["auto", "high", "low", "original"]), + "image_url": Schema.optionalKey(Schema.String), + "type": Schema.Literal("input_image") +}).annotate({ "description": "Image input content item" }) +export type InputModality = "text" | "image" | "file" | "audio" | "video" +export const InputModality = Schema.Literals(["text", "image", "file", "audio", "video"]) +export type InputText = { readonly "text": string; readonly "type": "input_text" } +export const InputText = Schema.Struct({ "text": Schema.String, "type": Schema.Literal("input_text") }).annotate({ + "description": "Text input content item" +}) +export type InputVideo = { readonly "type": "input_video"; readonly "video_url": string } +export const InputVideo = Schema.Struct({ + "type": Schema.Literal("input_video"), + "video_url": Schema.String.annotate({ + "description": "A base64 data URL or remote URL that resolves to a video file" + }) +}).annotate({ "description": "Video input content item" }) +export type InternalServerResponseErrorData = { readonly "code": number readonly "message": string readonly "metadata"?: {} } -export const ForbiddenResponseErrorData = Schema.Struct({ +export const InternalServerResponseErrorData = Schema.Struct({ "code": Schema.Number.check(Schema.isInt()), "message": Schema.String, "metadata": Schema.optionalKey(Schema.Struct({})) -}).annotate({ "description": "Error data for ForbiddenResponse" }) -export type CreateChargeRequest = { - readonly "amount": number - readonly "sender": string - readonly "chain_id": 1 | 137 | 8453 -} -export const CreateChargeRequest = Schema.Struct({ - "amount": Schema.Number.check(Schema.isFinite()), - "sender": Schema.String, - "chain_id": Schema.Literals([1, 137, 8453]) -}).annotate({ "description": "Create a Coinbase charge for crypto payment" }) -export type PublicPricing = { - readonly "prompt": string - readonly "completion": string - readonly "request"?: string - readonly "image"?: string - readonly "image_token"?: string - readonly "image_output"?: string - readonly "audio"?: string - readonly "audio_output"?: string - readonly "input_audio_cache"?: string - readonly "web_search"?: string - readonly "internal_reasoning"?: string - readonly "input_cache_read"?: string - readonly "input_cache_write"?: string - readonly "discount"?: number +}).annotate({ "description": "Error data for InternalServerResponse" }) +export type ItemReferenceItem = { readonly "id": string; readonly "type": "item_reference" } +export const ItemReferenceItem = Schema.Struct({ "id": Schema.String, "type": Schema.Literal("item_reference") }) + .annotate({ "description": "A reference to a previous response item by ID" }) +export type KeyAssignment = { + readonly "assigned_by": string + readonly "created_at": string + readonly "guardrail_id": string + readonly "id": string + readonly "key_hash": string + readonly "key_label": string + readonly "key_name": string } -export const PublicPricing = Schema.Struct({ - "prompt": Schema.String.annotate({ "description": "A number or string value representing a large number" }), - "completion": Schema.String.annotate({ "description": "A number or string value representing a large number" }), - "request": Schema.optionalKey( - Schema.String.annotate({ "description": "A number or string value representing a large number" }) - ), - "image": Schema.optionalKey( - Schema.String.annotate({ "description": "A number or string value representing a large number" }) - ), - "image_token": Schema.optionalKey( - Schema.String.annotate({ "description": "A number or string value representing a large number" }) +export const KeyAssignment = Schema.Struct({ + "assigned_by": Schema.String.annotate({ "description": "User ID of who made the assignment" }), + "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the assignment was created" }), + "guardrail_id": Schema.String.annotate({ "description": "ID of the guardrail", "format": "uuid" }), + "id": Schema.String.annotate({ "description": "Unique identifier for the assignment", "format": "uuid" }), + "key_hash": Schema.String.annotate({ "description": "Hash of the assigned API key" }), + "key_label": Schema.String.annotate({ "description": "Label of the API key" }), + "key_name": Schema.String.annotate({ "description": "Name of the API key" }) +}) +export type LocalShellCallOutputItem = { + readonly "id": string + readonly "output": string + readonly "status"?: "in_progress" | "completed" | "incomplete" + readonly "type": "local_shell_call_output" +} +export const LocalShellCallOutputItem = Schema.Struct({ + "id": Schema.String, + "output": Schema.String, + "status": Schema.optionalKey(Schema.Literals(["in_progress", "completed", "incomplete"])), + "type": Schema.Literal("local_shell_call_output") +}).annotate({ "description": "Output from a local shell command execution" }) +export type McpApprovalRequestItem = { + readonly "arguments": string + readonly "id": string + readonly "name": string + readonly "server_label": string + readonly "type": "mcp_approval_request" +} +export const McpApprovalRequestItem = Schema.Struct({ + "arguments": Schema.String, + "id": Schema.String, + "name": Schema.String, + "server_label": Schema.String, + "type": Schema.Literal("mcp_approval_request") +}).annotate({ "description": "Request for approval to execute an MCP tool" }) +export type McpApprovalResponseItem = { + readonly "approval_request_id": string + readonly "approve": boolean + readonly "id"?: string + readonly "reason"?: string + readonly "type": "mcp_approval_response" +} +export const McpApprovalResponseItem = Schema.Struct({ + "approval_request_id": Schema.String, + "approve": Schema.Boolean, + "id": Schema.optionalKey(Schema.String), + "reason": Schema.optionalKey(Schema.String), + "type": Schema.Literal("mcp_approval_response") +}).annotate({ "description": "User response to an MCP tool approval request" }) +export type McpCallItem = { + readonly "arguments": string + readonly "error"?: string + readonly "id": string + readonly "name": string + readonly "output"?: string + readonly "server_label": string + readonly "type": "mcp_call" +} +export const McpCallItem = Schema.Struct({ + "arguments": Schema.String, + "error": Schema.optionalKey(Schema.String), + "id": Schema.String, + "name": Schema.String, + "output": Schema.optionalKey(Schema.String), + "server_label": Schema.String, + "type": Schema.Literal("mcp_call") +}).annotate({ "description": "An MCP tool call with its output or error" }) +export type McpListToolsItem = { + readonly "error"?: string + readonly "id": string + readonly "server_label": string + readonly "tools": ReadonlyArray< + { + readonly "annotations"?: unknown + readonly "description"?: string + readonly "input_schema": {} + readonly "name": string + } + > + readonly "type": "mcp_list_tools" +} +export const McpListToolsItem = Schema.Struct({ + "error": Schema.optionalKey(Schema.String), + "id": Schema.String, + "server_label": Schema.String, + "tools": Schema.Array( + Schema.Struct({ + "annotations": Schema.optionalKey(Schema.Unknown), + "description": Schema.optionalKey(Schema.String), + "input_schema": Schema.Struct({}), + "name": Schema.String + }) ), - "image_output": Schema.optionalKey( - Schema.String.annotate({ "description": "A number or string value representing a large number" }) + "type": Schema.Literal("mcp_list_tools") +}).annotate({ "description": "List of available MCP tools from a server" }) +export type McpServerTool = { + readonly "allowed_tools"?: ReadonlyArray | { + readonly "read_only"?: boolean + readonly "tool_names"?: ReadonlyArray + } | unknown + readonly "authorization"?: string + readonly "connector_id"?: + | "connector_dropbox" + | "connector_gmail" + | "connector_googlecalendar" + | "connector_googledrive" + | "connector_microsoftteams" + | "connector_outlookcalendar" + | "connector_outlookemail" + | "connector_sharepoint" + readonly "headers"?: {} + readonly "require_approval"?: + | { + readonly "always"?: { readonly "tool_names"?: ReadonlyArray } + readonly "never"?: { readonly "tool_names"?: ReadonlyArray } + } + | "always" + | "never" + | unknown + readonly "server_description"?: string + readonly "server_label": string + readonly "server_url"?: string + readonly "type": "mcp" +} +export const McpServerTool = Schema.Struct({ + "allowed_tools": Schema.optionalKey( + Schema.Union([ + Schema.Array(Schema.String), + Schema.Struct({ + "read_only": Schema.optionalKey(Schema.Boolean), + "tool_names": Schema.optionalKey(Schema.Array(Schema.String)) + }), + Schema.Unknown + ]) ), - "audio": Schema.optionalKey( - Schema.String.annotate({ "description": "A number or string value representing a large number" }) + "authorization": Schema.optionalKey(Schema.String), + "connector_id": Schema.optionalKey( + Schema.Literals([ + "connector_dropbox", + "connector_gmail", + "connector_googlecalendar", + "connector_googledrive", + "connector_microsoftteams", + "connector_outlookcalendar", + "connector_outlookemail", + "connector_sharepoint" + ]) ), - "audio_output": Schema.optionalKey( - Schema.String.annotate({ "description": "A number or string value representing a large number" }) + "headers": Schema.optionalKey(Schema.Struct({})), + "require_approval": Schema.optionalKey( + Schema.Union([ + Schema.Struct({ + "always": Schema.optionalKey(Schema.Struct({ "tool_names": Schema.optionalKey(Schema.Array(Schema.String)) })), + "never": Schema.optionalKey(Schema.Struct({ "tool_names": Schema.optionalKey(Schema.Array(Schema.String)) })) + }), + Schema.Literal("always"), + Schema.Literal("never"), + Schema.Unknown + ]) ), - "input_audio_cache": Schema.optionalKey( - Schema.String.annotate({ "description": "A number or string value representing a large number" }) - ), - "web_search": Schema.optionalKey( - Schema.String.annotate({ "description": "A number or string value representing a large number" }) - ), - "internal_reasoning": Schema.optionalKey( - Schema.String.annotate({ "description": "A number or string value representing a large number" }) - ), - "input_cache_read": Schema.optionalKey( - Schema.String.annotate({ "description": "A number or string value representing a large number" }) + "server_description": Schema.optionalKey(Schema.String), + "server_label": Schema.String, + "server_url": Schema.optionalKey(Schema.String), + "type": Schema.Literal("mcp") +}).annotate({ "description": "MCP (Model Context Protocol) tool configuration" }) +export type MemberAssignment = { + readonly "assigned_by": string + readonly "created_at": string + readonly "guardrail_id": string + readonly "id": string + readonly "organization_id": string + readonly "user_id": string +} +export const MemberAssignment = Schema.Struct({ + "assigned_by": Schema.String.annotate({ "description": "User ID of who made the assignment" }), + "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the assignment was created" }), + "guardrail_id": Schema.String.annotate({ "description": "ID of the guardrail", "format": "uuid" }), + "id": Schema.String.annotate({ "description": "Unique identifier for the assignment", "format": "uuid" }), + "organization_id": Schema.String.annotate({ "description": "Organization ID" }), + "user_id": Schema.String.annotate({ "description": "Clerk user ID of the assigned member" }) +}) +export type MessagesAdvisorToolResultBlock = { + readonly "content": {} + readonly "tool_use_id": string + readonly "type": "advisor_tool_result" +} +export const MessagesAdvisorToolResultBlock = Schema.Struct({ + "content": Schema.Struct({}), + "tool_use_id": Schema.String, + "type": Schema.Literal("advisor_tool_result") +}).annotate({ + "description": + "Advisor tool result from a prior assistant turn, replayed back to the model on the next turn. Mirrors the block Anthropic returns in assistant content when the `advisor_20260301` tool runs." +}) +export type MessagesContentBlockStopEvent = { readonly "index": number; readonly "type": "content_block_stop" } +export const MessagesContentBlockStopEvent = Schema.Struct({ + "index": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("content_block_stop") +}).annotate({ "description": "Event sent when a content block is complete" }) +export type MessagesErrorDetail = { readonly "message": string; readonly "type": string } +export const MessagesErrorDetail = Schema.Struct({ "message": Schema.String, "type": Schema.String }) +export type MessagesErrorEvent = { + readonly "error": { readonly "message": string; readonly "type": string } + readonly "type": "error" +} +export const MessagesErrorEvent = Schema.Struct({ + "error": Schema.Struct({ "message": Schema.String, "type": Schema.String }), + "type": Schema.Literal("error") +}).annotate({ "description": "Error event in the stream" }) +export type MessagesOutputConfig = { + readonly "effort"?: "low" | "medium" | "high" | "xhigh" | "max" | null + readonly "format"?: { readonly "schema": {}; readonly "type": "json_schema" } + readonly "task_budget"?: { readonly "remaining"?: number; readonly "total": number; readonly "type": "tokens" } +} +export const MessagesOutputConfig = Schema.Struct({ + "effort": Schema.optionalKey( + Schema.Union([ + Schema.Literal("low"), + Schema.Literal("medium"), + Schema.Literal("high"), + Schema.Literal("xhigh"), + Schema.Literal("max"), + Schema.Null + ]).annotate({ + "description": + "How much effort the model should put into its response. Higher effort levels may result in more thorough analysis but take longer. Valid values are `low`, `medium`, `high`, `xhigh`, or `max`." + }) ), - "input_cache_write": Schema.optionalKey( - Schema.String.annotate({ "description": "A number or string value representing a large number" }) + "format": Schema.optionalKey( + Schema.Struct({ "schema": Schema.Struct({}), "type": Schema.Literal("json_schema") }).annotate({ + "description": + "A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)." + }) ), - "discount": Schema.optionalKey(Schema.Number.check(Schema.isFinite())) -}).annotate({ "description": "Pricing information for the model" }) + "task_budget": Schema.optionalKey( + Schema.Struct({ + "remaining": Schema.optionalKey(Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0))), + "total": Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(20000)), + "type": Schema.Literal("tokens") + }).annotate({ + "description": + "Task budget for an agentic turn. The model sees a countdown of remaining tokens and uses it to prioritize work and wind down gracefully. Advisory — does not enforce a hard cap." + }) + ) +}).annotate({ + "description": + "Configuration for controlling output behavior. Supports the effort parameter and structured output format." +}) +export type MessagesPingEvent = { readonly "type": "ping" } +export const MessagesPingEvent = Schema.Struct({ "type": Schema.Literal("ping") }).annotate({ + "description": "Keep-alive ping event" +}) +export type MetadataLevel = "disabled" | "enabled" +export const MetadataLevel = Schema.Literals(["disabled", "enabled"]).annotate({ + "description": "Opt-in level for surfacing routing metadata on the response under `openrouter_metadata`." +}) export type ModelGroup = | "Router" | "Media" @@ -2396,6 +2468,7 @@ export type ModelGroup = | "GPT" | "Claude" | "Gemini" + | "Gemma" | "Grok" | "Cohere" | "Nova" @@ -2416,6 +2489,7 @@ export const ModelGroup = Schema.Literals([ "GPT", "Claude", "Gemini", + "Gemma", "Grok", "Cohere", "Nova", @@ -2430,35 +2504,315 @@ export const ModelGroup = Schema.Literals([ "RWKV", "Qwen3" ]).annotate({ "description": "Tokenizer type used by the model" }) -export type InputModality = "text" | "image" | "file" | "audio" | "video" -export const InputModality = Schema.Literals(["text", "image", "file", "audio", "video"]) -export type OutputModality = "text" | "image" | "embeddings" | "audio" -export const OutputModality = Schema.Literals(["text", "image", "embeddings", "audio"]) -export type TopProviderInfo = { - readonly "context_length"?: number - readonly "max_completion_tokens"?: number - readonly "is_moderated": boolean +export type ModelLinks = { readonly "details": string } +export const ModelLinks = Schema.Struct({ + "details": Schema.String.annotate({ "description": "URL for the model details/endpoints API" }) +}).annotate({ "description": "Related API endpoints and resources for this model." }) +export type ModelName = string +export const ModelName = Schema.String.annotate({ "description": "Model to use for completion" }) +export type ModelsCountResponse = { readonly "data": { readonly "count": number } } +export const ModelsCountResponse = Schema.Struct({ + "data": Schema.Struct({ + "count": Schema.Number.annotate({ "description": "Total number of available models" }).check(Schema.isInt()) + }).annotate({ "description": "Model count data" }) +}).annotate({ "description": "Model count data" }) +export type ModerationPlugin = { readonly "id": "moderation" } +export const ModerationPlugin = Schema.Struct({ "id": Schema.Literal("moderation") }) +export type MultimodalMedia = { readonly "data": string; readonly "format"?: string } +export const MultimodalMedia = Schema.Struct({ "data": Schema.String, "format": Schema.optionalKey(Schema.String) }) +export type NotFoundResponseErrorData = { + readonly "code": number + readonly "message": string + readonly "metadata"?: {} } -export const TopProviderInfo = Schema.Struct({ - "context_length": Schema.optionalKey( - Schema.Number.annotate({ "description": "Context length from the top provider" }).check(Schema.isFinite()) +export const NotFoundResponseErrorData = Schema.Struct({ + "code": Schema.Number.check(Schema.isInt()), + "message": Schema.String, + "metadata": Schema.optionalKey(Schema.Struct({})) +}).annotate({ "description": "Error data for NotFoundResponse" }) +export type ObservabilityFilterRulesConfig = { + readonly "enabled"?: boolean + readonly "groups": ReadonlyArray< + { + readonly "logic"?: "and" | "or" + readonly "rules": ReadonlyArray< + { + readonly "field": + | "model" + | "provider" + | "session_id" + | "user_id" + | "api_key_name" + | "finish_reason" + | "input" + | "output" + | "total_cost" + | "total_tokens" + | "prompt_tokens" + | "completion_tokens" + readonly "operator": + | "equals" + | "not_equals" + | "contains" + | "not_contains" + | "regex" + | "starts_with" + | "ends_with" + | "gt" + | "lt" + | "gte" + | "lte" + | "exists" + | "not_exists" + readonly "value"?: string | number + } + > + } + > +} +export const ObservabilityFilterRulesConfig = Schema.Struct({ + "enabled": Schema.optionalKey(Schema.Boolean), + "groups": Schema.Array(Schema.Struct({ + "logic": Schema.optionalKey(Schema.Literals(["and", "or"])), + "rules": Schema.Array(Schema.Struct({ + "field": Schema.Literals([ + "model", + "provider", + "session_id", + "user_id", + "api_key_name", + "finish_reason", + "input", + "output", + "total_cost", + "total_tokens", + "prompt_tokens", + "completion_tokens" + ]), + "operator": Schema.Literals([ + "equals", + "not_equals", + "contains", + "not_contains", + "regex", + "starts_with", + "ends_with", + "gt", + "lt", + "gte", + "lte", + "exists", + "not_exists" + ]), + "value": Schema.optionalKey(Schema.Union([Schema.String, Schema.Number.check(Schema.isFinite())])) + })) + })) +}).annotate({ "description": "Optional structured filter rules controlling which events are forwarded." }) +export type OpenAIResponseCustomToolCall = { + readonly "call_id": string + readonly "id"?: string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + readonly "type": "custom_tool_call" +} +export const OpenAIResponseCustomToolCall = Schema.Struct({ + "call_id": Schema.String, + "id": Schema.optionalKey(Schema.String), + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) ), - "max_completion_tokens": Schema.optionalKey( - Schema.Number.annotate({ "description": "Maximum completion tokens from the top provider" }).check( - Schema.isFinite() - ) + "type": Schema.Literal("custom_tool_call") +}) +export type OpenAIResponsesRefusalContent = { readonly "refusal": string; readonly "type": "refusal" } +export const OpenAIResponsesRefusalContent = Schema.Struct({ + "refusal": Schema.String, + "type": Schema.Literal("refusal") +}) +export type OpenAIResponsesResponseStatus = + | "completed" + | "incomplete" + | "in_progress" + | "failed" + | "cancelled" + | "queued" +export const OpenAIResponsesResponseStatus = Schema.Literals([ + "completed", + "incomplete", + "in_progress", + "failed", + "cancelled", + "queued" +]) +export type OpenAIResponsesTruncation = "auto" | "disabled" | null +export const OpenAIResponsesTruncation = Schema.Union([Schema.Literal("auto"), Schema.Literal("disabled"), Schema.Null]) +export type OpenAIResponsesUsage = { + readonly "input_tokens": number + readonly "input_tokens_details": { readonly "cached_tokens": number } + readonly "output_tokens": number + readonly "output_tokens_details": { readonly "reasoning_tokens": number } + readonly "total_tokens": number +} +export const OpenAIResponsesUsage = Schema.Struct({ + "input_tokens": Schema.Number.check(Schema.isInt()), + "input_tokens_details": Schema.Struct({ "cached_tokens": Schema.Number.check(Schema.isInt()) }), + "output_tokens": Schema.Number.check(Schema.isInt()), + "output_tokens_details": Schema.Struct({ "reasoning_tokens": Schema.Number.check(Schema.isInt()) }), + "total_tokens": Schema.Number.check(Schema.isInt()) +}) +export type OpenResponsesTopLogprobs = { + readonly "bytes"?: ReadonlyArray + readonly "logprob"?: number + readonly "token"?: string +} +export const OpenResponsesTopLogprobs = Schema.Struct({ + "bytes": Schema.optionalKey(Schema.Array(Schema.Number.check(Schema.isInt()))), + "logprob": Schema.optionalKey(Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite())), + "token": Schema.optionalKey(Schema.String) +}).annotate({ "description": "Alternative token with its log probability" }) +export type ORAnthropicStopReason = + | "end_turn" + | "max_tokens" + | "stop_sequence" + | "tool_use" + | "pause_turn" + | "refusal" + | "compaction" + | null +export const ORAnthropicStopReason = Schema.Union([ + Schema.Literal("end_turn"), + Schema.Literal("max_tokens"), + Schema.Literal("stop_sequence"), + Schema.Literal("tool_use"), + Schema.Literal("pause_turn"), + Schema.Literal("refusal"), + Schema.Literal("compaction"), + Schema.Null +]) +export type OutputComputerCallItem = { + readonly "action"?: unknown + readonly "call_id": string + readonly "id"?: string + readonly "pending_safety_checks": ReadonlyArray< + { readonly "code": string; readonly "id": string; readonly "message": string } + > + readonly "status": "completed" | "incomplete" | "in_progress" + readonly "type": "computer_call" +} +export const OutputComputerCallItem = Schema.Struct({ + "action": Schema.optionalKey(Schema.Unknown), + "call_id": Schema.String, + "id": Schema.optionalKey(Schema.String), + "pending_safety_checks": Schema.Array( + Schema.Struct({ "code": Schema.String, "id": Schema.String, "message": Schema.String }) ), - "is_moderated": Schema.Boolean.annotate({ "description": "Whether the top provider moderates content" }) -}).annotate({ "description": "Information about the top provider for this model" }) -export type PerRequestLimits = { readonly "prompt_tokens": number; readonly "completion_tokens": number } -export const PerRequestLimits = Schema.Struct({ - "prompt_tokens": Schema.Number.annotate({ "description": "Maximum prompt tokens per request" }).check( - Schema.isFinite() + "status": Schema.Literals(["completed", "incomplete", "in_progress"]), + "type": Schema.Literal("computer_call") +}) +export type OutputCustomToolCallItem = { + readonly "call_id": string + readonly "id"?: string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + readonly "type": "custom_tool_call" +} +export const OutputCustomToolCallItem = Schema.Struct({ + "call_id": Schema.String, + "id": Schema.optionalKey(Schema.String), + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) ), - "completion_tokens": Schema.Number.annotate({ "description": "Maximum completion tokens per request" }).check( - Schema.isFinite() - ) -}).annotate({ "description": "Per-request token limits" }) + "type": Schema.Literal("custom_tool_call") +}).annotate({ + "description": + "A call to a custom (freeform-grammar) tool created by the model — distinct from `function_call`. Used for tools like Codex CLI's `apply_patch` whose payload is opaque text rather than JSON arguments." +}) +export type OutputFunctionCallItem = { + readonly "arguments": string + readonly "call_id": string + readonly "id"?: string + readonly "name": string + readonly "namespace"?: string + readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "type": "function_call" +} +export const OutputFunctionCallItem = Schema.Struct({ + "arguments": Schema.String, + "call_id": Schema.String, + "id": Schema.optionalKey(Schema.String), + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ), + "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])), + "type": Schema.Literal("function_call") +}) +export type OutputItemCustomToolCall = { + readonly "call_id": string + readonly "id"?: string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + readonly "type": "custom_tool_call" +} +export const OutputItemCustomToolCall = Schema.Struct({ + "call_id": Schema.String, + "id": Schema.optionalKey(Schema.String), + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ), + "type": Schema.Literal("custom_tool_call") +}) +export type OutputItemFunctionCall = { + readonly "arguments": string + readonly "call_id": string + readonly "id"?: string + readonly "name": string + readonly "namespace"?: string + readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "type": "function_call" +} +export const OutputItemFunctionCall = Schema.Struct({ + "arguments": Schema.String, + "call_id": Schema.String, + "id": Schema.optionalKey(Schema.String), + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ), + "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])), + "type": Schema.Literal("function_call") +}) +export type OutputModality = "text" | "image" | "embeddings" | "audio" | "video" | "rerank" | "speech" | "transcription" +export const OutputModality = Schema.Literals([ + "text", + "image", + "embeddings", + "audio", + "video", + "rerank", + "speech", + "transcription" +]) +export type OutputModalityEnum = "text" | "image" +export const OutputModalityEnum = Schema.Literals(["text", "image"]) export type Parameter = | "temperature" | "top_p" @@ -2469,6 +2823,7 @@ export type Parameter = | "presence_penalty" | "repetition_penalty" | "max_tokens" + | "max_completion_tokens" | "logit_bias" | "logprobs" | "top_logprobs" @@ -2494,6 +2849,7 @@ export const Parameter = Schema.Literals([ "presence_penalty", "repetition_penalty", "max_tokens", + "max_completion_tokens", "logit_bias", "logprobs", "top_logprobs", @@ -2510,57 +2866,200 @@ export const Parameter = Schema.Literals([ "web_search_options", "verbosity" ]) -export type DefaultParameters = { - readonly "temperature"?: number - readonly "top_p"?: number - readonly "frequency_penalty"?: number +export type ParetoRouterPlugin = { + readonly "enabled"?: boolean + readonly "id": "pareto-router" + readonly "min_coding_score"?: number } -export const DefaultParameters = Schema.Struct({ - "temperature": Schema.optionalKey( - Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(2)) - ), - "top_p": Schema.optionalKey( - Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)) +export const ParetoRouterPlugin = Schema.Struct({ + "enabled": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": "Set to false to disable the pareto-router plugin for this request. Defaults to true." + }) ), - "frequency_penalty": Schema.optionalKey( - Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(-2)).check(Schema.isLessThanOrEqualTo(2)) + "id": Schema.Literal("pareto-router"), + "min_coding_score": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "Minimum desired coding score between 0 and 1, where 1 is best. Higher values select from stronger coding models (sourced from Artificial Analysis coding percentiles). Maps internally to one of three tiers (low, medium, high). Omit to use the router default tier.", + "format": "double" + }).check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(1)) ) -}).annotate({ "description": "Default parameters for this model" }) -export type ModelsCountResponse = { readonly "data": { readonly "count": number } } -export const ModelsCountResponse = Schema.Struct({ - "data": Schema.Struct({ - "count": Schema.Number.annotate({ "description": "Total number of available models" }).check(Schema.isFinite()) - }).annotate({ "description": "Model count data" }) -}).annotate({ "description": "Model count data" }) -export type EndpointStatus = 0 | -1 | -2 | -3 | -5 | -10 -export const EndpointStatus = Schema.Literals([0, -1, -2, -3, -5, -10]) -export type PercentileStats = { - readonly "p50": number - readonly "p75": number - readonly "p90": number - readonly "p99": number +}) +export type PayloadTooLargeResponseErrorData = { + readonly "code": number + readonly "message": string + readonly "metadata"?: {} } -export const PercentileStats = Schema.Struct({ - "p50": Schema.Number.annotate({ "description": "Median (50th percentile)" }).check(Schema.isFinite()), - "p75": Schema.Number.annotate({ "description": "75th percentile" }).check(Schema.isFinite()), - "p90": Schema.Number.annotate({ "description": "90th percentile" }).check(Schema.isFinite()), - "p99": Schema.Number.annotate({ "description": "99th percentile" }).check(Schema.isFinite()) -}).annotate({ +export const PayloadTooLargeResponseErrorData = Schema.Struct({ + "code": Schema.Number.check(Schema.isInt()), + "message": Schema.String, + "metadata": Schema.optionalKey(Schema.Struct({})) +}).annotate({ "description": "Error data for PayloadTooLargeResponse" }) +export type PaymentRequiredResponseErrorData = { + readonly "code": number + readonly "message": string + readonly "metadata"?: {} +} +export const PaymentRequiredResponseErrorData = Schema.Struct({ + "code": Schema.Number.check(Schema.isInt()), + "message": Schema.String, + "metadata": Schema.optionalKey(Schema.Struct({})) +}).annotate({ "description": "Error data for PaymentRequiredResponse" }) +export type PDFParserEngine = "mistral-ocr" | "native" | "cloudflare-ai" | "pdf-text" +export const PDFParserEngine = Schema.Union([ + Schema.Literals(["mistral-ocr", "native", "cloudflare-ai"]), + Schema.Literal("pdf-text") +]).annotate({ "description": - "Latency percentiles in milliseconds over the last 30 minutes. Latency measures time to first token. Only visible when authenticated with an API key or cookie; returns null for unauthenticated requests." + "The engine to use for parsing PDF files. \"pdf-text\" is deprecated and automatically redirected to \"cloudflare-ai\"." }) -export type __schema5 = ReadonlyArray< - | "AI21" - | "AionLabs" - | "Alibaba" - | "Ambient" - | "Amazon Bedrock" - | "Amazon Nova" - | "Anthropic" - | "Arcee AI" - | "AtlasCloud" - | "Avian" - | "Azure" +export type PercentileLatencyCutoffs = { + readonly "p50"?: number + readonly "p75"?: number + readonly "p90"?: number + readonly "p99"?: number +} +export const PercentileLatencyCutoffs = Schema.Struct({ + "p50": Schema.optionalKey( + Schema.Number.annotate({ "description": "Maximum p50 latency (seconds)", "format": "double" }).check( + Schema.isFinite() + ) + ), + "p75": Schema.optionalKey( + Schema.Number.annotate({ "description": "Maximum p75 latency (seconds)", "format": "double" }).check( + Schema.isFinite() + ) + ), + "p90": Schema.optionalKey( + Schema.Number.annotate({ "description": "Maximum p90 latency (seconds)", "format": "double" }).check( + Schema.isFinite() + ) + ), + "p99": Schema.optionalKey( + Schema.Number.annotate({ "description": "Maximum p99 latency (seconds)", "format": "double" }).check( + Schema.isFinite() + ) + ) +}).annotate({ + "description": "Percentile-based latency cutoffs. All specified cutoffs must be met for an endpoint to be preferred." +}) +export type PercentileStats = { + readonly "p50": number + readonly "p75": number + readonly "p90": number + readonly "p99": number +} +export const PercentileStats = Schema.Struct({ + "p50": Schema.Number.annotate({ "description": "Median (50th percentile)", "format": "double" }).check( + Schema.isFinite() + ), + "p75": Schema.Number.annotate({ "description": "75th percentile", "format": "double" }).check(Schema.isFinite()), + "p90": Schema.Number.annotate({ "description": "90th percentile", "format": "double" }).check(Schema.isFinite()), + "p99": Schema.Number.annotate({ "description": "99th percentile", "format": "double" }).check(Schema.isFinite()) +}).annotate({ + "description": + "Latency percentiles in milliseconds over the last 30 minutes. Latency measures time to first token. Only visible when authenticated with an API key or cookie; returns null for unauthenticated requests." +}) +export type PercentileThroughputCutoffs = { + readonly "p50"?: number + readonly "p75"?: number + readonly "p90"?: number + readonly "p99"?: number +} +export const PercentileThroughputCutoffs = Schema.Struct({ + "p50": Schema.optionalKey( + Schema.Number.annotate({ "description": "Minimum p50 throughput (tokens/sec)", "format": "double" }).check( + Schema.isFinite() + ) + ), + "p75": Schema.optionalKey( + Schema.Number.annotate({ "description": "Minimum p75 throughput (tokens/sec)", "format": "double" }).check( + Schema.isFinite() + ) + ), + "p90": Schema.optionalKey( + Schema.Number.annotate({ "description": "Minimum p90 throughput (tokens/sec)", "format": "double" }).check( + Schema.isFinite() + ) + ), + "p99": Schema.optionalKey( + Schema.Number.annotate({ "description": "Minimum p99 throughput (tokens/sec)", "format": "double" }).check( + Schema.isFinite() + ) + ) +}).annotate({ + "description": + "Percentile-based throughput cutoffs. All specified cutoffs must be met for an endpoint to be preferred." +}) +export type PerRequestLimits = { readonly "completion_tokens": number; readonly "prompt_tokens": number } +export const PerRequestLimits = Schema.Struct({ + "completion_tokens": Schema.Number.annotate({ "description": "Maximum completion tokens per request" }).check( + Schema.isFinite() + ), + "prompt_tokens": Schema.Number.annotate({ "description": "Maximum prompt tokens per request" }).check( + Schema.isFinite() + ) +}).annotate({ "description": "Per-request token limits" }) +export type PipelineStageType = "guardrail" | "plugin" | "server_tools" | "response_healing" | "context_compression" +export const PipelineStageType = Schema.Literals([ + "guardrail", + "plugin", + "server_tools", + "response_healing", + "context_compression" +]).annotate({ + "description": + "Categorical kind of a pipeline stage. Multiple plugins can share a type (e.g. all guardrail-level plugins emit `guardrail`); the `name` field disambiguates which plugin emitted it." +}) +export type PresetDesignatedVersion = { + readonly "config": {} + readonly "created_at": string + readonly "creator_id": string + readonly "id": string + readonly "preset_id": string + readonly "system_prompt": string + readonly "updated_at": string + readonly "version": number +} +export const PresetDesignatedVersion = Schema.Struct({ + "config": Schema.Struct({}), + "created_at": Schema.String, + "creator_id": Schema.String, + "id": Schema.String, + "preset_id": Schema.String, + "system_prompt": Schema.String, + "updated_at": Schema.String, + "version": Schema.Number.check(Schema.isInt()) +}).annotate({ "description": "A specific version of a preset, containing config and optional system prompt." }) +export type Preview_WebSearchUserLocation = { + readonly "city"?: string + readonly "country"?: string + readonly "region"?: string + readonly "timezone"?: string + readonly "type": "approximate" +} +export const Preview_WebSearchUserLocation = Schema.Struct({ + "city": Schema.optionalKey(Schema.String), + "country": Schema.optionalKey(Schema.String), + "region": Schema.optionalKey(Schema.String), + "timezone": Schema.optionalKey(Schema.String), + "type": Schema.Literal("approximate") +}) +export type ProviderName = + | "AkashML" + | "AI21" + | "AionLabs" + | "Alibaba" + | "Ambient" + | "Baidu" + | "Amazon Bedrock" + | "Amazon Nova" + | "Anthropic" + | "Arcee AI" + | "AtlasCloud" + | "Avian" + | "Azure" | "BaseTen" | "BytePlus" | "Black Forest Labs" @@ -2570,9 +3069,12 @@ export type __schema5 = ReadonlyArray< | "Clarifai" | "Cloudflare" | "Cohere" + | "Crucible" | "Crusoe" | "DeepInfra" | "DeepSeek" + | "DekaLLM" + | "DigitalOcean" | "Featherless" | "Fireworks" | "Friendli" @@ -2584,6 +3086,7 @@ export type __schema5 = ReadonlyArray< | "Inception" | "Inceptron" | "InferenceNet" + | "Ionstream" | "Infermatic" | "Io Net" | "Inflection" @@ -2598,14 +3101,19 @@ export type __schema5 = ReadonlyArray< | "Morph" | "NCompass" | "Nebius" + | "Nex AGI" | "NextBit" | "Novita" | "Nvidia" | "OpenAI" | "OpenInference" | "Parasail" + | "Poolside" + | "Perceptron" | "Perplexity" | "Phala" + | "Recraft" + | "Reka" | "Relace" | "SambaNova" | "Seed" @@ -2623,15 +3131,500 @@ export type __schema5 = ReadonlyArray< | "xAI" | "Z.AI" | "FakeProvider" - | string -> -export const __schema5 = Schema.Array( - Schema.Union([ +export const ProviderName = Schema.Literals([ + "AkashML", + "AI21", + "AionLabs", + "Alibaba", + "Ambient", + "Baidu", + "Amazon Bedrock", + "Amazon Nova", + "Anthropic", + "Arcee AI", + "AtlasCloud", + "Avian", + "Azure", + "BaseTen", + "BytePlus", + "Black Forest Labs", + "Cerebras", + "Chutes", + "Cirrascale", + "Clarifai", + "Cloudflare", + "Cohere", + "Crucible", + "Crusoe", + "DeepInfra", + "DeepSeek", + "DekaLLM", + "DigitalOcean", + "Featherless", + "Fireworks", + "Friendli", + "GMICloud", + "Google", + "Google AI Studio", + "Groq", + "Hyperbolic", + "Inception", + "Inceptron", + "InferenceNet", + "Ionstream", + "Infermatic", + "Io Net", + "Inflection", + "Liquid", + "Mara", + "Mancer 2", + "Minimax", + "ModelRun", + "Mistral", + "Modular", + "Moonshot AI", + "Morph", + "NCompass", + "Nebius", + "Nex AGI", + "NextBit", + "Novita", + "Nvidia", + "OpenAI", + "OpenInference", + "Parasail", + "Poolside", + "Perceptron", + "Perplexity", + "Phala", + "Recraft", + "Reka", + "Relace", + "SambaNova", + "Seed", + "SiliconFlow", + "Sourceful", + "StepFun", + "Stealth", + "StreamLake", + "Switchpoint", + "Together", + "Upstage", + "Venice", + "WandB", + "Xiaomi", + "xAI", + "Z.AI", + "FakeProvider" +]) +export type ProviderOptions = { + readonly "01ai"?: {} + readonly "ai21"?: {} + readonly "aion-labs"?: {} + readonly "akashml"?: {} + readonly "alibaba"?: {} + readonly "amazon-bedrock"?: {} + readonly "amazon-nova"?: {} + readonly "ambient"?: {} + readonly "anthropic"?: {} + readonly "anyscale"?: {} + readonly "arcee-ai"?: {} + readonly "atlas-cloud"?: {} + readonly "atoma"?: {} + readonly "avian"?: {} + readonly "azure"?: {} + readonly "baidu"?: {} + readonly "baseten"?: {} + readonly "black-forest-labs"?: {} + readonly "byteplus"?: {} + readonly "centml"?: {} + readonly "cerebras"?: {} + readonly "chutes"?: {} + readonly "cirrascale"?: {} + readonly "clarifai"?: {} + readonly "cloudflare"?: {} + readonly "cohere"?: {} + readonly "crofai"?: {} + readonly "crucible"?: {} + readonly "crusoe"?: {} + readonly "deepinfra"?: {} + readonly "deepseek"?: {} + readonly "dekallm"?: {} + readonly "digitalocean"?: {} + readonly "enfer"?: {} + readonly "fake-provider"?: {} + readonly "featherless"?: {} + readonly "fireworks"?: {} + readonly "friendli"?: {} + readonly "gmicloud"?: {} + readonly "google-ai-studio"?: {} + readonly "google-vertex"?: {} + readonly "gopomelo"?: {} + readonly "groq"?: {} + readonly "huggingface"?: {} + readonly "hyperbolic"?: {} + readonly "hyperbolic-quantized"?: {} + readonly "inception"?: {} + readonly "inceptron"?: {} + readonly "inference-net"?: {} + readonly "infermatic"?: {} + readonly "inflection"?: {} + readonly "inocloud"?: {} + readonly "io-net"?: {} + readonly "ionstream"?: {} + readonly "klusterai"?: {} + readonly "lambda"?: {} + readonly "lepton"?: {} + readonly "liquid"?: {} + readonly "lynn"?: {} + readonly "lynn-private"?: {} + readonly "mancer"?: {} + readonly "mancer-old"?: {} + readonly "mara"?: {} + readonly "meta"?: {} + readonly "minimax"?: {} + readonly "mistral"?: {} + readonly "modal"?: {} + readonly "modelrun"?: {} + readonly "modular"?: {} + readonly "moonshotai"?: {} + readonly "morph"?: {} + readonly "ncompass"?: {} + readonly "nebius"?: {} + readonly "nex-agi"?: {} + readonly "nextbit"?: {} + readonly "nineteen"?: {} + readonly "novita"?: {} + readonly "nvidia"?: {} + readonly "octoai"?: {} + readonly "open-inference"?: {} + readonly "openai"?: {} + readonly "parasail"?: {} + readonly "perceptron"?: {} + readonly "perplexity"?: {} + readonly "phala"?: {} + readonly "poolside"?: {} + readonly "recraft"?: {} + readonly "recursal"?: {} + readonly "reflection"?: {} + readonly "reka"?: {} + readonly "relace"?: {} + readonly "replicate"?: {} + readonly "sambanova"?: {} + readonly "sambanova-cloaked"?: {} + readonly "seed"?: {} + readonly "sf-compute"?: {} + readonly "siliconflow"?: {} + readonly "sourceful"?: {} + readonly "stealth"?: {} + readonly "stepfun"?: {} + readonly "streamlake"?: {} + readonly "switchpoint"?: {} + readonly "targon"?: {} + readonly "together"?: {} + readonly "together-lite"?: {} + readonly "ubicloud"?: {} + readonly "upstage"?: {} + readonly "venice"?: {} + readonly "wandb"?: {} + readonly "xai"?: {} + readonly "xiaomi"?: {} + readonly "z-ai"?: {} +} +export const ProviderOptions = Schema.Struct({ + "01ai": Schema.optionalKey(Schema.Struct({})), + "ai21": Schema.optionalKey(Schema.Struct({})), + "aion-labs": Schema.optionalKey(Schema.Struct({})), + "akashml": Schema.optionalKey(Schema.Struct({})), + "alibaba": Schema.optionalKey(Schema.Struct({})), + "amazon-bedrock": Schema.optionalKey(Schema.Struct({})), + "amazon-nova": Schema.optionalKey(Schema.Struct({})), + "ambient": Schema.optionalKey(Schema.Struct({})), + "anthropic": Schema.optionalKey(Schema.Struct({})), + "anyscale": Schema.optionalKey(Schema.Struct({})), + "arcee-ai": Schema.optionalKey(Schema.Struct({})), + "atlas-cloud": Schema.optionalKey(Schema.Struct({})), + "atoma": Schema.optionalKey(Schema.Struct({})), + "avian": Schema.optionalKey(Schema.Struct({})), + "azure": Schema.optionalKey(Schema.Struct({})), + "baidu": Schema.optionalKey(Schema.Struct({})), + "baseten": Schema.optionalKey(Schema.Struct({})), + "black-forest-labs": Schema.optionalKey(Schema.Struct({})), + "byteplus": Schema.optionalKey(Schema.Struct({})), + "centml": Schema.optionalKey(Schema.Struct({})), + "cerebras": Schema.optionalKey(Schema.Struct({})), + "chutes": Schema.optionalKey(Schema.Struct({})), + "cirrascale": Schema.optionalKey(Schema.Struct({})), + "clarifai": Schema.optionalKey(Schema.Struct({})), + "cloudflare": Schema.optionalKey(Schema.Struct({})), + "cohere": Schema.optionalKey(Schema.Struct({})), + "crofai": Schema.optionalKey(Schema.Struct({})), + "crucible": Schema.optionalKey(Schema.Struct({})), + "crusoe": Schema.optionalKey(Schema.Struct({})), + "deepinfra": Schema.optionalKey(Schema.Struct({})), + "deepseek": Schema.optionalKey(Schema.Struct({})), + "dekallm": Schema.optionalKey(Schema.Struct({})), + "digitalocean": Schema.optionalKey(Schema.Struct({})), + "enfer": Schema.optionalKey(Schema.Struct({})), + "fake-provider": Schema.optionalKey(Schema.Struct({})), + "featherless": Schema.optionalKey(Schema.Struct({})), + "fireworks": Schema.optionalKey(Schema.Struct({})), + "friendli": Schema.optionalKey(Schema.Struct({})), + "gmicloud": Schema.optionalKey(Schema.Struct({})), + "google-ai-studio": Schema.optionalKey(Schema.Struct({})), + "google-vertex": Schema.optionalKey(Schema.Struct({})), + "gopomelo": Schema.optionalKey(Schema.Struct({})), + "groq": Schema.optionalKey(Schema.Struct({})), + "huggingface": Schema.optionalKey(Schema.Struct({})), + "hyperbolic": Schema.optionalKey(Schema.Struct({})), + "hyperbolic-quantized": Schema.optionalKey(Schema.Struct({})), + "inception": Schema.optionalKey(Schema.Struct({})), + "inceptron": Schema.optionalKey(Schema.Struct({})), + "inference-net": Schema.optionalKey(Schema.Struct({})), + "infermatic": Schema.optionalKey(Schema.Struct({})), + "inflection": Schema.optionalKey(Schema.Struct({})), + "inocloud": Schema.optionalKey(Schema.Struct({})), + "io-net": Schema.optionalKey(Schema.Struct({})), + "ionstream": Schema.optionalKey(Schema.Struct({})), + "klusterai": Schema.optionalKey(Schema.Struct({})), + "lambda": Schema.optionalKey(Schema.Struct({})), + "lepton": Schema.optionalKey(Schema.Struct({})), + "liquid": Schema.optionalKey(Schema.Struct({})), + "lynn": Schema.optionalKey(Schema.Struct({})), + "lynn-private": Schema.optionalKey(Schema.Struct({})), + "mancer": Schema.optionalKey(Schema.Struct({})), + "mancer-old": Schema.optionalKey(Schema.Struct({})), + "mara": Schema.optionalKey(Schema.Struct({})), + "meta": Schema.optionalKey(Schema.Struct({})), + "minimax": Schema.optionalKey(Schema.Struct({})), + "mistral": Schema.optionalKey(Schema.Struct({})), + "modal": Schema.optionalKey(Schema.Struct({})), + "modelrun": Schema.optionalKey(Schema.Struct({})), + "modular": Schema.optionalKey(Schema.Struct({})), + "moonshotai": Schema.optionalKey(Schema.Struct({})), + "morph": Schema.optionalKey(Schema.Struct({})), + "ncompass": Schema.optionalKey(Schema.Struct({})), + "nebius": Schema.optionalKey(Schema.Struct({})), + "nex-agi": Schema.optionalKey(Schema.Struct({})), + "nextbit": Schema.optionalKey(Schema.Struct({})), + "nineteen": Schema.optionalKey(Schema.Struct({})), + "novita": Schema.optionalKey(Schema.Struct({})), + "nvidia": Schema.optionalKey(Schema.Struct({})), + "octoai": Schema.optionalKey(Schema.Struct({})), + "open-inference": Schema.optionalKey(Schema.Struct({})), + "openai": Schema.optionalKey(Schema.Struct({})), + "parasail": Schema.optionalKey(Schema.Struct({})), + "perceptron": Schema.optionalKey(Schema.Struct({})), + "perplexity": Schema.optionalKey(Schema.Struct({})), + "phala": Schema.optionalKey(Schema.Struct({})), + "poolside": Schema.optionalKey(Schema.Struct({})), + "recraft": Schema.optionalKey(Schema.Struct({})), + "recursal": Schema.optionalKey(Schema.Struct({})), + "reflection": Schema.optionalKey(Schema.Struct({})), + "reka": Schema.optionalKey(Schema.Struct({})), + "relace": Schema.optionalKey(Schema.Struct({})), + "replicate": Schema.optionalKey(Schema.Struct({})), + "sambanova": Schema.optionalKey(Schema.Struct({})), + "sambanova-cloaked": Schema.optionalKey(Schema.Struct({})), + "seed": Schema.optionalKey(Schema.Struct({})), + "sf-compute": Schema.optionalKey(Schema.Struct({})), + "siliconflow": Schema.optionalKey(Schema.Struct({})), + "sourceful": Schema.optionalKey(Schema.Struct({})), + "stealth": Schema.optionalKey(Schema.Struct({})), + "stepfun": Schema.optionalKey(Schema.Struct({})), + "streamlake": Schema.optionalKey(Schema.Struct({})), + "switchpoint": Schema.optionalKey(Schema.Struct({})), + "targon": Schema.optionalKey(Schema.Struct({})), + "together": Schema.optionalKey(Schema.Struct({})), + "together-lite": Schema.optionalKey(Schema.Struct({})), + "ubicloud": Schema.optionalKey(Schema.Struct({})), + "upstage": Schema.optionalKey(Schema.Struct({})), + "venice": Schema.optionalKey(Schema.Struct({})), + "wandb": Schema.optionalKey(Schema.Struct({})), + "xai": Schema.optionalKey(Schema.Struct({})), + "xiaomi": Schema.optionalKey(Schema.Struct({})), + "z-ai": Schema.optionalKey(Schema.Struct({})) +}).annotate({ + "description": + "Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body." +}) +export type ProviderOverloadedResponseErrorData = { + readonly "code": number + readonly "message": string + readonly "metadata"?: {} +} +export const ProviderOverloadedResponseErrorData = Schema.Struct({ + "code": Schema.Number.check(Schema.isInt()), + "message": Schema.String, + "metadata": Schema.optionalKey(Schema.Struct({})) +}).annotate({ "description": "Error data for ProviderOverloadedResponse" }) +export type ProviderResponse = { + readonly "endpoint_id"?: string + readonly "id"?: string + readonly "is_byok"?: boolean + readonly "latency"?: number + readonly "model_permaslug"?: string + readonly "provider_name"?: + | "AnyScale" + | "Atoma" + | "Cent-ML" + | "CrofAI" + | "Enfer" + | "GoPomelo" + | "HuggingFace" + | "Hyperbolic 2" + | "InoCloud" + | "Kluster" + | "Lambda" + | "Lepton" + | "Lynn 2" + | "Lynn" + | "Mancer" + | "Meta" + | "Modal" + | "Nineteen" + | "OctoAI" + | "Recursal" + | "Reflection" + | "Replicate" + | "SambaNova 2" + | "SF Compute" + | "Targon" + | "Together 2" + | "Ubicloud" + | "01.AI" + | "AkashML" + | "AI21" + | "AionLabs" + | "Alibaba" + | "Ambient" + | "Baidu" + | "Amazon Bedrock" + | "Amazon Nova" + | "Anthropic" + | "Arcee AI" + | "AtlasCloud" + | "Avian" + | "Azure" + | "BaseTen" + | "BytePlus" + | "Black Forest Labs" + | "Cerebras" + | "Chutes" + | "Cirrascale" + | "Clarifai" + | "Cloudflare" + | "Cohere" + | "Crucible" + | "Crusoe" + | "DeepInfra" + | "DeepSeek" + | "DekaLLM" + | "DigitalOcean" + | "Featherless" + | "Fireworks" + | "Friendli" + | "GMICloud" + | "Google" + | "Google AI Studio" + | "Groq" + | "Hyperbolic" + | "Inception" + | "Inceptron" + | "InferenceNet" + | "Ionstream" + | "Infermatic" + | "Io Net" + | "Inflection" + | "Liquid" + | "Mara" + | "Mancer 2" + | "Minimax" + | "ModelRun" + | "Mistral" + | "Modular" + | "Moonshot AI" + | "Morph" + | "NCompass" + | "Nebius" + | "Nex AGI" + | "NextBit" + | "Novita" + | "Nvidia" + | "OpenAI" + | "OpenInference" + | "Parasail" + | "Poolside" + | "Perceptron" + | "Perplexity" + | "Phala" + | "Recraft" + | "Reka" + | "Relace" + | "SambaNova" + | "Seed" + | "SiliconFlow" + | "Sourceful" + | "StepFun" + | "Stealth" + | "StreamLake" + | "Switchpoint" + | "Together" + | "Upstage" + | "Venice" + | "WandB" + | "Xiaomi" + | "xAI" + | "Z.AI" + | "FakeProvider" + readonly "status": number +} +export const ProviderResponse = Schema.Struct({ + "endpoint_id": Schema.optionalKey(Schema.String.annotate({ "description": "Internal endpoint identifier" })), + "id": Schema.optionalKey(Schema.String.annotate({ "description": "Upstream provider response identifier" })), + "is_byok": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether the request used a bring-your-own-key" }) + ), + "latency": Schema.optionalKey( + Schema.Number.annotate({ "description": "Response latency in milliseconds" }).check(Schema.isFinite()) + ), + "model_permaslug": Schema.optionalKey(Schema.String.annotate({ "description": "Canonical model slug" })), + "provider_name": Schema.optionalKey( Schema.Literals([ + "AnyScale", + "Atoma", + "Cent-ML", + "CrofAI", + "Enfer", + "GoPomelo", + "HuggingFace", + "Hyperbolic 2", + "InoCloud", + "Kluster", + "Lambda", + "Lepton", + "Lynn 2", + "Lynn", + "Mancer", + "Meta", + "Modal", + "Nineteen", + "OctoAI", + "Recursal", + "Reflection", + "Replicate", + "SambaNova 2", + "SF Compute", + "Targon", + "Together 2", + "Ubicloud", + "01.AI", + "AkashML", "AI21", "AionLabs", "Alibaba", "Ambient", + "Baidu", "Amazon Bedrock", "Amazon Nova", "Anthropic", @@ -2648,9 +3641,12 @@ export const __schema5 = Schema.Array( "Clarifai", "Cloudflare", "Cohere", + "Crucible", "Crusoe", "DeepInfra", "DeepSeek", + "DekaLLM", + "DigitalOcean", "Featherless", "Fireworks", "Friendli", @@ -2662,6 +3658,7 @@ export const __schema5 = Schema.Array( "Inception", "Inceptron", "InferenceNet", + "Ionstream", "Infermatic", "Io Net", "Inflection", @@ -2676,14 +3673,19 @@ export const __schema5 = Schema.Array( "Morph", "NCompass", "Nebius", + "Nex AGI", "NextBit", "Novita", "Nvidia", "OpenAI", "OpenInference", "Parasail", + "Poolside", + "Perceptron", "Perplexity", "Phala", + "Recraft", + "Reka", "Relace", "SambaNova", "Seed", @@ -2701,2832 +3703,10939 @@ export const __schema5 = Schema.Array( "xAI", "Z.AI", "FakeProvider" - ]), - Schema.String - ]) -) -export type __schema11 = number -export const __schema11 = Schema.Number.check(Schema.isFinite()) -export type __schema13 = unknown -export const __schema13 = Schema.Unknown -export type __schema21 = string | null -export const __schema21 = Schema.Union([Schema.String, Schema.Null]) -export type __schema22 = - | "unknown" - | "openai-responses-v1" - | "azure-openai-responses-v1" - | "xai-responses-v1" - | "anthropic-claude-v1" - | "google-gemini-v1" - | null -export const __schema22 = Schema.Union([ - Schema.Literals([ - "unknown", - "openai-responses-v1", - "azure-openai-responses-v1", - "xai-responses-v1", - "anthropic-claude-v1", - "google-gemini-v1" - ]), - Schema.Null -]) -export type ModelName = string -export const ModelName = Schema.String -export type ChatMessageContentItemImage = { - readonly "type": "image_url" - readonly "image_url": { readonly "url": string; readonly "detail"?: "auto" | "low" | "high" } -} -export const ChatMessageContentItemImage = Schema.Struct({ - "type": Schema.Literal("image_url"), - "image_url": Schema.Struct({ - "url": Schema.String, - "detail": Schema.optionalKey(Schema.Literals(["auto", "low", "high"])) - }) -}) -export type ChatMessageContentItemAudio = { - readonly "type": "input_audio" - readonly "input_audio": { readonly "data": string; readonly "format": string } -} -export const ChatMessageContentItemAudio = Schema.Struct({ - "type": Schema.Literal("input_audio"), - "input_audio": Schema.Struct({ "data": Schema.String, "format": Schema.String }) -}) -export type ChatMessageContentItemVideo = { - readonly "type": "input_video" - readonly "video_url": { readonly "url": string } -} | { readonly "type": "video_url"; readonly "video_url": { readonly "url": string } } -export const ChatMessageContentItemVideo = Schema.Union([ - Schema.Struct({ "type": Schema.Literal("input_video"), "video_url": Schema.Struct({ "url": Schema.String }) }), - Schema.Struct({ "type": Schema.Literal("video_url"), "video_url": Schema.Struct({ "url": Schema.String }) }) -], { mode: "oneOf" }) -export type ChatMessageToolCall = { - readonly "id": string - readonly "type": "function" - readonly "function": { readonly "name": string; readonly "arguments": string } -} -export const ChatMessageToolCall = Schema.Struct({ - "id": Schema.String, - "type": Schema.Literal("function"), - "function": Schema.Struct({ "name": Schema.String, "arguments": Schema.String }) + ]).annotate({ "description": "Name of the provider" }) + ), + "status": Schema.Number.annotate({ "description": "HTTP status code from the provider" }).check(Schema.isFinite()) +}).annotate({ "description": "Details of a provider response for a generation attempt" }) +export type ProviderSort = "price" | "throughput" | "latency" | "exacto" +export const ProviderSort = Schema.Literals(["price", "throughput", "latency", "exacto"]).annotate({ + "description": "The provider sorting strategy (price, throughput, latency)" }) -export type ChatMessageTokenLogprob = { - readonly "token": string - readonly "logprob": number - readonly "bytes": ReadonlyArray | null - readonly "top_logprobs": ReadonlyArray< - { readonly "token": string; readonly "logprob": number; readonly "bytes": ReadonlyArray | null } - > +export type ProviderSortConfig = { + readonly "by"?: "price" | "throughput" | "latency" | "exacto" | null + readonly "partition"?: "model" | "none" | null } -export const ChatMessageTokenLogprob = Schema.Struct({ - "token": Schema.String, - "logprob": Schema.Number.check(Schema.isFinite()), - "bytes": Schema.Union([Schema.Array(Schema.Number.check(Schema.isFinite())), Schema.Null]), - "top_logprobs": Schema.Array( - Schema.Struct({ - "token": Schema.String, - "logprob": Schema.Number.check(Schema.isFinite()), - "bytes": Schema.Union([Schema.Array(Schema.Number.check(Schema.isFinite())), Schema.Null]) +export const ProviderSortConfig = Schema.Struct({ + "by": Schema.optionalKey( + Schema.Union([ + Schema.Literal("price"), + Schema.Literal("throughput"), + Schema.Literal("latency"), + Schema.Literal("exacto"), + Schema.Null + ]).annotate({ "description": "The provider sorting strategy (price, throughput, latency)" }) + ), + "partition": Schema.optionalKey( + Schema.Union([Schema.Literal("model"), Schema.Literal("none"), Schema.Null]).annotate({ + "description": + "Partitioning strategy for sorting: \"model\" (default) groups endpoints by model before sorting (fallback models remain fallbacks), \"none\" sorts all endpoints together regardless of model." }) ) -}) -export type ChatGenerationTokenUsage = { - readonly "completion_tokens": number - readonly "prompt_tokens": number - readonly "total_tokens": number - readonly "completion_tokens_details"?: { - readonly "reasoning_tokens"?: number | null - readonly "audio_tokens"?: number | null - readonly "accepted_prediction_tokens"?: number | null - readonly "rejected_prediction_tokens"?: number | null - } | null - readonly "prompt_tokens_details"?: { - readonly "cached_tokens"?: number - readonly "cache_write_tokens"?: number - readonly "audio_tokens"?: number - readonly "video_tokens"?: number - } | null -} -export const ChatGenerationTokenUsage = Schema.Struct({ - "completion_tokens": Schema.Number.check(Schema.isFinite()), - "prompt_tokens": Schema.Number.check(Schema.isFinite()), - "total_tokens": Schema.Number.check(Schema.isFinite()), - "completion_tokens_details": Schema.optionalKey(Schema.Union([ - Schema.Struct({ - "reasoning_tokens": Schema.optionalKey(Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null])), - "audio_tokens": Schema.optionalKey(Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null])), - "accepted_prediction_tokens": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null]) - ), - "rejected_prediction_tokens": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null]) - ) - }), - Schema.Null - ])), - "prompt_tokens_details": Schema.optionalKey(Schema.Union([ - Schema.Struct({ - "cached_tokens": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "cache_write_tokens": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "audio_tokens": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "video_tokens": Schema.optionalKey(Schema.Number.check(Schema.isFinite())) - }), - Schema.Null - ])) -}) -export type ChatCompletionFinishReason = "tool_calls" | "stop" | "length" | "content_filter" | "error" -export const ChatCompletionFinishReason = Schema.Literals(["tool_calls", "stop", "length", "content_filter", "error"]) -export type JSONSchemaConfig = { - readonly "name": string - readonly "description"?: string - readonly "schema"?: {} - readonly "strict"?: boolean | null -} -export const JSONSchemaConfig = Schema.Struct({ - "name": Schema.String.check(Schema.isMaxLength(64)), - "description": Schema.optionalKey(Schema.String), - "schema": Schema.optionalKey(Schema.Struct({}).check(Schema.isPropertyNames(Schema.String))), - "strict": Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])) -}) -export type ResponseFormatTextGrammar = { readonly "type": "grammar"; readonly "grammar": string } -export const ResponseFormatTextGrammar = Schema.Struct({ "type": Schema.Literal("grammar"), "grammar": Schema.String }) -export type ChatMessageContentItemCacheControl = { readonly "type": "ephemeral"; readonly "ttl"?: "5m" | "1h" } -export const ChatMessageContentItemCacheControl = Schema.Struct({ - "type": Schema.Literal("ephemeral"), - "ttl": Schema.optionalKey(Schema.Literals(["5m", "1h"])) -}) -export type NamedToolChoice = { readonly "type": "function"; readonly "function": { readonly "name": string } } -export const NamedToolChoice = Schema.Struct({ - "type": Schema.Literal("function"), - "function": Schema.Struct({ "name": Schema.String }) -}) -export type ChatStreamOptions = { readonly "include_usage"?: boolean } -export const ChatStreamOptions = Schema.Struct({ "include_usage": Schema.optionalKey(Schema.Boolean) }) -export type ChatStreamingMessageToolCall = { - readonly "index": number - readonly "id"?: string | null - readonly "type"?: "function" | null - readonly "function"?: { readonly "name"?: string | null; readonly "arguments"?: string } -} -export const ChatStreamingMessageToolCall = Schema.Struct({ - "index": Schema.Number.check(Schema.isFinite()), - "id": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "type": Schema.optionalKey(Schema.Union([Schema.Literal("function"), Schema.Null])), - "function": Schema.optionalKey( - Schema.Struct({ - "name": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "arguments": Schema.optionalKey(Schema.String) - }) - ) -}) -export type ChatError = { - readonly "error": { - readonly "code": string | number | null - readonly "message": string - readonly "param"?: string | null - readonly "type"?: string | null - } -} -export const ChatError = Schema.Struct({ - "error": Schema.Struct({ - "code": Schema.Union([Schema.Union([Schema.String, Schema.Number.check(Schema.isFinite())]), Schema.Null]), - "message": Schema.String, - "param": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "type": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])) - }) -}) -export type OpenAIResponsesAnnotation = FileCitation | URLCitation | FilePath -export const OpenAIResponsesAnnotation = Schema.Union([FileCitation, URLCitation, FilePath]) -export type OutputItemReasoning = { - readonly "type": "reasoning" - readonly "id": string - readonly "content"?: ReadonlyArray - readonly "summary": ReadonlyArray - readonly "encrypted_content"?: string - readonly "status"?: "completed" | "incomplete" | "in_progress" +}).annotate({ "description": "The provider sorting strategy (price, throughput, latency)" }) +export type PublicPricing = { + readonly "audio"?: string + readonly "audio_output"?: string + readonly "completion": string + readonly "discount"?: number + readonly "image"?: string + readonly "image_output"?: string + readonly "image_token"?: string + readonly "input_audio_cache"?: string + readonly "input_cache_read"?: string + readonly "input_cache_write"?: string + readonly "internal_reasoning"?: string + readonly "prompt": string + readonly "request"?: string + readonly "web_search"?: string } -export const OutputItemReasoning = Schema.Struct({ - "type": Schema.Literal("reasoning"), - "id": Schema.String, - "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), - "summary": Schema.Array(ReasoningSummaryText), - "encrypted_content": Schema.optionalKey(Schema.String), - "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])) -}) -export type ResponsesOutputItemReasoning = { - readonly "type": "reasoning" - readonly "id": string - readonly "content"?: ReadonlyArray - readonly "summary": ReadonlyArray - readonly "encrypted_content"?: string - readonly "status"?: "completed" | "incomplete" | "in_progress" - readonly "signature"?: string - readonly "format"?: - | "unknown" - | "openai-responses-v1" - | "azure-openai-responses-v1" - | "xai-responses-v1" - | "anthropic-claude-v1" - | "google-gemini-v1" -} -export const ResponsesOutputItemReasoning = Schema.Struct({ - "type": Schema.Literal("reasoning"), - "id": Schema.String, - "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), - "summary": Schema.Array(ReasoningSummaryText), - "encrypted_content": Schema.optionalKey(Schema.String), - "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])), - "signature": Schema.optionalKey( - Schema.String.annotate({ "description": "A signature for the reasoning content, used for verification" }) +export const PublicPricing = Schema.Struct({ + "audio": Schema.optionalKey( + Schema.String.annotate({ "description": "A number or string value representing a large number" }) ), - "format": Schema.optionalKey( - Schema.Literals([ - "unknown", - "openai-responses-v1", - "azure-openai-responses-v1", - "xai-responses-v1", - "anthropic-claude-v1", - "google-gemini-v1" - ]).annotate({ "description": "The format of the reasoning content" }) + "audio_output": Schema.optionalKey( + Schema.String.annotate({ "description": "A number or string value representing a large number" }) + ), + "completion": Schema.String.annotate({ "description": "A number or string value representing a large number" }), + "discount": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), + "image": Schema.optionalKey( + Schema.String.annotate({ "description": "A number or string value representing a large number" }) + ), + "image_output": Schema.optionalKey( + Schema.String.annotate({ "description": "A number or string value representing a large number" }) + ), + "image_token": Schema.optionalKey( + Schema.String.annotate({ "description": "A number or string value representing a large number" }) + ), + "input_audio_cache": Schema.optionalKey( + Schema.String.annotate({ "description": "A number or string value representing a large number" }) + ), + "input_cache_read": Schema.optionalKey( + Schema.String.annotate({ "description": "A number or string value representing a large number" }) + ), + "input_cache_write": Schema.optionalKey( + Schema.String.annotate({ "description": "A number or string value representing a large number" }) + ), + "internal_reasoning": Schema.optionalKey( + Schema.String.annotate({ "description": "A number or string value representing a large number" }) + ), + "prompt": Schema.String.annotate({ "description": "A number or string value representing a large number" }), + "request": Schema.optionalKey( + Schema.String.annotate({ "description": "A number or string value representing a large number" }) + ), + "web_search": Schema.optionalKey( + Schema.String.annotate({ "description": "A number or string value representing a large number" }) ) -}).annotate({ "description": "An output item containing reasoning" }) -export type OpenResponsesReasoningSummaryPartAddedEvent = { - readonly "type": "response.reasoning_summary_part.added" - readonly "output_index": number +}).annotate({ "description": "Pricing information for the model" }) +export type Quantization = "int4" | "int8" | "fp4" | "fp6" | "fp8" | "fp16" | "bf16" | "fp32" | "unknown" +export const Quantization = Schema.Literals(["int4", "int8", "fp4", "fp6", "fp8", "fp16", "bf16", "fp32", "unknown"]) +export type ReasoningDeltaEvent = { + readonly "content_index": number + readonly "delta": string readonly "item_id": string - readonly "summary_index": number - readonly "part": ReasoningSummaryText + readonly "output_index": number readonly "sequence_number": number + readonly "type": "response.reasoning_text.delta" } -export const OpenResponsesReasoningSummaryPartAddedEvent = Schema.Struct({ - "type": Schema.Literal("response.reasoning_summary_part.added"), - "output_index": Schema.Number.check(Schema.isFinite()), +export const ReasoningDeltaEvent = Schema.Struct({ + "content_index": Schema.Number.check(Schema.isInt()), + "delta": Schema.String, "item_id": Schema.String, - "summary_index": Schema.Number.check(Schema.isFinite()), - "part": ReasoningSummaryText, - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Event emitted when a reasoning summary part is added" }) -export type OpenResponsesReasoningSummaryPartDoneEvent = { - readonly "type": "response.reasoning_summary_part.done" - readonly "output_index": number + "output_index": Schema.Number.check(Schema.isInt()), + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.reasoning_text.delta") +}).annotate({ "description": "Event emitted when reasoning text delta is streamed" }) +export type ReasoningDoneEvent = { + readonly "content_index": number readonly "item_id": string - readonly "summary_index": number - readonly "part": ReasoningSummaryText + readonly "output_index": number readonly "sequence_number": number + readonly "text": string + readonly "type": "response.reasoning_text.done" } -export const OpenResponsesReasoningSummaryPartDoneEvent = Schema.Struct({ - "type": Schema.Literal("response.reasoning_summary_part.done"), - "output_index": Schema.Number.check(Schema.isFinite()), +export const ReasoningDoneEvent = Schema.Struct({ + "content_index": Schema.Number.check(Schema.isInt()), "item_id": Schema.String, - "summary_index": Schema.Number.check(Schema.isFinite()), - "part": ReasoningSummaryText, - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Event emitted when a reasoning summary part is complete" }) -export type OpenResponsesReasoning = { - readonly "type": "reasoning" - readonly "id": string - readonly "content"?: ReadonlyArray - readonly "summary": ReadonlyArray - readonly "encrypted_content"?: string - readonly "status"?: "completed" | "incomplete" | "in_progress" - readonly "signature"?: string - readonly "format"?: - | "unknown" - | "openai-responses-v1" - | "azure-openai-responses-v1" - | "xai-responses-v1" - | "anthropic-claude-v1" - | "google-gemini-v1" -} -export const OpenResponsesReasoning = Schema.Struct({ - "type": Schema.Literal("reasoning"), - "id": Schema.String, - "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), - "summary": Schema.Array(ReasoningSummaryText), - "encrypted_content": Schema.optionalKey(Schema.String), - "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])), - "signature": Schema.optionalKey(Schema.String), - "format": Schema.optionalKey( - Schema.Literals([ - "unknown", - "openai-responses-v1", - "azure-openai-responses-v1", - "xai-responses-v1", - "anthropic-claude-v1", - "google-gemini-v1" - ]) - ) -}).annotate({ "description": "Reasoning output item with signature and format extensions" }) -export type OutputItemWebSearchCall = { - readonly "type": "web_search_call" - readonly "id": string - readonly "status": WebSearchStatus + "output_index": Schema.Number.check(Schema.isInt()), + "sequence_number": Schema.Number.check(Schema.isInt()), + "text": Schema.String, + "type": Schema.Literal("response.reasoning_text.done") +}).annotate({ "description": "Event emitted when reasoning text streaming is complete" }) +export type ReasoningEffort = "xhigh" | "high" | "medium" | "low" | "minimal" | "none" | null +export const ReasoningEffort = Schema.Union([ + Schema.Literal("xhigh"), + Schema.Literal("high"), + Schema.Literal("medium"), + Schema.Literal("low"), + Schema.Literal("minimal"), + Schema.Literal("none"), + Schema.Null +]) +export type ReasoningFormat = + | "unknown" + | "openai-responses-v1" + | "azure-openai-responses-v1" + | "xai-responses-v1" + | "anthropic-claude-v1" + | "google-gemini-v1" + | null +export const ReasoningFormat = Schema.Union([ + Schema.Literal("unknown"), + Schema.Literal("openai-responses-v1"), + Schema.Literal("azure-openai-responses-v1"), + Schema.Literal("xai-responses-v1"), + Schema.Literal("anthropic-claude-v1"), + Schema.Literal("google-gemini-v1"), + Schema.Null +]) +export type ReasoningSummaryText = { readonly "text": string; readonly "type": "summary_text" } +export const ReasoningSummaryText = Schema.Struct({ "text": Schema.String, "type": Schema.Literal("summary_text") }) +export type ReasoningSummaryTextDeltaEvent = { + readonly "delta": string + readonly "item_id": string + readonly "output_index": number + readonly "sequence_number": number + readonly "summary_index": number + readonly "type": "response.reasoning_summary_text.delta" } -export const OutputItemWebSearchCall = Schema.Struct({ - "type": Schema.Literal("web_search_call"), - "id": Schema.String, - "status": WebSearchStatus -}) -export type ResponsesWebSearchCallOutput = { - readonly "type": "web_search_call" - readonly "id": string - readonly "status": WebSearchStatus +export const ReasoningSummaryTextDeltaEvent = Schema.Struct({ + "delta": Schema.String, + "item_id": Schema.String, + "output_index": Schema.Number.check(Schema.isInt()), + "sequence_number": Schema.Number.check(Schema.isInt()), + "summary_index": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.reasoning_summary_text.delta") +}).annotate({ "description": "Event emitted when reasoning summary text delta is streamed" }) +export type ReasoningSummaryTextDoneEvent = { + readonly "item_id": string + readonly "output_index": number + readonly "sequence_number": number + readonly "summary_index": number + readonly "text": string + readonly "type": "response.reasoning_summary_text.done" } -export const ResponsesWebSearchCallOutput = Schema.Struct({ - "type": Schema.Literal("web_search_call"), - "id": Schema.String, - "status": WebSearchStatus -}) -export type OutputItemFileSearchCall = { - readonly "type": "file_search_call" - readonly "id": string - readonly "queries": ReadonlyArray - readonly "status": WebSearchStatus +export const ReasoningSummaryTextDoneEvent = Schema.Struct({ + "item_id": Schema.String, + "output_index": Schema.Number.check(Schema.isInt()), + "sequence_number": Schema.Number.check(Schema.isInt()), + "summary_index": Schema.Number.check(Schema.isInt()), + "text": Schema.String, + "type": Schema.Literal("response.reasoning_summary_text.done") +}).annotate({ "description": "Event emitted when reasoning summary text streaming is complete" }) +export type ReasoningSummaryVerbosity = "auto" | "concise" | "detailed" | null +export const ReasoningSummaryVerbosity = Schema.Union([ + Schema.Literal("auto"), + Schema.Literal("concise"), + Schema.Literal("detailed"), + Schema.Null +]) +export type ReasoningTextContent = { readonly "text": string; readonly "type": "reasoning_text" } +export const ReasoningTextContent = Schema.Struct({ "text": Schema.String, "type": Schema.Literal("reasoning_text") }) +export type RefusalDeltaEvent = { + readonly "content_index": number + readonly "delta": string + readonly "item_id": string + readonly "output_index": number + readonly "sequence_number": number + readonly "type": "response.refusal.delta" } -export const OutputItemFileSearchCall = Schema.Struct({ - "type": Schema.Literal("file_search_call"), - "id": Schema.String, - "queries": Schema.Array(Schema.String), - "status": WebSearchStatus -}) -export type ResponsesOutputItemFileSearchCall = { - readonly "type": "file_search_call" - readonly "id": string - readonly "queries": ReadonlyArray - readonly "status": WebSearchStatus +export const RefusalDeltaEvent = Schema.Struct({ + "content_index": Schema.Number.check(Schema.isInt()), + "delta": Schema.String, + "item_id": Schema.String, + "output_index": Schema.Number.check(Schema.isInt()), + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.refusal.delta") +}).annotate({ "description": "Event emitted when a refusal delta is streamed" }) +export type RefusalDoneEvent = { + readonly "content_index": number + readonly "item_id": string + readonly "output_index": number + readonly "refusal": string + readonly "sequence_number": number + readonly "type": "response.refusal.done" } -export const ResponsesOutputItemFileSearchCall = Schema.Struct({ - "type": Schema.Literal("file_search_call"), - "id": Schema.String, - "queries": Schema.Array(Schema.String), - "status": WebSearchStatus +export const RefusalDoneEvent = Schema.Struct({ + "content_index": Schema.Number.check(Schema.isInt()), + "item_id": Schema.String, + "output_index": Schema.Number.check(Schema.isInt()), + "refusal": Schema.String, + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.refusal.done") +}).annotate({ "description": "Event emitted when refusal streaming is complete" }) +export type RequestMetadata = {} +export const RequestMetadata = Schema.Struct({}).annotate({ + "description": + "Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed." }) -export type OutputItemImageGenerationCall = { - readonly "type": "image_generation_call" - readonly "id": string - readonly "result"?: string - readonly "status": ImageGenerationStatus +export type RequestTimeoutResponseErrorData = { + readonly "code": number + readonly "message": string + readonly "metadata"?: {} } -export const OutputItemImageGenerationCall = Schema.Struct({ - "type": Schema.Literal("image_generation_call"), - "id": Schema.String, - "result": Schema.optionalKey(Schema.String), - "status": ImageGenerationStatus +export const RequestTimeoutResponseErrorData = Schema.Struct({ + "code": Schema.Number.check(Schema.isInt()), + "message": Schema.String, + "metadata": Schema.optionalKey(Schema.Struct({})) +}).annotate({ "description": "Error data for RequestTimeoutResponse" }) +export type ResponseHealingPlugin = { readonly "enabled"?: boolean; readonly "id": "response-healing" } +export const ResponseHealingPlugin = Schema.Struct({ + "enabled": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": "Set to false to disable the response-healing plugin for this request. Defaults to true." + }) + ), + "id": Schema.Literal("response-healing") }) -export type ResponsesImageGenerationCall = { - readonly "type": "image_generation_call" - readonly "id": string - readonly "result"?: string - readonly "status": ImageGenerationStatus +export type ResponseIncludesEnum = + | "file_search_call.results" + | "message.input_image.image_url" + | "computer_call_output.output.image_url" + | "reasoning.encrypted_content" + | "code_interpreter_call.outputs" +export const ResponseIncludesEnum = Schema.Literals([ + "file_search_call.results", + "message.input_image.image_url", + "computer_call_output.output.image_url", + "reasoning.encrypted_content", + "code_interpreter_call.outputs" +]) +export type ResponsesErrorField = { + readonly "code": + | "server_error" + | "rate_limit_exceeded" + | "invalid_prompt" + | "vector_store_timeout" + | "invalid_image" + | "invalid_image_format" + | "invalid_base64_image" + | "invalid_image_url" + | "image_too_large" + | "image_too_small" + | "image_parse_error" + | "image_content_policy_violation" + | "invalid_image_mode" + | "image_file_too_large" + | "unsupported_image_media_type" + | "empty_image_file" + | "failed_to_download_image" + | "image_file_not_found" + readonly "message": string } -export const ResponsesImageGenerationCall = Schema.Struct({ - "type": Schema.Literal("image_generation_call"), - "id": Schema.String, - "result": Schema.optionalKey(Schema.String), - "status": ImageGenerationStatus +export const ResponsesErrorField = Schema.Struct({ + "code": Schema.Literals([ + "server_error", + "rate_limit_exceeded", + "invalid_prompt", + "vector_store_timeout", + "invalid_image", + "invalid_image_format", + "invalid_base64_image", + "invalid_image_url", + "image_too_large", + "image_too_small", + "image_parse_error", + "image_content_policy_violation", + "invalid_image_mode", + "image_file_too_large", + "unsupported_image_media_type", + "empty_image_file", + "failed_to_download_image", + "image_file_not_found" + ]), + "message": Schema.String +}).annotate({ "description": "Error information returned from the API" }) +export type RouterAttempt = { readonly "model": string; readonly "provider": string; readonly "status": number } +export const RouterAttempt = Schema.Struct({ + "model": Schema.String, + "provider": Schema.String, + "status": Schema.Number.check(Schema.isInt()) }) -export type OpenResponsesFunctionToolCall = { - readonly "type": "function_call" +export type RouterParams = { + readonly "quality_floor"?: number + readonly "throughput_floor"?: number + readonly "version_group"?: string +} +export const RouterParams = Schema.Struct({ + "quality_floor": Schema.optionalKey(Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite())), + "throughput_floor": Schema.optionalKey(Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite())), + "version_group": Schema.optionalKey(Schema.String) +}) +export type RoutingStrategy = + | "direct" + | "auto" + | "free" + | "latest" + | "alias" + | "fallback" + | "pareto" + | "bodybuilder" + | "fusion" +export const RoutingStrategy = Schema.Literals([ + "direct", + "auto", + "free", + "latest", + "alias", + "fallback", + "pareto", + "bodybuilder", + "fusion" +]) +export type SearchContextSizeEnum = "low" | "medium" | "high" +export const SearchContextSizeEnum = Schema.Literals(["low", "medium", "high"]).annotate({ + "description": "Size of the search context for web search tools" +}) +export type SearchModelsServerToolConfig = { readonly "max_results"?: number } +export const SearchModelsServerToolConfig = Schema.Struct({ + "max_results": Schema.optionalKey( + Schema.Number.annotate({ "description": "Maximum number of models to return. Defaults to 5, max 20." }).check( + Schema.isInt() + ) + ) +}).annotate({ "description": "Configuration for the openrouter:experimental__search_models server tool" }) +export type SearchQualityLevel = "low" | "medium" | "high" +export const SearchQualityLevel = Schema.Literals(["low", "medium", "high"]).annotate({ + "description": + "How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically ~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size." +}) +export type ServiceTier = "auto" | "default" | "flex" | "priority" | "scale" | null +export const ServiceTier = Schema.Union([ + Schema.Literal("auto"), + Schema.Literal("default"), + Schema.Literal("flex"), + Schema.Literal("priority"), + Schema.Literal("scale"), + Schema.Null +]) +export type ServiceUnavailableResponseErrorData = { + readonly "code": number + readonly "message": string + readonly "metadata"?: {} +} +export const ServiceUnavailableResponseErrorData = Schema.Struct({ + "code": Schema.Number.check(Schema.isInt()), + "message": Schema.String, + "metadata": Schema.optionalKey(Schema.Struct({})) +}).annotate({ "description": "Error data for ServiceUnavailableResponse" }) +export type ShellCallItem = { + readonly "action": { + readonly "commands": ReadonlyArray + readonly "max_output_length"?: number + readonly "timeout_ms"?: number + } readonly "call_id": string - readonly "name": string - readonly "arguments": string - readonly "id": string - readonly "status"?: ToolCallStatus + readonly "environment"?: unknown + readonly "id"?: string + readonly "status"?: "in_progress" | "completed" | "incomplete" + readonly "type": "shell_call" } -export const OpenResponsesFunctionToolCall = Schema.Struct({ - "type": Schema.Literal("function_call"), +export const ShellCallItem = Schema.Struct({ + "action": Schema.Struct({ + "commands": Schema.Array(Schema.String), + "max_output_length": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "timeout_ms": Schema.optionalKey(Schema.Number.check(Schema.isInt())) + }), "call_id": Schema.String, - "name": Schema.String, - "arguments": Schema.String, - "id": Schema.String, - "status": Schema.optionalKey(ToolCallStatus) -}).annotate({ "description": "A function call initiated by the model" }) -export type OpenResponsesFunctionCallOutput = { - readonly "type": "function_call_output" - readonly "id"?: string + "environment": Schema.optionalKey(Schema.Unknown), + "id": Schema.optionalKey(Schema.String), + "status": Schema.optionalKey(Schema.Literals(["in_progress", "completed", "incomplete"])), + "type": Schema.Literal("shell_call") +}).annotate({ "description": "A shell command execution call (newer variant)" }) +export type ShellCallOutputItem = { readonly "call_id": string - readonly "output": string - readonly "status"?: ToolCallStatus + readonly "id"?: string + readonly "max_output_length"?: number + readonly "output": ReadonlyArray< + { readonly "content"?: string; readonly "exit_code"?: number; readonly "type": string } + > + readonly "status"?: "in_progress" | "completed" | "incomplete" + readonly "type": "shell_call_output" } -export const OpenResponsesFunctionCallOutput = Schema.Struct({ - "type": Schema.Literal("function_call_output"), - "id": Schema.optionalKey(Schema.String), +export const ShellCallOutputItem = Schema.Struct({ "call_id": Schema.String, - "output": Schema.String, - "status": Schema.optionalKey(ToolCallStatus) -}).annotate({ "description": "The output from a function call execution" }) -export type OpenResponsesWebSearchPreviewTool = { - readonly "type": "web_search_preview" - readonly "search_context_size"?: ResponsesSearchContextSize - readonly "user_location"?: WebSearchPreviewToolUserLocation + "id": Schema.optionalKey(Schema.String), + "max_output_length": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "output": Schema.Array( + Schema.Struct({ + "content": Schema.optionalKey(Schema.String), + "exit_code": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "type": Schema.String + }) + ), + "status": Schema.optionalKey(Schema.Literals(["in_progress", "completed", "incomplete"])), + "type": Schema.Literal("shell_call_output") +}).annotate({ "description": "Output from a shell command execution (newer variant)" }) +export type ShellServerTool = { readonly "type": "shell" } +export const ShellServerTool = Schema.Struct({ "type": Schema.Literal("shell") }).annotate({ + "description": "Shell tool configuration" +}) +export type StopServerToolsWhenFinishReasonIs = { readonly "reason": string; readonly "type": "finish_reason_is" } +export const StopServerToolsWhenFinishReasonIs = Schema.Struct({ + "reason": Schema.String.check(Schema.isMinLength(1)), + "type": Schema.Literal("finish_reason_is") +}).annotate({ "description": "Stop when the upstream model emits this finish reason (e.g. `length`)." }) +export type StopServerToolsWhenHasToolCall = { readonly "tool_name": string; readonly "type": "has_tool_call" } +export const StopServerToolsWhenHasToolCall = Schema.Struct({ + "tool_name": Schema.String.check(Schema.isMinLength(1)), + "type": Schema.Literal("has_tool_call") +}).annotate({ "description": "Stop after a tool with this name has been called." }) +export type StopServerToolsWhenMaxCost = { readonly "max_cost_in_dollars": number; readonly "type": "max_cost" } +export const StopServerToolsWhenMaxCost = Schema.Struct({ + "max_cost_in_dollars": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "type": Schema.Literal("max_cost") +}).annotate({ "description": "Stop once cumulative cost across the loop exceeds this dollar threshold." }) +export type StopServerToolsWhenMaxTokensUsed = { readonly "max_tokens": number; readonly "type": "max_tokens_used" } +export const StopServerToolsWhenMaxTokensUsed = Schema.Struct({ + "max_tokens": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("max_tokens_used") +}).annotate({ "description": "Stop once cumulative token usage across the loop exceeds this threshold." }) +export type StopServerToolsWhenStepCountIs = { readonly "step_count": number; readonly "type": "step_count_is" } +export const StopServerToolsWhenStepCountIs = Schema.Struct({ + "step_count": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("step_count_is") +}).annotate({ "description": "Stop after the agent loop has executed this many steps." }) +export type StoredPromptTemplate = { readonly "id": string; readonly "variables"?: {} } +export const StoredPromptTemplate = Schema.Struct({ + "id": Schema.String, + "variables": Schema.optionalKey(Schema.Struct({})) +}) +export type STTInputAudio = { readonly "data": string; readonly "format": string } +export const STTInputAudio = Schema.Struct({ + "data": Schema.String.annotate({ "description": "Base64-encoded audio data (raw bytes, not a data URI)" }), + "format": Schema.String.annotate({ + "description": "Audio format (e.g., wav, mp3, flac, m4a, ogg, webm, aac). Supported formats vary by provider." + }) +}).annotate({ "description": "Base64-encoded audio to transcribe" }) +export type STTUsage = { + readonly "cost"?: number + readonly "input_tokens"?: number + readonly "output_tokens"?: number + readonly "seconds"?: number + readonly "total_tokens"?: number } -export const OpenResponsesWebSearchPreviewTool = Schema.Struct({ - "type": Schema.Literal("web_search_preview"), - "search_context_size": Schema.optionalKey(ResponsesSearchContextSize), - "user_location": Schema.optionalKey(WebSearchPreviewToolUserLocation) -}).annotate({ "description": "Web search preview tool configuration" }) -export type OpenResponsesWebSearchPreview20250311Tool = { - readonly "type": "web_search_preview_2025_03_11" - readonly "search_context_size"?: ResponsesSearchContextSize - readonly "user_location"?: WebSearchPreviewToolUserLocation +export const STTUsage = Schema.Struct({ + "cost": Schema.optionalKey( + Schema.Number.annotate({ "description": "Total cost of the request in USD", "format": "double" }).check( + Schema.isFinite() + ) + ), + "input_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Number of input tokens billed for this request" }).check(Schema.isInt()) + ), + "output_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Number of output tokens generated" }).check(Schema.isInt()) + ), + "seconds": Schema.optionalKey( + Schema.Number.annotate({ "description": "Duration of the input audio in seconds", "format": "double" }).check( + Schema.isFinite() + ) + ), + "total_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Total number of tokens used (input + output)" }).check(Schema.isInt()) + ) +}).annotate({ "description": "Aggregated usage statistics for the request" }) +export type TextDeltaEvent = { + readonly "content_index": number + readonly "delta": string + readonly "item_id": string + readonly "logprobs": ReadonlyArray< + { + readonly "bytes"?: ReadonlyArray + readonly "logprob": number + readonly "token": string + readonly "top_logprobs"?: ReadonlyArray< + { readonly "bytes"?: ReadonlyArray; readonly "logprob"?: number; readonly "token"?: string } + > + } + > + readonly "output_index": number + readonly "sequence_number": number + readonly "type": "response.output_text.delta" } -export const OpenResponsesWebSearchPreview20250311Tool = Schema.Struct({ - "type": Schema.Literal("web_search_preview_2025_03_11"), - "search_context_size": Schema.optionalKey(ResponsesSearchContextSize), - "user_location": Schema.optionalKey(WebSearchPreviewToolUserLocation) -}).annotate({ "description": "Web search preview tool configuration (2025-03-11 version)" }) -export type OpenResponsesWebSearchTool = { - readonly "type": "web_search" - readonly "filters"?: { readonly "allowed_domains"?: ReadonlyArray } - readonly "search_context_size"?: ResponsesSearchContextSize - readonly "user_location"?: ResponsesWebSearchUserLocation +export const TextDeltaEvent = Schema.Struct({ + "content_index": Schema.Number.check(Schema.isInt()), + "delta": Schema.String, + "item_id": Schema.String, + "logprobs": Schema.Array( + Schema.Struct({ + "bytes": Schema.optionalKey(Schema.Array(Schema.Number.check(Schema.isInt()))), + "logprob": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "token": Schema.String, + "top_logprobs": Schema.optionalKey( + Schema.Array( + Schema.Struct({ + "bytes": Schema.optionalKey(Schema.Array(Schema.Number.check(Schema.isInt()))), + "logprob": Schema.optionalKey(Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite())), + "token": Schema.optionalKey(Schema.String) + }).annotate({ "description": "Alternative token with its log probability" }) + ) + ) + }).annotate({ "description": "Log probability information for a token" }) + ), + "output_index": Schema.Number.check(Schema.isInt()), + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.output_text.delta") +}).annotate({ "description": "Event emitted when a text delta is streamed" }) +export type TextDoneEvent = { + readonly "content_index": number + readonly "item_id": string + readonly "logprobs": ReadonlyArray< + { + readonly "bytes"?: ReadonlyArray + readonly "logprob": number + readonly "token": string + readonly "top_logprobs"?: ReadonlyArray< + { readonly "bytes"?: ReadonlyArray; readonly "logprob"?: number; readonly "token"?: string } + > + } + > + readonly "output_index": number + readonly "sequence_number": number + readonly "text": string + readonly "type": "response.output_text.done" } -export const OpenResponsesWebSearchTool = Schema.Struct({ - "type": Schema.Literal("web_search"), - "filters": Schema.optionalKey(Schema.Struct({ "allowed_domains": Schema.optionalKey(Schema.Array(Schema.String)) })), - "search_context_size": Schema.optionalKey(ResponsesSearchContextSize), - "user_location": Schema.optionalKey(ResponsesWebSearchUserLocation) -}).annotate({ "description": "Web search tool configuration" }) -export type OpenResponsesWebSearch20250826Tool = { - readonly "type": "web_search_2025_08_26" - readonly "filters"?: { readonly "allowed_domains"?: ReadonlyArray } - readonly "search_context_size"?: ResponsesSearchContextSize - readonly "user_location"?: ResponsesWebSearchUserLocation +export const TextDoneEvent = Schema.Struct({ + "content_index": Schema.Number.check(Schema.isInt()), + "item_id": Schema.String, + "logprobs": Schema.Array( + Schema.Struct({ + "bytes": Schema.optionalKey(Schema.Array(Schema.Number.check(Schema.isInt()))), + "logprob": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "token": Schema.String, + "top_logprobs": Schema.optionalKey( + Schema.Array( + Schema.Struct({ + "bytes": Schema.optionalKey(Schema.Array(Schema.Number.check(Schema.isInt()))), + "logprob": Schema.optionalKey(Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite())), + "token": Schema.optionalKey(Schema.String) + }).annotate({ "description": "Alternative token with its log probability" }) + ) + ) + }).annotate({ "description": "Log probability information for a token" }) + ), + "output_index": Schema.Number.check(Schema.isInt()), + "sequence_number": Schema.Number.check(Schema.isInt()), + "text": Schema.String, + "type": Schema.Literal("response.output_text.done") +}).annotate({ "description": "Event emitted when text streaming is complete" }) +export type ToolCallStatus = "in_progress" | "completed" | "incomplete" +export const ToolCallStatus = Schema.Literals(["in_progress", "completed", "incomplete"]) +export type ToolChoiceAllowed = { + readonly "mode": "auto" | "required" + readonly "tools": ReadonlyArray<{}> + readonly "type": "allowed_tools" } -export const OpenResponsesWebSearch20250826Tool = Schema.Struct({ - "type": Schema.Literal("web_search_2025_08_26"), - "filters": Schema.optionalKey(Schema.Struct({ "allowed_domains": Schema.optionalKey(Schema.Array(Schema.String)) })), - "search_context_size": Schema.optionalKey(ResponsesSearchContextSize), - "user_location": Schema.optionalKey(ResponsesWebSearchUserLocation) -}).annotate({ "description": "Web search tool configuration (2025-08-26 version)" }) -export type OpenAIResponsesReasoningConfig = { - readonly "effort"?: OpenAIResponsesReasoningEffort - readonly "summary"?: ReasoningSummaryVerbosity +export const ToolChoiceAllowed = Schema.Struct({ + "mode": Schema.Literals(["auto", "required"]), + "tools": Schema.Array(Schema.Struct({})), + "type": Schema.Literal("allowed_tools") +}).annotate({ "description": "Constrains the model to a pre-defined set of allowed tools" }) +export type TooManyRequestsResponseErrorData = { + readonly "code": number + readonly "message": string + readonly "metadata"?: {} } -export const OpenAIResponsesReasoningConfig = Schema.Struct({ - "effort": Schema.optionalKey(OpenAIResponsesReasoningEffort), - "summary": Schema.optionalKey(ReasoningSummaryVerbosity) +export const TooManyRequestsResponseErrorData = Schema.Struct({ + "code": Schema.Number.check(Schema.isInt()), + "message": Schema.String, + "metadata": Schema.optionalKey(Schema.Struct({})) +}).annotate({ "description": "Error data for TooManyRequestsResponse" }) +export type TopProviderInfo = { + readonly "context_length"?: number + readonly "is_moderated": boolean + readonly "max_completion_tokens"?: number +} +export const TopProviderInfo = Schema.Struct({ + "context_length": Schema.optionalKey( + Schema.Number.annotate({ "description": "Context length from the top provider" }).check(Schema.isInt()) + ), + "is_moderated": Schema.Boolean.annotate({ "description": "Whether the top provider moderates content" }), + "max_completion_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Maximum completion tokens from the top provider" }).check(Schema.isInt()) + ) +}).annotate({ "description": "Information about the top provider for this model" }) +export type TraceConfig = { + readonly "generation_name"?: string + readonly "parent_span_id"?: string + readonly "span_name"?: string + readonly "trace_id"?: string + readonly "trace_name"?: string +} +export const TraceConfig = Schema.Struct({ + "generation_name": Schema.optionalKey(Schema.String), + "parent_span_id": Schema.optionalKey(Schema.String), + "span_name": Schema.optionalKey(Schema.String), + "trace_id": Schema.optionalKey(Schema.String), + "trace_name": Schema.optionalKey(Schema.String) +}).annotate({ + "description": + "Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations." }) -export type OpenResponsesReasoningConfig = { - readonly "effort"?: OpenAIResponsesReasoningEffort - readonly "summary"?: ReasoningSummaryVerbosity - readonly "max_tokens"?: number - readonly "enabled"?: boolean +export type Truncation = "auto" | "disabled" | null +export const Truncation = Schema.Union([Schema.Literal("auto"), Schema.Literal("disabled"), Schema.Null]) +export type UnauthorizedResponseErrorData = { + readonly "code": number + readonly "message": string + readonly "metadata"?: {} } -export const OpenResponsesReasoningConfig = Schema.Struct({ - "effort": Schema.optionalKey(OpenAIResponsesReasoningEffort), - "summary": Schema.optionalKey(ReasoningSummaryVerbosity), - "max_tokens": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "enabled": Schema.optionalKey(Schema.Boolean) -}).annotate({ "description": "Configuration for reasoning mode in the response" }) -export type ResponseFormatTextConfig = - | ResponsesFormatText - | ResponsesFormatJSONObject - | ResponsesFormatTextJSONSchemaConfig -export const ResponseFormatTextConfig = Schema.Union([ - ResponsesFormatText, - ResponsesFormatJSONObject, - ResponsesFormatTextJSONSchemaConfig -]).annotate({ "description": "Text response format configuration" }) -export type OpenResponsesLogProbs = { - readonly "logprob": number - readonly "token": string - readonly "top_logprobs"?: ReadonlyArray +export const UnauthorizedResponseErrorData = Schema.Struct({ + "code": Schema.Number.check(Schema.isInt()), + "message": Schema.String, + "metadata": Schema.optionalKey(Schema.Struct({})) +}).annotate({ "description": "Error data for UnauthorizedResponse" }) +export type UnprocessableEntityResponseErrorData = { + readonly "code": number + readonly "message": string + readonly "metadata"?: {} } -export const OpenResponsesLogProbs = Schema.Struct({ - "logprob": Schema.Number.check(Schema.isFinite()), - "token": Schema.String, - "top_logprobs": Schema.optionalKey(Schema.Array(OpenResponsesTopLogprobs)) -}).annotate({ "description": "Log probability information for a token" }) -export type BadRequestResponse = { readonly "error": BadRequestResponseErrorData; readonly "user_id"?: string } -export const BadRequestResponse = Schema.Struct({ - "error": BadRequestResponseErrorData, - "user_id": Schema.optionalKey(Schema.String) -}).annotate({ "description": "Bad Request - Invalid request parameters or malformed input" }) -export type UnauthorizedResponse = { readonly "error": UnauthorizedResponseErrorData; readonly "user_id"?: string } -export const UnauthorizedResponse = Schema.Struct({ - "error": UnauthorizedResponseErrorData, - "user_id": Schema.optionalKey(Schema.String) -}).annotate({ "description": "Unauthorized - Authentication required or invalid credentials" }) -export type PaymentRequiredResponse = { - readonly "error": PaymentRequiredResponseErrorData - readonly "user_id"?: string +export const UnprocessableEntityResponseErrorData = Schema.Struct({ + "code": Schema.Number.check(Schema.isInt()), + "message": Schema.String, + "metadata": Schema.optionalKey(Schema.Struct({})) +}).annotate({ "description": "Error data for UnprocessableEntityResponse" }) +export type UpdateBYOKKeyRequest = { + readonly "allowed_models"?: ReadonlyArray + readonly "allowed_user_ids"?: ReadonlyArray + readonly "disabled"?: boolean + readonly "is_fallback"?: boolean + readonly "key"?: string + readonly "name"?: string } -export const PaymentRequiredResponse = Schema.Struct({ - "error": PaymentRequiredResponseErrorData, - "user_id": Schema.optionalKey(Schema.String) -}).annotate({ "description": "Payment Required - Insufficient credits or quota to complete request" }) -export type NotFoundResponse = { readonly "error": NotFoundResponseErrorData; readonly "user_id"?: string } -export const NotFoundResponse = Schema.Struct({ - "error": NotFoundResponseErrorData, - "user_id": Schema.optionalKey(Schema.String) -}).annotate({ "description": "Not Found - Resource does not exist" }) -export type RequestTimeoutResponse = { readonly "error": RequestTimeoutResponseErrorData; readonly "user_id"?: string } -export const RequestTimeoutResponse = Schema.Struct({ - "error": RequestTimeoutResponseErrorData, - "user_id": Schema.optionalKey(Schema.String) -}).annotate({ "description": "Request Timeout - Operation exceeded time limit" }) -export type PayloadTooLargeResponse = { - readonly "error": PayloadTooLargeResponseErrorData - readonly "user_id"?: string -} -export const PayloadTooLargeResponse = Schema.Struct({ - "error": PayloadTooLargeResponseErrorData, - "user_id": Schema.optionalKey(Schema.String) -}).annotate({ "description": "Payload Too Large - Request payload exceeds size limits" }) -export type UnprocessableEntityResponse = { - readonly "error": UnprocessableEntityResponseErrorData - readonly "user_id"?: string -} -export const UnprocessableEntityResponse = Schema.Struct({ - "error": UnprocessableEntityResponseErrorData, - "user_id": Schema.optionalKey(Schema.String) -}).annotate({ "description": "Unprocessable Entity - Semantic validation failure" }) -export type TooManyRequestsResponse = { - readonly "error": TooManyRequestsResponseErrorData - readonly "user_id"?: string -} -export const TooManyRequestsResponse = Schema.Struct({ - "error": TooManyRequestsResponseErrorData, - "user_id": Schema.optionalKey(Schema.String) -}).annotate({ "description": "Too Many Requests - Rate limit exceeded" }) -export type InternalServerResponse = { readonly "error": InternalServerResponseErrorData; readonly "user_id"?: string } -export const InternalServerResponse = Schema.Struct({ - "error": InternalServerResponseErrorData, - "user_id": Schema.optionalKey(Schema.String) -}).annotate({ "description": "Internal Server Error - Unexpected server error" }) -export type BadGatewayResponse = { readonly "error": BadGatewayResponseErrorData; readonly "user_id"?: string } -export const BadGatewayResponse = Schema.Struct({ - "error": BadGatewayResponseErrorData, - "user_id": Schema.optionalKey(Schema.String) -}).annotate({ "description": "Bad Gateway - Provider/upstream API failure" }) -export type ServiceUnavailableResponse = { - readonly "error": ServiceUnavailableResponseErrorData - readonly "user_id"?: string +export const UpdateBYOKKeyRequest = Schema.Struct({ + "allowed_models": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "description": "Optional allowlist of model slugs this credential may be used for. `null` means no restriction." + }).check(Schema.isMaxLength(100)) + ), + "allowed_user_ids": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "description": "Optional allowlist of user IDs that may use this credential. `null` means no restriction." + }).check(Schema.isMaxLength(100)) + ), + "disabled": Schema.optionalKey(Schema.Boolean.annotate({ "description": "Whether this credential is disabled." })), + "is_fallback": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried." + }) + ), + "key": Schema.optionalKey( + Schema.String.annotate({ + "description": + "A new raw provider API key to rotate the credential in-place. The previous key material is overwritten and the masked label is regenerated. Encrypted at rest and never returned in API responses." + }).check(Schema.isMinLength(1)) + ), + "name": Schema.optionalKey( + Schema.String.annotate({ "description": "Optional human-readable name for the credential." }).check( + Schema.isMaxLength(255) + ) + ) +}) +export type UpdateObservabilityDestinationRequest = { + readonly "api_key_hashes"?: ReadonlyArray + readonly "config"?: {} + readonly "enabled"?: boolean + readonly "filter_rules"?: { + readonly "enabled"?: boolean + readonly "groups": ReadonlyArray< + { + readonly "logic"?: "and" | "or" + readonly "rules": ReadonlyArray< + { + readonly "field": + | "model" + | "provider" + | "session_id" + | "user_id" + | "api_key_name" + | "finish_reason" + | "input" + | "output" + | "total_cost" + | "total_tokens" + | "prompt_tokens" + | "completion_tokens" + readonly "operator": + | "equals" + | "not_equals" + | "contains" + | "not_contains" + | "regex" + | "starts_with" + | "ends_with" + | "gt" + | "lt" + | "gte" + | "lte" + | "exists" + | "not_exists" + readonly "value"?: string | number + } + > + } + > + } + readonly "name"?: string + readonly "privacy_mode"?: boolean + readonly "sampling_rate"?: number } -export const ServiceUnavailableResponse = Schema.Struct({ - "error": ServiceUnavailableResponseErrorData, - "user_id": Schema.optionalKey(Schema.String) -}).annotate({ "description": "Service Unavailable - Service temporarily unavailable" }) -export type EdgeNetworkTimeoutResponse = { - readonly "error": EdgeNetworkTimeoutResponseErrorData - readonly "user_id"?: string +export const UpdateObservabilityDestinationRequest = Schema.Struct({ + "api_key_hashes": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "description": + "Optional allowlist of OpenRouter API key hashes. `null` clears the filter (all keys). Omitting leaves the current value. Must contain at least one hash if provided." + }).check(Schema.isMinLength(1)) + ), + "config": Schema.optionalKey( + Schema.Struct({}).annotate({ + "description": + "Provider-specific configuration fields to update. Masked values are ignored; unset fields keep their current value." + }) + ), + "enabled": Schema.optionalKey(Schema.Boolean.annotate({ "description": "Whether the destination is enabled." })), + "filter_rules": Schema.optionalKey( + Schema.Struct({ + "enabled": Schema.optionalKey(Schema.Boolean), + "groups": Schema.Array(Schema.Struct({ + "logic": Schema.optionalKey(Schema.Literals(["and", "or"])), + "rules": Schema.Array(Schema.Struct({ + "field": Schema.Literals([ + "model", + "provider", + "session_id", + "user_id", + "api_key_name", + "finish_reason", + "input", + "output", + "total_cost", + "total_tokens", + "prompt_tokens", + "completion_tokens" + ]), + "operator": Schema.Literals([ + "equals", + "not_equals", + "contains", + "not_contains", + "regex", + "starts_with", + "ends_with", + "gt", + "lt", + "gte", + "lte", + "exists", + "not_exists" + ]), + "value": Schema.optionalKey(Schema.Union([Schema.String, Schema.Number.check(Schema.isFinite())])) + })) + })) + }).annotate({ + "description": "Optional structured filter rules. `null` clears the rules. Omitting keeps the current value." + }) + ), + "name": Schema.optionalKey(Schema.String.annotate({ "description": "Human-readable name for the destination." })), + "privacy_mode": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "When true, request/response bodies are not forwarded — only metadata." }) + ), + "sampling_rate": Schema.optionalKey( + Schema.Number.annotate({ "description": "Sampling rate between 0 and 1 (1 = 100%).", "format": "double" }).check( + Schema.isFinite() + ) + ) +}) +export type UpdateWorkspaceRequest = { + readonly "default_image_model"?: string + readonly "default_provider_sort"?: string + readonly "default_text_model"?: string + readonly "description"?: string + readonly "io_logging_api_key_ids"?: ReadonlyArray + readonly "io_logging_sampling_rate"?: number + readonly "is_data_discount_logging_enabled"?: boolean + readonly "is_observability_broadcast_enabled"?: boolean + readonly "is_observability_io_logging_enabled"?: boolean + readonly "name"?: string + readonly "slug"?: string } -export const EdgeNetworkTimeoutResponse = Schema.Struct({ - "error": EdgeNetworkTimeoutResponseErrorData, - "user_id": Schema.optionalKey(Schema.String) -}).annotate({ "description": "Infrastructure Timeout - Provider request timed out at edge network" }) -export type ProviderOverloadedResponse = { - readonly "error": ProviderOverloadedResponseErrorData - readonly "user_id"?: string +export const UpdateWorkspaceRequest = Schema.Struct({ + "default_image_model": Schema.optionalKey( + Schema.String.annotate({ "description": "Default image model for this workspace" }) + ), + "default_provider_sort": Schema.optionalKey( + Schema.String.annotate({ "description": "Default provider sort preference (price, throughput, latency, exacto)" }) + ), + "default_text_model": Schema.optionalKey( + Schema.String.annotate({ "description": "Default text model for this workspace" }) + ), + "description": Schema.optionalKey( + Schema.String.annotate({ "description": "New description for the workspace" }).check(Schema.isMaxLength(500)) + ), + "io_logging_api_key_ids": Schema.optionalKey( + Schema.Array(Schema.Number.check(Schema.isInt())).annotate({ + "description": "Optional array of API key IDs to filter I/O logging" + }) + ), + "io_logging_sampling_rate": Schema.optionalKey( + Schema.Number.annotate({ "description": "Sampling rate for I/O logging (0.0001-1)", "format": "double" }).check( + Schema.isFinite() + ) + ), + "is_data_discount_logging_enabled": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether data discount logging is enabled" }) + ), + "is_observability_broadcast_enabled": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether broadcast is enabled" }) + ), + "is_observability_io_logging_enabled": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether private logging is enabled" }) + ), + "name": Schema.optionalKey( + Schema.String.annotate({ "description": "New name for the workspace" }).check(Schema.isMinLength(1)).check( + Schema.isMaxLength(100) + ) + ), + "slug": Schema.optionalKey( + Schema.String.annotate({ + "description": + "New URL-friendly slug (lowercase alphanumeric segments separated by single hyphens, no leading/trailing hyphens)" + }).check(Schema.isMinLength(1)).check(Schema.isMaxLength(50)).check( + Schema.isPattern(new RegExp("^[a-z0-9]+(?:-[a-z0-9]+)*$")) + ) + ) +}) +export type UpdateWorkspaceResponse = { + readonly "data": { + readonly "created_at": string + readonly "created_by": string + readonly "default_image_model": string + readonly "default_provider_sort": string + readonly "default_text_model": string + readonly "description": string + readonly "id": string + readonly "io_logging_api_key_ids": ReadonlyArray + readonly "io_logging_sampling_rate": number + readonly "is_data_discount_logging_enabled": boolean + readonly "is_observability_broadcast_enabled": boolean + readonly "is_observability_io_logging_enabled": boolean + readonly "name": string + readonly "slug": string + readonly "updated_at": string + } } -export const ProviderOverloadedResponse = Schema.Struct({ - "error": ProviderOverloadedResponseErrorData, - "user_id": Schema.optionalKey(Schema.String) -}).annotate({ "description": "Provider Overloaded - Provider is temporarily overloaded" }) -export type OpenResponsesEasyInputMessage = { - readonly "type"?: "message" - readonly "role": "user" | "system" | "assistant" | "developer" - readonly "content": - | ReadonlyArray< - | ResponseInputText - | { readonly "type": "input_image"; readonly "detail": "auto" | "high" | "low"; readonly "image_url"?: string } - | ResponseInputFile - | ResponseInputAudio - | ResponseInputVideo - > - | string +export const UpdateWorkspaceResponse = Schema.Struct({ + "data": Schema.Struct({ + "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the workspace was created" }), + "created_by": Schema.String.annotate({ "description": "User ID of the workspace creator" }), + "default_image_model": Schema.String.annotate({ "description": "Default image model for this workspace" }), + "default_provider_sort": Schema.String.annotate({ + "description": "Default provider sort preference (price, throughput, latency, exacto)" + }), + "default_text_model": Schema.String.annotate({ "description": "Default text model for this workspace" }), + "description": Schema.String.annotate({ "description": "Description of the workspace" }), + "id": Schema.String.annotate({ "description": "Unique identifier for the workspace", "format": "uuid" }), + "io_logging_api_key_ids": Schema.Array(Schema.Number.check(Schema.isInt())).annotate({ + "description": "Optional array of API key IDs to filter I/O logging. Null means all keys are logged." + }), + "io_logging_sampling_rate": Schema.Number.annotate({ + "description": "Sampling rate for I/O logging (0.0001-1). 1 means 100% of requests are logged.", + "format": "double" + }).check(Schema.isFinite()), + "is_data_discount_logging_enabled": Schema.Boolean.annotate({ + "description": "Whether data discount logging is enabled for this workspace" + }), + "is_observability_broadcast_enabled": Schema.Boolean.annotate({ + "description": "Whether broadcast is enabled for this workspace" + }), + "is_observability_io_logging_enabled": Schema.Boolean.annotate({ + "description": "Whether private logging is enabled for this workspace" + }), + "name": Schema.String.annotate({ "description": "Name of the workspace" }), + "slug": Schema.String.annotate({ "description": "URL-friendly slug for the workspace" }), + "updated_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the workspace was last updated" }) + }).annotate({ "description": "The updated workspace" }) +}) +export type URLCitation = { + readonly "end_index": number + readonly "start_index": number + readonly "title": string + readonly "type": "url_citation" + readonly "url": string } -export const OpenResponsesEasyInputMessage = Schema.Struct({ - "type": Schema.optionalKey(Schema.Literal("message")), - "role": Schema.Literals(["user", "system", "assistant", "developer"]), - "content": Schema.Union([ - Schema.Array( - Schema.Union([ - ResponseInputText, - Schema.Struct({ - "type": Schema.Literal("input_image"), - "detail": Schema.Literals(["auto", "high", "low"]), - "image_url": Schema.optionalKey(Schema.String) - }).annotate({ "description": "Image input content item" }), - ResponseInputFile, - ResponseInputAudio, - ResponseInputVideo - ], { mode: "oneOf" }) - ), - Schema.String - ]) +export const URLCitation = Schema.Struct({ + "end_index": Schema.Number.check(Schema.isInt()), + "start_index": Schema.Number.check(Schema.isInt()), + "title": Schema.String, + "type": Schema.Literal("url_citation"), + "url": Schema.String }) -export type OpenResponsesInputMessageItem = { - readonly "id"?: string - readonly "type"?: "message" - readonly "role": "user" | "system" | "developer" - readonly "content": ReadonlyArray< - | ResponseInputText - | { readonly "type": "input_image"; readonly "detail": "auto" | "high" | "low"; readonly "image_url"?: string } - | ResponseInputFile - | ResponseInputAudio - | ResponseInputVideo +export type VideoGenerationUsage = { readonly "cost"?: number; readonly "is_byok"?: boolean } +export const VideoGenerationUsage = Schema.Struct({ + "cost": Schema.optionalKey( + Schema.Number.annotate({ "description": "The cost of the video generation in USD.", "format": "double" }).check( + Schema.isFinite() + ) + ), + "is_byok": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether the request was made using a Bring Your Own Key configuration." }) + ) +}).annotate({ + "description": "Usage and cost information for the video generation. Available once the job has completed." +}) +export type VideoModel = { + readonly "allowed_passthrough_parameters": ReadonlyArray + readonly "canonical_slug": string + readonly "created": number + readonly "description"?: string + readonly "generate_audio": boolean + readonly "hugging_face_id"?: string + readonly "id": string + readonly "name": string + readonly "pricing_skus"?: {} + readonly "seed": boolean + readonly "supported_aspect_ratios": ReadonlyArray< + "16:9" | "9:16" | "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "21:9" | "9:21" + > + readonly "supported_durations": ReadonlyArray + readonly "supported_frame_images": ReadonlyArray<"first_frame" | "last_frame"> + readonly "supported_resolutions": ReadonlyArray<"480p" | "720p" | "1080p" | "1K" | "2K" | "4K"> + readonly "supported_sizes": ReadonlyArray< + | "480x480" + | "480x640" + | "480x720" + | "480x854" + | "480x1120" + | "640x480" + | "720x480" + | "720x720" + | "720x960" + | "720x1080" + | "720x1280" + | "720x1680" + | "854x480" + | "960x720" + | "1080x720" + | "1080x1080" + | "1080x1440" + | "1080x1620" + | "1080x1920" + | "1080x2520" + | "1120x480" + | "1280x720" + | "1440x1080" + | "1620x1080" + | "1680x720" + | "1920x1080" + | "2160x2160" + | "2160x2880" + | "2160x3240" + | "2160x3840" + | "2160x5040" + | "2520x1080" + | "2880x2160" + | "3240x2160" + | "3840x2160" + | "5040x2160" > } -export const OpenResponsesInputMessageItem = Schema.Struct({ - "id": Schema.optionalKey(Schema.String), - "type": Schema.optionalKey(Schema.Literal("message")), - "role": Schema.Literals(["user", "system", "developer"]), - "content": Schema.Array( - Schema.Union([ - ResponseInputText, - Schema.Struct({ - "type": Schema.Literal("input_image"), - "detail": Schema.Literals(["auto", "high", "low"]), - "image_url": Schema.optionalKey(Schema.String) - }).annotate({ "description": "Image input content item" }), - ResponseInputFile, - ResponseInputAudio, - ResponseInputVideo - ], { mode: "oneOf" }) +export const VideoModel = Schema.Struct({ + "allowed_passthrough_parameters": Schema.Array(Schema.String).annotate({ + "description": "List of parameters that are allowed to be passed through to the provider" + }), + "canonical_slug": Schema.String.annotate({ "description": "Canonical slug for the model" }), + "created": Schema.Number.annotate({ "description": "Unix timestamp of when the model was created" }).check( + Schema.isInt() + ), + "description": Schema.optionalKey(Schema.String.annotate({ "description": "Description of the model" })), + "generate_audio": Schema.Boolean.annotate({ + "description": "Whether the model supports generating audio alongside video" + }), + "hugging_face_id": Schema.optionalKey( + Schema.String.annotate({ "description": "Hugging Face model identifier, if applicable" }) + ), + "id": Schema.String.annotate({ "description": "Unique identifier for the model" }), + "name": Schema.String.annotate({ "description": "Display name of the model" }), + "pricing_skus": Schema.optionalKey( + Schema.Struct({}).annotate({ "description": "Pricing SKUs with provider prefix stripped, values as strings" }) + ), + "seed": Schema.Boolean.annotate({ + "description": "Whether the model supports deterministic generation via seed parameter" + }), + "supported_aspect_ratios": Schema.Array( + Schema.Literals(["16:9", "9:16", "1:1", "4:3", "3:4", "3:2", "2:3", "21:9", "9:21"]) + ).annotate({ "description": "Supported output aspect ratios" }), + "supported_durations": Schema.Array(Schema.Number.check(Schema.isInt())).annotate({ + "description": "Supported video durations in seconds" + }), + "supported_frame_images": Schema.Array(Schema.Literals(["first_frame", "last_frame"])).annotate({ + "description": "Supported frame image types (e.g. first_frame, last_frame)" + }), + "supported_resolutions": Schema.Array(Schema.Literals(["480p", "720p", "1080p", "1K", "2K", "4K"])).annotate({ + "description": "Supported output resolutions" + }), + "supported_sizes": Schema.Array( + Schema.Literals([ + "480x480", + "480x640", + "480x720", + "480x854", + "480x1120", + "640x480", + "720x480", + "720x720", + "720x960", + "720x1080", + "720x1280", + "720x1680", + "854x480", + "960x720", + "1080x720", + "1080x1080", + "1080x1440", + "1080x1620", + "1080x1920", + "1080x2520", + "1120x480", + "1280x720", + "1440x1080", + "1620x1080", + "1680x720", + "1920x1080", + "2160x2160", + "2160x2880", + "2160x3240", + "2160x3840", + "2160x5040", + "2520x1080", + "2880x2160", + "3240x2160", + "3840x2160", + "5040x2160" + ]) + ).annotate({ "description": "Supported output sizes (width x height)" }) +}) +export type WebFetchEngineEnum = "auto" | "native" | "openrouter" | "exa" | "parallel" | "firecrawl" +export const WebFetchEngineEnum = Schema.Literals(["auto", "native", "openrouter", "exa", "parallel", "firecrawl"]) + .annotate({ + "description": + "Which fetch engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in fetch. \"exa\" uses Exa Contents API. \"openrouter\" uses direct HTTP fetch. \"firecrawl\" uses Firecrawl scrape (requires BYOK). \"parallel\" uses the Parallel extract API." + }) +export type WebFetchPlugin = { + readonly "allowed_domains"?: ReadonlyArray + readonly "blocked_domains"?: ReadonlyArray + readonly "id": "web-fetch" + readonly "max_content_tokens"?: number + readonly "max_uses"?: number +} +export const WebFetchPlugin = Schema.Struct({ + "allowed_domains": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "Only fetch from these domains." }) + ), + "blocked_domains": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "Never fetch from these domains." }) + ), + "id": Schema.Literal("web-fetch"), + "max_content_tokens": Schema.optionalKey( + Schema.Number.annotate({ + "description": "Maximum content length in approximate tokens. Content exceeding this limit is truncated." + }).check(Schema.isInt()) + ), + "max_uses": Schema.optionalKey( + Schema.Number.annotate({ + "description": "Maximum number of web fetches per request. Once exceeded, the tool returns an error." + }).check(Schema.isInt()) ) }) -export type ProviderSortConfig = { readonly "by"?: ProviderSort | null; readonly "partition"?: "model" | "none" | null } -export const ProviderSortConfig = Schema.Struct({ - "by": Schema.optionalKey(Schema.Union([ProviderSort, Schema.Null])), - "partition": Schema.optionalKey(Schema.Union([Schema.Literals(["model", "none"]), Schema.Null])) +export type WebSearchCallCompletedEvent = { + readonly "item_id": string + readonly "output_index": number + readonly "sequence_number": number + readonly "type": "response.web_search_call.completed" +} +export const WebSearchCallCompletedEvent = Schema.Struct({ + "item_id": Schema.String, + "output_index": Schema.Number.check(Schema.isInt()), + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.web_search_call.completed") +}).annotate({ "description": "Web search call completed" }) +export type WebSearchCallInProgressEvent = { + readonly "item_id": string + readonly "output_index": number + readonly "sequence_number": number + readonly "type": "response.web_search_call.in_progress" +} +export const WebSearchCallInProgressEvent = Schema.Struct({ + "item_id": Schema.String, + "output_index": Schema.Number.check(Schema.isInt()), + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.web_search_call.in_progress") +}).annotate({ "description": "Web search call in progress" }) +export type WebSearchCallSearchingEvent = { + readonly "item_id": string + readonly "output_index": number + readonly "sequence_number": number + readonly "type": "response.web_search_call.searching" +} +export const WebSearchCallSearchingEvent = Schema.Struct({ + "item_id": Schema.String, + "output_index": Schema.Number.check(Schema.isInt()), + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.web_search_call.searching") +}).annotate({ "description": "Web search call is searching" }) +export type WebSearchDomainFilter = { + readonly "allowed_domains"?: ReadonlyArray + readonly "excluded_domains"?: ReadonlyArray +} +export const WebSearchDomainFilter = Schema.Struct({ + "allowed_domains": Schema.optionalKey(Schema.Array(Schema.String)), + "excluded_domains": Schema.optionalKey(Schema.Array(Schema.String)) }) -export type PreferredMinThroughput = number | PercentileThroughputCutoffs | unknown -export const PreferredMinThroughput = Schema.Union([ - Schema.Number.check(Schema.isFinite()), - PercentileThroughputCutoffs, - Schema.Unknown -]).annotate({ - "description": - "Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold." +export type WebSearchEngine = "native" | "exa" | "firecrawl" | "parallel" +export const WebSearchEngine = Schema.Literals(["native", "exa", "firecrawl", "parallel"]).annotate({ + "description": "The search engine to use for web search." }) -export type PreferredMaxLatency = number | PercentileLatencyCutoffs | unknown -export const PreferredMaxLatency = Schema.Union([ - Schema.Number.check(Schema.isFinite()), - PercentileLatencyCutoffs, - Schema.Unknown -]).annotate({ +export type WebSearchEngineEnum = "auto" | "native" | "exa" | "parallel" | "firecrawl" +export const WebSearchEngineEnum = Schema.Literals(["auto", "native", "exa", "parallel", "firecrawl"]).annotate({ "description": - "Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold." -}) -export type PDFParserOptions = { readonly "engine"?: PDFParserEngine } -export const PDFParserOptions = Schema.Struct({ "engine": Schema.optionalKey(PDFParserEngine) }).annotate({ - "description": "Options for PDF parsing." + "Which search engine to use. \"auto\" (default) uses native if the provider supports it, otherwise Exa. \"native\" forces the provider's built-in search. \"exa\" forces the Exa search API. \"firecrawl\" uses Firecrawl (requires BYOK). \"parallel\" uses the Parallel search API." }) -export type ForbiddenResponse = { readonly "error": ForbiddenResponseErrorData; readonly "user_id"?: string } -export const ForbiddenResponse = Schema.Struct({ - "error": ForbiddenResponseErrorData, - "user_id": Schema.optionalKey(Schema.String) -}).annotate({ "description": "Forbidden - Authentication successful but insufficient permissions" }) -export type ModelArchitecture = { - readonly "tokenizer"?: ModelGroup - readonly "instruct_type"?: - | "none" - | "airoboros" - | "alpaca" - | "alpaca-modif" - | "chatml" - | "claude" - | "code-llama" - | "gemma" - | "llama2" - | "llama3" - | "mistral" - | "nemotron" - | "neural" - | "openchat" - | "phi3" - | "rwkv" - | "vicuna" - | "zephyr" - | "deepseek-r1" - | "deepseek-v3.1" - | "qwq" - | "qwen3" - readonly "modality": string - readonly "input_modalities": ReadonlyArray - readonly "output_modalities": ReadonlyArray +export type WebSearchSource = { readonly "type": "url"; readonly "url": string } +export const WebSearchSource = Schema.Struct({ "type": Schema.Literal("url"), "url": Schema.String }) +export type WebSearchStatus = "completed" | "searching" | "in_progress" | "failed" +export const WebSearchStatus = Schema.Literals(["completed", "searching", "in_progress", "failed"]) +export type WebSearchUserLocation = { + readonly "city"?: string + readonly "country"?: string + readonly "region"?: string + readonly "timezone"?: string + readonly "type"?: "approximate" } -export const ModelArchitecture = Schema.Struct({ - "tokenizer": Schema.optionalKey(ModelGroup), - "instruct_type": Schema.optionalKey( - Schema.Literals([ - "none", - "airoboros", - "alpaca", - "alpaca-modif", - "chatml", - "claude", - "code-llama", - "gemma", - "llama2", - "llama3", - "mistral", - "nemotron", - "neural", - "openchat", - "phi3", - "rwkv", - "vicuna", - "zephyr", - "deepseek-r1", - "deepseek-v3.1", - "qwq", - "qwen3" - ]).annotate({ "description": "Instruction format type" }) - ), - "modality": Schema.String.annotate({ "description": "Primary modality of the model" }), - "input_modalities": Schema.Array(InputModality).annotate({ "description": "Supported input modalities" }), - "output_modalities": Schema.Array(OutputModality).annotate({ "description": "Supported output modalities" }) -}).annotate({ "description": "Model architecture information" }) -export type PublicEndpoint = { +export const WebSearchUserLocation = Schema.Struct({ + "city": Schema.optionalKey(Schema.String), + "country": Schema.optionalKey(Schema.String), + "region": Schema.optionalKey(Schema.String), + "timezone": Schema.optionalKey(Schema.String), + "type": Schema.optionalKey(Schema.Literal("approximate")) +}).annotate({ "description": "User location information for web search" }) +export type WebSearchUserLocationServerTool = { + readonly "city"?: string + readonly "country"?: string + readonly "region"?: string + readonly "timezone"?: string + readonly "type"?: "approximate" +} +export const WebSearchUserLocationServerTool = Schema.Struct({ + "city": Schema.optionalKey(Schema.String), + "country": Schema.optionalKey(Schema.String), + "region": Schema.optionalKey(Schema.String), + "timezone": Schema.optionalKey(Schema.String), + "type": Schema.optionalKey(Schema.Literal("approximate")) +}).annotate({ "description": "Approximate user location for location-biased results." }) +export type Workspace = { + readonly "created_at": string + readonly "created_by": string + readonly "default_image_model": string + readonly "default_provider_sort": string + readonly "default_text_model": string + readonly "description": string + readonly "id": string + readonly "io_logging_api_key_ids": ReadonlyArray + readonly "io_logging_sampling_rate": number + readonly "is_data_discount_logging_enabled": boolean + readonly "is_observability_broadcast_enabled": boolean + readonly "is_observability_io_logging_enabled": boolean readonly "name": string - readonly "model_id": string - readonly "model_name": string - readonly "context_length": number - readonly "pricing": { - readonly "prompt": string - readonly "completion": string - readonly "request"?: string - readonly "image"?: string - readonly "image_token"?: string - readonly "image_output"?: string - readonly "audio"?: string - readonly "audio_output"?: string - readonly "input_audio_cache"?: string - readonly "web_search"?: string - readonly "internal_reasoning"?: string - readonly "input_cache_read"?: string - readonly "input_cache_write"?: string - readonly "discount"?: number - } - readonly "provider_name": ProviderName - readonly "tag": string - readonly "quantization": "int4" | "int8" | "fp4" | "fp6" | "fp8" | "fp16" | "bf16" | "fp32" | "unknown" - readonly "max_completion_tokens": number - readonly "max_prompt_tokens": number - readonly "supported_parameters": ReadonlyArray - readonly "status"?: EndpointStatus - readonly "uptime_last_30m": number - readonly "supports_implicit_caching": boolean - readonly "latency_last_30m": PercentileStats - readonly "throughput_last_30m": { - readonly "p50": number - readonly "p75": number - readonly "p90": number - readonly "p99": number - } + readonly "slug": string + readonly "updated_at": string } -export const PublicEndpoint = Schema.Struct({ - "name": Schema.String, - "model_id": Schema.String.annotate({ "description": "The unique identifier for the model (permaslug)" }), - "model_name": Schema.String, - "context_length": Schema.Number.check(Schema.isFinite()), - "pricing": Schema.Struct({ - "prompt": Schema.String.annotate({ "description": "A number or string value representing a large number" }), - "completion": Schema.String.annotate({ "description": "A number or string value representing a large number" }), - "request": Schema.optionalKey( - Schema.String.annotate({ "description": "A number or string value representing a large number" }) - ), - "image": Schema.optionalKey( - Schema.String.annotate({ "description": "A number or string value representing a large number" }) - ), - "image_token": Schema.optionalKey( - Schema.String.annotate({ "description": "A number or string value representing a large number" }) - ), - "image_output": Schema.optionalKey( - Schema.String.annotate({ "description": "A number or string value representing a large number" }) - ), - "audio": Schema.optionalKey( - Schema.String.annotate({ "description": "A number or string value representing a large number" }) - ), - "audio_output": Schema.optionalKey( - Schema.String.annotate({ "description": "A number or string value representing a large number" }) - ), - "input_audio_cache": Schema.optionalKey( - Schema.String.annotate({ "description": "A number or string value representing a large number" }) - ), - "web_search": Schema.optionalKey( - Schema.String.annotate({ "description": "A number or string value representing a large number" }) - ), - "internal_reasoning": Schema.optionalKey( - Schema.String.annotate({ "description": "A number or string value representing a large number" }) - ), - "input_cache_read": Schema.optionalKey( - Schema.String.annotate({ "description": "A number or string value representing a large number" }) - ), - "input_cache_write": Schema.optionalKey( - Schema.String.annotate({ "description": "A number or string value representing a large number" }) - ), - "discount": Schema.optionalKey(Schema.Number.check(Schema.isFinite())) +export const Workspace = Schema.Struct({ + "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the workspace was created" }), + "created_by": Schema.String.annotate({ "description": "User ID of the workspace creator" }), + "default_image_model": Schema.String.annotate({ "description": "Default image model for this workspace" }), + "default_provider_sort": Schema.String.annotate({ + "description": "Default provider sort preference (price, throughput, latency, exacto)" }), - "provider_name": ProviderName, - "tag": Schema.String, - "quantization": Schema.Literals(["int4", "int8", "fp4", "fp6", "fp8", "fp16", "bf16", "fp32", "unknown"]), - "max_completion_tokens": Schema.Number.check(Schema.isFinite()), - "max_prompt_tokens": Schema.Number.check(Schema.isFinite()), - "supported_parameters": Schema.Array(Parameter), - "status": Schema.optionalKey(EndpointStatus), - "uptime_last_30m": Schema.Number.check(Schema.isFinite()), - "supports_implicit_caching": Schema.Boolean, - "latency_last_30m": PercentileStats, - "throughput_last_30m": Schema.Struct({ - "p50": Schema.Number.annotate({ "description": "Median (50th percentile)" }).check(Schema.isFinite()), - "p75": Schema.Number.annotate({ "description": "75th percentile" }).check(Schema.isFinite()), - "p90": Schema.Number.annotate({ "description": "90th percentile" }).check(Schema.isFinite()), - "p99": Schema.Number.annotate({ "description": "99th percentile" }).check(Schema.isFinite()) - }).annotate({ - "description": - "Throughput percentiles in tokens per second over the last 30 minutes. Throughput measures output token generation speed. Only visible when authenticated with an API key or cookie; returns null for unauthenticated requests." - }) -}).annotate({ "description": "Information about a specific model endpoint" }) -export type __schema20 = { - readonly "type": "reasoning.summary" - readonly "summary": string - readonly "id"?: __schema21 - readonly "format"?: __schema22 - readonly "index"?: __schema11 -} | { - readonly "type": "reasoning.encrypted" - readonly "data": string - readonly "id"?: __schema21 - readonly "format"?: __schema22 - readonly "index"?: __schema11 -} | { - readonly "type": "reasoning.text" - readonly "text"?: string | null - readonly "signature"?: string | null - readonly "id"?: __schema21 - readonly "format"?: __schema22 - readonly "index"?: __schema11 -} -export const __schema20 = Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("reasoning.summary"), - "summary": Schema.String, - "id": Schema.optionalKey(__schema21), - "format": Schema.optionalKey(__schema22), - "index": Schema.optionalKey(__schema11) + "default_text_model": Schema.String.annotate({ "description": "Default text model for this workspace" }), + "description": Schema.String.annotate({ "description": "Description of the workspace" }), + "id": Schema.String.annotate({ "description": "Unique identifier for the workspace", "format": "uuid" }), + "io_logging_api_key_ids": Schema.Array(Schema.Number.check(Schema.isInt())).annotate({ + "description": "Optional array of API key IDs to filter I/O logging. Null means all keys are logged." }), - Schema.Struct({ - "type": Schema.Literal("reasoning.encrypted"), - "data": Schema.String, - "id": Schema.optionalKey(__schema21), - "format": Schema.optionalKey(__schema22), - "index": Schema.optionalKey(__schema11) + "io_logging_sampling_rate": Schema.Number.annotate({ + "description": "Sampling rate for I/O logging (0.0001-1). 1 means 100% of requests are logged.", + "format": "double" + }).check(Schema.isFinite()), + "is_data_discount_logging_enabled": Schema.Boolean.annotate({ + "description": "Whether data discount logging is enabled for this workspace" }), - Schema.Struct({ - "type": Schema.Literal("reasoning.text"), - "text": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "signature": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "id": Schema.optionalKey(__schema21), - "format": Schema.optionalKey(__schema22), - "index": Schema.optionalKey(__schema11) - }) -], { mode: "oneOf" }) -export type __schema14 = __schema11 | ModelName | __schema13 -export const __schema14 = Schema.Union([__schema11, ModelName, __schema13]) -export type ChatMessageTokenLogprobs = { - readonly "content": ReadonlyArray | null - readonly "refusal": ReadonlyArray | null -} -export const ChatMessageTokenLogprobs = Schema.Struct({ - "content": Schema.Union([Schema.Array(ChatMessageTokenLogprob), Schema.Null]), - "refusal": Schema.Union([Schema.Array(ChatMessageTokenLogprob), Schema.Null]) -}) -export type __schema26 = ChatCompletionFinishReason | null -export const __schema26 = Schema.Union([ChatCompletionFinishReason, Schema.Null]) -export type ResponseFormatJSONSchema = { readonly "type": "json_schema"; readonly "json_schema": JSONSchemaConfig } -export const ResponseFormatJSONSchema = Schema.Struct({ - "type": Schema.Literal("json_schema"), - "json_schema": JSONSchemaConfig -}) -export type ChatMessageContentItemText = { - readonly "type": "text" - readonly "text": string - readonly "cache_control"?: ChatMessageContentItemCacheControl + "is_observability_broadcast_enabled": Schema.Boolean.annotate({ + "description": "Whether broadcast is enabled for this workspace" + }), + "is_observability_io_logging_enabled": Schema.Boolean.annotate({ + "description": "Whether private logging is enabled for this workspace" + }), + "name": Schema.String.annotate({ "description": "Name of the workspace" }), + "slug": Schema.String.annotate({ "description": "URL-friendly slug for the workspace" }), + "updated_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the workspace was last updated" }) +}) +export type WorkspaceMember = { + readonly "created_at": string + readonly "id": string + readonly "role": "admin" | "member" + readonly "user_id": string + readonly "workspace_id": string } -export const ChatMessageContentItemText = Schema.Struct({ - "type": Schema.Literal("text"), - "text": Schema.String, - "cache_control": Schema.optionalKey(ChatMessageContentItemCacheControl) +export const WorkspaceMember = Schema.Struct({ + "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the membership was created" }), + "id": Schema.String.annotate({ "description": "Unique identifier for the workspace membership", "format": "uuid" }), + "role": Schema.Literals(["admin", "member"]).annotate({ "description": "Role of the member in the workspace" }), + "user_id": Schema.String.annotate({ "description": "Clerk user ID of the member" }), + "workspace_id": Schema.String.annotate({ "description": "ID of the workspace", "format": "uuid" }) }) -export type ToolDefinitionJson = { - readonly "type": "function" - readonly "function": { - readonly "name": string - readonly "description"?: string - readonly "parameters"?: {} - readonly "strict"?: boolean | null - } - readonly "cache_control"?: ChatMessageContentItemCacheControl +export type ActivityResponse = { readonly "data": ReadonlyArray } +export const ActivityResponse = Schema.Struct({ + "data": Schema.Array(ActivityItem).annotate({ "description": "List of activity items" }) +}) +export type AnthropicBashCodeExecutionResult = { + readonly "content": ReadonlyArray + readonly "return_code": number + readonly "stderr": string + readonly "stdout": string + readonly "type": "bash_code_execution_result" } -export const ToolDefinitionJson = Schema.Struct({ - "type": Schema.Literal("function"), - "function": Schema.Struct({ - "name": Schema.String.check(Schema.isMaxLength(64)), - "description": Schema.optionalKey(Schema.String), - "parameters": Schema.optionalKey(Schema.Struct({}).check(Schema.isPropertyNames(Schema.String))), - "strict": Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])) - }), - "cache_control": Schema.optionalKey(ChatMessageContentItemCacheControl) +export const AnthropicBashCodeExecutionResult = Schema.Struct({ + "content": Schema.Array(AnthropicBashCodeExecutionOutput), + "return_code": Schema.Number.check(Schema.isInt()), + "stderr": Schema.String, + "stdout": Schema.String, + "type": Schema.Literal("bash_code_execution_result") }) -export type ToolChoiceOption = "none" | "auto" | "required" | NamedToolChoice -export const ToolChoiceOption = Schema.Union([ - Schema.Literal("none"), - Schema.Literal("auto"), - Schema.Literal("required"), - NamedToolChoice -]) -export type ResponseOutputText = { - readonly "type": "output_text" - readonly "text": string - readonly "annotations"?: ReadonlyArray - readonly "logprobs"?: ReadonlyArray< - { - readonly "token": string - readonly "bytes": ReadonlyArray - readonly "logprob": number - readonly "top_logprobs": ReadonlyArray< - { readonly "token": string; readonly "bytes": ReadonlyArray; readonly "logprob": number } - > +export type AnthropicCacheControlDirective = { readonly "ttl"?: AnthropicCacheControlTtl; readonly "type": "ephemeral" } +export const AnthropicCacheControlDirective = Schema.Struct({ + "ttl": Schema.optionalKey(AnthropicCacheControlTtl), + "type": Schema.Literal("ephemeral") +}).annotate({ + "description": + "Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models." +}) +export type ChatContentCacheControl = { readonly "ttl"?: AnthropicCacheControlTtl; readonly "type": "ephemeral" } +export const ChatContentCacheControl = Schema.Struct({ + "ttl": Schema.optionalKey(AnthropicCacheControlTtl), + "type": Schema.Literal("ephemeral") +}).annotate({ + "description": + "Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models." +}) +export type AnthropicTextCitation = + | AnthropicCitationCharLocation + | AnthropicCitationPageLocation + | AnthropicCitationContentBlockLocation + | AnthropicCitationWebSearchResultLocation + | AnthropicCitationSearchResultLocation +export const AnthropicTextCitation = Schema.Union([ + AnthropicCitationCharLocation, + AnthropicCitationPageLocation, + AnthropicCitationContentBlockLocation, + AnthropicCitationWebSearchResultLocation, + AnthropicCitationSearchResultLocation +], { mode: "oneOf" }) +export type MessagesContentBlockDeltaEvent = { + readonly "delta": + | { readonly "text": string; readonly "type": "text_delta" } + | { readonly "partial_json": string; readonly "type": "input_json_delta" } + | { readonly "thinking": string; readonly "type": "thinking_delta" } + | { readonly "signature": string; readonly "type": "signature_delta" } + | { + readonly "citation": + | AnthropicCitationCharLocation + | AnthropicCitationPageLocation + | AnthropicCitationContentBlockLocation + | AnthropicCitationWebSearchResultLocation + | AnthropicCitationSearchResultLocation + readonly "type": "citations_delta" } - > + | { readonly "content": string; readonly "type": "compaction_delta" } + readonly "index": number + readonly "type": "content_block_delta" } -export const ResponseOutputText = Schema.Struct({ - "type": Schema.Literal("output_text"), - "text": Schema.String, - "annotations": Schema.optionalKey(Schema.Array(OpenAIResponsesAnnotation)), - "logprobs": Schema.optionalKey(Schema.Array(Schema.Struct({ - "token": Schema.String, - "bytes": Schema.Array(Schema.Number.check(Schema.isFinite())), - "logprob": Schema.Number.check(Schema.isFinite()), - "top_logprobs": Schema.Array( - Schema.Struct({ - "token": Schema.String, - "bytes": Schema.Array(Schema.Number.check(Schema.isFinite())), - "logprob": Schema.Number.check(Schema.isFinite()) - }) - ) - }))) +export const MessagesContentBlockDeltaEvent = Schema.Struct({ + "delta": Schema.Union([ + Schema.Struct({ "text": Schema.String, "type": Schema.Literal("text_delta") }), + Schema.Struct({ "partial_json": Schema.String, "type": Schema.Literal("input_json_delta") }), + Schema.Struct({ "thinking": Schema.String, "type": Schema.Literal("thinking_delta") }), + Schema.Struct({ "signature": Schema.String, "type": Schema.Literal("signature_delta") }), + Schema.Struct({ + "citation": Schema.Union([ + AnthropicCitationCharLocation, + AnthropicCitationPageLocation, + AnthropicCitationContentBlockLocation, + AnthropicCitationWebSearchResultLocation, + AnthropicCitationSearchResultLocation + ], { mode: "oneOf" }), + "type": Schema.Literal("citations_delta") + }), + Schema.Struct({ "content": Schema.String, "type": Schema.Literal("compaction_delta") }) + ], { mode: "oneOf" }), + "index": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("content_block_delta") +}).annotate({ "description": "Event sent when content is added to a content block" }) +export type AnthropicCodeExecutionResult = { + readonly "content": ReadonlyArray + readonly "return_code": number + readonly "stderr": string + readonly "stdout": string + readonly "type": "code_execution_result" +} +export const AnthropicCodeExecutionResult = Schema.Struct({ + "content": Schema.Array(AnthropicCodeExecutionOutput), + "return_code": Schema.Number.check(Schema.isInt()), + "stderr": Schema.String, + "stdout": Schema.String, + "type": Schema.Literal("code_execution_result") }) -export type OpenResponsesOutputTextAnnotationAddedEvent = { - readonly "type": "response.output_text.annotation.added" - readonly "output_index": number - readonly "item_id": string - readonly "content_index": number - readonly "sequence_number": number - readonly "annotation_index": number - readonly "annotation": OpenAIResponsesAnnotation +export type AnthropicEncryptedCodeExecutionResult = { + readonly "content": ReadonlyArray + readonly "encrypted_stdout": string + readonly "return_code": number + readonly "stderr": string + readonly "type": "encrypted_code_execution_result" } -export const OpenResponsesOutputTextAnnotationAddedEvent = Schema.Struct({ - "type": Schema.Literal("response.output_text.annotation.added"), - "output_index": Schema.Number.check(Schema.isFinite()), - "item_id": Schema.String, - "content_index": Schema.Number.check(Schema.isFinite()), - "sequence_number": Schema.Number.check(Schema.isFinite()), - "annotation_index": Schema.Number.check(Schema.isFinite()), - "annotation": OpenAIResponsesAnnotation -}).annotate({ "description": "Event emitted when a text annotation is added to output" }) -export type ResponseTextConfig = { - readonly "format"?: ResponseFormatTextConfig - readonly "verbosity"?: "high" | "low" | "medium" +export const AnthropicEncryptedCodeExecutionResult = Schema.Struct({ + "content": Schema.Array(AnthropicCodeExecutionOutput), + "encrypted_stdout": Schema.String, + "return_code": Schema.Number.check(Schema.isInt()), + "stderr": Schema.String, + "type": Schema.Literal("encrypted_code_execution_result") +}) +export type AnthropicCaller = + | AnthropicDirectCaller + | AnthropicCodeExecution20250825Caller + | AnthropicCodeExecution20260120Caller +export const AnthropicCaller = Schema.Union([ + AnthropicDirectCaller, + AnthropicCodeExecution20250825Caller, + AnthropicCodeExecution20260120Caller +], { mode: "oneOf" }) +export type ORAnthropicNullableCaller = + | AnthropicDirectCaller + | AnthropicCodeExecution20250825Caller + | AnthropicCodeExecution20260120Caller + | unknown +export const ORAnthropicNullableCaller = Schema.Union([ + AnthropicDirectCaller, + AnthropicCodeExecution20250825Caller, + AnthropicCodeExecution20260120Caller, + Schema.Unknown +], { mode: "oneOf" }) +export type AnthropicBase64ImageSource = { + readonly "data": string + readonly "media_type": AnthropicImageMimeType + readonly "type": "base64" } -export const ResponseTextConfig = Schema.Struct({ - "format": Schema.optionalKey(ResponseFormatTextConfig), - "verbosity": Schema.optionalKey(Schema.Literals(["high", "low", "medium"])) -}).annotate({ "description": "Text output configuration including format and verbosity" }) -export type OpenResponsesResponseText = { - readonly "format"?: ResponseFormatTextConfig - readonly "verbosity"?: "high" | "low" | "medium" +export const AnthropicBase64ImageSource = Schema.Struct({ + "data": Schema.String, + "media_type": AnthropicImageMimeType, + "type": Schema.Literal("base64") +}) +export type AnthropicAdvisorMessageUsageIteration = { + readonly "cache_creation"?: AnthropicIterationCacheCreation + readonly "cache_creation_input_tokens"?: number + readonly "cache_read_input_tokens"?: number + readonly "input_tokens"?: number + readonly "output_tokens"?: number + readonly "model": string + readonly "type": "advisor_message" } -export const OpenResponsesResponseText = Schema.Struct({ - "format": Schema.optionalKey(ResponseFormatTextConfig), - "verbosity": Schema.optionalKey(Schema.Literals(["high", "low", "medium"])) -}).annotate({ "description": "Text output configuration including format and verbosity" }) -export type OpenResponsesTextDeltaEvent = { - readonly "type": "response.output_text.delta" - readonly "logprobs": ReadonlyArray - readonly "output_index": number - readonly "item_id": string - readonly "content_index": number - readonly "delta": string - readonly "sequence_number": number +export const AnthropicAdvisorMessageUsageIteration = Schema.Struct({ + "cache_creation": Schema.optionalKey(AnthropicIterationCacheCreation), + "cache_creation_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "cache_read_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "model": Schema.String, + "type": Schema.Literal("advisor_message") +}) +export type AnthropicCompactionUsageIteration = { + readonly "cache_creation"?: AnthropicIterationCacheCreation + readonly "cache_creation_input_tokens"?: number + readonly "cache_read_input_tokens"?: number + readonly "input_tokens"?: number + readonly "output_tokens"?: number + readonly "type": "compaction" } -export const OpenResponsesTextDeltaEvent = Schema.Struct({ - "type": Schema.Literal("response.output_text.delta"), - "logprobs": Schema.Array(OpenResponsesLogProbs), - "output_index": Schema.Number.check(Schema.isFinite()), - "item_id": Schema.String, - "content_index": Schema.Number.check(Schema.isFinite()), - "delta": Schema.String, - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Event emitted when a text delta is streamed" }) -export type OpenResponsesTextDoneEvent = { - readonly "type": "response.output_text.done" - readonly "output_index": number - readonly "item_id": string - readonly "content_index": number - readonly "text": string - readonly "sequence_number": number - readonly "logprobs": ReadonlyArray +export const AnthropicCompactionUsageIteration = Schema.Struct({ + "cache_creation": Schema.optionalKey(AnthropicIterationCacheCreation), + "cache_creation_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "cache_read_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "type": Schema.Literal("compaction") +}) +export type AnthropicMessageUsageIteration = { + readonly "cache_creation"?: AnthropicIterationCacheCreation + readonly "cache_creation_input_tokens"?: number + readonly "cache_read_input_tokens"?: number + readonly "input_tokens"?: number + readonly "output_tokens"?: number + readonly "type": "message" } -export const OpenResponsesTextDoneEvent = Schema.Struct({ - "type": Schema.Literal("response.output_text.done"), - "output_index": Schema.Number.check(Schema.isFinite()), - "item_id": Schema.String, - "content_index": Schema.Number.check(Schema.isFinite()), - "text": Schema.String, - "sequence_number": Schema.Number.check(Schema.isFinite()), - "logprobs": Schema.Array(OpenResponsesLogProbs) -}).annotate({ "description": "Event emitted when text streaming is complete" }) -export type ProviderSortUnion = ProviderSort | ProviderSortConfig -export const ProviderSortUnion = Schema.Union([ProviderSort, ProviderSortConfig]) -export type ProviderPreferences = { - readonly "allow_fallbacks"?: boolean - readonly "require_parameters"?: boolean - readonly "data_collection"?: DataCollection - readonly "zdr"?: boolean - readonly "enforce_distillable_text"?: boolean - readonly "order"?: ReadonlyArray - readonly "only"?: ReadonlyArray - readonly "ignore"?: ReadonlyArray - readonly "quantizations"?: ReadonlyArray - readonly "sort"?: "price" | "price" | "throughput" | "throughput" | "latency" | "latency" - readonly "max_price"?: { - readonly "prompt"?: BigNumberUnion - readonly "completion"?: string - readonly "image"?: string - readonly "audio"?: string - readonly "request"?: string - } - readonly "preferred_min_throughput"?: PreferredMinThroughput - readonly "preferred_max_latency"?: PreferredMaxLatency +export const AnthropicMessageUsageIteration = Schema.Struct({ + "cache_creation": Schema.optionalKey(AnthropicIterationCacheCreation), + "cache_creation_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "cache_read_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "type": Schema.Literal("message") +}) +export type AnthropicUnknownUsageIteration = { + readonly "cache_creation"?: AnthropicIterationCacheCreation + readonly "cache_creation_input_tokens"?: number + readonly "cache_read_input_tokens"?: number + readonly "input_tokens"?: number + readonly "output_tokens"?: number + readonly "type": string } -export const ProviderPreferences = Schema.Struct({ - "allow_fallbacks": Schema.optionalKey(Schema.Boolean.annotate({ +export const AnthropicUnknownUsageIteration = Schema.Struct({ + "cache_creation": Schema.optionalKey(AnthropicIterationCacheCreation), + "cache_creation_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "cache_read_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "type": Schema.String +}) +export type AnthropicDocumentBlock = { + readonly "citations"?: AnthropicCitationsConfig + readonly "source": AnthropicBase64PdfSource | AnthropicPlainTextSource + readonly "title": string + readonly "type": "document" +} +export const AnthropicDocumentBlock = Schema.Struct({ + "citations": Schema.optionalKey(AnthropicCitationsConfig), + "source": Schema.Union([AnthropicBase64PdfSource, AnthropicPlainTextSource]), + "title": Schema.String, + "type": Schema.Literal("document") +}) +export type AnthropicCodeExecutionToolResultError = { + readonly "error_code": AnthropicServerToolErrorCode + readonly "type": "code_execution_tool_result_error" +} +export const AnthropicCodeExecutionToolResultError = Schema.Struct({ + "error_code": AnthropicServerToolErrorCode, + "type": Schema.Literal("code_execution_tool_result_error") +}) +export type AnthropicToolSearchResultError = { + readonly "error_code": AnthropicServerToolErrorCode + readonly "error_message": string + readonly "type": "tool_search_tool_result_error" +} +export const AnthropicToolSearchResultError = Schema.Struct({ + "error_code": AnthropicServerToolErrorCode, + "error_message": Schema.String, + "type": Schema.Literal("tool_search_tool_result_error") +}) +export type AnthropicTextEditorCodeExecutionContent = + | AnthropicTextEditorCodeExecutionToolResultError + | AnthropicTextEditorCodeExecutionViewResult + | AnthropicTextEditorCodeExecutionCreateResult + | AnthropicTextEditorCodeExecutionStrReplaceResult +export const AnthropicTextEditorCodeExecutionContent = Schema.Union([ + AnthropicTextEditorCodeExecutionToolResultError, + AnthropicTextEditorCodeExecutionViewResult, + AnthropicTextEditorCodeExecutionCreateResult, + AnthropicTextEditorCodeExecutionStrReplaceResult +], { mode: "oneOf" }) +export type AnthropicToolSearchResult = { + readonly "tool_references": ReadonlyArray + readonly "type": "tool_search_tool_search_result" +} +export const AnthropicToolSearchResult = Schema.Struct({ + "tool_references": Schema.Array(AnthropicToolReference), + "type": Schema.Literal("tool_search_tool_search_result") +}) +export type ApplyPatchServerToolConfig = { readonly "engine"?: ApplyPatchEngineEnum } +export const ApplyPatchServerToolConfig = Schema.Struct({ "engine": Schema.optionalKey(ApplyPatchEngineEnum) }) + .annotate({ "description": "Configuration for the openrouter:apply_patch server tool" }) +export type ApplyPatchCallOperation = + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation +export const ApplyPatchCallOperation = Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation +], { mode: "oneOf" }).annotate({ + "description": + "The patch operation requested by an `apply_patch_call`. `create_file` and `update_file` carry a V4A diff; `delete_file` omits it." +}) +export type OutputItemApplyPatchCall = { + readonly "call_id": string + readonly "created_by"?: string + readonly "id": string + readonly "operation": ApplyPatchCreateFileOperation | ApplyPatchUpdateFileOperation | ApplyPatchDeleteFileOperation + readonly "status": "in_progress" | "completed" + readonly "type": "apply_patch_call" +} +export const OutputItemApplyPatchCall = Schema.Struct({ + "call_id": Schema.String, + "created_by": Schema.optionalKey(Schema.String), + "id": Schema.String, + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }), + "status": Schema.Literals(["in_progress", "completed"]), + "type": Schema.Literal("apply_patch_call") +}) +export type BadGatewayResponse = { + readonly "error": BadGatewayResponseErrorData + readonly "openrouter_metadata"?: {} + readonly "user_id"?: string +} +export const BadGatewayResponse = Schema.Struct({ + "error": BadGatewayResponseErrorData, + "openrouter_metadata": Schema.optionalKey(Schema.Struct({})), + "user_id": Schema.optionalKey(Schema.String) +}).annotate({ "description": "Bad Gateway - Provider/upstream API failure" }) +export type BadRequestResponse = { + readonly "error": BadRequestResponseErrorData + readonly "openrouter_metadata"?: {} + readonly "user_id"?: string +} +export const BadRequestResponse = Schema.Struct({ + "error": BadRequestResponseErrorData, + "openrouter_metadata": Schema.optionalKey(Schema.Struct({})), + "user_id": Schema.optionalKey(Schema.String) +}).annotate({ "description": "Bad Request - Invalid request parameters or malformed input" }) +export type BYOKKey = { + readonly "allowed_api_key_hashes": ReadonlyArray + readonly "allowed_models": ReadonlyArray + readonly "allowed_user_ids": ReadonlyArray + readonly "created_at": string + readonly "disabled": boolean + readonly "id": string + readonly "is_fallback": boolean + readonly "label": string + readonly "name"?: string + readonly "provider": BYOKProviderSlug + readonly "sort_order": number + readonly "workspace_id": string +} +export const BYOKKey = Schema.Struct({ + "allowed_api_key_hashes": Schema.Array(Schema.String).annotate({ "description": - "Whether to allow backup providers to serve requests\n- true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider.\n- false: use only the primary/custom provider, and return the upstream error if it's unavailable.\n" - })), - "require_parameters": Schema.optionalKey( - Schema.Boolean.annotate({ - "description": - "Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest." - }) + "Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) that may use this credential. `null` means no restriction." + }).check(Schema.isMaxLength(100)), + "allowed_models": Schema.Array(Schema.String).annotate({ + "description": "Optional allowlist of model slugs this credential may be used for. `null` means no restriction." + }).check(Schema.isMaxLength(100)), + "allowed_user_ids": Schema.Array(Schema.String).annotate({ + "description": "Optional allowlist of user IDs that may use this credential. `null` means no restriction." + }).check(Schema.isMaxLength(100)), + "created_at": Schema.String.annotate({ "description": "ISO timestamp of when the credential was created." }), + "disabled": Schema.Boolean.annotate({ "description": "Whether this credential is currently disabled." }), + "id": Schema.String.annotate({ + "description": "Stable public identifier for this BYOK credential.", + "format": "uuid" + }), + "is_fallback": Schema.Boolean.annotate({ + "description": + "Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried." + }), + "label": Schema.String.annotate({ + "description": "Short masked snippet of the key (e.g. the first/last few characters) used to identify it in the UI." + }), + "name": Schema.optionalKey( + Schema.String.annotate({ "description": "Optional human-readable name for the credential." }) ), - "data_collection": Schema.optionalKey(DataCollection), - "zdr": Schema.optionalKey( + "provider": BYOKProviderSlug, + "sort_order": Schema.Number.annotate({ + "description": "Position within the provider — credentials are tried in ascending sort order." + }).check(Schema.isInt()), + "workspace_id": Schema.String.annotate({ + "description": "ID of the workspace this credential belongs to.", + "format": "uuid" + }) +}) +export type CreateBYOKKeyRequest = { + readonly "allowed_models"?: ReadonlyArray + readonly "allowed_user_ids"?: ReadonlyArray + readonly "disabled"?: boolean + readonly "is_fallback"?: boolean + readonly "key": string + readonly "name"?: string + readonly "provider": BYOKProviderSlug + readonly "workspace_id"?: string +} +export const CreateBYOKKeyRequest = Schema.Struct({ + "allowed_models": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "description": "Optional allowlist of model slugs this credential may be used for. `null` means no restriction." + }).check(Schema.isMaxLength(100)) + ), + "allowed_user_ids": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "description": "Optional allowlist of user IDs that may use this credential. `null` means no restriction." + }).check(Schema.isMaxLength(100)) + ), + "disabled": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether this credential should be created in a disabled state." }) + ), + "is_fallback": Schema.optionalKey( Schema.Boolean.annotate({ "description": - "Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used." + "Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried." }) ), - "enforce_distillable_text": Schema.optionalKey( - Schema.Boolean.annotate({ + "key": Schema.String.annotate({ + "description": + "The raw provider API key or credential. This value is encrypted at rest and never returned in API responses." + }).check(Schema.isMinLength(1)), + "name": Schema.optionalKey( + Schema.String.annotate({ "description": "Optional human-readable name for the credential." }).check( + Schema.isMaxLength(255) + ) + ), + "provider": BYOKProviderSlug, + "workspace_id": Schema.optionalKey( + Schema.String.annotate({ + "description": "Optional workspace ID. Defaults to the authenticated entity's default workspace.", + "format": "uuid" + }) + ) +}) +export type CreateBYOKKeyResponse = { + readonly "data": { + readonly "allowed_api_key_hashes": ReadonlyArray + readonly "allowed_models": ReadonlyArray + readonly "allowed_user_ids": ReadonlyArray + readonly "created_at": string + readonly "disabled": boolean + readonly "id": string + readonly "is_fallback": boolean + readonly "label": string + readonly "name"?: string + readonly "provider": BYOKProviderSlug + readonly "sort_order": number + readonly "workspace_id": string + } +} +export const CreateBYOKKeyResponse = Schema.Struct({ + "data": Schema.Struct({ + "allowed_api_key_hashes": Schema.Array(Schema.String).annotate({ "description": - "Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used." + "Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) that may use this credential. `null` means no restriction." + }).check(Schema.isMaxLength(100)), + "allowed_models": Schema.Array(Schema.String).annotate({ + "description": "Optional allowlist of model slugs this credential may be used for. `null` means no restriction." + }).check(Schema.isMaxLength(100)), + "allowed_user_ids": Schema.Array(Schema.String).annotate({ + "description": "Optional allowlist of user IDs that may use this credential. `null` means no restriction." + }).check(Schema.isMaxLength(100)), + "created_at": Schema.String.annotate({ "description": "ISO timestamp of when the credential was created." }), + "disabled": Schema.Boolean.annotate({ "description": "Whether this credential is currently disabled." }), + "id": Schema.String.annotate({ + "description": "Stable public identifier for this BYOK credential.", + "format": "uuid" + }), + "is_fallback": Schema.Boolean.annotate({ + "description": + "Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried." + }), + "label": Schema.String.annotate({ + "description": + "Short masked snippet of the key (e.g. the first/last few characters) used to identify it in the UI." + }), + "name": Schema.optionalKey( + Schema.String.annotate({ "description": "Optional human-readable name for the credential." }) + ), + "provider": BYOKProviderSlug, + "sort_order": Schema.Number.annotate({ + "description": "Position within the provider — credentials are tried in ascending sort order." + }).check(Schema.isInt()), + "workspace_id": Schema.String.annotate({ + "description": "ID of the workspace this credential belongs to.", + "format": "uuid" }) - ), - "order": Schema.optionalKey( - Schema.Array(Schema.Union([ProviderName, Schema.String])).annotate({ + }).annotate({ "description": "The created BYOK credential." }) +}) +export type GetBYOKKeyResponse = { + readonly "data": { + readonly "allowed_api_key_hashes": ReadonlyArray + readonly "allowed_models": ReadonlyArray + readonly "allowed_user_ids": ReadonlyArray + readonly "created_at": string + readonly "disabled": boolean + readonly "id": string + readonly "is_fallback": boolean + readonly "label": string + readonly "name"?: string + readonly "provider": BYOKProviderSlug + readonly "sort_order": number + readonly "workspace_id": string + } +} +export const GetBYOKKeyResponse = Schema.Struct({ + "data": Schema.Struct({ + "allowed_api_key_hashes": Schema.Array(Schema.String).annotate({ "description": - "An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message." + "Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) that may use this credential. `null` means no restriction." + }).check(Schema.isMaxLength(100)), + "allowed_models": Schema.Array(Schema.String).annotate({ + "description": "Optional allowlist of model slugs this credential may be used for. `null` means no restriction." + }).check(Schema.isMaxLength(100)), + "allowed_user_ids": Schema.Array(Schema.String).annotate({ + "description": "Optional allowlist of user IDs that may use this credential. `null` means no restriction." + }).check(Schema.isMaxLength(100)), + "created_at": Schema.String.annotate({ "description": "ISO timestamp of when the credential was created." }), + "disabled": Schema.Boolean.annotate({ "description": "Whether this credential is currently disabled." }), + "id": Schema.String.annotate({ + "description": "Stable public identifier for this BYOK credential.", + "format": "uuid" + }), + "is_fallback": Schema.Boolean.annotate({ + "description": + "Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried." + }), + "label": Schema.String.annotate({ + "description": + "Short masked snippet of the key (e.g. the first/last few characters) used to identify it in the UI." + }), + "name": Schema.optionalKey( + Schema.String.annotate({ "description": "Optional human-readable name for the credential." }) + ), + "provider": BYOKProviderSlug, + "sort_order": Schema.Number.annotate({ + "description": "Position within the provider — credentials are tried in ascending sort order." + }).check(Schema.isInt()), + "workspace_id": Schema.String.annotate({ + "description": "ID of the workspace this credential belongs to.", + "format": "uuid" }) - ), - "only": Schema.optionalKey( - Schema.Array(Schema.Union([ProviderName, Schema.String])).annotate({ + }).annotate({ "description": "The BYOK credential." }) +}) +export type UpdateBYOKKeyResponse = { + readonly "data": { + readonly "allowed_api_key_hashes": ReadonlyArray + readonly "allowed_models": ReadonlyArray + readonly "allowed_user_ids": ReadonlyArray + readonly "created_at": string + readonly "disabled": boolean + readonly "id": string + readonly "is_fallback": boolean + readonly "label": string + readonly "name"?: string + readonly "provider": BYOKProviderSlug + readonly "sort_order": number + readonly "workspace_id": string + } +} +export const UpdateBYOKKeyResponse = Schema.Struct({ + "data": Schema.Struct({ + "allowed_api_key_hashes": Schema.Array(Schema.String).annotate({ "description": - "List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request." + "Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) that may use this credential. `null` means no restriction." + }).check(Schema.isMaxLength(100)), + "allowed_models": Schema.Array(Schema.String).annotate({ + "description": "Optional allowlist of model slugs this credential may be used for. `null` means no restriction." + }).check(Schema.isMaxLength(100)), + "allowed_user_ids": Schema.Array(Schema.String).annotate({ + "description": "Optional allowlist of user IDs that may use this credential. `null` means no restriction." + }).check(Schema.isMaxLength(100)), + "created_at": Schema.String.annotate({ "description": "ISO timestamp of when the credential was created." }), + "disabled": Schema.Boolean.annotate({ "description": "Whether this credential is currently disabled." }), + "id": Schema.String.annotate({ + "description": "Stable public identifier for this BYOK credential.", + "format": "uuid" + }), + "is_fallback": Schema.Boolean.annotate({ + "description": + "Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried." + }), + "label": Schema.String.annotate({ + "description": + "Short masked snippet of the key (e.g. the first/last few characters) used to identify it in the UI." + }), + "name": Schema.optionalKey( + Schema.String.annotate({ "description": "Optional human-readable name for the credential." }) + ), + "provider": BYOKProviderSlug, + "sort_order": Schema.Number.annotate({ + "description": "Position within the provider — credentials are tried in ascending sort order." + }).check(Schema.isInt()), + "workspace_id": Schema.String.annotate({ + "description": "ID of the workspace this credential belongs to.", + "format": "uuid" + }) + }).annotate({ "description": "The updated BYOK credential." }) +}) +export type ChatContentVideo = { readonly "type": "video_url"; readonly "video_url": ChatContentVideoInput } +export const ChatContentVideo = Schema.Struct({ + "type": Schema.Literal("video_url"), + "video_url": ChatContentVideoInput +}).annotate({ "description": "Video input content part" }) +export type Legacy_ChatContentVideo = { readonly "type": "input_video"; readonly "video_url": ChatContentVideoInput } +export const Legacy_ChatContentVideo = Schema.Struct({ + "type": Schema.Literal("input_video"), + "video_url": ChatContentVideoInput +}).annotate({ "description": "Video input content part (legacy format - deprecated)" }) +export type ChatFormatJsonSchemaConfig = { + readonly "json_schema": ChatJsonSchemaConfig + readonly "type": "json_schema" +} +export const ChatFormatJsonSchemaConfig = Schema.Struct({ + "json_schema": ChatJsonSchemaConfig, + "type": Schema.Literal("json_schema") +}).annotate({ "description": "JSON Schema response format for structured outputs" }) +export type ChatToolChoice = "none" | "auto" | "required" | ChatNamedToolChoice | ChatServerToolChoice +export const ChatToolChoice = Schema.Union([ + Schema.Literal("none"), + Schema.Literal("auto"), + Schema.Literal("required"), + ChatNamedToolChoice, + ChatServerToolChoice +]).annotate({ "description": "Tool choice configuration" }) +export type ChatTokenLogprobs = { + readonly "content": ReadonlyArray + readonly "refusal"?: ReadonlyArray +} +export const ChatTokenLogprobs = Schema.Struct({ + "content": Schema.Array(ChatTokenLogprob).annotate({ "description": "Log probabilities for content tokens" }), + "refusal": Schema.optionalKey( + Schema.Array(ChatTokenLogprob).annotate({ "description": "Log probabilities for refusal tokens" }) + ) +}).annotate({ "description": "Log probabilities for the completion" }) +export type FileSearchServerTool = { + readonly "filters"?: + | { + readonly "key": string + readonly "type": "eq" | "ne" | "gt" | "gte" | "lt" | "lte" + readonly "value": string | number | boolean | ReadonlyArray + } + | CompoundFilter + | unknown + readonly "max_num_results"?: number + readonly "ranking_options"?: { + readonly "ranker"?: "auto" | "default-2024-11-15" + readonly "score_threshold"?: number + } + readonly "type": "file_search" + readonly "vector_store_ids": ReadonlyArray +} +export const FileSearchServerTool = Schema.Struct({ + "filters": Schema.optionalKey(Schema.Union([ + Schema.Struct({ + "key": Schema.String, + "type": Schema.Literals(["eq", "ne", "gt", "gte", "lt", "lte"]), + "value": Schema.Union([ + Schema.String, + Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + Schema.Boolean, + Schema.Array( + Schema.Union([Schema.String, Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite())]) + ) + ]) + }), + CompoundFilter, + Schema.Unknown + ])), + "max_num_results": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "ranking_options": Schema.optionalKey( + Schema.Struct({ + "ranker": Schema.optionalKey(Schema.Literals(["auto", "default-2024-11-15"])), + "score_threshold": Schema.optionalKey(Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite())) }) ), - "ignore": Schema.optionalKey( - Schema.Array(Schema.Union([ProviderName, Schema.String])).annotate({ - "description": - "List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request." + "type": Schema.Literal("file_search"), + "vector_store_ids": Schema.Array(Schema.String) +}).annotate({ "description": "File search tool configuration" }) +export type ConflictResponse = { + readonly "error": ConflictResponseErrorData + readonly "openrouter_metadata"?: {} + readonly "user_id"?: string +} +export const ConflictResponse = Schema.Struct({ + "error": ConflictResponseErrorData, + "openrouter_metadata": Schema.optionalKey(Schema.Struct({})), + "user_id": Schema.optionalKey(Schema.String) +}).annotate({ "description": "Conflict - Resource conflict or concurrent modification" }) +export type ContentFilterEntry = { + readonly "action": ContentFilterAction + readonly "label"?: string + readonly "pattern": string +} +export const ContentFilterEntry = Schema.Struct({ + "action": ContentFilterAction, + "label": Schema.optionalKey( + Schema.String.annotate({ "description": "Optional label used in redaction placeholders or error messages" }).check( + Schema.isMaxLength(100) + ) + ), + "pattern": Schema.String.annotate({ "description": "A regex pattern to match against request content" }).check( + Schema.isMinLength(1) + ) +}).annotate({ "description": "A custom regex content filter that scans request messages for matching patterns." }) +export type ContentFilterBuiltinEntry = { + readonly "action": ContentFilterBuiltinAction + readonly "label"?: string + readonly "slug": ContentFilterBuiltinSlug +} +export const ContentFilterBuiltinEntry = Schema.Struct({ + "action": ContentFilterBuiltinAction, + "label": Schema.optionalKey( + Schema.String.annotate({ + "description": "Optional label used in redaction placeholders (e.g. \"[PROMPT_INJECTION]\")" + }).check(Schema.isMaxLength(100)) + ), + "slug": ContentFilterBuiltinSlug +}).annotate({ + "description": + "A builtin content filter entry. Builtin filters include PII detectors and the regex-based prompt injection detector." +}) +export type ContextCompressionPlugin = { + readonly "enabled"?: boolean + readonly "engine"?: ContextCompressionEngine + readonly "id": "context-compression" +} +export const ContextCompressionPlugin = Schema.Struct({ + "enabled": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": "Set to false to disable the context-compression plugin for this request. Defaults to true." }) ), - "quantizations": Schema.optionalKey( - Schema.Array(Quantization).annotate({ "description": "A list of quantization levels to filter the provider by." }) + "engine": Schema.optionalKey(ContextCompressionEngine), + "id": Schema.Literal("context-compression") +}) +export type ChatUsage = { + readonly "completion_tokens": number + readonly "completion_tokens_details"?: { + readonly "accepted_prediction_tokens"?: number + readonly "audio_tokens"?: number + readonly "reasoning_tokens"?: number + readonly "rejected_prediction_tokens"?: number + } + readonly "cost"?: number + readonly "cost_details"?: CostDetails + readonly "is_byok"?: boolean + readonly "prompt_tokens": number + readonly "prompt_tokens_details"?: { + readonly "audio_tokens"?: number + readonly "cache_write_tokens"?: number + readonly "cached_tokens"?: number + readonly "video_tokens"?: number + } + readonly "total_tokens": number +} +export const ChatUsage = Schema.Struct({ + "completion_tokens": Schema.Number.annotate({ "description": "Number of tokens in the completion" }).check( + Schema.isInt() ), - "sort": Schema.optionalKey( - Schema.Union([ - Schema.Union([Schema.Literal("price"), Schema.Literal("price")]).annotate({ - "description": - "The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed." - }), - Schema.Union([Schema.Literal("throughput"), Schema.Literal("throughput")]).annotate({ - "description": - "The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed." - }), - Schema.Union([Schema.Literal("latency"), Schema.Literal("latency")]).annotate({ - "description": - "The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed." - }) - ]) + "completion_tokens_details": Schema.optionalKey( + Schema.Struct({ + "accepted_prediction_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Accepted prediction tokens" }).check(Schema.isInt()) + ), + "audio_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Tokens used for audio output" }).check(Schema.isInt()) + ), + "reasoning_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Tokens used for reasoning" }).check(Schema.isInt()) + ), + "rejected_prediction_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Rejected prediction tokens" }).check(Schema.isInt()) + ) + }).annotate({ "description": "Detailed completion token usage" }) ), - "max_price": Schema.optionalKey( + "cost": Schema.optionalKey( + Schema.Number.annotate({ "description": "Cost of the completion", "format": "double" }).check(Schema.isFinite()) + ), + "cost_details": Schema.optionalKey(CostDetails), + "is_byok": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether a request was made using a Bring Your Own Key configuration" }) + ), + "prompt_tokens": Schema.Number.annotate({ "description": "Number of tokens in the prompt" }).check(Schema.isInt()), + "prompt_tokens_details": Schema.optionalKey( Schema.Struct({ - "prompt": Schema.optionalKey(BigNumberUnion), - "completion": Schema.optionalKey( - Schema.String.annotate({ "description": "Price per million completion tokens" }) + "audio_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Audio input tokens" }).check(Schema.isInt()) ), - "image": Schema.optionalKey(Schema.String.annotate({ "description": "Price per image" })), - "audio": Schema.optionalKey(Schema.String.annotate({ "description": "Price per audio unit" })), - "request": Schema.optionalKey(Schema.String.annotate({ "description": "Price per request" })) - }).annotate({ - "description": - "The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion." - }) + "cache_write_tokens": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "Tokens written to cache. Only returned for models with explicit caching and cache write pricing." + }).check(Schema.isInt()) + ), + "cached_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Cached prompt tokens" }).check(Schema.isInt()) + ), + "video_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Video input tokens" }).check(Schema.isInt()) + ) + }).annotate({ "description": "Detailed prompt token usage" }) ), - "preferred_min_throughput": Schema.optionalKey(PreferredMinThroughput), - "preferred_max_latency": Schema.optionalKey(PreferredMaxLatency) -}).annotate({ "description": "Provider routing preferences for the request." }) -export type AnthropicMessagesRequest = { + "total_tokens": Schema.Number.annotate({ "description": "Total number of tokens" }).check(Schema.isInt()) +}).annotate({ "description": "Token usage statistics" }) +export type DatetimeServerTool = { + readonly "parameters"?: DatetimeServerToolConfig + readonly "type": "openrouter:datetime" +} +export const DatetimeServerTool = Schema.Struct({ + "parameters": Schema.optionalKey(DatetimeServerToolConfig), + "type": Schema.Literal("openrouter:datetime") +}).annotate({ "description": "OpenRouter built-in server tool: returns the current date and time" }) +export type EdgeNetworkTimeoutResponse = { + readonly "error": EdgeNetworkTimeoutResponseErrorData + readonly "openrouter_metadata"?: {} + readonly "user_id"?: string +} +export const EdgeNetworkTimeoutResponse = Schema.Struct({ + "error": EdgeNetworkTimeoutResponseErrorData, + "openrouter_metadata": Schema.optionalKey(Schema.Struct({})), + "user_id": Schema.optionalKey(Schema.String) +}).annotate({ "description": "Infrastructure Timeout - Provider request timed out at edge network" }) +export type EndpointsMetadata = { readonly "available": ReadonlyArray; readonly "total": number } +export const EndpointsMetadata = Schema.Struct({ + "available": Schema.Array(EndpointInfo), + "total": Schema.Number.check(Schema.isInt()) +}) +export type ForbiddenResponse = { + readonly "error": ForbiddenResponseErrorData + readonly "openrouter_metadata"?: {} + readonly "user_id"?: string +} +export const ForbiddenResponse = Schema.Struct({ + "error": ForbiddenResponseErrorData, + "openrouter_metadata": Schema.optionalKey(Schema.Struct({})), + "user_id": Schema.optionalKey(Schema.String) +}).annotate({ "description": "Forbidden - Authentication successful but insufficient permissions" }) +export type Formats = FormatTextConfig | FormatJsonObjectConfig | FormatJsonSchemaConfig +export const Formats = Schema.Union([FormatTextConfig, FormatJsonObjectConfig, FormatJsonSchemaConfig]).annotate({ + "description": "Text response format configuration" +}) +export type VideoGenerationRequest = { + readonly "aspect_ratio"?: "16:9" | "9:16" | "1:1" | "4:3" | "3:4" | "3:2" | "2:3" | "21:9" | "9:21" + readonly "callback_url"?: string + readonly "duration"?: number + readonly "frame_images"?: ReadonlyArray + readonly "generate_audio"?: boolean + readonly "input_references"?: ReadonlyArray readonly "model": string - readonly "max_tokens": number - readonly "messages": ReadonlyArray - readonly "system"?: - | string - | ReadonlyArray< - { - readonly "type": "text" - readonly "text": string - readonly "citations"?: ReadonlyArray< - { - readonly "type": "char_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_char_index": number - readonly "end_char_index": number - } | { - readonly "type": "page_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_page_number": number - readonly "end_page_number": number - } | { - readonly "type": "content_block_location" - readonly "cited_text": string - readonly "document_index": number - readonly "document_title": string - readonly "start_block_index": number - readonly "end_block_index": number - } | { - readonly "type": "web_search_result_location" - readonly "cited_text": string - readonly "encrypted_index": string - readonly "title": string - readonly "url": string - } | { - readonly "type": "search_result_location" - readonly "cited_text": string - readonly "search_result_index": number - readonly "source": string - readonly "title": string - readonly "start_block_index": number - readonly "end_block_index": number - } - > - readonly "cache_control"?: { readonly "type": "ephemeral"; readonly "ttl"?: "5m" | "1h" } - } - > - readonly "metadata"?: { readonly "user_id"?: string } - readonly "stop_sequences"?: ReadonlyArray - readonly "stream"?: boolean - readonly "temperature"?: number - readonly "top_p"?: number - readonly "top_k"?: number - readonly "tools"?: ReadonlyArray< - { - readonly "name": string - readonly "description"?: string - readonly "input_schema": { - readonly "type": "object" - readonly "properties"?: unknown - readonly "required"?: ReadonlyArray - } - readonly "type"?: "custom" - readonly "cache_control"?: { readonly "type": "ephemeral"; readonly "ttl"?: "5m" | "1h" } - } | { - readonly "type": "bash_20250124" - readonly "name": "bash" - readonly "cache_control"?: { readonly "type": "ephemeral"; readonly "ttl"?: "5m" | "1h" } - } | { - readonly "type": "text_editor_20250124" - readonly "name": "str_replace_editor" - readonly "cache_control"?: { readonly "type": "ephemeral"; readonly "ttl"?: "5m" | "1h" } - } | { - readonly "type": "web_search_20250305" - readonly "name": "web_search" - readonly "allowed_domains"?: ReadonlyArray - readonly "blocked_domains"?: ReadonlyArray - readonly "max_uses"?: number - readonly "user_location"?: { - readonly "type": "approximate" - readonly "city"?: string - readonly "country"?: string - readonly "region"?: string - readonly "timezone"?: string - } - readonly "cache_control"?: { readonly "type": "ephemeral"; readonly "ttl"?: "5m" | "1h" } - } - > - readonly "tool_choice"?: - | { readonly "type": "auto"; readonly "disable_parallel_tool_use"?: boolean } - | { readonly "type": "any"; readonly "disable_parallel_tool_use"?: boolean } - | { readonly "type": "none" } - | { readonly "type": "tool"; readonly "name": string; readonly "disable_parallel_tool_use"?: boolean } - readonly "thinking"?: { readonly "type": "enabled"; readonly "budget_tokens": number } | { - readonly "type": "disabled" - } | { readonly "type": "adaptive" } - readonly "service_tier"?: "auto" | "standard_only" + readonly "prompt": string readonly "provider"?: { - readonly "allow_fallbacks"?: boolean - readonly "require_parameters"?: boolean - readonly "data_collection"?: DataCollection - readonly "zdr"?: boolean - readonly "enforce_distillable_text"?: boolean - readonly "order"?: ReadonlyArray - readonly "only"?: ReadonlyArray - readonly "ignore"?: ReadonlyArray - readonly "quantizations"?: ReadonlyArray - readonly "sort"?: "price" | "price" | "throughput" | "throughput" | "latency" | "latency" - readonly "max_price"?: { - readonly "prompt"?: BigNumberUnion - readonly "completion"?: string - readonly "image"?: string - readonly "audio"?: string - readonly "request"?: string - } - readonly "preferred_min_throughput"?: PreferredMinThroughput - readonly "preferred_max_latency"?: PreferredMaxLatency - } - readonly "plugins"?: ReadonlyArray< - | { readonly "id": "auto-router"; readonly "enabled"?: boolean; readonly "allowed_models"?: ReadonlyArray } - | { readonly "id": "moderation" } - | { - readonly "id": "web" - readonly "enabled"?: boolean - readonly "max_results"?: number - readonly "search_prompt"?: string - readonly "engine"?: WebSearchEngine + readonly "options"?: { + readonly "01ai"?: {} + readonly "ai21"?: {} + readonly "aion-labs"?: {} + readonly "akashml"?: {} + readonly "alibaba"?: {} + readonly "amazon-bedrock"?: {} + readonly "amazon-nova"?: {} + readonly "ambient"?: {} + readonly "anthropic"?: {} + readonly "anyscale"?: {} + readonly "arcee-ai"?: {} + readonly "atlas-cloud"?: {} + readonly "atoma"?: {} + readonly "avian"?: {} + readonly "azure"?: {} + readonly "baidu"?: {} + readonly "baseten"?: {} + readonly "black-forest-labs"?: {} + readonly "byteplus"?: {} + readonly "centml"?: {} + readonly "cerebras"?: {} + readonly "chutes"?: {} + readonly "cirrascale"?: {} + readonly "clarifai"?: {} + readonly "cloudflare"?: {} + readonly "cohere"?: {} + readonly "crofai"?: {} + readonly "crucible"?: {} + readonly "crusoe"?: {} + readonly "deepinfra"?: {} + readonly "deepseek"?: {} + readonly "dekallm"?: {} + readonly "digitalocean"?: {} + readonly "enfer"?: {} + readonly "fake-provider"?: {} + readonly "featherless"?: {} + readonly "fireworks"?: {} + readonly "friendli"?: {} + readonly "gmicloud"?: {} + readonly "google-ai-studio"?: {} + readonly "google-vertex"?: {} + readonly "gopomelo"?: {} + readonly "groq"?: {} + readonly "huggingface"?: {} + readonly "hyperbolic"?: {} + readonly "hyperbolic-quantized"?: {} + readonly "inception"?: {} + readonly "inceptron"?: {} + readonly "inference-net"?: {} + readonly "infermatic"?: {} + readonly "inflection"?: {} + readonly "inocloud"?: {} + readonly "io-net"?: {} + readonly "ionstream"?: {} + readonly "klusterai"?: {} + readonly "lambda"?: {} + readonly "lepton"?: {} + readonly "liquid"?: {} + readonly "lynn"?: {} + readonly "lynn-private"?: {} + readonly "mancer"?: {} + readonly "mancer-old"?: {} + readonly "mara"?: {} + readonly "meta"?: {} + readonly "minimax"?: {} + readonly "mistral"?: {} + readonly "modal"?: {} + readonly "modelrun"?: {} + readonly "modular"?: {} + readonly "moonshotai"?: {} + readonly "morph"?: {} + readonly "ncompass"?: {} + readonly "nebius"?: {} + readonly "nex-agi"?: {} + readonly "nextbit"?: {} + readonly "nineteen"?: {} + readonly "novita"?: {} + readonly "nvidia"?: {} + readonly "octoai"?: {} + readonly "open-inference"?: {} + readonly "openai"?: {} + readonly "parasail"?: {} + readonly "perceptron"?: {} + readonly "perplexity"?: {} + readonly "phala"?: {} + readonly "poolside"?: {} + readonly "recraft"?: {} + readonly "recursal"?: {} + readonly "reflection"?: {} + readonly "reka"?: {} + readonly "relace"?: {} + readonly "replicate"?: {} + readonly "sambanova"?: {} + readonly "sambanova-cloaked"?: {} + readonly "seed"?: {} + readonly "sf-compute"?: {} + readonly "siliconflow"?: {} + readonly "sourceful"?: {} + readonly "stealth"?: {} + readonly "stepfun"?: {} + readonly "streamlake"?: {} + readonly "switchpoint"?: {} + readonly "targon"?: {} + readonly "together"?: {} + readonly "together-lite"?: {} + readonly "ubicloud"?: {} + readonly "upstage"?: {} + readonly "venice"?: {} + readonly "wandb"?: {} + readonly "xai"?: {} + readonly "xiaomi"?: {} + readonly "z-ai"?: {} } - | { readonly "id": "file-parser"; readonly "enabled"?: boolean; readonly "pdf"?: PDFParserOptions } - | { readonly "id": "response-healing"; readonly "enabled"?: boolean } - > - readonly "route"?: "fallback" | "sort" - readonly "user"?: string - readonly "session_id"?: string - readonly "trace"?: { - readonly "trace_id"?: string - readonly "trace_name"?: string - readonly "span_name"?: string - readonly "generation_name"?: string - readonly "parent_span_id"?: string } - readonly "models"?: ReadonlyArray - readonly "output_config"?: AnthropicOutputConfig + readonly "resolution"?: "480p" | "720p" | "1080p" | "1K" | "2K" | "4K" + readonly "seed"?: number + readonly "size"?: string } -export const AnthropicMessagesRequest = Schema.Struct({ - "model": Schema.String, - "max_tokens": Schema.Number.check(Schema.isFinite()), - "messages": Schema.Array(OpenRouterAnthropicMessageParam), - "system": Schema.optionalKey(Schema.Union([ - Schema.String, - Schema.Array(Schema.Struct({ - "type": Schema.Literal("text"), - "text": Schema.String, - "citations": Schema.optionalKey(Schema.Array(Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("char_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_char_index": Schema.Number.check(Schema.isFinite()), - "end_char_index": Schema.Number.check(Schema.isFinite()) - }), - Schema.Struct({ - "type": Schema.Literal("page_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_page_number": Schema.Number.check(Schema.isFinite()), - "end_page_number": Schema.Number.check(Schema.isFinite()) - }), - Schema.Struct({ - "type": Schema.Literal("content_block_location"), - "cited_text": Schema.String, - "document_index": Schema.Number.check(Schema.isFinite()), - "document_title": Schema.String, - "start_block_index": Schema.Number.check(Schema.isFinite()), - "end_block_index": Schema.Number.check(Schema.isFinite()) - }), - Schema.Struct({ - "type": Schema.Literal("web_search_result_location"), - "cited_text": Schema.String, - "encrypted_index": Schema.String, - "title": Schema.String, - "url": Schema.String - }), - Schema.Struct({ - "type": Schema.Literal("search_result_location"), - "cited_text": Schema.String, - "search_result_index": Schema.Number.check(Schema.isFinite()), - "source": Schema.String, - "title": Schema.String, - "start_block_index": Schema.Number.check(Schema.isFinite()), - "end_block_index": Schema.Number.check(Schema.isFinite()) - }) - ], { mode: "oneOf" }))), - "cache_control": Schema.optionalKey( - Schema.Struct({ "type": Schema.Literal("ephemeral"), "ttl": Schema.optionalKey(Schema.Literals(["5m", "1h"])) }) - ) - })) - ])), - "metadata": Schema.optionalKey(Schema.Struct({ "user_id": Schema.optionalKey(Schema.String) })), - "stop_sequences": Schema.optionalKey(Schema.Array(Schema.String)), - "stream": Schema.optionalKey(Schema.Boolean), - "temperature": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "top_p": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "top_k": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "tools": Schema.optionalKey(Schema.Array(Schema.Union([ - Schema.Struct({ - "name": Schema.String, - "description": Schema.optionalKey(Schema.String), - "input_schema": Schema.Struct({ - "type": Schema.Literal("object"), - "properties": Schema.optionalKey(Schema.Unknown), - "required": Schema.optionalKey(Schema.Array(Schema.String)) - }), - "type": Schema.optionalKey(Schema.Literal("custom")), - "cache_control": Schema.optionalKey( - Schema.Struct({ "type": Schema.Literal("ephemeral"), "ttl": Schema.optionalKey(Schema.Literals(["5m", "1h"])) }) - ) - }), - Schema.Struct({ - "type": Schema.Literal("bash_20250124"), - "name": Schema.Literal("bash"), - "cache_control": Schema.optionalKey( - Schema.Struct({ "type": Schema.Literal("ephemeral"), "ttl": Schema.optionalKey(Schema.Literals(["5m", "1h"])) }) - ) - }), - Schema.Struct({ - "type": Schema.Literal("text_editor_20250124"), - "name": Schema.Literal("str_replace_editor"), - "cache_control": Schema.optionalKey( - Schema.Struct({ "type": Schema.Literal("ephemeral"), "ttl": Schema.optionalKey(Schema.Literals(["5m", "1h"])) }) - ) - }), - Schema.Struct({ - "type": Schema.Literal("web_search_20250305"), - "name": Schema.Literal("web_search"), - "allowed_domains": Schema.optionalKey(Schema.Array(Schema.String)), - "blocked_domains": Schema.optionalKey(Schema.Array(Schema.String)), - "max_uses": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "user_location": Schema.optionalKey( - Schema.Struct({ - "type": Schema.Literal("approximate"), - "city": Schema.optionalKey(Schema.String), - "country": Schema.optionalKey(Schema.String), - "region": Schema.optionalKey(Schema.String), - "timezone": Schema.optionalKey(Schema.String) - }) - ), - "cache_control": Schema.optionalKey( - Schema.Struct({ "type": Schema.Literal("ephemeral"), "ttl": Schema.optionalKey(Schema.Literals(["5m", "1h"])) }) - ) +export const VideoGenerationRequest = Schema.Struct({ + "aspect_ratio": Schema.optionalKey( + Schema.Literals(["16:9", "9:16", "1:1", "4:3", "3:4", "3:2", "2:3", "21:9", "9:21"]).annotate({ + "description": "Aspect ratio of the generated video" }) - ], { mode: "oneOf" }))), - "tool_choice": Schema.optionalKey( - Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("auto"), - "disable_parallel_tool_use": Schema.optionalKey(Schema.Boolean) - }), - Schema.Struct({ "type": Schema.Literal("any"), "disable_parallel_tool_use": Schema.optionalKey(Schema.Boolean) }), - Schema.Struct({ "type": Schema.Literal("none") }), - Schema.Struct({ - "type": Schema.Literal("tool"), - "name": Schema.String, - "disable_parallel_tool_use": Schema.optionalKey(Schema.Boolean) - }) - ], { mode: "oneOf" }) ), - "thinking": Schema.optionalKey( - Schema.Union([ - Schema.Struct({ "type": Schema.Literal("enabled"), "budget_tokens": Schema.Number.check(Schema.isFinite()) }), - Schema.Struct({ "type": Schema.Literal("disabled") }), - Schema.Struct({ "type": Schema.Literal("adaptive") }) - ], { mode: "oneOf" }) + "callback_url": Schema.optionalKey( + Schema.String.annotate({ + "description": + "URL to receive a webhook notification when the video generation job completes. Overrides the workspace-level default callback URL if set. Must be HTTPS.", + "format": "uri" + }) + ), + "duration": Schema.optionalKey( + Schema.Number.annotate({ "description": "Duration of the generated video in seconds" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(1) + ) + ), + "frame_images": Schema.optionalKey( + Schema.Array(FrameImage).annotate({ + "description": + "Images to use as the first and/or last frame of the generated video. Each image must specify a frame_type of first_frame or last_frame." + }) + ), + "generate_audio": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to generate audio alongside the video. Defaults to the endpoint's generate_audio capability flag, false if not set." + }) ), - "service_tier": Schema.optionalKey(Schema.Literals(["auto", "standard_only"])), + "input_references": Schema.optionalKey( + Schema.Array(ContentPartImage).annotate({ "description": "Reference images to guide video generation" }) + ), + "model": Schema.String, + "prompt": Schema.String, "provider": Schema.optionalKey( Schema.Struct({ - "allow_fallbacks": Schema.optionalKey(Schema.Boolean.annotate({ - "description": - "Whether to allow backup providers to serve requests\n- true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider.\n- false: use only the primary/custom provider, and return the upstream error if it's unavailable.\n" - })), - "require_parameters": Schema.optionalKey( - Schema.Boolean.annotate({ - "description": - "Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest." - }) - ), - "data_collection": Schema.optionalKey(DataCollection), - "zdr": Schema.optionalKey( - Schema.Boolean.annotate({ - "description": - "Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used." - }) - ), - "enforce_distillable_text": Schema.optionalKey( - Schema.Boolean.annotate({ - "description": - "Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used." - }) - ), - "order": Schema.optionalKey( - Schema.Array(Schema.Union([ProviderName, Schema.String])).annotate({ - "description": - "An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message." - }) - ), - "only": Schema.optionalKey( - Schema.Array(Schema.Union([ProviderName, Schema.String])).annotate({ - "description": - "List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request." - }) - ), - "ignore": Schema.optionalKey( - Schema.Array(Schema.Union([ProviderName, Schema.String])).annotate({ - "description": - "List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request." - }) - ), - "quantizations": Schema.optionalKey( - Schema.Array(Quantization).annotate({ - "description": "A list of quantization levels to filter the provider by." - }) - ), - "sort": Schema.optionalKey( - Schema.Union([ - Schema.Union([Schema.Literal("price"), Schema.Literal("price")]).annotate({ - "description": - "The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed." - }), - Schema.Union([Schema.Literal("throughput"), Schema.Literal("throughput")]).annotate({ - "description": - "The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed." - }), - Schema.Union([Schema.Literal("latency"), Schema.Literal("latency")]).annotate({ - "description": - "The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed." - }) - ]) - ), - "max_price": Schema.optionalKey( + "options": Schema.optionalKey( Schema.Struct({ - "prompt": Schema.optionalKey(BigNumberUnion), - "completion": Schema.optionalKey( - Schema.String.annotate({ "description": "Price per million completion tokens" }) - ), - "image": Schema.optionalKey(Schema.String.annotate({ "description": "Price per image" })), - "audio": Schema.optionalKey(Schema.String.annotate({ "description": "Price per audio unit" })), - "request": Schema.optionalKey(Schema.String.annotate({ "description": "Price per request" })) + "01ai": Schema.optionalKey(Schema.Struct({})), + "ai21": Schema.optionalKey(Schema.Struct({})), + "aion-labs": Schema.optionalKey(Schema.Struct({})), + "akashml": Schema.optionalKey(Schema.Struct({})), + "alibaba": Schema.optionalKey(Schema.Struct({})), + "amazon-bedrock": Schema.optionalKey(Schema.Struct({})), + "amazon-nova": Schema.optionalKey(Schema.Struct({})), + "ambient": Schema.optionalKey(Schema.Struct({})), + "anthropic": Schema.optionalKey(Schema.Struct({})), + "anyscale": Schema.optionalKey(Schema.Struct({})), + "arcee-ai": Schema.optionalKey(Schema.Struct({})), + "atlas-cloud": Schema.optionalKey(Schema.Struct({})), + "atoma": Schema.optionalKey(Schema.Struct({})), + "avian": Schema.optionalKey(Schema.Struct({})), + "azure": Schema.optionalKey(Schema.Struct({})), + "baidu": Schema.optionalKey(Schema.Struct({})), + "baseten": Schema.optionalKey(Schema.Struct({})), + "black-forest-labs": Schema.optionalKey(Schema.Struct({})), + "byteplus": Schema.optionalKey(Schema.Struct({})), + "centml": Schema.optionalKey(Schema.Struct({})), + "cerebras": Schema.optionalKey(Schema.Struct({})), + "chutes": Schema.optionalKey(Schema.Struct({})), + "cirrascale": Schema.optionalKey(Schema.Struct({})), + "clarifai": Schema.optionalKey(Schema.Struct({})), + "cloudflare": Schema.optionalKey(Schema.Struct({})), + "cohere": Schema.optionalKey(Schema.Struct({})), + "crofai": Schema.optionalKey(Schema.Struct({})), + "crucible": Schema.optionalKey(Schema.Struct({})), + "crusoe": Schema.optionalKey(Schema.Struct({})), + "deepinfra": Schema.optionalKey(Schema.Struct({})), + "deepseek": Schema.optionalKey(Schema.Struct({})), + "dekallm": Schema.optionalKey(Schema.Struct({})), + "digitalocean": Schema.optionalKey(Schema.Struct({})), + "enfer": Schema.optionalKey(Schema.Struct({})), + "fake-provider": Schema.optionalKey(Schema.Struct({})), + "featherless": Schema.optionalKey(Schema.Struct({})), + "fireworks": Schema.optionalKey(Schema.Struct({})), + "friendli": Schema.optionalKey(Schema.Struct({})), + "gmicloud": Schema.optionalKey(Schema.Struct({})), + "google-ai-studio": Schema.optionalKey(Schema.Struct({})), + "google-vertex": Schema.optionalKey(Schema.Struct({})), + "gopomelo": Schema.optionalKey(Schema.Struct({})), + "groq": Schema.optionalKey(Schema.Struct({})), + "huggingface": Schema.optionalKey(Schema.Struct({})), + "hyperbolic": Schema.optionalKey(Schema.Struct({})), + "hyperbolic-quantized": Schema.optionalKey(Schema.Struct({})), + "inception": Schema.optionalKey(Schema.Struct({})), + "inceptron": Schema.optionalKey(Schema.Struct({})), + "inference-net": Schema.optionalKey(Schema.Struct({})), + "infermatic": Schema.optionalKey(Schema.Struct({})), + "inflection": Schema.optionalKey(Schema.Struct({})), + "inocloud": Schema.optionalKey(Schema.Struct({})), + "io-net": Schema.optionalKey(Schema.Struct({})), + "ionstream": Schema.optionalKey(Schema.Struct({})), + "klusterai": Schema.optionalKey(Schema.Struct({})), + "lambda": Schema.optionalKey(Schema.Struct({})), + "lepton": Schema.optionalKey(Schema.Struct({})), + "liquid": Schema.optionalKey(Schema.Struct({})), + "lynn": Schema.optionalKey(Schema.Struct({})), + "lynn-private": Schema.optionalKey(Schema.Struct({})), + "mancer": Schema.optionalKey(Schema.Struct({})), + "mancer-old": Schema.optionalKey(Schema.Struct({})), + "mara": Schema.optionalKey(Schema.Struct({})), + "meta": Schema.optionalKey(Schema.Struct({})), + "minimax": Schema.optionalKey(Schema.Struct({})), + "mistral": Schema.optionalKey(Schema.Struct({})), + "modal": Schema.optionalKey(Schema.Struct({})), + "modelrun": Schema.optionalKey(Schema.Struct({})), + "modular": Schema.optionalKey(Schema.Struct({})), + "moonshotai": Schema.optionalKey(Schema.Struct({})), + "morph": Schema.optionalKey(Schema.Struct({})), + "ncompass": Schema.optionalKey(Schema.Struct({})), + "nebius": Schema.optionalKey(Schema.Struct({})), + "nex-agi": Schema.optionalKey(Schema.Struct({})), + "nextbit": Schema.optionalKey(Schema.Struct({})), + "nineteen": Schema.optionalKey(Schema.Struct({})), + "novita": Schema.optionalKey(Schema.Struct({})), + "nvidia": Schema.optionalKey(Schema.Struct({})), + "octoai": Schema.optionalKey(Schema.Struct({})), + "open-inference": Schema.optionalKey(Schema.Struct({})), + "openai": Schema.optionalKey(Schema.Struct({})), + "parasail": Schema.optionalKey(Schema.Struct({})), + "perceptron": Schema.optionalKey(Schema.Struct({})), + "perplexity": Schema.optionalKey(Schema.Struct({})), + "phala": Schema.optionalKey(Schema.Struct({})), + "poolside": Schema.optionalKey(Schema.Struct({})), + "recraft": Schema.optionalKey(Schema.Struct({})), + "recursal": Schema.optionalKey(Schema.Struct({})), + "reflection": Schema.optionalKey(Schema.Struct({})), + "reka": Schema.optionalKey(Schema.Struct({})), + "relace": Schema.optionalKey(Schema.Struct({})), + "replicate": Schema.optionalKey(Schema.Struct({})), + "sambanova": Schema.optionalKey(Schema.Struct({})), + "sambanova-cloaked": Schema.optionalKey(Schema.Struct({})), + "seed": Schema.optionalKey(Schema.Struct({})), + "sf-compute": Schema.optionalKey(Schema.Struct({})), + "siliconflow": Schema.optionalKey(Schema.Struct({})), + "sourceful": Schema.optionalKey(Schema.Struct({})), + "stealth": Schema.optionalKey(Schema.Struct({})), + "stepfun": Schema.optionalKey(Schema.Struct({})), + "streamlake": Schema.optionalKey(Schema.Struct({})), + "switchpoint": Schema.optionalKey(Schema.Struct({})), + "targon": Schema.optionalKey(Schema.Struct({})), + "together": Schema.optionalKey(Schema.Struct({})), + "together-lite": Schema.optionalKey(Schema.Struct({})), + "ubicloud": Schema.optionalKey(Schema.Struct({})), + "upstage": Schema.optionalKey(Schema.Struct({})), + "venice": Schema.optionalKey(Schema.Struct({})), + "wandb": Schema.optionalKey(Schema.Struct({})), + "xai": Schema.optionalKey(Schema.Struct({})), + "xiaomi": Schema.optionalKey(Schema.Struct({})), + "z-ai": Schema.optionalKey(Schema.Struct({})) }).annotate({ "description": - "The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion." + "Provider-specific options keyed by provider slug. The options for the matched provider are spread into the upstream request body." }) - ), - "preferred_min_throughput": Schema.optionalKey(PreferredMinThroughput), - "preferred_max_latency": Schema.optionalKey(PreferredMaxLatency) - }).annotate({ - "description": "When multiple model providers are available, optionally indicate your routing preference." - }) - ), - "plugins": Schema.optionalKey( - Schema.Array(Schema.Union([ - Schema.Struct({ - "id": Schema.Literal("auto-router"), - "enabled": Schema.optionalKey( - Schema.Boolean.annotate({ - "description": "Set to false to disable the auto-router plugin for this request. Defaults to true." - }) - ), - "allowed_models": Schema.optionalKey( - Schema.Array(Schema.String).annotate({ - "description": - "List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list." - }) - ) - }), - Schema.Struct({ "id": Schema.Literal("moderation") }), - Schema.Struct({ - "id": Schema.Literal("web"), - "enabled": Schema.optionalKey( - Schema.Boolean.annotate({ - "description": "Set to false to disable the web-search plugin for this request. Defaults to true." - }) - ), - "max_results": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "search_prompt": Schema.optionalKey(Schema.String), - "engine": Schema.optionalKey(WebSearchEngine) - }), - Schema.Struct({ - "id": Schema.Literal("file-parser"), - "enabled": Schema.optionalKey( - Schema.Boolean.annotate({ - "description": "Set to false to disable the file-parser plugin for this request. Defaults to true." - }) - ), - "pdf": Schema.optionalKey(PDFParserOptions) - }), - Schema.Struct({ - "id": Schema.Literal("response-healing"), - "enabled": Schema.optionalKey( - Schema.Boolean.annotate({ - "description": "Set to false to disable the response-healing plugin for this request. Defaults to true." - }) - ) - }) - ], { mode: "oneOf" })).annotate({ - "description": "Plugins you want to enable for this request, including their settings." - }) + ) + }).annotate({ "description": "Provider-specific passthrough configuration" }) ), - "route": Schema.optionalKey( - Schema.Literals(["fallback", "sort"]).annotate({ - "description": - "**DEPRECATED** Use providers.sort.partition instead. Backwards-compatible alias for providers.sort.partition. Accepts legacy values: \"fallback\" (maps to \"model\"), \"sort\" (maps to \"none\")." + "resolution": Schema.optionalKey( + Schema.Literals(["480p", "720p", "1080p", "1K", "2K", "4K"]).annotate({ + "description": "Resolution of the generated video" }) ), - "user": Schema.optionalKey( - Schema.String.annotate({ + "seed": Schema.optionalKey( + Schema.Number.annotate({ "description": - "A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters." - }).check(Schema.isMaxLength(128)) + "If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers." + }).check(Schema.isInt()) ), - "session_id": Schema.optionalKey( + "size": Schema.optionalKey( Schema.String.annotate({ "description": - "A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters." - }).check(Schema.isMaxLength(128)) - ), - "trace": Schema.optionalKey( - Schema.Struct({ - "trace_id": Schema.optionalKey(Schema.String), - "trace_name": Schema.optionalKey(Schema.String), - "span_name": Schema.optionalKey(Schema.String), - "generation_name": Schema.optionalKey(Schema.String), - "parent_span_id": Schema.optionalKey(Schema.String) - }).annotate({ - "description": - "Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations." + "Exact pixel dimensions of the generated video in \"WIDTHxHEIGHT\" format (e.g. \"1280x720\"). Interchangeable with resolution + aspect_ratio." }) - ), - "models": Schema.optionalKey(Schema.Array(Schema.String)), - "output_config": Schema.optionalKey(AnthropicOutputConfig) -}).annotate({ "description": "Request schema for Anthropic Messages API endpoint" }) -export type Model = { + ) +}) +export type FusionServerTool_OpenRouter = { + readonly "parameters"?: FusionServerToolConfig + readonly "type": "openrouter:fusion" +} +export const FusionServerTool_OpenRouter = Schema.Struct({ + "parameters": Schema.optionalKey(FusionServerToolConfig), + "type": Schema.Literal("openrouter:fusion") +}).annotate({ + "description": + "OpenRouter built-in server tool: fans out the user prompt to a panel of analysis models, then asks a judge model to summarize their collective output as structured JSON the outer model can synthesize from." +}) +export type GenerationContentResponse = { readonly "data": GenerationContentData } +export const GenerationContentResponse = Schema.Struct({ "data": GenerationContentData }).annotate({ + "description": "Stored prompt and completion content for a generation" +}) +export type GoneResponse = { + readonly "error": GoneResponseErrorData + readonly "openrouter_metadata"?: {} + readonly "user_id"?: string +} +export const GoneResponse = Schema.Struct({ + "error": GoneResponseErrorData, + "openrouter_metadata": Schema.optionalKey(Schema.Struct({})), + "user_id": Schema.optionalKey(Schema.String) +}).annotate({ "description": "Gone - Endpoint has been permanently removed or deprecated" }) +export type ImageGenerationServerTool_OpenRouter = { + readonly "parameters"?: ImageGenerationServerToolConfig + readonly "type": "openrouter:image_generation" +} +export const ImageGenerationServerTool_OpenRouter = Schema.Struct({ + "parameters": Schema.optionalKey(ImageGenerationServerToolConfig), + "type": Schema.Literal("openrouter:image_generation") +}).annotate({ + "description": "OpenRouter built-in server tool: generates images from text prompts using an image generation model" +}) +export type OutputImageGenerationCallItem = { readonly "id": string - readonly "canonical_slug": string - readonly "hugging_face_id"?: string - readonly "name": string - readonly "created": number - readonly "description"?: string - readonly "pricing": PublicPricing - readonly "context_length": number - readonly "architecture": ModelArchitecture - readonly "top_provider": TopProviderInfo - readonly "per_request_limits": PerRequestLimits - readonly "supported_parameters": ReadonlyArray - readonly "default_parameters": DefaultParameters - readonly "expiration_date"?: string + readonly "result"?: string + readonly "status": ImageGenerationStatus + readonly "type": "image_generation_call" } -export const Model = Schema.Struct({ - "id": Schema.String.annotate({ "description": "Unique identifier for the model" }), - "canonical_slug": Schema.String.annotate({ "description": "Canonical slug for the model" }), - "hugging_face_id": Schema.optionalKey( - Schema.String.annotate({ "description": "Hugging Face model identifier, if applicable" }) - ), - "name": Schema.String.annotate({ "description": "Display name of the model" }), - "created": Schema.Number.annotate({ "description": "Unix timestamp of when the model was created" }).check( - Schema.isFinite() - ), - "description": Schema.optionalKey(Schema.String.annotate({ "description": "Description of the model" })), - "pricing": PublicPricing, - "context_length": Schema.Number.annotate({ "description": "Maximum context length in tokens" }).check( - Schema.isFinite() - ), - "architecture": ModelArchitecture, - "top_provider": TopProviderInfo, - "per_request_limits": PerRequestLimits, - "supported_parameters": Schema.Array(Parameter).annotate({ - "description": "List of supported parameters for this model" - }), - "default_parameters": DefaultParameters, - "expiration_date": Schema.optionalKey( - Schema.String.annotate({ - "description": - "The date after which the model may be removed. ISO 8601 date string (YYYY-MM-DD) or null if no expiration." - }) - ) -}).annotate({ "description": "Information about an AI model available on OpenRouter" }) -export type ListEndpointsResponse = { +export const OutputImageGenerationCallItem = Schema.Struct({ + "id": Schema.String, + "result": Schema.optionalKey(Schema.String), + "status": ImageGenerationStatus, + "type": Schema.Literal("image_generation_call") +}) +export type OutputItemImageGenerationCall = { readonly "id": string - readonly "name": string - readonly "created": number - readonly "description": string - readonly "architecture": { - readonly "tokenizer": - | "Router" - | "Media" - | "Other" - | "GPT" - | "Claude" - | "Gemini" - | "Grok" - | "Cohere" - | "Nova" - | "Qwen" - | "Yi" - | "DeepSeek" - | "Mistral" - | "Llama2" - | "Llama3" - | "Llama4" - | "PaLM" - | "RWKV" - | "Qwen3" - readonly "instruct_type": - | "none" - | "airoboros" - | "alpaca" - | "alpaca-modif" - | "chatml" - | "claude" - | "code-llama" - | "gemma" - | "llama2" - | "llama3" - | "mistral" - | "nemotron" - | "neural" - | "openchat" - | "phi3" - | "rwkv" - | "vicuna" - | "zephyr" - | "deepseek-r1" - | "deepseek-v3.1" - | "qwq" - | "qwen3" - readonly "modality": string - readonly "input_modalities": ReadonlyArray<"text" | "image" | "file" | "audio" | "video"> - readonly "output_modalities": ReadonlyArray<"text" | "image" | "embeddings" | "audio"> - } - readonly "endpoints": ReadonlyArray + readonly "result"?: string + readonly "status": ImageGenerationStatus + readonly "type": "image_generation_call" } -export const ListEndpointsResponse = Schema.Struct({ - "id": Schema.String.annotate({ "description": "Unique identifier for the model" }), - "name": Schema.String.annotate({ "description": "Display name of the model" }), - "created": Schema.Number.annotate({ "description": "Unix timestamp of when the model was created" }).check( - Schema.isFinite() - ), - "description": Schema.String.annotate({ "description": "Description of the model" }), - "architecture": Schema.Struct({ - "tokenizer": Schema.Union([ - Schema.Literal("Router").annotate({ "description": "Tokenizer type used by the model" }), - Schema.Literal("Media").annotate({ "description": "Tokenizer type used by the model" }), - Schema.Literal("Other").annotate({ "description": "Tokenizer type used by the model" }), - Schema.Literal("GPT").annotate({ "description": "Tokenizer type used by the model" }), - Schema.Literal("Claude").annotate({ "description": "Tokenizer type used by the model" }), - Schema.Literal("Gemini").annotate({ "description": "Tokenizer type used by the model" }), - Schema.Literal("Grok").annotate({ "description": "Tokenizer type used by the model" }), - Schema.Literal("Cohere").annotate({ "description": "Tokenizer type used by the model" }), - Schema.Literal("Nova").annotate({ "description": "Tokenizer type used by the model" }), - Schema.Literal("Qwen").annotate({ "description": "Tokenizer type used by the model" }), - Schema.Literal("Yi").annotate({ "description": "Tokenizer type used by the model" }), - Schema.Literal("DeepSeek").annotate({ "description": "Tokenizer type used by the model" }), - Schema.Literal("Mistral").annotate({ "description": "Tokenizer type used by the model" }), - Schema.Literal("Llama2").annotate({ "description": "Tokenizer type used by the model" }), - Schema.Literal("Llama3").annotate({ "description": "Tokenizer type used by the model" }), - Schema.Literal("Llama4").annotate({ "description": "Tokenizer type used by the model" }), - Schema.Literal("PaLM").annotate({ "description": "Tokenizer type used by the model" }), - Schema.Literal("RWKV").annotate({ "description": "Tokenizer type used by the model" }), - Schema.Literal("Qwen3").annotate({ "description": "Tokenizer type used by the model" }) - ]).annotate({ "description": "Tokenizer type used by the model" }), - "instruct_type": Schema.Union([ - Schema.Literal("none").annotate({ "description": "Instruction format type" }), - Schema.Literal("airoboros").annotate({ "description": "Instruction format type" }), - Schema.Literal("alpaca").annotate({ "description": "Instruction format type" }), - Schema.Literal("alpaca-modif").annotate({ "description": "Instruction format type" }), - Schema.Literal("chatml").annotate({ "description": "Instruction format type" }), - Schema.Literal("claude").annotate({ "description": "Instruction format type" }), - Schema.Literal("code-llama").annotate({ "description": "Instruction format type" }), - Schema.Literal("gemma").annotate({ "description": "Instruction format type" }), - Schema.Literal("llama2").annotate({ "description": "Instruction format type" }), - Schema.Literal("llama3").annotate({ "description": "Instruction format type" }), - Schema.Literal("mistral").annotate({ "description": "Instruction format type" }), - Schema.Literal("nemotron").annotate({ "description": "Instruction format type" }), - Schema.Literal("neural").annotate({ "description": "Instruction format type" }), - Schema.Literal("openchat").annotate({ "description": "Instruction format type" }), - Schema.Literal("phi3").annotate({ "description": "Instruction format type" }), - Schema.Literal("rwkv").annotate({ "description": "Instruction format type" }), - Schema.Literal("vicuna").annotate({ "description": "Instruction format type" }), - Schema.Literal("zephyr").annotate({ "description": "Instruction format type" }), - Schema.Literal("deepseek-r1").annotate({ "description": "Instruction format type" }), - Schema.Literal("deepseek-v3.1").annotate({ "description": "Instruction format type" }), - Schema.Literal("qwq").annotate({ "description": "Instruction format type" }), - Schema.Literal("qwen3").annotate({ "description": "Instruction format type" }) - ]).annotate({ "description": "Instruction format type" }), - "modality": Schema.String.annotate({ "description": "Primary modality of the model" }), - "input_modalities": Schema.Array( - Schema.Union([ - Schema.Literal("text"), - Schema.Literal("image"), - Schema.Literal("file"), - Schema.Literal("audio"), - Schema.Literal("video") - ]) - ).annotate({ "description": "Supported input modalities" }), - "output_modalities": Schema.Array( - Schema.Union([ - Schema.Literal("text"), - Schema.Literal("image"), - Schema.Literal("embeddings"), - Schema.Literal("audio") - ]) - ).annotate({ "description": "Supported output modalities" }) - }).annotate({ "description": "Model architecture information" }), - "endpoints": Schema.Array(PublicEndpoint).annotate({ "description": "List of available endpoints for this model" }) -}).annotate({ "description": "List of available endpoints for a model" }) -export type ChatStreamingMessageChunk = { - readonly "role"?: "assistant" - readonly "content"?: string | null - readonly "reasoning"?: string | null - readonly "refusal"?: string | null - readonly "tool_calls"?: ReadonlyArray - readonly "reasoning_details"?: ReadonlyArray<__schema20> - readonly "images"?: - | ReadonlyArray<{ readonly "type": "image_url"; readonly "image_url": { readonly "url": string } }> - | null - readonly "annotations"?: +export const OutputItemImageGenerationCall = Schema.Struct({ + "id": Schema.String, + "result": Schema.optionalKey(Schema.String), + "status": ImageGenerationStatus, + "type": Schema.Literal("image_generation_call") +}) +export type OpenAIResponseCustomToolCallOutput = { + readonly "call_id": string + readonly "id"?: string + readonly "output": string | ReadonlyArray + readonly "type": "custom_tool_call_output" +} +export const OpenAIResponseCustomToolCallOutput = Schema.Struct({ + "call_id": Schema.String, + "id": Schema.optionalKey(Schema.String), + "output": Schema.Union([ + Schema.String, + Schema.Array(Schema.Union([InputText, InputImage, InputFile], { mode: "oneOf" })) + ]), + "type": Schema.Literal("custom_tool_call_output") +}) +export type OpenAIResponseFunctionToolCallOutput = { + readonly "call_id": string + readonly "id"?: string + readonly "output": string | ReadonlyArray + readonly "status"?: "in_progress" | "completed" | "incomplete" + readonly "type": "function_call_output" +} +export const OpenAIResponseFunctionToolCallOutput = Schema.Struct({ + "call_id": Schema.String, + "id": Schema.optionalKey(Schema.String), + "output": Schema.Union([ + Schema.String, + Schema.Array(Schema.Union([InputText, InputImage, InputFile], { mode: "oneOf" })) + ]), + "status": Schema.optionalKey(Schema.Literals(["in_progress", "completed", "incomplete"])), + "type": Schema.Literal("function_call_output") +}) +export type OpenAIResponseInputMessageItem = { + readonly "content": ReadonlyArray + readonly "id": string + readonly "role": "user" | "system" | "developer" + readonly "type"?: "message" +} +export const OpenAIResponseInputMessageItem = Schema.Struct({ + "content": Schema.Array(Schema.Union([InputText, InputImage, InputFile, InputAudio], { mode: "oneOf" })), + "id": Schema.String, + "role": Schema.Literals(["user", "system", "developer"]), + "type": Schema.optionalKey(Schema.Literal("message")) +}) +export type EasyInputMessage = { + readonly "content"?: | ReadonlyArray< - { - readonly "type": "url_citation" - readonly "url_citation": { - readonly "url": string - readonly "title"?: string - readonly "start_index"?: number - readonly "end_index"?: number - readonly "content"?: string - } - } | { - readonly "type": "file_annotation" - readonly "file_annotation": { readonly "file_id": string; readonly "quote"?: string } - } | { - readonly "type": "file" - readonly "file": { - readonly "hash": string - readonly "name": string - readonly "content"?: ReadonlyArray<{ readonly "type": string; readonly "text"?: string }> - } + | InputText + | { + readonly "detail": "auto" | "high" | "low" | "original" + readonly "image_url"?: string + readonly "type": "input_image" } + | InputFile + | InputAudio + | InputVideo > - | null + | string + | unknown + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "user" | "system" | "assistant" | "developer" + readonly "type"?: "message" } -export const ChatStreamingMessageChunk = Schema.Struct({ - "role": Schema.optionalKey(Schema.Literal("assistant")), - "content": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "reasoning": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "refusal": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "tool_calls": Schema.optionalKey(Schema.Array(ChatStreamingMessageToolCall)), - "reasoning_details": Schema.optionalKey(Schema.Array(__schema20)), - "images": Schema.optionalKey( +export const EasyInputMessage = Schema.Struct({ + "content": Schema.optionalKey( Schema.Union([ Schema.Array( - Schema.Struct({ "type": Schema.Literal("image_url"), "image_url": Schema.Struct({ "url": Schema.String }) }) + Schema.Union([ + InputText, + Schema.Struct({ + "detail": Schema.Literals(["auto", "high", "low", "original"]), + "image_url": Schema.optionalKey(Schema.String), + "type": Schema.Literal("input_image") + }).annotate({ "description": "Image input content item" }), + InputFile, + InputAudio, + InputVideo + ], { mode: "oneOf" }) ), - Schema.Null + Schema.String, + Schema.Unknown ]) ), - "annotations": Schema.optionalKey(Schema.Union([ - Schema.Array(Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("url_citation"), - "url_citation": Schema.Struct({ - "url": Schema.String, - "title": Schema.optionalKey(Schema.String), - "start_index": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "end_index": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "content": Schema.optionalKey(Schema.String) - }) - }), - Schema.Struct({ - "type": Schema.Literal("file_annotation"), - "file_annotation": Schema.Struct({ "file_id": Schema.String, "quote": Schema.optionalKey(Schema.String) }) - }), - Schema.Struct({ - "type": Schema.Literal("file"), - "file": Schema.Struct({ - "hash": Schema.String, - "name": Schema.String, - "content": Schema.optionalKey( - Schema.Array(Schema.Struct({ "type": Schema.String, "text": Schema.optionalKey(Schema.String) })) - ) - }) - }) - ], { mode: "oneOf" })), - Schema.Null - ])) + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literals(["user", "system", "assistant", "developer"]), + "type": Schema.optionalKey(Schema.Literal("message")) }) -export type ChatMessageContentItem = - | ChatMessageContentItemText - | ChatMessageContentItemImage - | ChatMessageContentItemAudio - | ChatMessageContentItemVideo -export const ChatMessageContentItem = Schema.Union([ - ChatMessageContentItemText, - ChatMessageContentItemImage, - ChatMessageContentItemAudio, - ChatMessageContentItemVideo -], { mode: "oneOf" }) -export type SystemMessage = { - readonly "role": "system" - readonly "content": string | ReadonlyArray - readonly "name"?: string +export type InputMessageItem = { + readonly "content"?: ReadonlyArray< + | InputText + | { + readonly "detail": "auto" | "high" | "low" | "original" + readonly "image_url"?: string + readonly "type": "input_image" + } + | InputFile + | InputAudio + | InputVideo + > + readonly "id"?: string + readonly "role": "user" | "system" | "developer" + readonly "type"?: "message" } -export const SystemMessage = Schema.Struct({ - "role": Schema.Literal("system"), - "content": Schema.Union([Schema.String, Schema.Array(ChatMessageContentItemText)]), - "name": Schema.optionalKey(Schema.String) +export const InputMessageItem = Schema.Struct({ + "content": Schema.optionalKey( + Schema.Array( + Schema.Union([ + InputText, + Schema.Struct({ + "detail": Schema.Literals(["auto", "high", "low", "original"]), + "image_url": Schema.optionalKey(Schema.String), + "type": Schema.Literal("input_image") + }).annotate({ "description": "Image input content item" }), + InputFile, + InputAudio, + InputVideo + ], { mode: "oneOf" }) + ) + ), + "id": Schema.optionalKey(Schema.String), + "role": Schema.Literals(["user", "system", "developer"]), + "type": Schema.optionalKey(Schema.Literal("message")) }) -export type DeveloperMessage = { - readonly "role": "developer" - readonly "content": string | ReadonlyArray - readonly "name"?: string +export type InternalServerResponse = { + readonly "error": InternalServerResponseErrorData + readonly "openrouter_metadata"?: {} + readonly "user_id"?: string } -export const DeveloperMessage = Schema.Struct({ - "role": Schema.Literal("developer"), - "content": Schema.Union([Schema.String, Schema.Array(ChatMessageContentItemText)]), - "name": Schema.optionalKey(Schema.String) +export const InternalServerResponse = Schema.Struct({ + "error": InternalServerResponseErrorData, + "openrouter_metadata": Schema.optionalKey(Schema.Struct({})), + "user_id": Schema.optionalKey(Schema.String) +}).annotate({ "description": "Internal Server Error - Unexpected server error" }) +export type ListKeyAssignmentsResponse = { + readonly "data": ReadonlyArray + readonly "total_count": number +} +export const ListKeyAssignmentsResponse = Schema.Struct({ + "data": Schema.Array(KeyAssignment).annotate({ "description": "List of key assignments" }), + "total_count": Schema.Number.annotate({ "description": "Total number of key assignments for this guardrail" }).check( + Schema.isInt() + ) }) -export type OutputMessage = { - readonly "id": string - readonly "role": "assistant" - readonly "type": "message" - readonly "status"?: "completed" | "incomplete" | "in_progress" - readonly "content": ReadonlyArray +export type ListMemberAssignmentsResponse = { + readonly "data": ReadonlyArray + readonly "total_count": number } -export const OutputMessage = Schema.Struct({ - "id": Schema.String, - "role": Schema.Literal("assistant"), - "type": Schema.Literal("message"), - "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])), - "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])) +export const ListMemberAssignmentsResponse = Schema.Struct({ + "data": Schema.Array(MemberAssignment).annotate({ "description": "List of member assignments" }), + "total_count": Schema.Number.annotate({ "description": "Total number of member assignments" }).check(Schema.isInt()) }) -export type ResponsesOutputMessage = { - readonly "id": string - readonly "role": "assistant" - readonly "type": "message" - readonly "status"?: "completed" | "incomplete" | "in_progress" - readonly "content": ReadonlyArray +export type MessagesErrorResponse = { readonly "error": MessagesErrorDetail; readonly "type": "error" } +export const MessagesErrorResponse = Schema.Struct({ "error": MessagesErrorDetail, "type": Schema.Literal("error") }) +export type ContentPartInputAudio = { readonly "input_audio": MultimodalMedia; readonly "type": "input_audio" } +export const ContentPartInputAudio = Schema.Struct({ + "input_audio": MultimodalMedia, + "type": Schema.Literal("input_audio") +}) +export type ContentPartInputFile = { readonly "input_file": MultimodalMedia; readonly "type": "input_file" } +export const ContentPartInputFile = Schema.Struct({ + "input_file": MultimodalMedia, + "type": Schema.Literal("input_file") +}) +export type ContentPartInputVideo = { readonly "input_video": MultimodalMedia; readonly "type": "input_video" } +export const ContentPartInputVideo = Schema.Struct({ + "input_video": MultimodalMedia, + "type": Schema.Literal("input_video") +}) +export type NotFoundResponse = { + readonly "error": NotFoundResponseErrorData + readonly "openrouter_metadata"?: {} + readonly "user_id"?: string } -export const ResponsesOutputMessage = Schema.Struct({ - "id": Schema.String, - "role": Schema.Literal("assistant"), - "type": Schema.Literal("message"), - "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])), - "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])) -}).annotate({ "description": "An output message item" }) -export type OpenResponsesContentPartAddedEvent = { - readonly "type": "response.content_part.added" - readonly "output_index": number - readonly "item_id": string - readonly "content_index": number - readonly "part": ResponseOutputText | OpenAIResponsesRefusalContent - readonly "sequence_number": number +export const NotFoundResponse = Schema.Struct({ + "error": NotFoundResponseErrorData, + "openrouter_metadata": Schema.optionalKey(Schema.Struct({})), + "user_id": Schema.optionalKey(Schema.String) +}).annotate({ "description": "Not Found - Resource does not exist" }) +export type CreateObservabilityDestinationRequest = { + readonly "api_key_hashes"?: ReadonlyArray + readonly "config": {} + readonly "enabled"?: boolean + readonly "filter_rules"?: ObservabilityFilterRulesConfig + readonly "name": string + readonly "privacy_mode"?: boolean + readonly "sampling_rate"?: number + readonly "type": + | "arize" + | "braintrust" + | "clickhouse" + | "datadog" + | "grafana" + | "langfuse" + | "langsmith" + | "newrelic" + | "opik" + | "otel-collector" + | "posthog" + | "ramp" + | "s3" + | "sentry" + | "snowflake" + | "weave" + | "webhook" + readonly "workspace_id"?: string } -export const OpenResponsesContentPartAddedEvent = Schema.Struct({ - "type": Schema.Literal("response.content_part.added"), - "output_index": Schema.Number.check(Schema.isFinite()), - "item_id": Schema.String, - "content_index": Schema.Number.check(Schema.isFinite()), - "part": Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent]), - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Event emitted when a new content part is added to an output item" }) -export type OpenResponsesContentPartDoneEvent = { - readonly "type": "response.content_part.done" - readonly "output_index": number - readonly "item_id": string - readonly "content_index": number - readonly "part": ResponseOutputText | OpenAIResponsesRefusalContent - readonly "sequence_number": number +export const CreateObservabilityDestinationRequest = Schema.Struct({ + "api_key_hashes": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "description": + "Optional allowlist of OpenRouter API key hashes whose traffic is forwarded. `null` or omitted means all keys. Must contain at least one hash if provided." + }).check(Schema.isMinLength(1)) + ), + "config": Schema.Struct({}).annotate({ + "description": "Provider-specific configuration. The shape depends on `type` and is validated server-side." + }), + "enabled": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether this destination should be enabled immediately." }) + ), + "filter_rules": Schema.optionalKey(ObservabilityFilterRulesConfig), + "name": Schema.String.annotate({ "description": "Human-readable name for the destination." }), + "privacy_mode": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "When true, request/response bodies are not forwarded — only metadata." }) + ), + "sampling_rate": Schema.optionalKey( + Schema.Number.annotate({ "description": "Sampling rate between 0 and 1 (1 = 100%).", "format": "double" }).check( + Schema.isFinite() + ) + ), + "type": Schema.Literals([ + "arize", + "braintrust", + "clickhouse", + "datadog", + "grafana", + "langfuse", + "langsmith", + "newrelic", + "opik", + "otel-collector", + "posthog", + "ramp", + "s3", + "sentry", + "snowflake", + "weave", + "webhook" + ]).annotate({ "description": "The destination type. Only stable destination types are accepted." }), + "workspace_id": Schema.optionalKey( + Schema.String.annotate({ + "description": "Optional workspace ID. Defaults to the authenticated entity's default workspace.", + "format": "uuid" + }) + ) +}) +export type ObservabilityArizeDestination = { + readonly "api_key_hashes": ReadonlyArray + readonly "config": { + readonly "apiKey": string + readonly "baseUrl"?: string + readonly "headers"?: {} + readonly "modelId": string + readonly "spaceKey": string + } + readonly "created_at": string + readonly "enabled": boolean + readonly "filter_rules": ObservabilityFilterRulesConfig + readonly "id": string + readonly "name": string + readonly "privacy_mode": boolean + readonly "sampling_rate": number + readonly "type": "arize" + readonly "updated_at": string + readonly "workspace_id": string } -export const OpenResponsesContentPartDoneEvent = Schema.Struct({ - "type": Schema.Literal("response.content_part.done"), - "output_index": Schema.Number.check(Schema.isFinite()), - "item_id": Schema.String, - "content_index": Schema.Number.check(Schema.isFinite()), - "part": Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent]), - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Event emitted when a content part is complete" }) -export type ModelsListResponseData = ReadonlyArray -export const ModelsListResponseData = Schema.Array(Model).annotate({ "description": "List of available models" }) -export type ChatStreamingChoice = { - readonly "delta": ChatStreamingMessageChunk - readonly "finish_reason"?: __schema26 - readonly "index": number - readonly "logprobs"?: ChatMessageTokenLogprobs | null +export const ObservabilityArizeDestination = Schema.Struct({ + "api_key_hashes": Schema.Array(Schema.String).annotate({ + "description": + "Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) whose traffic is forwarded to this destination. `null` means all keys." + }), + "config": Schema.Struct({ + "apiKey": Schema.String.check(Schema.isMinLength(1)), + "baseUrl": Schema.optionalKey(Schema.String), + "headers": Schema.optionalKey( + Schema.Struct({}).annotate({ "description": "Custom HTTP headers to include in requests to this destination." }) + ), + "modelId": Schema.String.check(Schema.isMinLength(1)), + "spaceKey": Schema.String.check(Schema.isMinLength(1)) + }), + "created_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was created." }), + "enabled": Schema.Boolean.annotate({ "description": "Whether this destination is currently enabled." }), + "filter_rules": ObservabilityFilterRulesConfig, + "id": Schema.String.annotate({ "description": "Stable public identifier for this destination.", "format": "uuid" }), + "name": Schema.String.annotate({ "description": "Human-readable name for the destination." }), + "privacy_mode": Schema.Boolean.annotate({ + "description": "When true, request/response bodies are not forwarded to this destination — only metadata." + }), + "sampling_rate": Schema.Number.annotate({ + "description": "Sampling rate for events sent to this destination, between 0 and 1 (1 = 100%).", + "format": "double" + }).check(Schema.isFinite()), + "type": Schema.Literal("arize"), + "updated_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was last updated." }), + "workspace_id": Schema.String.annotate({ + "description": "ID of the workspace this destination belongs to.", + "format": "uuid" + }) +}) +export type ObservabilityBraintrustDestination = { + readonly "api_key_hashes": ReadonlyArray + readonly "config": { + readonly "apiKey": string + readonly "baseUrl"?: string + readonly "headers"?: {} + readonly "projectId": string + } + readonly "created_at": string + readonly "enabled": boolean + readonly "filter_rules": ObservabilityFilterRulesConfig + readonly "id": string + readonly "name": string + readonly "privacy_mode": boolean + readonly "sampling_rate": number + readonly "type": "braintrust" + readonly "updated_at": string + readonly "workspace_id": string } -export const ChatStreamingChoice = Schema.Struct({ - "delta": ChatStreamingMessageChunk, - "finish_reason": Schema.optionalKey(__schema26), - "index": Schema.Number.check(Schema.isFinite()), - "logprobs": Schema.optionalKey(Schema.Union([ChatMessageTokenLogprobs, Schema.Null])) +export const ObservabilityBraintrustDestination = Schema.Struct({ + "api_key_hashes": Schema.Array(Schema.String).annotate({ + "description": + "Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) whose traffic is forwarded to this destination. `null` means all keys." + }), + "config": Schema.Struct({ + "apiKey": Schema.String.check(Schema.isMinLength(1)), + "baseUrl": Schema.optionalKey(Schema.String), + "headers": Schema.optionalKey( + Schema.Struct({}).annotate({ "description": "Custom HTTP headers to include in requests to this destination." }) + ), + "projectId": Schema.String.check(Schema.isMinLength(1)) + }), + "created_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was created." }), + "enabled": Schema.Boolean.annotate({ "description": "Whether this destination is currently enabled." }), + "filter_rules": ObservabilityFilterRulesConfig, + "id": Schema.String.annotate({ "description": "Stable public identifier for this destination.", "format": "uuid" }), + "name": Schema.String.annotate({ "description": "Human-readable name for the destination." }), + "privacy_mode": Schema.Boolean.annotate({ + "description": "When true, request/response bodies are not forwarded to this destination — only metadata." + }), + "sampling_rate": Schema.Number.annotate({ + "description": "Sampling rate for events sent to this destination, between 0 and 1 (1 = 100%).", + "format": "double" + }).check(Schema.isFinite()), + "type": Schema.Literal("braintrust"), + "updated_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was last updated." }), + "workspace_id": Schema.String.annotate({ + "description": "ID of the workspace this destination belongs to.", + "format": "uuid" + }) }) -export type UserMessage = { - readonly "role": "user" - readonly "content": string | ReadonlyArray - readonly "name"?: string +export type ObservabilityClickhouseDestination = { + readonly "api_key_hashes": ReadonlyArray + readonly "config": { + readonly "database": string + readonly "headers"?: {} + readonly "host": string + readonly "password": string + readonly "table"?: string + readonly "username": string + } + readonly "created_at": string + readonly "enabled": boolean + readonly "filter_rules": ObservabilityFilterRulesConfig + readonly "id": string + readonly "name": string + readonly "privacy_mode": boolean + readonly "sampling_rate": number + readonly "type": "clickhouse" + readonly "updated_at": string + readonly "workspace_id": string } -export const UserMessage = Schema.Struct({ - "role": Schema.Literal("user"), - "content": Schema.Union([Schema.String, Schema.Array(ChatMessageContentItem)]), - "name": Schema.optionalKey(Schema.String) +export const ObservabilityClickhouseDestination = Schema.Struct({ + "api_key_hashes": Schema.Array(Schema.String).annotate({ + "description": + "Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) whose traffic is forwarded to this destination. `null` means all keys." + }), + "config": Schema.Struct({ + "database": Schema.String.check(Schema.isMinLength(1)), + "headers": Schema.optionalKey( + Schema.Struct({}).annotate({ "description": "Custom HTTP headers to include in requests to this destination." }) + ), + "host": Schema.String.check(Schema.isMinLength(1)), + "password": Schema.String.check(Schema.isMinLength(1)), + "table": Schema.optionalKey(Schema.String), + "username": Schema.String.annotate({ + "description": "If you have not set a specific username in ClickHouse, simply type in 'default' below." + }).check(Schema.isMinLength(1)) + }), + "created_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was created." }), + "enabled": Schema.Boolean.annotate({ "description": "Whether this destination is currently enabled." }), + "filter_rules": ObservabilityFilterRulesConfig, + "id": Schema.String.annotate({ "description": "Stable public identifier for this destination.", "format": "uuid" }), + "name": Schema.String.annotate({ "description": "Human-readable name for the destination." }), + "privacy_mode": Schema.Boolean.annotate({ + "description": "When true, request/response bodies are not forwarded to this destination — only metadata." + }), + "sampling_rate": Schema.Number.annotate({ + "description": "Sampling rate for events sent to this destination, between 0 and 1 (1 = 100%).", + "format": "double" + }).check(Schema.isFinite()), + "type": Schema.Literal("clickhouse"), + "updated_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was last updated." }), + "workspace_id": Schema.String.annotate({ + "description": "ID of the workspace this destination belongs to.", + "format": "uuid" + }) }) -export type AssistantMessage = { - readonly "role": "assistant" - readonly "content"?: string | ReadonlyArray | null - readonly "name"?: string - readonly "tool_calls"?: ReadonlyArray - readonly "refusal"?: string | null - readonly "reasoning"?: string | null - readonly "reasoning_details"?: ReadonlyArray<__schema20> - readonly "images"?: - | ReadonlyArray<{ readonly "type": "image_url"; readonly "image_url": { readonly "url": string } }> - | null - readonly "annotations"?: - | ReadonlyArray< - { - readonly "type": "url_citation" - readonly "url_citation": { - readonly "url": string - readonly "title"?: string - readonly "start_index"?: number - readonly "end_index"?: number - readonly "content"?: string - } - } | { - readonly "type": "file_annotation" - readonly "file_annotation": { readonly "file_id": string; readonly "quote"?: string } - } | { - readonly "type": "file" - readonly "file": { - readonly "hash": string - readonly "name": string - readonly "content"?: ReadonlyArray<{ readonly "type": string; readonly "text"?: string }> - } - } - > - | null +export type ObservabilityDatadogDestination = { + readonly "api_key_hashes": ReadonlyArray + readonly "config": { + readonly "apiKey": string + readonly "headers"?: {} + readonly "mlApp": string + readonly "url"?: string + } + readonly "created_at": string + readonly "enabled": boolean + readonly "filter_rules": ObservabilityFilterRulesConfig + readonly "id": string + readonly "name": string + readonly "privacy_mode": boolean + readonly "sampling_rate": number + readonly "type": "datadog" + readonly "updated_at": string + readonly "workspace_id": string } -export const AssistantMessage = Schema.Struct({ - "role": Schema.Literal("assistant"), - "content": Schema.optionalKey( - Schema.Union([Schema.Union([Schema.String, Schema.Array(ChatMessageContentItem)]), Schema.Null]) - ), - "name": Schema.optionalKey(Schema.String), - "tool_calls": Schema.optionalKey(Schema.Array(ChatMessageToolCall)), - "refusal": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "reasoning": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "reasoning_details": Schema.optionalKey(Schema.Array(__schema20)), - "images": Schema.optionalKey( - Schema.Union([ - Schema.Array( - Schema.Struct({ "type": Schema.Literal("image_url"), "image_url": Schema.Struct({ "url": Schema.String }) }) - ), - Schema.Null - ]) - ), - "annotations": Schema.optionalKey(Schema.Union([ - Schema.Array(Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("url_citation"), - "url_citation": Schema.Struct({ - "url": Schema.String, - "title": Schema.optionalKey(Schema.String), - "start_index": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "end_index": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "content": Schema.optionalKey(Schema.String) - }) - }), - Schema.Struct({ - "type": Schema.Literal("file_annotation"), - "file_annotation": Schema.Struct({ "file_id": Schema.String, "quote": Schema.optionalKey(Schema.String) }) - }), - Schema.Struct({ - "type": Schema.Literal("file"), - "file": Schema.Struct({ - "hash": Schema.String, - "name": Schema.String, - "content": Schema.optionalKey( - Schema.Array(Schema.Struct({ "type": Schema.String, "text": Schema.optionalKey(Schema.String) })) - ) - }) +export const ObservabilityDatadogDestination = Schema.Struct({ + "api_key_hashes": Schema.Array(Schema.String).annotate({ + "description": + "Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) whose traffic is forwarded to this destination. `null` means all keys." + }), + "config": Schema.Struct({ + "apiKey": Schema.String.annotate({ + "description": "Datadog API key must have LLM Observability permissions. Create at: " + }).check(Schema.isMinLength(1)), + "headers": Schema.optionalKey( + Schema.Struct({}).annotate({ "description": "Custom HTTP headers to include in requests to this destination." }) + ), + "mlApp": Schema.String.annotate({ "description": "Name to identify your application in Datadog LLM Observability" }) + .check(Schema.isMinLength(1)), + "url": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Datadog API URL for your region (e.g., https://api.datadoghq.com, https://api.us3.datadoghq.com, https://api.datadoghq.eu)" }) - ], { mode: "oneOf" })), - Schema.Null - ])) + ) + }), + "created_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was created." }), + "enabled": Schema.Boolean.annotate({ "description": "Whether this destination is currently enabled." }), + "filter_rules": ObservabilityFilterRulesConfig, + "id": Schema.String.annotate({ "description": "Stable public identifier for this destination.", "format": "uuid" }), + "name": Schema.String.annotate({ "description": "Human-readable name for the destination." }), + "privacy_mode": Schema.Boolean.annotate({ + "description": "When true, request/response bodies are not forwarded to this destination — only metadata." + }), + "sampling_rate": Schema.Number.annotate({ + "description": "Sampling rate for events sent to this destination, between 0 and 1 (1 = 100%).", + "format": "double" + }).check(Schema.isFinite()), + "type": Schema.Literal("datadog"), + "updated_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was last updated." }), + "workspace_id": Schema.String.annotate({ + "description": "ID of the workspace this destination belongs to.", + "format": "uuid" + }) }) -export type ToolResponseMessage = { - readonly "role": "tool" - readonly "content": string | ReadonlyArray - readonly "tool_call_id": string +export type ObservabilityGrafanaDestination = { + readonly "api_key_hashes": ReadonlyArray + readonly "config": { + readonly "apiKey": string + readonly "baseUrl"?: string + readonly "headers"?: {} + readonly "instanceId": string + } + readonly "created_at": string + readonly "enabled": boolean + readonly "filter_rules": ObservabilityFilterRulesConfig + readonly "id": string + readonly "name": string + readonly "privacy_mode": boolean + readonly "sampling_rate": number + readonly "type": "grafana" + readonly "updated_at": string + readonly "workspace_id": string } -export const ToolResponseMessage = Schema.Struct({ - "role": Schema.Literal("tool"), - "content": Schema.Union([Schema.String, Schema.Array(ChatMessageContentItem)]), - "tool_call_id": Schema.String +export const ObservabilityGrafanaDestination = Schema.Struct({ + "api_key_hashes": Schema.Array(Schema.String).annotate({ + "description": + "Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) whose traffic is forwarded to this destination. `null` means all keys." + }), + "config": Schema.Struct({ + "apiKey": Schema.String.check(Schema.isMinLength(1)), + "baseUrl": Schema.optionalKey(Schema.String), + "headers": Schema.optionalKey( + Schema.Struct({}).annotate({ "description": "Custom HTTP headers to include in requests to this destination." }) + ), + "instanceId": Schema.String.check(Schema.isMinLength(1)) + }), + "created_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was created." }), + "enabled": Schema.Boolean.annotate({ "description": "Whether this destination is currently enabled." }), + "filter_rules": ObservabilityFilterRulesConfig, + "id": Schema.String.annotate({ "description": "Stable public identifier for this destination.", "format": "uuid" }), + "name": Schema.String.annotate({ "description": "Human-readable name for the destination." }), + "privacy_mode": Schema.Boolean.annotate({ + "description": "When true, request/response bodies are not forwarded to this destination — only metadata." + }), + "sampling_rate": Schema.Number.annotate({ + "description": "Sampling rate for events sent to this destination, between 0 and 1 (1 = 100%).", + "format": "double" + }).check(Schema.isFinite()), + "type": Schema.Literal("grafana"), + "updated_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was last updated." }), + "workspace_id": Schema.String.annotate({ + "description": "ID of the workspace this destination belongs to.", + "format": "uuid" + }) }) -export type OpenAIResponsesInput = - | string - | ReadonlyArray< - | { - readonly "type"?: "message" - readonly "role": "user" | "system" | "assistant" | "developer" - readonly "content": - | ReadonlyArray - | string - } - | { - readonly "id": string - readonly "type"?: "message" - readonly "role": "user" | "system" | "developer" - readonly "content": ReadonlyArray - } - | { - readonly "type": "function_call_output" - readonly "id"?: string - readonly "call_id": string - readonly "output": string - readonly "status"?: ToolCallStatus - } - | { - readonly "type": "function_call" - readonly "call_id": string - readonly "name": string - readonly "arguments": string - readonly "id"?: string - readonly "status"?: ToolCallStatus - } - | OutputItemImageGenerationCall - | OutputMessage - > - | unknown -export const OpenAIResponsesInput = Schema.Union([ - Schema.String, - Schema.Array(Schema.Union([ - Schema.Struct({ - "type": Schema.optionalKey(Schema.Literal("message")), - "role": Schema.Literals(["user", "system", "assistant", "developer"]), - "content": Schema.Union([ - Schema.Array( - Schema.Union([ResponseInputText, ResponseInputImage, ResponseInputFile, ResponseInputAudio], { - mode: "oneOf" - }) - ), - Schema.String - ]) - }), - Schema.Struct({ - "id": Schema.String, - "type": Schema.optionalKey(Schema.Literal("message")), - "role": Schema.Literals(["user", "system", "developer"]), - "content": Schema.Array( - Schema.Union([ResponseInputText, ResponseInputImage, ResponseInputFile, ResponseInputAudio], { mode: "oneOf" }) - ) - }), - Schema.Struct({ - "type": Schema.Literal("function_call_output"), - "id": Schema.optionalKey(Schema.String), - "call_id": Schema.String, - "output": Schema.String, - "status": Schema.optionalKey(ToolCallStatus) - }), - Schema.Struct({ - "type": Schema.Literal("function_call"), - "call_id": Schema.String, - "name": Schema.String, - "arguments": Schema.String, - "id": Schema.optionalKey(Schema.String), - "status": Schema.optionalKey(ToolCallStatus) - }), - OutputItemImageGenerationCall, - OutputMessage - ])), - Schema.Unknown -]) -export type OpenResponsesOutputItemAddedEvent = { - readonly "type": "response.output_item.added" - readonly "output_index": number - readonly "item": - | OutputMessage - | OutputItemReasoning - | OutputItemFunctionCall - | OutputItemWebSearchCall - | OutputItemFileSearchCall - | OutputItemImageGenerationCall - readonly "sequence_number": number +export type ObservabilityLangfuseDestination = { + readonly "api_key_hashes": ReadonlyArray + readonly "config": { + readonly "baseUrl"?: string + readonly "headers"?: {} + readonly "publicKey": string + readonly "secretKey": string + } + readonly "created_at": string + readonly "enabled": boolean + readonly "filter_rules": ObservabilityFilterRulesConfig + readonly "id": string + readonly "name": string + readonly "privacy_mode": boolean + readonly "sampling_rate": number + readonly "type": "langfuse" + readonly "updated_at": string + readonly "workspace_id": string } -export const OpenResponsesOutputItemAddedEvent = Schema.Struct({ - "type": Schema.Literal("response.output_item.added"), - "output_index": Schema.Number.check(Schema.isFinite()), - "item": Schema.Union([ - OutputMessage, - OutputItemReasoning, - OutputItemFunctionCall, - OutputItemWebSearchCall, - OutputItemFileSearchCall, - OutputItemImageGenerationCall - ], { mode: "oneOf" }), - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Event emitted when a new output item is added to the response" }) -export type OpenResponsesOutputItemDoneEvent = { - readonly "type": "response.output_item.done" - readonly "output_index": number - readonly "item": - | OutputMessage - | OutputItemReasoning - | OutputItemFunctionCall - | OutputItemWebSearchCall - | OutputItemFileSearchCall - | OutputItemImageGenerationCall - readonly "sequence_number": number +export const ObservabilityLangfuseDestination = Schema.Struct({ + "api_key_hashes": Schema.Array(Schema.String).annotate({ + "description": + "Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) whose traffic is forwarded to this destination. `null` means all keys." + }), + "config": Schema.Struct({ + "baseUrl": Schema.optionalKey(Schema.String), + "headers": Schema.optionalKey( + Schema.Struct({}).annotate({ "description": "Custom HTTP headers to include in requests to this destination." }) + ), + "publicKey": Schema.String.check(Schema.isMinLength(1)), + "secretKey": Schema.String.check(Schema.isMinLength(1)) + }), + "created_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was created." }), + "enabled": Schema.Boolean.annotate({ "description": "Whether this destination is currently enabled." }), + "filter_rules": ObservabilityFilterRulesConfig, + "id": Schema.String.annotate({ "description": "Stable public identifier for this destination.", "format": "uuid" }), + "name": Schema.String.annotate({ "description": "Human-readable name for the destination." }), + "privacy_mode": Schema.Boolean.annotate({ + "description": "When true, request/response bodies are not forwarded to this destination — only metadata." + }), + "sampling_rate": Schema.Number.annotate({ + "description": "Sampling rate for events sent to this destination, between 0 and 1 (1 = 100%).", + "format": "double" + }).check(Schema.isFinite()), + "type": Schema.Literal("langfuse"), + "updated_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was last updated." }), + "workspace_id": Schema.String.annotate({ + "description": "ID of the workspace this destination belongs to.", + "format": "uuid" + }) +}) +export type ObservabilityLangsmithDestination = { + readonly "api_key_hashes": ReadonlyArray + readonly "config": { + readonly "apiKey": string + readonly "endpoint"?: string + readonly "headers"?: {} + readonly "project"?: string + readonly "workspaceId"?: string + } + readonly "created_at": string + readonly "enabled": boolean + readonly "filter_rules": ObservabilityFilterRulesConfig + readonly "id": string + readonly "name": string + readonly "privacy_mode": boolean + readonly "sampling_rate": number + readonly "type": "langsmith" + readonly "updated_at": string + readonly "workspace_id": string } -export const OpenResponsesOutputItemDoneEvent = Schema.Struct({ - "type": Schema.Literal("response.output_item.done"), - "output_index": Schema.Number.check(Schema.isFinite()), - "item": Schema.Union([ - OutputMessage, - OutputItemReasoning, - OutputItemFunctionCall, - OutputItemWebSearchCall, - OutputItemFileSearchCall, - OutputItemImageGenerationCall - ], { mode: "oneOf" }), - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Event emitted when an output item is complete" }) -export type OpenResponsesInput = - | string - | ReadonlyArray< - | OpenResponsesReasoning - | OpenResponsesEasyInputMessage - | OpenResponsesInputMessageItem - | OpenResponsesFunctionToolCall - | OpenResponsesFunctionCallOutput - | ResponsesOutputMessage - | ResponsesOutputItemReasoning - | ResponsesOutputItemFunctionCall - | ResponsesWebSearchCallOutput - | ResponsesOutputItemFileSearchCall - | ResponsesImageGenerationCall - > -export const OpenResponsesInput = Schema.Union([ - Schema.String, - Schema.Array( - Schema.Union([ - OpenResponsesReasoning, - OpenResponsesEasyInputMessage, - OpenResponsesInputMessageItem, - OpenResponsesFunctionToolCall, - OpenResponsesFunctionCallOutput, - ResponsesOutputMessage, - ResponsesOutputItemReasoning, - ResponsesOutputItemFunctionCall, - ResponsesWebSearchCallOutput, - ResponsesOutputItemFileSearchCall, - ResponsesImageGenerationCall - ]) - ) -]).annotate({ "description": "Input for a response request - can be a string or array of items" }) -export type ModelsListResponse = { readonly "data": ModelsListResponseData } -export const ModelsListResponse = Schema.Struct({ "data": ModelsListResponseData }).annotate({ - "description": "List of available models" +export const ObservabilityLangsmithDestination = Schema.Struct({ + "api_key_hashes": Schema.Array(Schema.String).annotate({ + "description": + "Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) whose traffic is forwarded to this destination. `null` means all keys." + }), + "config": Schema.Struct({ + "apiKey": Schema.String.check(Schema.isMinLength(1)), + "endpoint": Schema.optionalKey(Schema.String), + "headers": Schema.optionalKey( + Schema.Struct({}).annotate({ "description": "Custom HTTP headers to include in requests to this destination." }) + ), + "project": Schema.optionalKey( + Schema.String.annotate({ + "description": "The name for this project, such as pr-openrouter-demo. Defaults to \"main\" if not set." + }).check(Schema.isMinLength(1)) + ), + "workspaceId": Schema.optionalKey( + Schema.String.annotate({ + "description": "Required for org-scoped API keys. Find this in your LangSmith workspace settings." + }) + ) + }), + "created_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was created." }), + "enabled": Schema.Boolean.annotate({ "description": "Whether this destination is currently enabled." }), + "filter_rules": ObservabilityFilterRulesConfig, + "id": Schema.String.annotate({ "description": "Stable public identifier for this destination.", "format": "uuid" }), + "name": Schema.String.annotate({ "description": "Human-readable name for the destination." }), + "privacy_mode": Schema.Boolean.annotate({ + "description": "When true, request/response bodies are not forwarded to this destination — only metadata." + }), + "sampling_rate": Schema.Number.annotate({ + "description": "Sampling rate for events sent to this destination, between 0 and 1 (1 = 100%).", + "format": "double" + }).check(Schema.isFinite()), + "type": Schema.Literal("langsmith"), + "updated_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was last updated." }), + "workspace_id": Schema.String.annotate({ + "description": "ID of the workspace this destination belongs to.", + "format": "uuid" + }) }) -export type ChatStreamingResponseChunk = { - readonly "data": { - readonly "id": string - readonly "choices": ReadonlyArray - readonly "created": number - readonly "model": string - readonly "object": "chat.completion.chunk" - readonly "system_fingerprint"?: string | null - readonly "error"?: { readonly "message": string; readonly "code": number } - readonly "usage"?: ChatGenerationTokenUsage +export type ObservabilityNewrelicDestination = { + readonly "api_key_hashes": ReadonlyArray + readonly "config": { readonly "headers"?: {}; readonly "licenseKey": string; readonly "region"?: "us" | "eu" } + readonly "created_at": string + readonly "enabled": boolean + readonly "filter_rules": ObservabilityFilterRulesConfig + readonly "id": string + readonly "name": string + readonly "privacy_mode": boolean + readonly "sampling_rate": number + readonly "type": "newrelic" + readonly "updated_at": string + readonly "workspace_id": string +} +export const ObservabilityNewrelicDestination = Schema.Struct({ + "api_key_hashes": Schema.Array(Schema.String).annotate({ + "description": + "Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) whose traffic is forwarded to this destination. `null` means all keys." + }), + "config": Schema.Struct({ + "headers": Schema.optionalKey( + Schema.Struct({}).annotate({ "description": "Custom HTTP headers to include in requests to this destination." }) + ), + "licenseKey": Schema.String.check(Schema.isMinLength(1)), + "region": Schema.optionalKey(Schema.Literals(["us", "eu"])) + }), + "created_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was created." }), + "enabled": Schema.Boolean.annotate({ "description": "Whether this destination is currently enabled." }), + "filter_rules": ObservabilityFilterRulesConfig, + "id": Schema.String.annotate({ "description": "Stable public identifier for this destination.", "format": "uuid" }), + "name": Schema.String.annotate({ "description": "Human-readable name for the destination." }), + "privacy_mode": Schema.Boolean.annotate({ + "description": "When true, request/response bodies are not forwarded to this destination — only metadata." + }), + "sampling_rate": Schema.Number.annotate({ + "description": "Sampling rate for events sent to this destination, between 0 and 1 (1 = 100%).", + "format": "double" + }).check(Schema.isFinite()), + "type": Schema.Literal("newrelic"), + "updated_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was last updated." }), + "workspace_id": Schema.String.annotate({ + "description": "ID of the workspace this destination belongs to.", + "format": "uuid" + }) +}) +export type ObservabilityOpikDestination = { + readonly "api_key_hashes": ReadonlyArray + readonly "config": { + readonly "apiKey": string + readonly "headers"?: {} + readonly "projectName": string + readonly "workspace": string } + readonly "created_at": string + readonly "enabled": boolean + readonly "filter_rules": ObservabilityFilterRulesConfig + readonly "id": string + readonly "name": string + readonly "privacy_mode": boolean + readonly "sampling_rate": number + readonly "type": "opik" + readonly "updated_at": string + readonly "workspace_id": string } -export const ChatStreamingResponseChunk = Schema.Struct({ - "data": Schema.Struct({ - "id": Schema.String, - "choices": Schema.Array(ChatStreamingChoice), - "created": Schema.Number.check(Schema.isFinite()), - "model": Schema.String, - "object": Schema.Literal("chat.completion.chunk"), - "system_fingerprint": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "error": Schema.optionalKey( - Schema.Struct({ "message": Schema.String, "code": Schema.Number.check(Schema.isFinite()) }) +export const ObservabilityOpikDestination = Schema.Struct({ + "api_key_hashes": Schema.Array(Schema.String).annotate({ + "description": + "Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) whose traffic is forwarded to this destination. `null` means all keys." + }), + "config": Schema.Struct({ + "apiKey": Schema.String.check(Schema.isMinLength(1)), + "headers": Schema.optionalKey( + Schema.Struct({}).annotate({ "description": "Custom HTTP headers to include in requests to this destination." }) ), - "usage": Schema.optionalKey(ChatGenerationTokenUsage) + "projectName": Schema.String.check(Schema.isMinLength(1)), + "workspace": Schema.String.check(Schema.isMinLength(1)) + }), + "created_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was created." }), + "enabled": Schema.Boolean.annotate({ "description": "Whether this destination is currently enabled." }), + "filter_rules": ObservabilityFilterRulesConfig, + "id": Schema.String.annotate({ "description": "Stable public identifier for this destination.", "format": "uuid" }), + "name": Schema.String.annotate({ "description": "Human-readable name for the destination." }), + "privacy_mode": Schema.Boolean.annotate({ + "description": "When true, request/response bodies are not forwarded to this destination — only metadata." + }), + "sampling_rate": Schema.Number.annotate({ + "description": "Sampling rate for events sent to this destination, between 0 and 1 (1 = 100%).", + "format": "double" + }).check(Schema.isFinite()), + "type": Schema.Literal("opik"), + "updated_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was last updated." }), + "workspace_id": Schema.String.annotate({ + "description": "ID of the workspace this destination belongs to.", + "format": "uuid" }) }) -export type ChatResponseChoice = { - readonly "finish_reason": __schema26 - readonly "index": number - readonly "message": AssistantMessage - readonly "logprobs"?: ChatMessageTokenLogprobs | null -} -export const ChatResponseChoice = Schema.Struct({ - "finish_reason": __schema26, - "index": Schema.Number.check(Schema.isFinite()), - "message": AssistantMessage, - "logprobs": Schema.optionalKey(Schema.Union([ChatMessageTokenLogprobs, Schema.Null])) -}) -export type Message = SystemMessage | UserMessage | DeveloperMessage | AssistantMessage | ToolResponseMessage -export const Message = Schema.Union([ - SystemMessage, - UserMessage, - DeveloperMessage, - AssistantMessage, - ToolResponseMessage -], { mode: "oneOf" }) -export type OpenAIResponsesNonStreamingResponse = { +export type ObservabilityOtelCollectorDestination = { + readonly "api_key_hashes": ReadonlyArray + readonly "config": { readonly "endpoint": string; readonly "headers"?: {} } + readonly "created_at": string + readonly "enabled": boolean + readonly "filter_rules": ObservabilityFilterRulesConfig readonly "id": string - readonly "object": "response" - readonly "created_at": number - readonly "model": string - readonly "status": OpenAIResponsesResponseStatus - readonly "completed_at": number - readonly "output": ReadonlyArray< - | OutputMessage - | OutputItemReasoning - | OutputItemFunctionCall - | OutputItemWebSearchCall - | OutputItemFileSearchCall - | OutputItemImageGenerationCall - > - readonly "user"?: string - readonly "output_text"?: string - readonly "prompt_cache_key"?: string - readonly "safety_identifier"?: string - readonly "error": ResponsesErrorField - readonly "incomplete_details": OpenAIResponsesIncompleteDetails - readonly "usage"?: OpenAIResponsesUsage - readonly "max_tool_calls"?: number - readonly "top_logprobs"?: number - readonly "max_output_tokens"?: number - readonly "temperature": number - readonly "top_p": number - readonly "presence_penalty": number - readonly "frequency_penalty": number - readonly "instructions": OpenAIResponsesInput - readonly "metadata": OpenResponsesRequestMetadata - readonly "tools": ReadonlyArray< - | { - readonly "type": "function" - readonly "name": string - readonly "description"?: string - readonly "strict"?: boolean - readonly "parameters": {} - } - | OpenResponsesWebSearchPreviewTool - | OpenResponsesWebSearchPreview20250311Tool - | OpenResponsesWebSearchTool - | OpenResponsesWebSearch20250826Tool - > - readonly "tool_choice": OpenAIResponsesToolChoice - readonly "parallel_tool_calls": boolean - readonly "prompt"?: OpenAIResponsesPrompt - readonly "background"?: boolean - readonly "previous_response_id"?: string - readonly "reasoning"?: OpenAIResponsesReasoningConfig - readonly "service_tier"?: OpenAIResponsesServiceTier - readonly "store"?: boolean - readonly "truncation"?: OpenAIResponsesTruncation - readonly "text"?: ResponseTextConfig + readonly "name": string + readonly "privacy_mode": boolean + readonly "sampling_rate": number + readonly "type": "otel-collector" + readonly "updated_at": string + readonly "workspace_id": string } -export const OpenAIResponsesNonStreamingResponse = Schema.Struct({ - "id": Schema.String, - "object": Schema.Literal("response"), - "created_at": Schema.Number.check(Schema.isFinite()), - "model": Schema.String, - "status": OpenAIResponsesResponseStatus, - "completed_at": Schema.Number.check(Schema.isFinite()), - "output": Schema.Array( - Schema.Union([ - OutputMessage, - OutputItemReasoning, - OutputItemFunctionCall, - OutputItemWebSearchCall, - OutputItemFileSearchCall, - OutputItemImageGenerationCall - ], { mode: "oneOf" }) - ), - "user": Schema.optionalKey(Schema.String), - "output_text": Schema.optionalKey(Schema.String), - "prompt_cache_key": Schema.optionalKey(Schema.String), - "safety_identifier": Schema.optionalKey(Schema.String), - "error": ResponsesErrorField, - "incomplete_details": OpenAIResponsesIncompleteDetails, - "usage": Schema.optionalKey(OpenAIResponsesUsage), - "max_tool_calls": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "top_logprobs": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "max_output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "temperature": Schema.Number.check(Schema.isFinite()), - "top_p": Schema.Number.check(Schema.isFinite()), - "presence_penalty": Schema.Number.check(Schema.isFinite()), - "frequency_penalty": Schema.Number.check(Schema.isFinite()), - "instructions": OpenAIResponsesInput, - "metadata": OpenResponsesRequestMetadata, - "tools": Schema.Array( - Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("function"), - "name": Schema.String, - "description": Schema.optionalKey(Schema.String), - "strict": Schema.optionalKey(Schema.Boolean), - "parameters": Schema.Struct({}) - }).annotate({ "description": "Function tool definition" }), - OpenResponsesWebSearchPreviewTool, - OpenResponsesWebSearchPreview20250311Tool, - OpenResponsesWebSearchTool, - OpenResponsesWebSearch20250826Tool - ], { mode: "oneOf" }) - ), - "tool_choice": OpenAIResponsesToolChoice, - "parallel_tool_calls": Schema.Boolean, - "prompt": Schema.optionalKey(OpenAIResponsesPrompt), - "background": Schema.optionalKey(Schema.Boolean), - "previous_response_id": Schema.optionalKey(Schema.String), - "reasoning": Schema.optionalKey(OpenAIResponsesReasoningConfig), - "service_tier": Schema.optionalKey(OpenAIResponsesServiceTier), - "store": Schema.optionalKey(Schema.Boolean), - "truncation": Schema.optionalKey(OpenAIResponsesTruncation), - "text": Schema.optionalKey(ResponseTextConfig) +export const ObservabilityOtelCollectorDestination = Schema.Struct({ + "api_key_hashes": Schema.Array(Schema.String).annotate({ + "description": + "Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) whose traffic is forwarded to this destination. `null` means all keys." + }), + "config": Schema.Struct({ + "endpoint": Schema.String, + "headers": Schema.optionalKey( + Schema.Struct({}).annotate({ + "description": + "Custom HTTP headers as a JSON object. For Axiom, use {\"Authorization\": \"Bearer xaat-xxx\", \"X-Axiom-Dataset\": \"your-dataset\"}" + }) + ) + }), + "created_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was created." }), + "enabled": Schema.Boolean.annotate({ "description": "Whether this destination is currently enabled." }), + "filter_rules": ObservabilityFilterRulesConfig, + "id": Schema.String.annotate({ "description": "Stable public identifier for this destination.", "format": "uuid" }), + "name": Schema.String.annotate({ "description": "Human-readable name for the destination." }), + "privacy_mode": Schema.Boolean.annotate({ + "description": "When true, request/response bodies are not forwarded to this destination — only metadata." + }), + "sampling_rate": Schema.Number.annotate({ + "description": "Sampling rate for events sent to this destination, between 0 and 1 (1 = 100%).", + "format": "double" + }).check(Schema.isFinite()), + "type": Schema.Literal("otel-collector"), + "updated_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was last updated." }), + "workspace_id": Schema.String.annotate({ + "description": "ID of the workspace this destination belongs to.", + "format": "uuid" + }) }) -export type OpenResponsesNonStreamingResponse = { +export type ObservabilityPosthogDestination = { + readonly "api_key_hashes": ReadonlyArray + readonly "config": { readonly "apiKey": string; readonly "endpoint"?: string; readonly "headers"?: {} } + readonly "created_at": string + readonly "enabled": boolean + readonly "filter_rules": ObservabilityFilterRulesConfig readonly "id": string - readonly "object": "response" - readonly "created_at": number - readonly "model": string - readonly "status": OpenAIResponsesResponseStatus - readonly "completed_at": number - readonly "output": ReadonlyArray< - { - readonly "id": string - readonly "role": "assistant" - readonly "type": "message" - readonly "status"?: "completed" | "incomplete" | "in_progress" - readonly "content": ReadonlyArray< - { - readonly "type": "output_text" - readonly "text": string - readonly "annotations"?: ReadonlyArray< - { - readonly "type": "file_citation" - readonly "file_id": string - readonly "filename": string - readonly "index": number - } | { - readonly "type": never - readonly "url": string - readonly "title": string - readonly "start_index": number - readonly "end_index": number - readonly "file_id": string - readonly "filename": string - readonly "index": number - } | { - readonly "type": never - readonly "file_id": string - readonly "index": number - readonly "filename": string - } | { - readonly "type": never - readonly "file_id": string - readonly "filename": string - readonly "index": number - readonly "url": string - readonly "title": string - readonly "start_index": number - readonly "end_index": number - } | { - readonly "type": "url_citation" - readonly "url": string - readonly "title": string - readonly "start_index": number - readonly "end_index": number - } | { - readonly "type": never - readonly "file_id": string - readonly "index": number - readonly "url": string - readonly "title": string - readonly "start_index": number - readonly "end_index": number + readonly "name": string + readonly "privacy_mode": boolean + readonly "sampling_rate": number + readonly "type": "posthog" + readonly "updated_at": string + readonly "workspace_id": string +} +export const ObservabilityPosthogDestination = Schema.Struct({ + "api_key_hashes": Schema.Array(Schema.String).annotate({ + "description": + "Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) whose traffic is forwarded to this destination. `null` means all keys." + }), + "config": Schema.Struct({ + "apiKey": Schema.String.check(Schema.isMinLength(1)), + "endpoint": Schema.optionalKey(Schema.String), + "headers": Schema.optionalKey( + Schema.Struct({}).annotate({ "description": "Custom HTTP headers to include in requests to this destination." }) + ) + }), + "created_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was created." }), + "enabled": Schema.Boolean.annotate({ "description": "Whether this destination is currently enabled." }), + "filter_rules": ObservabilityFilterRulesConfig, + "id": Schema.String.annotate({ "description": "Stable public identifier for this destination.", "format": "uuid" }), + "name": Schema.String.annotate({ "description": "Human-readable name for the destination." }), + "privacy_mode": Schema.Boolean.annotate({ + "description": "When true, request/response bodies are not forwarded to this destination — only metadata." + }), + "sampling_rate": Schema.Number.annotate({ + "description": "Sampling rate for events sent to this destination, between 0 and 1 (1 = 100%).", + "format": "double" + }).check(Schema.isFinite()), + "type": Schema.Literal("posthog"), + "updated_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was last updated." }), + "workspace_id": Schema.String.annotate({ + "description": "ID of the workspace this destination belongs to.", + "format": "uuid" + }) +}) +export type ObservabilityRampDestination = { + readonly "api_key_hashes": ReadonlyArray + readonly "config": { readonly "apiKey": string; readonly "baseUrl"?: string; readonly "headers"?: {} } + readonly "created_at": string + readonly "enabled": boolean + readonly "filter_rules": ObservabilityFilterRulesConfig + readonly "id": string + readonly "name": string + readonly "privacy_mode": boolean + readonly "sampling_rate": number + readonly "type": "ramp" + readonly "updated_at": string + readonly "workspace_id": string +} +export const ObservabilityRampDestination = Schema.Struct({ + "api_key_hashes": Schema.Array(Schema.String).annotate({ + "description": + "Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) whose traffic is forwarded to this destination. `null` means all keys." + }), + "config": Schema.Struct({ + "apiKey": Schema.String.annotate({ "description": "Generate this in your Ramp integration settings." }).check( + Schema.isMinLength(1) + ), + "baseUrl": Schema.optionalKey(Schema.String), + "headers": Schema.optionalKey( + Schema.Struct({}).annotate({ "description": "Custom HTTP headers to include in requests to Ramp." }) + ) + }), + "created_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was created." }), + "enabled": Schema.Boolean.annotate({ "description": "Whether this destination is currently enabled." }), + "filter_rules": ObservabilityFilterRulesConfig, + "id": Schema.String.annotate({ "description": "Stable public identifier for this destination.", "format": "uuid" }), + "name": Schema.String.annotate({ "description": "Human-readable name for the destination." }), + "privacy_mode": Schema.Boolean.annotate({ + "description": "When true, request/response bodies are not forwarded to this destination — only metadata." + }), + "sampling_rate": Schema.Number.annotate({ + "description": "Sampling rate for events sent to this destination, between 0 and 1 (1 = 100%).", + "format": "double" + }).check(Schema.isFinite()), + "type": Schema.Literal("ramp"), + "updated_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was last updated." }), + "workspace_id": Schema.String.annotate({ + "description": "ID of the workspace this destination belongs to.", + "format": "uuid" + }) +}) +export type ObservabilityS3Destination = { + readonly "api_key_hashes": ReadonlyArray + readonly "config": { + readonly "accessKeyId": string + readonly "bucketName": string + readonly "endpoint"?: string + readonly "headers"?: {} + readonly "pathTemplate"?: string + readonly "prefix"?: string + readonly "region"?: string + readonly "secretAccessKey": string + readonly "sessionToken"?: string + } + readonly "created_at": string + readonly "enabled": boolean + readonly "filter_rules": ObservabilityFilterRulesConfig + readonly "id": string + readonly "name": string + readonly "privacy_mode": boolean + readonly "sampling_rate": number + readonly "type": "s3" + readonly "updated_at": string + readonly "workspace_id": string +} +export const ObservabilityS3Destination = Schema.Struct({ + "api_key_hashes": Schema.Array(Schema.String).annotate({ + "description": + "Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) whose traffic is forwarded to this destination. `null` means all keys." + }), + "config": Schema.Struct({ + "accessKeyId": Schema.String.check(Schema.isMinLength(1)), + "bucketName": Schema.String.check(Schema.isMinLength(1)), + "endpoint": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Only for S3-compatible services like Cloudflare R2 (https://account-id.r2.cloudflarestorage.com) or MinIO. Leave blank for standard AWS S3.", + "format": "uri" + }) + ), + "headers": Schema.optionalKey( + Schema.Struct({}).annotate({ "description": "Custom HTTP headers to include in requests to this destination." }) + ), + "pathTemplate": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Template for S3 object path. The filename ({traceId}-{timestamp}.json) is automatically appended. Available variables: {prefix}, {date}, {year}, {month}, {day}, {apiKeyName}" + }) + ), + "prefix": Schema.optionalKey(Schema.String), + "region": Schema.optionalKey(Schema.String), + "secretAccessKey": Schema.String.check(Schema.isMinLength(1)), + "sessionToken": Schema.optionalKey(Schema.String) + }), + "created_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was created." }), + "enabled": Schema.Boolean.annotate({ "description": "Whether this destination is currently enabled." }), + "filter_rules": ObservabilityFilterRulesConfig, + "id": Schema.String.annotate({ "description": "Stable public identifier for this destination.", "format": "uuid" }), + "name": Schema.String.annotate({ "description": "Human-readable name for the destination." }), + "privacy_mode": Schema.Boolean.annotate({ + "description": "When true, request/response bodies are not forwarded to this destination — only metadata." + }), + "sampling_rate": Schema.Number.annotate({ + "description": "Sampling rate for events sent to this destination, between 0 and 1 (1 = 100%).", + "format": "double" + }).check(Schema.isFinite()), + "type": Schema.Literal("s3"), + "updated_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was last updated." }), + "workspace_id": Schema.String.annotate({ + "description": "ID of the workspace this destination belongs to.", + "format": "uuid" + }) +}) +export type ObservabilitySentryDestination = { + readonly "api_key_hashes": ReadonlyArray + readonly "config": { readonly "dsn": string; readonly "headers"?: {}; readonly "otlpEndpoint": string } + readonly "created_at": string + readonly "enabled": boolean + readonly "filter_rules": ObservabilityFilterRulesConfig + readonly "id": string + readonly "name": string + readonly "privacy_mode": boolean + readonly "sampling_rate": number + readonly "type": "sentry" + readonly "updated_at": string + readonly "workspace_id": string +} +export const ObservabilitySentryDestination = Schema.Struct({ + "api_key_hashes": Schema.Array(Schema.String).annotate({ + "description": + "Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) whose traffic is forwarded to this destination. `null` means all keys." + }), + "config": Schema.Struct({ + "dsn": Schema.String.check(Schema.isMinLength(1)).check( + Schema.isPattern(new RegExp("^https:\\/\\/([^:@]+)(?::[^@]*)?@([^/]+)(?:\\/[^/]+)*\\/(\\d+)\\/?$")) + ), + "headers": Schema.optionalKey( + Schema.Struct({}).annotate({ "description": "Custom HTTP headers to include in requests to this destination." }) + ), + "otlpEndpoint": Schema.String + }), + "created_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was created." }), + "enabled": Schema.Boolean.annotate({ "description": "Whether this destination is currently enabled." }), + "filter_rules": ObservabilityFilterRulesConfig, + "id": Schema.String.annotate({ "description": "Stable public identifier for this destination.", "format": "uuid" }), + "name": Schema.String.annotate({ "description": "Human-readable name for the destination." }), + "privacy_mode": Schema.Boolean.annotate({ + "description": "When true, request/response bodies are not forwarded to this destination — only metadata." + }), + "sampling_rate": Schema.Number.annotate({ + "description": "Sampling rate for events sent to this destination, between 0 and 1 (1 = 100%).", + "format": "double" + }).check(Schema.isFinite()), + "type": Schema.Literal("sentry"), + "updated_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was last updated." }), + "workspace_id": Schema.String.annotate({ + "description": "ID of the workspace this destination belongs to.", + "format": "uuid" + }) +}) +export type ObservabilitySnowflakeDestination = { + readonly "api_key_hashes": ReadonlyArray + readonly "config": { + readonly "account": string + readonly "database"?: string + readonly "headers"?: {} + readonly "schema"?: string + readonly "table"?: string + readonly "token": string + readonly "warehouse"?: string + } + readonly "created_at": string + readonly "enabled": boolean + readonly "filter_rules": ObservabilityFilterRulesConfig + readonly "id": string + readonly "name": string + readonly "privacy_mode": boolean + readonly "sampling_rate": number + readonly "type": "snowflake" + readonly "updated_at": string + readonly "workspace_id": string +} +export const ObservabilitySnowflakeDestination = Schema.Struct({ + "api_key_hashes": Schema.Array(Schema.String).annotate({ + "description": + "Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) whose traffic is forwarded to this destination. `null` means all keys." + }), + "config": Schema.Struct({ + "account": Schema.String.check(Schema.isMinLength(1)), + "database": Schema.optionalKey(Schema.String), + "headers": Schema.optionalKey( + Schema.Struct({}).annotate({ "description": "Custom HTTP headers to include in requests to this destination." }) + ), + "schema": Schema.optionalKey(Schema.String), + "table": Schema.optionalKey(Schema.String), + "token": Schema.String.check(Schema.isMinLength(1)), + "warehouse": Schema.optionalKey(Schema.String) + }), + "created_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was created." }), + "enabled": Schema.Boolean.annotate({ "description": "Whether this destination is currently enabled." }), + "filter_rules": ObservabilityFilterRulesConfig, + "id": Schema.String.annotate({ "description": "Stable public identifier for this destination.", "format": "uuid" }), + "name": Schema.String.annotate({ "description": "Human-readable name for the destination." }), + "privacy_mode": Schema.Boolean.annotate({ + "description": "When true, request/response bodies are not forwarded to this destination — only metadata." + }), + "sampling_rate": Schema.Number.annotate({ + "description": "Sampling rate for events sent to this destination, between 0 and 1 (1 = 100%).", + "format": "double" + }).check(Schema.isFinite()), + "type": Schema.Literal("snowflake"), + "updated_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was last updated." }), + "workspace_id": Schema.String.annotate({ + "description": "ID of the workspace this destination belongs to.", + "format": "uuid" + }) +}) +export type ObservabilityWeaveDestination = { + readonly "api_key_hashes": ReadonlyArray + readonly "config": { + readonly "apiKey": string + readonly "baseUrl"?: string + readonly "entity": string + readonly "headers"?: {} + readonly "project": string + } + readonly "created_at": string + readonly "enabled": boolean + readonly "filter_rules": ObservabilityFilterRulesConfig + readonly "id": string + readonly "name": string + readonly "privacy_mode": boolean + readonly "sampling_rate": number + readonly "type": "weave" + readonly "updated_at": string + readonly "workspace_id": string +} +export const ObservabilityWeaveDestination = Schema.Struct({ + "api_key_hashes": Schema.Array(Schema.String).annotate({ + "description": + "Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) whose traffic is forwarded to this destination. `null` means all keys." + }), + "config": Schema.Struct({ + "apiKey": Schema.String.check(Schema.isMinLength(1)), + "baseUrl": Schema.optionalKey(Schema.String), + "entity": Schema.String.check(Schema.isMinLength(1)), + "headers": Schema.optionalKey( + Schema.Struct({}).annotate({ "description": "Custom HTTP headers to include in requests to this destination." }) + ), + "project": Schema.String.check(Schema.isMinLength(1)) + }), + "created_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was created." }), + "enabled": Schema.Boolean.annotate({ "description": "Whether this destination is currently enabled." }), + "filter_rules": ObservabilityFilterRulesConfig, + "id": Schema.String.annotate({ "description": "Stable public identifier for this destination.", "format": "uuid" }), + "name": Schema.String.annotate({ "description": "Human-readable name for the destination." }), + "privacy_mode": Schema.Boolean.annotate({ + "description": "When true, request/response bodies are not forwarded to this destination — only metadata." + }), + "sampling_rate": Schema.Number.annotate({ + "description": "Sampling rate for events sent to this destination, between 0 and 1 (1 = 100%).", + "format": "double" + }).check(Schema.isFinite()), + "type": Schema.Literal("weave"), + "updated_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was last updated." }), + "workspace_id": Schema.String.annotate({ + "description": "ID of the workspace this destination belongs to.", + "format": "uuid" + }) +}) +export type ObservabilityWebhookDestination = { + readonly "api_key_hashes": ReadonlyArray + readonly "config": { readonly "headers"?: {}; readonly "method"?: "POST" | "PUT"; readonly "url": string } + readonly "created_at": string + readonly "enabled": boolean + readonly "filter_rules": ObservabilityFilterRulesConfig + readonly "id": string + readonly "name": string + readonly "privacy_mode": boolean + readonly "sampling_rate": number + readonly "type": "webhook" + readonly "updated_at": string + readonly "workspace_id": string +} +export const ObservabilityWebhookDestination = Schema.Struct({ + "api_key_hashes": Schema.Array(Schema.String).annotate({ + "description": + "Optional allowlist of OpenRouter API key hashes (`api_keys.hash`) whose traffic is forwarded to this destination. `null` means all keys." + }), + "config": Schema.Struct({ + "headers": Schema.optionalKey(Schema.Struct({})), + "method": Schema.optionalKey(Schema.Literals(["POST", "PUT"])), + "url": Schema.String + }), + "created_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was created." }), + "enabled": Schema.Boolean.annotate({ "description": "Whether this destination is currently enabled." }), + "filter_rules": ObservabilityFilterRulesConfig, + "id": Schema.String.annotate({ "description": "Stable public identifier for this destination.", "format": "uuid" }), + "name": Schema.String.annotate({ "description": "Human-readable name for the destination." }), + "privacy_mode": Schema.Boolean.annotate({ + "description": "When true, request/response bodies are not forwarded to this destination — only metadata." + }), + "sampling_rate": Schema.Number.annotate({ + "description": "Sampling rate for events sent to this destination, between 0 and 1 (1 = 100%).", + "format": "double" + }).check(Schema.isFinite()), + "type": Schema.Literal("webhook"), + "updated_at": Schema.String.annotate({ "description": "ISO timestamp of when the destination was last updated." }), + "workspace_id": Schema.String.annotate({ + "description": "ID of the workspace this destination belongs to.", + "format": "uuid" + }) +}) +export type OpenResponsesLogProbs = { + readonly "bytes"?: ReadonlyArray + readonly "logprob": number + readonly "token": string + readonly "top_logprobs"?: ReadonlyArray +} +export const OpenResponsesLogProbs = Schema.Struct({ + "bytes": Schema.optionalKey(Schema.Array(Schema.Number.check(Schema.isInt()))), + "logprob": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "token": Schema.String, + "top_logprobs": Schema.optionalKey(Schema.Array(OpenResponsesTopLogprobs)) +}).annotate({ "description": "Log probability information for a token" }) +export type ModelArchitecture = { + readonly "input_modalities": ReadonlyArray + readonly "instruct_type"?: + | "none" + | "airoboros" + | "alpaca" + | "alpaca-modif" + | "chatml" + | "claude" + | "code-llama" + | "gemma" + | "llama2" + | "llama3" + | "mistral" + | "nemotron" + | "neural" + | "openchat" + | "phi3" + | "rwkv" + | "vicuna" + | "zephyr" + | "deepseek-r1" + | "deepseek-v3.1" + | "qwq" + | "qwen3" + | null + readonly "modality": string + readonly "output_modalities": ReadonlyArray + readonly "tokenizer"?: ModelGroup +} +export const ModelArchitecture = Schema.Struct({ + "input_modalities": Schema.Array(InputModality).annotate({ "description": "Supported input modalities" }), + "instruct_type": Schema.optionalKey( + Schema.Union([ + Schema.Literal("none"), + Schema.Literal("airoboros"), + Schema.Literal("alpaca"), + Schema.Literal("alpaca-modif"), + Schema.Literal("chatml"), + Schema.Literal("claude"), + Schema.Literal("code-llama"), + Schema.Literal("gemma"), + Schema.Literal("llama2"), + Schema.Literal("llama3"), + Schema.Literal("mistral"), + Schema.Literal("nemotron"), + Schema.Literal("neural"), + Schema.Literal("openchat"), + Schema.Literal("phi3"), + Schema.Literal("rwkv"), + Schema.Literal("vicuna"), + Schema.Literal("zephyr"), + Schema.Literal("deepseek-r1"), + Schema.Literal("deepseek-v3.1"), + Schema.Literal("qwq"), + Schema.Literal("qwen3"), + Schema.Null + ]).annotate({ "description": "Instruction format type" }) + ), + "modality": Schema.String.annotate({ "description": "Primary modality of the model" }), + "output_modalities": Schema.Array(OutputModality).annotate({ "description": "Supported output modalities" }), + "tokenizer": Schema.optionalKey(ModelGroup) +}).annotate({ "description": "Model architecture information" }) +export type PayloadTooLargeResponse = { + readonly "error": PayloadTooLargeResponseErrorData + readonly "openrouter_metadata"?: {} + readonly "user_id"?: string +} +export const PayloadTooLargeResponse = Schema.Struct({ + "error": PayloadTooLargeResponseErrorData, + "openrouter_metadata": Schema.optionalKey(Schema.Struct({})), + "user_id": Schema.optionalKey(Schema.String) +}).annotate({ "description": "Payload Too Large - Request payload exceeds size limits" }) +export type PaymentRequiredResponse = { + readonly "error": PaymentRequiredResponseErrorData + readonly "openrouter_metadata"?: {} + readonly "user_id"?: string +} +export const PaymentRequiredResponse = Schema.Struct({ + "error": PaymentRequiredResponseErrorData, + "openrouter_metadata": Schema.optionalKey(Schema.Struct({})), + "user_id": Schema.optionalKey(Schema.String) +}).annotate({ "description": "Payment Required - Insufficient credits or quota to complete request" }) +export type PDFParserOptions = { readonly "engine"?: PDFParserEngine } +export const PDFParserOptions = Schema.Struct({ "engine": Schema.optionalKey(PDFParserEngine) }).annotate({ + "description": "Options for PDF parsing." +}) +export type PreferredMaxLatency = number | PercentileLatencyCutoffs | unknown +export const PreferredMaxLatency = Schema.Union([ + Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + PercentileLatencyCutoffs, + Schema.Unknown +]).annotate({ + "description": + "Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold." +}) +export type PreferredMinThroughput = number | PercentileThroughputCutoffs | unknown +export const PreferredMinThroughput = Schema.Union([ + Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + PercentileThroughputCutoffs, + Schema.Unknown +]).annotate({ + "description": + "Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold." +}) +export type PipelineStage = { + readonly "cost_usd"?: number + readonly "data"?: {} + readonly "guardrail_id"?: string + readonly "guardrail_scope"?: string + readonly "name": string + readonly "summary"?: string + readonly "type": PipelineStageType +} +export const PipelineStage = Schema.Struct({ + "cost_usd": Schema.optionalKey(Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite())), + "data": Schema.optionalKey(Schema.Struct({})), + "guardrail_id": Schema.optionalKey(Schema.String), + "guardrail_scope": Schema.optionalKey(Schema.String), + "name": Schema.String, + "summary": Schema.optionalKey(Schema.String), + "type": PipelineStageType +}) +export type PresetWithDesignatedVersion = { + readonly "created_at": string + readonly "creator_user_id": string + readonly "description": string + readonly "designated_version": PresetDesignatedVersion + readonly "designated_version_id": string + readonly "id": string + readonly "name": string + readonly "slug": string + readonly "status": "active" | "disabled" | "archived" + readonly "status_updated_at": string + readonly "updated_at": string + readonly "workspace_id": string +} +export const PresetWithDesignatedVersion = Schema.Struct({ + "created_at": Schema.String, + "creator_user_id": Schema.String, + "description": Schema.String, + "designated_version": PresetDesignatedVersion, + "designated_version_id": Schema.String, + "id": Schema.String, + "name": Schema.String, + "slug": Schema.String, + "status": Schema.Literals(["active", "disabled", "archived"]), + "status_updated_at": Schema.String, + "updated_at": Schema.String, + "workspace_id": Schema.String +}).annotate({ "description": "A preset with its currently designated version." }) +export type PublicEndpoint = { + readonly "context_length": number + readonly "latency_last_30m": PercentileStats + readonly "max_completion_tokens": number + readonly "max_prompt_tokens": number + readonly "model_id": string + readonly "model_name": string + readonly "name": string + readonly "pricing": { + readonly "audio"?: string + readonly "audio_output"?: string + readonly "completion": string + readonly "discount"?: number + readonly "image"?: string + readonly "image_output"?: string + readonly "image_token"?: string + readonly "input_audio_cache"?: string + readonly "input_cache_read"?: string + readonly "input_cache_write"?: string + readonly "internal_reasoning"?: string + readonly "prompt": string + readonly "request"?: string + readonly "web_search"?: string + } + readonly "provider_name": ProviderName + readonly "quantization": "int4" | "int8" | "fp4" | "fp6" | "fp8" | "fp16" | "bf16" | "fp32" | "unknown" + readonly "status"?: EndpointStatus + readonly "supported_parameters": ReadonlyArray + readonly "supports_implicit_caching": boolean + readonly "tag": string + readonly "throughput_last_30m": { + readonly "p50": number + readonly "p75": number + readonly "p90": number + readonly "p99": number + } + readonly "uptime_last_1d": number + readonly "uptime_last_30m": number + readonly "uptime_last_5m": number +} +export const PublicEndpoint = Schema.Struct({ + "context_length": Schema.Number.check(Schema.isInt()), + "latency_last_30m": PercentileStats, + "max_completion_tokens": Schema.Number.check(Schema.isInt()), + "max_prompt_tokens": Schema.Number.check(Schema.isInt()), + "model_id": Schema.String.annotate({ "description": "The unique identifier for the model (permaslug)" }), + "model_name": Schema.String, + "name": Schema.String, + "pricing": Schema.Struct({ + "audio": Schema.optionalKey( + Schema.String.annotate({ "description": "A number or string value representing a large number" }) + ), + "audio_output": Schema.optionalKey( + Schema.String.annotate({ "description": "A number or string value representing a large number" }) + ), + "completion": Schema.String.annotate({ "description": "A number or string value representing a large number" }), + "discount": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), + "image": Schema.optionalKey( + Schema.String.annotate({ "description": "A number or string value representing a large number" }) + ), + "image_output": Schema.optionalKey( + Schema.String.annotate({ "description": "A number or string value representing a large number" }) + ), + "image_token": Schema.optionalKey( + Schema.String.annotate({ "description": "A number or string value representing a large number" }) + ), + "input_audio_cache": Schema.optionalKey( + Schema.String.annotate({ "description": "A number or string value representing a large number" }) + ), + "input_cache_read": Schema.optionalKey( + Schema.String.annotate({ "description": "A number or string value representing a large number" }) + ), + "input_cache_write": Schema.optionalKey( + Schema.String.annotate({ "description": "A number or string value representing a large number" }) + ), + "internal_reasoning": Schema.optionalKey( + Schema.String.annotate({ "description": "A number or string value representing a large number" }) + ), + "prompt": Schema.String.annotate({ "description": "A number or string value representing a large number" }), + "request": Schema.optionalKey( + Schema.String.annotate({ "description": "A number or string value representing a large number" }) + ), + "web_search": Schema.optionalKey( + Schema.String.annotate({ "description": "A number or string value representing a large number" }) + ) + }), + "provider_name": ProviderName, + "quantization": Schema.Literals(["int4", "int8", "fp4", "fp6", "fp8", "fp16", "bf16", "fp32", "unknown"]), + "status": Schema.optionalKey(EndpointStatus), + "supported_parameters": Schema.Array(Parameter), + "supports_implicit_caching": Schema.Boolean, + "tag": Schema.String, + "throughput_last_30m": Schema.Struct({ + "p50": Schema.Number.annotate({ "description": "Median (50th percentile)", "format": "double" }).check( + Schema.isFinite() + ), + "p75": Schema.Number.annotate({ "description": "75th percentile", "format": "double" }).check(Schema.isFinite()), + "p90": Schema.Number.annotate({ "description": "90th percentile", "format": "double" }).check(Schema.isFinite()), + "p99": Schema.Number.annotate({ "description": "99th percentile", "format": "double" }).check(Schema.isFinite()) + }).annotate({ + "description": + "Throughput percentiles in tokens per second over the last 30 minutes. Throughput measures output token generation speed. Only visible when authenticated with an API key or cookie; returns null for unauthenticated requests." + }), + "uptime_last_1d": Schema.Number.annotate({ + "description": + "Uptime percentage over the last 1 day, calculated as successful requests / (successful + error requests) * 100. Rate-limited requests are excluded. Returns null if insufficient data.", + "format": "double" + }).check(Schema.isFinite()), + "uptime_last_30m": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "uptime_last_5m": Schema.Number.annotate({ + "description": + "Uptime percentage over the last 5 minutes, calculated as successful requests / (successful + error requests) * 100. Rate-limited requests are excluded. Returns null if insufficient data.", + "format": "double" + }).check(Schema.isFinite()) +}).annotate({ "description": "Information about a specific model endpoint" }) +export type SpeechRequest = { + readonly "input": string + readonly "model": string + readonly "provider"?: { readonly "options"?: ProviderOptions } + readonly "response_format"?: "mp3" | "pcm" + readonly "speed"?: number + readonly "voice": string +} +export const SpeechRequest = Schema.Struct({ + "input": Schema.String.annotate({ "description": "Text to synthesize" }), + "model": Schema.String.annotate({ "description": "TTS model identifier" }), + "provider": Schema.optionalKey( + Schema.Struct({ "options": Schema.optionalKey(ProviderOptions) }).annotate({ + "description": "Provider-specific passthrough configuration" + }) + ), + "response_format": Schema.optionalKey( + Schema.Literals(["mp3", "pcm"]).annotate({ "description": "Audio output format" }) + ), + "speed": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "Playback speed multiplier. Only used by models that support it (e.g. OpenAI TTS). Ignored by other providers.", + "format": "double" + }).check(Schema.isFinite()) + ), + "voice": Schema.String.annotate({ "description": "Voice identifier (provider-specific)." }) +}).annotate({ "description": "Text-to-speech request input" }) +export type ProviderOverloadedResponse = { + readonly "error": ProviderOverloadedResponseErrorData + readonly "openrouter_metadata"?: {} + readonly "user_id"?: string +} +export const ProviderOverloadedResponse = Schema.Struct({ + "error": ProviderOverloadedResponseErrorData, + "openrouter_metadata": Schema.optionalKey(Schema.Struct({})), + "user_id": Schema.optionalKey(Schema.String) +}).annotate({ "description": "Provider Overloaded - Provider is temporarily overloaded" }) +export type GenerationResponse = { + readonly "data": { + readonly "api_type": "completions" | "embeddings" | "rerank" | "tts" | "stt" | "video" | null + readonly "app_id": number + readonly "cache_discount": number + readonly "cancelled": boolean + readonly "created_at": string + readonly "external_user": string + readonly "finish_reason": string + readonly "generation_time": number + readonly "http_referer": string + readonly "id": string + readonly "is_byok": boolean + readonly "latency": number + readonly "model": string + readonly "moderation_latency": number + readonly "native_finish_reason": string + readonly "native_tokens_cached": number + readonly "native_tokens_completion": number + readonly "native_tokens_completion_images": number + readonly "native_tokens_prompt": number + readonly "native_tokens_reasoning": number + readonly "num_fetches": number + readonly "num_input_audio_prompt": number + readonly "num_media_completion": number + readonly "num_media_prompt": number + readonly "num_search_results": number + readonly "origin": string + readonly "provider_name": string + readonly "provider_responses": ReadonlyArray + readonly "request_id"?: string + readonly "response_cache_source_id"?: string + readonly "router": string + readonly "service_tier": string + readonly "session_id"?: string + readonly "streamed": boolean + readonly "tokens_completion": number + readonly "tokens_prompt": number + readonly "total_cost": number + readonly "upstream_id": string + readonly "upstream_inference_cost": number + readonly "usage": number + readonly "user_agent": string + readonly "web_search_engine": string + } +} +export const GenerationResponse = Schema.Struct({ + "data": Schema.Struct({ + "api_type": Schema.Union([ + Schema.Literal("completions"), + Schema.Literal("embeddings"), + Schema.Literal("rerank"), + Schema.Literal("tts"), + Schema.Literal("stt"), + Schema.Literal("video"), + Schema.Null + ]).annotate({ "description": "Type of API used for the generation" }), + "app_id": Schema.Number.annotate({ "description": "ID of the app that made the request" }).check(Schema.isInt()), + "cache_discount": Schema.Number.annotate({ "description": "Discount applied due to caching", "format": "double" }) + .check(Schema.isFinite()), + "cancelled": Schema.Boolean.annotate({ "description": "Whether the generation was cancelled" }), + "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the generation was created" }), + "external_user": Schema.String.annotate({ "description": "External user identifier" }), + "finish_reason": Schema.String.annotate({ "description": "Reason the generation finished" }), + "generation_time": Schema.Number.annotate({ + "description": "Time taken for generation in milliseconds", + "format": "double" + }).check(Schema.isFinite()), + "http_referer": Schema.String.annotate({ "description": "Referer header from the request" }), + "id": Schema.String.annotate({ "description": "Unique identifier for the generation" }), + "is_byok": Schema.Boolean.annotate({ "description": "Whether this used bring-your-own-key" }), + "latency": Schema.Number.annotate({ "description": "Total latency in milliseconds", "format": "double" }).check( + Schema.isFinite() + ), + "model": Schema.String.annotate({ "description": "Model used for the generation" }), + "moderation_latency": Schema.Number.annotate({ + "description": "Moderation latency in milliseconds", + "format": "double" + }).check(Schema.isFinite()), + "native_finish_reason": Schema.String.annotate({ "description": "Native finish reason as reported by provider" }), + "native_tokens_cached": Schema.Number.annotate({ "description": "Native cached tokens as reported by provider" }) + .check(Schema.isInt()), + "native_tokens_completion": Schema.Number.annotate({ + "description": "Native completion tokens as reported by provider" + }).check(Schema.isInt()), + "native_tokens_completion_images": Schema.Number.annotate({ + "description": "Native completion image tokens as reported by provider" + }).check(Schema.isInt()), + "native_tokens_prompt": Schema.Number.annotate({ "description": "Native prompt tokens as reported by provider" }) + .check(Schema.isInt()), + "native_tokens_reasoning": Schema.Number.annotate({ + "description": "Native reasoning tokens as reported by provider" + }).check(Schema.isInt()), + "num_fetches": Schema.Number.annotate({ "description": "Number of web fetches performed" }).check(Schema.isInt()), + "num_input_audio_prompt": Schema.Number.annotate({ "description": "Number of audio inputs in the prompt" }).check( + Schema.isInt() + ), + "num_media_completion": Schema.Number.annotate({ "description": "Number of media items in the completion" }).check( + Schema.isInt() + ), + "num_media_prompt": Schema.Number.annotate({ "description": "Number of media items in the prompt" }).check( + Schema.isInt() + ), + "num_search_results": Schema.Number.annotate({ "description": "Number of search results included" }).check( + Schema.isInt() + ), + "origin": Schema.String.annotate({ "description": "Origin URL of the request" }), + "provider_name": Schema.String.annotate({ "description": "Name of the provider that served the request" }), + "provider_responses": Schema.Array(ProviderResponse).annotate({ + "description": "List of provider responses for this generation, including fallback attempts" + }), + "request_id": Schema.optionalKey( + Schema.String.annotate({ "description": "Unique identifier grouping all generations from a single API request" }) + ), + "response_cache_source_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "If this generation was served from response cache, contains the original generation ID. Null otherwise." + }) + ), + "router": Schema.String.annotate({ "description": "Router used for the request (e.g., openrouter/auto)" }), + "service_tier": Schema.String.annotate({ + "description": + "Service tier the upstream provider reported running this request on, or null if it did not report one." + }), + "session_id": Schema.optionalKey( + Schema.String.annotate({ "description": "Session identifier grouping multiple generations in the same session" }) + ), + "streamed": Schema.Boolean.annotate({ "description": "Whether the response was streamed" }), + "tokens_completion": Schema.Number.annotate({ "description": "Number of tokens in the completion" }).check( + Schema.isInt() + ), + "tokens_prompt": Schema.Number.annotate({ "description": "Number of tokens in the prompt" }).check(Schema.isInt()), + "total_cost": Schema.Number.annotate({ "description": "Total cost of the generation in USD", "format": "double" }) + .check(Schema.isFinite()), + "upstream_id": Schema.String.annotate({ "description": "Upstream provider's identifier for this generation" }), + "upstream_inference_cost": Schema.Number.annotate({ + "description": "Cost charged by the upstream provider", + "format": "double" + }).check(Schema.isFinite()), + "usage": Schema.Number.annotate({ "description": "Usage amount in USD", "format": "double" }).check( + Schema.isFinite() + ), + "user_agent": Schema.String.annotate({ "description": "User-Agent header from the request" }), + "web_search_engine": Schema.String.annotate({ + "description": "The resolved web search engine used for this generation (e.g. exa, firecrawl, parallel)" + }) + }).annotate({ "description": "Generation data" }) +}).annotate({ "description": "Generation response" }) +export type ReasoningDetailEncrypted = { + readonly "data": string + readonly "format"?: ReasoningFormat + readonly "id"?: string + readonly "index"?: number + readonly "type": "reasoning.encrypted" +} +export const ReasoningDetailEncrypted = Schema.Struct({ + "data": Schema.String, + "format": Schema.optionalKey(ReasoningFormat), + "id": Schema.optionalKey(Schema.String), + "index": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "type": Schema.Literal("reasoning.encrypted") +}).annotate({ "description": "Reasoning detail encrypted schema" }) +export type ReasoningDetailSummary = { + readonly "format"?: ReasoningFormat + readonly "id"?: string + readonly "index"?: number + readonly "summary": string + readonly "type": "reasoning.summary" +} +export const ReasoningDetailSummary = Schema.Struct({ + "format": Schema.optionalKey(ReasoningFormat), + "id": Schema.optionalKey(Schema.String), + "index": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "summary": Schema.String, + "type": Schema.Literal("reasoning.summary") +}).annotate({ "description": "Reasoning detail summary schema" }) +export type ReasoningDetailText = { + readonly "format"?: ReasoningFormat + readonly "id"?: string + readonly "index"?: number + readonly "signature"?: string + readonly "text"?: string + readonly "type": "reasoning.text" +} +export const ReasoningDetailText = Schema.Struct({ + "format": Schema.optionalKey(ReasoningFormat), + "id": Schema.optionalKey(Schema.String), + "index": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "signature": Schema.optionalKey(Schema.String), + "text": Schema.optionalKey(Schema.String), + "type": Schema.Literal("reasoning.text") +}).annotate({ "description": "Reasoning detail text schema" }) +export type OutputReasoningItem = { + readonly "content"?: ReadonlyArray<{ readonly "text": string; readonly "type": "reasoning_text" }> + readonly "encrypted_content"?: string + readonly "id": string + readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "summary": ReadonlyArray + readonly "type": "reasoning" + readonly "format"?: ReasoningFormat + readonly "signature"?: string +} +export const OutputReasoningItem = Schema.Struct({ + "content": Schema.optionalKey( + Schema.Array(Schema.Struct({ "text": Schema.String, "type": Schema.Literal("reasoning_text") })) + ), + "encrypted_content": Schema.optionalKey(Schema.String), + "id": Schema.String, + "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])), + "summary": Schema.Array(ReasoningSummaryText), + "type": Schema.Literal("reasoning"), + "format": Schema.optionalKey(ReasoningFormat), + "signature": Schema.optionalKey( + Schema.String.annotate({ "description": "A signature for the reasoning content, used for verification" }) + ) +}).annotate({ "description": "An output item containing reasoning" }) +export type ReasoningItem = { + readonly "content"?: ReadonlyArray<{ readonly "text": string; readonly "type": "reasoning_text" }> + readonly "encrypted_content"?: string + readonly "id": string + readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "summary": ReadonlyArray + readonly "type": "reasoning" + readonly "format"?: ReasoningFormat + readonly "signature"?: string +} +export const ReasoningItem = Schema.Struct({ + "content": Schema.optionalKey( + Schema.Array(Schema.Struct({ "text": Schema.String, "type": Schema.Literal("reasoning_text") })) + ), + "encrypted_content": Schema.optionalKey(Schema.String), + "id": Schema.String, + "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])), + "summary": Schema.Array(ReasoningSummaryText), + "type": Schema.Literal("reasoning"), + "format": Schema.optionalKey(ReasoningFormat), + "signature": Schema.optionalKey(Schema.String) +}).annotate({ "description": "Reasoning output item with signature and format extensions" }) +export type ReasoningSummaryPartAddedEvent = { + readonly "item_id": string + readonly "output_index": number + readonly "part": ReasoningSummaryText + readonly "sequence_number": number + readonly "summary_index": number + readonly "type": "response.reasoning_summary_part.added" +} +export const ReasoningSummaryPartAddedEvent = Schema.Struct({ + "item_id": Schema.String, + "output_index": Schema.Number.check(Schema.isInt()), + "part": ReasoningSummaryText, + "sequence_number": Schema.Number.check(Schema.isInt()), + "summary_index": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.reasoning_summary_part.added") +}).annotate({ "description": "Event emitted when a reasoning summary part is added" }) +export type ReasoningSummaryPartDoneEvent = { + readonly "item_id": string + readonly "output_index": number + readonly "part": ReasoningSummaryText + readonly "sequence_number": number + readonly "summary_index": number + readonly "type": "response.reasoning_summary_part.done" +} +export const ReasoningSummaryPartDoneEvent = Schema.Struct({ + "item_id": Schema.String, + "output_index": Schema.Number.check(Schema.isInt()), + "part": ReasoningSummaryText, + "sequence_number": Schema.Number.check(Schema.isInt()), + "summary_index": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.reasoning_summary_part.done") +}).annotate({ "description": "Event emitted when a reasoning summary part is complete" }) +export type BaseReasoningConfig = { + readonly "effort"?: ReasoningEffort + readonly "summary"?: ReasoningSummaryVerbosity +} +export const BaseReasoningConfig = Schema.Struct({ + "effort": Schema.optionalKey(ReasoningEffort), + "summary": Schema.optionalKey(ReasoningSummaryVerbosity) +}) +export type ReasoningConfig = { + readonly "effort"?: ReasoningEffort + readonly "summary"?: ReasoningSummaryVerbosity + readonly "enabled"?: boolean + readonly "max_tokens"?: number +} +export const ReasoningConfig = Schema.Struct({ + "effort": Schema.optionalKey(ReasoningEffort), + "summary": Schema.optionalKey(ReasoningSummaryVerbosity), + "enabled": Schema.optionalKey(Schema.Boolean), + "max_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())) +}).annotate({ "description": "Configuration for reasoning mode in the response" }) +export type OutputItemReasoning = { + readonly "content"?: ReadonlyArray + readonly "encrypted_content"?: string + readonly "id": string + readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "summary": ReadonlyArray + readonly "type": "reasoning" +} +export const OutputItemReasoning = Schema.Struct({ + "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "encrypted_content": Schema.optionalKey(Schema.String), + "id": Schema.String, + "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])), + "summary": Schema.Array(ReasoningSummaryText), + "type": Schema.Literal("reasoning") +}) +export type RequestTimeoutResponse = { + readonly "error": RequestTimeoutResponseErrorData + readonly "openrouter_metadata"?: {} + readonly "user_id"?: string +} +export const RequestTimeoutResponse = Schema.Struct({ + "error": RequestTimeoutResponseErrorData, + "openrouter_metadata": Schema.optionalKey(Schema.Struct({})), + "user_id": Schema.optionalKey(Schema.String) +}).annotate({ "description": "Request Timeout - Operation exceeded time limit" }) +export type ChatSearchModelsServerTool = { + readonly "parameters"?: SearchModelsServerToolConfig + readonly "type": "openrouter:experimental__search_models" +} +export const ChatSearchModelsServerTool = Schema.Struct({ + "parameters": Schema.optionalKey(SearchModelsServerToolConfig), + "type": Schema.Literal("openrouter:experimental__search_models") +}).annotate({ + "description": "OpenRouter built-in server tool: searches and filters AI models available on OpenRouter" +}) +export type ServiceUnavailableResponse = { + readonly "error": ServiceUnavailableResponseErrorData + readonly "openrouter_metadata"?: {} + readonly "user_id"?: string +} +export const ServiceUnavailableResponse = Schema.Struct({ + "error": ServiceUnavailableResponseErrorData, + "openrouter_metadata": Schema.optionalKey(Schema.Struct({})), + "user_id": Schema.optionalKey(Schema.String) +}).annotate({ "description": "Service Unavailable - Service temporarily unavailable" }) +export type StopServerToolsWhenCondition = + | StopServerToolsWhenStepCountIs + | StopServerToolsWhenHasToolCall + | StopServerToolsWhenMaxTokensUsed + | StopServerToolsWhenMaxCost + | StopServerToolsWhenFinishReasonIs +export const StopServerToolsWhenCondition = Schema.Union([ + StopServerToolsWhenStepCountIs, + StopServerToolsWhenHasToolCall, + StopServerToolsWhenMaxTokensUsed, + StopServerToolsWhenMaxCost, + StopServerToolsWhenFinishReasonIs +], { mode: "oneOf" }).annotate({ + "description": "A single condition that, when met, halts the server-tool agent loop." +}) +export type STTRequest = { + readonly "input_audio": STTInputAudio + readonly "language"?: string + readonly "model": string + readonly "provider"?: { readonly "options"?: ProviderOptions } + readonly "temperature"?: number +} +export const STTRequest = Schema.Struct({ + "input_audio": STTInputAudio, + "language": Schema.optionalKey( + Schema.String.annotate({ + "description": "ISO-639-1 language code (e.g., \"en\", \"ja\"). Auto-detected if omitted." + }) + ), + "model": Schema.String.annotate({ "description": "STT model identifier" }), + "provider": Schema.optionalKey( + Schema.Struct({ "options": Schema.optionalKey(ProviderOptions) }).annotate({ + "description": "Provider-specific passthrough configuration" + }) + ), + "temperature": Schema.optionalKey( + Schema.Number.annotate({ "description": "Sampling temperature for transcription", "format": "double" }).check( + Schema.isFinite() + ) + ) +}).annotate({ + "description": "Speech-to-text request input. Accepts a JSON body with input_audio containing base64-encoded audio." +}) +export type STTResponse = { readonly "text": string; readonly "usage"?: STTUsage } +export const STTResponse = Schema.Struct({ + "text": Schema.String.annotate({ "description": "The transcribed text" }), + "usage": Schema.optionalKey(STTUsage) +}).annotate({ "description": "STT response containing transcribed text and optional usage statistics" }) +export type FunctionCallItem = { + readonly "arguments": string + readonly "call_id": string + readonly "id": string + readonly "name": string + readonly "namespace"?: string + readonly "status"?: ToolCallStatus + readonly "type": "function_call" +} +export const FunctionCallItem = Schema.Struct({ + "arguments": Schema.String, + "call_id": Schema.String, + "id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ), + "status": Schema.optionalKey(ToolCallStatus), + "type": Schema.Literal("function_call") +}).annotate({ "description": "A function call initiated by the model" }) +export type LocalShellCallItem = { + readonly "action": { + readonly "command": ReadonlyArray + readonly "env": {} + readonly "timeout_ms"?: number + readonly "type": "exec" + readonly "user"?: string + readonly "working_directory"?: string + } + readonly "call_id": string + readonly "id": string + readonly "status": ToolCallStatus + readonly "type": "local_shell_call" +} +export const LocalShellCallItem = Schema.Struct({ + "action": Schema.Struct({ + "command": Schema.Array(Schema.String), + "env": Schema.Struct({}), + "timeout_ms": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "type": Schema.Literal("exec"), + "user": Schema.optionalKey(Schema.String), + "working_directory": Schema.optionalKey(Schema.String) + }), + "call_id": Schema.String, + "id": Schema.String, + "status": ToolCallStatus, + "type": Schema.Literal("local_shell_call") +}).annotate({ "description": "A local shell command execution call" }) +export type OpenAIResponseFunctionToolCall = { + readonly "arguments": string + readonly "call_id": string + readonly "id"?: string + readonly "name": string + readonly "namespace"?: string + readonly "status"?: ToolCallStatus + readonly "type": "function_call" +} +export const OpenAIResponseFunctionToolCall = Schema.Struct({ + "arguments": Schema.String, + "call_id": Schema.String, + "id": Schema.optionalKey(Schema.String), + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ), + "status": Schema.optionalKey(ToolCallStatus), + "type": Schema.Literal("function_call") +}) +export type OutputBashServerToolItem = { + readonly "command"?: string + readonly "exitCode"?: number + readonly "id"?: string + readonly "status": ToolCallStatus + readonly "stderr"?: string + readonly "stdout"?: string + readonly "type": "openrouter:bash" +} +export const OutputBashServerToolItem = Schema.Struct({ + "command": Schema.optionalKey(Schema.String), + "exitCode": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "id": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "stderr": Schema.optionalKey(Schema.String), + "stdout": Schema.optionalKey(Schema.String), + "type": Schema.Literal("openrouter:bash") +}).annotate({ "description": "An openrouter:bash server tool output item" }) +export type OutputBrowserUseServerToolItem = { + readonly "action"?: string + readonly "id"?: string + readonly "screenshotB64"?: string + readonly "status": ToolCallStatus + readonly "type": "openrouter:browser_use" +} +export const OutputBrowserUseServerToolItem = Schema.Struct({ + "action": Schema.optionalKey(Schema.String), + "id": Schema.optionalKey(Schema.String), + "screenshotB64": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "type": Schema.Literal("openrouter:browser_use") +}).annotate({ "description": "An openrouter:browser_use server tool output item" }) +export type OutputCodeInterpreterCallItem = { + readonly "code": string + readonly "container_id": string + readonly "id": string + readonly "outputs": ReadonlyArray< + { readonly "type": "image"; readonly "url": string } | { readonly "logs": string; readonly "type": "logs" } + > + readonly "status": ToolCallStatus + readonly "type": "code_interpreter_call" +} +export const OutputCodeInterpreterCallItem = Schema.Struct({ + "code": Schema.String, + "container_id": Schema.String, + "id": Schema.String, + "outputs": Schema.Array( + Schema.Union([ + Schema.Struct({ "type": Schema.Literal("image"), "url": Schema.String }), + Schema.Struct({ "logs": Schema.String, "type": Schema.Literal("logs") }) + ]) + ), + "status": ToolCallStatus, + "type": Schema.Literal("code_interpreter_call") +}).annotate({ "description": "A code interpreter execution call with outputs" }) +export type OutputCodeInterpreterServerToolItem = { + readonly "code"?: string + readonly "exitCode"?: number + readonly "id"?: string + readonly "language"?: string + readonly "status": ToolCallStatus + readonly "stderr"?: string + readonly "stdout"?: string + readonly "type": "openrouter:code_interpreter" +} +export const OutputCodeInterpreterServerToolItem = Schema.Struct({ + "code": Schema.optionalKey(Schema.String), + "exitCode": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "id": Schema.optionalKey(Schema.String), + "language": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "stderr": Schema.optionalKey(Schema.String), + "stdout": Schema.optionalKey(Schema.String), + "type": Schema.Literal("openrouter:code_interpreter") +}).annotate({ "description": "An openrouter:code_interpreter server tool output item" }) +export type OutputDatetimeItem = { + readonly "datetime": string + readonly "id"?: string + readonly "status": ToolCallStatus + readonly "timezone": string + readonly "type": "openrouter:datetime" +} +export const OutputDatetimeItem = Schema.Struct({ + "datetime": Schema.String.annotate({ "description": "ISO 8601 datetime string" }), + "id": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "timezone": Schema.String.annotate({ "description": "IANA timezone name" }), + "type": Schema.Literal("openrouter:datetime") +}).annotate({ "description": "An openrouter:datetime server tool output item" }) +export type OutputFileSearchServerToolItem = { + readonly "id"?: string + readonly "queries"?: ReadonlyArray + readonly "status": ToolCallStatus + readonly "type": "openrouter:file_search" +} +export const OutputFileSearchServerToolItem = Schema.Struct({ + "id": Schema.optionalKey(Schema.String), + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "status": ToolCallStatus, + "type": Schema.Literal("openrouter:file_search") +}).annotate({ "description": "An openrouter:file_search server tool output item" }) +export type OutputFusionServerToolItem = { + readonly "analysis"?: { + readonly "blind_spots": ReadonlyArray + readonly "consensus": ReadonlyArray + readonly "contradictions": ReadonlyArray< + { + readonly "stances": ReadonlyArray<{ readonly "model": string; readonly "stance": string }> + readonly "topic": string + } + > + readonly "partial_coverage": ReadonlyArray<{ readonly "models": ReadonlyArray; readonly "point": string }> + readonly "unique_insights": ReadonlyArray<{ readonly "insight": string; readonly "model": string }> + } + readonly "error"?: string + readonly "failed_models"?: ReadonlyArray<{ readonly "error": string; readonly "model": string }> + readonly "id"?: string + readonly "responses"?: ReadonlyArray<{ readonly "model": string }> + readonly "status": ToolCallStatus + readonly "type": "openrouter:fusion" +} +export const OutputFusionServerToolItem = Schema.Struct({ + "analysis": Schema.optionalKey( + Schema.Struct({ + "blind_spots": Schema.Array(Schema.String), + "consensus": Schema.Array(Schema.String), + "contradictions": Schema.Array( + Schema.Struct({ + "stances": Schema.Array(Schema.Struct({ "model": Schema.String, "stance": Schema.String })), + "topic": Schema.String + }) + ), + "partial_coverage": Schema.Array( + Schema.Struct({ "models": Schema.Array(Schema.String), "point": Schema.String }) + ), + "unique_insights": Schema.Array(Schema.Struct({ "insight": Schema.String, "model": Schema.String })) + }).annotate({ "description": "Structured analysis produced by the fusion judge model." }) + ), + "error": Schema.optionalKey( + Schema.String.annotate({ "description": "Error message when the fusion run did not produce an analysis result." }) + ), + "failed_models": Schema.optionalKey( + Schema.Array( + Schema.Struct({ + "error": Schema.String.annotate({ "description": "Error message describing why the model failed." }), + "model": Schema.String.annotate({ "description": "Slug of the analysis model that failed." }) + }) + ).annotate({ + "description": + "Models that were requested as part of the analysis panel but did not produce a response. Present when at least one requested analysis model failed. The fusion result is still usable but was produced from a degraded panel." + }) + ), + "id": Schema.optionalKey(Schema.String), + "responses": Schema.optionalKey( + Schema.Array(Schema.Struct({ "model": Schema.String })).annotate({ + "description": "Slugs of the analysis models that produced a response in this fusion run." + }) + ), + "status": ToolCallStatus, + "type": Schema.Literal("openrouter:fusion") +}).annotate({ "description": "An openrouter:fusion server tool output item" }) +export type OutputImageGenerationServerToolItem = { + readonly "id"?: string + readonly "imageB64"?: string + readonly "imageUrl"?: string + readonly "result"?: string + readonly "revisedPrompt"?: string + readonly "status": ToolCallStatus + readonly "type": "openrouter:image_generation" +} +export const OutputImageGenerationServerToolItem = Schema.Struct({ + "id": Schema.optionalKey(Schema.String), + "imageB64": Schema.optionalKey(Schema.String), + "imageUrl": Schema.optionalKey(Schema.String), + "result": Schema.optionalKey( + Schema.String.annotate({ + "description": + "The generated image as a base64-encoded string or URL, matching OpenAI image_generation_call format" + }) + ), + "revisedPrompt": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "type": Schema.Literal("openrouter:image_generation") +}).annotate({ "description": "An openrouter:image_generation server tool output item" }) +export type OutputMcpServerToolItem = { + readonly "id"?: string + readonly "serverLabel"?: string + readonly "status": ToolCallStatus + readonly "toolName"?: string + readonly "type": "openrouter:mcp" +} +export const OutputMcpServerToolItem = Schema.Struct({ + "id": Schema.optionalKey(Schema.String), + "serverLabel": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "toolName": Schema.optionalKey(Schema.String), + "type": Schema.Literal("openrouter:mcp") +}).annotate({ "description": "An openrouter:mcp server tool output item" }) +export type OutputMemoryServerToolItem = { + readonly "action"?: "read" | "write" | "delete" + readonly "id"?: string + readonly "key"?: string + readonly "status": ToolCallStatus + readonly "type": "openrouter:memory" + readonly "value"?: unknown +} +export const OutputMemoryServerToolItem = Schema.Struct({ + "action": Schema.optionalKey(Schema.Literals(["read", "write", "delete"])), + "id": Schema.optionalKey(Schema.String), + "key": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "type": Schema.Literal("openrouter:memory"), + "value": Schema.optionalKey(Schema.Unknown) +}).annotate({ "description": "An openrouter:memory server tool output item" }) +export type OutputSearchModelsServerToolItem = { + readonly "arguments"?: string + readonly "id"?: string + readonly "query"?: string + readonly "status": ToolCallStatus + readonly "type": "openrouter:experimental__search_models" +} +export const OutputSearchModelsServerToolItem = Schema.Struct({ + "arguments": Schema.optionalKey( + Schema.String.annotate({ + "description": "The JSON arguments submitted to the search tool (e.g. {\"query\":\"Claude\"})" + }) + ), + "id": Schema.optionalKey(Schema.String), + "query": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "type": Schema.Literal("openrouter:experimental__search_models") +}).annotate({ "description": "An openrouter:experimental__search_models server tool output item" }) +export type OutputTextEditorServerToolItem = { + readonly "command"?: "view" | "create" | "str_replace" | "insert" + readonly "filePath"?: string + readonly "id"?: string + readonly "status": ToolCallStatus + readonly "type": "openrouter:text_editor" +} +export const OutputTextEditorServerToolItem = Schema.Struct({ + "command": Schema.optionalKey(Schema.Literals(["view", "create", "str_replace", "insert"])), + "filePath": Schema.optionalKey(Schema.String), + "id": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "type": Schema.Literal("openrouter:text_editor") +}).annotate({ "description": "An openrouter:text_editor server tool output item" }) +export type OutputToolSearchServerToolItem = { + readonly "id"?: string + readonly "query"?: string + readonly "status": ToolCallStatus + readonly "type": "openrouter:tool_search" +} +export const OutputToolSearchServerToolItem = Schema.Struct({ + "id": Schema.optionalKey(Schema.String), + "query": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "type": Schema.Literal("openrouter:tool_search") +}).annotate({ "description": "An openrouter:tool_search server tool output item" }) +export type OutputWebFetchServerToolItem = { + readonly "content"?: string + readonly "error"?: string + readonly "httpStatus"?: number + readonly "id"?: string + readonly "status": ToolCallStatus + readonly "title"?: string + readonly "type": "openrouter:web_fetch" + readonly "url"?: string +} +export const OutputWebFetchServerToolItem = Schema.Struct({ + "content": Schema.optionalKey(Schema.String), + "error": Schema.optionalKey(Schema.String.annotate({ "description": "The error message if the fetch failed." })), + "httpStatus": Schema.optionalKey( + Schema.Number.annotate({ "description": "The HTTP status code returned by the upstream URL fetch." }).check( + Schema.isInt() + ) + ), + "id": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "title": Schema.optionalKey(Schema.String), + "type": Schema.Literal("openrouter:web_fetch"), + "url": Schema.optionalKey(Schema.String) +}).annotate({ "description": "An openrouter:web_fetch server tool output item" }) +export type OutputWebSearchServerToolItem = { + readonly "action"?: { + readonly "query": string + readonly "sources"?: ReadonlyArray<{ readonly "type": "url"; readonly "url": string }> + readonly "type": "search" + } + readonly "id"?: string + readonly "status": ToolCallStatus + readonly "type": "openrouter:web_search" +} +export const OutputWebSearchServerToolItem = Schema.Struct({ + "action": Schema.optionalKey( + Schema.Struct({ + "query": Schema.String, + "sources": Schema.optionalKey( + Schema.Array(Schema.Struct({ "type": Schema.Literal("url"), "url": Schema.String })) + ), + "type": Schema.Literal("search") + }).annotate({ + "description": + "The search action performed, matching OpenAI web_search_call.action shape. Includes the query the model issued and optional source URLs returned by the search provider." + }) + ), + "id": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "type": Schema.Literal("openrouter:web_search") +}).annotate({ "description": "An openrouter:web_search server tool output item" }) +export type OpenAIResponsesToolChoice = + | "auto" + | "none" + | "required" + | { readonly "name": string; readonly "type": "function" } + | { readonly "type": "web_search_preview_2025_03_11" | "web_search_preview" } + | ToolChoiceAllowed + | { readonly "type": "apply_patch" } + | { readonly "type": "shell" } +export const OpenAIResponsesToolChoice = Schema.Union([ + Schema.Literal("auto"), + Schema.Literal("none"), + Schema.Literal("required"), + Schema.Struct({ "name": Schema.String, "type": Schema.Literal("function") }), + Schema.Struct({ "type": Schema.Literals(["web_search_preview_2025_03_11", "web_search_preview"]) }), + ToolChoiceAllowed, + Schema.Struct({ "type": Schema.Literal("apply_patch") }), + Schema.Struct({ "type": Schema.Literal("shell") }) +]) +export type TooManyRequestsResponse = { + readonly "error": TooManyRequestsResponseErrorData + readonly "openrouter_metadata"?: {} + readonly "user_id"?: string +} +export const TooManyRequestsResponse = Schema.Struct({ + "error": TooManyRequestsResponseErrorData, + "openrouter_metadata": Schema.optionalKey(Schema.Struct({})), + "user_id": Schema.optionalKey(Schema.String) +}).annotate({ "description": "Too Many Requests - Rate limit exceeded" }) +export type UnauthorizedResponse = { + readonly "error": UnauthorizedResponseErrorData + readonly "openrouter_metadata"?: {} + readonly "user_id"?: string +} +export const UnauthorizedResponse = Schema.Struct({ + "error": UnauthorizedResponseErrorData, + "openrouter_metadata": Schema.optionalKey(Schema.Struct({})), + "user_id": Schema.optionalKey(Schema.String) +}).annotate({ "description": "Unauthorized - Authentication required or invalid credentials" }) +export type UnprocessableEntityResponse = { + readonly "error": UnprocessableEntityResponseErrorData + readonly "openrouter_metadata"?: {} + readonly "user_id"?: string +} +export const UnprocessableEntityResponse = Schema.Struct({ + "error": UnprocessableEntityResponseErrorData, + "openrouter_metadata": Schema.optionalKey(Schema.Struct({})), + "user_id": Schema.optionalKey(Schema.String) +}).annotate({ "description": "Unprocessable Entity - Semantic validation failure" }) +export type OpenAIResponsesAnnotation = FileCitation | URLCitation | FilePath +export const OpenAIResponsesAnnotation = Schema.Union([FileCitation, URLCitation, FilePath]) +export type VideoGenerationResponse = { + readonly "error"?: string + readonly "generation_id"?: string + readonly "id": string + readonly "polling_url": string + readonly "status": "pending" | "in_progress" | "completed" | "failed" | "cancelled" | "expired" + readonly "unsigned_urls"?: ReadonlyArray + readonly "usage"?: VideoGenerationUsage +} +export const VideoGenerationResponse = Schema.Struct({ + "error": Schema.optionalKey(Schema.String), + "generation_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "The generation ID associated with this video generation job. Available once the job has been processed." + }) + ), + "id": Schema.String, + "polling_url": Schema.String, + "status": Schema.Literals(["pending", "in_progress", "completed", "failed", "cancelled", "expired"]), + "unsigned_urls": Schema.optionalKey(Schema.Array(Schema.String)), + "usage": Schema.optionalKey(VideoGenerationUsage) +}) +export type VideoModelsListResponse = { readonly "data": ReadonlyArray } +export const VideoModelsListResponse = Schema.Struct({ "data": Schema.Array(VideoModel) }) +export type WebFetchServerToolConfig = { + readonly "allowed_domains"?: ReadonlyArray + readonly "blocked_domains"?: ReadonlyArray + readonly "engine"?: WebFetchEngineEnum + readonly "max_content_tokens"?: number + readonly "max_uses"?: number +} +export const WebFetchServerToolConfig = Schema.Struct({ + "allowed_domains": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "Only fetch from these domains." }) + ), + "blocked_domains": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "Never fetch from these domains." }) + ), + "engine": Schema.optionalKey(WebFetchEngineEnum), + "max_content_tokens": Schema.optionalKey( + Schema.Number.annotate({ + "description": "Maximum content length in approximate tokens. Content exceeding this limit is truncated." + }).check(Schema.isInt()) + ), + "max_uses": Schema.optionalKey( + Schema.Number.annotate({ + "description": "Maximum number of web fetches per request. Once exceeded, the tool returns an error." + }).check(Schema.isInt()) + ) +}).annotate({ "description": "Configuration for the openrouter:web_fetch server tool" }) +export type WebSearchPlugin = { + readonly "enabled"?: boolean + readonly "engine"?: WebSearchEngine + readonly "exclude_domains"?: ReadonlyArray + readonly "id": "web" + readonly "include_domains"?: ReadonlyArray + readonly "max_results"?: number + readonly "max_uses"?: number + readonly "search_prompt"?: string + readonly "user_location"?: { + readonly "city"?: string + readonly "country"?: string + readonly "region"?: string + readonly "timezone"?: string + readonly "type": "approximate" + } +} +export const WebSearchPlugin = Schema.Struct({ + "enabled": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": "Set to false to disable the web-search plugin for this request. Defaults to true." + }) + ), + "engine": Schema.optionalKey(WebSearchEngine), + "exclude_domains": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "description": + "A list of domains to exclude from web search results. Supports wildcards (e.g. \"*.substack.com\") and path filtering (e.g. \"openai.com/blog\")." + }) + ), + "id": Schema.Literal("web"), + "include_domains": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "description": + "A list of domains to restrict web search results to. Supports wildcards (e.g. \"*.substack.com\") and path filtering (e.g. \"openai.com/blog\")." + }) + ), + "max_results": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "max_uses": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "Maximum number of times the model can invoke web search in a single turn. Passed through to native providers that support it (e.g. Anthropic)." + }).check(Schema.isInt()) + ), + "search_prompt": Schema.optionalKey(Schema.String), + "user_location": Schema.optionalKey( + Schema.Struct({ + "city": Schema.optionalKey(Schema.String), + "country": Schema.optionalKey(Schema.String), + "region": Schema.optionalKey(Schema.String), + "timezone": Schema.optionalKey(Schema.String), + "type": Schema.Literal("approximate") + }).annotate({ + "description": + "Approximate user location for location-biased search results. Passed through to native providers that support it (e.g. Anthropic)." + }) + ) +}) +export type Preview_20250311_WebSearchServerTool = { + readonly "engine"?: WebSearchEngineEnum + readonly "filters"?: WebSearchDomainFilter + readonly "max_results"?: number + readonly "search_context_size"?: SearchContextSizeEnum + readonly "type": "web_search_preview_2025_03_11" + readonly "user_location"?: Preview_WebSearchUserLocation +} +export const Preview_20250311_WebSearchServerTool = Schema.Struct({ + "engine": Schema.optionalKey(WebSearchEngineEnum), + "filters": Schema.optionalKey(WebSearchDomainFilter), + "max_results": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search." + }).check(Schema.isInt()) + ), + "search_context_size": Schema.optionalKey(SearchContextSizeEnum), + "type": Schema.Literal("web_search_preview_2025_03_11"), + "user_location": Schema.optionalKey(Preview_WebSearchUserLocation) +}).annotate({ "description": "Web search preview tool configuration (2025-03-11 version)" }) +export type Preview_WebSearchServerTool = { + readonly "engine"?: WebSearchEngineEnum + readonly "filters"?: WebSearchDomainFilter + readonly "max_results"?: number + readonly "search_context_size"?: SearchContextSizeEnum + readonly "type": "web_search_preview" + readonly "user_location"?: Preview_WebSearchUserLocation +} +export const Preview_WebSearchServerTool = Schema.Struct({ + "engine": Schema.optionalKey(WebSearchEngineEnum), + "filters": Schema.optionalKey(WebSearchDomainFilter), + "max_results": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search." + }).check(Schema.isInt()) + ), + "search_context_size": Schema.optionalKey(SearchContextSizeEnum), + "type": Schema.Literal("web_search_preview"), + "user_location": Schema.optionalKey(Preview_WebSearchUserLocation) +}).annotate({ "description": "Web search preview tool configuration" }) +export type OutputFileSearchCallItem = { + readonly "id": string + readonly "queries": ReadonlyArray + readonly "status": WebSearchStatus + readonly "type": "file_search_call" +} +export const OutputFileSearchCallItem = Schema.Struct({ + "id": Schema.String, + "queries": Schema.Array(Schema.String), + "status": WebSearchStatus, + "type": Schema.Literal("file_search_call") +}) +export type OutputItemFileSearchCall = { + readonly "id": string + readonly "queries": ReadonlyArray + readonly "status": WebSearchStatus + readonly "type": "file_search_call" +} +export const OutputItemFileSearchCall = Schema.Struct({ + "id": Schema.String, + "queries": Schema.Array(Schema.String), + "status": WebSearchStatus, + "type": Schema.Literal("file_search_call") +}) +export type OutputItemWebSearchCall = { + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + readonly "id": string + readonly "status": WebSearchStatus + readonly "type": "web_search_call" +} +export const OutputItemWebSearchCall = Schema.Struct({ + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }), + "id": Schema.String, + "status": WebSearchStatus, + "type": Schema.Literal("web_search_call") +}) +export type OutputWebSearchCallItem = { + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + readonly "id": string + readonly "status": WebSearchStatus + readonly "type": "web_search_call" +} +export const OutputWebSearchCallItem = Schema.Struct({ + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }), + "id": Schema.String, + "status": WebSearchStatus, + "type": Schema.Literal("web_search_call") +}) +export type Legacy_WebSearchServerTool = { + readonly "engine"?: WebSearchEngineEnum + readonly "filters"?: WebSearchDomainFilter + readonly "max_results"?: number + readonly "search_context_size"?: SearchContextSizeEnum + readonly "type": "web_search" + readonly "user_location"?: WebSearchUserLocation +} +export const Legacy_WebSearchServerTool = Schema.Struct({ + "engine": Schema.optionalKey(WebSearchEngineEnum), + "filters": Schema.optionalKey(WebSearchDomainFilter), + "max_results": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search." + }).check(Schema.isInt()) + ), + "search_context_size": Schema.optionalKey(SearchContextSizeEnum), + "type": Schema.Literal("web_search"), + "user_location": Schema.optionalKey(WebSearchUserLocation) +}).annotate({ "description": "Web search tool configuration" }) +export type WebSearchServerTool = { + readonly "engine"?: WebSearchEngineEnum + readonly "filters"?: WebSearchDomainFilter + readonly "max_results"?: number + readonly "search_context_size"?: SearchContextSizeEnum + readonly "type": "web_search_2025_08_26" + readonly "user_location"?: WebSearchUserLocation +} +export const WebSearchServerTool = Schema.Struct({ + "engine": Schema.optionalKey(WebSearchEngineEnum), + "filters": Schema.optionalKey(WebSearchDomainFilter), + "max_results": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search." + }).check(Schema.isInt()) + ), + "search_context_size": Schema.optionalKey(SearchContextSizeEnum), + "type": Schema.Literal("web_search_2025_08_26"), + "user_location": Schema.optionalKey(WebSearchUserLocation) +}).annotate({ "description": "Web search tool configuration (2025-08-26 version)" }) +export type WebSearchConfig = { + readonly "allowed_domains"?: ReadonlyArray + readonly "engine"?: WebSearchEngineEnum + readonly "excluded_domains"?: ReadonlyArray + readonly "max_results"?: number + readonly "max_total_results"?: number + readonly "search_context_size"?: SearchQualityLevel + readonly "user_location"?: WebSearchUserLocationServerTool +} +export const WebSearchConfig = Schema.Struct({ + "allowed_domains": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "description": + "Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains." + }) + ), + "engine": Schema.optionalKey(WebSearchEngineEnum), + "excluded_domains": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "description": + "Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains." + }) + ), + "max_results": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search." + }).check(Schema.isInt()) + ), + "max_total_results": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified." + }).check(Schema.isInt()) + ), + "search_context_size": Schema.optionalKey(SearchQualityLevel), + "user_location": Schema.optionalKey(WebSearchUserLocationServerTool) +}) +export type WebSearchServerToolConfig = { + readonly "allowed_domains"?: ReadonlyArray + readonly "engine"?: WebSearchEngineEnum + readonly "excluded_domains"?: ReadonlyArray + readonly "max_results"?: number + readonly "max_total_results"?: number + readonly "search_context_size"?: SearchQualityLevel + readonly "user_location"?: WebSearchUserLocationServerTool +} +export const WebSearchServerToolConfig = Schema.Struct({ + "allowed_domains": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "description": + "Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains." + }) + ), + "engine": Schema.optionalKey(WebSearchEngineEnum), + "excluded_domains": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "description": + "Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains." + }) + ), + "max_results": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search." + }).check(Schema.isInt()) + ), + "max_total_results": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified." + }).check(Schema.isInt()) + ), + "search_context_size": Schema.optionalKey(SearchQualityLevel), + "user_location": Schema.optionalKey(WebSearchUserLocationServerTool) +}).annotate({ "description": "Configuration for the openrouter:web_search server tool" }) +export type ListWorkspacesResponse = { readonly "data": ReadonlyArray; readonly "total_count": number } +export const ListWorkspacesResponse = Schema.Struct({ + "data": Schema.Array(Workspace).annotate({ "description": "List of workspaces" }), + "total_count": Schema.Number.annotate({ "description": "Total number of workspaces" }).check(Schema.isInt()) +}) +export type BulkAddWorkspaceMembersResponse = { + readonly "added_count": number + readonly "data": ReadonlyArray +} +export const BulkAddWorkspaceMembersResponse = Schema.Struct({ + "added_count": Schema.Number.annotate({ "description": "Number of workspace memberships created or updated" }).check( + Schema.isInt() + ), + "data": Schema.Array(WorkspaceMember).annotate({ "description": "List of added workspace memberships" }) +}) +export type AnthropicBashCodeExecutionContent = + | AnthropicBashCodeExecutionToolResultError + | AnthropicBashCodeExecutionResult +export const AnthropicBashCodeExecutionContent = Schema.Union([ + AnthropicBashCodeExecutionToolResultError, + AnthropicBashCodeExecutionResult +], { mode: "oneOf" }) +export type AnthropicTextBlockParam = { + readonly "cache_control"?: AnthropicCacheControlDirective + readonly "citations"?: ReadonlyArray< + | AnthropicCitationCharLocationParam + | AnthropicCitationPageLocationParam + | AnthropicCitationContentBlockLocationParam + | AnthropicCitationWebSearchResultLocation + | AnthropicCitationSearchResultLocation + > + readonly "text": string + readonly "type": "text" +} +export const AnthropicTextBlockParam = Schema.Struct({ + "cache_control": Schema.optionalKey(AnthropicCacheControlDirective), + "citations": Schema.optionalKey( + Schema.Array( + Schema.Union([ + AnthropicCitationCharLocationParam, + AnthropicCitationPageLocationParam, + AnthropicCitationContentBlockLocationParam, + AnthropicCitationWebSearchResultLocation, + AnthropicCitationSearchResultLocation + ], { mode: "oneOf" }) + ) + ), + "text": Schema.String, + "type": Schema.Literal("text") +}) +export type ChatContentText = { + readonly "cache_control"?: ChatContentCacheControl + readonly "text": string + readonly "type": "text" +} +export const ChatContentText = Schema.Struct({ + "cache_control": Schema.optionalKey(ChatContentCacheControl), + "text": Schema.String, + "type": Schema.Literal("text") +}).annotate({ "description": "Text content part" }) +export type AnthropicTextBlock = { + readonly "citations": ReadonlyArray + readonly "text": string + readonly "type": "text" +} +export const AnthropicTextBlock = Schema.Struct({ + "citations": Schema.Array(AnthropicTextCitation), + "text": Schema.String, + "type": Schema.Literal("text") +}) +export type AnthropicToolUseBlock = { + readonly "caller": AnthropicCaller + readonly "id": string + readonly "input"?: unknown + readonly "name": string + readonly "type": "tool_use" +} +export const AnthropicToolUseBlock = Schema.Struct({ + "caller": AnthropicCaller, + "id": Schema.String, + "input": Schema.optionalKey(Schema.Unknown), + "name": Schema.String, + "type": Schema.Literal("tool_use") +}) +export type AnthropicWebSearchToolResult = { + readonly "caller": AnthropicCaller + readonly "content": ReadonlyArray | AnthropicWebSearchToolResultError + readonly "tool_use_id": string + readonly "type": "web_search_tool_result" +} +export const AnthropicWebSearchToolResult = Schema.Struct({ + "caller": AnthropicCaller, + "content": Schema.Union([Schema.Array(AnthropicWebSearchResult), AnthropicWebSearchToolResultError]), + "tool_use_id": Schema.String, + "type": Schema.Literal("web_search_tool_result") +}) +export type ORAnthropicServerToolUseBlock = { + readonly "caller"?: ORAnthropicNullableCaller + readonly "id": string + readonly "input"?: unknown + readonly "name": string + readonly "type": "server_tool_use" +} +export const ORAnthropicServerToolUseBlock = Schema.Struct({ + "caller": Schema.optionalKey(ORAnthropicNullableCaller), + "id": Schema.String, + "input": Schema.optionalKey(Schema.Unknown), + "name": Schema.String, + "type": Schema.Literal("server_tool_use") +}) +export type AnthropicImageBlockParam = { + readonly "cache_control"?: AnthropicCacheControlDirective + readonly "source": AnthropicBase64ImageSource | AnthropicUrlImageSource + readonly "type": "image" +} +export const AnthropicImageBlockParam = Schema.Struct({ + "cache_control": Schema.optionalKey(AnthropicCacheControlDirective), + "source": Schema.Union([AnthropicBase64ImageSource, AnthropicUrlImageSource], { mode: "oneOf" }), + "type": Schema.Literal("image") +}) +export type AnthropicUsageIteration = + | AnthropicCompactionUsageIteration + | AnthropicMessageUsageIteration + | AnthropicAdvisorMessageUsageIteration + | AnthropicUnknownUsageIteration +export const AnthropicUsageIteration = Schema.Union([ + AnthropicCompactionUsageIteration, + AnthropicMessageUsageIteration, + AnthropicAdvisorMessageUsageIteration, + AnthropicUnknownUsageIteration +]) +export type AnthropicWebFetchBlock = { + readonly "content": AnthropicDocumentBlock + readonly "retrieved_at": string + readonly "type": "web_fetch_result" + readonly "url": string +} +export const AnthropicWebFetchBlock = Schema.Struct({ + "content": AnthropicDocumentBlock, + "retrieved_at": Schema.String, + "type": Schema.Literal("web_fetch_result"), + "url": Schema.String +}) +export type AnthropicCodeExecutionContent = + | AnthropicCodeExecutionToolResultError + | AnthropicCodeExecutionResult + | AnthropicEncryptedCodeExecutionResult +export const AnthropicCodeExecutionContent = Schema.Union([ + AnthropicCodeExecutionToolResultError, + AnthropicCodeExecutionResult, + AnthropicEncryptedCodeExecutionResult +], { mode: "oneOf" }) +export type AnthropicTextEditorCodeExecutionToolResult = { + readonly "content": AnthropicTextEditorCodeExecutionContent + readonly "tool_use_id": string + readonly "type": "text_editor_code_execution_tool_result" +} +export const AnthropicTextEditorCodeExecutionToolResult = Schema.Struct({ + "content": AnthropicTextEditorCodeExecutionContent, + "tool_use_id": Schema.String, + "type": Schema.Literal("text_editor_code_execution_tool_result") +}) +export type AnthropicToolSearchContent = AnthropicToolSearchResultError | AnthropicToolSearchResult +export const AnthropicToolSearchContent = Schema.Union([AnthropicToolSearchResultError, AnthropicToolSearchResult], { + mode: "oneOf" +}) +export type ApplyPatchServerTool_OpenRouter = { + readonly "parameters"?: ApplyPatchServerToolConfig + readonly "type": "openrouter:apply_patch" +} +export const ApplyPatchServerTool_OpenRouter = Schema.Struct({ + "parameters": Schema.optionalKey(ApplyPatchServerToolConfig), + "type": Schema.Literal("openrouter:apply_patch") +}).annotate({ + "description": + "OpenRouter built-in server tool: validates V4A diff patches for file operations (create, update, delete). Restricted to the Responses API." +}) +export type ApplyPatchCallItem = { + readonly "call_id": string + readonly "id"?: string + readonly "operation": ApplyPatchCallOperation + readonly "status": ApplyPatchCallStatus + readonly "type": "apply_patch_call" +} +export const ApplyPatchCallItem = Schema.Struct({ + "call_id": Schema.String, + "id": Schema.optionalKey(Schema.String), + "operation": ApplyPatchCallOperation, + "status": ApplyPatchCallStatus, + "type": Schema.Literal("apply_patch_call") +}).annotate({ + "description": + "A tool call emitted by the model requesting a V4A patch operation. The client applies the patch and echoes an `apply_patch_call_output` on the next turn." +}) +export type OutputApplyPatchCallItem = { + readonly "call_id": string + readonly "id": string + readonly "operation": ApplyPatchCallOperation + readonly "status": ApplyPatchCallStatus + readonly "type": "apply_patch_call" +} +export const OutputApplyPatchCallItem = Schema.Struct({ + "call_id": Schema.String, + "id": Schema.String, + "operation": ApplyPatchCallOperation, + "status": ApplyPatchCallStatus, + "type": Schema.Literal("apply_patch_call") +}).annotate({ + "description": + "A native `apply_patch_call` output item matching OpenAI's Responses API shape. Emitted when the client requested the `apply_patch` shorthand." +}) +export type OutputApplyPatchServerToolItem = { + readonly "call_id"?: string + readonly "id"?: string + readonly "operation"?: ApplyPatchCallOperation + readonly "status": ToolCallStatus + readonly "type": "openrouter:apply_patch" +} +export const OutputApplyPatchServerToolItem = Schema.Struct({ + "call_id": Schema.optionalKey(Schema.String), + "id": Schema.optionalKey(Schema.String), + "operation": Schema.optionalKey(ApplyPatchCallOperation), + "status": ToolCallStatus, + "type": Schema.Literal("openrouter:apply_patch") +}).annotate({ + "description": + "An openrouter:apply_patch server tool output item. The turn halts when validation succeeds so the client can apply the patch and echo an `apply_patch_call_output` on the next turn." +}) +export type ListBYOKKeysResponse = { readonly "data": ReadonlyArray; readonly "total_count": number } +export const ListBYOKKeysResponse = Schema.Struct({ + "data": Schema.Array(BYOKKey).annotate({ "description": "List of BYOK credentials." }), + "total_count": Schema.Number.annotate({ "description": "Total number of BYOK credentials matching the filters." }) + .check(Schema.isInt()) +}) +export type CreateGuardrailRequest = { + readonly "allowed_models"?: ReadonlyArray + readonly "allowed_providers"?: ReadonlyArray + readonly "content_filter_builtins"?: ReadonlyArray + readonly "content_filters"?: ReadonlyArray + readonly "description"?: string + readonly "enforce_zdr"?: boolean + readonly "enforce_zdr_anthropic"?: boolean + readonly "enforce_zdr_google"?: boolean + readonly "enforce_zdr_openai"?: boolean + readonly "enforce_zdr_other"?: boolean + readonly "ignored_models"?: ReadonlyArray + readonly "ignored_providers"?: ReadonlyArray + readonly "limit_usd"?: number + readonly "name": string + readonly "reset_interval"?: GuardrailInterval + readonly "workspace_id"?: string +} +export const CreateGuardrailRequest = Schema.Struct({ + "allowed_models": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "description": "Array of model identifiers (slug or canonical_slug accepted)" + }).check(Schema.isMinLength(1)) + ), + "allowed_providers": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "List of allowed provider IDs" }).check(Schema.isMinLength(1)) + ), + "content_filter_builtins": Schema.optionalKey( + Schema.Array(ContentFilterBuiltinEntry).annotate({ + "description": + "Builtin content filters to apply. The \"flag\" action is only supported for \"regex-prompt-injection\"; PII slugs (email, phone, ssn, credit-card, ip-address, person-name, address) accept \"block\" or \"redact\" only." + }) + ), + "content_filters": Schema.optionalKey( + Schema.Array(ContentFilterEntry).annotate({ + "description": "Custom regex content filters to apply to request messages" + }) + ), + "description": Schema.optionalKey( + Schema.String.annotate({ "description": "Description of the guardrail" }).check(Schema.isMaxLength(1000)) + ), + "enforce_zdr": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request." + }) + ), + "enforce_zdr_anthropic": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided." + }) + ), + "enforce_zdr_google": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided." + }) + ), + "enforce_zdr_openai": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided." + }) + ), + "enforce_zdr_other": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided." + }) + ), + "ignored_models": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "description": "Array of model identifiers to exclude from routing (slug or canonical_slug accepted)" + }).check(Schema.isMinLength(1)) + ), + "ignored_providers": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "List of provider IDs to exclude from routing" }).check( + Schema.isMinLength(1) + ) + ), + "limit_usd": Schema.optionalKey( + Schema.Number.annotate({ "description": "Spending limit in USD", "format": "double" }).check(Schema.isFinite()) + ), + "name": Schema.String.annotate({ "description": "Name for the new guardrail" }).check(Schema.isMinLength(1)).check( + Schema.isMaxLength(200) + ), + "reset_interval": Schema.optionalKey(GuardrailInterval), + "workspace_id": Schema.optionalKey( + Schema.String.annotate({ + "description": "The workspace to create the guardrail in. Defaults to the default workspace if not provided.", + "format": "uuid" + }) + ) +}) +export type CreateGuardrailResponse = { + readonly "data": { + readonly "allowed_models"?: ReadonlyArray + readonly "allowed_providers"?: ReadonlyArray + readonly "content_filter_builtins"?: ReadonlyArray + readonly "content_filters"?: ReadonlyArray + readonly "created_at": string + readonly "description"?: string + readonly "enforce_zdr"?: boolean + readonly "enforce_zdr_anthropic"?: boolean + readonly "enforce_zdr_google"?: boolean + readonly "enforce_zdr_openai"?: boolean + readonly "enforce_zdr_other"?: boolean + readonly "id": string + readonly "ignored_models"?: ReadonlyArray + readonly "ignored_providers"?: ReadonlyArray + readonly "limit_usd"?: number + readonly "name": string + readonly "reset_interval"?: GuardrailInterval + readonly "updated_at"?: string + readonly "workspace_id": string + } +} +export const CreateGuardrailResponse = Schema.Struct({ + "data": Schema.Struct({ + "allowed_models": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "Array of model canonical_slugs (immutable identifiers)" }) + ), + "allowed_providers": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "List of allowed provider IDs" }) + ), + "content_filter_builtins": Schema.optionalKey( + Schema.Array(ContentFilterBuiltinEntry).annotate({ + "description": + "Builtin content filters applied to requests. Includes PII detectors and the regex-based prompt injection detector." + }) + ), + "content_filters": Schema.optionalKey( + Schema.Array(ContentFilterEntry).annotate({ + "description": "Custom regex content filters applied to request messages" + }) + ), + "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the guardrail was created" }), + "description": Schema.optionalKey(Schema.String.annotate({ "description": "Description of the guardrail" })), + "enforce_zdr": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request." + }) + ), + "enforce_zdr_anthropic": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided." + }) + ), + "enforce_zdr_google": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided." + }) + ), + "enforce_zdr_openai": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided." + }) + ), + "enforce_zdr_other": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided." + }) + ), + "id": Schema.String.annotate({ "description": "Unique identifier for the guardrail", "format": "uuid" }), + "ignored_models": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "Array of model canonical_slugs to exclude from routing" }) + ), + "ignored_providers": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "List of provider IDs to exclude from routing" }) + ), + "limit_usd": Schema.optionalKey( + Schema.Number.annotate({ "description": "Spending limit in USD", "format": "double" }).check(Schema.isFinite()) + ), + "name": Schema.String.annotate({ "description": "Name of the guardrail" }), + "reset_interval": Schema.optionalKey(GuardrailInterval), + "updated_at": Schema.optionalKey( + Schema.String.annotate({ "description": "ISO 8601 timestamp of when the guardrail was last updated" }) + ), + "workspace_id": Schema.String.annotate({ "description": "The workspace ID this guardrail belongs to." }) + }).annotate({ "description": "The created guardrail" }) +}) +export type GetGuardrailResponse = { + readonly "data": { + readonly "allowed_models"?: ReadonlyArray + readonly "allowed_providers"?: ReadonlyArray + readonly "content_filter_builtins"?: ReadonlyArray + readonly "content_filters"?: ReadonlyArray + readonly "created_at": string + readonly "description"?: string + readonly "enforce_zdr"?: boolean + readonly "enforce_zdr_anthropic"?: boolean + readonly "enforce_zdr_google"?: boolean + readonly "enforce_zdr_openai"?: boolean + readonly "enforce_zdr_other"?: boolean + readonly "id": string + readonly "ignored_models"?: ReadonlyArray + readonly "ignored_providers"?: ReadonlyArray + readonly "limit_usd"?: number + readonly "name": string + readonly "reset_interval"?: GuardrailInterval + readonly "updated_at"?: string + readonly "workspace_id": string + } +} +export const GetGuardrailResponse = Schema.Struct({ + "data": Schema.Struct({ + "allowed_models": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "Array of model canonical_slugs (immutable identifiers)" }) + ), + "allowed_providers": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "List of allowed provider IDs" }) + ), + "content_filter_builtins": Schema.optionalKey( + Schema.Array(ContentFilterBuiltinEntry).annotate({ + "description": + "Builtin content filters applied to requests. Includes PII detectors and the regex-based prompt injection detector." + }) + ), + "content_filters": Schema.optionalKey( + Schema.Array(ContentFilterEntry).annotate({ + "description": "Custom regex content filters applied to request messages" + }) + ), + "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the guardrail was created" }), + "description": Schema.optionalKey(Schema.String.annotate({ "description": "Description of the guardrail" })), + "enforce_zdr": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request." + }) + ), + "enforce_zdr_anthropic": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided." + }) + ), + "enforce_zdr_google": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided." + }) + ), + "enforce_zdr_openai": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided." + }) + ), + "enforce_zdr_other": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided." + }) + ), + "id": Schema.String.annotate({ "description": "Unique identifier for the guardrail", "format": "uuid" }), + "ignored_models": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "Array of model canonical_slugs to exclude from routing" }) + ), + "ignored_providers": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "List of provider IDs to exclude from routing" }) + ), + "limit_usd": Schema.optionalKey( + Schema.Number.annotate({ "description": "Spending limit in USD", "format": "double" }).check(Schema.isFinite()) + ), + "name": Schema.String.annotate({ "description": "Name of the guardrail" }), + "reset_interval": Schema.optionalKey(GuardrailInterval), + "updated_at": Schema.optionalKey( + Schema.String.annotate({ "description": "ISO 8601 timestamp of when the guardrail was last updated" }) + ), + "workspace_id": Schema.String.annotate({ "description": "The workspace ID this guardrail belongs to." }) + }).annotate({ "description": "The guardrail" }) +}) +export type Guardrail = { + readonly "allowed_models"?: ReadonlyArray + readonly "allowed_providers"?: ReadonlyArray + readonly "content_filter_builtins"?: ReadonlyArray + readonly "content_filters"?: ReadonlyArray + readonly "created_at": string + readonly "description"?: string + readonly "enforce_zdr"?: boolean + readonly "enforce_zdr_anthropic"?: boolean + readonly "enforce_zdr_google"?: boolean + readonly "enforce_zdr_openai"?: boolean + readonly "enforce_zdr_other"?: boolean + readonly "id": string + readonly "ignored_models"?: ReadonlyArray + readonly "ignored_providers"?: ReadonlyArray + readonly "limit_usd"?: number + readonly "name": string + readonly "reset_interval"?: GuardrailInterval + readonly "updated_at"?: string + readonly "workspace_id": string +} +export const Guardrail = Schema.Struct({ + "allowed_models": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "Array of model canonical_slugs (immutable identifiers)" }) + ), + "allowed_providers": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "List of allowed provider IDs" }) + ), + "content_filter_builtins": Schema.optionalKey( + Schema.Array(ContentFilterBuiltinEntry).annotate({ + "description": + "Builtin content filters applied to requests. Includes PII detectors and the regex-based prompt injection detector." + }) + ), + "content_filters": Schema.optionalKey( + Schema.Array(ContentFilterEntry).annotate({ + "description": "Custom regex content filters applied to request messages" + }) + ), + "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the guardrail was created" }), + "description": Schema.optionalKey(Schema.String.annotate({ "description": "Description of the guardrail" })), + "enforce_zdr": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request." + }) + ), + "enforce_zdr_anthropic": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided." + }) + ), + "enforce_zdr_google": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided." + }) + ), + "enforce_zdr_openai": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided." + }) + ), + "enforce_zdr_other": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided." + }) + ), + "id": Schema.String.annotate({ "description": "Unique identifier for the guardrail", "format": "uuid" }), + "ignored_models": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "Array of model canonical_slugs to exclude from routing" }) + ), + "ignored_providers": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "List of provider IDs to exclude from routing" }) + ), + "limit_usd": Schema.optionalKey( + Schema.Number.annotate({ "description": "Spending limit in USD", "format": "double" }).check(Schema.isFinite()) + ), + "name": Schema.String.annotate({ "description": "Name of the guardrail" }), + "reset_interval": Schema.optionalKey(GuardrailInterval), + "updated_at": Schema.optionalKey( + Schema.String.annotate({ "description": "ISO 8601 timestamp of when the guardrail was last updated" }) + ), + "workspace_id": Schema.String.annotate({ "description": "The workspace ID this guardrail belongs to." }) +}) +export type UpdateGuardrailRequest = { + readonly "allowed_models"?: ReadonlyArray + readonly "allowed_providers"?: ReadonlyArray + readonly "content_filter_builtins"?: ReadonlyArray + readonly "content_filters"?: ReadonlyArray + readonly "description"?: string + readonly "enforce_zdr"?: boolean + readonly "enforce_zdr_anthropic"?: boolean + readonly "enforce_zdr_google"?: boolean + readonly "enforce_zdr_openai"?: boolean + readonly "enforce_zdr_other"?: boolean + readonly "ignored_models"?: ReadonlyArray + readonly "ignored_providers"?: ReadonlyArray + readonly "limit_usd"?: number + readonly "name"?: string + readonly "reset_interval"?: GuardrailInterval +} +export const UpdateGuardrailRequest = Schema.Struct({ + "allowed_models": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "description": "Array of model identifiers (slug or canonical_slug accepted)" + }).check(Schema.isMinLength(1)) + ), + "allowed_providers": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "New list of allowed provider IDs" }).check( + Schema.isMinLength(1) + ) + ), + "content_filter_builtins": Schema.optionalKey( + Schema.Array(ContentFilterBuiltinEntry).annotate({ + "description": + "Builtin content filters to apply. Set to null to remove. The \"flag\" action is only supported for \"regex-prompt-injection\"; PII slugs (email, phone, ssn, credit-card, ip-address, person-name, address) accept \"block\" or \"redact\" only." + }) + ), + "content_filters": Schema.optionalKey( + Schema.Array(ContentFilterEntry).annotate({ + "description": "Custom regex content filters to apply. Set to null to remove." + }) + ), + "description": Schema.optionalKey( + Schema.String.annotate({ "description": "New description for the guardrail" }).check(Schema.isMaxLength(1000)) + ), + "enforce_zdr": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request." + }) + ), + "enforce_zdr_anthropic": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided." + }) + ), + "enforce_zdr_google": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided." + }) + ), + "enforce_zdr_openai": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided." + }) + ), + "enforce_zdr_other": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided." + }) + ), + "ignored_models": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "description": "Array of model identifiers to exclude from routing (slug or canonical_slug accepted)" + }).check(Schema.isMinLength(1)) + ), + "ignored_providers": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "List of provider IDs to exclude from routing" }).check( + Schema.isMinLength(1) + ) + ), + "limit_usd": Schema.optionalKey( + Schema.Number.annotate({ "description": "New spending limit in USD", "format": "double" }).check(Schema.isFinite()) + ), + "name": Schema.optionalKey( + Schema.String.annotate({ "description": "New name for the guardrail" }).check(Schema.isMinLength(1)).check( + Schema.isMaxLength(200) + ) + ), + "reset_interval": Schema.optionalKey(GuardrailInterval) +}) +export type UpdateGuardrailResponse = { + readonly "data": { + readonly "allowed_models"?: ReadonlyArray + readonly "allowed_providers"?: ReadonlyArray + readonly "content_filter_builtins"?: ReadonlyArray + readonly "content_filters"?: ReadonlyArray + readonly "created_at": string + readonly "description"?: string + readonly "enforce_zdr"?: boolean + readonly "enforce_zdr_anthropic"?: boolean + readonly "enforce_zdr_google"?: boolean + readonly "enforce_zdr_openai"?: boolean + readonly "enforce_zdr_other"?: boolean + readonly "id": string + readonly "ignored_models"?: ReadonlyArray + readonly "ignored_providers"?: ReadonlyArray + readonly "limit_usd"?: number + readonly "name": string + readonly "reset_interval"?: GuardrailInterval + readonly "updated_at"?: string + readonly "workspace_id": string + } +} +export const UpdateGuardrailResponse = Schema.Struct({ + "data": Schema.Struct({ + "allowed_models": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "Array of model canonical_slugs (immutable identifiers)" }) + ), + "allowed_providers": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "List of allowed provider IDs" }) + ), + "content_filter_builtins": Schema.optionalKey( + Schema.Array(ContentFilterBuiltinEntry).annotate({ + "description": + "Builtin content filters applied to requests. Includes PII detectors and the regex-based prompt injection detector." + }) + ), + "content_filters": Schema.optionalKey( + Schema.Array(ContentFilterEntry).annotate({ + "description": "Custom regex content filters applied to request messages" + }) + ), + "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the guardrail was created" }), + "description": Schema.optionalKey(Schema.String.annotate({ "description": "Description of the guardrail" })), + "enforce_zdr": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request." + }) + ), + "enforce_zdr_anthropic": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided." + }) + ), + "enforce_zdr_google": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided." + }) + ), + "enforce_zdr_openai": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided." + }) + ), + "enforce_zdr_other": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided." + }) + ), + "id": Schema.String.annotate({ "description": "Unique identifier for the guardrail", "format": "uuid" }), + "ignored_models": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "Array of model canonical_slugs to exclude from routing" }) + ), + "ignored_providers": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ "description": "List of provider IDs to exclude from routing" }) + ), + "limit_usd": Schema.optionalKey( + Schema.Number.annotate({ "description": "Spending limit in USD", "format": "double" }).check(Schema.isFinite()) + ), + "name": Schema.String.annotate({ "description": "Name of the guardrail" }), + "reset_interval": Schema.optionalKey(GuardrailInterval), + "updated_at": Schema.optionalKey( + Schema.String.annotate({ "description": "ISO 8601 timestamp of when the guardrail was last updated" }) + ), + "workspace_id": Schema.String.annotate({ "description": "The workspace ID this guardrail belongs to." }) + }).annotate({ "description": "The updated guardrail" }) +}) +export type TextConfig = { readonly "format"?: Formats; readonly "verbosity"?: "high" | "low" | "medium" | null } +export const TextConfig = Schema.Struct({ + "format": Schema.optionalKey(Formats), + "verbosity": Schema.optionalKey( + Schema.Union([Schema.Literal("high"), Schema.Literal("low"), Schema.Literal("medium"), Schema.Null]) + ) +}).annotate({ "description": "Text output configuration including format and verbosity" }) +export type TextExtendedConfig = { + readonly "format"?: Formats + readonly "verbosity"?: "high" | "low" | "medium" | null +} +export const TextExtendedConfig = Schema.Struct({ + "format": Schema.optionalKey(Formats), + "verbosity": Schema.optionalKey( + Schema.Union([Schema.Literal("high"), Schema.Literal("low"), Schema.Literal("medium"), Schema.Union([Schema.Null])]) + ) +}).annotate({ "description": "Text output configuration including format and verbosity" }) +export type CreateObservabilityDestinationResponse = { + readonly "data": + | ObservabilityArizeDestination + | ObservabilityBraintrustDestination + | ObservabilityClickhouseDestination + | ObservabilityDatadogDestination + | ObservabilityGrafanaDestination + | ObservabilityLangfuseDestination + | ObservabilityLangsmithDestination + | ObservabilityNewrelicDestination + | ObservabilityOpikDestination + | ObservabilityOtelCollectorDestination + | ObservabilityPosthogDestination + | ObservabilityRampDestination + | ObservabilityS3Destination + | ObservabilitySentryDestination + | ObservabilitySnowflakeDestination + | ObservabilityWeaveDestination + | ObservabilityWebhookDestination +} +export const CreateObservabilityDestinationResponse = Schema.Struct({ + "data": Schema.Union([ + ObservabilityArizeDestination, + ObservabilityBraintrustDestination, + ObservabilityClickhouseDestination, + ObservabilityDatadogDestination, + ObservabilityGrafanaDestination, + ObservabilityLangfuseDestination, + ObservabilityLangsmithDestination, + ObservabilityNewrelicDestination, + ObservabilityOpikDestination, + ObservabilityOtelCollectorDestination, + ObservabilityPosthogDestination, + ObservabilityRampDestination, + ObservabilityS3Destination, + ObservabilitySentryDestination, + ObservabilitySnowflakeDestination, + ObservabilityWeaveDestination, + ObservabilityWebhookDestination + ], { mode: "oneOf" }).annotate({ "description": "The newly created observability destination." }) +}) +export type GetObservabilityDestinationResponse = { + readonly "data": + | ObservabilityArizeDestination + | ObservabilityBraintrustDestination + | ObservabilityClickhouseDestination + | ObservabilityDatadogDestination + | ObservabilityGrafanaDestination + | ObservabilityLangfuseDestination + | ObservabilityLangsmithDestination + | ObservabilityNewrelicDestination + | ObservabilityOpikDestination + | ObservabilityOtelCollectorDestination + | ObservabilityPosthogDestination + | ObservabilityRampDestination + | ObservabilityS3Destination + | ObservabilitySentryDestination + | ObservabilitySnowflakeDestination + | ObservabilityWeaveDestination + | ObservabilityWebhookDestination +} +export const GetObservabilityDestinationResponse = Schema.Struct({ + "data": Schema.Union([ + ObservabilityArizeDestination, + ObservabilityBraintrustDestination, + ObservabilityClickhouseDestination, + ObservabilityDatadogDestination, + ObservabilityGrafanaDestination, + ObservabilityLangfuseDestination, + ObservabilityLangsmithDestination, + ObservabilityNewrelicDestination, + ObservabilityOpikDestination, + ObservabilityOtelCollectorDestination, + ObservabilityPosthogDestination, + ObservabilityRampDestination, + ObservabilityS3Destination, + ObservabilitySentryDestination, + ObservabilitySnowflakeDestination, + ObservabilityWeaveDestination, + ObservabilityWebhookDestination + ], { mode: "oneOf" }).annotate({ "description": "The observability destination." }) +}) +export type ObservabilityDestination = + | ObservabilityArizeDestination + | ObservabilityBraintrustDestination + | ObservabilityClickhouseDestination + | ObservabilityDatadogDestination + | ObservabilityGrafanaDestination + | ObservabilityLangfuseDestination + | ObservabilityLangsmithDestination + | ObservabilityNewrelicDestination + | ObservabilityOpikDestination + | ObservabilityOtelCollectorDestination + | ObservabilityPosthogDestination + | ObservabilityRampDestination + | ObservabilityS3Destination + | ObservabilitySentryDestination + | ObservabilitySnowflakeDestination + | ObservabilityWeaveDestination + | ObservabilityWebhookDestination +export const ObservabilityDestination = Schema.Union([ + ObservabilityArizeDestination, + ObservabilityBraintrustDestination, + ObservabilityClickhouseDestination, + ObservabilityDatadogDestination, + ObservabilityGrafanaDestination, + ObservabilityLangfuseDestination, + ObservabilityLangsmithDestination, + ObservabilityNewrelicDestination, + ObservabilityOpikDestination, + ObservabilityOtelCollectorDestination, + ObservabilityPosthogDestination, + ObservabilityRampDestination, + ObservabilityS3Destination, + ObservabilitySentryDestination, + ObservabilitySnowflakeDestination, + ObservabilityWeaveDestination, + ObservabilityWebhookDestination +], { mode: "oneOf" }) +export type UpdateObservabilityDestinationResponse = { + readonly "data": + | ObservabilityArizeDestination + | ObservabilityBraintrustDestination + | ObservabilityClickhouseDestination + | ObservabilityDatadogDestination + | ObservabilityGrafanaDestination + | ObservabilityLangfuseDestination + | ObservabilityLangsmithDestination + | ObservabilityNewrelicDestination + | ObservabilityOpikDestination + | ObservabilityOtelCollectorDestination + | ObservabilityPosthogDestination + | ObservabilityRampDestination + | ObservabilityS3Destination + | ObservabilitySentryDestination + | ObservabilitySnowflakeDestination + | ObservabilityWeaveDestination + | ObservabilityWebhookDestination +} +export const UpdateObservabilityDestinationResponse = Schema.Struct({ + "data": Schema.Union([ + ObservabilityArizeDestination, + ObservabilityBraintrustDestination, + ObservabilityClickhouseDestination, + ObservabilityDatadogDestination, + ObservabilityGrafanaDestination, + ObservabilityLangfuseDestination, + ObservabilityLangsmithDestination, + ObservabilityNewrelicDestination, + ObservabilityOpikDestination, + ObservabilityOtelCollectorDestination, + ObservabilityPosthogDestination, + ObservabilityRampDestination, + ObservabilityS3Destination, + ObservabilitySentryDestination, + ObservabilitySnowflakeDestination, + ObservabilityWeaveDestination, + ObservabilityWebhookDestination + ], { mode: "oneOf" }).annotate({ "description": "The updated observability destination." }) +}) +export type Model = { + readonly "architecture": ModelArchitecture + readonly "canonical_slug": string + readonly "context_length": number + readonly "created": number + readonly "default_parameters": DefaultParameters + readonly "description"?: string + readonly "expiration_date"?: string + readonly "hugging_face_id"?: string + readonly "id": string + readonly "knowledge_cutoff"?: string + readonly "links": ModelLinks + readonly "name": string + readonly "per_request_limits": PerRequestLimits + readonly "pricing": PublicPricing + readonly "supported_parameters": ReadonlyArray + readonly "supported_voices": ReadonlyArray + readonly "top_provider": TopProviderInfo +} +export const Model = Schema.Struct({ + "architecture": ModelArchitecture, + "canonical_slug": Schema.String.annotate({ "description": "Canonical slug for the model" }), + "context_length": Schema.Number.annotate({ "description": "Maximum context length in tokens" }).check(Schema.isInt()), + "created": Schema.Number.annotate({ "description": "Unix timestamp of when the model was created" }).check( + Schema.isInt() + ), + "default_parameters": DefaultParameters, + "description": Schema.optionalKey(Schema.String.annotate({ "description": "Description of the model" })), + "expiration_date": Schema.optionalKey( + Schema.String.annotate({ + "description": + "The date after which the model may be removed. ISO 8601 date string (YYYY-MM-DD) or null if no expiration." + }) + ), + "hugging_face_id": Schema.optionalKey( + Schema.String.annotate({ "description": "Hugging Face model identifier, if applicable" }) + ), + "id": Schema.String.annotate({ "description": "Unique identifier for the model" }), + "knowledge_cutoff": Schema.optionalKey( + Schema.String.annotate({ + "description": + "The date up to which the model was trained on data. ISO 8601 date string (YYYY-MM-DD) or null if unknown." + }) + ), + "links": ModelLinks, + "name": Schema.String.annotate({ "description": "Display name of the model" }), + "per_request_limits": PerRequestLimits, + "pricing": PublicPricing, + "supported_parameters": Schema.Array(Parameter).annotate({ + "description": "List of supported parameters for this model" + }), + "supported_voices": Schema.Array(Schema.String).annotate({ + "description": "List of supported voice identifiers for TTS models. Null for non-TTS models." + }), + "top_provider": TopProviderInfo +}).annotate({ "description": "Information about an AI model available on OpenRouter" }) +export type FileParserPlugin = { + readonly "enabled"?: boolean + readonly "id": "file-parser" + readonly "pdf"?: PDFParserOptions +} +export const FileParserPlugin = Schema.Struct({ + "enabled": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": "Set to false to disable the file-parser plugin for this request. Defaults to true." + }) + ), + "id": Schema.Literal("file-parser"), + "pdf": Schema.optionalKey(PDFParserOptions) +}) +export type ProviderPreferences = { + readonly "allow_fallbacks"?: boolean + readonly "data_collection"?: "deny" | "allow" | null + readonly "enforce_distillable_text"?: boolean + readonly "ignore"?: ReadonlyArray + readonly "max_price"?: { + readonly "audio"?: string + readonly "completion"?: string + readonly "image"?: string + readonly "prompt"?: BigNumberUnion + readonly "request"?: string + } + readonly "only"?: ReadonlyArray + readonly "order"?: ReadonlyArray + readonly "preferred_max_latency"?: PreferredMaxLatency + readonly "preferred_min_throughput"?: PreferredMinThroughput + readonly "quantizations"?: ReadonlyArray + readonly "require_parameters"?: boolean + readonly "sort"?: ProviderSort | ProviderSortConfig | unknown + readonly "zdr"?: boolean +} +export const ProviderPreferences = Schema.Struct({ + "allow_fallbacks": Schema.optionalKey(Schema.Boolean.annotate({ + "description": + "Whether to allow backup providers to serve requests\n- true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider.\n- false: use only the primary/custom provider, and return the upstream error if it's unavailable.\n" + })), + "data_collection": Schema.optionalKey( + Schema.Union([Schema.Literal("deny"), Schema.Literal("allow"), Schema.Null]).annotate({ + "description": + "Data collection setting. If no available model provider meets the requirement, your request will return an error.\n- allow: (default) allow providers which store user data non-transiently and may train on it\n\n- deny: use only providers which do not collect user data." + }) + ), + "enforce_distillable_text": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used." + }) + ), + "ignore": Schema.optionalKey( + Schema.Array(Schema.Union([ProviderName, Schema.String])).annotate({ + "description": + "List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request." + }) + ), + "max_price": Schema.optionalKey( + Schema.Struct({ + "audio": Schema.optionalKey(Schema.String.annotate({ "description": "Price per audio unit" })), + "completion": Schema.optionalKey( + Schema.String.annotate({ "description": "Price per million completion tokens" }) + ), + "image": Schema.optionalKey(Schema.String.annotate({ "description": "Price per image" })), + "prompt": Schema.optionalKey(BigNumberUnion), + "request": Schema.optionalKey(Schema.String.annotate({ "description": "Price per request" })) + }).annotate({ + "description": + "The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion." + }) + ), + "only": Schema.optionalKey( + Schema.Array(Schema.Union([ProviderName, Schema.String])).annotate({ + "description": + "List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request." + }) + ), + "order": Schema.optionalKey( + Schema.Array(Schema.Union([ProviderName, Schema.String])).annotate({ + "description": + "An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message." + }) + ), + "preferred_max_latency": Schema.optionalKey(PreferredMaxLatency), + "preferred_min_throughput": Schema.optionalKey(PreferredMinThroughput), + "quantizations": Schema.optionalKey( + Schema.Array(Quantization).annotate({ "description": "A list of quantization levels to filter the provider by." }) + ), + "require_parameters": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest." + }) + ), + "sort": Schema.optionalKey( + Schema.Union([ProviderSort, ProviderSortConfig, Schema.Unknown]).annotate({ + "description": + "The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed." + }) + ), + "zdr": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used." + }) + ) +}).annotate({ + "description": "When multiple model providers are available, optionally indicate your routing preference." +}) +export type OpenRouterMetadata = { + readonly "attempt": number + readonly "attempts"?: ReadonlyArray + readonly "endpoints": EndpointsMetadata + readonly "is_byok": boolean + readonly "params"?: RouterParams + readonly "pipeline"?: ReadonlyArray + readonly "region": string + readonly "requested": string + readonly "strategy": RoutingStrategy + readonly "summary": string +} +export const OpenRouterMetadata = Schema.Struct({ + "attempt": Schema.Number.check(Schema.isInt()), + "attempts": Schema.optionalKey(Schema.Array(RouterAttempt)), + "endpoints": EndpointsMetadata, + "is_byok": Schema.Boolean, + "params": Schema.optionalKey(RouterParams), + "pipeline": Schema.optionalKey(Schema.Array(PipelineStage)), + "region": Schema.String, + "requested": Schema.String, + "strategy": RoutingStrategy, + "summary": Schema.String +}) +export type CreatePresetFromInferenceResponse = { readonly "data": PresetWithDesignatedVersion } +export const CreatePresetFromInferenceResponse = Schema.Struct({ "data": PresetWithDesignatedVersion }).annotate({ + "description": "Response containing the created preset with its designated version." +}) +export type ListEndpointsResponse = { + readonly "architecture": { + readonly "input_modalities": ReadonlyArray<"text" | "image" | "file" | "audio" | "video"> + readonly "instruct_type": + | "none" + | "airoboros" + | "alpaca" + | "alpaca-modif" + | "chatml" + | "claude" + | "code-llama" + | "gemma" + | "llama2" + | "llama3" + | "mistral" + | "nemotron" + | "neural" + | "openchat" + | "phi3" + | "rwkv" + | "vicuna" + | "zephyr" + | "deepseek-r1" + | "deepseek-v3.1" + | "qwq" + | "qwen3" + | null + readonly "modality": string + readonly "output_modalities": ReadonlyArray< + "text" | "image" | "embeddings" | "audio" | "video" | "rerank" | "speech" | "transcription" + > + readonly "tokenizer": + | "Router" + | "Media" + | "Other" + | "GPT" + | "Claude" + | "Gemini" + | "Gemma" + | "Grok" + | "Cohere" + | "Nova" + | "Qwen" + | "Yi" + | "DeepSeek" + | "Mistral" + | "Llama2" + | "Llama3" + | "Llama4" + | "PaLM" + | "RWKV" + | "Qwen3" + } + readonly "created": number + readonly "description": string + readonly "endpoints": ReadonlyArray + readonly "id": string + readonly "name": string +} +export const ListEndpointsResponse = Schema.Struct({ + "architecture": Schema.Struct({ + "input_modalities": Schema.Array( + Schema.Union([ + Schema.Literal("text"), + Schema.Literal("image"), + Schema.Literal("file"), + Schema.Literal("audio"), + Schema.Literal("video") + ]) + ).annotate({ "description": "Supported input modalities" }), + "instruct_type": Schema.Union([ + Schema.Literal("none").annotate({ "description": "Instruction format type" }), + Schema.Literal("airoboros").annotate({ "description": "Instruction format type" }), + Schema.Literal("alpaca").annotate({ "description": "Instruction format type" }), + Schema.Literal("alpaca-modif").annotate({ "description": "Instruction format type" }), + Schema.Literal("chatml").annotate({ "description": "Instruction format type" }), + Schema.Literal("claude").annotate({ "description": "Instruction format type" }), + Schema.Literal("code-llama").annotate({ "description": "Instruction format type" }), + Schema.Literal("gemma").annotate({ "description": "Instruction format type" }), + Schema.Literal("llama2").annotate({ "description": "Instruction format type" }), + Schema.Literal("llama3").annotate({ "description": "Instruction format type" }), + Schema.Literal("mistral").annotate({ "description": "Instruction format type" }), + Schema.Literal("nemotron").annotate({ "description": "Instruction format type" }), + Schema.Literal("neural").annotate({ "description": "Instruction format type" }), + Schema.Literal("openchat").annotate({ "description": "Instruction format type" }), + Schema.Literal("phi3").annotate({ "description": "Instruction format type" }), + Schema.Literal("rwkv").annotate({ "description": "Instruction format type" }), + Schema.Literal("vicuna").annotate({ "description": "Instruction format type" }), + Schema.Literal("zephyr").annotate({ "description": "Instruction format type" }), + Schema.Literal("deepseek-r1").annotate({ "description": "Instruction format type" }), + Schema.Literal("deepseek-v3.1").annotate({ "description": "Instruction format type" }), + Schema.Literal("qwq").annotate({ "description": "Instruction format type" }), + Schema.Literal("qwen3").annotate({ "description": "Instruction format type" }), + Schema.Union([Schema.Null]).annotate({ "description": "Instruction format type" }) + ]).annotate({ "description": "Instruction format type" }), + "modality": Schema.String.annotate({ "description": "Primary modality of the model" }), + "output_modalities": Schema.Array( + Schema.Union([ + Schema.Literal("text"), + Schema.Literal("image"), + Schema.Literal("embeddings"), + Schema.Literal("audio"), + Schema.Literal("video"), + Schema.Literal("rerank"), + Schema.Literal("speech"), + Schema.Literal("transcription") + ]) + ).annotate({ "description": "Supported output modalities" }), + "tokenizer": Schema.Union([ + Schema.Literal("Router").annotate({ "description": "Tokenizer type used by the model" }), + Schema.Literal("Media").annotate({ "description": "Tokenizer type used by the model" }), + Schema.Literal("Other").annotate({ "description": "Tokenizer type used by the model" }), + Schema.Literal("GPT").annotate({ "description": "Tokenizer type used by the model" }), + Schema.Literal("Claude").annotate({ "description": "Tokenizer type used by the model" }), + Schema.Literal("Gemini").annotate({ "description": "Tokenizer type used by the model" }), + Schema.Literal("Gemma").annotate({ "description": "Tokenizer type used by the model" }), + Schema.Literal("Grok").annotate({ "description": "Tokenizer type used by the model" }), + Schema.Literal("Cohere").annotate({ "description": "Tokenizer type used by the model" }), + Schema.Literal("Nova").annotate({ "description": "Tokenizer type used by the model" }), + Schema.Literal("Qwen").annotate({ "description": "Tokenizer type used by the model" }), + Schema.Literal("Yi").annotate({ "description": "Tokenizer type used by the model" }), + Schema.Literal("DeepSeek").annotate({ "description": "Tokenizer type used by the model" }), + Schema.Literal("Mistral").annotate({ "description": "Tokenizer type used by the model" }), + Schema.Literal("Llama2").annotate({ "description": "Tokenizer type used by the model" }), + Schema.Literal("Llama3").annotate({ "description": "Tokenizer type used by the model" }), + Schema.Literal("Llama4").annotate({ "description": "Tokenizer type used by the model" }), + Schema.Literal("PaLM").annotate({ "description": "Tokenizer type used by the model" }), + Schema.Literal("RWKV").annotate({ "description": "Tokenizer type used by the model" }), + Schema.Literal("Qwen3").annotate({ "description": "Tokenizer type used by the model" }) + ]).annotate({ "description": "Tokenizer type used by the model" }) + }).annotate({ "description": "Model architecture information" }), + "created": Schema.Number.annotate({ "description": "Unix timestamp of when the model was created" }).check( + Schema.isInt() + ), + "description": Schema.String.annotate({ "description": "Description of the model" }), + "endpoints": Schema.Array(PublicEndpoint).annotate({ "description": "List of available endpoints for this model" }), + "id": Schema.String.annotate({ "description": "Unique identifier for the model" }), + "name": Schema.String.annotate({ "description": "Display name of the model" }) +}).annotate({ "description": "List of available endpoints for a model" }) +export type ReasoningDetailUnion = ReasoningDetailSummary | ReasoningDetailEncrypted | ReasoningDetailText +export const ReasoningDetailUnion = Schema.Union([ + ReasoningDetailSummary, + ReasoningDetailEncrypted, + ReasoningDetailText +], { mode: "oneOf" }).annotate({ "description": "Reasoning detail union schema" }) +export type StopServerToolsWhen = ReadonlyArray +export const StopServerToolsWhen = Schema.Array(StopServerToolsWhenCondition).annotate({ + "description": + "Stop conditions for the server-tool agent loop. Any condition firing halts the loop (OR logic). When set, this overrides `max_tool_calls`." +}).check(Schema.isMinLength(1)) +export type AnnotationAddedEvent = { + readonly "annotation": OpenAIResponsesAnnotation + readonly "annotation_index": number + readonly "content_index": number + readonly "item_id": string + readonly "output_index": number + readonly "sequence_number": number + readonly "type": "response.output_text.annotation.added" +} +export const AnnotationAddedEvent = Schema.Struct({ + "annotation": OpenAIResponsesAnnotation, + "annotation_index": Schema.Number.check(Schema.isInt()), + "content_index": Schema.Number.check(Schema.isInt()), + "item_id": Schema.String, + "output_index": Schema.Number.check(Schema.isInt()), + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.output_text.annotation.added") +}).annotate({ "description": "Event emitted when a text annotation is added to output" }) +export type ResponseOutputText = { + readonly "annotations"?: ReadonlyArray + readonly "logprobs"?: ReadonlyArray< + { + readonly "bytes": ReadonlyArray + readonly "logprob": number + readonly "token": string + readonly "top_logprobs": ReadonlyArray< + { readonly "bytes": ReadonlyArray; readonly "logprob": number; readonly "token": string } + > + } + > + readonly "text": string + readonly "type": "output_text" +} +export const ResponseOutputText = Schema.Struct({ + "annotations": Schema.optionalKey(Schema.Array(OpenAIResponsesAnnotation)), + "logprobs": Schema.optionalKey(Schema.Array(Schema.Struct({ + "bytes": Schema.Array(Schema.Number.check(Schema.isInt())), + "logprob": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "token": Schema.String, + "top_logprobs": Schema.Array( + Schema.Struct({ + "bytes": Schema.Array(Schema.Number.check(Schema.isInt())), + "logprob": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "token": Schema.String + }) + ) + }))), + "text": Schema.String, + "type": Schema.Literal("output_text") +}) +export type WebFetchServerTool = { + readonly "parameters"?: WebFetchServerToolConfig + readonly "type": "openrouter:web_fetch" +} +export const WebFetchServerTool = Schema.Struct({ + "parameters": Schema.optionalKey(WebFetchServerToolConfig), + "type": Schema.Literal("openrouter:web_fetch") +}).annotate({ "description": "OpenRouter built-in server tool: fetches full content from a URL (web page or PDF)" }) +export type ChatWebSearchShorthand = { + readonly "allowed_domains"?: ReadonlyArray + readonly "engine"?: WebSearchEngineEnum + readonly "excluded_domains"?: ReadonlyArray + readonly "max_results"?: number + readonly "max_total_results"?: number + readonly "parameters"?: WebSearchConfig + readonly "search_context_size"?: SearchQualityLevel + readonly "type": "web_search" | "web_search_preview" | "web_search_preview_2025_03_11" | "web_search_2025_08_26" + readonly "user_location"?: WebSearchUserLocationServerTool +} +export const ChatWebSearchShorthand = Schema.Struct({ + "allowed_domains": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "description": + "Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded_domains." + }) + ), + "engine": Schema.optionalKey(WebSearchEngineEnum), + "excluded_domains": Schema.optionalKey( + Schema.Array(Schema.String).annotate({ + "description": + "Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed_domains." + }) + ), + "max_results": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search." + }).check(Schema.isInt()) + ), + "max_total_results": Schema.optionalKey( + Schema.Number.annotate({ + "description": + "Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified." + }).check(Schema.isInt()) + ), + "parameters": Schema.optionalKey(WebSearchConfig), + "search_context_size": Schema.optionalKey(SearchQualityLevel), + "type": Schema.Literals([ + "web_search", + "web_search_preview", + "web_search_preview_2025_03_11", + "web_search_2025_08_26" + ]), + "user_location": Schema.optionalKey(WebSearchUserLocationServerTool) +}).annotate({ + "description": "Web search tool using OpenAI Responses API syntax. Automatically converted to openrouter:web_search." +}) +export type OpenRouterWebSearchServerTool = { + readonly "parameters"?: WebSearchConfig + readonly "type": "openrouter:web_search" +} +export const OpenRouterWebSearchServerTool = Schema.Struct({ + "parameters": Schema.optionalKey(WebSearchConfig), + "type": Schema.Literal("openrouter:web_search") +}).annotate({ "description": "OpenRouter built-in server tool: searches the web for current information" }) +export type WebSearchServerTool_OpenRouter = { + readonly "parameters"?: WebSearchServerToolConfig + readonly "type": "openrouter:web_search" +} +export const WebSearchServerTool_OpenRouter = Schema.Struct({ + "parameters": Schema.optionalKey(WebSearchServerToolConfig), + "type": Schema.Literal("openrouter:web_search") +}).annotate({ "description": "OpenRouter built-in server tool: searches the web for current information" }) +export type AnthropicBashCodeExecutionToolResult = { + readonly "content": AnthropicBashCodeExecutionContent + readonly "tool_use_id": string + readonly "type": "bash_code_execution_tool_result" +} +export const AnthropicBashCodeExecutionToolResult = Schema.Struct({ + "content": AnthropicBashCodeExecutionContent, + "tool_use_id": Schema.String, + "type": Schema.Literal("bash_code_execution_tool_result") +}) +export type AnthropicSearchResultBlockParam = { + readonly "cache_control"?: AnthropicCacheControlDirective + readonly "citations"?: { readonly "enabled"?: boolean } + readonly "content": ReadonlyArray + readonly "source": string + readonly "title": string + readonly "type": "search_result" +} +export const AnthropicSearchResultBlockParam = Schema.Struct({ + "cache_control": Schema.optionalKey(AnthropicCacheControlDirective), + "citations": Schema.optionalKey(Schema.Struct({ "enabled": Schema.optionalKey(Schema.Boolean) })), + "content": Schema.Array(AnthropicTextBlockParam), + "source": Schema.String, + "title": Schema.String, + "type": Schema.Literal("search_result") +}) +export type ChatContentItems = + | ChatContentText + | ChatContentImage + | ChatContentAudio + | Legacy_ChatContentVideo + | ChatContentVideo + | ChatContentFile +export const ChatContentItems = Schema.Union([ + ChatContentText, + ChatContentImage, + ChatContentAudio, + Legacy_ChatContentVideo, + ChatContentVideo, + ChatContentFile +], { mode: "oneOf" }).annotate({ "description": "Content part for chat completion messages" }) +export type ChatDeveloperMessage = { + readonly "content": string | ReadonlyArray + readonly "name"?: string + readonly "role": "developer" +} +export const ChatDeveloperMessage = Schema.Struct({ + "content": Schema.Union([Schema.String, Schema.Array(ChatContentText)]).annotate({ + "description": "Developer message content" + }), + "name": Schema.optionalKey(Schema.String.annotate({ "description": "Optional name for the developer message" })), + "role": Schema.Literal("developer") +}).annotate({ "description": "Developer message" }) +export type ChatSystemMessage = { + readonly "content": string | ReadonlyArray + readonly "name"?: string + readonly "role": "system" +} +export const ChatSystemMessage = Schema.Struct({ + "content": Schema.Union([Schema.String, Schema.Array(ChatContentText)]).annotate({ + "description": "System message content" + }), + "name": Schema.optionalKey(Schema.String.annotate({ "description": "Optional name for the system message" })), + "role": Schema.Literal("system") +}).annotate({ "description": "System message for setting behavior" }) +export type AnthropicDocumentBlockParam = { + readonly "cache_control"?: AnthropicCacheControlDirective + readonly "citations"?: { readonly "enabled"?: boolean } + readonly "context"?: string + readonly "source": AnthropicBase64PdfSource | AnthropicPlainTextSource | { + readonly "content": string | ReadonlyArray + readonly "type": "content" + } | AnthropicUrlPdfSource + readonly "title"?: string + readonly "type": "document" +} +export const AnthropicDocumentBlockParam = Schema.Struct({ + "cache_control": Schema.optionalKey(AnthropicCacheControlDirective), + "citations": Schema.optionalKey(Schema.Struct({ "enabled": Schema.optionalKey(Schema.Boolean) })), + "context": Schema.optionalKey(Schema.String), + "source": Schema.Union([ + AnthropicBase64PdfSource, + AnthropicPlainTextSource, + Schema.Struct({ + "content": Schema.Union([ + Schema.String, + Schema.Array(Schema.Union([AnthropicTextBlockParam, AnthropicImageBlockParam], { mode: "oneOf" })) + ]), + "type": Schema.Literal("content") + }), + AnthropicUrlPdfSource + ], { mode: "oneOf" }), + "title": Schema.optionalKey(Schema.String), + "type": Schema.Literal("document") +}) +export type MessagesDeltaEvent = { + readonly "delta": { + readonly "container": AnthropicContainer + readonly "stop_details": AnthropicRefusalStopDetails + readonly "stop_reason": ORAnthropicStopReason + readonly "stop_sequence": string + } + readonly "type": "message_delta" + readonly "usage": { + readonly "cache_creation_input_tokens": number + readonly "cache_read_input_tokens": number + readonly "input_tokens": number + readonly "iterations"?: ReadonlyArray + readonly "output_tokens": number + readonly "server_tool_use": { readonly "web_fetch_requests": number; readonly "web_search_requests": number } + } +} +export const MessagesDeltaEvent = Schema.Struct({ + "delta": Schema.Struct({ + "container": AnthropicContainer, + "stop_details": AnthropicRefusalStopDetails, + "stop_reason": ORAnthropicStopReason, + "stop_sequence": Schema.String + }), + "type": Schema.Literal("message_delta"), + "usage": Schema.Struct({ + "cache_creation_input_tokens": Schema.Number.check(Schema.isInt()), + "cache_read_input_tokens": Schema.Number.check(Schema.isInt()), + "input_tokens": Schema.Number.check(Schema.isInt()), + "iterations": Schema.optionalKey(Schema.Array(AnthropicUsageIteration)), + "output_tokens": Schema.Number.check(Schema.isInt()), + "server_tool_use": Schema.Struct({ + "web_fetch_requests": Schema.Number.check(Schema.isInt()), + "web_search_requests": Schema.Number.check(Schema.isInt()) + }) + }) +}).annotate({ "description": "Event sent when the message metadata changes (e.g., stop_reason)" }) +export type AnthropicWebFetchContent = AnthropicWebFetchToolResultError | AnthropicWebFetchBlock +export const AnthropicWebFetchContent = Schema.Union([AnthropicWebFetchToolResultError, AnthropicWebFetchBlock], { + mode: "oneOf" +}) +export type AnthropicCodeExecutionToolResult = { + readonly "content": AnthropicCodeExecutionContent + readonly "tool_use_id": string + readonly "type": "code_execution_tool_result" +} +export const AnthropicCodeExecutionToolResult = Schema.Struct({ + "content": AnthropicCodeExecutionContent, + "tool_use_id": Schema.String, + "type": Schema.Literal("code_execution_tool_result") +}) +export type AnthropicToolSearchToolResult = { + readonly "content": AnthropicToolSearchContent + readonly "tool_use_id": string + readonly "type": "tool_search_tool_result" +} +export const AnthropicToolSearchToolResult = Schema.Struct({ + "content": AnthropicToolSearchContent, + "tool_use_id": Schema.String, + "type": Schema.Literal("tool_search_tool_result") +}) +export type ListGuardrailsResponse = { readonly "data": ReadonlyArray; readonly "total_count": number } +export const ListGuardrailsResponse = Schema.Struct({ + "data": Schema.Array(Guardrail).annotate({ "description": "List of guardrails" }), + "total_count": Schema.Number.annotate({ "description": "Total number of guardrails" }).check(Schema.isInt()) +}) +export type ListObservabilityDestinationsResponse = { + readonly "data": ReadonlyArray + readonly "total_count": number +} +export const ListObservabilityDestinationsResponse = Schema.Struct({ + "data": Schema.Array(ObservabilityDestination).annotate({ "description": "List of observability destinations." }), + "total_count": Schema.Number.annotate({ "description": "Total number of destinations matching the filters." }).check( + Schema.isInt() + ) +}) +export type ModelsListResponseData = ReadonlyArray +export const ModelsListResponseData = Schema.Array(Model).annotate({ "description": "List of available models" }) +export type MessagesStopEvent = { readonly "openrouter_metadata"?: OpenRouterMetadata; readonly "type": "message_stop" } +export const MessagesStopEvent = Schema.Struct({ + "openrouter_metadata": Schema.optionalKey(OpenRouterMetadata), + "type": Schema.Literal("message_stop") +}).annotate({ "description": "Event sent when the message is complete" }) +export type ChatReasoningDetails = ReadonlyArray +export const ChatReasoningDetails = Schema.Array(ReasoningDetailUnion).annotate({ + "description": "Reasoning details for extended thinking models" +}) +export type ChatStreamReasoningDetails = ReadonlyArray +export const ChatStreamReasoningDetails = Schema.Array(ReasoningDetailUnion).annotate({ + "description": "Reasoning details for extended thinking models" +}) +export type ContentPartAddedEvent = { + readonly "content_index": number + readonly "item_id": string + readonly "output_index": number + readonly "part": ResponseOutputText | ReasoningTextContent | OpenAIResponsesRefusalContent + readonly "sequence_number": number + readonly "type": "response.content_part.added" +} +export const ContentPartAddedEvent = Schema.Struct({ + "content_index": Schema.Number.check(Schema.isInt()), + "item_id": Schema.String, + "output_index": Schema.Number.check(Schema.isInt()), + "part": Schema.Union([ResponseOutputText, ReasoningTextContent, OpenAIResponsesRefusalContent]), + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.content_part.added") +}).annotate({ "description": "Event emitted when a new content part is added to an output item" }) +export type ContentPartDoneEvent = { + readonly "content_index": number + readonly "item_id": string + readonly "output_index": number + readonly "part": ResponseOutputText | ReasoningTextContent | OpenAIResponsesRefusalContent + readonly "sequence_number": number + readonly "type": "response.content_part.done" +} +export const ContentPartDoneEvent = Schema.Struct({ + "content_index": Schema.Number.check(Schema.isInt()), + "item_id": Schema.String, + "output_index": Schema.Number.check(Schema.isInt()), + "part": Schema.Union([ResponseOutputText, ReasoningTextContent, OpenAIResponsesRefusalContent]), + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.content_part.done") +}).annotate({ "description": "Event emitted when a content part is complete" }) +export type Inputs = + | string + | ReadonlyArray< + | ReasoningItem + | EasyInputMessage + | InputMessageItem + | FunctionCallItem + | FunctionCallOutputItem + | ApplyPatchCallItem + | ApplyPatchCallOutputItem + | { + readonly "content": + | ReadonlyArray< + { + readonly "annotations"?: ReadonlyArray< + { + readonly "file_id": string + readonly "filename": string + readonly "index": number + readonly "type": "file_citation" + } | { + readonly "end_index": number + readonly "start_index": number + readonly "title": string + readonly "type": never + readonly "url": string + readonly "file_id": string + readonly "filename": string + readonly "index": number + } | { + readonly "file_id": string + readonly "index": number + readonly "type": never + readonly "filename": string + } | { + readonly "file_id": string + readonly "filename": string + readonly "index": number + readonly "type": never + readonly "end_index": number + readonly "start_index": number + readonly "title": string + readonly "url": string + } | { + readonly "end_index": number + readonly "start_index": number + readonly "title": string + readonly "type": "url_citation" + readonly "url": string + } | { + readonly "file_id": string + readonly "index": number + readonly "type": never + readonly "end_index": number + readonly "start_index": number + readonly "title": string + readonly "url": string + } | { + readonly "file_id": string + readonly "filename": string + readonly "index": number + readonly "type": never + } | { + readonly "end_index": number + readonly "start_index": number + readonly "title": string + readonly "type": never + readonly "url": string + readonly "file_id": string + readonly "index": number + } | { readonly "file_id": string; readonly "index": number; readonly "type": "file_path" } + > + readonly "logprobs"?: ReadonlyArray< + { + readonly "bytes": ReadonlyArray + readonly "logprob": number + readonly "token": string + readonly "top_logprobs": ReadonlyArray< + { readonly "bytes": ReadonlyArray; readonly "logprob": number; readonly "token": string } + > + } + > + readonly "text": string + readonly "type": "output_text" + } | { + readonly "refusal": string + readonly "type": never + readonly "annotations"?: ReadonlyArray + readonly "logprobs"?: ReadonlyArray< + { + readonly "bytes": ReadonlyArray + readonly "logprob": number + readonly "token": string + readonly "top_logprobs": ReadonlyArray< + { readonly "bytes": ReadonlyArray; readonly "logprob": number; readonly "token": string } + > + } + > + readonly "text": string + } | { + readonly "annotations"?: ReadonlyArray + readonly "logprobs"?: ReadonlyArray< + { + readonly "bytes": ReadonlyArray + readonly "logprob": number + readonly "token": string + readonly "top_logprobs": ReadonlyArray< + { readonly "bytes": ReadonlyArray; readonly "logprob": number; readonly "token": string } + > + } + > + readonly "text": string + readonly "type": never + readonly "refusal": string + } | { readonly "refusal": string; readonly "type": "refusal" } + > + | ReadonlyArray + readonly "id": string + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "type": "message" + } + | { + readonly "content"?: ReadonlyArray<{ readonly "text": string; readonly "type": "reasoning_text" }> + readonly "encrypted_content"?: string + readonly "id": string + readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "summary": ReadonlyArray<{ readonly "text": string; readonly "type": "summary_text" }> + readonly "type": "reasoning" + readonly "format"?: ReasoningFormat + readonly "signature"?: string + } + | OutputFunctionCallItem + | OutputCustomToolCallItem + | OutputWebSearchCallItem + | OutputFileSearchCallItem + | OutputImageGenerationCallItem + | OutputCodeInterpreterCallItem + | OutputComputerCallItem + | OutputDatetimeItem + | OutputWebSearchServerToolItem + | OutputCodeInterpreterServerToolItem + | OutputFileSearchServerToolItem + | OutputImageGenerationServerToolItem + | OutputBrowserUseServerToolItem + | OutputBashServerToolItem + | OutputTextEditorServerToolItem + | OutputApplyPatchServerToolItem + | OutputWebFetchServerToolItem + | OutputToolSearchServerToolItem + | OutputMemoryServerToolItem + | OutputMcpServerToolItem + | OutputSearchModelsServerToolItem + | LocalShellCallItem + | LocalShellCallOutputItem + | ShellCallItem + | ShellCallOutputItem + | McpListToolsItem + | McpApprovalRequestItem + | McpApprovalResponseItem + | McpCallItem + | CustomToolCallItem + | CustomToolCallOutputItem + | CompactionItem + | ItemReferenceItem + > +export const Inputs = Schema.Union([ + Schema.String, + Schema.Array( + Schema.Union([ + ReasoningItem, + EasyInputMessage, + InputMessageItem, + FunctionCallItem, + FunctionCallOutputItem, + ApplyPatchCallItem, + ApplyPatchCallOutputItem, + Schema.Struct({ + "content": Schema.Union([ + Schema.Array(Schema.Union([ + Schema.Union([ + Schema.Struct({ + "annotations": Schema.optionalKey( + Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + "file_id": Schema.String, + "filename": Schema.String, + "index": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("file_citation") + }), + Schema.Struct({ + "end_index": Schema.Number.check(Schema.isInt()), + "start_index": Schema.Number.check(Schema.isInt()), + "title": Schema.String, + "type": Schema.Never, + "url": Schema.String, + "file_id": Schema.String, + "filename": Schema.String, + "index": Schema.Number.check(Schema.isInt()) + }), + Schema.Struct({ + "file_id": Schema.String, + "index": Schema.Number.check(Schema.isInt()), + "type": Schema.Never, + "filename": Schema.String + }) + ]), + Schema.Union([ + Schema.Struct({ + "file_id": Schema.String, + "filename": Schema.String, + "index": Schema.Number.check(Schema.isInt()), + "type": Schema.Never, + "end_index": Schema.Number.check(Schema.isInt()), + "start_index": Schema.Number.check(Schema.isInt()), + "title": Schema.String, + "url": Schema.String + }), + Schema.Struct({ + "end_index": Schema.Number.check(Schema.isInt()), + "start_index": Schema.Number.check(Schema.isInt()), + "title": Schema.String, + "type": Schema.Literal("url_citation"), + "url": Schema.String + }), + Schema.Struct({ + "file_id": Schema.String, + "index": Schema.Number.check(Schema.isInt()), + "type": Schema.Never, + "end_index": Schema.Number.check(Schema.isInt()), + "start_index": Schema.Number.check(Schema.isInt()), + "title": Schema.String, + "url": Schema.String + }) + ]), + Schema.Union([ + Schema.Struct({ + "file_id": Schema.String, + "filename": Schema.String, + "index": Schema.Number.check(Schema.isInt()), + "type": Schema.Never + }), + Schema.Struct({ + "end_index": Schema.Number.check(Schema.isInt()), + "start_index": Schema.Number.check(Schema.isInt()), + "title": Schema.String, + "type": Schema.Never, + "url": Schema.String, + "file_id": Schema.String, + "index": Schema.Number.check(Schema.isInt()) + }), + Schema.Struct({ + "file_id": Schema.String, + "index": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("file_path") + }) + ]) + ]) + ) + ), + "logprobs": Schema.optionalKey(Schema.Array(Schema.Struct({ + "bytes": Schema.Array(Schema.Number.check(Schema.isInt())), + "logprob": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "token": Schema.String, + "top_logprobs": Schema.Array( + Schema.Struct({ + "bytes": Schema.Array(Schema.Number.check(Schema.isInt())), + "logprob": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "token": Schema.String + }) + ) + }))), + "text": Schema.String, + "type": Schema.Literal("output_text") + }), + Schema.Struct({ + "refusal": Schema.String, + "type": Schema.Never, + "annotations": Schema.optionalKey(Schema.Array(OpenAIResponsesAnnotation)), + "logprobs": Schema.optionalKey(Schema.Array(Schema.Struct({ + "bytes": Schema.Array(Schema.Number.check(Schema.isInt())), + "logprob": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "token": Schema.String, + "top_logprobs": Schema.Array( + Schema.Struct({ + "bytes": Schema.Array(Schema.Number.check(Schema.isInt())), + "logprob": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "token": Schema.String + }) + ) + }))), + "text": Schema.String + }) + ]), + Schema.Union([ + Schema.Struct({ + "annotations": Schema.optionalKey(Schema.Array(OpenAIResponsesAnnotation)), + "logprobs": Schema.optionalKey(Schema.Array(Schema.Struct({ + "bytes": Schema.Array(Schema.Number.check(Schema.isInt())), + "logprob": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "token": Schema.String, + "top_logprobs": Schema.Array( + Schema.Struct({ + "bytes": Schema.Array(Schema.Number.check(Schema.isInt())), + "logprob": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "token": Schema.String + }) + ) + }))), + "text": Schema.String, + "type": Schema.Never, + "refusal": Schema.String + }), + Schema.Struct({ "refusal": Schema.String, "type": Schema.Literal("refusal") }) + ]) + ])), + Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])) + ]), + "id": Schema.String, + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant"), + "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])), + "type": Schema.Literal("message") + }).annotate({ "description": "An output message item" }), + Schema.Struct({ + "content": Schema.optionalKey( + Schema.Array(Schema.Struct({ "text": Schema.String, "type": Schema.Literal("reasoning_text") })) + ), + "encrypted_content": Schema.optionalKey(Schema.String), + "id": Schema.String, + "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])), + "summary": Schema.Array(Schema.Struct({ "text": Schema.String, "type": Schema.Literal("summary_text") })), + "type": Schema.Literal("reasoning"), + "format": Schema.optionalKey(ReasoningFormat), + "signature": Schema.optionalKey( + Schema.String.annotate({ "description": "A signature for the reasoning content, used for verification" }) + ) + }).annotate({ "description": "An output item containing reasoning" }), + OutputFunctionCallItem, + OutputCustomToolCallItem, + OutputWebSearchCallItem, + OutputFileSearchCallItem, + OutputImageGenerationCallItem, + OutputCodeInterpreterCallItem, + OutputComputerCallItem, + OutputDatetimeItem, + OutputWebSearchServerToolItem, + OutputCodeInterpreterServerToolItem, + OutputFileSearchServerToolItem, + OutputImageGenerationServerToolItem, + OutputBrowserUseServerToolItem, + OutputBashServerToolItem, + OutputTextEditorServerToolItem, + OutputApplyPatchServerToolItem, + OutputWebFetchServerToolItem, + OutputToolSearchServerToolItem, + OutputMemoryServerToolItem, + OutputMcpServerToolItem, + OutputSearchModelsServerToolItem, + LocalShellCallItem, + LocalShellCallOutputItem, + ShellCallItem, + ShellCallOutputItem, + McpListToolsItem, + McpApprovalRequestItem, + McpApprovalResponseItem, + McpCallItem, + CustomToolCallItem, + CustomToolCallOutputItem, + CompactionItem, + ItemReferenceItem + ]) + ) +]).annotate({ "description": "Input for a response request - can be a string or array of items" }) +export type OutputMessage = { + readonly "content": ReadonlyArray + readonly "id": string + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "type": "message" +} +export const OutputMessage = Schema.Struct({ + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "id": Schema.String, + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant"), + "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])), + "type": Schema.Literal("message") +}) +export type OutputMessageItem = { + readonly "content": ReadonlyArray + readonly "id": string + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "type": "message" +} +export const OutputMessageItem = Schema.Struct({ + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "id": Schema.String, + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant"), + "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])), + "type": Schema.Literal("message") +}).annotate({ "description": "An output message item" }) +export type ChatFunctionTool = + | { + readonly "cache_control"?: ChatContentCacheControl + readonly "function": { + readonly "description"?: string + readonly "name": string + readonly "parameters"?: {} + readonly "strict"?: boolean + } + readonly "type": "function" + } + | DatetimeServerTool + | ImageGenerationServerTool_OpenRouter + | ChatSearchModelsServerTool + | WebFetchServerTool + | OpenRouterWebSearchServerTool + | ChatWebSearchShorthand +export const ChatFunctionTool = Schema.Union([ + Schema.Struct({ + "cache_control": Schema.optionalKey(ChatContentCacheControl), + "function": Schema.Struct({ + "description": Schema.optionalKey( + Schema.String.annotate({ "description": "Function description for the model" }) + ), + "name": Schema.String.annotate({ + "description": "Function name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars)" + }).check(Schema.isMaxLength(64)), + "parameters": Schema.optionalKey( + Schema.Struct({}).annotate({ "description": "Function parameters as JSON Schema object" }) + ), + "strict": Schema.optionalKey(Schema.Boolean.annotate({ "description": "Enable strict schema adherence" })) + }).annotate({ "description": "Function definition for tool calling" }), + "type": Schema.Literal("function") + }), + DatetimeServerTool, + ImageGenerationServerTool_OpenRouter, + ChatSearchModelsServerTool, + WebFetchServerTool, + OpenRouterWebSearchServerTool, + ChatWebSearchShorthand +]).annotate({ + "description": "Tool definition for function calling (regular function or OpenRouter built-in server tool)" +}) +export type ChatToolMessage = { + readonly "content": string | ReadonlyArray + readonly "role": "tool" + readonly "tool_call_id": string +} +export const ChatToolMessage = Schema.Struct({ + "content": Schema.Union([Schema.String, Schema.Array(ChatContentItems)]).annotate({ + "description": "Tool response content" + }), + "role": Schema.Literal("tool"), + "tool_call_id": Schema.String.annotate({ + "description": "ID of the assistant message tool call this message responds to" + }) +}).annotate({ "description": "Tool response message" }) +export type ChatUserMessage = { + readonly "content": string | ReadonlyArray + readonly "name"?: string + readonly "role": "user" +} +export const ChatUserMessage = Schema.Struct({ + "content": Schema.Union([Schema.String, Schema.Array(ChatContentItems)]).annotate({ + "description": "User message content" + }), + "name": Schema.optionalKey(Schema.String.annotate({ "description": "Optional name for the user" })), + "role": Schema.Literal("user") +}).annotate({ "description": "User message" }) +export type MessagesMessageParam = { + readonly "content": + | string + | ReadonlyArray< + | AnthropicTextBlockParam + | AnthropicImageBlockParam + | AnthropicDocumentBlockParam + | { + readonly "cache_control"?: AnthropicCacheControlDirective + readonly "id": string + readonly "input"?: unknown + readonly "name": string + readonly "type": "tool_use" + } + | { + readonly "cache_control"?: AnthropicCacheControlDirective + readonly "content"?: + | string + | ReadonlyArray< + | AnthropicTextBlockParam + | AnthropicImageBlockParam + | { readonly "tool_name": string; readonly "type": "tool_reference" } + | AnthropicSearchResultBlockParam + | AnthropicDocumentBlockParam + > + readonly "is_error"?: boolean + readonly "tool_use_id": string + readonly "type": "tool_result" + } + | { readonly "signature": string; readonly "thinking": string; readonly "type": "thinking" } + | { readonly "data": string; readonly "type": "redacted_thinking" } + | { + readonly "cache_control"?: AnthropicCacheControlDirective + readonly "id": string + readonly "input"?: unknown + readonly "name": string + readonly "type": "server_tool_use" + } + | { + readonly "cache_control"?: AnthropicCacheControlDirective + readonly "content": ReadonlyArray | { + readonly "error_code": + | "invalid_tool_input" + | "unavailable" + | "max_uses_exceeded" + | "too_many_requests" + | "query_too_long" + readonly "type": "web_search_tool_result_error" + } + readonly "tool_use_id": string + readonly "type": "web_search_tool_result" + } + | AnthropicSearchResultBlockParam + | { + readonly "cache_control"?: AnthropicCacheControlDirective + readonly "content": string + readonly "type": "compaction" + } + | MessagesAdvisorToolResultBlock + > + readonly "role": "user" | "assistant" +} +export const MessagesMessageParam = Schema.Struct({ + "content": Schema.Union([ + Schema.String, + Schema.Array( + Schema.Union([ + AnthropicTextBlockParam, + AnthropicImageBlockParam, + AnthropicDocumentBlockParam, + Schema.Struct({ + "cache_control": Schema.optionalKey(AnthropicCacheControlDirective), + "id": Schema.String, + "input": Schema.optionalKey(Schema.Unknown), + "name": Schema.String, + "type": Schema.Literal("tool_use") + }), + Schema.Struct({ + "cache_control": Schema.optionalKey(AnthropicCacheControlDirective), + "content": Schema.optionalKey( + Schema.Union([ + Schema.String, + Schema.Array( + Schema.Union([ + AnthropicTextBlockParam, + AnthropicImageBlockParam, + Schema.Struct({ "tool_name": Schema.String, "type": Schema.Literal("tool_reference") }), + AnthropicSearchResultBlockParam, + AnthropicDocumentBlockParam + ]) + ) + ]) + ), + "is_error": Schema.optionalKey(Schema.Boolean), + "tool_use_id": Schema.String, + "type": Schema.Literal("tool_result") + }), + Schema.Struct({ "signature": Schema.String, "thinking": Schema.String, "type": Schema.Literal("thinking") }), + Schema.Struct({ "data": Schema.String, "type": Schema.Literal("redacted_thinking") }), + Schema.Struct({ + "cache_control": Schema.optionalKey(AnthropicCacheControlDirective), + "id": Schema.String, + "input": Schema.optionalKey(Schema.Unknown), + "name": Schema.String, + "type": Schema.Literal("server_tool_use") + }), + Schema.Struct({ + "cache_control": Schema.optionalKey(AnthropicCacheControlDirective), + "content": Schema.Union([ + Schema.Array(AnthropicWebSearchResultBlockParam), + Schema.Struct({ + "error_code": Schema.Literals([ + "invalid_tool_input", + "unavailable", + "max_uses_exceeded", + "too_many_requests", + "query_too_long" + ]), + "type": Schema.Literal("web_search_tool_result_error") + }) + ]), + "tool_use_id": Schema.String, + "type": Schema.Literal("web_search_tool_result") + }), + AnthropicSearchResultBlockParam, + Schema.Struct({ + "cache_control": Schema.optionalKey(AnthropicCacheControlDirective), + "content": Schema.String, + "type": Schema.Literal("compaction") + }), + MessagesAdvisorToolResultBlock + ], { mode: "oneOf" }) + ) + ]), + "role": Schema.Literals(["user", "assistant"]) +}).annotate({ "description": "Anthropic message with OpenRouter extensions" }) +export type AnthropicWebFetchToolResult = { + readonly "caller": AnthropicCaller + readonly "content": AnthropicWebFetchContent + readonly "tool_use_id": string + readonly "type": "web_fetch_tool_result" +} +export const AnthropicWebFetchToolResult = Schema.Struct({ + "caller": AnthropicCaller, + "content": AnthropicWebFetchContent, + "tool_use_id": Schema.String, + "type": Schema.Literal("web_fetch_tool_result") +}) +export type ModelsListResponse = { readonly "data": ModelsListResponseData } +export const ModelsListResponse = Schema.Struct({ "data": ModelsListResponseData }).annotate({ + "description": "List of available models" +}) +export type ChatAssistantMessage = { + readonly "audio"?: ChatAudioOutput + readonly "content"?: string | ReadonlyArray | unknown + readonly "images"?: + | ReadonlyArray<{ readonly "type": "image_url"; readonly "image_url": { readonly "url": string } }> + | null + readonly "name"?: string + readonly "reasoning"?: string + readonly "reasoning_details"?: ChatReasoningDetails + readonly "refusal"?: string + readonly "role": "assistant" + readonly "tool_calls"?: ReadonlyArray + readonly "annotations"?: + | ReadonlyArray< + { + readonly "type": "url_citation" + readonly "url_citation": { + readonly "url": string + readonly "title"?: string + readonly "start_index"?: number + readonly "end_index"?: number + readonly "content"?: string + } + } | { + readonly "type": "file_annotation" + readonly "file_annotation": { readonly "file_id": string; readonly "quote"?: string } + } | { + readonly "type": "file" + readonly "file": { + readonly "hash": string + readonly "name": string + readonly "content"?: ReadonlyArray<{ readonly "type": string; readonly "text"?: string }> + } + } + > + | null +} +export const ChatAssistantMessage = Schema.Struct({ + "audio": Schema.optionalKey(ChatAudioOutput), + "content": Schema.optionalKey( + Schema.Union([Schema.String, Schema.Array(ChatContentItems), Schema.Unknown]).annotate({ + "description": "Assistant message content" + }) + ), + "images": Schema.optionalKey( + Schema.Union([ + Schema.Array( + Schema.Struct({ "type": Schema.Literal("image_url"), "image_url": Schema.Struct({ "url": Schema.String }) }) + ), + Schema.Null + ]) + ), + "name": Schema.optionalKey(Schema.String.annotate({ "description": "Optional name for the assistant" })), + "reasoning": Schema.optionalKey(Schema.String.annotate({ "description": "Reasoning output" })), + "reasoning_details": Schema.optionalKey(ChatReasoningDetails), + "refusal": Schema.optionalKey(Schema.String.annotate({ "description": "Refusal message if content was refused" })), + "role": Schema.Literal("assistant"), + "tool_calls": Schema.optionalKey( + Schema.Array(ChatToolCall).annotate({ "description": "Tool calls made by the assistant" }) + ), + "annotations": Schema.optionalKey(Schema.Union([ + Schema.Array(Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("url_citation"), + "url_citation": Schema.Struct({ + "url": Schema.String, + "title": Schema.optionalKey(Schema.String), + "start_index": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), + "end_index": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), + "content": Schema.optionalKey(Schema.String) + }) + }), + Schema.Struct({ + "type": Schema.Literal("file_annotation"), + "file_annotation": Schema.Struct({ "file_id": Schema.String, "quote": Schema.optionalKey(Schema.String) }) + }), + Schema.Struct({ + "type": Schema.Literal("file"), + "file": Schema.Struct({ + "hash": Schema.String, + "name": Schema.String, + "content": Schema.optionalKey( + Schema.Array(Schema.Struct({ "type": Schema.String, "text": Schema.optionalKey(Schema.String) })) + ) + }) + }) + ], { mode: "oneOf" })), + Schema.Null + ])) +}).annotate({ "description": "Assistant message for requests and responses" }) +export type ChatStreamDelta = { + readonly "audio"?: { + readonly "data"?: string + readonly "expires_at"?: number + readonly "id"?: string + readonly "transcript"?: string + } + readonly "content"?: string + readonly "reasoning"?: string + readonly "reasoning_details"?: ChatStreamReasoningDetails + readonly "refusal"?: string + readonly "role"?: "assistant" + readonly "tool_calls"?: ReadonlyArray + readonly "images"?: + | ReadonlyArray<{ readonly "type": "image_url"; readonly "image_url": { readonly "url": string } }> + | null + readonly "annotations"?: + | ReadonlyArray< + { + readonly "type": "url_citation" + readonly "url_citation": { + readonly "url": string + readonly "title"?: string + readonly "start_index"?: number + readonly "end_index"?: number + readonly "content"?: string + } + } | { + readonly "type": "file_annotation" + readonly "file_annotation": { readonly "file_id": string; readonly "quote"?: string } + } | { + readonly "type": "file" + readonly "file": { + readonly "hash": string + readonly "name": string + readonly "content"?: ReadonlyArray<{ readonly "type": string; readonly "text"?: string }> + } + } + > + | null +} +export const ChatStreamDelta = Schema.Struct({ + "audio": Schema.optionalKey( + Schema.Struct({ + "data": Schema.optionalKey(Schema.String.annotate({ "description": "Base64 encoded audio data" })), + "expires_at": Schema.optionalKey( + Schema.Number.annotate({ "description": "Audio expiration timestamp" }).check(Schema.isInt()) + ), + "id": Schema.optionalKey(Schema.String.annotate({ "description": "Audio output identifier" })), + "transcript": Schema.optionalKey(Schema.String.annotate({ "description": "Audio transcript" })) + }).annotate({ "description": "Audio output data" }) + ), + "content": Schema.optionalKey(Schema.String.annotate({ "description": "Message content delta" })), + "reasoning": Schema.optionalKey(Schema.String.annotate({ "description": "Reasoning content delta" })), + "reasoning_details": Schema.optionalKey(ChatStreamReasoningDetails), + "refusal": Schema.optionalKey(Schema.String.annotate({ "description": "Refusal message delta" })), + "role": Schema.optionalKey(Schema.Literal("assistant").annotate({ "description": "The role of the message author" })), + "tool_calls": Schema.optionalKey(Schema.Array(ChatStreamToolCall).annotate({ "description": "Tool calls delta" })), + "images": Schema.optionalKey( + Schema.Union([ + Schema.Array( + Schema.Struct({ "type": Schema.Literal("image_url"), "image_url": Schema.Struct({ "url": Schema.String }) }) + ), + Schema.Null + ]) + ), + "annotations": Schema.optionalKey(Schema.Union([ + Schema.Array(Schema.Union([ + Schema.Struct({ + "type": Schema.Literal("url_citation"), + "url_citation": Schema.Struct({ + "url": Schema.String, + "title": Schema.optionalKey(Schema.String), + "start_index": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), + "end_index": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), + "content": Schema.optionalKey(Schema.String) + }) + }), + Schema.Struct({ + "type": Schema.Literal("file_annotation"), + "file_annotation": Schema.Struct({ "file_id": Schema.String, "quote": Schema.optionalKey(Schema.String) }) + }), + Schema.Struct({ + "type": Schema.Literal("file"), + "file": Schema.Struct({ + "hash": Schema.String, + "name": Schema.String, + "content": Schema.optionalKey( + Schema.Array(Schema.Struct({ "type": Schema.String, "text": Schema.optionalKey(Schema.String) })) + ) + }) + }) + ], { mode: "oneOf" })), + Schema.Null + ])) +}).annotate({ "description": "Delta changes in streaming response" }) +export type ResponsesRequest = { + readonly "background"?: boolean + readonly "cache_control"?: AnthropicCacheControlDirective + readonly "frequency_penalty"?: number + readonly "image_config"?: ImageConfig + readonly "include"?: ReadonlyArray + readonly "input"?: Inputs + readonly "instructions"?: string + readonly "max_output_tokens"?: number + readonly "max_tool_calls"?: number + readonly "metadata"?: RequestMetadata + readonly "modalities"?: ReadonlyArray + readonly "model"?: string + readonly "models"?: ReadonlyArray + readonly "parallel_tool_calls"?: boolean + readonly "plugins"?: ReadonlyArray< + | AutoRouterPlugin + | ModerationPlugin + | WebSearchPlugin + | WebFetchPlugin + | FileParserPlugin + | ResponseHealingPlugin + | ContextCompressionPlugin + | ParetoRouterPlugin + | FusionPlugin + > + readonly "presence_penalty"?: number + readonly "previous_response_id"?: string + readonly "prompt"?: StoredPromptTemplate + readonly "prompt_cache_key"?: string + readonly "provider"?: ProviderPreferences + readonly "reasoning"?: ReasoningConfig + readonly "route"?: DeprecatedRoute + readonly "safety_identifier"?: string + readonly "service_tier"?: "auto" | "default" | "flex" | "priority" | "scale" | null + readonly "session_id"?: string + readonly "stop_server_tools_when"?: StopServerToolsWhen + readonly "store"?: false + readonly "stream"?: boolean + readonly "temperature"?: number + readonly "text"?: TextExtendedConfig + readonly "tool_choice"?: OpenAIResponsesToolChoice + readonly "tools"?: ReadonlyArray< + | { + readonly "description"?: string + readonly "name": string + readonly "parameters": {} + readonly "strict"?: boolean + readonly "type": "function" + } + | Preview_WebSearchServerTool + | Preview_20250311_WebSearchServerTool + | Legacy_WebSearchServerTool + | WebSearchServerTool + | FileSearchServerTool + | ComputerUseServerTool + | CodeInterpreterServerTool + | McpServerTool + | ImageGenerationServerTool + | CodexLocalShellTool + | ShellServerTool + | ApplyPatchServerTool + | CustomTool + | DatetimeServerTool + | FusionServerTool_OpenRouter + | ImageGenerationServerTool_OpenRouter + | ChatSearchModelsServerTool + | WebFetchServerTool + | WebSearchServerTool_OpenRouter + | ApplyPatchServerTool_OpenRouter + > + readonly "top_k"?: number + readonly "top_logprobs"?: number + readonly "top_p"?: number + readonly "trace"?: TraceConfig + readonly "truncation"?: OpenAIResponsesTruncation + readonly "user"?: string +} +export const ResponsesRequest = Schema.Struct({ + "background": Schema.optionalKey(Schema.Boolean), + "cache_control": Schema.optionalKey(AnthropicCacheControlDirective), + "frequency_penalty": Schema.optionalKey(Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite())), + "image_config": Schema.optionalKey(ImageConfig), + "include": Schema.optionalKey(Schema.Array(ResponseIncludesEnum)), + "input": Schema.optionalKey(Inputs), + "instructions": Schema.optionalKey(Schema.String), + "max_output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "max_tool_calls": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "metadata": Schema.optionalKey(RequestMetadata), + "modalities": Schema.optionalKey( + Schema.Array(OutputModalityEnum).annotate({ + "description": "Output modalities for the response. Supported values are \"text\" and \"image\"." + }) + ), + "model": Schema.optionalKey(Schema.String), + "models": Schema.optionalKey(Schema.Array(Schema.String)), + "parallel_tool_calls": Schema.optionalKey(Schema.Boolean), + "plugins": Schema.optionalKey( + Schema.Array( + Schema.Union([ + AutoRouterPlugin, + ModerationPlugin, + WebSearchPlugin, + WebFetchPlugin, + FileParserPlugin, + ResponseHealingPlugin, + ContextCompressionPlugin, + ParetoRouterPlugin, + FusionPlugin + ], { mode: "oneOf" }) + ).annotate({ "description": "Plugins you want to enable for this request, including their settings." }) + ), + "presence_penalty": Schema.optionalKey(Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite())), + "previous_response_id": Schema.optionalKey(Schema.String), + "prompt": Schema.optionalKey(StoredPromptTemplate), + "prompt_cache_key": Schema.optionalKey(Schema.String), + "provider": Schema.optionalKey(ProviderPreferences), + "reasoning": Schema.optionalKey(ReasoningConfig), + "route": Schema.optionalKey(DeprecatedRoute), + "safety_identifier": Schema.optionalKey(Schema.String), + "service_tier": Schema.optionalKey( + Schema.Union([ + Schema.Literal("auto"), + Schema.Literal("default"), + Schema.Literal("flex"), + Schema.Literal("priority"), + Schema.Literal("scale"), + Schema.Null + ]) + ), + "session_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters." + }).check(Schema.isMaxLength(256)) + ), + "stop_server_tools_when": Schema.optionalKey(StopServerToolsWhen), + "store": Schema.optionalKey(Schema.Literal(false)), + "stream": Schema.optionalKey(Schema.Boolean), + "temperature": Schema.optionalKey(Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite())), + "text": Schema.optionalKey(TextExtendedConfig), + "tool_choice": Schema.optionalKey(OpenAIResponsesToolChoice), + "tools": Schema.optionalKey( + Schema.Array( + Schema.Union([ + Schema.Struct({ + "description": Schema.optionalKey(Schema.String), + "name": Schema.String, + "parameters": Schema.Struct({}), + "strict": Schema.optionalKey(Schema.Boolean), + "type": Schema.Literal("function") + }).annotate({ "description": "Function tool definition" }), + Preview_WebSearchServerTool, + Preview_20250311_WebSearchServerTool, + Legacy_WebSearchServerTool, + WebSearchServerTool, + FileSearchServerTool, + ComputerUseServerTool, + CodeInterpreterServerTool, + McpServerTool, + ImageGenerationServerTool, + CodexLocalShellTool, + ShellServerTool, + ApplyPatchServerTool, + CustomTool, + DatetimeServerTool, + FusionServerTool_OpenRouter, + ImageGenerationServerTool_OpenRouter, + ChatSearchModelsServerTool, + WebFetchServerTool, + WebSearchServerTool_OpenRouter, + ApplyPatchServerTool_OpenRouter + ]) + ) + ), + "top_k": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "top_logprobs": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "top_p": Schema.optionalKey(Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite())), + "trace": Schema.optionalKey(TraceConfig), + "truncation": Schema.optionalKey(OpenAIResponsesTruncation), + "user": Schema.optionalKey( + Schema.String.annotate({ + "description": + "A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 256 characters." + }).check(Schema.isMaxLength(256)) + ) +}).annotate({ "description": "Request schema for Responses endpoint" }) +export type BaseInputs = + | string + | ReadonlyArray< + | { + readonly "content": ReadonlyArray | string + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "user" | "system" | "assistant" | "developer" + readonly "type"?: "message" + } + | OpenAIResponseInputMessageItem + | OpenAIResponseFunctionToolCallOutput + | OpenAIResponseFunctionToolCall + | OutputItemImageGenerationCall + | OutputMessage + | OpenAIResponseCustomToolCall + | OpenAIResponseCustomToolCallOutput + | ApplyPatchCallItem + | ApplyPatchCallOutputItem + > + | unknown +export const BaseInputs = Schema.Union([ + Schema.String, + Schema.Array(Schema.Union([ + Schema.Struct({ + "content": Schema.Union([ + Schema.Array(Schema.Union([InputText, InputImage, InputFile, InputAudio], { mode: "oneOf" })), + Schema.String + ]), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]) + ), + "role": Schema.Literals(["user", "system", "assistant", "developer"]), + "type": Schema.optionalKey(Schema.Literal("message")) + }), + OpenAIResponseInputMessageItem, + OpenAIResponseFunctionToolCallOutput, + OpenAIResponseFunctionToolCall, + OutputItemImageGenerationCall, + OutputMessage, + OpenAIResponseCustomToolCall, + OpenAIResponseCustomToolCallOutput, + ApplyPatchCallItem, + ApplyPatchCallOutputItem + ])), + Schema.Unknown +]) +export type OutputItems = + | OutputMessageItem + | OutputReasoningItem + | OutputFunctionCallItem + | OutputWebSearchCallItem + | OutputFileSearchCallItem + | OutputImageGenerationCallItem + | OutputCodeInterpreterCallItem + | OutputComputerCallItem + | OutputDatetimeItem + | OutputWebSearchServerToolItem + | OutputCodeInterpreterServerToolItem + | OutputFileSearchServerToolItem + | OutputImageGenerationServerToolItem + | OutputBrowserUseServerToolItem + | OutputBashServerToolItem + | OutputTextEditorServerToolItem + | OutputApplyPatchServerToolItem + | OutputApplyPatchCallItem + | OutputWebFetchServerToolItem + | OutputToolSearchServerToolItem + | OutputMemoryServerToolItem + | OutputMcpServerToolItem + | OutputSearchModelsServerToolItem + | OutputFusionServerToolItem + | OutputCustomToolCallItem +export const OutputItems = Schema.Union([ + OutputMessageItem, + OutputReasoningItem, + OutputFunctionCallItem, + OutputWebSearchCallItem, + OutputFileSearchCallItem, + OutputImageGenerationCallItem, + OutputCodeInterpreterCallItem, + OutputComputerCallItem, + OutputDatetimeItem, + OutputWebSearchServerToolItem, + OutputCodeInterpreterServerToolItem, + OutputFileSearchServerToolItem, + OutputImageGenerationServerToolItem, + OutputBrowserUseServerToolItem, + OutputBashServerToolItem, + OutputTextEditorServerToolItem, + OutputApplyPatchServerToolItem, + OutputApplyPatchCallItem, + OutputWebFetchServerToolItem, + OutputToolSearchServerToolItem, + OutputMemoryServerToolItem, + OutputMcpServerToolItem, + OutputSearchModelsServerToolItem, + OutputFusionServerToolItem, + OutputCustomToolCallItem +], { mode: "oneOf" }).annotate({ "description": "An output item from the response" }) +export type MessagesRequest = { + readonly "cache_control"?: AnthropicCacheControlDirective + readonly "context_management"?: { + readonly "edits"?: ReadonlyArray< + { + readonly "clear_at_least"?: AnthropicInputTokensClearAtLeast + readonly "clear_tool_inputs"?: boolean | ReadonlyArray | unknown + readonly "exclude_tools"?: ReadonlyArray + readonly "keep"?: AnthropicToolUsesKeep + readonly "trigger"?: AnthropicInputTokensTrigger | AnthropicToolUsesTrigger + readonly "type": "clear_tool_uses_20250919" + } | { + readonly "keep"?: AnthropicThinkingTurns | { readonly "type": "all" } | "all" + readonly "type": "clear_thinking_20251015" + } | { + readonly "instructions"?: string + readonly "pause_after_compaction"?: boolean + readonly "trigger"?: { readonly "type": "input_tokens"; readonly "value": number } + readonly "type": "compact_20260112" + } + > + } + readonly "max_tokens"?: number + readonly "messages": ReadonlyArray + readonly "metadata"?: { readonly "user_id"?: string } + readonly "model": string + readonly "models"?: ReadonlyArray + readonly "output_config"?: MessagesOutputConfig + readonly "plugins"?: ReadonlyArray< + | AutoRouterPlugin + | ModerationPlugin + | WebSearchPlugin + | WebFetchPlugin + | FileParserPlugin + | ResponseHealingPlugin + | ContextCompressionPlugin + | ParetoRouterPlugin + | FusionPlugin + > + readonly "provider"?: ProviderPreferences + readonly "route"?: DeprecatedRoute + readonly "service_tier"?: string + readonly "session_id"?: string + readonly "speed"?: "fast" | "standard" | null + readonly "stop_sequences"?: ReadonlyArray + readonly "stop_server_tools_when"?: StopServerToolsWhen + readonly "stream"?: boolean + readonly "system"?: string | ReadonlyArray + readonly "temperature"?: number + readonly "thinking"?: + | { readonly "budget_tokens": number; readonly "display"?: AnthropicThinkingDisplay; readonly "type": "enabled" } + | { readonly "type": "disabled" } + | { readonly "display"?: AnthropicThinkingDisplay; readonly "type": "adaptive" } + readonly "tool_choice"?: + | { readonly "disable_parallel_tool_use"?: boolean; readonly "type": "auto" } + | { readonly "disable_parallel_tool_use"?: boolean; readonly "type": "any" } + | { readonly "type": "none" } + | { readonly "disable_parallel_tool_use"?: boolean; readonly "name": string; readonly "type": "tool" } + readonly "tools"?: ReadonlyArray< + | { + readonly "cache_control"?: AnthropicCacheControlDirective + readonly "description"?: string + readonly "input_schema": { + readonly "properties"?: unknown + readonly "required"?: ReadonlyArray + readonly "type"?: string + } + readonly "name": string + readonly "type"?: "custom" + } + | { + readonly "cache_control"?: AnthropicCacheControlDirective + readonly "name": "bash" + readonly "type": "bash_20250124" + } + | { + readonly "cache_control"?: AnthropicCacheControlDirective + readonly "name": "str_replace_editor" + readonly "type": "text_editor_20250124" + } + | { + readonly "allowed_domains"?: ReadonlyArray + readonly "blocked_domains"?: ReadonlyArray + readonly "cache_control"?: AnthropicCacheControlDirective + readonly "max_uses"?: number + readonly "name": "web_search" + readonly "type": "web_search_20250305" + readonly "user_location"?: AnthropicWebSearchToolUserLocation + } + | { + readonly "allowed_callers"?: AnthropicAllowedCallers + readonly "allowed_domains"?: ReadonlyArray + readonly "blocked_domains"?: ReadonlyArray + readonly "cache_control"?: AnthropicCacheControlDirective + readonly "max_uses"?: number + readonly "name": "web_search" + readonly "type": "web_search_20260209" + readonly "user_location"?: AnthropicWebSearchToolUserLocation + } + | { + readonly "allowed_callers"?: AnthropicAllowedCallers + readonly "cache_control"?: AnthropicCacheControlDirective + readonly "caching"?: { readonly "ttl"?: AnthropicCacheControlTtl; readonly "type": "ephemeral" } + readonly "defer_loading"?: boolean + readonly "max_uses"?: number + readonly "model": string + readonly "name": "advisor" + readonly "type": "advisor_20260301" + } + | DatetimeServerTool + | ImageGenerationServerTool_OpenRouter + | ChatSearchModelsServerTool + | WebFetchServerTool + | OpenRouterWebSearchServerTool + | { readonly "type": string } + > + readonly "top_k"?: number + readonly "top_p"?: number + readonly "trace"?: TraceConfig + readonly "user"?: string +} +export const MessagesRequest = Schema.Struct({ + "cache_control": Schema.optionalKey(AnthropicCacheControlDirective), + "context_management": Schema.optionalKey(Schema.Struct({ + "edits": Schema.optionalKey(Schema.Array(Schema.Union([ + Schema.Struct({ + "clear_at_least": Schema.optionalKey(AnthropicInputTokensClearAtLeast), + "clear_tool_inputs": Schema.optionalKey( + Schema.Union([Schema.Boolean, Schema.Array(Schema.String), Schema.Unknown]) + ), + "exclude_tools": Schema.optionalKey(Schema.Array(Schema.String)), + "keep": Schema.optionalKey(AnthropicToolUsesKeep), + "trigger": Schema.optionalKey( + Schema.Union([AnthropicInputTokensTrigger, AnthropicToolUsesTrigger], { mode: "oneOf" }) + ), + "type": Schema.Literal("clear_tool_uses_20250919") + }), + Schema.Struct({ + "keep": Schema.optionalKey( + Schema.Union([ + AnthropicThinkingTurns, + Schema.Struct({ "type": Schema.Literal("all") }), + Schema.Literal("all") + ]) + ), + "type": Schema.Literal("clear_thinking_20251015") + }), + Schema.Struct({ + "instructions": Schema.optionalKey(Schema.String), + "pause_after_compaction": Schema.optionalKey(Schema.Boolean), + "trigger": Schema.optionalKey( + Schema.Struct({ "type": Schema.Literal("input_tokens"), "value": Schema.Number.check(Schema.isInt()) }) + ), + "type": Schema.Literal("compact_20260112") + }) + ], { mode: "oneOf" }))) + })), + "max_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "messages": Schema.Array(MessagesMessageParam), + "metadata": Schema.optionalKey(Schema.Struct({ "user_id": Schema.optionalKey(Schema.String) })), + "model": Schema.String, + "models": Schema.optionalKey(Schema.Array(Schema.String)), + "output_config": Schema.optionalKey(MessagesOutputConfig), + "plugins": Schema.optionalKey( + Schema.Array( + Schema.Union([ + AutoRouterPlugin, + ModerationPlugin, + WebSearchPlugin, + WebFetchPlugin, + FileParserPlugin, + ResponseHealingPlugin, + ContextCompressionPlugin, + ParetoRouterPlugin, + FusionPlugin + ], { mode: "oneOf" }) + ).annotate({ "description": "Plugins you want to enable for this request, including their settings." }) + ), + "provider": Schema.optionalKey(ProviderPreferences), + "route": Schema.optionalKey(DeprecatedRoute), + "service_tier": Schema.optionalKey(Schema.String), + "session_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters." + }).check(Schema.isMaxLength(256)) + ), + "speed": Schema.optionalKey( + Schema.Union([Schema.Literal("fast"), Schema.Literal("standard"), Schema.Null]).annotate({ + "description": + "Controls output generation speed. When set to `fast`, uses a higher-speed inference configuration at premium pricing. Defaults to `standard` when omitted." + }) + ), + "stop_sequences": Schema.optionalKey(Schema.Array(Schema.String)), + "stop_server_tools_when": Schema.optionalKey(StopServerToolsWhen), + "stream": Schema.optionalKey(Schema.Boolean), + "system": Schema.optionalKey(Schema.Union([Schema.String, Schema.Array(AnthropicTextBlockParam)])), + "temperature": Schema.optionalKey(Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite())), + "thinking": Schema.optionalKey( + Schema.Union([ + Schema.Struct({ + "budget_tokens": Schema.Number.check(Schema.isInt()), + "display": Schema.optionalKey(AnthropicThinkingDisplay), + "type": Schema.Literal("enabled") + }), + Schema.Struct({ "type": Schema.Literal("disabled") }), + Schema.Struct({ "display": Schema.optionalKey(AnthropicThinkingDisplay), "type": Schema.Literal("adaptive") }) + ], { mode: "oneOf" }) + ), + "tool_choice": Schema.optionalKey( + Schema.Union([ + Schema.Struct({ + "disable_parallel_tool_use": Schema.optionalKey(Schema.Boolean), + "type": Schema.Literal("auto") + }), + Schema.Struct({ "disable_parallel_tool_use": Schema.optionalKey(Schema.Boolean), "type": Schema.Literal("any") }), + Schema.Struct({ "type": Schema.Literal("none") }), + Schema.Struct({ + "disable_parallel_tool_use": Schema.optionalKey(Schema.Boolean), + "name": Schema.String, + "type": Schema.Literal("tool") + }) + ], { mode: "oneOf" }) + ), + "tools": Schema.optionalKey(Schema.Array(Schema.Union([ + Schema.Struct({ + "cache_control": Schema.optionalKey(AnthropicCacheControlDirective), + "description": Schema.optionalKey(Schema.String), + "input_schema": Schema.Struct({ + "properties": Schema.optionalKey(Schema.Unknown), + "required": Schema.optionalKey(Schema.Array(Schema.String)), + "type": Schema.optionalKey(Schema.String) + }), + "name": Schema.String, + "type": Schema.optionalKey(Schema.Literal("custom")) + }), + Schema.Struct({ + "cache_control": Schema.optionalKey(AnthropicCacheControlDirective), + "name": Schema.Literal("bash"), + "type": Schema.Literal("bash_20250124") + }), + Schema.Struct({ + "cache_control": Schema.optionalKey(AnthropicCacheControlDirective), + "name": Schema.Literal("str_replace_editor"), + "type": Schema.Literal("text_editor_20250124") + }), + Schema.Struct({ + "allowed_domains": Schema.optionalKey(Schema.Array(Schema.String)), + "blocked_domains": Schema.optionalKey(Schema.Array(Schema.String)), + "cache_control": Schema.optionalKey(AnthropicCacheControlDirective), + "max_uses": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "name": Schema.Literal("web_search"), + "type": Schema.Literal("web_search_20250305"), + "user_location": Schema.optionalKey(AnthropicWebSearchToolUserLocation) + }), + Schema.Struct({ + "allowed_callers": Schema.optionalKey(AnthropicAllowedCallers), + "allowed_domains": Schema.optionalKey(Schema.Array(Schema.String)), + "blocked_domains": Schema.optionalKey(Schema.Array(Schema.String)), + "cache_control": Schema.optionalKey(AnthropicCacheControlDirective), + "max_uses": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "name": Schema.Literal("web_search"), + "type": Schema.Literal("web_search_20260209"), + "user_location": Schema.optionalKey(AnthropicWebSearchToolUserLocation) + }), + Schema.Struct({ + "allowed_callers": Schema.optionalKey(AnthropicAllowedCallers), + "cache_control": Schema.optionalKey(AnthropicCacheControlDirective), + "caching": Schema.optionalKey( + Schema.Struct({ "ttl": Schema.optionalKey(AnthropicCacheControlTtl), "type": Schema.Literal("ephemeral") }) + .annotate({ + "description": + "Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models." + }) + ), + "defer_loading": Schema.optionalKey(Schema.Boolean), + "max_uses": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "model": Schema.String, + "name": Schema.Literal("advisor"), + "type": Schema.Literal("advisor_20260301") + }), + DatetimeServerTool, + ImageGenerationServerTool_OpenRouter, + ChatSearchModelsServerTool, + WebFetchServerTool, + OpenRouterWebSearchServerTool, + Schema.Struct({ "type": Schema.String }) + ]))), + "top_k": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "top_p": Schema.optionalKey(Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite())), + "trace": Schema.optionalKey(TraceConfig), + "user": Schema.optionalKey( + Schema.String.annotate({ + "description": + "A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 256 characters." + }).check(Schema.isMaxLength(256)) + ) +}).annotate({ "description": "Request schema for Anthropic Messages API endpoint" }) +export type MessagesContentBlockStartEvent = { + readonly "content_block": + | AnthropicTextBlock + | AnthropicToolUseBlock + | AnthropicThinkingBlock + | AnthropicRedactedThinkingBlock + | ORAnthropicServerToolUseBlock + | AnthropicWebSearchToolResult + | AnthropicWebFetchToolResult + | AnthropicCodeExecutionToolResult + | AnthropicBashCodeExecutionToolResult + | AnthropicTextEditorCodeExecutionToolResult + | AnthropicToolSearchToolResult + | AnthropicContainerUpload + | AnthropicCompactionBlock + | AnthropicAdvisorToolResult + | { readonly "content": string; readonly "type": "compaction" } + readonly "index": number + readonly "type": "content_block_start" +} +export const MessagesContentBlockStartEvent = Schema.Struct({ + "content_block": Schema.Union([ + AnthropicTextBlock, + AnthropicToolUseBlock, + AnthropicThinkingBlock, + AnthropicRedactedThinkingBlock, + ORAnthropicServerToolUseBlock, + AnthropicWebSearchToolResult, + AnthropicWebFetchToolResult, + AnthropicCodeExecutionToolResult, + AnthropicBashCodeExecutionToolResult, + AnthropicTextEditorCodeExecutionToolResult, + AnthropicToolSearchToolResult, + AnthropicContainerUpload, + AnthropicCompactionBlock, + AnthropicAdvisorToolResult, + Schema.Struct({ "content": Schema.String, "type": Schema.Literal("compaction") }) + ]), + "index": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("content_block_start") +}).annotate({ "description": "Event sent when a new content block starts" }) +export type ORAnthropicContentBlock = + | AnthropicTextBlock + | AnthropicToolUseBlock + | AnthropicThinkingBlock + | AnthropicRedactedThinkingBlock + | ORAnthropicServerToolUseBlock + | AnthropicWebSearchToolResult + | AnthropicWebFetchToolResult + | AnthropicCodeExecutionToolResult + | AnthropicBashCodeExecutionToolResult + | AnthropicTextEditorCodeExecutionToolResult + | AnthropicToolSearchToolResult + | AnthropicContainerUpload + | AnthropicCompactionBlock + | AnthropicAdvisorToolResult +export const ORAnthropicContentBlock = Schema.Union([ + AnthropicTextBlock, + AnthropicToolUseBlock, + AnthropicThinkingBlock, + AnthropicRedactedThinkingBlock, + ORAnthropicServerToolUseBlock, + AnthropicWebSearchToolResult, + AnthropicWebFetchToolResult, + AnthropicCodeExecutionToolResult, + AnthropicBashCodeExecutionToolResult, + AnthropicTextEditorCodeExecutionToolResult, + AnthropicToolSearchToolResult, + AnthropicContainerUpload, + AnthropicCompactionBlock, + AnthropicAdvisorToolResult +], { mode: "oneOf" }) +export type ChatChoice = { + readonly "finish_reason": ChatFinishReasonEnum + readonly "index": number + readonly "logprobs"?: ChatTokenLogprobs + readonly "message": ChatAssistantMessage +} +export const ChatChoice = Schema.Struct({ + "finish_reason": ChatFinishReasonEnum, + "index": Schema.Number.annotate({ "description": "Choice index" }).check(Schema.isInt()), + "logprobs": Schema.optionalKey(ChatTokenLogprobs), + "message": ChatAssistantMessage +}).annotate({ "description": "Chat completion choice" }) +export type ChatMessages = + | ChatSystemMessage + | ChatUserMessage + | ChatDeveloperMessage + | ChatAssistantMessage + | ChatToolMessage +export const ChatMessages = Schema.Union([ + ChatSystemMessage, + ChatUserMessage, + ChatDeveloperMessage, + ChatAssistantMessage, + ChatToolMessage +], { mode: "oneOf" }).annotate({ "description": "Chat completion message with role-based discrimination" }) +export type ChatStreamChoice = { + readonly "delta": ChatStreamDelta + readonly "finish_reason"?: ChatFinishReasonEnum + readonly "index": number + readonly "logprobs"?: ChatTokenLogprobs +} +export const ChatStreamChoice = Schema.Struct({ + "delta": ChatStreamDelta, + "finish_reason": Schema.optionalKey(ChatFinishReasonEnum), + "index": Schema.Number.annotate({ "description": "Choice index" }).check(Schema.isInt()), + "logprobs": Schema.optionalKey(ChatTokenLogprobs) +}).annotate({ "description": "Streaming completion choice chunk" }) +export type BaseResponsesResult = { + readonly "background"?: boolean + readonly "completed_at": number + readonly "created_at": number + readonly "error": ResponsesErrorField + readonly "frequency_penalty": number + readonly "id": string + readonly "incomplete_details": IncompleteDetails + readonly "instructions": BaseInputs + readonly "max_output_tokens"?: number + readonly "max_tool_calls"?: number + readonly "metadata": RequestMetadata + readonly "model": string + readonly "object": "response" + readonly "output": ReadonlyArray< + | OutputMessage + | OutputItemReasoning + | OutputItemFunctionCall + | OutputItemCustomToolCall + | OutputItemWebSearchCall + | OutputItemFileSearchCall + | OutputItemImageGenerationCall + | OutputItemApplyPatchCall + > + readonly "output_text"?: string + readonly "parallel_tool_calls": boolean + readonly "presence_penalty": number + readonly "previous_response_id"?: string + readonly "prompt"?: StoredPromptTemplate + readonly "prompt_cache_key"?: string + readonly "reasoning"?: BaseReasoningConfig + readonly "safety_identifier"?: string + readonly "service_tier"?: ServiceTier + readonly "status": OpenAIResponsesResponseStatus + readonly "store"?: boolean + readonly "temperature": number + readonly "text"?: TextConfig + readonly "tool_choice": OpenAIResponsesToolChoice + readonly "tools": ReadonlyArray< + | { + readonly "description"?: string + readonly "name": string + readonly "parameters": {} + readonly "strict"?: boolean + readonly "type": "function" + } + | Preview_WebSearchServerTool + | Preview_20250311_WebSearchServerTool + | Legacy_WebSearchServerTool + | WebSearchServerTool + | FileSearchServerTool + | ComputerUseServerTool + | CodeInterpreterServerTool + | McpServerTool + | ImageGenerationServerTool + | CodexLocalShellTool + | ShellServerTool + | ApplyPatchServerTool + | CustomTool + > + readonly "top_logprobs"?: number + readonly "top_p": number + readonly "truncation"?: Truncation + readonly "usage"?: OpenAIResponsesUsage + readonly "user"?: string +} +export const BaseResponsesResult = Schema.Struct({ + "background": Schema.optionalKey(Schema.Boolean), + "completed_at": Schema.Number.check(Schema.isInt()), + "created_at": Schema.Number.check(Schema.isInt()), + "error": ResponsesErrorField, + "frequency_penalty": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "id": Schema.String, + "incomplete_details": IncompleteDetails, + "instructions": BaseInputs, + "max_output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "max_tool_calls": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "metadata": RequestMetadata, + "model": Schema.String, + "object": Schema.Literal("response"), + "output": Schema.Array( + Schema.Union([ + OutputMessage, + OutputItemReasoning, + OutputItemFunctionCall, + OutputItemCustomToolCall, + OutputItemWebSearchCall, + OutputItemFileSearchCall, + OutputItemImageGenerationCall, + OutputItemApplyPatchCall + ], { mode: "oneOf" }) + ), + "output_text": Schema.optionalKey(Schema.String), + "parallel_tool_calls": Schema.Boolean, + "presence_penalty": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "previous_response_id": Schema.optionalKey(Schema.String), + "prompt": Schema.optionalKey(StoredPromptTemplate), + "prompt_cache_key": Schema.optionalKey(Schema.String), + "reasoning": Schema.optionalKey(BaseReasoningConfig), + "safety_identifier": Schema.optionalKey(Schema.String), + "service_tier": Schema.optionalKey(ServiceTier), + "status": OpenAIResponsesResponseStatus, + "store": Schema.optionalKey(Schema.Boolean), + "temperature": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "text": Schema.optionalKey(TextConfig), + "tool_choice": OpenAIResponsesToolChoice, + "tools": Schema.Array( + Schema.Union([ + Schema.Struct({ + "description": Schema.optionalKey(Schema.String), + "name": Schema.String, + "parameters": Schema.Struct({}), + "strict": Schema.optionalKey(Schema.Boolean), + "type": Schema.Literal("function") + }).annotate({ "description": "Function tool definition" }), + Preview_WebSearchServerTool, + Preview_20250311_WebSearchServerTool, + Legacy_WebSearchServerTool, + WebSearchServerTool, + FileSearchServerTool, + ComputerUseServerTool, + CodeInterpreterServerTool, + McpServerTool, + ImageGenerationServerTool, + CodexLocalShellTool, + ShellServerTool, + ApplyPatchServerTool, + CustomTool + ], { mode: "oneOf" }) + ), + "top_logprobs": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "top_p": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "truncation": Schema.optionalKey(Truncation), + "usage": Schema.optionalKey(OpenAIResponsesUsage), + "user": Schema.optionalKey(Schema.String) +}) +export type OpenResponsesResult = { + readonly "background"?: boolean + readonly "completed_at": number + readonly "created_at": number + readonly "error": ResponsesErrorField + readonly "frequency_penalty": number + readonly "id": string + readonly "incomplete_details": IncompleteDetails + readonly "instructions": BaseInputs + readonly "max_output_tokens"?: number + readonly "max_tool_calls"?: number + readonly "metadata": RequestMetadata + readonly "model": string + readonly "object": "response" + readonly "output": ReadonlyArray< + { + readonly "content": ReadonlyArray< + { + readonly "annotations"?: ReadonlyArray< + { + readonly "file_id": string + readonly "filename": string + readonly "index": number + readonly "type": "file_citation" } | { + readonly "end_index": number + readonly "start_index": number + readonly "title": string readonly "type": never + readonly "url": string readonly "file_id": string readonly "filename": string readonly "index": number } | { + readonly "file_id": string + readonly "index": number + readonly "type": never + readonly "filename": string + } | { + readonly "file_id": string + readonly "filename": string + readonly "index": number readonly "type": never + readonly "end_index": number + readonly "start_index": number + readonly "title": string readonly "url": string + } | { + readonly "end_index": number + readonly "start_index": number readonly "title": string + readonly "type": "url_citation" + readonly "url": string + } | { + readonly "file_id": string + readonly "index": number + readonly "type": never + readonly "end_index": number readonly "start_index": number + readonly "title": string + readonly "url": string + } | { + readonly "file_id": string + readonly "filename": string + readonly "index": number + readonly "type": never + } | { readonly "end_index": number + readonly "start_index": number + readonly "title": string + readonly "type": never + readonly "url": string readonly "file_id": string readonly "index": number - } | { readonly "type": "file_path"; readonly "file_id": string; readonly "index": number } + } | { readonly "file_id": string; readonly "index": number; readonly "type": "file_path" } + > + readonly "logprobs"?: ReadonlyArray< + { + readonly "bytes": ReadonlyArray + readonly "logprob": number + readonly "token": string + readonly "top_logprobs": ReadonlyArray< + { readonly "bytes": ReadonlyArray; readonly "logprob": number; readonly "token": string } + > + } + > + readonly "text": string + readonly "type": "output_text" + } | { + readonly "refusal": string + readonly "type": never + readonly "annotations"?: ReadonlyArray + readonly "logprobs"?: ReadonlyArray< + { + readonly "bytes": ReadonlyArray + readonly "logprob": number + readonly "token": string + readonly "top_logprobs": ReadonlyArray< + { readonly "bytes": ReadonlyArray; readonly "logprob": number; readonly "token": string } + > + } + > + readonly "text": string + } | { + readonly "annotations"?: ReadonlyArray + readonly "logprobs"?: ReadonlyArray< + { + readonly "bytes": ReadonlyArray + readonly "logprob": number + readonly "token": string + readonly "top_logprobs": ReadonlyArray< + { readonly "bytes": ReadonlyArray; readonly "logprob": number; readonly "token": string } + > + } + > + readonly "text": string + readonly "type": never + readonly "refusal": string + } | { readonly "refusal": string; readonly "type": "refusal" } + > + readonly "id": string + readonly "phase"?: + | "commentary" + | "commentary" + | "final_answer" + | "final_answer" + | "commentary" + | "final_answer" + | unknown + readonly "role": "assistant" + readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "type": "message" + } | { + readonly "content": ReadonlyArray< + { + readonly "annotations"?: ReadonlyArray + readonly "logprobs"?: ReadonlyArray< + { + readonly "bytes": ReadonlyArray + readonly "logprob": number + readonly "token": string + readonly "top_logprobs": ReadonlyArray< + { readonly "bytes": ReadonlyArray; readonly "logprob": number; readonly "token": string } + > + } > + readonly "text": string + readonly "type": never + } | { readonly "refusal": string; readonly "type": never; readonly "text": string } + > + readonly "encrypted_content"?: string + readonly "id": string + readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "summary": ReadonlyArray + readonly "type": never + readonly "format"?: ReasoningFormat + readonly "signature"?: string + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + } | { + readonly "arguments": string + readonly "call_id": string + readonly "id": string + readonly "name": string + readonly "namespace"?: string + readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "type": never + readonly "content": ReadonlyArray + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + } | { + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + readonly "id": string + readonly "status": "completed" | "in_progress" + readonly "type": never + readonly "content": ReadonlyArray + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + } | { + readonly "id": string + readonly "queries": ReadonlyArray + readonly "status": "completed" | "in_progress" + readonly "type": never + readonly "content": ReadonlyArray + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + } | { + readonly "id": string + readonly "result"?: string + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "content": ReadonlyArray + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + } | { + readonly "code": string + readonly "container_id": string + readonly "id": string + readonly "outputs": ReadonlyArray< + { readonly "type": "image"; readonly "url": string } | { readonly "logs": string; readonly "type": "logs" } + > + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "content": ReadonlyArray + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + } | { + readonly "action"?: unknown + readonly "call_id": string + readonly "id": string + readonly "pending_safety_checks": ReadonlyArray< + { readonly "code": string; readonly "id": string; readonly "message": string } + > + readonly "status": "completed" | "incomplete" | "in_progress" + readonly "type": never + readonly "content": ReadonlyArray + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + } | { + readonly "datetime": string + readonly "id": string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "timezone": string + readonly "type": never + readonly "content": ReadonlyArray + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + } | { + readonly "action"?: { + readonly "query": string + readonly "sources"?: ReadonlyArray<{ readonly "type": "url"; readonly "url": string }> + readonly "type": "search" + } + readonly "id": string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "content": ReadonlyArray + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + } | { + readonly "code"?: string + readonly "exitCode"?: number + readonly "id": string + readonly "language"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "stderr"?: string + readonly "stdout"?: string + readonly "type": never + readonly "content": ReadonlyArray + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + } | { + readonly "id": string + readonly "queries"?: ReadonlyArray + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "content": ReadonlyArray + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + } | { + readonly "id": string + readonly "imageB64"?: string + readonly "imageUrl"?: string + readonly "result"?: string + readonly "revisedPrompt"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "content": ReadonlyArray + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + } | { + readonly "action"?: string + readonly "id": string + readonly "screenshotB64"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "content": ReadonlyArray + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + } | { + readonly "command"?: string + readonly "exitCode"?: number + readonly "id": string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "stderr"?: string + readonly "stdout"?: string + readonly "type": never + readonly "content": ReadonlyArray + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + } | { + readonly "command"?: "view" | "create" | "str_replace" | "insert" + readonly "filePath"?: string + readonly "id": string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "content": ReadonlyArray + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + } | { + readonly "call_id"?: string + readonly "id": string + readonly "operation"?: ApplyPatchCallOperation + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "content": ReadonlyArray + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + } | { + readonly "call_id": string + readonly "id": string + readonly "operation": ApplyPatchCallOperation + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "content": ReadonlyArray + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + } | { + readonly "content": never + readonly "error"?: string + readonly "httpStatus"?: number + readonly "id": string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "title"?: string + readonly "type": never + readonly "url"?: string + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + } | { + readonly "id": string + readonly "query"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "content": ReadonlyArray + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + } | { + readonly "action"?: "read" | "write" | "delete" + readonly "id": string + readonly "key"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "value"?: unknown + readonly "content": ReadonlyArray + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + } | { + readonly "id": string + readonly "serverLabel"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "toolName"?: string + readonly "type": never + readonly "content": ReadonlyArray + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + } | { + readonly "arguments"?: string + readonly "id": string + readonly "query"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "content": ReadonlyArray + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + } | { + readonly "analysis"?: { + readonly "blind_spots": ReadonlyArray + readonly "consensus": ReadonlyArray + readonly "contradictions": ReadonlyArray< + { + readonly "stances": ReadonlyArray<{ readonly "model": string; readonly "stance": string }> + readonly "topic": string + } + > + readonly "partial_coverage": ReadonlyArray< + { readonly "models": ReadonlyArray; readonly "point": string } + > + readonly "unique_insights": ReadonlyArray<{ readonly "insight": string; readonly "model": string }> + } + readonly "error"?: string + readonly "failed_models"?: ReadonlyArray<{ readonly "error": string; readonly "model": string }> + readonly "id": string + readonly "responses"?: ReadonlyArray<{ readonly "model": string }> + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "content": ReadonlyArray + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + } | { + readonly "call_id": string + readonly "id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + readonly "type": never + readonly "content": ReadonlyArray + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + readonly "status"?: "completed" | "incomplete" | "in_progress" + } | { + readonly "content": ReadonlyArray< + { + readonly "annotations"?: ReadonlyArray readonly "logprobs"?: ReadonlyArray< { - readonly "token": string readonly "bytes": ReadonlyArray readonly "logprob": number + readonly "token": string readonly "top_logprobs": ReadonlyArray< - { readonly "token": string; readonly "bytes": ReadonlyArray; readonly "logprob": number } + { readonly "bytes": ReadonlyArray; readonly "logprob": number; readonly "token": string } > } > - } | { + readonly "text": string + readonly "type": never + } | { readonly "refusal": string; readonly "type": never; readonly "text": string } + > + readonly "id": string + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "type": never + readonly "encrypted_content"?: string + readonly "summary": ReadonlyArray + } | { + readonly "content"?: ReadonlyArray<{ readonly "text": string; readonly "type": "reasoning_text" }> + readonly "encrypted_content"?: string + readonly "id": string + readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "summary": ReadonlyArray<{ readonly "text": string; readonly "type": "summary_text" }> + readonly "type": "reasoning" + readonly "format"?: ReasoningFormat + readonly "signature"?: string + } | { + readonly "arguments": string + readonly "call_id": string + readonly "id": string + readonly "name": string + readonly "namespace"?: string + readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "type": never + readonly "content"?: ReadonlyArray + readonly "encrypted_content"?: string + readonly "summary": ReadonlyArray + } | { + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + readonly "id": string + readonly "status": "completed" | "in_progress" + readonly "type": never + readonly "content"?: ReadonlyArray + readonly "encrypted_content"?: string + readonly "summary": ReadonlyArray + } | { + readonly "id": string + readonly "queries": ReadonlyArray + readonly "status": "completed" | "in_progress" + readonly "type": never + readonly "content"?: ReadonlyArray + readonly "encrypted_content"?: string + readonly "summary": ReadonlyArray + } | { + readonly "id": string + readonly "result"?: string + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "content"?: ReadonlyArray + readonly "encrypted_content"?: string + readonly "summary": ReadonlyArray + } | { + readonly "code": string + readonly "container_id": string + readonly "id": string + readonly "outputs": ReadonlyArray< + { readonly "type": "image"; readonly "url": string } | { readonly "logs": string; readonly "type": "logs" } + > + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "content"?: ReadonlyArray + readonly "encrypted_content"?: string + readonly "summary": ReadonlyArray + } | { + readonly "action"?: unknown + readonly "call_id": string + readonly "id": string + readonly "pending_safety_checks": ReadonlyArray< + { readonly "code": string; readonly "id": string; readonly "message": string } + > + readonly "status": "completed" | "incomplete" | "in_progress" + readonly "type": never + readonly "content"?: ReadonlyArray + readonly "encrypted_content"?: string + readonly "summary": ReadonlyArray + } | { + readonly "datetime": string + readonly "id": string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "timezone": string + readonly "type": never + readonly "content"?: ReadonlyArray + readonly "encrypted_content"?: string + readonly "summary": ReadonlyArray + } | { + readonly "action"?: { + readonly "query": string + readonly "sources"?: ReadonlyArray<{ readonly "type": "url"; readonly "url": string }> + readonly "type": "search" + } + readonly "id": string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "content"?: ReadonlyArray + readonly "encrypted_content"?: string + readonly "summary": ReadonlyArray + } | { + readonly "code"?: string + readonly "exitCode"?: number + readonly "id": string + readonly "language"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "stderr"?: string + readonly "stdout"?: string + readonly "type": never + readonly "content"?: ReadonlyArray + readonly "encrypted_content"?: string + readonly "summary": ReadonlyArray + } | { + readonly "id": string + readonly "queries"?: ReadonlyArray + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "content"?: ReadonlyArray + readonly "encrypted_content"?: string + readonly "summary": ReadonlyArray + } | { + readonly "id": string + readonly "imageB64"?: string + readonly "imageUrl"?: string + readonly "result"?: string + readonly "revisedPrompt"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "content"?: ReadonlyArray + readonly "encrypted_content"?: string + readonly "summary": ReadonlyArray + } | { + readonly "action"?: string + readonly "id": string + readonly "screenshotB64"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "content"?: ReadonlyArray + readonly "encrypted_content"?: string + readonly "summary": ReadonlyArray + } | { + readonly "command"?: string + readonly "exitCode"?: number + readonly "id": string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "stderr"?: string + readonly "stdout"?: string + readonly "type": never + readonly "content"?: ReadonlyArray + readonly "encrypted_content"?: string + readonly "summary": ReadonlyArray + } | { + readonly "command"?: "view" | "create" | "str_replace" | "insert" + readonly "filePath"?: string + readonly "id": string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "content"?: ReadonlyArray + readonly "encrypted_content"?: string + readonly "summary": ReadonlyArray + } | { + readonly "call_id"?: string + readonly "id": string + readonly "operation"?: ApplyPatchCallOperation + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "content"?: ReadonlyArray + readonly "encrypted_content"?: string + readonly "summary": ReadonlyArray + } | { + readonly "call_id": string + readonly "id": string + readonly "operation": ApplyPatchCallOperation + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "content"?: ReadonlyArray + readonly "encrypted_content"?: string + readonly "summary": ReadonlyArray + } | { + readonly "content"?: never + readonly "error"?: string + readonly "httpStatus"?: number + readonly "id": string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "title"?: string + readonly "type": never + readonly "url"?: string + readonly "encrypted_content"?: string + readonly "summary": ReadonlyArray + } | { + readonly "id": string + readonly "query"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "content"?: ReadonlyArray + readonly "encrypted_content"?: string + readonly "summary": ReadonlyArray + } | { + readonly "action"?: "read" | "write" | "delete" + readonly "id": string + readonly "key"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "value"?: unknown + readonly "content"?: ReadonlyArray + readonly "encrypted_content"?: string + readonly "summary": ReadonlyArray + } | { + readonly "id": string + readonly "serverLabel"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "toolName"?: string + readonly "type": never + readonly "content"?: ReadonlyArray + readonly "encrypted_content"?: string + readonly "summary": ReadonlyArray + } | { + readonly "arguments"?: string + readonly "id": string + readonly "query"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "content"?: ReadonlyArray + readonly "encrypted_content"?: string + readonly "summary": ReadonlyArray + } | { + readonly "analysis"?: { + readonly "blind_spots": ReadonlyArray + readonly "consensus": ReadonlyArray + readonly "contradictions": ReadonlyArray< + { + readonly "stances": ReadonlyArray<{ readonly "model": string; readonly "stance": string }> + readonly "topic": string + } + > + readonly "partial_coverage": ReadonlyArray< + { readonly "models": ReadonlyArray; readonly "point": string } + > + readonly "unique_insights": ReadonlyArray<{ readonly "insight": string; readonly "model": string }> + } + readonly "error"?: string + readonly "failed_models"?: ReadonlyArray<{ readonly "error": string; readonly "model": string }> + readonly "id": string + readonly "responses"?: ReadonlyArray<{ readonly "model": string }> + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "content"?: ReadonlyArray + readonly "encrypted_content"?: string + readonly "summary": ReadonlyArray + } | { + readonly "call_id": string + readonly "id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + readonly "type": never + readonly "content"?: ReadonlyArray + readonly "encrypted_content"?: string + readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "summary": ReadonlyArray + } | { + readonly "content": ReadonlyArray + readonly "id": string + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "type": never + readonly "arguments": string + readonly "call_id": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "content"?: ReadonlyArray<{ readonly "text": string; readonly "type": "reasoning_text" }> + readonly "encrypted_content"?: string + readonly "id": string + readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "summary": ReadonlyArray + readonly "type": never + readonly "format"?: ReasoningFormat + readonly "signature"?: string + readonly "arguments": string + readonly "call_id": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "arguments": string + readonly "call_id": string + readonly "id"?: string + readonly "name": string + readonly "namespace"?: string + readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "type": "function_call" + } | { + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + readonly "id": string + readonly "status": "completed" | "in_progress" + readonly "type": never + readonly "arguments": string + readonly "call_id": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "id": string + readonly "queries": ReadonlyArray + readonly "status": "completed" | "in_progress" + readonly "type": never + readonly "arguments": string + readonly "call_id": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "id": string + readonly "result"?: string + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "arguments": string + readonly "call_id": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "code": string + readonly "container_id": string + readonly "id": string + readonly "outputs": ReadonlyArray< + { readonly "type": "image"; readonly "url": string } | { readonly "logs": string; readonly "type": "logs" } + > + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "arguments": string + readonly "call_id": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "action"?: unknown + readonly "call_id": string + readonly "id"?: string + readonly "pending_safety_checks": ReadonlyArray< + { readonly "code": string; readonly "id": string; readonly "message": string } + > + readonly "status": "completed" | "incomplete" | "in_progress" + readonly "type": never + readonly "arguments": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "datetime": string + readonly "id"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "timezone": string + readonly "type": never + readonly "arguments": string + readonly "call_id": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "action"?: { + readonly "query": string + readonly "sources"?: ReadonlyArray<{ readonly "type": "url"; readonly "url": string }> + readonly "type": "search" + } + readonly "id"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "arguments": string + readonly "call_id": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "code"?: string + readonly "exitCode"?: number + readonly "id"?: string + readonly "language"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "stderr"?: string + readonly "stdout"?: string + readonly "type": never + readonly "arguments": string + readonly "call_id": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "id"?: string + readonly "queries"?: ReadonlyArray + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "arguments": string + readonly "call_id": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "id"?: string + readonly "imageB64"?: string + readonly "imageUrl"?: string + readonly "result"?: string + readonly "revisedPrompt"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "arguments": string + readonly "call_id": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "action"?: string + readonly "id"?: string + readonly "screenshotB64"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "arguments": string + readonly "call_id": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "command"?: string + readonly "exitCode"?: number + readonly "id"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "stderr"?: string + readonly "stdout"?: string + readonly "type": never + readonly "arguments": string + readonly "call_id": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "command"?: "view" | "create" | "str_replace" | "insert" + readonly "filePath"?: string + readonly "id"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "arguments": string + readonly "call_id": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "call_id": string + readonly "id"?: string + readonly "operation"?: ApplyPatchCallOperation + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "arguments": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "call_id": string + readonly "id": string + readonly "operation": ApplyPatchCallOperation + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "arguments": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "content"?: string + readonly "error"?: string + readonly "httpStatus"?: number + readonly "id"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "title"?: string + readonly "type": never + readonly "url"?: string + readonly "arguments": string + readonly "call_id": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "id"?: string + readonly "query"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "arguments": string + readonly "call_id": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "action"?: "read" | "write" | "delete" + readonly "id"?: string + readonly "key"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "value"?: unknown + readonly "arguments": string + readonly "call_id": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "id"?: string + readonly "serverLabel"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "toolName"?: string + readonly "type": never + readonly "arguments": string + readonly "call_id": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "arguments": string + readonly "id"?: string + readonly "query"?: string + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "call_id": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "analysis"?: { + readonly "blind_spots": ReadonlyArray + readonly "consensus": ReadonlyArray + readonly "contradictions": ReadonlyArray< + { + readonly "stances": ReadonlyArray<{ readonly "model": string; readonly "stance": string }> + readonly "topic": string + } + > + readonly "partial_coverage": ReadonlyArray< + { readonly "models": ReadonlyArray; readonly "point": string } + > + readonly "unique_insights": ReadonlyArray<{ readonly "insight": string; readonly "model": string }> + } + readonly "error"?: string + readonly "failed_models"?: ReadonlyArray<{ readonly "error": string; readonly "model": string }> + readonly "id"?: string + readonly "responses"?: ReadonlyArray<{ readonly "model": string }> + readonly "status": "in_progress" | "completed" | "incomplete" + readonly "type": never + readonly "arguments": string + readonly "call_id": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "call_id": string + readonly "id"?: string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + readonly "type": never + readonly "arguments": string + readonly "status"?: "completed" | "incomplete" | "in_progress" + } | { + readonly "content": ReadonlyArray + readonly "id": string + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "type": never + readonly "call_id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "content"?: ReadonlyArray<{ readonly "text": string; readonly "type": "reasoning_text" }> + readonly "encrypted_content"?: string + readonly "id": string + readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "summary": ReadonlyArray + readonly "type": never + readonly "format"?: ReasoningFormat + readonly "signature"?: string + readonly "call_id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "arguments": string + readonly "call_id": string + readonly "id"?: string + readonly "name": string + readonly "namespace"?: string + readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "type": never + readonly "input": string + } | { + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + readonly "id": string + readonly "status": WebSearchStatus + readonly "type": never + readonly "call_id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "id": string + readonly "queries": ReadonlyArray + readonly "status": WebSearchStatus + readonly "type": never + readonly "call_id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "id": string + readonly "result"?: string + readonly "status": ImageGenerationStatus + readonly "type": never + readonly "call_id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "code": string + readonly "container_id": string + readonly "id": string + readonly "outputs": ReadonlyArray< + { readonly "type": "image"; readonly "url": string } | { readonly "logs": string; readonly "type": "logs" } + > + readonly "status": ToolCallStatus + readonly "type": never + readonly "call_id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "action"?: unknown + readonly "call_id": string + readonly "id"?: string + readonly "pending_safety_checks": ReadonlyArray< + { readonly "code": string; readonly "id": string; readonly "message": string } + > + readonly "status": "completed" | "incomplete" | "in_progress" + readonly "type": never + readonly "input": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "datetime": string + readonly "id"?: string + readonly "status": ToolCallStatus + readonly "timezone": string + readonly "type": never + readonly "call_id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "action"?: { + readonly "query": string + readonly "sources"?: ReadonlyArray<{ readonly "type": "url"; readonly "url": string }> + readonly "type": "search" + } + readonly "id"?: string + readonly "status": ToolCallStatus + readonly "type": never + readonly "call_id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "code"?: string + readonly "exitCode"?: number + readonly "id"?: string + readonly "language"?: string + readonly "status": ToolCallStatus + readonly "stderr"?: string + readonly "stdout"?: string + readonly "type": never + readonly "call_id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "id"?: string + readonly "queries"?: ReadonlyArray + readonly "status": ToolCallStatus + readonly "type": never + readonly "call_id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "id"?: string + readonly "imageB64"?: string + readonly "imageUrl"?: string + readonly "result"?: string + readonly "revisedPrompt"?: string + readonly "status": ToolCallStatus + readonly "type": never + readonly "call_id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "action"?: string + readonly "id"?: string + readonly "screenshotB64"?: string + readonly "status": ToolCallStatus + readonly "type": never + readonly "call_id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "command"?: string + readonly "exitCode"?: number + readonly "id"?: string + readonly "status": ToolCallStatus + readonly "stderr"?: string + readonly "stdout"?: string + readonly "type": never + readonly "call_id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "command"?: "view" | "create" | "str_replace" | "insert" + readonly "filePath"?: string + readonly "id"?: string + readonly "status": ToolCallStatus + readonly "type": never + readonly "call_id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "call_id": string + readonly "id"?: string + readonly "operation"?: ApplyPatchCallOperation + readonly "status": ToolCallStatus + readonly "type": never + readonly "input": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "call_id": string + readonly "id": string + readonly "operation": ApplyPatchCallOperation + readonly "status": ApplyPatchCallStatus + readonly "type": never + readonly "input": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "content"?: string + readonly "error"?: string + readonly "httpStatus"?: number + readonly "id"?: string + readonly "status": ToolCallStatus + readonly "title"?: string + readonly "type": never + readonly "url"?: string + readonly "call_id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "id"?: string + readonly "query"?: string + readonly "status": ToolCallStatus + readonly "type": never + readonly "call_id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "action"?: "read" | "write" | "delete" + readonly "id"?: string + readonly "key"?: string + readonly "status": ToolCallStatus + readonly "type": never + readonly "value"?: unknown + readonly "call_id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "id"?: string + readonly "serverLabel"?: string + readonly "status": ToolCallStatus + readonly "toolName"?: string + readonly "type": never + readonly "call_id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "arguments"?: string + readonly "id"?: string + readonly "query"?: string + readonly "status": ToolCallStatus + readonly "type": never + readonly "call_id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "analysis"?: { + readonly "blind_spots": ReadonlyArray + readonly "consensus": ReadonlyArray + readonly "contradictions": ReadonlyArray< + { + readonly "stances": ReadonlyArray<{ readonly "model": string; readonly "stance": string }> + readonly "topic": string + } + > + readonly "partial_coverage": ReadonlyArray< + { readonly "models": ReadonlyArray; readonly "point": string } + > + readonly "unique_insights": ReadonlyArray<{ readonly "insight": string; readonly "model": string }> + } + readonly "error"?: string + readonly "failed_models"?: ReadonlyArray<{ readonly "error": string; readonly "model": string }> + readonly "id"?: string + readonly "responses"?: ReadonlyArray<{ readonly "model": string }> + readonly "status": ToolCallStatus + readonly "type": never + readonly "call_id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + } | { + readonly "call_id": string + readonly "id"?: string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + readonly "type": "custom_tool_call" + } | { + readonly "content": ReadonlyArray + readonly "id": string + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + readonly "status": "completed" | "in_progress" + readonly "type": never + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + } | { + readonly "content"?: ReadonlyArray<{ readonly "text": string; readonly "type": "reasoning_text" }> + readonly "encrypted_content"?: string + readonly "id": string + readonly "status": "completed" | "in_progress" + readonly "summary": ReadonlyArray + readonly "type": never + readonly "format"?: ReasoningFormat + readonly "signature"?: string + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + } | { + readonly "arguments": string + readonly "call_id": string + readonly "id": string + readonly "name": string + readonly "namespace"?: string + readonly "status": "completed" | "in_progress" + readonly "type": never + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + } | { + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray<{ readonly "type": "url"; readonly "url": string }> + readonly "type": "search" + } + | { readonly "type": never - readonly "refusal": string - readonly "text": string - readonly "annotations"?: ReadonlyArray - readonly "logprobs"?: ReadonlyArray< - { - readonly "token": string - readonly "bytes": ReadonlyArray - readonly "logprob": number - readonly "top_logprobs": ReadonlyArray< - { readonly "token": string; readonly "bytes": ReadonlyArray; readonly "logprob": number } - > - } - > - } | { + readonly "url"?: string + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + } + | { + readonly "pattern": string readonly "type": never - readonly "text": string - readonly "annotations"?: ReadonlyArray - readonly "logprobs"?: ReadonlyArray< - { - readonly "token": string - readonly "bytes": ReadonlyArray - readonly "logprob": number - readonly "top_logprobs": ReadonlyArray< - { readonly "token": string; readonly "bytes": ReadonlyArray; readonly "logprob": number } - > - } - > - readonly "refusal": string - } | { readonly "type": "refusal"; readonly "refusal": string } + readonly "url": string + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + } + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": never + readonly "url"?: string + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": never; readonly "url": string } + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": never + readonly "pattern": string + readonly "url": string + } + | { readonly "type": never; readonly "url": string; readonly "pattern": string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + readonly "id": string + readonly "status": "completed" | "searching" | "in_progress" | "failed" + readonly "type": "web_search_call" + } | { + readonly "id": string + readonly "queries": ReadonlyArray + readonly "status": "completed" | "searching" | "in_progress" | "failed" + readonly "type": never + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + } | { + readonly "id": string + readonly "result"?: string + readonly "status": "in_progress" | "completed" | "failed" + readonly "type": never + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + } | { + readonly "code": string + readonly "container_id": string + readonly "id": string + readonly "outputs": ReadonlyArray< + { readonly "type": "image"; readonly "url": string } | { readonly "logs": string; readonly "type": "logs" } + > + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + } | { + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + readonly "call_id": string + readonly "id": string + readonly "pending_safety_checks": ReadonlyArray< + { readonly "code": string; readonly "id": string; readonly "message": string } > + readonly "status": "completed" | "in_progress" + readonly "type": never + } | { + readonly "datetime": string + readonly "id": string + readonly "status": "in_progress" | "completed" + readonly "timezone": string + readonly "type": never + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + } | { + readonly "action": { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray<{ readonly "type": "url"; readonly "url": string }> + readonly "type": "search" + } | { + readonly "type": never + readonly "url"?: string + readonly "query": string + readonly "sources"?: ReadonlyArray<{ readonly "type": "url"; readonly "url": string }> + } | { + readonly "pattern": string + readonly "type": never + readonly "url": string + readonly "query": string + readonly "sources"?: ReadonlyArray<{ readonly "type": "url"; readonly "url": string }> + } + readonly "id": string + readonly "status": "in_progress" | "completed" + readonly "type": never + } | { + readonly "code"?: string + readonly "exitCode"?: number + readonly "id": string + readonly "language"?: string + readonly "status": "in_progress" | "completed" + readonly "stderr"?: string + readonly "stdout"?: string + readonly "type": never + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + } | { + readonly "id": string + readonly "queries"?: ReadonlyArray + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + } | { + readonly "id": string + readonly "imageB64"?: string + readonly "imageUrl"?: string + readonly "result"?: string + readonly "revisedPrompt"?: string + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + } | { + readonly "action": never + readonly "id": string + readonly "screenshotB64"?: string + readonly "status": "in_progress" | "completed" + readonly "type": never + } | { + readonly "command"?: string + readonly "exitCode"?: number + readonly "id": string + readonly "status": "in_progress" | "completed" + readonly "stderr"?: string + readonly "stdout"?: string + readonly "type": never + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } } | { + readonly "command"?: "view" | "create" | "str_replace" | "insert" + readonly "filePath"?: string + readonly "id": string + readonly "status": "in_progress" | "completed" readonly "type": never + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + } | { + readonly "call_id"?: string readonly "id": string - readonly "content": ReadonlyArray< - { - readonly "type": never - readonly "text": string - readonly "annotations"?: ReadonlyArray - readonly "logprobs"?: ReadonlyArray< - { - readonly "token": string - readonly "bytes": ReadonlyArray - readonly "logprob": number - readonly "top_logprobs": ReadonlyArray< - { readonly "token": string; readonly "bytes": ReadonlyArray; readonly "logprob": number } - > - } - > - } | { readonly "type": never; readonly "refusal": string; readonly "text": string } - > - readonly "summary": ReadonlyArray + readonly "operation"?: ApplyPatchCallOperation + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + } | { + readonly "call_id": string + readonly "id": string + readonly "operation": ApplyPatchCallOperation + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + } | { + readonly "content"?: string + readonly "error"?: string + readonly "httpStatus"?: number + readonly "id": string + readonly "status": "in_progress" | "completed" + readonly "title"?: string + readonly "type": never + readonly "url"?: string + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + } | { + readonly "id": string + readonly "query"?: string + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + } | { + readonly "action": never + readonly "id": string + readonly "key"?: string + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "value"?: unknown + } | { + readonly "id": string + readonly "serverLabel"?: string + readonly "status": "in_progress" | "completed" + readonly "toolName"?: string + readonly "type": never + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + } | { + readonly "arguments"?: string + readonly "id": string + readonly "query"?: string + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + } | { + readonly "analysis"?: { + readonly "blind_spots": ReadonlyArray + readonly "consensus": ReadonlyArray + readonly "contradictions": ReadonlyArray< + { + readonly "stances": ReadonlyArray<{ readonly "model": string; readonly "stance": string }> + readonly "topic": string + } + > + readonly "partial_coverage": ReadonlyArray< + { readonly "models": ReadonlyArray; readonly "point": string } + > + readonly "unique_insights": ReadonlyArray<{ readonly "insight": string; readonly "model": string }> + } + readonly "error"?: string + readonly "failed_models"?: ReadonlyArray<{ readonly "error": string; readonly "model": string }> + readonly "id": string + readonly "responses"?: ReadonlyArray<{ readonly "model": string }> + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + } | { + readonly "call_id": string + readonly "id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + readonly "type": never + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + readonly "status": WebSearchStatus + } | { + readonly "content": ReadonlyArray + readonly "id": string + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + readonly "status": "completed" | "in_progress" + readonly "type": never + readonly "queries": ReadonlyArray + } | { + readonly "content"?: ReadonlyArray<{ readonly "text": string; readonly "type": "reasoning_text" }> readonly "encrypted_content"?: string - readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "id": string + readonly "status": "completed" | "in_progress" + readonly "summary": ReadonlyArray + readonly "type": never + readonly "format"?: ReasoningFormat readonly "signature"?: string - readonly "format"?: - | "unknown" - | "openai-responses-v1" - | "azure-openai-responses-v1" - | "xai-responses-v1" - | "anthropic-claude-v1" - | "google-gemini-v1" + readonly "queries": ReadonlyArray + } | { + readonly "arguments": string + readonly "call_id": string + readonly "id": string + readonly "name": string + readonly "namespace"?: string + readonly "status": "completed" | "in_progress" + readonly "type": never + readonly "queries": ReadonlyArray + } | { + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + readonly "id": string + readonly "status": "completed" | "searching" | "in_progress" | "failed" + readonly "type": never + readonly "queries": ReadonlyArray + } | { + readonly "id": string + readonly "queries": ReadonlyArray + readonly "status": "completed" | "searching" | "in_progress" | "failed" + readonly "type": "file_search_call" + } | { + readonly "id": string + readonly "result"?: string + readonly "status": "in_progress" | "completed" | "failed" + readonly "type": never + readonly "queries": ReadonlyArray + } | { + readonly "code": string + readonly "container_id": string + readonly "id": string + readonly "outputs": ReadonlyArray< + { readonly "type": "image"; readonly "url": string } | { readonly "logs": string; readonly "type": "logs" } + > + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "queries": ReadonlyArray + } | { + readonly "action"?: unknown + readonly "call_id": string + readonly "id": string + readonly "pending_safety_checks": ReadonlyArray< + { readonly "code": string; readonly "id": string; readonly "message": string } + > + readonly "status": "completed" | "in_progress" + readonly "type": never + readonly "queries": ReadonlyArray + } | { + readonly "datetime": string + readonly "id": string + readonly "status": "in_progress" | "completed" + readonly "timezone": string + readonly "type": never + readonly "queries": ReadonlyArray + } | { + readonly "action"?: { + readonly "query": string + readonly "sources"?: ReadonlyArray<{ readonly "type": "url"; readonly "url": string }> + readonly "type": "search" + } + readonly "id": string + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "queries": ReadonlyArray + } | { + readonly "code"?: string + readonly "exitCode"?: number + readonly "id": string + readonly "language"?: string + readonly "status": "in_progress" | "completed" + readonly "stderr"?: string + readonly "stdout"?: string + readonly "type": never + readonly "queries": ReadonlyArray + } | { + readonly "id": string + readonly "queries": ReadonlyArray + readonly "status": "in_progress" | "completed" + readonly "type": never + } | { + readonly "id": string + readonly "imageB64"?: string + readonly "imageUrl"?: string + readonly "result"?: string + readonly "revisedPrompt"?: string + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "queries": ReadonlyArray + } | { + readonly "action"?: string + readonly "id": string + readonly "screenshotB64"?: string + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "queries": ReadonlyArray + } | { + readonly "command"?: string + readonly "exitCode"?: number + readonly "id": string + readonly "status": "in_progress" | "completed" + readonly "stderr"?: string + readonly "stdout"?: string + readonly "type": never + readonly "queries": ReadonlyArray + } | { + readonly "command"?: "view" | "create" | "str_replace" | "insert" + readonly "filePath"?: string + readonly "id": string + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "queries": ReadonlyArray + } | { + readonly "call_id"?: string + readonly "id": string + readonly "operation"?: ApplyPatchCallOperation + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "queries": ReadonlyArray + } | { + readonly "call_id": string + readonly "id": string + readonly "operation": ApplyPatchCallOperation + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "queries": ReadonlyArray + } | { + readonly "content"?: string + readonly "error"?: string + readonly "httpStatus"?: number + readonly "id": string + readonly "status": "in_progress" | "completed" + readonly "title"?: string + readonly "type": never + readonly "url"?: string + readonly "queries": ReadonlyArray + } | { + readonly "id": string + readonly "query"?: string + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "queries": ReadonlyArray + } | { + readonly "action"?: "read" | "write" | "delete" + readonly "id": string + readonly "key"?: string + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "value"?: unknown + readonly "queries": ReadonlyArray + } | { + readonly "id": string + readonly "serverLabel"?: string + readonly "status": "in_progress" | "completed" + readonly "toolName"?: string + readonly "type": never + readonly "queries": ReadonlyArray + } | { + readonly "arguments"?: string + readonly "id": string + readonly "query"?: string + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "queries": ReadonlyArray + } | { + readonly "analysis"?: { + readonly "blind_spots": ReadonlyArray + readonly "consensus": ReadonlyArray + readonly "contradictions": ReadonlyArray< + { + readonly "stances": ReadonlyArray<{ readonly "model": string; readonly "stance": string }> + readonly "topic": string + } + > + readonly "partial_coverage": ReadonlyArray< + { readonly "models": ReadonlyArray; readonly "point": string } + > + readonly "unique_insights": ReadonlyArray<{ readonly "insight": string; readonly "model": string }> + } + readonly "error"?: string + readonly "failed_models"?: ReadonlyArray<{ readonly "error": string; readonly "model": string }> + readonly "id": string + readonly "responses"?: ReadonlyArray<{ readonly "model": string }> + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "queries": ReadonlyArray + } | { + readonly "call_id": string + readonly "id": string + readonly "input": string + readonly "name": string + readonly "namespace"?: string + readonly "type": never + readonly "queries": ReadonlyArray + readonly "status": WebSearchStatus + } | { + readonly "content": ReadonlyArray + readonly "id": string + readonly "phase"?: "commentary" | "final_answer" | unknown readonly "role": "assistant" + readonly "status": "completed" | "in_progress" + readonly "type": never + readonly "result"?: string + } | { + readonly "content"?: ReadonlyArray<{ readonly "text": string; readonly "type": "reasoning_text" }> + readonly "encrypted_content"?: string + readonly "id": string + readonly "status": "completed" | "in_progress" + readonly "summary": ReadonlyArray + readonly "type": never + readonly "format"?: ReasoningFormat + readonly "signature"?: string + readonly "result"?: string + } | { + readonly "arguments": string + readonly "call_id": string + readonly "id": string + readonly "name": string + readonly "namespace"?: string + readonly "status": "completed" | "in_progress" + readonly "type": never + readonly "result"?: string + } | { + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } + readonly "id": string + readonly "status": "completed" | "in_progress" | "failed" + readonly "type": never + readonly "result"?: string } | { + readonly "id": string + readonly "queries": ReadonlyArray + readonly "status": "completed" | "in_progress" | "failed" readonly "type": never + readonly "result"?: string + } | { readonly "id": string - readonly "name": string - readonly "arguments": string - readonly "call_id": string - readonly "status"?: "completed" | "incomplete" | "in_progress" - readonly "role": "assistant" - readonly "content": ReadonlyArray + readonly "result"?: string + readonly "status": "in_progress" | "completed" | "generating" | "failed" + readonly "type": "image_generation_call" } | { + readonly "code": string + readonly "container_id": string + readonly "id": string + readonly "outputs": ReadonlyArray< + { readonly "type": "image"; readonly "url": string } | { readonly "logs": string; readonly "type": "logs" } + > + readonly "status": "in_progress" | "completed" readonly "type": never + readonly "result"?: string + } | { + readonly "action"?: unknown + readonly "call_id": string readonly "id": string + readonly "pending_safety_checks": ReadonlyArray< + { readonly "code": string; readonly "id": string; readonly "message": string } + > readonly "status": "completed" | "in_progress" - readonly "role": "assistant" - readonly "content": ReadonlyArray + readonly "type": never + readonly "result"?: string + } | { + readonly "datetime": string + readonly "id": string + readonly "status": "in_progress" | "completed" + readonly "timezone": string + readonly "type": never + readonly "result"?: string } | { + readonly "action"?: { + readonly "query": string + readonly "sources"?: ReadonlyArray<{ readonly "type": "url"; readonly "url": string }> + readonly "type": "search" + } + readonly "id": string + readonly "status": "in_progress" | "completed" readonly "type": never + readonly "result"?: string + } | { + readonly "code"?: string + readonly "exitCode"?: number readonly "id": string - readonly "queries": ReadonlyArray - readonly "status": "completed" | "in_progress" - readonly "role": "assistant" - readonly "content": ReadonlyArray + readonly "language"?: string + readonly "status": "in_progress" | "completed" + readonly "stderr"?: string + readonly "stdout"?: string + readonly "type": never + readonly "result"?: string } | { + readonly "id": string + readonly "queries"?: ReadonlyArray + readonly "status": "in_progress" | "completed" readonly "type": never + readonly "result"?: string + } | { readonly "id": string + readonly "imageB64"?: string + readonly "imageUrl"?: string readonly "result"?: string + readonly "revisedPrompt"?: string readonly "status": "in_progress" | "completed" - readonly "role": "assistant" - readonly "content": ReadonlyArray + readonly "type": never } | { + readonly "action"?: string readonly "id": string - readonly "role": "assistant" + readonly "screenshotB64"?: string + readonly "status": "in_progress" | "completed" readonly "type": never - readonly "status"?: "completed" | "incomplete" | "in_progress" - readonly "content": ReadonlyArray< - { - readonly "type": never - readonly "text": string - readonly "annotations"?: ReadonlyArray - readonly "logprobs"?: ReadonlyArray< - { - readonly "token": string - readonly "bytes": ReadonlyArray - readonly "logprob": number - readonly "top_logprobs": ReadonlyArray< - { readonly "token": string; readonly "bytes": ReadonlyArray; readonly "logprob": number } - > - } - > - } | { readonly "type": never; readonly "refusal": string; readonly "text": string } - > - readonly "summary": ReadonlyArray - readonly "encrypted_content"?: string + readonly "result"?: string } | { - readonly "type": "reasoning" + readonly "command"?: string + readonly "exitCode"?: number readonly "id": string - readonly "content"?: ReadonlyArray<{ readonly "type": "reasoning_text"; readonly "text": string }> - readonly "summary": ReadonlyArray<{ readonly "type": "summary_text"; readonly "text": string }> - readonly "encrypted_content"?: string - readonly "status"?: "completed" | "incomplete" | "in_progress" - readonly "signature"?: string - readonly "format"?: - | "unknown" - | "openai-responses-v1" - | "azure-openai-responses-v1" - | "xai-responses-v1" - | "anthropic-claude-v1" - | "google-gemini-v1" + readonly "status": "in_progress" | "completed" + readonly "stderr"?: string + readonly "stdout"?: string + readonly "type": never + readonly "result"?: string } | { + readonly "command"?: "view" | "create" | "str_replace" | "insert" + readonly "filePath"?: string + readonly "id": string + readonly "status": "in_progress" | "completed" readonly "type": never + readonly "result"?: string + } | { + readonly "call_id"?: string readonly "id": string - readonly "name": string - readonly "arguments": string - readonly "call_id": string - readonly "status"?: "completed" | "incomplete" | "in_progress" - readonly "content"?: ReadonlyArray - readonly "summary": ReadonlyArray - readonly "encrypted_content"?: string + readonly "operation"?: ApplyPatchCallOperation + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "result"?: string } | { + readonly "call_id": string + readonly "id": string + readonly "operation": ApplyPatchCallOperation + readonly "status": "in_progress" | "completed" readonly "type": never + readonly "result"?: string + } | { + readonly "content"?: string + readonly "error"?: string + readonly "httpStatus"?: number readonly "id": string - readonly "status": "completed" | "in_progress" - readonly "content"?: ReadonlyArray - readonly "summary": ReadonlyArray - readonly "encrypted_content"?: string + readonly "status": "in_progress" | "completed" + readonly "title"?: string + readonly "type": never + readonly "url"?: string + readonly "result"?: string } | { + readonly "id": string + readonly "query"?: string + readonly "status": "in_progress" | "completed" readonly "type": never + readonly "result"?: string + } | { + readonly "action"?: "read" | "write" | "delete" readonly "id": string - readonly "queries": ReadonlyArray - readonly "status": "completed" | "in_progress" - readonly "content"?: ReadonlyArray - readonly "summary": ReadonlyArray - readonly "encrypted_content"?: string + readonly "key"?: string + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "value"?: unknown + readonly "result"?: string } | { + readonly "id": string + readonly "serverLabel"?: string + readonly "status": "in_progress" | "completed" + readonly "toolName"?: string readonly "type": never + readonly "result"?: string + } | { + readonly "arguments"?: string readonly "id": string + readonly "query"?: string + readonly "status": "in_progress" | "completed" + readonly "type": never readonly "result"?: string + } | { + readonly "analysis"?: { + readonly "blind_spots": ReadonlyArray + readonly "consensus": ReadonlyArray + readonly "contradictions": ReadonlyArray< + { + readonly "stances": ReadonlyArray<{ readonly "model": string; readonly "stance": string }> + readonly "topic": string + } + > + readonly "partial_coverage": ReadonlyArray< + { readonly "models": ReadonlyArray; readonly "point": string } + > + readonly "unique_insights": ReadonlyArray<{ readonly "insight": string; readonly "model": string }> + } + readonly "error"?: string + readonly "failed_models"?: ReadonlyArray<{ readonly "error": string; readonly "model": string }> + readonly "id": string + readonly "responses"?: ReadonlyArray<{ readonly "model": string }> readonly "status": "in_progress" | "completed" - readonly "content"?: ReadonlyArray - readonly "summary": ReadonlyArray - readonly "encrypted_content"?: string + readonly "type": never + readonly "result"?: string } | { + readonly "call_id": string readonly "id": string - readonly "role": "assistant" + readonly "input": string + readonly "name": string + readonly "namespace"?: string readonly "type": never - readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "result"?: string + readonly "status": ImageGenerationStatus + } | { readonly "content": ReadonlyArray - readonly "name": string - readonly "arguments": string + readonly "id": string + readonly "phase"?: "commentary" | "final_answer" | unknown + readonly "role": "assistant" + readonly "status": "completed" | "in_progress" + readonly "type": never readonly "call_id": string + readonly "created_by"?: string + readonly "operation": + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation } | { - readonly "type": never + readonly "content"?: ReadonlyArray<{ readonly "text": string; readonly "type": "reasoning_text" }> + readonly "encrypted_content"?: string readonly "id": string - readonly "content"?: ReadonlyArray + readonly "status": "completed" | "in_progress" readonly "summary": ReadonlyArray - readonly "encrypted_content"?: string - readonly "status"?: "completed" | "incomplete" | "in_progress" + readonly "type": never + readonly "format"?: ReasoningFormat readonly "signature"?: string - readonly "format"?: - | "unknown" - | "openai-responses-v1" - | "azure-openai-responses-v1" - | "xai-responses-v1" - | "anthropic-claude-v1" - | "google-gemini-v1" - readonly "name": string - readonly "arguments": string readonly "call_id": string + readonly "created_by"?: string + readonly "operation": + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation } | { - readonly "type": "function_call" - readonly "id"?: string - readonly "name": string readonly "arguments": string readonly "call_id": string - readonly "status"?: "completed" | "incomplete" | "in_progress" - } | { + readonly "id": string + readonly "name": string + readonly "namespace"?: string + readonly "status": "completed" | "in_progress" readonly "type": never + readonly "created_by"?: string + readonly "operation": + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation + } | { + readonly "action": + | { + readonly "queries"?: ReadonlyArray + readonly "query": string + readonly "sources"?: ReadonlyArray + readonly "type": "search" + } + | { readonly "type": "open_page"; readonly "url"?: string } + | { readonly "pattern": string; readonly "type": "find_in_page"; readonly "url": string } readonly "id": string readonly "status": "completed" | "in_progress" - readonly "name": string - readonly "arguments": string + readonly "type": never readonly "call_id": string + readonly "created_by"?: string + readonly "operation": + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation } | { - readonly "type": never readonly "id": string readonly "queries": ReadonlyArray readonly "status": "completed" | "in_progress" - readonly "name": string - readonly "arguments": string + readonly "type": never readonly "call_id": string + readonly "created_by"?: string + readonly "operation": + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation } | { - readonly "type": never readonly "id": string readonly "result"?: string readonly "status": "in_progress" | "completed" - readonly "name": string - readonly "arguments": string + readonly "type": never readonly "call_id": string + readonly "created_by"?: string + readonly "operation": + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation } | { + readonly "code": string + readonly "container_id": string readonly "id": string - readonly "role": "assistant" + readonly "outputs": ReadonlyArray< + { readonly "type": "image"; readonly "url": string } | { readonly "logs": string; readonly "type": "logs" } + > + readonly "status": "in_progress" | "completed" readonly "type": never - readonly "status": "completed" | "in_progress" - readonly "content": ReadonlyArray + readonly "call_id": string + readonly "created_by"?: string + readonly "operation": + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation } | { - readonly "type": never + readonly "action"?: unknown + readonly "call_id": string readonly "id": string - readonly "content"?: ReadonlyArray - readonly "summary": ReadonlyArray - readonly "encrypted_content"?: string + readonly "pending_safety_checks": ReadonlyArray< + { readonly "code": string; readonly "id": string; readonly "message": string } + > readonly "status": "completed" | "in_progress" - readonly "signature"?: string - readonly "format"?: - | "unknown" - | "openai-responses-v1" - | "azure-openai-responses-v1" - | "xai-responses-v1" - | "anthropic-claude-v1" - | "google-gemini-v1" - } | { readonly "type": never + readonly "created_by"?: string + readonly "operation": + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation + } | { + readonly "datetime": string readonly "id": string - readonly "name": string - readonly "arguments": string + readonly "status": "in_progress" | "completed" + readonly "timezone": string + readonly "type": never readonly "call_id": string - readonly "status": "completed" | "in_progress" + readonly "created_by"?: string + readonly "operation": + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation } | { - readonly "type": "web_search_call" + readonly "action"?: { + readonly "query": string + readonly "sources"?: ReadonlyArray<{ readonly "type": "url"; readonly "url": string }> + readonly "type": "search" + } readonly "id": string - readonly "status": "completed" | "searching" | "in_progress" | "failed" - } | { + readonly "status": "in_progress" | "completed" readonly "type": never + readonly "call_id": string + readonly "created_by"?: string + readonly "operation": + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation + } | { + readonly "code"?: string + readonly "exitCode"?: number readonly "id": string - readonly "queries": ReadonlyArray - readonly "status": "completed" | "searching" | "in_progress" | "failed" + readonly "language"?: string + readonly "status": "in_progress" | "completed" + readonly "stderr"?: string + readonly "stdout"?: string + readonly "type": never + readonly "call_id": string + readonly "created_by"?: string + readonly "operation": + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation } | { + readonly "id": string + readonly "queries"?: ReadonlyArray + readonly "status": "in_progress" | "completed" readonly "type": never + readonly "call_id": string + readonly "created_by"?: string + readonly "operation": + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation + } | { readonly "id": string + readonly "imageB64"?: string + readonly "imageUrl"?: string readonly "result"?: string - readonly "status": "in_progress" | "completed" | "failed" + readonly "revisedPrompt"?: string + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "call_id": string + readonly "created_by"?: string + readonly "operation": + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation } | { + readonly "action"?: string readonly "id": string - readonly "role": "assistant" + readonly "screenshotB64"?: string + readonly "status": "in_progress" | "completed" readonly "type": never - readonly "status": "completed" | "in_progress" - readonly "content": ReadonlyArray - readonly "queries": ReadonlyArray + readonly "call_id": string + readonly "created_by"?: string + readonly "operation": + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation } | { - readonly "type": never + readonly "command"?: string + readonly "exitCode"?: number readonly "id": string - readonly "content"?: ReadonlyArray - readonly "summary": ReadonlyArray - readonly "encrypted_content"?: string - readonly "status": "completed" | "in_progress" - readonly "signature"?: string - readonly "format"?: - | "unknown" - | "openai-responses-v1" - | "azure-openai-responses-v1" - | "xai-responses-v1" - | "anthropic-claude-v1" - | "google-gemini-v1" - readonly "queries": ReadonlyArray - } | { + readonly "status": "in_progress" | "completed" + readonly "stderr"?: string + readonly "stdout"?: string readonly "type": never - readonly "id": string - readonly "name": string - readonly "arguments": string readonly "call_id": string - readonly "status": "completed" | "in_progress" - readonly "queries": ReadonlyArray + readonly "created_by"?: string + readonly "operation": + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation } | { - readonly "type": never + readonly "command"?: "view" | "create" | "str_replace" | "insert" + readonly "filePath"?: string readonly "id": string - readonly "status": "completed" | "searching" | "in_progress" | "failed" - readonly "queries": ReadonlyArray + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "call_id": string + readonly "created_by"?: string + readonly "operation": + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation } | { - readonly "type": "file_search_call" + readonly "call_id": string readonly "id": string - readonly "queries": ReadonlyArray - readonly "status": "completed" | "searching" | "in_progress" | "failed" - } | { + readonly "operation": + | { readonly "diff": string; readonly "path": string; readonly "type": "create_file" } + | { readonly "diff": string; readonly "path": string; readonly "type": never } + | { readonly "path": string; readonly "type": never; readonly "diff": string } + | { readonly "diff": string; readonly "path": string; readonly "type": never } + | { readonly "diff": string; readonly "path": string; readonly "type": "update_file" } + | { readonly "path": string; readonly "type": never; readonly "diff": string } + | { readonly "diff": string; readonly "path": string; readonly "type": never } + | { readonly "diff": string; readonly "path": string; readonly "type": never } + | { readonly "path": string; readonly "type": "delete_file" } + readonly "status": "in_progress" | "completed" readonly "type": never + readonly "created_by"?: string + } | { + readonly "call_id": string readonly "id": string - readonly "result"?: string - readonly "status": "in_progress" | "completed" | "failed" - readonly "queries": ReadonlyArray + readonly "operation": + | { readonly "diff": string; readonly "path": string; readonly "type": "create_file" } + | { readonly "diff": string; readonly "path": string; readonly "type": never } + | { readonly "path": string; readonly "type": never; readonly "diff": string } + | { readonly "diff": string; readonly "path": string; readonly "type": never } + | { readonly "diff": string; readonly "path": string; readonly "type": "update_file" } + | { readonly "path": string; readonly "type": never; readonly "diff": string } + | { readonly "diff": string; readonly "path": string; readonly "type": never } + | { readonly "diff": string; readonly "path": string; readonly "type": never } + | { readonly "path": string; readonly "type": "delete_file" } + readonly "status": "in_progress" | "completed" + readonly "type": "apply_patch_call" + readonly "created_by"?: string } | { + readonly "content"?: string + readonly "error"?: string + readonly "httpStatus"?: number readonly "id": string - readonly "role": "assistant" + readonly "status": "in_progress" | "completed" + readonly "title"?: string readonly "type": never - readonly "status": "completed" | "in_progress" - readonly "content": ReadonlyArray - readonly "result"?: string + readonly "url"?: string + readonly "call_id": string + readonly "created_by"?: string + readonly "operation": + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation } | { - readonly "type": never readonly "id": string - readonly "content"?: ReadonlyArray - readonly "summary": ReadonlyArray - readonly "encrypted_content"?: string - readonly "status": "completed" | "in_progress" - readonly "signature"?: string - readonly "format"?: - | "unknown" - | "openai-responses-v1" - | "azure-openai-responses-v1" - | "xai-responses-v1" - | "anthropic-claude-v1" - | "google-gemini-v1" - readonly "result"?: string - } | { + readonly "query"?: string + readonly "status": "in_progress" | "completed" readonly "type": never - readonly "id": string - readonly "name": string - readonly "arguments": string readonly "call_id": string - readonly "status": "completed" | "in_progress" - readonly "result"?: string + readonly "created_by"?: string + readonly "operation": + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation } | { + readonly "action"?: "read" | "write" | "delete" + readonly "id": string + readonly "key"?: string + readonly "status": "in_progress" | "completed" readonly "type": never + readonly "value"?: unknown + readonly "call_id": string + readonly "created_by"?: string + readonly "operation": + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation + } | { readonly "id": string - readonly "status": "completed" | "in_progress" | "failed" - readonly "result"?: string + readonly "serverLabel"?: string + readonly "status": "in_progress" | "completed" + readonly "toolName"?: string + readonly "type": never + readonly "call_id": string + readonly "created_by"?: string + readonly "operation": + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation } | { + readonly "arguments"?: string + readonly "id": string + readonly "query"?: string + readonly "status": "in_progress" | "completed" readonly "type": never + readonly "call_id": string + readonly "created_by"?: string + readonly "operation": + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation + } | { + readonly "analysis"?: { + readonly "blind_spots": ReadonlyArray + readonly "consensus": ReadonlyArray + readonly "contradictions": ReadonlyArray< + { + readonly "stances": ReadonlyArray<{ readonly "model": string; readonly "stance": string }> + readonly "topic": string + } + > + readonly "partial_coverage": ReadonlyArray< + { readonly "models": ReadonlyArray; readonly "point": string } + > + readonly "unique_insights": ReadonlyArray<{ readonly "insight": string; readonly "model": string }> + } + readonly "error"?: string + readonly "failed_models"?: ReadonlyArray<{ readonly "error": string; readonly "model": string }> readonly "id": string - readonly "queries": ReadonlyArray - readonly "status": "completed" | "in_progress" | "failed" - readonly "result"?: string + readonly "responses"?: ReadonlyArray<{ readonly "model": string }> + readonly "status": "in_progress" | "completed" + readonly "type": never + readonly "call_id": string + readonly "created_by"?: string + readonly "operation": + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation } | { - readonly "type": "image_generation_call" + readonly "call_id": string readonly "id": string - readonly "result"?: string - readonly "status": "in_progress" | "completed" | "generating" | "failed" + readonly "input": string + readonly "name": string + readonly "namespace"?: string + readonly "type": never + readonly "created_by"?: string + readonly "operation": + | ApplyPatchCreateFileOperation + | ApplyPatchUpdateFileOperation + | ApplyPatchDeleteFileOperation + readonly "status": "in_progress" | "completed" } > - readonly "user"?: string readonly "output_text"?: string + readonly "parallel_tool_calls": boolean + readonly "presence_penalty": number + readonly "previous_response_id"?: string + readonly "prompt"?: StoredPromptTemplate readonly "prompt_cache_key"?: string + readonly "reasoning"?: BaseReasoningConfig readonly "safety_identifier"?: string - readonly "error": ResponsesErrorField - readonly "incomplete_details": OpenAIResponsesIncompleteDetails + readonly "service_tier"?: "auto" | "default" | "flex" | "priority" | "scale" + readonly "status": OpenAIResponsesResponseStatus + readonly "store"?: boolean + readonly "temperature": number + readonly "text"?: { + readonly "format"?: + | { readonly "type": "text" } + | { readonly "type": never } + | { + readonly "description"?: string + readonly "name": string + readonly "schema": {} + readonly "strict"?: boolean + readonly "type": never + } + | { readonly "type": never } + | { readonly "type": "json_object" } + | { + readonly "description"?: string + readonly "name": string + readonly "schema": {} + readonly "strict"?: boolean + readonly "type": never + } + | { + readonly "type": never + readonly "description"?: string + readonly "name": string + readonly "schema": {} + readonly "strict"?: boolean + } + | { + readonly "type": never + readonly "description"?: string + readonly "name": string + readonly "schema": {} + readonly "strict"?: boolean + } + | { + readonly "description"?: string + readonly "name": string + readonly "schema": {} + readonly "strict"?: boolean + readonly "type": "json_schema" + } + readonly "verbosity"?: "high" | "low" | "medium" | null + } + readonly "tool_choice": OpenAIResponsesToolChoice + readonly "tools": ReadonlyArray< + | { + readonly "description"?: string + readonly "name": string + readonly "parameters": {} + readonly "strict"?: boolean + readonly "type": "function" + } + | Preview_WebSearchServerTool + | Preview_20250311_WebSearchServerTool + | Legacy_WebSearchServerTool + | WebSearchServerTool + | FileSearchServerTool + | ComputerUseServerTool + | CodeInterpreterServerTool + | McpServerTool + | ImageGenerationServerTool + | CodexLocalShellTool + | ShellServerTool + | ApplyPatchServerTool + | CustomTool + > + readonly "top_logprobs"?: number + readonly "top_p": number + readonly "truncation"?: Truncation readonly "usage"?: { readonly "input_tokens": number readonly "input_tokens_details": { readonly "cached_tokens": number } @@ -5534,1597 +14643,5955 @@ export type OpenResponsesNonStreamingResponse = { readonly "output_tokens_details": { readonly "reasoning_tokens": number } readonly "total_tokens": number readonly "cost"?: number - readonly "is_byok"?: boolean readonly "cost_details"?: { readonly "upstream_inference_cost"?: number readonly "upstream_inference_input_cost": number readonly "upstream_inference_output_cost": number } + readonly "is_byok"?: boolean } - readonly "max_tool_calls"?: number - readonly "top_logprobs"?: number - readonly "max_output_tokens"?: number - readonly "temperature": number - readonly "top_p": number - readonly "presence_penalty": number - readonly "frequency_penalty": number - readonly "instructions": OpenAIResponsesInput - readonly "metadata": OpenResponsesRequestMetadata - readonly "tools": ReadonlyArray< - | { - readonly "type": "function" - readonly "name": string - readonly "description"?: string - readonly "strict"?: boolean - readonly "parameters": {} - } - | OpenResponsesWebSearchPreviewTool - | OpenResponsesWebSearchPreview20250311Tool - | OpenResponsesWebSearchTool - | OpenResponsesWebSearch20250826Tool - > - readonly "tool_choice": OpenAIResponsesToolChoice - readonly "parallel_tool_calls": boolean - readonly "prompt"?: OpenAIResponsesPrompt - readonly "background"?: boolean - readonly "previous_response_id"?: string - readonly "reasoning"?: OpenAIResponsesReasoningConfig - readonly "service_tier"?: OpenAIResponsesServiceTier - readonly "store"?: boolean - readonly "truncation"?: OpenAIResponsesTruncation - readonly "text"?: ResponseTextConfig + readonly "user"?: string + readonly "openrouter_metadata"?: OpenRouterMetadata } -export const OpenResponsesNonStreamingResponse = Schema.Struct({ +export const OpenResponsesResult = Schema.Struct({ + "background": Schema.optionalKey(Schema.Boolean), + "completed_at": Schema.Number.check(Schema.isInt()), + "created_at": Schema.Number.check(Schema.isInt()), + "error": ResponsesErrorField, + "frequency_penalty": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), "id": Schema.String, - "object": Schema.Literal("response"), - "created_at": Schema.Number.check(Schema.isFinite()), + "incomplete_details": IncompleteDetails, + "instructions": BaseInputs, + "max_output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "max_tool_calls": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "metadata": RequestMetadata, "model": Schema.String, - "status": OpenAIResponsesResponseStatus, - "completed_at": Schema.Number.check(Schema.isFinite()), + "object": Schema.Literal("response"), "output": Schema.Array(Schema.Union([ Schema.Union([ Schema.Struct({ + "content": Schema.Array(Schema.Union([ + Schema.Union([ + Schema.Struct({ + "annotations": Schema.optionalKey( + Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + "file_id": Schema.String, + "filename": Schema.String, + "index": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("file_citation") + }), + Schema.Struct({ + "end_index": Schema.Number.check(Schema.isInt()), + "start_index": Schema.Number.check(Schema.isInt()), + "title": Schema.String, + "type": Schema.Never, + "url": Schema.String, + "file_id": Schema.String, + "filename": Schema.String, + "index": Schema.Number.check(Schema.isInt()) + }), + Schema.Struct({ + "file_id": Schema.String, + "index": Schema.Number.check(Schema.isInt()), + "type": Schema.Never, + "filename": Schema.String + }) + ]), + Schema.Union([ + Schema.Struct({ + "file_id": Schema.String, + "filename": Schema.String, + "index": Schema.Number.check(Schema.isInt()), + "type": Schema.Never, + "end_index": Schema.Number.check(Schema.isInt()), + "start_index": Schema.Number.check(Schema.isInt()), + "title": Schema.String, + "url": Schema.String + }), + Schema.Struct({ + "end_index": Schema.Number.check(Schema.isInt()), + "start_index": Schema.Number.check(Schema.isInt()), + "title": Schema.String, + "type": Schema.Literal("url_citation"), + "url": Schema.String + }), + Schema.Struct({ + "file_id": Schema.String, + "index": Schema.Number.check(Schema.isInt()), + "type": Schema.Never, + "end_index": Schema.Number.check(Schema.isInt()), + "start_index": Schema.Number.check(Schema.isInt()), + "title": Schema.String, + "url": Schema.String + }) + ]), + Schema.Union([ + Schema.Struct({ + "file_id": Schema.String, + "filename": Schema.String, + "index": Schema.Number.check(Schema.isInt()), + "type": Schema.Never + }), + Schema.Struct({ + "end_index": Schema.Number.check(Schema.isInt()), + "start_index": Schema.Number.check(Schema.isInt()), + "title": Schema.String, + "type": Schema.Never, + "url": Schema.String, + "file_id": Schema.String, + "index": Schema.Number.check(Schema.isInt()) + }), + Schema.Struct({ + "file_id": Schema.String, + "index": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("file_path") + }) + ]) + ]) + ) + ), + "logprobs": Schema.optionalKey(Schema.Array(Schema.Struct({ + "bytes": Schema.Array(Schema.Number.check(Schema.isInt())), + "logprob": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "token": Schema.String, + "top_logprobs": Schema.Array( + Schema.Struct({ + "bytes": Schema.Array(Schema.Number.check(Schema.isInt())), + "logprob": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "token": Schema.String + }) + ) + }))), + "text": Schema.String, + "type": Schema.Literal("output_text") + }), + Schema.Struct({ + "refusal": Schema.String, + "type": Schema.Never, + "annotations": Schema.optionalKey(Schema.Array(OpenAIResponsesAnnotation)), + "logprobs": Schema.optionalKey(Schema.Array(Schema.Struct({ + "bytes": Schema.Array(Schema.Number.check(Schema.isInt())), + "logprob": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "token": Schema.String, + "top_logprobs": Schema.Array( + Schema.Struct({ + "bytes": Schema.Array(Schema.Number.check(Schema.isInt())), + "logprob": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "token": Schema.String + }) + ) + }))), + "text": Schema.String + }) + ]), + Schema.Union([ + Schema.Struct({ + "annotations": Schema.optionalKey(Schema.Array(OpenAIResponsesAnnotation)), + "logprobs": Schema.optionalKey(Schema.Array(Schema.Struct({ + "bytes": Schema.Array(Schema.Number.check(Schema.isInt())), + "logprob": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "token": Schema.String, + "top_logprobs": Schema.Array( + Schema.Struct({ + "bytes": Schema.Array(Schema.Number.check(Schema.isInt())), + "logprob": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "token": Schema.String + }) + ) + }))), + "text": Schema.String, + "type": Schema.Never, + "refusal": Schema.String + }), + Schema.Struct({ "refusal": Schema.String, "type": Schema.Literal("refusal") }) + ]) + ])), + "id": Schema.String, + "phase": Schema.optionalKey( + Schema.Union([ + Schema.Literals(["commentary", "commentary"]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }), + Schema.Literals(["final_answer", "final_answer"]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }), + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant"), + "status": Schema.optionalKey( + Schema.Union([Schema.Literal("completed"), Schema.Literal("incomplete"), Schema.Literal("in_progress")]) + ), + "type": Schema.Literal("message") + }).annotate({ "description": "An output message item" }), + Schema.Struct({ + "content": Schema.Array(Schema.Union([ + Schema.Struct({ + "annotations": Schema.optionalKey(Schema.Array(OpenAIResponsesAnnotation)), + "logprobs": Schema.optionalKey(Schema.Array(Schema.Struct({ + "bytes": Schema.Array(Schema.Number.check(Schema.isInt())), + "logprob": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "token": Schema.String, + "top_logprobs": Schema.Array( + Schema.Struct({ + "bytes": Schema.Array(Schema.Number.check(Schema.isInt())), + "logprob": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "token": Schema.String + }) + ) + }))), + "text": Schema.String, + "type": Schema.Never + }), + Schema.Struct({ "refusal": Schema.String, "type": Schema.Never, "text": Schema.String }) + ])), + "encrypted_content": Schema.optionalKey(Schema.String), + "id": Schema.String, + "status": Schema.optionalKey( + Schema.Union([Schema.Literal("completed"), Schema.Literal("incomplete"), Schema.Literal("in_progress")]) + ), + "summary": Schema.Array(ReasoningSummaryText), + "type": Schema.Never, + "format": Schema.optionalKey(ReasoningFormat), + "signature": Schema.optionalKey( + Schema.String.annotate({ "description": "A signature for the reasoning content, used for verification" }) + ), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant") + }).annotate({ "description": "An output item containing reasoning" }), + Schema.Struct({ + "arguments": Schema.String, + "call_id": Schema.String, + "id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ), + "status": Schema.optionalKey( + Schema.Union([Schema.Literal("completed"), Schema.Literal("incomplete"), Schema.Literal("in_progress")]) + ), + "type": Schema.Never, + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant") + }), + Schema.Struct({ + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }), + "id": Schema.String, + "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), + "type": Schema.Never, + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant") + }), + Schema.Struct({ + "id": Schema.String, + "queries": Schema.Array(Schema.String), + "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), + "type": Schema.Never, + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant") + }), + Schema.Struct({ + "id": Schema.String, + "result": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant") + }), + Schema.Struct({ + "code": Schema.String, + "container_id": Schema.String, + "id": Schema.String, + "outputs": Schema.Array( + Schema.Union([ + Schema.Struct({ "type": Schema.Literal("image"), "url": Schema.String }), + Schema.Struct({ "logs": Schema.String, "type": Schema.Literal("logs") }) + ]) + ), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant") + }).annotate({ "description": "A code interpreter execution call with outputs" }), + Schema.Struct({ + "action": Schema.optionalKey(Schema.Unknown), + "call_id": Schema.String, + "id": Schema.String, + "pending_safety_checks": Schema.Array( + Schema.Struct({ "code": Schema.String, "id": Schema.String, "message": Schema.String }) + ), + "status": Schema.Union([ + Schema.Literal("completed"), + Schema.Literal("incomplete"), + Schema.Literal("in_progress") + ]), + "type": Schema.Never, + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant") + }), + Schema.Struct({ + "datetime": Schema.String.annotate({ "description": "ISO 8601 datetime string" }), + "id": Schema.String, + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "timezone": Schema.String.annotate({ "description": "IANA timezone name" }), + "type": Schema.Never, + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant") + }).annotate({ "description": "An openrouter:datetime server tool output item" }), + Schema.Struct({ + "action": Schema.optionalKey( + Schema.Struct({ + "query": Schema.String, + "sources": Schema.optionalKey( + Schema.Array(Schema.Struct({ "type": Schema.Literal("url"), "url": Schema.String })) + ), + "type": Schema.Literal("search") + }).annotate({ + "description": + "The search action performed, matching OpenAI web_search_call.action shape. Includes the query the model issued and optional source URLs returned by the search provider." + }) + ), + "id": Schema.String, + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant") + }).annotate({ "description": "An openrouter:web_search server tool output item" }), + Schema.Struct({ + "code": Schema.optionalKey(Schema.String), + "exitCode": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "id": Schema.String, + "language": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "stderr": Schema.optionalKey(Schema.String), + "stdout": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant") + }).annotate({ "description": "An openrouter:code_interpreter server tool output item" }), + Schema.Struct({ + "id": Schema.String, + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant") + }).annotate({ "description": "An openrouter:file_search server tool output item" }), + Schema.Struct({ + "id": Schema.String, + "imageB64": Schema.optionalKey(Schema.String), + "imageUrl": Schema.optionalKey(Schema.String), + "result": Schema.optionalKey( + Schema.String.annotate({ + "description": + "The generated image as a base64-encoded string or URL, matching OpenAI image_generation_call format" + }) + ), + "revisedPrompt": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant") + }).annotate({ "description": "An openrouter:image_generation server tool output item" }), + Schema.Struct({ + "action": Schema.optionalKey(Schema.String), + "id": Schema.String, + "screenshotB64": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant") + }).annotate({ "description": "An openrouter:browser_use server tool output item" }), + Schema.Struct({ + "command": Schema.optionalKey(Schema.String), + "exitCode": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "id": Schema.String, + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "stderr": Schema.optionalKey(Schema.String), + "stdout": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant") + }).annotate({ "description": "An openrouter:bash server tool output item" }), + Schema.Struct({ + "command": Schema.optionalKey(Schema.Literals(["view", "create", "str_replace", "insert"])), + "filePath": Schema.optionalKey(Schema.String), + "id": Schema.String, + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant") + }).annotate({ "description": "An openrouter:text_editor server tool output item" }), + Schema.Struct({ + "call_id": Schema.optionalKey(Schema.String), + "id": Schema.String, + "operation": Schema.optionalKey(ApplyPatchCallOperation), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant") + }).annotate({ + "description": + "An openrouter:apply_patch server tool output item. The turn halts when validation succeeds so the client can apply the patch and echo an `apply_patch_call_output` on the next turn." + }), + Schema.Struct({ + "call_id": Schema.String, + "id": Schema.String, + "operation": ApplyPatchCallOperation, + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]).annotate({ + "description": "Lifecycle state of an `apply_patch_call` output item." + }), + "type": Schema.Never, + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant") + }).annotate({ + "description": + "A native `apply_patch_call` output item matching OpenAI's Responses API shape. Emitted when the client requested the `apply_patch` shorthand." + }), + Schema.Struct({ + "content": Schema.Never, + "error": Schema.optionalKey( + Schema.String.annotate({ "description": "The error message if the fetch failed." }) + ), + "httpStatus": Schema.optionalKey( + Schema.Number.annotate({ "description": "The HTTP status code returned by the upstream URL fetch." }).check( + Schema.isInt() + ) + ), + "id": Schema.String, + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "title": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "url": Schema.optionalKey(Schema.String), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant") + }).annotate({ "description": "An openrouter:web_fetch server tool output item" }), + Schema.Struct({ + "id": Schema.String, + "query": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant") + }).annotate({ "description": "An openrouter:tool_search server tool output item" }), + Schema.Struct({ + "action": Schema.optionalKey(Schema.Literals(["read", "write", "delete"])), + "id": Schema.String, + "key": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "value": Schema.optionalKey(Schema.Unknown), + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant") + }).annotate({ "description": "An openrouter:memory server tool output item" }), + Schema.Struct({ + "id": Schema.String, + "serverLabel": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "toolName": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant") + }).annotate({ "description": "An openrouter:mcp server tool output item" }), + Schema.Struct({ + "arguments": Schema.optionalKey( + Schema.String.annotate({ + "description": "The JSON arguments submitted to the search tool (e.g. {\"query\":\"Claude\"})" + }) + ), + "id": Schema.String, + "query": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant") + }).annotate({ "description": "An openrouter:experimental__search_models server tool output item" }), + Schema.Struct({ + "analysis": Schema.optionalKey( + Schema.Struct({ + "blind_spots": Schema.Array(Schema.String), + "consensus": Schema.Array(Schema.String), + "contradictions": Schema.Array( + Schema.Struct({ + "stances": Schema.Array(Schema.Struct({ "model": Schema.String, "stance": Schema.String })), + "topic": Schema.String + }) + ), + "partial_coverage": Schema.Array( + Schema.Struct({ "models": Schema.Array(Schema.String), "point": Schema.String }) + ), + "unique_insights": Schema.Array(Schema.Struct({ "insight": Schema.String, "model": Schema.String })) + }).annotate({ "description": "Structured analysis produced by the fusion judge model." }) + ), + "error": Schema.optionalKey( + Schema.String.annotate({ + "description": "Error message when the fusion run did not produce an analysis result." + }) + ), + "failed_models": Schema.optionalKey( + Schema.Array( + Schema.Struct({ + "error": Schema.String.annotate({ "description": "Error message describing why the model failed." }), + "model": Schema.String.annotate({ "description": "Slug of the analysis model that failed." }) + }) + ).annotate({ + "description": + "Models that were requested as part of the analysis panel but did not produce a response. Present when at least one requested analysis model failed. The fusion result is still usable but was produced from a degraded panel." + }) + ), + "id": Schema.String, + "responses": Schema.optionalKey( + Schema.Array(Schema.Struct({ "model": Schema.String })).annotate({ + "description": "Slugs of the analysis models that produced a response in this fusion run." + }) + ), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant") + }).annotate({ "description": "An openrouter:fusion server tool output item" }), + Schema.Struct({ + "call_id": Schema.String, + "id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ), + "type": Schema.Never, + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant"), + "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])) + }).annotate({ + "description": + "A call to a custom (freeform-grammar) tool created by the model — distinct from `function_call`. Used for tools like Codex CLI's `apply_patch` whose payload is opaque text rather than JSON arguments." + }) + ], { mode: "oneOf" }).annotate({ "description": "An output item from the response" }), + Schema.Union([ + Schema.Struct({ + "content": Schema.Array(Schema.Union([ + Schema.Struct({ + "annotations": Schema.optionalKey(Schema.Array(OpenAIResponsesAnnotation)), + "logprobs": Schema.optionalKey(Schema.Array(Schema.Struct({ + "bytes": Schema.Array(Schema.Number.check(Schema.isInt())), + "logprob": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "token": Schema.String, + "top_logprobs": Schema.Array( + Schema.Struct({ + "bytes": Schema.Array(Schema.Number.check(Schema.isInt())), + "logprob": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "token": Schema.String + }) + ) + }))), + "text": Schema.String, + "type": Schema.Never + }), + Schema.Struct({ "refusal": Schema.String, "type": Schema.Never, "text": Schema.String }) + ])), + "id": Schema.String, + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant"), + "status": Schema.optionalKey( + Schema.Union([Schema.Literal("completed"), Schema.Literal("incomplete"), Schema.Literal("in_progress")]) + ), + "type": Schema.Never, + "encrypted_content": Schema.optionalKey(Schema.String), + "summary": Schema.Array(ReasoningSummaryText) + }).annotate({ "description": "An output message item" }), + Schema.Struct({ + "content": Schema.optionalKey( + Schema.Array(Schema.Struct({ "text": Schema.String, "type": Schema.Literal("reasoning_text") })) + ), + "encrypted_content": Schema.optionalKey(Schema.String), + "id": Schema.String, + "status": Schema.optionalKey( + Schema.Union([Schema.Literal("completed"), Schema.Literal("incomplete"), Schema.Literal("in_progress")]) + ), + "summary": Schema.Array(Schema.Struct({ "text": Schema.String, "type": Schema.Literal("summary_text") })), + "type": Schema.Literal("reasoning"), + "format": Schema.optionalKey(ReasoningFormat), + "signature": Schema.optionalKey( + Schema.String.annotate({ "description": "A signature for the reasoning content, used for verification" }) + ) + }).annotate({ "description": "An output item containing reasoning" }), + Schema.Struct({ + "arguments": Schema.String, + "call_id": Schema.String, + "id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ), + "status": Schema.optionalKey( + Schema.Union([Schema.Literal("completed"), Schema.Literal("incomplete"), Schema.Literal("in_progress")]) + ), + "type": Schema.Never, + "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "encrypted_content": Schema.optionalKey(Schema.String), + "summary": Schema.Array(ReasoningSummaryText) + }), + Schema.Struct({ + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }), + "id": Schema.String, + "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), + "type": Schema.Never, + "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "encrypted_content": Schema.optionalKey(Schema.String), + "summary": Schema.Array(ReasoningSummaryText) + }), + Schema.Struct({ + "id": Schema.String, + "queries": Schema.Array(Schema.String), + "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), + "type": Schema.Never, + "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "encrypted_content": Schema.optionalKey(Schema.String), + "summary": Schema.Array(ReasoningSummaryText) + }), + Schema.Struct({ + "id": Schema.String, + "result": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "encrypted_content": Schema.optionalKey(Schema.String), + "summary": Schema.Array(ReasoningSummaryText) + }), + Schema.Struct({ + "code": Schema.String, + "container_id": Schema.String, + "id": Schema.String, + "outputs": Schema.Array( + Schema.Union([ + Schema.Struct({ "type": Schema.Literal("image"), "url": Schema.String }), + Schema.Struct({ "logs": Schema.String, "type": Schema.Literal("logs") }) + ]) + ), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "encrypted_content": Schema.optionalKey(Schema.String), + "summary": Schema.Array(ReasoningSummaryText) + }).annotate({ "description": "A code interpreter execution call with outputs" }), + Schema.Struct({ + "action": Schema.optionalKey(Schema.Unknown), + "call_id": Schema.String, + "id": Schema.String, + "pending_safety_checks": Schema.Array( + Schema.Struct({ "code": Schema.String, "id": Schema.String, "message": Schema.String }) + ), + "status": Schema.Union([ + Schema.Literal("completed"), + Schema.Literal("incomplete"), + Schema.Literal("in_progress") + ]), + "type": Schema.Never, + "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "encrypted_content": Schema.optionalKey(Schema.String), + "summary": Schema.Array(ReasoningSummaryText) + }), + Schema.Struct({ + "datetime": Schema.String.annotate({ "description": "ISO 8601 datetime string" }), + "id": Schema.String, + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "timezone": Schema.String.annotate({ "description": "IANA timezone name" }), + "type": Schema.Never, + "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "encrypted_content": Schema.optionalKey(Schema.String), + "summary": Schema.Array(ReasoningSummaryText) + }).annotate({ "description": "An openrouter:datetime server tool output item" }), + Schema.Struct({ + "action": Schema.optionalKey( + Schema.Struct({ + "query": Schema.String, + "sources": Schema.optionalKey( + Schema.Array(Schema.Struct({ "type": Schema.Literal("url"), "url": Schema.String })) + ), + "type": Schema.Literal("search") + }).annotate({ + "description": + "The search action performed, matching OpenAI web_search_call.action shape. Includes the query the model issued and optional source URLs returned by the search provider." + }) + ), + "id": Schema.String, + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "encrypted_content": Schema.optionalKey(Schema.String), + "summary": Schema.Array(ReasoningSummaryText) + }).annotate({ "description": "An openrouter:web_search server tool output item" }), + Schema.Struct({ + "code": Schema.optionalKey(Schema.String), + "exitCode": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "id": Schema.String, + "language": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "stderr": Schema.optionalKey(Schema.String), + "stdout": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "encrypted_content": Schema.optionalKey(Schema.String), + "summary": Schema.Array(ReasoningSummaryText) + }).annotate({ "description": "An openrouter:code_interpreter server tool output item" }), + Schema.Struct({ + "id": Schema.String, + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "encrypted_content": Schema.optionalKey(Schema.String), + "summary": Schema.Array(ReasoningSummaryText) + }).annotate({ "description": "An openrouter:file_search server tool output item" }), + Schema.Struct({ + "id": Schema.String, + "imageB64": Schema.optionalKey(Schema.String), + "imageUrl": Schema.optionalKey(Schema.String), + "result": Schema.optionalKey( + Schema.String.annotate({ + "description": + "The generated image as a base64-encoded string or URL, matching OpenAI image_generation_call format" + }) + ), + "revisedPrompt": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "encrypted_content": Schema.optionalKey(Schema.String), + "summary": Schema.Array(ReasoningSummaryText) + }).annotate({ "description": "An openrouter:image_generation server tool output item" }), + Schema.Struct({ + "action": Schema.optionalKey(Schema.String), + "id": Schema.String, + "screenshotB64": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "encrypted_content": Schema.optionalKey(Schema.String), + "summary": Schema.Array(ReasoningSummaryText) + }).annotate({ "description": "An openrouter:browser_use server tool output item" }), + Schema.Struct({ + "command": Schema.optionalKey(Schema.String), + "exitCode": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "id": Schema.String, + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "stderr": Schema.optionalKey(Schema.String), + "stdout": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "encrypted_content": Schema.optionalKey(Schema.String), + "summary": Schema.Array(ReasoningSummaryText) + }).annotate({ "description": "An openrouter:bash server tool output item" }), + Schema.Struct({ + "command": Schema.optionalKey(Schema.Literals(["view", "create", "str_replace", "insert"])), + "filePath": Schema.optionalKey(Schema.String), + "id": Schema.String, + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "encrypted_content": Schema.optionalKey(Schema.String), + "summary": Schema.Array(ReasoningSummaryText) + }).annotate({ "description": "An openrouter:text_editor server tool output item" }), + Schema.Struct({ + "call_id": Schema.optionalKey(Schema.String), + "id": Schema.String, + "operation": Schema.optionalKey(ApplyPatchCallOperation), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "encrypted_content": Schema.optionalKey(Schema.String), + "summary": Schema.Array(ReasoningSummaryText) + }).annotate({ + "description": + "An openrouter:apply_patch server tool output item. The turn halts when validation succeeds so the client can apply the patch and echo an `apply_patch_call_output` on the next turn." + }), + Schema.Struct({ + "call_id": Schema.String, + "id": Schema.String, + "operation": ApplyPatchCallOperation, + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]).annotate({ + "description": "Lifecycle state of an `apply_patch_call` output item." + }), + "type": Schema.Never, + "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "encrypted_content": Schema.optionalKey(Schema.String), + "summary": Schema.Array(ReasoningSummaryText) + }).annotate({ + "description": + "A native `apply_patch_call` output item matching OpenAI's Responses API shape. Emitted when the client requested the `apply_patch` shorthand." + }), + Schema.Struct({ + "content": Schema.optionalKey(Schema.Never), + "error": Schema.optionalKey( + Schema.String.annotate({ "description": "The error message if the fetch failed." }) + ), + "httpStatus": Schema.optionalKey( + Schema.Number.annotate({ "description": "The HTTP status code returned by the upstream URL fetch." }).check( + Schema.isInt() + ) + ), + "id": Schema.String, + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "title": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "url": Schema.optionalKey(Schema.String), + "encrypted_content": Schema.optionalKey(Schema.String), + "summary": Schema.Array(ReasoningSummaryText) + }).annotate({ "description": "An openrouter:web_fetch server tool output item" }), + Schema.Struct({ + "id": Schema.String, + "query": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "encrypted_content": Schema.optionalKey(Schema.String), + "summary": Schema.Array(ReasoningSummaryText) + }).annotate({ "description": "An openrouter:tool_search server tool output item" }), + Schema.Struct({ + "action": Schema.optionalKey(Schema.Literals(["read", "write", "delete"])), + "id": Schema.String, + "key": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "value": Schema.optionalKey(Schema.Unknown), + "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "encrypted_content": Schema.optionalKey(Schema.String), + "summary": Schema.Array(ReasoningSummaryText) + }).annotate({ "description": "An openrouter:memory server tool output item" }), + Schema.Struct({ + "id": Schema.String, + "serverLabel": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "toolName": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "encrypted_content": Schema.optionalKey(Schema.String), + "summary": Schema.Array(ReasoningSummaryText) + }).annotate({ "description": "An openrouter:mcp server tool output item" }), + Schema.Struct({ + "arguments": Schema.optionalKey( + Schema.String.annotate({ + "description": "The JSON arguments submitted to the search tool (e.g. {\"query\":\"Claude\"})" + }) + ), + "id": Schema.String, + "query": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "encrypted_content": Schema.optionalKey(Schema.String), + "summary": Schema.Array(ReasoningSummaryText) + }).annotate({ "description": "An openrouter:experimental__search_models server tool output item" }), + Schema.Struct({ + "analysis": Schema.optionalKey( + Schema.Struct({ + "blind_spots": Schema.Array(Schema.String), + "consensus": Schema.Array(Schema.String), + "contradictions": Schema.Array( + Schema.Struct({ + "stances": Schema.Array(Schema.Struct({ "model": Schema.String, "stance": Schema.String })), + "topic": Schema.String + }) + ), + "partial_coverage": Schema.Array( + Schema.Struct({ "models": Schema.Array(Schema.String), "point": Schema.String }) + ), + "unique_insights": Schema.Array(Schema.Struct({ "insight": Schema.String, "model": Schema.String })) + }).annotate({ "description": "Structured analysis produced by the fusion judge model." }) + ), + "error": Schema.optionalKey( + Schema.String.annotate({ + "description": "Error message when the fusion run did not produce an analysis result." + }) + ), + "failed_models": Schema.optionalKey( + Schema.Array( + Schema.Struct({ + "error": Schema.String.annotate({ "description": "Error message describing why the model failed." }), + "model": Schema.String.annotate({ "description": "Slug of the analysis model that failed." }) + }) + ).annotate({ + "description": + "Models that were requested as part of the analysis panel but did not produce a response. Present when at least one requested analysis model failed. The fusion result is still usable but was produced from a degraded panel." + }) + ), + "id": Schema.String, + "responses": Schema.optionalKey( + Schema.Array(Schema.Struct({ "model": Schema.String })).annotate({ + "description": "Slugs of the analysis models that produced a response in this fusion run." + }) + ), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "encrypted_content": Schema.optionalKey(Schema.String), + "summary": Schema.Array(ReasoningSummaryText) + }).annotate({ "description": "An openrouter:fusion server tool output item" }), + Schema.Struct({ + "call_id": Schema.String, + "id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ), + "type": Schema.Never, + "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), + "encrypted_content": Schema.optionalKey(Schema.String), + "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])), + "summary": Schema.Array(ReasoningSummaryText) + }).annotate({ + "description": + "A call to a custom (freeform-grammar) tool created by the model — distinct from `function_call`. Used for tools like Codex CLI's `apply_patch` whose payload is opaque text rather than JSON arguments." + }) + ], { mode: "oneOf" }).annotate({ "description": "An output item from the response" }), + Schema.Union([ + Schema.Struct({ + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "id": Schema.String, + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant"), + "status": Schema.optionalKey( + Schema.Union([Schema.Literal("completed"), Schema.Literal("incomplete"), Schema.Literal("in_progress")]) + ), + "type": Schema.Never, + "arguments": Schema.String, + "call_id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An output message item" }), + Schema.Struct({ + "content": Schema.optionalKey( + Schema.Array(Schema.Struct({ "text": Schema.String, "type": Schema.Literal("reasoning_text") })) + ), + "encrypted_content": Schema.optionalKey(Schema.String), + "id": Schema.String, + "status": Schema.optionalKey( + Schema.Union([Schema.Literal("completed"), Schema.Literal("incomplete"), Schema.Literal("in_progress")]) + ), + "summary": Schema.Array(ReasoningSummaryText), + "type": Schema.Never, + "format": Schema.optionalKey(ReasoningFormat), + "signature": Schema.optionalKey( + Schema.String.annotate({ "description": "A signature for the reasoning content, used for verification" }) + ), + "arguments": Schema.String, + "call_id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An output item containing reasoning" }), + Schema.Struct({ + "arguments": Schema.String, + "call_id": Schema.String, + "id": Schema.optionalKey(Schema.String), + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ), + "status": Schema.optionalKey( + Schema.Union([Schema.Literal("completed"), Schema.Literal("incomplete"), Schema.Literal("in_progress")]) + ), + "type": Schema.Literal("function_call") + }), + Schema.Struct({ + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }), + "id": Schema.String, + "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), + "type": Schema.Never, + "arguments": Schema.String, + "call_id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }), + Schema.Struct({ + "id": Schema.String, + "queries": Schema.Array(Schema.String), + "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), + "type": Schema.Never, + "arguments": Schema.String, + "call_id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }), + Schema.Struct({ + "id": Schema.String, + "result": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "arguments": Schema.String, + "call_id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }), + Schema.Struct({ + "code": Schema.String, + "container_id": Schema.String, + "id": Schema.String, + "outputs": Schema.Array( + Schema.Union([ + Schema.Struct({ "type": Schema.Literal("image"), "url": Schema.String }), + Schema.Struct({ "logs": Schema.String, "type": Schema.Literal("logs") }) + ]) + ), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "arguments": Schema.String, + "call_id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "A code interpreter execution call with outputs" }), + Schema.Struct({ + "action": Schema.optionalKey(Schema.Unknown), + "call_id": Schema.String, + "id": Schema.optionalKey(Schema.String), + "pending_safety_checks": Schema.Array( + Schema.Struct({ "code": Schema.String, "id": Schema.String, "message": Schema.String }) + ), + "status": Schema.Union([ + Schema.Literal("completed"), + Schema.Literal("incomplete"), + Schema.Literal("in_progress") + ]), + "type": Schema.Never, + "arguments": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }), + Schema.Struct({ + "datetime": Schema.String.annotate({ "description": "ISO 8601 datetime string" }), + "id": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "timezone": Schema.String.annotate({ "description": "IANA timezone name" }), + "type": Schema.Never, + "arguments": Schema.String, + "call_id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:datetime server tool output item" }), + Schema.Struct({ + "action": Schema.optionalKey( + Schema.Struct({ + "query": Schema.String, + "sources": Schema.optionalKey( + Schema.Array(Schema.Struct({ "type": Schema.Literal("url"), "url": Schema.String })) + ), + "type": Schema.Literal("search") + }).annotate({ + "description": + "The search action performed, matching OpenAI web_search_call.action shape. Includes the query the model issued and optional source URLs returned by the search provider." + }) + ), + "id": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "arguments": Schema.String, + "call_id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:web_search server tool output item" }), + Schema.Struct({ + "code": Schema.optionalKey(Schema.String), + "exitCode": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "id": Schema.optionalKey(Schema.String), + "language": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "stderr": Schema.optionalKey(Schema.String), + "stdout": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "arguments": Schema.String, + "call_id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:code_interpreter server tool output item" }), + Schema.Struct({ + "id": Schema.optionalKey(Schema.String), + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "arguments": Schema.String, + "call_id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:file_search server tool output item" }), + Schema.Struct({ + "id": Schema.optionalKey(Schema.String), + "imageB64": Schema.optionalKey(Schema.String), + "imageUrl": Schema.optionalKey(Schema.String), + "result": Schema.optionalKey( + Schema.String.annotate({ + "description": + "The generated image as a base64-encoded string or URL, matching OpenAI image_generation_call format" + }) + ), + "revisedPrompt": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "arguments": Schema.String, + "call_id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:image_generation server tool output item" }), + Schema.Struct({ + "action": Schema.optionalKey(Schema.String), + "id": Schema.optionalKey(Schema.String), + "screenshotB64": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "arguments": Schema.String, + "call_id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:browser_use server tool output item" }), + Schema.Struct({ + "command": Schema.optionalKey(Schema.String), + "exitCode": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "id": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "stderr": Schema.optionalKey(Schema.String), + "stdout": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "arguments": Schema.String, + "call_id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:bash server tool output item" }), + Schema.Struct({ + "command": Schema.optionalKey(Schema.Literals(["view", "create", "str_replace", "insert"])), + "filePath": Schema.optionalKey(Schema.String), + "id": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "arguments": Schema.String, + "call_id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:text_editor server tool output item" }), + Schema.Struct({ + "call_id": Schema.String, + "id": Schema.optionalKey(Schema.String), + "operation": Schema.optionalKey(ApplyPatchCallOperation), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "arguments": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ + "description": + "An openrouter:apply_patch server tool output item. The turn halts when validation succeeds so the client can apply the patch and echo an `apply_patch_call_output` on the next turn." + }), + Schema.Struct({ + "call_id": Schema.String, + "id": Schema.String, + "operation": ApplyPatchCallOperation, + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]).annotate({ + "description": "Lifecycle state of an `apply_patch_call` output item." + }), + "type": Schema.Never, + "arguments": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ + "description": + "A native `apply_patch_call` output item matching OpenAI's Responses API shape. Emitted when the client requested the `apply_patch` shorthand." + }), + Schema.Struct({ + "content": Schema.optionalKey(Schema.String), + "error": Schema.optionalKey( + Schema.String.annotate({ "description": "The error message if the fetch failed." }) + ), + "httpStatus": Schema.optionalKey( + Schema.Number.annotate({ "description": "The HTTP status code returned by the upstream URL fetch." }).check( + Schema.isInt() + ) + ), + "id": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "title": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "url": Schema.optionalKey(Schema.String), + "arguments": Schema.String, + "call_id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:web_fetch server tool output item" }), + Schema.Struct({ + "id": Schema.optionalKey(Schema.String), + "query": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "arguments": Schema.String, + "call_id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:tool_search server tool output item" }), + Schema.Struct({ + "action": Schema.optionalKey(Schema.Literals(["read", "write", "delete"])), + "id": Schema.optionalKey(Schema.String), + "key": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "value": Schema.optionalKey(Schema.Unknown), + "arguments": Schema.String, + "call_id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:memory server tool output item" }), + Schema.Struct({ + "id": Schema.optionalKey(Schema.String), + "serverLabel": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "toolName": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "arguments": Schema.String, + "call_id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:mcp server tool output item" }), + Schema.Struct({ + "arguments": Schema.String.annotate({ + "description": "The JSON arguments submitted to the search tool (e.g. {\"query\":\"Claude\"})" + }), + "id": Schema.optionalKey(Schema.String), + "query": Schema.optionalKey(Schema.String), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "call_id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:experimental__search_models server tool output item" }), + Schema.Struct({ + "analysis": Schema.optionalKey( + Schema.Struct({ + "blind_spots": Schema.Array(Schema.String), + "consensus": Schema.Array(Schema.String), + "contradictions": Schema.Array( + Schema.Struct({ + "stances": Schema.Array(Schema.Struct({ "model": Schema.String, "stance": Schema.String })), + "topic": Schema.String + }) + ), + "partial_coverage": Schema.Array( + Schema.Struct({ "models": Schema.Array(Schema.String), "point": Schema.String }) + ), + "unique_insights": Schema.Array(Schema.Struct({ "insight": Schema.String, "model": Schema.String })) + }).annotate({ "description": "Structured analysis produced by the fusion judge model." }) + ), + "error": Schema.optionalKey( + Schema.String.annotate({ + "description": "Error message when the fusion run did not produce an analysis result." + }) + ), + "failed_models": Schema.optionalKey( + Schema.Array( + Schema.Struct({ + "error": Schema.String.annotate({ "description": "Error message describing why the model failed." }), + "model": Schema.String.annotate({ "description": "Slug of the analysis model that failed." }) + }) + ).annotate({ + "description": + "Models that were requested as part of the analysis panel but did not produce a response. Present when at least one requested analysis model failed. The fusion result is still usable but was produced from a degraded panel." + }) + ), + "id": Schema.optionalKey(Schema.String), + "responses": Schema.optionalKey( + Schema.Array(Schema.Struct({ "model": Schema.String })).annotate({ + "description": "Slugs of the analysis models that produced a response in this fusion run." + }) + ), + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("incomplete") + ]), + "type": Schema.Never, + "arguments": Schema.String, + "call_id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:fusion server tool output item" }), + Schema.Struct({ + "call_id": Schema.String, + "id": Schema.optionalKey(Schema.String), + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ), + "type": Schema.Never, + "arguments": Schema.String, + "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])) + }).annotate({ + "description": + "A call to a custom (freeform-grammar) tool created by the model — distinct from `function_call`. Used for tools like Codex CLI's `apply_patch` whose payload is opaque text rather than JSON arguments." + }) + ], { mode: "oneOf" }).annotate({ "description": "An output item from the response" }), + Schema.Union([ + Schema.Struct({ + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "id": Schema.String, + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant"), + "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])), + "type": Schema.Never, + "call_id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An output message item" }), + Schema.Struct({ + "content": Schema.optionalKey( + Schema.Array(Schema.Struct({ "text": Schema.String, "type": Schema.Literal("reasoning_text") })) + ), + "encrypted_content": Schema.optionalKey(Schema.String), + "id": Schema.String, + "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])), + "summary": Schema.Array(ReasoningSummaryText), + "type": Schema.Never, + "format": Schema.optionalKey(ReasoningFormat), + "signature": Schema.optionalKey( + Schema.String.annotate({ "description": "A signature for the reasoning content, used for verification" }) + ), + "call_id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An output item containing reasoning" }), + Schema.Struct({ + "arguments": Schema.String, + "call_id": Schema.String, + "id": Schema.optionalKey(Schema.String), + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ), + "status": Schema.optionalKey(Schema.Literals(["completed", "incomplete", "in_progress"])), + "type": Schema.Never, + "input": Schema.String + }), + Schema.Struct({ + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }), + "id": Schema.String, + "status": WebSearchStatus, + "type": Schema.Never, + "call_id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }), + Schema.Struct({ + "id": Schema.String, + "queries": Schema.Array(Schema.String), + "status": WebSearchStatus, + "type": Schema.Never, + "call_id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }), + Schema.Struct({ + "id": Schema.String, + "result": Schema.optionalKey(Schema.String), + "status": ImageGenerationStatus, + "type": Schema.Never, + "call_id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }), + Schema.Struct({ + "code": Schema.String, + "container_id": Schema.String, + "id": Schema.String, + "outputs": Schema.Array( + Schema.Union([ + Schema.Struct({ "type": Schema.Literal("image"), "url": Schema.String }), + Schema.Struct({ "logs": Schema.String, "type": Schema.Literal("logs") }) + ]) + ), + "status": ToolCallStatus, + "type": Schema.Never, + "call_id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "A code interpreter execution call with outputs" }), + Schema.Struct({ + "action": Schema.optionalKey(Schema.Unknown), + "call_id": Schema.String, + "id": Schema.optionalKey(Schema.String), + "pending_safety_checks": Schema.Array( + Schema.Struct({ "code": Schema.String, "id": Schema.String, "message": Schema.String }) + ), + "status": Schema.Literals(["completed", "incomplete", "in_progress"]), + "type": Schema.Never, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }), + Schema.Struct({ + "datetime": Schema.String.annotate({ "description": "ISO 8601 datetime string" }), + "id": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "timezone": Schema.String.annotate({ "description": "IANA timezone name" }), + "type": Schema.Never, + "call_id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:datetime server tool output item" }), + Schema.Struct({ + "action": Schema.optionalKey( + Schema.Struct({ + "query": Schema.String, + "sources": Schema.optionalKey( + Schema.Array(Schema.Struct({ "type": Schema.Literal("url"), "url": Schema.String })) + ), + "type": Schema.Literal("search") + }).annotate({ + "description": + "The search action performed, matching OpenAI web_search_call.action shape. Includes the query the model issued and optional source URLs returned by the search provider." + }) + ), + "id": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "type": Schema.Never, + "call_id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:web_search server tool output item" }), + Schema.Struct({ + "code": Schema.optionalKey(Schema.String), + "exitCode": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "id": Schema.optionalKey(Schema.String), + "language": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "stderr": Schema.optionalKey(Schema.String), + "stdout": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "call_id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:code_interpreter server tool output item" }), + Schema.Struct({ + "id": Schema.optionalKey(Schema.String), + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "status": ToolCallStatus, + "type": Schema.Never, + "call_id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:file_search server tool output item" }), + Schema.Struct({ + "id": Schema.optionalKey(Schema.String), + "imageB64": Schema.optionalKey(Schema.String), + "imageUrl": Schema.optionalKey(Schema.String), + "result": Schema.optionalKey( + Schema.String.annotate({ + "description": + "The generated image as a base64-encoded string or URL, matching OpenAI image_generation_call format" + }) + ), + "revisedPrompt": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "type": Schema.Never, + "call_id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:image_generation server tool output item" }), + Schema.Struct({ + "action": Schema.optionalKey(Schema.String), + "id": Schema.optionalKey(Schema.String), + "screenshotB64": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "type": Schema.Never, + "call_id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:browser_use server tool output item" }), + Schema.Struct({ + "command": Schema.optionalKey(Schema.String), + "exitCode": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "id": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "stderr": Schema.optionalKey(Schema.String), + "stdout": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "call_id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:bash server tool output item" }), + Schema.Struct({ + "command": Schema.optionalKey(Schema.Literals(["view", "create", "str_replace", "insert"])), + "filePath": Schema.optionalKey(Schema.String), + "id": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "type": Schema.Never, + "call_id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:text_editor server tool output item" }), + Schema.Struct({ + "call_id": Schema.String, + "id": Schema.optionalKey(Schema.String), + "operation": Schema.optionalKey(ApplyPatchCallOperation), + "status": ToolCallStatus, + "type": Schema.Never, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ + "description": + "An openrouter:apply_patch server tool output item. The turn halts when validation succeeds so the client can apply the patch and echo an `apply_patch_call_output` on the next turn." + }), + Schema.Struct({ + "call_id": Schema.String, + "id": Schema.String, + "operation": ApplyPatchCallOperation, + "status": ApplyPatchCallStatus, + "type": Schema.Never, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ + "description": + "A native `apply_patch_call` output item matching OpenAI's Responses API shape. Emitted when the client requested the `apply_patch` shorthand." + }), + Schema.Struct({ + "content": Schema.optionalKey(Schema.String), + "error": Schema.optionalKey( + Schema.String.annotate({ "description": "The error message if the fetch failed." }) + ), + "httpStatus": Schema.optionalKey( + Schema.Number.annotate({ "description": "The HTTP status code returned by the upstream URL fetch." }).check( + Schema.isInt() + ) + ), + "id": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "title": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "url": Schema.optionalKey(Schema.String), + "call_id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:web_fetch server tool output item" }), + Schema.Struct({ + "id": Schema.optionalKey(Schema.String), + "query": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "type": Schema.Never, + "call_id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:tool_search server tool output item" }), + Schema.Struct({ + "action": Schema.optionalKey(Schema.Literals(["read", "write", "delete"])), + "id": Schema.optionalKey(Schema.String), + "key": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "type": Schema.Never, + "value": Schema.optionalKey(Schema.Unknown), + "call_id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:memory server tool output item" }), + Schema.Struct({ + "id": Schema.optionalKey(Schema.String), + "serverLabel": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "toolName": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "call_id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:mcp server tool output item" }), + Schema.Struct({ + "arguments": Schema.optionalKey( + Schema.String.annotate({ + "description": "The JSON arguments submitted to the search tool (e.g. {\"query\":\"Claude\"})" + }) + ), + "id": Schema.optionalKey(Schema.String), + "query": Schema.optionalKey(Schema.String), + "status": ToolCallStatus, + "type": Schema.Never, + "call_id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:experimental__search_models server tool output item" }), + Schema.Struct({ + "analysis": Schema.optionalKey( + Schema.Struct({ + "blind_spots": Schema.Array(Schema.String), + "consensus": Schema.Array(Schema.String), + "contradictions": Schema.Array( + Schema.Struct({ + "stances": Schema.Array(Schema.Struct({ "model": Schema.String, "stance": Schema.String })), + "topic": Schema.String + }) + ), + "partial_coverage": Schema.Array( + Schema.Struct({ "models": Schema.Array(Schema.String), "point": Schema.String }) + ), + "unique_insights": Schema.Array(Schema.Struct({ "insight": Schema.String, "model": Schema.String })) + }).annotate({ "description": "Structured analysis produced by the fusion judge model." }) + ), + "error": Schema.optionalKey( + Schema.String.annotate({ + "description": "Error message when the fusion run did not produce an analysis result." + }) + ), + "failed_models": Schema.optionalKey( + Schema.Array( + Schema.Struct({ + "error": Schema.String.annotate({ "description": "Error message describing why the model failed." }), + "model": Schema.String.annotate({ "description": "Slug of the analysis model that failed." }) + }) + ).annotate({ + "description": + "Models that were requested as part of the analysis panel but did not produce a response. Present when at least one requested analysis model failed. The fusion result is still usable but was produced from a degraded panel." + }) + ), + "id": Schema.optionalKey(Schema.String), + "responses": Schema.optionalKey( + Schema.Array(Schema.Struct({ "model": Schema.String })).annotate({ + "description": "Slugs of the analysis models that produced a response in this fusion run." + }) + ), + "status": ToolCallStatus, + "type": Schema.Never, + "call_id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ) + }).annotate({ "description": "An openrouter:fusion server tool output item" }), + Schema.Struct({ + "call_id": Schema.String, + "id": Schema.optionalKey(Schema.String), + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ), + "type": Schema.Literal("custom_tool_call") + }).annotate({ + "description": + "A call to a custom (freeform-grammar) tool created by the model — distinct from `function_call`. Used for tools like Codex CLI's `apply_patch` whose payload is opaque text rather than JSON arguments." + }) + ], { mode: "oneOf" }).annotate({ "description": "An output item from the response" }), + Schema.Union([ + Schema.Struct({ + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), "id": Schema.String, + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), "role": Schema.Literal("assistant"), - "type": Schema.Literal("message"), - "status": Schema.optionalKey( - Schema.Union([Schema.Literal("completed"), Schema.Literal("incomplete"), Schema.Literal("in_progress")]) + "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), + "type": Schema.Never, + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }) + }).annotate({ "description": "An output message item" }), + Schema.Struct({ + "content": Schema.optionalKey( + Schema.Array(Schema.Struct({ "text": Schema.String, "type": Schema.Literal("reasoning_text") })) + ), + "encrypted_content": Schema.optionalKey(Schema.String), + "id": Schema.String, + "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), + "summary": Schema.Array(ReasoningSummaryText), + "type": Schema.Never, + "format": Schema.optionalKey(ReasoningFormat), + "signature": Schema.optionalKey( + Schema.String.annotate({ "description": "A signature for the reasoning content, used for verification" }) + ), + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }) + }).annotate({ "description": "An output item containing reasoning" }), + Schema.Struct({ + "arguments": Schema.String, + "call_id": Schema.String, + "id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) ), - "content": Schema.Array(Schema.Union([ + "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), + "type": Schema.Never, + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }) + }), + Schema.Struct({ + "action": Schema.Union([ Schema.Union([ Schema.Struct({ - "type": Schema.Literal("output_text"), - "text": Schema.String, - "annotations": Schema.optionalKey( - Schema.Array( - Schema.Union([ - Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("file_citation"), - "file_id": Schema.String, - "filename": Schema.String, - "index": Schema.Number.check(Schema.isFinite()) - }), - Schema.Struct({ - "type": Schema.Never, - "url": Schema.String, - "title": Schema.String, - "start_index": Schema.Number.check(Schema.isFinite()), - "end_index": Schema.Number.check(Schema.isFinite()), - "file_id": Schema.String, - "filename": Schema.String, - "index": Schema.Number.check(Schema.isFinite()) - }), - Schema.Struct({ - "type": Schema.Never, - "file_id": Schema.String, - "index": Schema.Number.check(Schema.isFinite()), - "filename": Schema.String - }) - ]), - Schema.Union([ - Schema.Struct({ - "type": Schema.Never, - "file_id": Schema.String, - "filename": Schema.String, - "index": Schema.Number.check(Schema.isFinite()), - "url": Schema.String, - "title": Schema.String, - "start_index": Schema.Number.check(Schema.isFinite()), - "end_index": Schema.Number.check(Schema.isFinite()) - }), - Schema.Struct({ - "type": Schema.Literal("url_citation"), - "url": Schema.String, - "title": Schema.String, - "start_index": Schema.Number.check(Schema.isFinite()), - "end_index": Schema.Number.check(Schema.isFinite()) - }), - Schema.Struct({ - "type": Schema.Never, - "file_id": Schema.String, - "index": Schema.Number.check(Schema.isFinite()), - "url": Schema.String, - "title": Schema.String, - "start_index": Schema.Number.check(Schema.isFinite()), - "end_index": Schema.Number.check(Schema.isFinite()) - }) - ]), - Schema.Union([ - Schema.Struct({ - "type": Schema.Never, - "file_id": Schema.String, - "filename": Schema.String, - "index": Schema.Number.check(Schema.isFinite()) - }), - Schema.Struct({ - "type": Schema.Never, - "url": Schema.String, - "title": Schema.String, - "start_index": Schema.Number.check(Schema.isFinite()), - "end_index": Schema.Number.check(Schema.isFinite()), - "file_id": Schema.String, - "index": Schema.Number.check(Schema.isFinite()) - }), - Schema.Struct({ - "type": Schema.Literal("file_path"), - "file_id": Schema.String, - "index": Schema.Number.check(Schema.isFinite()) - }) - ]) - ]) - ) + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey( + Schema.Array(Schema.Struct({ "type": Schema.Literal("url"), "url": Schema.String })) ), - "logprobs": Schema.optionalKey(Schema.Array(Schema.Struct({ - "token": Schema.String, - "bytes": Schema.Array(Schema.Number.check(Schema.isFinite())), - "logprob": Schema.Number.check(Schema.isFinite()), - "top_logprobs": Schema.Array( - Schema.Struct({ - "token": Schema.String, - "bytes": Schema.Array(Schema.Number.check(Schema.isFinite())), - "logprob": Schema.Number.check(Schema.isFinite()) - }) - ) - }))) + "type": Schema.Literal("search") + }), + Schema.Struct({ + "type": Schema.Never, + "url": Schema.optionalKey(Schema.String), + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)) + }), + Schema.Struct({ + "pattern": Schema.String, + "type": Schema.Never, + "url": Schema.String, + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)) + }) + ], { mode: "oneOf" }), + Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Never, + "url": Schema.optionalKey(Schema.String) + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Never, "url": Schema.String }) + ], { mode: "oneOf" }), + Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Never, + "pattern": Schema.String, + "url": Schema.String }), + Schema.Struct({ "type": Schema.Never, "url": Schema.String, "pattern": Schema.String }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }) + ], { mode: "oneOf" }), + "id": Schema.String, + "status": Schema.Union([ + Schema.Literal("completed"), + Schema.Literal("searching"), + Schema.Literal("in_progress"), + Schema.Literal("failed") + ]), + "type": Schema.Literal("web_search_call") + }), + Schema.Struct({ + "id": Schema.String, + "queries": Schema.Array(Schema.String), + "status": Schema.Union([ + Schema.Literal("completed"), + Schema.Literal("searching"), + Schema.Literal("in_progress"), + Schema.Literal("failed") + ]), + "type": Schema.Never, + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }) + }), + Schema.Struct({ + "id": Schema.String, + "result": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed"), Schema.Literal("failed")]), + "type": Schema.Never, + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }) + }), + Schema.Struct({ + "code": Schema.String, + "container_id": Schema.String, + "id": Schema.String, + "outputs": Schema.Array( + Schema.Union([ + Schema.Struct({ "type": Schema.Literal("image"), "url": Schema.String }), + Schema.Struct({ "logs": Schema.String, "type": Schema.Literal("logs") }) + ]) + ), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }) + }).annotate({ "description": "A code interpreter execution call with outputs" }), + Schema.Struct({ + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }), + "call_id": Schema.String, + "id": Schema.String, + "pending_safety_checks": Schema.Array( + Schema.Struct({ "code": Schema.String, "id": Schema.String, "message": Schema.String }) + ), + "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), + "type": Schema.Never + }), + Schema.Struct({ + "datetime": Schema.String.annotate({ "description": "ISO 8601 datetime string" }), + "id": Schema.String, + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "timezone": Schema.String.annotate({ "description": "IANA timezone name" }), + "type": Schema.Never, + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:datetime server tool output item" }), + Schema.Struct({ + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey( + Schema.Array(Schema.Struct({ "type": Schema.Literal("url"), "url": Schema.String })) + ), + "type": Schema.Literal("search") + }).annotate({ + "description": + "The search action performed, matching OpenAI web_search_call.action shape. Includes the query the model issued and optional source URLs returned by the search provider." + }), + Schema.Struct({ + "type": Schema.Never, + "url": Schema.optionalKey(Schema.String), + "query": Schema.String, + "sources": Schema.optionalKey( + Schema.Array(Schema.Struct({ "type": Schema.Literal("url"), "url": Schema.String })) + ) + }).annotate({ + "description": + "The search action performed, matching OpenAI web_search_call.action shape. Includes the query the model issued and optional source URLs returned by the search provider." + }), + Schema.Struct({ + "pattern": Schema.String, + "type": Schema.Never, + "url": Schema.String, + "query": Schema.String, + "sources": Schema.optionalKey( + Schema.Array(Schema.Struct({ "type": Schema.Literal("url"), "url": Schema.String })) + ) + }).annotate({ + "description": + "The search action performed, matching OpenAI web_search_call.action shape. Includes the query the model issued and optional source URLs returned by the search provider." + }) + ], { mode: "oneOf" }), + "id": Schema.String, + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never + }).annotate({ "description": "An openrouter:web_search server tool output item" }), + Schema.Struct({ + "code": Schema.optionalKey(Schema.String), + "exitCode": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "id": Schema.String, + "language": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "stderr": Schema.optionalKey(Schema.String), + "stdout": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:code_interpreter server tool output item" }), + Schema.Struct({ + "id": Schema.String, + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:file_search server tool output item" }), + Schema.Struct({ + "id": Schema.String, + "imageB64": Schema.optionalKey(Schema.String), + "imageUrl": Schema.optionalKey(Schema.String), + "result": Schema.optionalKey( + Schema.String.annotate({ + "description": + "The generated image as a base64-encoded string or URL, matching OpenAI image_generation_call format" + }) + ), + "revisedPrompt": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:image_generation server tool output item" }), + Schema.Struct({ + "action": Schema.Never, + "id": Schema.String, + "screenshotB64": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never + }).annotate({ "description": "An openrouter:browser_use server tool output item" }), + Schema.Struct({ + "command": Schema.optionalKey(Schema.String), + "exitCode": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "id": Schema.String, + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "stderr": Schema.optionalKey(Schema.String), + "stdout": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:bash server tool output item" }), + Schema.Struct({ + "command": Schema.optionalKey(Schema.Literals(["view", "create", "str_replace", "insert"])), + "filePath": Schema.optionalKey(Schema.String), + "id": Schema.String, + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:text_editor server tool output item" }), + Schema.Struct({ + "call_id": Schema.optionalKey(Schema.String), + "id": Schema.String, + "operation": Schema.optionalKey(ApplyPatchCallOperation), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }) + }).annotate({ + "description": + "An openrouter:apply_patch server tool output item. The turn halts when validation succeeds so the client can apply the patch and echo an `apply_patch_call_output` on the next turn." + }), + Schema.Struct({ + "call_id": Schema.String, + "id": Schema.String, + "operation": ApplyPatchCallOperation, + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]).annotate({ + "description": "Lifecycle state of an `apply_patch_call` output item." + }), + "type": Schema.Never, + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }) + }).annotate({ + "description": + "A native `apply_patch_call` output item matching OpenAI's Responses API shape. Emitted when the client requested the `apply_patch` shorthand." + }), + Schema.Struct({ + "content": Schema.optionalKey(Schema.String), + "error": Schema.optionalKey( + Schema.String.annotate({ "description": "The error message if the fetch failed." }) + ), + "httpStatus": Schema.optionalKey( + Schema.Number.annotate({ "description": "The HTTP status code returned by the upstream URL fetch." }).check( + Schema.isInt() + ) + ), + "id": Schema.String, + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "title": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "url": Schema.optionalKey(Schema.String), + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:web_fetch server tool output item" }), + Schema.Struct({ + "id": Schema.String, + "query": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:tool_search server tool output item" }), + Schema.Struct({ + "action": Schema.Never, + "id": Schema.String, + "key": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "value": Schema.optionalKey(Schema.Unknown) + }).annotate({ "description": "An openrouter:memory server tool output item" }), + Schema.Struct({ + "id": Schema.String, + "serverLabel": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "toolName": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:mcp server tool output item" }), + Schema.Struct({ + "arguments": Schema.optionalKey( + Schema.String.annotate({ + "description": "The JSON arguments submitted to the search tool (e.g. {\"query\":\"Claude\"})" + }) + ), + "id": Schema.String, + "query": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:experimental__search_models server tool output item" }), + Schema.Struct({ + "analysis": Schema.optionalKey( + Schema.Struct({ + "blind_spots": Schema.Array(Schema.String), + "consensus": Schema.Array(Schema.String), + "contradictions": Schema.Array( + Schema.Struct({ + "stances": Schema.Array(Schema.Struct({ "model": Schema.String, "stance": Schema.String })), + "topic": Schema.String + }) + ), + "partial_coverage": Schema.Array( + Schema.Struct({ "models": Schema.Array(Schema.String), "point": Schema.String }) + ), + "unique_insights": Schema.Array(Schema.Struct({ "insight": Schema.String, "model": Schema.String })) + }).annotate({ "description": "Structured analysis produced by the fusion judge model." }) + ), + "error": Schema.optionalKey( + Schema.String.annotate({ + "description": "Error message when the fusion run did not produce an analysis result." + }) + ), + "failed_models": Schema.optionalKey( + Schema.Array( Schema.Struct({ - "type": Schema.Never, - "refusal": Schema.String, - "text": Schema.String, - "annotations": Schema.optionalKey(Schema.Array(OpenAIResponsesAnnotation)), - "logprobs": Schema.optionalKey(Schema.Array(Schema.Struct({ - "token": Schema.String, - "bytes": Schema.Array(Schema.Number.check(Schema.isFinite())), - "logprob": Schema.Number.check(Schema.isFinite()), - "top_logprobs": Schema.Array( - Schema.Struct({ - "token": Schema.String, - "bytes": Schema.Array(Schema.Number.check(Schema.isFinite())), - "logprob": Schema.Number.check(Schema.isFinite()) - }) - ) - }))) + "error": Schema.String.annotate({ "description": "Error message describing why the model failed." }), + "model": Schema.String.annotate({ "description": "Slug of the analysis model that failed." }) }) - ]), - Schema.Union([ - Schema.Struct({ - "type": Schema.Never, - "text": Schema.String, - "annotations": Schema.optionalKey(Schema.Array(OpenAIResponsesAnnotation)), - "logprobs": Schema.optionalKey(Schema.Array(Schema.Struct({ - "token": Schema.String, - "bytes": Schema.Array(Schema.Number.check(Schema.isFinite())), - "logprob": Schema.Number.check(Schema.isFinite()), - "top_logprobs": Schema.Array( - Schema.Struct({ - "token": Schema.String, - "bytes": Schema.Array(Schema.Number.check(Schema.isFinite())), - "logprob": Schema.Number.check(Schema.isFinite()) - }) - ) - }))), - "refusal": Schema.String - }), - Schema.Struct({ "type": Schema.Literal("refusal"), "refusal": Schema.String }) - ]) - ])) - }).annotate({ "description": "An output message item" }), - Schema.Struct({ + ).annotate({ + "description": + "Models that were requested as part of the analysis panel but did not produce a response. Present when at least one requested analysis model failed. The fusion result is still usable but was produced from a degraded panel." + }) + ), + "id": Schema.String, + "responses": Schema.optionalKey( + Schema.Array(Schema.Struct({ "model": Schema.String })).annotate({ + "description": "Slugs of the analysis models that produced a response in this fusion run." + }) + ), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), "type": Schema.Never, + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:fusion server tool output item" }), + Schema.Struct({ + "call_id": Schema.String, "id": Schema.String, - "content": Schema.Array(Schema.Union([ + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ), + "type": Schema.Never, + "action": Schema.Union([ Schema.Struct({ - "type": Schema.Never, - "text": Schema.String, - "annotations": Schema.optionalKey(Schema.Array(OpenAIResponsesAnnotation)), - "logprobs": Schema.optionalKey(Schema.Array(Schema.Struct({ - "token": Schema.String, - "bytes": Schema.Array(Schema.Number.check(Schema.isFinite())), - "logprob": Schema.Number.check(Schema.isFinite()), - "top_logprobs": Schema.Array( - Schema.Struct({ - "token": Schema.String, - "bytes": Schema.Array(Schema.Number.check(Schema.isFinite())), - "logprob": Schema.Number.check(Schema.isFinite()) - }) - ) - }))) + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") }), - Schema.Struct({ "type": Schema.Never, "refusal": Schema.String, "text": Schema.String }) - ])), - "summary": Schema.Array(ReasoningSummaryText), - "encrypted_content": Schema.optionalKey(Schema.String), - "status": Schema.optionalKey( - Schema.Union([Schema.Literal("completed"), Schema.Literal("incomplete"), Schema.Literal("in_progress")]) + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }), + "status": WebSearchStatus + }).annotate({ + "description": + "A call to a custom (freeform-grammar) tool created by the model — distinct from `function_call`. Used for tools like Codex CLI's `apply_patch` whose payload is opaque text rather than JSON arguments." + }) + ], { mode: "oneOf" }).annotate({ "description": "An output item from the response" }), + Schema.Union([ + Schema.Struct({ + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "id": Schema.String, + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), + "role": Schema.Literal("assistant"), + "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), + "type": Schema.Never, + "queries": Schema.Array(Schema.String) + }).annotate({ "description": "An output message item" }), + Schema.Struct({ + "content": Schema.optionalKey( + Schema.Array(Schema.Struct({ "text": Schema.String, "type": Schema.Literal("reasoning_text") })) ), + "encrypted_content": Schema.optionalKey(Schema.String), + "id": Schema.String, + "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), + "summary": Schema.Array(ReasoningSummaryText), + "type": Schema.Never, + "format": Schema.optionalKey(ReasoningFormat), "signature": Schema.optionalKey( Schema.String.annotate({ "description": "A signature for the reasoning content, used for verification" }) ), - "format": Schema.optionalKey( - Schema.Literals([ - "unknown", - "openai-responses-v1", - "azure-openai-responses-v1", - "xai-responses-v1", - "anthropic-claude-v1", - "google-gemini-v1" - ]).annotate({ "description": "The format of the reasoning content" }) - ), - "role": Schema.Literal("assistant") + "queries": Schema.Array(Schema.String) }).annotate({ "description": "An output item containing reasoning" }), Schema.Struct({ - "type": Schema.Never, - "id": Schema.String, - "name": Schema.String, "arguments": Schema.String, "call_id": Schema.String, - "status": Schema.optionalKey( - Schema.Union([Schema.Literal("completed"), Schema.Literal("incomplete"), Schema.Literal("in_progress")]) + "id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) ), - "role": Schema.Literal("assistant"), - "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])) + "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), + "type": Schema.Never, + "queries": Schema.Array(Schema.String) }), Schema.Struct({ + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }), + "id": Schema.String, + "status": Schema.Union([ + Schema.Literal("completed"), + Schema.Literal("searching"), + Schema.Literal("in_progress"), + Schema.Literal("failed") + ]), "type": Schema.Never, + "queries": Schema.Array(Schema.String) + }), + Schema.Struct({ "id": Schema.String, - "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), - "role": Schema.Literal("assistant"), - "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])) + "queries": Schema.Array(Schema.String), + "status": Schema.Union([ + Schema.Literal("completed"), + Schema.Literal("searching"), + Schema.Literal("in_progress"), + Schema.Literal("failed") + ]), + "type": Schema.Literal("file_search_call") + }), + Schema.Struct({ + "id": Schema.String, + "result": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed"), Schema.Literal("failed")]), + "type": Schema.Never, + "queries": Schema.Array(Schema.String) }), Schema.Struct({ + "code": Schema.String, + "container_id": Schema.String, + "id": Schema.String, + "outputs": Schema.Array( + Schema.Union([ + Schema.Struct({ "type": Schema.Literal("image"), "url": Schema.String }), + Schema.Struct({ "logs": Schema.String, "type": Schema.Literal("logs") }) + ]) + ), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), "type": Schema.Never, + "queries": Schema.Array(Schema.String) + }).annotate({ "description": "A code interpreter execution call with outputs" }), + Schema.Struct({ + "action": Schema.optionalKey(Schema.Unknown), + "call_id": Schema.String, "id": Schema.String, - "queries": Schema.Array(Schema.String), + "pending_safety_checks": Schema.Array( + Schema.Struct({ "code": Schema.String, "id": Schema.String, "message": Schema.String }) + ), "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), - "role": Schema.Literal("assistant"), - "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])) + "type": Schema.Never, + "queries": Schema.Array(Schema.String) }), Schema.Struct({ + "datetime": Schema.String.annotate({ "description": "ISO 8601 datetime string" }), + "id": Schema.String, + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "timezone": Schema.String.annotate({ "description": "IANA timezone name" }), "type": Schema.Never, + "queries": Schema.Array(Schema.String) + }).annotate({ "description": "An openrouter:datetime server tool output item" }), + Schema.Struct({ + "action": Schema.optionalKey( + Schema.Struct({ + "query": Schema.String, + "sources": Schema.optionalKey( + Schema.Array(Schema.Struct({ "type": Schema.Literal("url"), "url": Schema.String })) + ), + "type": Schema.Literal("search") + }).annotate({ + "description": + "The search action performed, matching OpenAI web_search_call.action shape. Includes the query the model issued and optional source URLs returned by the search provider." + }) + ), "id": Schema.String, - "result": Schema.optionalKey(Schema.String), "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), - "role": Schema.Literal("assistant"), - "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])) - }) - ]).annotate({ "description": "An output item from the response" }), - Schema.Union([ + "type": Schema.Never, + "queries": Schema.Array(Schema.String) + }).annotate({ "description": "An openrouter:web_search server tool output item" }), Schema.Struct({ + "code": Schema.optionalKey(Schema.String), + "exitCode": Schema.optionalKey(Schema.Number.check(Schema.isInt())), "id": Schema.String, - "role": Schema.Literal("assistant"), + "language": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "stderr": Schema.optionalKey(Schema.String), + "stdout": Schema.optionalKey(Schema.String), "type": Schema.Never, - "status": Schema.optionalKey( - Schema.Union([Schema.Literal("completed"), Schema.Literal("incomplete"), Schema.Literal("in_progress")]) - ), - "content": Schema.Array(Schema.Union([ - Schema.Struct({ - "type": Schema.Never, - "text": Schema.String, - "annotations": Schema.optionalKey(Schema.Array(OpenAIResponsesAnnotation)), - "logprobs": Schema.optionalKey(Schema.Array(Schema.Struct({ - "token": Schema.String, - "bytes": Schema.Array(Schema.Number.check(Schema.isFinite())), - "logprob": Schema.Number.check(Schema.isFinite()), - "top_logprobs": Schema.Array( - Schema.Struct({ - "token": Schema.String, - "bytes": Schema.Array(Schema.Number.check(Schema.isFinite())), - "logprob": Schema.Number.check(Schema.isFinite()) - }) - ) - }))) - }), - Schema.Struct({ "type": Schema.Never, "refusal": Schema.String, "text": Schema.String }) - ])), - "summary": Schema.Array(ReasoningSummaryText), - "encrypted_content": Schema.optionalKey(Schema.String) - }).annotate({ "description": "An output message item" }), + "queries": Schema.Array(Schema.String) + }).annotate({ "description": "An openrouter:code_interpreter server tool output item" }), Schema.Struct({ - "type": Schema.Literal("reasoning"), "id": Schema.String, - "content": Schema.optionalKey( - Schema.Array(Schema.Struct({ "type": Schema.Literal("reasoning_text"), "text": Schema.String })) - ), - "summary": Schema.Array(Schema.Struct({ "type": Schema.Literal("summary_text"), "text": Schema.String })), - "encrypted_content": Schema.optionalKey(Schema.String), - "status": Schema.optionalKey( - Schema.Union([Schema.Literal("completed"), Schema.Literal("incomplete"), Schema.Literal("in_progress")]) - ), - "signature": Schema.optionalKey( - Schema.String.annotate({ "description": "A signature for the reasoning content, used for verification" }) + "queries": Schema.Array(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never + }).annotate({ "description": "An openrouter:file_search server tool output item" }), + Schema.Struct({ + "id": Schema.String, + "imageB64": Schema.optionalKey(Schema.String), + "imageUrl": Schema.optionalKey(Schema.String), + "result": Schema.optionalKey( + Schema.String.annotate({ + "description": + "The generated image as a base64-encoded string or URL, matching OpenAI image_generation_call format" + }) ), - "format": Schema.optionalKey( - Schema.Literals([ - "unknown", - "openai-responses-v1", - "azure-openai-responses-v1", - "xai-responses-v1", - "anthropic-claude-v1", - "google-gemini-v1" - ]).annotate({ "description": "The format of the reasoning content" }) - ) - }).annotate({ "description": "An output item containing reasoning" }), + "revisedPrompt": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "queries": Schema.Array(Schema.String) + }).annotate({ "description": "An openrouter:image_generation server tool output item" }), + Schema.Struct({ + "action": Schema.optionalKey(Schema.String), + "id": Schema.String, + "screenshotB64": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "queries": Schema.Array(Schema.String) + }).annotate({ "description": "An openrouter:browser_use server tool output item" }), Schema.Struct({ + "command": Schema.optionalKey(Schema.String), + "exitCode": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "id": Schema.String, + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "stderr": Schema.optionalKey(Schema.String), + "stdout": Schema.optionalKey(Schema.String), "type": Schema.Never, + "queries": Schema.Array(Schema.String) + }).annotate({ "description": "An openrouter:bash server tool output item" }), + Schema.Struct({ + "command": Schema.optionalKey(Schema.Literals(["view", "create", "str_replace", "insert"])), + "filePath": Schema.optionalKey(Schema.String), "id": Schema.String, - "name": Schema.String, - "arguments": Schema.String, - "call_id": Schema.String, - "status": Schema.optionalKey( - Schema.Union([Schema.Literal("completed"), Schema.Literal("incomplete"), Schema.Literal("in_progress")]) - ), - "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), - "summary": Schema.Array(ReasoningSummaryText), - "encrypted_content": Schema.optionalKey(Schema.String) - }), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "queries": Schema.Array(Schema.String) + }).annotate({ "description": "An openrouter:text_editor server tool output item" }), Schema.Struct({ + "call_id": Schema.optionalKey(Schema.String), + "id": Schema.String, + "operation": Schema.optionalKey(ApplyPatchCallOperation), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), "type": Schema.Never, + "queries": Schema.Array(Schema.String) + }).annotate({ + "description": + "An openrouter:apply_patch server tool output item. The turn halts when validation succeeds so the client can apply the patch and echo an `apply_patch_call_output` on the next turn." + }), + Schema.Struct({ + "call_id": Schema.String, "id": Schema.String, - "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), - "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), - "summary": Schema.Array(ReasoningSummaryText), - "encrypted_content": Schema.optionalKey(Schema.String) + "operation": ApplyPatchCallOperation, + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]).annotate({ + "description": "Lifecycle state of an `apply_patch_call` output item." + }), + "type": Schema.Never, + "queries": Schema.Array(Schema.String) + }).annotate({ + "description": + "A native `apply_patch_call` output item matching OpenAI's Responses API shape. Emitted when the client requested the `apply_patch` shorthand." }), Schema.Struct({ - "type": Schema.Never, + "content": Schema.optionalKey(Schema.String), + "error": Schema.optionalKey( + Schema.String.annotate({ "description": "The error message if the fetch failed." }) + ), + "httpStatus": Schema.optionalKey( + Schema.Number.annotate({ "description": "The HTTP status code returned by the upstream URL fetch." }).check( + Schema.isInt() + ) + ), "id": Schema.String, - "queries": Schema.Array(Schema.String), - "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), - "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), - "summary": Schema.Array(ReasoningSummaryText), - "encrypted_content": Schema.optionalKey(Schema.String) - }), - Schema.Struct({ + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "title": Schema.optionalKey(Schema.String), "type": Schema.Never, + "url": Schema.optionalKey(Schema.String), + "queries": Schema.Array(Schema.String) + }).annotate({ "description": "An openrouter:web_fetch server tool output item" }), + Schema.Struct({ "id": Schema.String, - "result": Schema.optionalKey(Schema.String), + "query": Schema.optionalKey(Schema.String), "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), - "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), - "summary": Schema.Array(ReasoningSummaryText), - "encrypted_content": Schema.optionalKey(Schema.String) - }) - ]).annotate({ "description": "An output item from the response" }), - Schema.Union([ + "type": Schema.Never, + "queries": Schema.Array(Schema.String) + }).annotate({ "description": "An openrouter:tool_search server tool output item" }), Schema.Struct({ + "action": Schema.optionalKey(Schema.Literals(["read", "write", "delete"])), "id": Schema.String, - "role": Schema.Literal("assistant"), + "key": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), "type": Schema.Never, - "status": Schema.optionalKey( - Schema.Union([Schema.Literal("completed"), Schema.Literal("incomplete"), Schema.Literal("in_progress")]) - ), - "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), - "name": Schema.String, - "arguments": Schema.String, - "call_id": Schema.String - }).annotate({ "description": "An output message item" }), + "value": Schema.optionalKey(Schema.Unknown), + "queries": Schema.Array(Schema.String) + }).annotate({ "description": "An openrouter:memory server tool output item" }), Schema.Struct({ + "id": Schema.String, + "serverLabel": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "toolName": Schema.optionalKey(Schema.String), "type": Schema.Never, + "queries": Schema.Array(Schema.String) + }).annotate({ "description": "An openrouter:mcp server tool output item" }), + Schema.Struct({ + "arguments": Schema.optionalKey( + Schema.String.annotate({ + "description": "The JSON arguments submitted to the search tool (e.g. {\"query\":\"Claude\"})" + }) + ), "id": Schema.String, - "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), - "summary": Schema.Array(ReasoningSummaryText), - "encrypted_content": Schema.optionalKey(Schema.String), - "status": Schema.optionalKey( - Schema.Union([Schema.Literal("completed"), Schema.Literal("incomplete"), Schema.Literal("in_progress")]) + "query": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "queries": Schema.Array(Schema.String) + }).annotate({ "description": "An openrouter:experimental__search_models server tool output item" }), + Schema.Struct({ + "analysis": Schema.optionalKey( + Schema.Struct({ + "blind_spots": Schema.Array(Schema.String), + "consensus": Schema.Array(Schema.String), + "contradictions": Schema.Array( + Schema.Struct({ + "stances": Schema.Array(Schema.Struct({ "model": Schema.String, "stance": Schema.String })), + "topic": Schema.String + }) + ), + "partial_coverage": Schema.Array( + Schema.Struct({ "models": Schema.Array(Schema.String), "point": Schema.String }) + ), + "unique_insights": Schema.Array(Schema.Struct({ "insight": Schema.String, "model": Schema.String })) + }).annotate({ "description": "Structured analysis produced by the fusion judge model." }) ), - "signature": Schema.optionalKey( - Schema.String.annotate({ "description": "A signature for the reasoning content, used for verification" }) + "error": Schema.optionalKey( + Schema.String.annotate({ + "description": "Error message when the fusion run did not produce an analysis result." + }) ), - "format": Schema.optionalKey( - Schema.Literals([ - "unknown", - "openai-responses-v1", - "azure-openai-responses-v1", - "xai-responses-v1", - "anthropic-claude-v1", - "google-gemini-v1" - ]).annotate({ "description": "The format of the reasoning content" }) + "failed_models": Schema.optionalKey( + Schema.Array( + Schema.Struct({ + "error": Schema.String.annotate({ "description": "Error message describing why the model failed." }), + "model": Schema.String.annotate({ "description": "Slug of the analysis model that failed." }) + }) + ).annotate({ + "description": + "Models that were requested as part of the analysis panel but did not produce a response. Present when at least one requested analysis model failed. The fusion result is still usable but was produced from a degraded panel." + }) ), - "name": Schema.String, - "arguments": Schema.String, - "call_id": Schema.String - }).annotate({ "description": "An output item containing reasoning" }), + "id": Schema.String, + "responses": Schema.optionalKey( + Schema.Array(Schema.Struct({ "model": Schema.String })).annotate({ + "description": "Slugs of the analysis models that produced a response in this fusion run." + }) + ), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "queries": Schema.Array(Schema.String) + }).annotate({ "description": "An openrouter:fusion server tool output item" }), Schema.Struct({ - "type": Schema.Literal("function_call"), - "id": Schema.optionalKey(Schema.String), - "name": Schema.String, - "arguments": Schema.String, "call_id": Schema.String, - "status": Schema.optionalKey( - Schema.Union([Schema.Literal("completed"), Schema.Literal("incomplete"), Schema.Literal("in_progress")]) - ) - }), - Schema.Struct({ - "type": Schema.Never, "id": Schema.String, - "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), + "input": Schema.String, "name": Schema.String, - "arguments": Schema.String, - "call_id": Schema.String - }), - Schema.Struct({ + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ), "type": Schema.Never, - "id": Schema.String, "queries": Schema.Array(Schema.String), - "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), - "name": Schema.String, - "arguments": Schema.String, - "call_id": Schema.String - }), - Schema.Struct({ - "type": Schema.Never, - "id": Schema.String, - "result": Schema.optionalKey(Schema.String), - "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), - "name": Schema.String, - "arguments": Schema.String, - "call_id": Schema.String + "status": WebSearchStatus + }).annotate({ + "description": + "A call to a custom (freeform-grammar) tool created by the model — distinct from `function_call`. Used for tools like Codex CLI's `apply_patch` whose payload is opaque text rather than JSON arguments." }) - ]).annotate({ "description": "An output item from the response" }), + ], { mode: "oneOf" }).annotate({ "description": "An output item from the response" }), Schema.Union([ Schema.Struct({ + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), "id": Schema.String, + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ + "description": + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." + }) + ), "role": Schema.Literal("assistant"), - "type": Schema.Never, "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), - "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])) + "type": Schema.Never, + "result": Schema.optionalKey(Schema.String) }).annotate({ "description": "An output message item" }), Schema.Struct({ - "type": Schema.Never, - "id": Schema.String, - "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), - "summary": Schema.Array(ReasoningSummaryText), + "content": Schema.optionalKey( + Schema.Array(Schema.Struct({ "text": Schema.String, "type": Schema.Literal("reasoning_text") })) + ), "encrypted_content": Schema.optionalKey(Schema.String), + "id": Schema.String, "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), + "summary": Schema.Array(ReasoningSummaryText), + "type": Schema.Never, + "format": Schema.optionalKey(ReasoningFormat), "signature": Schema.optionalKey( Schema.String.annotate({ "description": "A signature for the reasoning content, used for verification" }) ), - "format": Schema.optionalKey( - Schema.Literals([ - "unknown", - "openai-responses-v1", - "azure-openai-responses-v1", - "xai-responses-v1", - "anthropic-claude-v1", - "google-gemini-v1" - ]).annotate({ "description": "The format of the reasoning content" }) - ) + "result": Schema.optionalKey(Schema.String) }).annotate({ "description": "An output item containing reasoning" }), Schema.Struct({ - "type": Schema.Never, - "id": Schema.String, - "name": Schema.String, "arguments": Schema.String, "call_id": Schema.String, - "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]) + "id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" + }) + ), + "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), + "type": Schema.Never, + "result": Schema.optionalKey(Schema.String) }), Schema.Struct({ - "type": Schema.Literal("web_search_call"), + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }), "id": Schema.String, - "status": Schema.Union([ - Schema.Literal("completed"), - Schema.Literal("searching"), - Schema.Literal("in_progress"), - Schema.Literal("failed") - ]) + "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress"), Schema.Literal("failed")]), + "type": Schema.Never, + "result": Schema.optionalKey(Schema.String) }), Schema.Struct({ - "type": Schema.Never, "id": Schema.String, "queries": Schema.Array(Schema.String), - "status": Schema.Union([ - Schema.Literal("completed"), - Schema.Literal("searching"), - Schema.Literal("in_progress"), - Schema.Literal("failed") - ]) + "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress"), Schema.Literal("failed")]), + "type": Schema.Never, + "result": Schema.optionalKey(Schema.String) }), Schema.Struct({ - "type": Schema.Never, "id": Schema.String, "result": Schema.optionalKey(Schema.String), - "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed"), Schema.Literal("failed")]) - }) - ]).annotate({ "description": "An output item from the response" }), - Schema.Union([ + "status": Schema.Union([ + Schema.Literal("in_progress"), + Schema.Literal("completed"), + Schema.Literal("generating"), + Schema.Literal("failed") + ]), + "type": Schema.Literal("image_generation_call") + }), Schema.Struct({ + "code": Schema.String, + "container_id": Schema.String, "id": Schema.String, - "role": Schema.Literal("assistant"), + "outputs": Schema.Array( + Schema.Union([ + Schema.Struct({ "type": Schema.Literal("image"), "url": Schema.String }), + Schema.Struct({ "logs": Schema.String, "type": Schema.Literal("logs") }) + ]) + ), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), "type": Schema.Never, - "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), - "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), - "queries": Schema.Array(Schema.String) - }).annotate({ "description": "An output message item" }), + "result": Schema.optionalKey(Schema.String) + }).annotate({ "description": "A code interpreter execution call with outputs" }), Schema.Struct({ - "type": Schema.Never, + "action": Schema.optionalKey(Schema.Unknown), + "call_id": Schema.String, "id": Schema.String, - "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), - "summary": Schema.Array(ReasoningSummaryText), - "encrypted_content": Schema.optionalKey(Schema.String), - "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), - "signature": Schema.optionalKey( - Schema.String.annotate({ "description": "A signature for the reasoning content, used for verification" }) + "pending_safety_checks": Schema.Array( + Schema.Struct({ "code": Schema.String, "id": Schema.String, "message": Schema.String }) ), - "format": Schema.optionalKey( - Schema.Literals([ - "unknown", - "openai-responses-v1", - "azure-openai-responses-v1", - "xai-responses-v1", - "anthropic-claude-v1", - "google-gemini-v1" - ]).annotate({ "description": "The format of the reasoning content" }) - ), - "queries": Schema.Array(Schema.String) - }).annotate({ "description": "An output item containing reasoning" }), - Schema.Struct({ - "type": Schema.Never, - "id": Schema.String, - "name": Schema.String, - "arguments": Schema.String, - "call_id": Schema.String, "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), - "queries": Schema.Array(Schema.String) + "type": Schema.Never, + "result": Schema.optionalKey(Schema.String) }), Schema.Struct({ + "datetime": Schema.String.annotate({ "description": "ISO 8601 datetime string" }), + "id": Schema.String, + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "timezone": Schema.String.annotate({ "description": "IANA timezone name" }), "type": Schema.Never, + "result": Schema.optionalKey(Schema.String) + }).annotate({ "description": "An openrouter:datetime server tool output item" }), + Schema.Struct({ + "action": Schema.optionalKey( + Schema.Struct({ + "query": Schema.String, + "sources": Schema.optionalKey( + Schema.Array(Schema.Struct({ "type": Schema.Literal("url"), "url": Schema.String })) + ), + "type": Schema.Literal("search") + }).annotate({ + "description": + "The search action performed, matching OpenAI web_search_call.action shape. Includes the query the model issued and optional source URLs returned by the search provider." + }) + ), "id": Schema.String, - "status": Schema.Union([ - Schema.Literal("completed"), - Schema.Literal("searching"), - Schema.Literal("in_progress"), - Schema.Literal("failed") - ]), - "queries": Schema.Array(Schema.String) - }), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "result": Schema.optionalKey(Schema.String) + }).annotate({ "description": "An openrouter:web_search server tool output item" }), Schema.Struct({ - "type": Schema.Literal("file_search_call"), + "code": Schema.optionalKey(Schema.String), + "exitCode": Schema.optionalKey(Schema.Number.check(Schema.isInt())), "id": Schema.String, - "queries": Schema.Array(Schema.String), - "status": Schema.Union([ - Schema.Literal("completed"), - Schema.Literal("searching"), - Schema.Literal("in_progress"), - Schema.Literal("failed") - ]) - }), + "language": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "stderr": Schema.optionalKey(Schema.String), + "stdout": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "result": Schema.optionalKey(Schema.String) + }).annotate({ "description": "An openrouter:code_interpreter server tool output item" }), Schema.Struct({ + "id": Schema.String, + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), "type": Schema.Never, + "result": Schema.optionalKey(Schema.String) + }).annotate({ "description": "An openrouter:file_search server tool output item" }), + Schema.Struct({ "id": Schema.String, - "result": Schema.optionalKey(Schema.String), - "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed"), Schema.Literal("failed")]), - "queries": Schema.Array(Schema.String) - }) - ]).annotate({ "description": "An output item from the response" }), - Schema.Union([ + "imageB64": Schema.optionalKey(Schema.String), + "imageUrl": Schema.optionalKey(Schema.String), + "result": Schema.optionalKey( + Schema.String.annotate({ + "description": + "The generated image as a base64-encoded string or URL, matching OpenAI image_generation_call format" + }) + ), + "revisedPrompt": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never + }).annotate({ "description": "An openrouter:image_generation server tool output item" }), Schema.Struct({ + "action": Schema.optionalKey(Schema.String), "id": Schema.String, - "role": Schema.Literal("assistant"), + "screenshotB64": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), "type": Schema.Never, - "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), - "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), "result": Schema.optionalKey(Schema.String) - }).annotate({ "description": "An output message item" }), + }).annotate({ "description": "An openrouter:browser_use server tool output item" }), + Schema.Struct({ + "command": Schema.optionalKey(Schema.String), + "exitCode": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "id": Schema.String, + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "stderr": Schema.optionalKey(Schema.String), + "stdout": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "result": Schema.optionalKey(Schema.String) + }).annotate({ "description": "An openrouter:bash server tool output item" }), Schema.Struct({ + "command": Schema.optionalKey(Schema.Literals(["view", "create", "str_replace", "insert"])), + "filePath": Schema.optionalKey(Schema.String), + "id": Schema.String, + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), "type": Schema.Never, + "result": Schema.optionalKey(Schema.String) + }).annotate({ "description": "An openrouter:text_editor server tool output item" }), + Schema.Struct({ + "call_id": Schema.optionalKey(Schema.String), "id": Schema.String, - "content": Schema.optionalKey(Schema.Array(ReasoningTextContent)), - "summary": Schema.Array(ReasoningSummaryText), - "encrypted_content": Schema.optionalKey(Schema.String), - "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), - "signature": Schema.optionalKey( - Schema.String.annotate({ "description": "A signature for the reasoning content, used for verification" }) - ), - "format": Schema.optionalKey( - Schema.Literals([ - "unknown", - "openai-responses-v1", - "azure-openai-responses-v1", - "xai-responses-v1", - "anthropic-claude-v1", - "google-gemini-v1" - ]).annotate({ "description": "The format of the reasoning content" }) - ), + "operation": Schema.optionalKey(ApplyPatchCallOperation), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, "result": Schema.optionalKey(Schema.String) - }).annotate({ "description": "An output item containing reasoning" }), + }).annotate({ + "description": + "An openrouter:apply_patch server tool output item. The turn halts when validation succeeds so the client can apply the patch and echo an `apply_patch_call_output` on the next turn." + }), Schema.Struct({ - "type": Schema.Never, - "id": Schema.String, - "name": Schema.String, - "arguments": Schema.String, "call_id": Schema.String, - "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), + "id": Schema.String, + "operation": ApplyPatchCallOperation, + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]).annotate({ + "description": "Lifecycle state of an `apply_patch_call` output item." + }), + "type": Schema.Never, "result": Schema.optionalKey(Schema.String) + }).annotate({ + "description": + "A native `apply_patch_call` output item matching OpenAI's Responses API shape. Emitted when the client requested the `apply_patch` shorthand." }), Schema.Struct({ + "content": Schema.optionalKey(Schema.String), + "error": Schema.optionalKey( + Schema.String.annotate({ "description": "The error message if the fetch failed." }) + ), + "httpStatus": Schema.optionalKey( + Schema.Number.annotate({ "description": "The HTTP status code returned by the upstream URL fetch." }).check( + Schema.isInt() + ) + ), + "id": Schema.String, + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "title": Schema.optionalKey(Schema.String), "type": Schema.Never, + "url": Schema.optionalKey(Schema.String), + "result": Schema.optionalKey(Schema.String) + }).annotate({ "description": "An openrouter:web_fetch server tool output item" }), + Schema.Struct({ "id": Schema.String, - "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress"), Schema.Literal("failed")]), + "query": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, "result": Schema.optionalKey(Schema.String) - }), + }).annotate({ "description": "An openrouter:tool_search server tool output item" }), Schema.Struct({ + "action": Schema.optionalKey(Schema.Literals(["read", "write", "delete"])), + "id": Schema.String, + "key": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), "type": Schema.Never, + "value": Schema.optionalKey(Schema.Unknown), + "result": Schema.optionalKey(Schema.String) + }).annotate({ "description": "An openrouter:memory server tool output item" }), + Schema.Struct({ "id": Schema.String, - "queries": Schema.Array(Schema.String), - "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress"), Schema.Literal("failed")]), + "serverLabel": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "toolName": Schema.optionalKey(Schema.String), + "type": Schema.Never, "result": Schema.optionalKey(Schema.String) - }), + }).annotate({ "description": "An openrouter:mcp server tool output item" }), Schema.Struct({ - "type": Schema.Literal("image_generation_call"), + "arguments": Schema.optionalKey( + Schema.String.annotate({ + "description": "The JSON arguments submitted to the search tool (e.g. {\"query\":\"Claude\"})" + }) + ), "id": Schema.String, - "result": Schema.optionalKey(Schema.String), - "status": Schema.Union([ - Schema.Literal("in_progress"), - Schema.Literal("completed"), - Schema.Literal("generating"), - Schema.Literal("failed") - ]) - }) - ]).annotate({ "description": "An output item from the response" }) - ])), - "user": Schema.optionalKey(Schema.String), - "output_text": Schema.optionalKey(Schema.String), - "prompt_cache_key": Schema.optionalKey(Schema.String), - "safety_identifier": Schema.optionalKey(Schema.String), - "error": ResponsesErrorField, - "incomplete_details": OpenAIResponsesIncompleteDetails, - "usage": Schema.optionalKey( - Schema.Struct({ - "input_tokens": Schema.Number.check(Schema.isFinite()), - "input_tokens_details": Schema.Struct({ "cached_tokens": Schema.Number.check(Schema.isFinite()) }), - "output_tokens": Schema.Number.check(Schema.isFinite()), - "output_tokens_details": Schema.Struct({ "reasoning_tokens": Schema.Number.check(Schema.isFinite()) }), - "total_tokens": Schema.Number.check(Schema.isFinite()), - "cost": Schema.optionalKey( - Schema.Number.annotate({ "description": "Cost of the completion" }).check(Schema.isFinite()) - ), - "is_byok": Schema.optionalKey( - Schema.Boolean.annotate({ - "description": "Whether a request was made using a Bring Your Own Key configuration" - }) - ), - "cost_details": Schema.optionalKey( - Schema.Struct({ - "upstream_inference_cost": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "upstream_inference_input_cost": Schema.Number.check(Schema.isFinite()), - "upstream_inference_output_cost": Schema.Number.check(Schema.isFinite()) - }) - ) - }).annotate({ "description": "Token usage information for the response" }) - ), - "max_tool_calls": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "top_logprobs": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "max_output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "temperature": Schema.Number.check(Schema.isFinite()), - "top_p": Schema.Number.check(Schema.isFinite()), - "presence_penalty": Schema.Number.check(Schema.isFinite()), - "frequency_penalty": Schema.Number.check(Schema.isFinite()), - "instructions": OpenAIResponsesInput, - "metadata": OpenResponsesRequestMetadata, - "tools": Schema.Array( - Schema.Union([ + "query": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "result": Schema.optionalKey(Schema.String) + }).annotate({ "description": "An openrouter:experimental__search_models server tool output item" }), Schema.Struct({ - "type": Schema.Literal("function"), - "name": Schema.String, - "description": Schema.optionalKey(Schema.String), - "strict": Schema.optionalKey(Schema.Boolean), - "parameters": Schema.Struct({}) - }).annotate({ "description": "Function tool definition" }), - OpenResponsesWebSearchPreviewTool, - OpenResponsesWebSearchPreview20250311Tool, - OpenResponsesWebSearchTool, - OpenResponsesWebSearch20250826Tool - ], { mode: "oneOf" }) - ), - "tool_choice": OpenAIResponsesToolChoice, - "parallel_tool_calls": Schema.Boolean, - "prompt": Schema.optionalKey(OpenAIResponsesPrompt), - "background": Schema.optionalKey(Schema.Boolean), - "previous_response_id": Schema.optionalKey(Schema.String), - "reasoning": Schema.optionalKey(OpenAIResponsesReasoningConfig), - "service_tier": Schema.optionalKey(OpenAIResponsesServiceTier), - "store": Schema.optionalKey(Schema.Boolean), - "truncation": Schema.optionalKey(OpenAIResponsesTruncation), - "text": Schema.optionalKey(ResponseTextConfig) -}).annotate({ "description": "Complete non-streaming response from the Responses API" }) -export type OpenResponsesRequest = { - readonly "input"?: OpenResponsesInput - readonly "instructions"?: string - readonly "metadata"?: OpenResponsesRequestMetadata - readonly "tools"?: ReadonlyArray< - | { - readonly "type": "function" - readonly "name": string - readonly "description"?: string - readonly "strict"?: boolean - readonly "parameters": {} - } - | OpenResponsesWebSearchPreviewTool - | OpenResponsesWebSearchPreview20250311Tool - | OpenResponsesWebSearchTool - | OpenResponsesWebSearch20250826Tool - > - readonly "tool_choice"?: OpenAIResponsesToolChoice - readonly "parallel_tool_calls"?: boolean - readonly "model"?: string - readonly "models"?: ReadonlyArray - readonly "text"?: OpenResponsesResponseText - readonly "reasoning"?: OpenResponsesReasoningConfig - readonly "max_output_tokens"?: number - readonly "temperature"?: number - readonly "top_p"?: number - readonly "top_logprobs"?: number - readonly "max_tool_calls"?: number - readonly "presence_penalty"?: number - readonly "frequency_penalty"?: number - readonly "top_k"?: number - readonly "image_config"?: {} - readonly "modalities"?: ReadonlyArray - readonly "prompt_cache_key"?: string - readonly "previous_response_id"?: string - readonly "prompt"?: OpenAIResponsesPrompt - readonly "include"?: ReadonlyArray - readonly "background"?: boolean - readonly "safety_identifier"?: string - readonly "store"?: false - readonly "service_tier"?: "auto" - readonly "truncation"?: "auto" | "disabled" - readonly "stream"?: boolean - readonly "provider"?: { - readonly "allow_fallbacks"?: boolean - readonly "require_parameters"?: boolean - readonly "data_collection"?: DataCollection - readonly "zdr"?: boolean - readonly "enforce_distillable_text"?: boolean - readonly "order"?: ReadonlyArray - readonly "only"?: ReadonlyArray - readonly "ignore"?: ReadonlyArray - readonly "quantizations"?: ReadonlyArray - readonly "sort"?: ProviderSort | ProviderSortConfig | unknown - readonly "max_price"?: { - readonly "prompt"?: BigNumberUnion - readonly "completion"?: string - readonly "image"?: string - readonly "audio"?: string - readonly "request"?: string - } - readonly "preferred_min_throughput"?: PreferredMinThroughput - readonly "preferred_max_latency"?: PreferredMaxLatency - } - readonly "plugins"?: ReadonlyArray< - | { readonly "id": "auto-router"; readonly "enabled"?: boolean; readonly "allowed_models"?: ReadonlyArray } - | { readonly "id": "moderation" } - | { - readonly "id": "web" - readonly "enabled"?: boolean - readonly "max_results"?: number - readonly "search_prompt"?: string - readonly "engine"?: WebSearchEngine - } - | { readonly "id": "file-parser"; readonly "enabled"?: boolean; readonly "pdf"?: PDFParserOptions } - | { readonly "id": "response-healing"; readonly "enabled"?: boolean } - > - readonly "route"?: "fallback" | "sort" - readonly "user"?: string - readonly "session_id"?: string - readonly "trace"?: { - readonly "trace_id"?: string - readonly "trace_name"?: string - readonly "span_name"?: string - readonly "generation_name"?: string - readonly "parent_span_id"?: string - } -} -export const OpenResponsesRequest = Schema.Struct({ - "input": Schema.optionalKey(OpenResponsesInput), - "instructions": Schema.optionalKey(Schema.String), - "metadata": Schema.optionalKey(OpenResponsesRequestMetadata), - "tools": Schema.optionalKey( - Schema.Array( - Schema.Union([ - Schema.Struct({ - "type": Schema.Literal("function"), - "name": Schema.String, - "description": Schema.optionalKey(Schema.String), - "strict": Schema.optionalKey(Schema.Boolean), - "parameters": Schema.Struct({}) - }).annotate({ "description": "Function tool definition" }), - OpenResponsesWebSearchPreviewTool, - OpenResponsesWebSearchPreview20250311Tool, - OpenResponsesWebSearchTool, - OpenResponsesWebSearch20250826Tool - ], { mode: "oneOf" }) - ) - ), - "tool_choice": Schema.optionalKey(OpenAIResponsesToolChoice), - "parallel_tool_calls": Schema.optionalKey(Schema.Boolean), - "model": Schema.optionalKey(Schema.String), - "models": Schema.optionalKey(Schema.Array(Schema.String)), - "text": Schema.optionalKey(OpenResponsesResponseText), - "reasoning": Schema.optionalKey(OpenResponsesReasoningConfig), - "max_output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "temperature": Schema.optionalKey( - Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(2)) - ), - "top_p": Schema.optionalKey(Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0))), - "top_logprobs": Schema.optionalKey( - Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0)).check(Schema.isLessThanOrEqualTo(20)) - ), - "max_tool_calls": Schema.optionalKey(Schema.Number.check(Schema.isInt())), - "presence_penalty": Schema.optionalKey( - Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(-2)).check(Schema.isLessThanOrEqualTo(2)) - ), - "frequency_penalty": Schema.optionalKey( - Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(-2)).check(Schema.isLessThanOrEqualTo(2)) - ), - "top_k": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "image_config": Schema.optionalKey( - Schema.Struct({}).annotate({ - "description": - "Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/features/multimodal/image-generation for more details." - }) - ), - "modalities": Schema.optionalKey( - Schema.Array(ResponsesOutputModality).annotate({ - "description": "Output modalities for the response. Supported values are \"text\" and \"image\"." - }) - ), - "prompt_cache_key": Schema.optionalKey(Schema.String), - "previous_response_id": Schema.optionalKey(Schema.String), - "prompt": Schema.optionalKey(OpenAIResponsesPrompt), - "include": Schema.optionalKey(Schema.Array(OpenAIResponsesIncludable)), - "background": Schema.optionalKey(Schema.Boolean), - "safety_identifier": Schema.optionalKey(Schema.String), - "store": Schema.optionalKey(Schema.Literal(false)), - "service_tier": Schema.optionalKey(Schema.Literal("auto")), - "truncation": Schema.optionalKey(Schema.Literals(["auto", "disabled"])), - "stream": Schema.optionalKey(Schema.Boolean), - "provider": Schema.optionalKey( - Schema.Struct({ - "allow_fallbacks": Schema.optionalKey(Schema.Boolean.annotate({ - "description": - "Whether to allow backup providers to serve requests\n- true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider.\n- false: use only the primary/custom provider, and return the upstream error if it's unavailable.\n" - })), - "require_parameters": Schema.optionalKey( - Schema.Boolean.annotate({ - "description": - "Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest." - }) - ), - "data_collection": Schema.optionalKey(DataCollection), - "zdr": Schema.optionalKey( - Schema.Boolean.annotate({ - "description": - "Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used." - }) - ), - "enforce_distillable_text": Schema.optionalKey( - Schema.Boolean.annotate({ - "description": - "Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used." - }) - ), - "order": Schema.optionalKey( - Schema.Array(Schema.Union([ProviderName, Schema.String])).annotate({ - "description": - "An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message." - }) - ), - "only": Schema.optionalKey( - Schema.Array(Schema.Union([ProviderName, Schema.String])).annotate({ - "description": - "List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request." - }) - ), - "ignore": Schema.optionalKey( - Schema.Array(Schema.Union([ProviderName, Schema.String])).annotate({ - "description": - "List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request." - }) - ), - "quantizations": Schema.optionalKey( - Schema.Array(Quantization).annotate({ - "description": "A list of quantization levels to filter the provider by." - }) - ), - "sort": Schema.optionalKey( - Schema.Union([ProviderSort, ProviderSortConfig, Schema.Unknown]).annotate({ - "description": - "The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed." - }) - ), - "max_price": Schema.optionalKey( - Schema.Struct({ - "prompt": Schema.optionalKey(BigNumberUnion), - "completion": Schema.optionalKey( - Schema.String.annotate({ "description": "Price per million completion tokens" }) - ), - "image": Schema.optionalKey(Schema.String.annotate({ "description": "Price per image" })), - "audio": Schema.optionalKey(Schema.String.annotate({ "description": "Price per audio unit" })), - "request": Schema.optionalKey(Schema.String.annotate({ "description": "Price per request" })) - }).annotate({ - "description": - "The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion." - }) - ), - "preferred_min_throughput": Schema.optionalKey(PreferredMinThroughput), - "preferred_max_latency": Schema.optionalKey(PreferredMaxLatency) - }).annotate({ - "description": "When multiple model providers are available, optionally indicate your routing preference." - }) - ), - "plugins": Schema.optionalKey( - Schema.Array(Schema.Union([ + "analysis": Schema.optionalKey( + Schema.Struct({ + "blind_spots": Schema.Array(Schema.String), + "consensus": Schema.Array(Schema.String), + "contradictions": Schema.Array( + Schema.Struct({ + "stances": Schema.Array(Schema.Struct({ "model": Schema.String, "stance": Schema.String })), + "topic": Schema.String + }) + ), + "partial_coverage": Schema.Array( + Schema.Struct({ "models": Schema.Array(Schema.String), "point": Schema.String }) + ), + "unique_insights": Schema.Array(Schema.Struct({ "insight": Schema.String, "model": Schema.String })) + }).annotate({ "description": "Structured analysis produced by the fusion judge model." }) + ), + "error": Schema.optionalKey( + Schema.String.annotate({ + "description": "Error message when the fusion run did not produce an analysis result." + }) + ), + "failed_models": Schema.optionalKey( + Schema.Array( + Schema.Struct({ + "error": Schema.String.annotate({ "description": "Error message describing why the model failed." }), + "model": Schema.String.annotate({ "description": "Slug of the analysis model that failed." }) + }) + ).annotate({ + "description": + "Models that were requested as part of the analysis panel but did not produce a response. Present when at least one requested analysis model failed. The fusion result is still usable but was produced from a degraded panel." + }) + ), + "id": Schema.String, + "responses": Schema.optionalKey( + Schema.Array(Schema.Struct({ "model": Schema.String })).annotate({ + "description": "Slugs of the analysis models that produced a response in this fusion run." + }) + ), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "result": Schema.optionalKey(Schema.String) + }).annotate({ "description": "An openrouter:fusion server tool output item" }), Schema.Struct({ - "id": Schema.Literal("auto-router"), - "enabled": Schema.optionalKey( - Schema.Boolean.annotate({ - "description": "Set to false to disable the auto-router plugin for this request. Defaults to true." + "call_id": Schema.String, + "id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" }) ), - "allowed_models": Schema.optionalKey( - Schema.Array(Schema.String).annotate({ + "type": Schema.Never, + "result": Schema.optionalKey(Schema.String), + "status": ImageGenerationStatus + }).annotate({ + "description": + "A call to a custom (freeform-grammar) tool created by the model — distinct from `function_call`. Used for tools like Codex CLI's `apply_patch` whose payload is opaque text rather than JSON arguments." + }) + ], { mode: "oneOf" }).annotate({ "description": "An output item from the response" }), + Schema.Union([ + Schema.Struct({ + "content": Schema.Array(Schema.Union([ResponseOutputText, OpenAIResponsesRefusalContent])), + "id": Schema.String, + "phase": Schema.optionalKey( + Schema.Union([Schema.Literal("commentary"), Schema.Literal("final_answer"), Schema.Unknown]).annotate({ "description": - "List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list." + "The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages." }) - ) - }), - Schema.Struct({ "id": Schema.Literal("moderation") }), + ), + "role": Schema.Literal("assistant"), + "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), + "type": Schema.Never, + "call_id": Schema.String, + "created_by": Schema.optionalKey(Schema.String), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }) + }).annotate({ "description": "An output message item" }), + Schema.Struct({ + "content": Schema.optionalKey( + Schema.Array(Schema.Struct({ "text": Schema.String, "type": Schema.Literal("reasoning_text") })) + ), + "encrypted_content": Schema.optionalKey(Schema.String), + "id": Schema.String, + "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), + "summary": Schema.Array(ReasoningSummaryText), + "type": Schema.Never, + "format": Schema.optionalKey(ReasoningFormat), + "signature": Schema.optionalKey( + Schema.String.annotate({ "description": "A signature for the reasoning content, used for verification" }) + ), + "call_id": Schema.String, + "created_by": Schema.optionalKey(Schema.String), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }) + }).annotate({ "description": "An output item containing reasoning" }), Schema.Struct({ - "id": Schema.Literal("web"), - "enabled": Schema.optionalKey( - Schema.Boolean.annotate({ - "description": "Set to false to disable the web-search plugin for this request. Defaults to true." + "arguments": Schema.String, + "call_id": Schema.String, + "id": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" }) ), - "max_results": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "search_prompt": Schema.optionalKey(Schema.String), - "engine": Schema.optionalKey(WebSearchEngine) + "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), + "type": Schema.Never, + "created_by": Schema.optionalKey(Schema.String), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }) }), Schema.Struct({ - "id": Schema.Literal("file-parser"), - "enabled": Schema.optionalKey( - Schema.Boolean.annotate({ - "description": "Set to false to disable the file-parser plugin for this request. Defaults to true." - }) + "action": Schema.Union([ + Schema.Struct({ + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "query": Schema.String, + "sources": Schema.optionalKey(Schema.Array(WebSearchSource)), + "type": Schema.Literal("search") + }), + Schema.Struct({ "type": Schema.Literal("open_page"), "url": Schema.optionalKey(Schema.String) }), + Schema.Struct({ "pattern": Schema.String, "type": Schema.Literal("find_in_page"), "url": Schema.String }) + ], { mode: "oneOf" }), + "id": Schema.String, + "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), + "type": Schema.Never, + "call_id": Schema.String, + "created_by": Schema.optionalKey(Schema.String), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }) + }), + Schema.Struct({ + "id": Schema.String, + "queries": Schema.Array(Schema.String), + "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), + "type": Schema.Never, + "call_id": Schema.String, + "created_by": Schema.optionalKey(Schema.String), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }) + }), + Schema.Struct({ + "id": Schema.String, + "result": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "call_id": Schema.String, + "created_by": Schema.optionalKey(Schema.String), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }) + }), + Schema.Struct({ + "code": Schema.String, + "container_id": Schema.String, + "id": Schema.String, + "outputs": Schema.Array( + Schema.Union([ + Schema.Struct({ "type": Schema.Literal("image"), "url": Schema.String }), + Schema.Struct({ "logs": Schema.String, "type": Schema.Literal("logs") }) + ]) + ), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "call_id": Schema.String, + "created_by": Schema.optionalKey(Schema.String), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }) + }).annotate({ "description": "A code interpreter execution call with outputs" }), + Schema.Struct({ + "action": Schema.optionalKey(Schema.Unknown), + "call_id": Schema.String, + "id": Schema.String, + "pending_safety_checks": Schema.Array( + Schema.Struct({ "code": Schema.String, "id": Schema.String, "message": Schema.String }) ), - "pdf": Schema.optionalKey(PDFParserOptions) + "status": Schema.Union([Schema.Literal("completed"), Schema.Literal("in_progress")]), + "type": Schema.Never, + "created_by": Schema.optionalKey(Schema.String), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }) }), Schema.Struct({ - "id": Schema.Literal("response-healing"), - "enabled": Schema.optionalKey( - Schema.Boolean.annotate({ - "description": "Set to false to disable the response-healing plugin for this request. Defaults to true." + "datetime": Schema.String.annotate({ "description": "ISO 8601 datetime string" }), + "id": Schema.String, + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "timezone": Schema.String.annotate({ "description": "IANA timezone name" }), + "type": Schema.Never, + "call_id": Schema.String, + "created_by": Schema.optionalKey(Schema.String), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:datetime server tool output item" }), + Schema.Struct({ + "action": Schema.optionalKey( + Schema.Struct({ + "query": Schema.String, + "sources": Schema.optionalKey( + Schema.Array(Schema.Struct({ "type": Schema.Literal("url"), "url": Schema.String })) + ), + "type": Schema.Literal("search") + }).annotate({ + "description": + "The search action performed, matching OpenAI web_search_call.action shape. Includes the query the model issued and optional source URLs returned by the search provider." }) - ) - }) - ], { mode: "oneOf" })).annotate({ - "description": "Plugins you want to enable for this request, including their settings." - }) - ), - "route": Schema.optionalKey( - Schema.Literals(["fallback", "sort"]).annotate({ - "description": - "**DEPRECATED** Use providers.sort.partition instead. Backwards-compatible alias for providers.sort.partition. Accepts legacy values: \"fallback\" (maps to \"model\"), \"sort\" (maps to \"none\")." - }) - ), - "user": Schema.optionalKey( - Schema.String.annotate({ - "description": - "A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters." - }).check(Schema.isMaxLength(128)) - ), - "session_id": Schema.optionalKey( - Schema.String.annotate({ - "description": - "A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters." - }).check(Schema.isMaxLength(128)) - ), - "trace": Schema.optionalKey( - Schema.Struct({ - "trace_id": Schema.optionalKey(Schema.String), - "trace_name": Schema.optionalKey(Schema.String), - "span_name": Schema.optionalKey(Schema.String), - "generation_name": Schema.optionalKey(Schema.String), - "parent_span_id": Schema.optionalKey(Schema.String) - }).annotate({ - "description": - "Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations." - }) - ) -}).annotate({ "description": "Request schema for Responses endpoint" }) -export type ChatGenerationParams = { - readonly "provider"?: { - readonly "allow_fallbacks"?: boolean | null - readonly "require_parameters"?: boolean | null - readonly "data_collection"?: "deny" | "allow" | null - readonly "zdr"?: boolean | null - readonly "enforce_distillable_text"?: boolean | null - readonly "order"?: __schema5 | null - readonly "only"?: __schema5 | null - readonly "ignore"?: __schema5 | null - readonly "quantizations"?: - | ReadonlyArray<"int4" | "int8" | "fp4" | "fp6" | "fp8" | "fp16" | "bf16" | "fp32" | "unknown"> - | null - readonly "sort"?: ProviderSortUnion | null - readonly "max_price"?: { - readonly "prompt"?: __schema11 | ModelName | __schema13 - readonly "completion"?: __schema11 | ModelName | __schema13 - readonly "image"?: __schema14 - readonly "audio"?: __schema14 - readonly "request"?: __schema14 - } - readonly "preferred_min_throughput"?: number | { - readonly "p50"?: number | null - readonly "p75"?: number | null - readonly "p90"?: number | null - readonly "p99"?: number | null - } | null - readonly "preferred_max_latency"?: number | { - readonly "p50"?: number | null - readonly "p75"?: number | null - readonly "p90"?: number | null - readonly "p99"?: number | null - } | null - } | null - readonly "plugins"?: ReadonlyArray< - | { readonly "id": "auto-router"; readonly "enabled"?: boolean; readonly "allowed_models"?: ReadonlyArray } - | { readonly "id": "moderation" } - | { - readonly "id": "web" - readonly "enabled"?: boolean - readonly "max_results"?: number - readonly "search_prompt"?: string - readonly "engine"?: "native" | "exa" - } - | { - readonly "id": "file-parser" - readonly "enabled"?: boolean - readonly "pdf"?: { readonly "engine"?: "mistral-ocr" | "pdf-text" | "native" } - } - | { readonly "id": "response-healing"; readonly "enabled"?: boolean } - > - readonly "route"?: "fallback" | "sort" | null - readonly "user"?: string - readonly "session_id"?: string - readonly "trace"?: { - readonly "trace_id"?: string - readonly "trace_name"?: string - readonly "span_name"?: string - readonly "generation_name"?: string - readonly "parent_span_id"?: string - } - readonly "messages": ReadonlyArray - readonly "model"?: ModelName - readonly "models"?: ReadonlyArray - readonly "frequency_penalty"?: number | null - readonly "logit_bias"?: {} | null - readonly "logprobs"?: boolean | null - readonly "top_logprobs"?: number | null - readonly "max_completion_tokens"?: number | null - readonly "max_tokens"?: number | null - readonly "metadata"?: {} - readonly "presence_penalty"?: number | null - readonly "reasoning"?: { - readonly "effort"?: "xhigh" | "high" | "medium" | "low" | "minimal" | "none" | null - readonly "summary"?: ReasoningSummaryVerbosity | null - } - readonly "response_format"?: - | { readonly "type": "text" } - | { readonly "type": "json_object" } - | ResponseFormatJSONSchema - | ResponseFormatTextGrammar - | { readonly "type": "python" } - readonly "seed"?: number | null - readonly "stop"?: string | ReadonlyArray | null - readonly "stream"?: boolean - readonly "stream_options"?: ChatStreamOptions | null - readonly "temperature"?: number | null - readonly "parallel_tool_calls"?: boolean | null - readonly "tool_choice"?: ToolChoiceOption - readonly "tools"?: ReadonlyArray - readonly "top_p"?: number | null - readonly "debug"?: { readonly "echo_upstream_body"?: boolean } - readonly "image_config"?: {} - readonly "modalities"?: ReadonlyArray<"text" | "image"> -} -export const ChatGenerationParams = Schema.Struct({ - "provider": Schema.optionalKey( - Schema.Union([ + ), + "id": Schema.String, + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "call_id": Schema.String, + "created_by": Schema.optionalKey(Schema.String), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:web_search server tool output item" }), + Schema.Struct({ + "code": Schema.optionalKey(Schema.String), + "exitCode": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "id": Schema.String, + "language": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "stderr": Schema.optionalKey(Schema.String), + "stdout": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "call_id": Schema.String, + "created_by": Schema.optionalKey(Schema.String), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:code_interpreter server tool output item" }), + Schema.Struct({ + "id": Schema.String, + "queries": Schema.optionalKey(Schema.Array(Schema.String)), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "call_id": Schema.String, + "created_by": Schema.optionalKey(Schema.String), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:file_search server tool output item" }), + Schema.Struct({ + "id": Schema.String, + "imageB64": Schema.optionalKey(Schema.String), + "imageUrl": Schema.optionalKey(Schema.String), + "result": Schema.optionalKey( + Schema.String.annotate({ + "description": + "The generated image as a base64-encoded string or URL, matching OpenAI image_generation_call format" + }) + ), + "revisedPrompt": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "call_id": Schema.String, + "created_by": Schema.optionalKey(Schema.String), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:image_generation server tool output item" }), + Schema.Struct({ + "action": Schema.optionalKey(Schema.String), + "id": Schema.String, + "screenshotB64": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "call_id": Schema.String, + "created_by": Schema.optionalKey(Schema.String), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:browser_use server tool output item" }), + Schema.Struct({ + "command": Schema.optionalKey(Schema.String), + "exitCode": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "id": Schema.String, + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "stderr": Schema.optionalKey(Schema.String), + "stdout": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "call_id": Schema.String, + "created_by": Schema.optionalKey(Schema.String), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:bash server tool output item" }), + Schema.Struct({ + "command": Schema.optionalKey(Schema.Literals(["view", "create", "str_replace", "insert"])), + "filePath": Schema.optionalKey(Schema.String), + "id": Schema.String, + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "call_id": Schema.String, + "created_by": Schema.optionalKey(Schema.String), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:text_editor server tool output item" }), + Schema.Struct({ + "call_id": Schema.String, + "id": Schema.String, + "operation": Schema.Union([ + Schema.Union([ + Schema.Struct({ "diff": Schema.String, "path": Schema.String, "type": Schema.Literal("create_file") }) + .annotate({ + "description": + "The `create_file` variant of an `apply_patch_call.operation`. Carries a V4A diff describing the new file contents." + }), + Schema.Struct({ "diff": Schema.String, "path": Schema.String, "type": Schema.Never }).annotate({ + "description": + "The `create_file` variant of an `apply_patch_call.operation`. Carries a V4A diff describing the new file contents." + }), + Schema.Struct({ "path": Schema.String, "type": Schema.Never, "diff": Schema.String }).annotate({ + "description": + "The `create_file` variant of an `apply_patch_call.operation`. Carries a V4A diff describing the new file contents." + }) + ], { mode: "oneOf" }), + Schema.Union([ + Schema.Struct({ "diff": Schema.String, "path": Schema.String, "type": Schema.Never }).annotate({ + "description": + "The `update_file` variant of an `apply_patch_call.operation`. Carries a V4A diff describing edits to an existing file." + }), + Schema.Struct({ "diff": Schema.String, "path": Schema.String, "type": Schema.Literal("update_file") }) + .annotate({ + "description": + "The `update_file` variant of an `apply_patch_call.operation`. Carries a V4A diff describing edits to an existing file." + }), + Schema.Struct({ "path": Schema.String, "type": Schema.Never, "diff": Schema.String }).annotate({ + "description": + "The `update_file` variant of an `apply_patch_call.operation`. Carries a V4A diff describing edits to an existing file." + }) + ], { mode: "oneOf" }), + Schema.Union([ + Schema.Struct({ "diff": Schema.String, "path": Schema.String, "type": Schema.Never }).annotate({ + "description": + "The `delete_file` variant of an `apply_patch_call.operation`. Identifies the file to remove; no diff is required." + }), + Schema.Struct({ "diff": Schema.String, "path": Schema.String, "type": Schema.Never }).annotate({ + "description": + "The `delete_file` variant of an `apply_patch_call.operation`. Identifies the file to remove; no diff is required." + }), + Schema.Struct({ "path": Schema.String, "type": Schema.Literal("delete_file") }).annotate({ + "description": + "The `delete_file` variant of an `apply_patch_call.operation`. Identifies the file to remove; no diff is required." + }) + ], { mode: "oneOf" }) + ], { mode: "oneOf" }).annotate({ + "description": + "The patch operation requested by an `apply_patch_call`. `create_file` and `update_file` carry a V4A diff; `delete_file` omits it." + }), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "created_by": Schema.optionalKey(Schema.String) + }).annotate({ + "description": + "An openrouter:apply_patch server tool output item. The turn halts when validation succeeds so the client can apply the patch and echo an `apply_patch_call_output` on the next turn." + }), + Schema.Struct({ + "call_id": Schema.String, + "id": Schema.String, + "operation": Schema.Union([ + Schema.Union([ + Schema.Struct({ "diff": Schema.String, "path": Schema.String, "type": Schema.Literal("create_file") }) + .annotate({ + "description": + "The `create_file` variant of an `apply_patch_call.operation`. Carries a V4A diff describing the new file contents." + }), + Schema.Struct({ "diff": Schema.String, "path": Schema.String, "type": Schema.Never }).annotate({ + "description": + "The `create_file` variant of an `apply_patch_call.operation`. Carries a V4A diff describing the new file contents." + }), + Schema.Struct({ "path": Schema.String, "type": Schema.Never, "diff": Schema.String }).annotate({ + "description": + "The `create_file` variant of an `apply_patch_call.operation`. Carries a V4A diff describing the new file contents." + }) + ], { mode: "oneOf" }), + Schema.Union([ + Schema.Struct({ "diff": Schema.String, "path": Schema.String, "type": Schema.Never }).annotate({ + "description": + "The `update_file` variant of an `apply_patch_call.operation`. Carries a V4A diff describing edits to an existing file." + }), + Schema.Struct({ "diff": Schema.String, "path": Schema.String, "type": Schema.Literal("update_file") }) + .annotate({ + "description": + "The `update_file` variant of an `apply_patch_call.operation`. Carries a V4A diff describing edits to an existing file." + }), + Schema.Struct({ "path": Schema.String, "type": Schema.Never, "diff": Schema.String }).annotate({ + "description": + "The `update_file` variant of an `apply_patch_call.operation`. Carries a V4A diff describing edits to an existing file." + }) + ], { mode: "oneOf" }), + Schema.Union([ + Schema.Struct({ "diff": Schema.String, "path": Schema.String, "type": Schema.Never }).annotate({ + "description": + "The `delete_file` variant of an `apply_patch_call.operation`. Identifies the file to remove; no diff is required." + }), + Schema.Struct({ "diff": Schema.String, "path": Schema.String, "type": Schema.Never }).annotate({ + "description": + "The `delete_file` variant of an `apply_patch_call.operation`. Identifies the file to remove; no diff is required." + }), + Schema.Struct({ "path": Schema.String, "type": Schema.Literal("delete_file") }).annotate({ + "description": + "The `delete_file` variant of an `apply_patch_call.operation`. Identifies the file to remove; no diff is required." + }) + ], { mode: "oneOf" }) + ], { mode: "oneOf" }).annotate({ + "description": + "The patch operation requested by an `apply_patch_call`. `create_file` and `update_file` carry a V4A diff; `delete_file` omits it." + }), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]).annotate({ + "description": "Lifecycle state of an `apply_patch_call` output item." + }), + "type": Schema.Literal("apply_patch_call"), + "created_by": Schema.optionalKey(Schema.String) + }).annotate({ + "description": + "A native `apply_patch_call` output item matching OpenAI's Responses API shape. Emitted when the client requested the `apply_patch` shorthand." + }), + Schema.Struct({ + "content": Schema.optionalKey(Schema.String), + "error": Schema.optionalKey( + Schema.String.annotate({ "description": "The error message if the fetch failed." }) + ), + "httpStatus": Schema.optionalKey( + Schema.Number.annotate({ "description": "The HTTP status code returned by the upstream URL fetch." }).check( + Schema.isInt() + ) + ), + "id": Schema.String, + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "title": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "url": Schema.optionalKey(Schema.String), + "call_id": Schema.String, + "created_by": Schema.optionalKey(Schema.String), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:web_fetch server tool output item" }), + Schema.Struct({ + "id": Schema.String, + "query": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "call_id": Schema.String, + "created_by": Schema.optionalKey(Schema.String), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:tool_search server tool output item" }), + Schema.Struct({ + "action": Schema.optionalKey(Schema.Literals(["read", "write", "delete"])), + "id": Schema.String, + "key": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "value": Schema.optionalKey(Schema.Unknown), + "call_id": Schema.String, + "created_by": Schema.optionalKey(Schema.String), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:memory server tool output item" }), Schema.Struct({ - "allow_fallbacks": Schema.optionalKey( - Schema.Union([Schema.Boolean, Schema.Null]).annotate({ - "description": - "Whether to allow backup providers to serve requests\n- true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider.\n- false: use only the primary/custom provider, and return the upstream error if it's unavailable.\n" + "id": Schema.String, + "serverLabel": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "toolName": Schema.optionalKey(Schema.String), + "type": Schema.Never, + "call_id": Schema.String, + "created_by": Schema.optionalKey(Schema.String), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:mcp server tool output item" }), + Schema.Struct({ + "arguments": Schema.optionalKey( + Schema.String.annotate({ + "description": "The JSON arguments submitted to the search tool (e.g. {\"query\":\"Claude\"})" }) ), - "require_parameters": Schema.optionalKey( - Schema.Union([Schema.Boolean, Schema.Null]).annotate({ - "description": - "Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest." - }) + "id": Schema.String, + "query": Schema.optionalKey(Schema.String), + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "call_id": Schema.String, + "created_by": Schema.optionalKey(Schema.String), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:experimental__search_models server tool output item" }), + Schema.Struct({ + "analysis": Schema.optionalKey( + Schema.Struct({ + "blind_spots": Schema.Array(Schema.String), + "consensus": Schema.Array(Schema.String), + "contradictions": Schema.Array( + Schema.Struct({ + "stances": Schema.Array(Schema.Struct({ "model": Schema.String, "stance": Schema.String })), + "topic": Schema.String + }) + ), + "partial_coverage": Schema.Array( + Schema.Struct({ "models": Schema.Array(Schema.String), "point": Schema.String }) + ), + "unique_insights": Schema.Array(Schema.Struct({ "insight": Schema.String, "model": Schema.String })) + }).annotate({ "description": "Structured analysis produced by the fusion judge model." }) ), - "data_collection": Schema.optionalKey( - Schema.Union([Schema.Literals(["deny", "allow"]), Schema.Null]).annotate({ - "description": - "Data collection setting. If no available model provider meets the requirement, your request will return an error.\n- allow: (default) allow providers which store user data non-transiently and may train on it\n\n- deny: use only providers which do not collect user data." + "error": Schema.optionalKey( + Schema.String.annotate({ + "description": "Error message when the fusion run did not produce an analysis result." }) ), - "zdr": Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - "enforce_distillable_text": Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - "order": Schema.optionalKey( - Schema.Union([__schema5, Schema.Null]).annotate({ + "failed_models": Schema.optionalKey( + Schema.Array( + Schema.Struct({ + "error": Schema.String.annotate({ "description": "Error message describing why the model failed." }), + "model": Schema.String.annotate({ "description": "Slug of the analysis model that failed." }) + }) + ).annotate({ "description": - "An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message." + "Models that were requested as part of the analysis panel but did not produce a response. Present when at least one requested analysis model failed. The fusion result is still usable but was produced from a degraded panel." }) ), - "only": Schema.optionalKey( - Schema.Union([__schema5, Schema.Null]).annotate({ - "description": - "List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request." + "id": Schema.String, + "responses": Schema.optionalKey( + Schema.Array(Schema.Struct({ "model": Schema.String })).annotate({ + "description": "Slugs of the analysis models that produced a response in this fusion run." }) ), - "ignore": Schema.optionalKey( - Schema.Union([__schema5, Schema.Null]).annotate({ + "status": Schema.Union([Schema.Literal("in_progress"), Schema.Literal("completed")]), + "type": Schema.Never, + "call_id": Schema.String, + "created_by": Schema.optionalKey(Schema.String), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }) + }).annotate({ "description": "An openrouter:fusion server tool output item" }), + Schema.Struct({ + "call_id": Schema.String, + "id": Schema.String, + "input": Schema.String, + "name": Schema.String, + "namespace": Schema.optionalKey( + Schema.String.annotate({ "description": - "List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request." + "Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)" }) ), - "quantizations": Schema.optionalKey( + "type": Schema.Never, + "created_by": Schema.optionalKey(Schema.String), + "operation": Schema.Union([ + ApplyPatchCreateFileOperation, + ApplyPatchUpdateFileOperation, + ApplyPatchDeleteFileOperation + ], { mode: "oneOf" }), + "status": Schema.Literals(["in_progress", "completed"]) + }).annotate({ + "description": + "A call to a custom (freeform-grammar) tool created by the model — distinct from `function_call`. Used for tools like Codex CLI's `apply_patch` whose payload is opaque text rather than JSON arguments." + }) + ], { mode: "oneOf" }).annotate({ "description": "An output item from the response" }) + ], { mode: "oneOf" })), + "output_text": Schema.optionalKey(Schema.String), + "parallel_tool_calls": Schema.Boolean, + "presence_penalty": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "previous_response_id": Schema.optionalKey(Schema.String), + "prompt": Schema.optionalKey(StoredPromptTemplate), + "prompt_cache_key": Schema.optionalKey(Schema.String), + "reasoning": Schema.optionalKey(BaseReasoningConfig), + "safety_identifier": Schema.optionalKey(Schema.String), + "service_tier": Schema.optionalKey(Schema.Literals(["auto", "default", "flex", "priority", "scale"])), + "status": OpenAIResponsesResponseStatus, + "store": Schema.optionalKey(Schema.Boolean), + "temperature": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "text": Schema.optionalKey( + Schema.Struct({ + "format": Schema.optionalKey( + Schema.Union([ Schema.Union([ - Schema.Array(Schema.Literals(["int4", "int8", "fp4", "fp6", "fp8", "fp16", "bf16", "fp32", "unknown"])), - Schema.Null - ]).annotate({ "description": "A list of quantization levels to filter the provider by." }) - ), - "sort": Schema.optionalKey( - Schema.Union([ProviderSortUnion, Schema.Null]).annotate({ - "description": - "The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed." - }) - ), - "max_price": Schema.optionalKey( - Schema.Struct({ - "prompt": Schema.optionalKey(Schema.Union([__schema11, ModelName, __schema13])), - "completion": Schema.optionalKey(Schema.Union([__schema11, ModelName, __schema13])), - "image": Schema.optionalKey(__schema14), - "audio": Schema.optionalKey(__schema14), - "request": Schema.optionalKey(__schema14) - }).annotate({ - "description": - "The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion." - }) - ), - "preferred_min_throughput": Schema.optionalKey( + Schema.Struct({ "type": Schema.Literal("text") }).annotate({ "description": "Plain text response format" }), + Schema.Struct({ "type": Schema.Never }).annotate({ "description": "Plain text response format" }), + Schema.Struct({ + "description": Schema.optionalKey(Schema.String), + "name": Schema.String, + "schema": Schema.Struct({}), + "strict": Schema.optionalKey(Schema.Boolean), + "type": Schema.Never + }).annotate({ "description": "Plain text response format" }) + ]).annotate({ "description": "Text response format configuration" }), Schema.Union([ - Schema.Union([ - Schema.Number.check(Schema.isFinite()), - Schema.Struct({ - "p50": Schema.optionalKey(Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null])), - "p75": Schema.optionalKey(Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null])), - "p90": Schema.optionalKey(Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null])), - "p99": Schema.optionalKey(Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null])) - }) - ]), - Schema.Null - ]).annotate({ - "description": - "Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold." - }) - ), - "preferred_max_latency": Schema.optionalKey( + Schema.Struct({ "type": Schema.Never }).annotate({ "description": "JSON object response format" }), + Schema.Struct({ "type": Schema.Literal("json_object") }).annotate({ + "description": "JSON object response format" + }), + Schema.Struct({ + "description": Schema.optionalKey(Schema.String), + "name": Schema.String, + "schema": Schema.Struct({}), + "strict": Schema.optionalKey(Schema.Boolean), + "type": Schema.Never + }).annotate({ "description": "JSON object response format" }) + ]).annotate({ "description": "Text response format configuration" }), Schema.Union([ - Schema.Union([ - Schema.Number.check(Schema.isFinite()), - Schema.Struct({ - "p50": Schema.optionalKey(Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null])), - "p75": Schema.optionalKey(Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null])), - "p90": Schema.optionalKey(Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null])), - "p99": Schema.optionalKey(Schema.Union([Schema.Number.check(Schema.isFinite()), Schema.Null])) - }) - ]), - Schema.Null - ]).annotate({ - "description": - "Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold." - }) - ) - }), - Schema.Null - ]).annotate({ - "description": "When multiple model providers are available, optionally indicate your routing preference." - }) + Schema.Struct({ + "type": Schema.Never, + "description": Schema.optionalKey(Schema.String), + "name": Schema.String, + "schema": Schema.Struct({}), + "strict": Schema.optionalKey(Schema.Boolean) + }).annotate({ "description": "JSON schema constrained response format" }), + Schema.Struct({ + "type": Schema.Never, + "description": Schema.optionalKey(Schema.String), + "name": Schema.String, + "schema": Schema.Struct({}), + "strict": Schema.optionalKey(Schema.Boolean) + }).annotate({ "description": "JSON schema constrained response format" }), + Schema.Struct({ + "description": Schema.optionalKey(Schema.String), + "name": Schema.String, + "schema": Schema.Struct({}), + "strict": Schema.optionalKey(Schema.Boolean), + "type": Schema.Literal("json_schema") + }).annotate({ "description": "JSON schema constrained response format" }) + ]).annotate({ "description": "Text response format configuration" }) + ]).annotate({ "description": "Text response format configuration" }) + ), + "verbosity": Schema.optionalKey( + Schema.Union([ + Schema.Union([Schema.Literal("high")]), + Schema.Union([Schema.Literal("low")]), + Schema.Union([Schema.Literal("medium")]), + Schema.Union([Schema.Union([Schema.Null])]) + ]) + ) + }).annotate({ "description": "Text output configuration including format and verbosity" }) ), - "plugins": Schema.optionalKey( - Schema.Array( + "tool_choice": OpenAIResponsesToolChoice, + "tools": Schema.Array( + Schema.Union([ + Schema.Struct({ + "description": Schema.optionalKey(Schema.String), + "name": Schema.String, + "parameters": Schema.Struct({}), + "strict": Schema.optionalKey(Schema.Boolean), + "type": Schema.Literal("function") + }).annotate({ "description": "Function tool definition" }), + Preview_WebSearchServerTool, + Preview_20250311_WebSearchServerTool, + Legacy_WebSearchServerTool, + WebSearchServerTool, + FileSearchServerTool, + ComputerUseServerTool, + CodeInterpreterServerTool, + McpServerTool, + ImageGenerationServerTool, + CodexLocalShellTool, + ShellServerTool, + ApplyPatchServerTool, + CustomTool + ], { mode: "oneOf" }) + ), + "top_logprobs": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "top_p": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "truncation": Schema.optionalKey(Truncation), + "usage": Schema.optionalKey( + Schema.Struct({ + "input_tokens": Schema.Number.check(Schema.isInt()), + "input_tokens_details": Schema.Struct({ "cached_tokens": Schema.Number.check(Schema.isInt()) }), + "output_tokens": Schema.Number.check(Schema.isInt()), + "output_tokens_details": Schema.Struct({ "reasoning_tokens": Schema.Number.check(Schema.isInt()) }), + "total_tokens": Schema.Number.check(Schema.isInt()), + "cost": Schema.optionalKey( + Schema.Number.annotate({ "description": "Cost of the completion", "format": "double" }).check(Schema.isFinite()) + ), + "cost_details": Schema.optionalKey(Schema.Struct({ + "upstream_inference_cost": Schema.optionalKey( + Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()) + ), + "upstream_inference_input_cost": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()), + "upstream_inference_output_cost": Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite()) + })), + "is_byok": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": "Whether a request was made using a Bring Your Own Key configuration" + }) + ) + }).annotate({ "description": "Token usage information for the response" }) + ), + "user": Schema.optionalKey(Schema.String), + "openrouter_metadata": Schema.optionalKey(OpenRouterMetadata) +}).annotate({ "description": "Complete non-streaming response from the Responses API" }) +export type StreamEventsResponseOutputItemAdded = { + readonly "item": OutputItems + readonly "output_index": number + readonly "sequence_number": number + readonly "type": "response.output_item.added" +} +export const StreamEventsResponseOutputItemAdded = Schema.Struct({ + "item": OutputItems, + "output_index": Schema.Number.check(Schema.isInt()), + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.output_item.added") +}).annotate({ "description": "Event emitted when a new output item is added to the response" }) +export type StreamEventsResponseOutputItemDone = { + readonly "item": OutputItems + readonly "output_index": number + readonly "sequence_number": number + readonly "type": "response.output_item.done" +} +export const StreamEventsResponseOutputItemDone = Schema.Struct({ + "item": OutputItems, + "output_index": Schema.Number.check(Schema.isInt()), + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.output_item.done") +}).annotate({ "description": "Event emitted when an output item is complete" }) +export type MessagesResult = { + readonly "container": AnthropicContainer + readonly "content": ReadonlyArray + readonly "id": string + readonly "model": string + readonly "role": "assistant" + readonly "stop_details": AnthropicRefusalStopDetails + readonly "stop_reason": ORAnthropicStopReason + readonly "stop_sequence": string + readonly "type": "message" + readonly "usage": { + readonly "cache_creation": { + readonly "ephemeral_1h_input_tokens": number + readonly "ephemeral_5m_input_tokens": number + } + readonly "cache_creation_input_tokens": number + readonly "cache_read_input_tokens": number + readonly "inference_geo": string + readonly "input_tokens": number + readonly "output_tokens": number + readonly "server_tool_use": { readonly "web_fetch_requests": number; readonly "web_search_requests": number } + readonly "service_tier": "standard" | "priority" | "batch" + readonly "iterations"?: ReadonlyArray< + { + readonly "cache_creation"?: { + readonly "ephemeral_1h_input_tokens"?: number + readonly "ephemeral_5m_input_tokens"?: number + } + readonly "cache_creation_input_tokens"?: number + readonly "cache_read_input_tokens"?: number + readonly "input_tokens"?: number + readonly "output_tokens"?: number + readonly "type": "compaction" + } | { + readonly "cache_creation"?: { + readonly "ephemeral_1h_input_tokens"?: number + readonly "ephemeral_5m_input_tokens"?: number + } + readonly "cache_creation_input_tokens"?: number + readonly "cache_read_input_tokens"?: number + readonly "input_tokens"?: number + readonly "output_tokens"?: number + readonly "type": never + } | { + readonly "cache_creation"?: { + readonly "ephemeral_1h_input_tokens"?: number + readonly "ephemeral_5m_input_tokens"?: number + } + readonly "cache_creation_input_tokens"?: number + readonly "cache_read_input_tokens"?: number + readonly "input_tokens"?: number + readonly "output_tokens"?: number + readonly "model": string + readonly "type": never + } | { + readonly "cache_creation"?: { + readonly "ephemeral_1h_input_tokens"?: number + readonly "ephemeral_5m_input_tokens"?: number + } + readonly "cache_creation_input_tokens"?: number + readonly "cache_read_input_tokens"?: number + readonly "input_tokens"?: number + readonly "output_tokens"?: number + readonly "type": "compaction" + } | { + readonly "cache_creation"?: { + readonly "ephemeral_1h_input_tokens"?: number + readonly "ephemeral_5m_input_tokens"?: number + } + readonly "cache_creation_input_tokens"?: number + readonly "cache_read_input_tokens"?: number + readonly "input_tokens"?: number + readonly "output_tokens"?: number + readonly "type": never + } | { + readonly "cache_creation"?: { + readonly "ephemeral_1h_input_tokens"?: number + readonly "ephemeral_5m_input_tokens"?: number + } + readonly "cache_creation_input_tokens"?: number + readonly "cache_read_input_tokens"?: number + readonly "input_tokens"?: number + readonly "output_tokens"?: number + readonly "type": "message" + } | { + readonly "cache_creation"?: { + readonly "ephemeral_1h_input_tokens"?: number + readonly "ephemeral_5m_input_tokens"?: number + } + readonly "cache_creation_input_tokens"?: number + readonly "cache_read_input_tokens"?: number + readonly "input_tokens"?: number + readonly "output_tokens"?: number + readonly "model": string + readonly "type": never + } | { + readonly "cache_creation"?: { + readonly "ephemeral_1h_input_tokens"?: number + readonly "ephemeral_5m_input_tokens"?: number + } + readonly "cache_creation_input_tokens"?: number + readonly "cache_read_input_tokens"?: number + readonly "input_tokens"?: number + readonly "output_tokens"?: number + readonly "type": "message" + } | { + readonly "cache_creation"?: { + readonly "ephemeral_1h_input_tokens"?: number + readonly "ephemeral_5m_input_tokens"?: number + } + readonly "cache_creation_input_tokens"?: number + readonly "cache_read_input_tokens"?: number + readonly "input_tokens"?: number + readonly "output_tokens"?: number + readonly "type": never + readonly "model": string + } | { + readonly "cache_creation"?: { + readonly "ephemeral_1h_input_tokens"?: number + readonly "ephemeral_5m_input_tokens"?: number + } + readonly "cache_creation_input_tokens"?: number + readonly "cache_read_input_tokens"?: number + readonly "input_tokens"?: number + readonly "output_tokens"?: number + readonly "type": never + readonly "model": string + } | { + readonly "cache_creation"?: { + readonly "ephemeral_1h_input_tokens"?: number + readonly "ephemeral_5m_input_tokens"?: number + } + readonly "cache_creation_input_tokens"?: number + readonly "cache_read_input_tokens"?: number + readonly "input_tokens"?: number + readonly "output_tokens"?: number + readonly "model": string + readonly "type": "advisor_message" + } | { + readonly "cache_creation"?: { + readonly "ephemeral_1h_input_tokens"?: number + readonly "ephemeral_5m_input_tokens"?: number + } + readonly "cache_creation_input_tokens"?: number + readonly "cache_read_input_tokens"?: number + readonly "input_tokens"?: number + readonly "output_tokens"?: number + readonly "type": "advisor_message" + readonly "model": string + } | { + readonly "cache_creation"?: { + readonly "ephemeral_1h_input_tokens"?: number + readonly "ephemeral_5m_input_tokens"?: number + } + readonly "cache_creation_input_tokens"?: number + readonly "cache_read_input_tokens"?: number + readonly "input_tokens"?: number + readonly "output_tokens"?: number + readonly "type": "compaction" + } | { + readonly "cache_creation"?: { + readonly "ephemeral_1h_input_tokens"?: number + readonly "ephemeral_5m_input_tokens"?: number + } + readonly "cache_creation_input_tokens"?: number + readonly "cache_read_input_tokens"?: number + readonly "input_tokens"?: number + readonly "output_tokens"?: number + readonly "type": "message" + } | { + readonly "cache_creation"?: { + readonly "ephemeral_1h_input_tokens"?: number + readonly "ephemeral_5m_input_tokens"?: number + } + readonly "cache_creation_input_tokens"?: number + readonly "cache_read_input_tokens"?: number + readonly "input_tokens"?: number + readonly "output_tokens"?: number + readonly "model": string + readonly "type": "advisor_message" + } | { + readonly "cache_creation"?: { + readonly "ephemeral_1h_input_tokens"?: number + readonly "ephemeral_5m_input_tokens"?: number + } + readonly "cache_creation_input_tokens"?: number + readonly "cache_read_input_tokens"?: number + readonly "input_tokens"?: number + readonly "output_tokens"?: number + readonly "type": string + } + > + readonly "speed"?: "fast" | "standard" | null + readonly "cost"?: number + readonly "cost_details"?: CostDetails + readonly "is_byok"?: boolean + } + readonly "context_management"?: { readonly "applied_edits": ReadonlyArray<{ readonly "type": string }> } + readonly "openrouter_metadata"?: OpenRouterMetadata + readonly "provider"?: ProviderName +} +export const MessagesResult = Schema.Struct({ + "container": AnthropicContainer, + "content": Schema.Array(ORAnthropicContentBlock), + "id": Schema.String, + "model": Schema.String, + "role": Schema.Literal("assistant"), + "stop_details": AnthropicRefusalStopDetails, + "stop_reason": ORAnthropicStopReason, + "stop_sequence": Schema.String, + "type": Schema.Literal("message"), + "usage": Schema.Struct({ + "cache_creation": Schema.Struct({ + "ephemeral_1h_input_tokens": Schema.Number.check(Schema.isInt()), + "ephemeral_5m_input_tokens": Schema.Number.check(Schema.isInt()) + }), + "cache_creation_input_tokens": Schema.Number.check(Schema.isInt()), + "cache_read_input_tokens": Schema.Number.check(Schema.isInt()), + "inference_geo": Schema.String, + "input_tokens": Schema.Number.check(Schema.isInt()), + "output_tokens": Schema.Number.check(Schema.isInt()), + "server_tool_use": Schema.Struct({ + "web_fetch_requests": Schema.Number.check(Schema.isInt()), + "web_search_requests": Schema.Number.check(Schema.isInt()) + }), + "service_tier": Schema.Union([Schema.Literal("standard"), Schema.Literal("priority"), Schema.Literal("batch")]), + "iterations": Schema.optionalKey(Schema.Array(Schema.Union([ Schema.Union([ Schema.Struct({ - "id": Schema.Literal("auto-router"), - "enabled": Schema.optionalKey(Schema.Boolean), - "allowed_models": Schema.optionalKey(Schema.Array(Schema.String)) + "cache_creation": Schema.optionalKey( + Schema.Struct({ + "ephemeral_1h_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "ephemeral_5m_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())) + }) + ), + "cache_creation_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "cache_read_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "type": Schema.Literal("compaction") + }), + Schema.Struct({ + "cache_creation": Schema.optionalKey( + Schema.Struct({ + "ephemeral_1h_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "ephemeral_5m_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())) + }) + ), + "cache_creation_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "cache_read_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "type": Schema.Never + }), + Schema.Struct({ + "cache_creation": Schema.optionalKey( + Schema.Struct({ + "ephemeral_1h_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "ephemeral_5m_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())) + }) + ), + "cache_creation_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "cache_read_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "model": Schema.String, + "type": Schema.Never + }), + Schema.Struct({ + "cache_creation": Schema.optionalKey( + Schema.Struct({ + "ephemeral_1h_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "ephemeral_5m_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())) + }) + ), + "cache_creation_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "cache_read_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "type": Schema.Literal("compaction") + }) + ]), + Schema.Union([ + Schema.Struct({ + "cache_creation": Schema.optionalKey( + Schema.Struct({ + "ephemeral_1h_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "ephemeral_5m_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())) + }) + ), + "cache_creation_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "cache_read_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "type": Schema.Never + }), + Schema.Struct({ + "cache_creation": Schema.optionalKey( + Schema.Struct({ + "ephemeral_1h_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "ephemeral_5m_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())) + }) + ), + "cache_creation_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "cache_read_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "type": Schema.Literal("message") + }), + Schema.Struct({ + "cache_creation": Schema.optionalKey( + Schema.Struct({ + "ephemeral_1h_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "ephemeral_5m_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())) + }) + ), + "cache_creation_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "cache_read_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "model": Schema.String, + "type": Schema.Never + }), + Schema.Struct({ + "cache_creation": Schema.optionalKey( + Schema.Struct({ + "ephemeral_1h_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "ephemeral_5m_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())) + }) + ), + "cache_creation_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "cache_read_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "type": Schema.Literal("message") + }) + ]), + Schema.Union([ + Schema.Struct({ + "cache_creation": Schema.optionalKey( + Schema.Struct({ + "ephemeral_1h_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "ephemeral_5m_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())) + }) + ), + "cache_creation_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "cache_read_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "type": Schema.Never, + "model": Schema.String + }), + Schema.Struct({ + "cache_creation": Schema.optionalKey( + Schema.Struct({ + "ephemeral_1h_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "ephemeral_5m_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())) + }) + ), + "cache_creation_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "cache_read_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "type": Schema.Never, + "model": Schema.String + }), + Schema.Struct({ + "cache_creation": Schema.optionalKey( + Schema.Struct({ + "ephemeral_1h_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "ephemeral_5m_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())) + }) + ), + "cache_creation_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "cache_read_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "model": Schema.String, + "type": Schema.Literal("advisor_message") + }), + Schema.Struct({ + "cache_creation": Schema.optionalKey( + Schema.Struct({ + "ephemeral_1h_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "ephemeral_5m_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())) + }) + ), + "cache_creation_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "cache_read_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "type": Schema.Literal("advisor_message"), + "model": Schema.String + }) + ]), + Schema.Union([ + Schema.Struct({ + "cache_creation": Schema.optionalKey( + Schema.Struct({ + "ephemeral_1h_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "ephemeral_5m_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())) + }) + ), + "cache_creation_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "cache_read_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "type": Schema.Literal("compaction") }), - Schema.Struct({ "id": Schema.Literal("moderation") }), Schema.Struct({ - "id": Schema.Literal("web"), - "enabled": Schema.optionalKey(Schema.Boolean), - "max_results": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "search_prompt": Schema.optionalKey(Schema.String), - "engine": Schema.optionalKey(Schema.Literals(["native", "exa"])) + "cache_creation": Schema.optionalKey( + Schema.Struct({ + "ephemeral_1h_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "ephemeral_5m_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())) + }) + ), + "cache_creation_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "cache_read_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "type": Schema.Literal("message") }), Schema.Struct({ - "id": Schema.Literal("file-parser"), - "enabled": Schema.optionalKey(Schema.Boolean), - "pdf": Schema.optionalKey( - Schema.Struct({ "engine": Schema.optionalKey(Schema.Literals(["mistral-ocr", "pdf-text", "native"])) }) - ) + "cache_creation": Schema.optionalKey( + Schema.Struct({ + "ephemeral_1h_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "ephemeral_5m_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())) + }) + ), + "cache_creation_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "cache_read_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "model": Schema.String, + "type": Schema.Literal("advisor_message") }), - Schema.Struct({ "id": Schema.Literal("response-healing"), "enabled": Schema.optionalKey(Schema.Boolean) }) - ], { mode: "oneOf" }) - ).annotate({ "description": "Plugins you want to enable for this request, including their settings." }) - ), - "route": Schema.optionalKey(Schema.Union([Schema.Literals(["fallback", "sort"]), Schema.Null])), - "user": Schema.optionalKey(Schema.String), - "session_id": Schema.optionalKey( - Schema.String.annotate({ - "description": - "A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters." - }).check(Schema.isMaxLength(128)) + Schema.Struct({ + "cache_creation": Schema.optionalKey( + Schema.Struct({ + "ephemeral_1h_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "ephemeral_5m_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())) + }) + ), + "cache_creation_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "cache_read_input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "input_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "output_tokens": Schema.optionalKey(Schema.Number.check(Schema.isInt())), + "type": Schema.String + }) + ]) + ]))), + "speed": Schema.optionalKey( + Schema.Union([Schema.Literal("fast"), Schema.Literal("standard"), Schema.Union([Schema.Null])]) + ), + "cost": Schema.optionalKey(Schema.Number.annotate({ "format": "double" }).check(Schema.isFinite())), + "cost_details": Schema.optionalKey(CostDetails), + "is_byok": Schema.optionalKey(Schema.Boolean) + }), + "context_management": Schema.optionalKey( + Schema.Struct({ "applied_edits": Schema.Array(Schema.Struct({ "type": Schema.String })) }) ), - "trace": Schema.optionalKey( - Schema.Struct({ - "trace_id": Schema.optionalKey(Schema.String), - "trace_name": Schema.optionalKey(Schema.String), - "span_name": Schema.optionalKey(Schema.String), - "generation_name": Schema.optionalKey(Schema.String), - "parent_span_id": Schema.optionalKey(Schema.String) - }).annotate({ - "description": - "Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations." + "openrouter_metadata": Schema.optionalKey(OpenRouterMetadata), + "provider": Schema.optionalKey(ProviderName) +}).annotate({ "description": "Base Anthropic Messages API response before OpenRouter extensions" }) +export type MessagesStartEvent = { + readonly "message": { + readonly "container": AnthropicContainer + readonly "content": ReadonlyArray + readonly "id": string + readonly "model": string + readonly "provider"?: + | "AnyScale" + | "Atoma" + | "Cent-ML" + | "CrofAI" + | "Enfer" + | "GoPomelo" + | "HuggingFace" + | "Hyperbolic 2" + | "InoCloud" + | "Kluster" + | "Lambda" + | "Lepton" + | "Lynn 2" + | "Lynn" + | "Mancer" + | "Meta" + | "Modal" + | "Nineteen" + | "OctoAI" + | "Recursal" + | "Reflection" + | "Replicate" + | "SambaNova 2" + | "SF Compute" + | "Targon" + | "Together 2" + | "Ubicloud" + | "01.AI" + | "AkashML" + | "AI21" + | "AionLabs" + | "Alibaba" + | "Ambient" + | "Baidu" + | "Amazon Bedrock" + | "Amazon Nova" + | "Anthropic" + | "Arcee AI" + | "AtlasCloud" + | "Avian" + | "Azure" + | "BaseTen" + | "BytePlus" + | "Black Forest Labs" + | "Cerebras" + | "Chutes" + | "Cirrascale" + | "Clarifai" + | "Cloudflare" + | "Cohere" + | "Crucible" + | "Crusoe" + | "DeepInfra" + | "DeepSeek" + | "DekaLLM" + | "DigitalOcean" + | "Featherless" + | "Fireworks" + | "Friendli" + | "GMICloud" + | "Google" + | "Google AI Studio" + | "Groq" + | "Hyperbolic" + | "Inception" + | "Inceptron" + | "InferenceNet" + | "Ionstream" + | "Infermatic" + | "Io Net" + | "Inflection" + | "Liquid" + | "Mara" + | "Mancer 2" + | "Minimax" + | "ModelRun" + | "Mistral" + | "Modular" + | "Moonshot AI" + | "Morph" + | "NCompass" + | "Nebius" + | "Nex AGI" + | "NextBit" + | "Novita" + | "Nvidia" + | "OpenAI" + | "OpenInference" + | "Parasail" + | "Poolside" + | "Perceptron" + | "Perplexity" + | "Phala" + | "Recraft" + | "Reka" + | "Relace" + | "SambaNova" + | "Seed" + | "SiliconFlow" + | "Sourceful" + | "StepFun" + | "Stealth" + | "StreamLake" + | "Switchpoint" + | "Together" + | "Upstage" + | "Venice" + | "WandB" + | "Xiaomi" + | "xAI" + | "Z.AI" + | "FakeProvider" + readonly "role": "assistant" + readonly "stop_details": AnthropicRefusalStopDetails + readonly "stop_reason": unknown + readonly "stop_sequence": unknown + readonly "type": "message" + readonly "usage": { + readonly "cache_creation": AnthropicCacheCreation + readonly "cache_creation_input_tokens": number + readonly "cache_read_input_tokens": number + readonly "inference_geo": string + readonly "input_tokens": number + readonly "output_tokens": number + readonly "server_tool_use": AnthropicServerToolUsage + readonly "service_tier": AnthropicServiceTier + readonly "iterations"?: ReadonlyArray + readonly "speed"?: AnthropicSpeed + } + } + readonly "type": "message_start" +} +export const MessagesStartEvent = Schema.Struct({ + "message": Schema.Struct({ + "container": AnthropicContainer, + "content": Schema.Array(ORAnthropicContentBlock), + "id": Schema.String, + "model": Schema.String, + "provider": Schema.optionalKey( + Schema.Literals([ + "AnyScale", + "Atoma", + "Cent-ML", + "CrofAI", + "Enfer", + "GoPomelo", + "HuggingFace", + "Hyperbolic 2", + "InoCloud", + "Kluster", + "Lambda", + "Lepton", + "Lynn 2", + "Lynn", + "Mancer", + "Meta", + "Modal", + "Nineteen", + "OctoAI", + "Recursal", + "Reflection", + "Replicate", + "SambaNova 2", + "SF Compute", + "Targon", + "Together 2", + "Ubicloud", + "01.AI", + "AkashML", + "AI21", + "AionLabs", + "Alibaba", + "Ambient", + "Baidu", + "Amazon Bedrock", + "Amazon Nova", + "Anthropic", + "Arcee AI", + "AtlasCloud", + "Avian", + "Azure", + "BaseTen", + "BytePlus", + "Black Forest Labs", + "Cerebras", + "Chutes", + "Cirrascale", + "Clarifai", + "Cloudflare", + "Cohere", + "Crucible", + "Crusoe", + "DeepInfra", + "DeepSeek", + "DekaLLM", + "DigitalOcean", + "Featherless", + "Fireworks", + "Friendli", + "GMICloud", + "Google", + "Google AI Studio", + "Groq", + "Hyperbolic", + "Inception", + "Inceptron", + "InferenceNet", + "Ionstream", + "Infermatic", + "Io Net", + "Inflection", + "Liquid", + "Mara", + "Mancer 2", + "Minimax", + "ModelRun", + "Mistral", + "Modular", + "Moonshot AI", + "Morph", + "NCompass", + "Nebius", + "Nex AGI", + "NextBit", + "Novita", + "Nvidia", + "OpenAI", + "OpenInference", + "Parasail", + "Poolside", + "Perceptron", + "Perplexity", + "Phala", + "Recraft", + "Reka", + "Relace", + "SambaNova", + "Seed", + "SiliconFlow", + "Sourceful", + "StepFun", + "Stealth", + "StreamLake", + "Switchpoint", + "Together", + "Upstage", + "Venice", + "WandB", + "Xiaomi", + "xAI", + "Z.AI", + "FakeProvider" + ]) + ), + "role": Schema.Literal("assistant"), + "stop_details": AnthropicRefusalStopDetails, + "stop_reason": Schema.Unknown, + "stop_sequence": Schema.Unknown, + "type": Schema.Literal("message"), + "usage": Schema.Struct({ + "cache_creation": AnthropicCacheCreation, + "cache_creation_input_tokens": Schema.Number.check(Schema.isInt()), + "cache_read_input_tokens": Schema.Number.check(Schema.isInt()), + "inference_geo": Schema.String, + "input_tokens": Schema.Number.check(Schema.isInt()), + "output_tokens": Schema.Number.check(Schema.isInt()), + "server_tool_use": AnthropicServerToolUsage, + "service_tier": AnthropicServiceTier, + "iterations": Schema.optionalKey(Schema.Array(AnthropicUsageIteration)), + "speed": Schema.optionalKey(AnthropicSpeed) }) + }), + "type": Schema.Literal("message_start") +}).annotate({ "description": "Event sent at the start of a streaming message" }) +export type ChatResult = { + readonly "choices": ReadonlyArray + readonly "created": number + readonly "id": string + readonly "model": string + readonly "object": "chat.completion" + readonly "openrouter_metadata"?: OpenRouterMetadata + readonly "service_tier"?: string + readonly "system_fingerprint": string + readonly "usage"?: ChatUsage +} +export const ChatResult = Schema.Struct({ + "choices": Schema.Array(ChatChoice).annotate({ "description": "List of completion choices" }), + "created": Schema.Number.annotate({ "description": "Unix timestamp of creation" }).check(Schema.isInt()), + "id": Schema.String.annotate({ "description": "Unique completion identifier" }), + "model": Schema.String.annotate({ "description": "Model used for completion" }), + "object": Schema.Literal("chat.completion"), + "openrouter_metadata": Schema.optionalKey(OpenRouterMetadata), + "service_tier": Schema.optionalKey( + Schema.String.annotate({ "description": "The service tier used by the upstream provider for this request" }) ), - "messages": Schema.Array(Message).check(Schema.isMinLength(1)), - "model": Schema.optionalKey(ModelName), - "models": Schema.optionalKey(Schema.Array(ModelName)), + "system_fingerprint": Schema.String.annotate({ "description": "System fingerprint" }), + "usage": Schema.optionalKey(ChatUsage) +}).annotate({ "description": "Chat completion response" }) +export type ChatRequest = { + readonly "cache_control"?: AnthropicCacheControlDirective + readonly "debug"?: ChatDebugOptions + readonly "frequency_penalty"?: number + readonly "image_config"?: ImageConfig + readonly "logit_bias"?: {} + readonly "logprobs"?: boolean + readonly "max_completion_tokens"?: number + readonly "max_tokens"?: number + readonly "messages": ReadonlyArray + readonly "metadata"?: {} + readonly "modalities"?: ReadonlyArray<"text" | "image" | "audio"> + readonly "model"?: ModelName + readonly "models"?: ChatModelNames + readonly "parallel_tool_calls"?: boolean + readonly "plugins"?: ReadonlyArray< + | AutoRouterPlugin + | ModerationPlugin + | WebSearchPlugin + | WebFetchPlugin + | FileParserPlugin + | ResponseHealingPlugin + | ContextCompressionPlugin + | ParetoRouterPlugin + | FusionPlugin + > + readonly "presence_penalty"?: number + readonly "provider"?: ProviderPreferences + readonly "reasoning"?: { + readonly "effort"?: "xhigh" | "high" | "medium" | "low" | "minimal" | "none" | null + readonly "summary"?: ChatReasoningSummaryVerbosityEnum + } + readonly "response_format"?: + | ChatFormatTextConfig + | FormatJsonObjectConfig + | ChatFormatJsonSchemaConfig + | ChatFormatGrammarConfig + | ChatFormatPythonConfig + readonly "route"?: DeprecatedRoute + readonly "seed"?: number + readonly "service_tier"?: "auto" | "default" | "flex" | "priority" | "scale" | null + readonly "session_id"?: string + readonly "stop"?: string | ReadonlyArray | unknown + readonly "stop_server_tools_when"?: StopServerToolsWhen + readonly "stream"?: boolean + readonly "stream_options"?: ChatStreamOptions + readonly "temperature"?: number + readonly "tool_choice"?: ChatToolChoice + readonly "tools"?: ReadonlyArray + readonly "top_logprobs"?: number + readonly "top_p"?: number + readonly "trace"?: TraceConfig + readonly "user"?: string +} +export const ChatRequest = Schema.Struct({ + "cache_control": Schema.optionalKey(AnthropicCacheControlDirective), + "debug": Schema.optionalKey(ChatDebugOptions), "frequency_penalty": Schema.optionalKey( - Schema.Union([ - Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(-2)).check( - Schema.isLessThanOrEqualTo(2) - ), - Schema.Null - ]) - ), - "logit_bias": Schema.optionalKey( - Schema.Union([Schema.Struct({}).check(Schema.isPropertyNames(Schema.String)), Schema.Null]) - ), - "logprobs": Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - "top_logprobs": Schema.optionalKey( - Schema.Union([ - Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check( - Schema.isLessThanOrEqualTo(20) - ), - Schema.Null - ]) + Schema.Number.annotate({ "description": "Frequency penalty (-2.0 to 2.0)", "format": "double" }).check( + Schema.isFinite() + ) ), + "image_config": Schema.optionalKey(ImageConfig), + "logit_bias": Schema.optionalKey(Schema.Struct({}).annotate({ "description": "Token logit bias adjustments" })), + "logprobs": Schema.optionalKey(Schema.Boolean.annotate({ "description": "Return log probabilities" })), "max_completion_tokens": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(1)), Schema.Null]) + Schema.Number.annotate({ "description": "Maximum tokens in completion" }).check(Schema.isInt()) ), "max_tokens": Schema.optionalKey( - Schema.Union([Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(1)), Schema.Null]) + Schema.Number.annotate({ + "description": + "Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16." + }).check(Schema.isInt()) + ), + "messages": Schema.Array(ChatMessages).annotate({ "description": "List of messages for the conversation" }).check( + Schema.isMinLength(1) + ), + "metadata": Schema.optionalKey( + Schema.Struct({}).annotate({ + "description": "Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)" + }) + ), + "modalities": Schema.optionalKey( + Schema.Array(Schema.Literals(["text", "image", "audio"])).annotate({ + "description": "Output modalities for the response. Supported values are \"text\", \"image\", and \"audio\"." + }) + ), + "model": Schema.optionalKey(ModelName), + "models": Schema.optionalKey(ChatModelNames), + "parallel_tool_calls": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response." + }) + ), + "plugins": Schema.optionalKey( + Schema.Array( + Schema.Union([ + AutoRouterPlugin, + ModerationPlugin, + WebSearchPlugin, + WebFetchPlugin, + FileParserPlugin, + ResponseHealingPlugin, + ContextCompressionPlugin, + ParetoRouterPlugin, + FusionPlugin + ], { mode: "oneOf" }) + ).annotate({ "description": "Plugins you want to enable for this request, including their settings." }) ), - "metadata": Schema.optionalKey(Schema.Struct({}).check(Schema.isPropertyNames(Schema.String))), "presence_penalty": Schema.optionalKey( - Schema.Union([ - Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(-2)).check( - Schema.isLessThanOrEqualTo(2) - ), - Schema.Null - ]) + Schema.Number.annotate({ "description": "Presence penalty (-2.0 to 2.0)", "format": "double" }).check( + Schema.isFinite() + ) ), + "provider": Schema.optionalKey(ProviderPreferences), "reasoning": Schema.optionalKey( Schema.Struct({ "effort": Schema.optionalKey( - Schema.Union([Schema.Literals(["xhigh", "high", "medium", "low", "minimal", "none"]), Schema.Null]) + Schema.Union([ + Schema.Literal("xhigh"), + Schema.Literal("high"), + Schema.Literal("medium"), + Schema.Literal("low"), + Schema.Literal("minimal"), + Schema.Literal("none"), + Schema.Null + ]).annotate({ "description": "Constrains effort on reasoning for reasoning models" }) ), - "summary": Schema.optionalKey(Schema.Union([ReasoningSummaryVerbosity, Schema.Null])) - }) + "summary": Schema.optionalKey(ChatReasoningSummaryVerbosityEnum) + }).annotate({ "description": "Configuration options for reasoning models" }) ), "response_format": Schema.optionalKey( Schema.Union([ - Schema.Struct({ "type": Schema.Literal("text") }), - Schema.Struct({ "type": Schema.Literal("json_object") }), - ResponseFormatJSONSchema, - ResponseFormatTextGrammar, - Schema.Struct({ "type": Schema.Literal("python") }) - ], { mode: "oneOf" }) + ChatFormatTextConfig, + FormatJsonObjectConfig, + ChatFormatJsonSchemaConfig, + ChatFormatGrammarConfig, + ChatFormatPythonConfig + ], { mode: "oneOf" }).annotate({ "description": "Response format configuration" }) ), + "route": Schema.optionalKey(DeprecatedRoute), "seed": Schema.optionalKey( + Schema.Number.annotate({ "description": "Random seed for deterministic outputs" }).check(Schema.isInt()) + ), + "service_tier": Schema.optionalKey( Schema.Union([ - Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(-9007199254740991)).check( - Schema.isLessThanOrEqualTo(9007199254740991) - ), + Schema.Literal("auto"), + Schema.Literal("default"), + Schema.Literal("flex"), + Schema.Literal("priority"), + Schema.Literal("scale"), Schema.Null - ]) + ]).annotate({ "description": "The service tier to use for processing this request." }) + ), + "session_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters." + }).check(Schema.isMaxLength(256)) ), "stop": Schema.optionalKey( - Schema.Union([Schema.Union([Schema.String, Schema.Array(ModelName).check(Schema.isMaxLength(4))]), Schema.Null]) + Schema.Union([Schema.String, Schema.Array(Schema.String).check(Schema.isMaxLength(4)), Schema.Unknown]).annotate({ + "description": "Stop sequences (up to 4)" + }) ), - "stream": Schema.optionalKey(Schema.Boolean), - "stream_options": Schema.optionalKey(Schema.Union([ChatStreamOptions, Schema.Null])), + "stop_server_tools_when": Schema.optionalKey(StopServerToolsWhen), + "stream": Schema.optionalKey(Schema.Boolean.annotate({ "description": "Enable streaming response" })), + "stream_options": Schema.optionalKey(ChatStreamOptions), "temperature": Schema.optionalKey( - Schema.Union([ - Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check( - Schema.isLessThanOrEqualTo(2) - ), - Schema.Null - ]) + Schema.Number.annotate({ "description": "Sampling temperature (0-2)", "format": "double" }).check(Schema.isFinite()) + ), + "tool_choice": Schema.optionalKey(ChatToolChoice), + "tools": Schema.optionalKey( + Schema.Array(ChatFunctionTool).annotate({ "description": "Available tools for function calling" }) + ), + "top_logprobs": Schema.optionalKey( + Schema.Number.annotate({ "description": "Number of top log probabilities to return (0-20)" }).check(Schema.isInt()) + ), + "top_p": Schema.optionalKey( + Schema.Number.annotate({ "description": "Nucleus sampling parameter (0-1)", "format": "double" }).check( + Schema.isFinite() + ) + ), + "trace": Schema.optionalKey(TraceConfig), + "user": Schema.optionalKey(Schema.String.annotate({ "description": "Unique user identifier" })) +}).annotate({ "description": "Chat completion request parameters" }) +export type ChatStreamChunk = { + readonly "choices": ReadonlyArray + readonly "created": number + readonly "error"?: { readonly "code": number; readonly "message": string } + readonly "id": string + readonly "model": string + readonly "object": "chat.completion.chunk" + readonly "openrouter_metadata"?: OpenRouterMetadata + readonly "service_tier"?: string + readonly "system_fingerprint"?: string + readonly "usage"?: ChatUsage +} +export const ChatStreamChunk = Schema.Struct({ + "choices": Schema.Array(ChatStreamChoice).annotate({ "description": "List of streaming chunk choices" }), + "created": Schema.Number.annotate({ "description": "Unix timestamp of creation" }).check(Schema.isInt()), + "error": Schema.optionalKey( + Schema.Struct({ + "code": Schema.Number.annotate({ "description": "Error code", "format": "int32" }).check(Schema.isInt()), + "message": Schema.String.annotate({ "description": "Error message" }) + }).annotate({ "description": "Error information" }) + ), + "id": Schema.String.annotate({ "description": "Unique chunk identifier" }), + "model": Schema.String.annotate({ "description": "Model used for completion" }), + "object": Schema.Literal("chat.completion.chunk"), + "openrouter_metadata": Schema.optionalKey(OpenRouterMetadata), + "service_tier": Schema.optionalKey( + Schema.String.annotate({ "description": "The service tier used by the upstream provider for this request" }) + ), + "system_fingerprint": Schema.optionalKey(Schema.String.annotate({ "description": "System fingerprint" })), + "usage": Schema.optionalKey(ChatUsage) +}).annotate({ "description": "Streaming chat completion chunk" }) +export type OpenResponsesCreatedEvent = { + readonly "response": OpenResponsesResult + readonly "sequence_number": number + readonly "type": "response.created" +} +export const OpenResponsesCreatedEvent = Schema.Struct({ + "response": OpenResponsesResult, + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.created") +}).annotate({ "description": "Event emitted when a response is created" }) +export type OpenResponsesInProgressEvent = { + readonly "response": OpenResponsesResult + readonly "sequence_number": number + readonly "type": "response.in_progress" +} +export const OpenResponsesInProgressEvent = Schema.Struct({ + "response": OpenResponsesResult, + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.in_progress") +}).annotate({ "description": "Event emitted when a response is in progress" }) +export type StreamEventsResponseCompleted = { + readonly "response": OpenResponsesResult + readonly "sequence_number": number + readonly "type": "response.completed" +} +export const StreamEventsResponseCompleted = Schema.Struct({ + "response": OpenResponsesResult, + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.completed") +}).annotate({ "description": "Event emitted when a response has completed successfully" }) +export type StreamEventsResponseFailed = { + readonly "response": OpenResponsesResult + readonly "sequence_number": number + readonly "type": "response.failed" +} +export const StreamEventsResponseFailed = Schema.Struct({ + "response": OpenResponsesResult, + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.failed") +}).annotate({ "description": "Event emitted when a response has failed" }) +export type StreamEventsResponseIncomplete = { + readonly "response": OpenResponsesResult + readonly "sequence_number": number + readonly "type": "response.incomplete" +} +export const StreamEventsResponseIncomplete = Schema.Struct({ + "response": OpenResponsesResult, + "sequence_number": Schema.Number.check(Schema.isInt()), + "type": Schema.Literal("response.incomplete") +}).annotate({ "description": "Event emitted when a response is incomplete" }) +export type MessagesStreamEvents = + | MessagesStartEvent + | MessagesDeltaEvent + | MessagesStopEvent + | MessagesContentBlockStartEvent + | MessagesContentBlockDeltaEvent + | MessagesContentBlockStopEvent + | MessagesPingEvent + | MessagesErrorEvent +export const MessagesStreamEvents = Schema.Union([ + MessagesStartEvent, + MessagesDeltaEvent, + MessagesStopEvent, + MessagesContentBlockStartEvent, + MessagesContentBlockDeltaEvent, + MessagesContentBlockStopEvent, + MessagesPingEvent, + MessagesErrorEvent +], { mode: "oneOf" }).annotate({ "description": "Union of all possible streaming events" }) +export type ChatStreamingResponse = { readonly "data": ChatStreamChunk } +export const ChatStreamingResponse = Schema.Struct({ "data": ChatStreamChunk }) +export type StreamEvents = + | OpenResponsesCreatedEvent + | OpenResponsesInProgressEvent + | StreamEventsResponseCompleted + | StreamEventsResponseIncomplete + | StreamEventsResponseFailed + | ErrorEvent + | StreamEventsResponseOutputItemAdded + | StreamEventsResponseOutputItemDone + | ContentPartAddedEvent + | ContentPartDoneEvent + | TextDeltaEvent + | TextDoneEvent + | RefusalDeltaEvent + | RefusalDoneEvent + | AnnotationAddedEvent + | FunctionCallArgsDeltaEvent + | FunctionCallArgsDoneEvent + | ReasoningDeltaEvent + | ReasoningDoneEvent + | ReasoningSummaryPartAddedEvent + | ReasoningSummaryPartDoneEvent + | ReasoningSummaryTextDeltaEvent + | ReasoningSummaryTextDoneEvent + | ImageGenCallInProgressEvent + | ImageGenCallGeneratingEvent + | ImageGenCallPartialImageEvent + | ImageGenCallCompletedEvent + | WebSearchCallInProgressEvent + | WebSearchCallSearchingEvent + | WebSearchCallCompletedEvent + | CustomToolCallInputDeltaEvent + | CustomToolCallInputDoneEvent + | ApplyPatchCallOperationDiffDeltaEvent + | ApplyPatchCallOperationDiffDoneEvent +export const StreamEvents: Schema.Schema = Schema.Union([ + OpenResponsesCreatedEvent, + OpenResponsesInProgressEvent, + StreamEventsResponseCompleted, + StreamEventsResponseIncomplete, + StreamEventsResponseFailed, + ErrorEvent, + StreamEventsResponseOutputItemAdded, + StreamEventsResponseOutputItemDone, + ContentPartAddedEvent, + ContentPartDoneEvent, + TextDeltaEvent, + TextDoneEvent, + RefusalDeltaEvent, + RefusalDoneEvent, + AnnotationAddedEvent, + FunctionCallArgsDeltaEvent, + FunctionCallArgsDoneEvent, + ReasoningDeltaEvent, + ReasoningDoneEvent, + ReasoningSummaryPartAddedEvent, + ReasoningSummaryPartDoneEvent, + ReasoningSummaryTextDeltaEvent, + ReasoningSummaryTextDoneEvent, + ImageGenCallInProgressEvent, + ImageGenCallGeneratingEvent, + ImageGenCallPartialImageEvent, + ImageGenCallCompletedEvent, + WebSearchCallInProgressEvent, + WebSearchCallSearchingEvent, + WebSearchCallCompletedEvent, + CustomToolCallInputDeltaEvent, + CustomToolCallInputDoneEvent, + ApplyPatchCallOperationDiffDeltaEvent, + ApplyPatchCallOperationDiffDoneEvent +], { mode: "oneOf" }).annotate({ "description": "Union of all possible event types emitted during response streaming" }) +export type MessagesStreamingResponse = { readonly "data": MessagesStreamEvents; readonly "event": string } +export const MessagesStreamingResponse = Schema.Struct({ "data": MessagesStreamEvents, "event": Schema.String }) +export type ResponsesStreamingResponse = { readonly "data": StreamEvents } +export const ResponsesStreamingResponse: Schema.Schema = Schema.Struct({ + "data": StreamEvents +}) +// schemas +export type GetUserActivityParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string + readonly "date"?: string + readonly "api_key_hash"?: string + readonly "user_id"?: string +} +export const GetUserActivityParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String), + "date": Schema.optionalKey( + Schema.String.annotate({ "description": "Filter by a single UTC date in the last 30 days (YYYY-MM-DD format)." }) + ), + "api_key_hash": Schema.optionalKey( + Schema.String.annotate({ + "description": "Filter by API key hash (SHA-256 hex string, as returned by the keys API)." + }) + ), + "user_id": Schema.optionalKey( + Schema.String.annotate({ + "description": "Filter by org member user ID. Only applicable for organization accounts." + }) + ) +}) +export type GetUserActivity200 = ActivityResponse +export const GetUserActivity200 = ActivityResponse +export type GetUserActivity400 = BadRequestResponse +export const GetUserActivity400 = BadRequestResponse +export type GetUserActivity401 = UnauthorizedResponse +export const GetUserActivity401 = UnauthorizedResponse +export type GetUserActivity403 = ForbiddenResponse +export const GetUserActivity403 = ForbiddenResponse +export type GetUserActivity404 = NotFoundResponse +export const GetUserActivity404 = NotFoundResponse +export type GetUserActivity500 = InternalServerResponse +export const GetUserActivity500 = InternalServerResponse +export type CreateAudioSpeechParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const CreateAudioSpeechParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) +export type CreateAudioSpeechRequestJson = SpeechRequest +export const CreateAudioSpeechRequestJson = SpeechRequest +export type CreateAudioSpeech400 = BadRequestResponse +export const CreateAudioSpeech400 = BadRequestResponse +export type CreateAudioSpeech401 = UnauthorizedResponse +export const CreateAudioSpeech401 = UnauthorizedResponse +export type CreateAudioSpeech402 = PaymentRequiredResponse +export const CreateAudioSpeech402 = PaymentRequiredResponse +export type CreateAudioSpeech404 = NotFoundResponse +export const CreateAudioSpeech404 = NotFoundResponse +export type CreateAudioSpeech429 = TooManyRequestsResponse +export const CreateAudioSpeech429 = TooManyRequestsResponse +export type CreateAudioSpeech500 = InternalServerResponse +export const CreateAudioSpeech500 = InternalServerResponse +export type CreateAudioSpeech502 = BadGatewayResponse +export const CreateAudioSpeech502 = BadGatewayResponse +export type CreateAudioSpeech503 = ServiceUnavailableResponse +export const CreateAudioSpeech503 = ServiceUnavailableResponse +export type CreateAudioSpeech524 = EdgeNetworkTimeoutResponse +export const CreateAudioSpeech524 = EdgeNetworkTimeoutResponse +export type CreateAudioSpeech529 = ProviderOverloadedResponse +export const CreateAudioSpeech529 = ProviderOverloadedResponse +export type CreateAudioTranscriptionsParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const CreateAudioTranscriptionsParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) +export type CreateAudioTranscriptionsRequestJson = STTRequest +export const CreateAudioTranscriptionsRequestJson = STTRequest +export type CreateAudioTranscriptions200 = STTResponse +export const CreateAudioTranscriptions200 = STTResponse +export type CreateAudioTranscriptions400 = BadRequestResponse +export const CreateAudioTranscriptions400 = BadRequestResponse +export type CreateAudioTranscriptions401 = UnauthorizedResponse +export const CreateAudioTranscriptions401 = UnauthorizedResponse +export type CreateAudioTranscriptions402 = PaymentRequiredResponse +export const CreateAudioTranscriptions402 = PaymentRequiredResponse +export type CreateAudioTranscriptions404 = NotFoundResponse +export const CreateAudioTranscriptions404 = NotFoundResponse +export type CreateAudioTranscriptions429 = TooManyRequestsResponse +export const CreateAudioTranscriptions429 = TooManyRequestsResponse +export type CreateAudioTranscriptions500 = InternalServerResponse +export const CreateAudioTranscriptions500 = InternalServerResponse +export type CreateAudioTranscriptions502 = BadGatewayResponse +export const CreateAudioTranscriptions502 = BadGatewayResponse +export type CreateAudioTranscriptions503 = ServiceUnavailableResponse +export const CreateAudioTranscriptions503 = ServiceUnavailableResponse +export type CreateAudioTranscriptions524 = EdgeNetworkTimeoutResponse +export const CreateAudioTranscriptions524 = EdgeNetworkTimeoutResponse +export type CreateAudioTranscriptions529 = ProviderOverloadedResponse +export const CreateAudioTranscriptions529 = ProviderOverloadedResponse +export type ExchangeAuthCodeForAPIKeyParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const ExchangeAuthCodeForAPIKeyParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) +export type ExchangeAuthCodeForAPIKeyRequestJson = { + readonly "code": string + readonly "code_challenge_method"?: "S256" | "plain" | null + readonly "code_verifier"?: string +} +export const ExchangeAuthCodeForAPIKeyRequestJson = Schema.Struct({ + "code": Schema.String.annotate({ "description": "The authorization code received from the OAuth redirect" }), + "code_challenge_method": Schema.optionalKey( + Schema.Union([Schema.Literal("S256"), Schema.Literal("plain"), Schema.Null]).annotate({ + "description": "The method used to generate the code challenge" + }) + ), + "code_verifier": Schema.optionalKey( + Schema.String.annotate({ + "description": "The code verifier if code_challenge was used in the authorization request" + }) + ) +}) +export type ExchangeAuthCodeForAPIKey200 = { readonly "key": string; readonly "user_id": string } +export const ExchangeAuthCodeForAPIKey200 = Schema.Struct({ + "key": Schema.String.annotate({ "description": "The API key to use for OpenRouter requests" }), + "user_id": Schema.String.annotate({ "description": "User ID associated with the API key" }) +}) +export type ExchangeAuthCodeForAPIKey400 = BadRequestResponse +export const ExchangeAuthCodeForAPIKey400 = BadRequestResponse +export type ExchangeAuthCodeForAPIKey403 = ForbiddenResponse +export const ExchangeAuthCodeForAPIKey403 = ForbiddenResponse +export type ExchangeAuthCodeForAPIKey500 = InternalServerResponse +export const ExchangeAuthCodeForAPIKey500 = InternalServerResponse +export type CreateAuthKeysCodeParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const CreateAuthKeysCodeParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) +export type CreateAuthKeysCodeRequestJson = { + readonly "callback_url": string + readonly "code_challenge"?: string + readonly "code_challenge_method"?: "S256" | "plain" + readonly "expires_at"?: string + readonly "key_label"?: string + readonly "limit"?: number + readonly "spawn_agent"?: string + readonly "spawn_cloud"?: string + readonly "usage_limit_type"?: "daily" | "weekly" | "monthly" +} +export const CreateAuthKeysCodeRequestJson = Schema.Struct({ + "callback_url": Schema.String.annotate({ + "description": + "The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed.", + "format": "uri" + }), + "code_challenge": Schema.optionalKey( + Schema.String.annotate({ "description": "PKCE code challenge for enhanced security" }) + ), + "code_challenge_method": Schema.optionalKey( + Schema.Literals(["S256", "plain"]).annotate({ "description": "The method used to generate the code challenge" }) + ), + "expires_at": Schema.optionalKey( + Schema.String.annotate({ + "description": "Optional expiration time for the API key to be created", + "format": "date-time" + }) ), - "parallel_tool_calls": Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Null])), - "tool_choice": Schema.optionalKey(ToolChoiceOption), - "tools": Schema.optionalKey(Schema.Array(ToolDefinitionJson)), - "top_p": Schema.optionalKey( - Schema.Union([ - Schema.Number.check(Schema.isFinite()).check(Schema.isGreaterThanOrEqualTo(0)).check( - Schema.isLessThanOrEqualTo(1) - ), - Schema.Null - ]) + "key_label": Schema.optionalKey( + Schema.String.annotate({ + "description": "Optional custom label for the API key. Defaults to the app name if not provided." + }).check(Schema.isMaxLength(100)) + ), + "limit": Schema.optionalKey( + Schema.Number.annotate({ "description": "Credit limit for the API key to be created", "format": "double" }).check( + Schema.isFinite() + ) ), - "debug": Schema.optionalKey(Schema.Struct({ "echo_upstream_body": Schema.optionalKey(Schema.Boolean) })), - "image_config": Schema.optionalKey(Schema.Struct({}).check(Schema.isPropertyNames(Schema.String))), - "modalities": Schema.optionalKey(Schema.Array(Schema.Literals(["text", "image"]))) + "spawn_agent": Schema.optionalKey(Schema.String.annotate({ "description": "Agent identifier for spawn telemetry" })), + "spawn_cloud": Schema.optionalKey(Schema.String.annotate({ "description": "Cloud identifier for spawn telemetry" })), + "usage_limit_type": Schema.optionalKey( + Schema.Literals(["daily", "weekly", "monthly"]).annotate({ + "description": "Optional credit limit reset interval. When set, the credit limit resets on this interval." + }) + ) }) -export type OpenResponsesCreatedEvent = { - readonly "type": "response.created" - readonly "response": OpenAIResponsesNonStreamingResponse - readonly "sequence_number": number -} -export const OpenResponsesCreatedEvent = Schema.Struct({ - "type": Schema.Literal("response.created"), - "response": OpenAIResponsesNonStreamingResponse, - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Event emitted when a response is created" }) -export type OpenResponsesInProgressEvent = { - readonly "type": "response.in_progress" - readonly "response": OpenAIResponsesNonStreamingResponse - readonly "sequence_number": number -} -export const OpenResponsesInProgressEvent = Schema.Struct({ - "type": Schema.Literal("response.in_progress"), - "response": OpenAIResponsesNonStreamingResponse, - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Event emitted when a response is in progress" }) -export type OpenResponsesCompletedEvent = { - readonly "type": "response.completed" - readonly "response": OpenAIResponsesNonStreamingResponse - readonly "sequence_number": number -} -export const OpenResponsesCompletedEvent = Schema.Struct({ - "type": Schema.Literal("response.completed"), - "response": OpenAIResponsesNonStreamingResponse, - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Event emitted when a response has completed successfully" }) -export type OpenResponsesIncompleteEvent = { - readonly "type": "response.incomplete" - readonly "response": OpenAIResponsesNonStreamingResponse - readonly "sequence_number": number -} -export const OpenResponsesIncompleteEvent = Schema.Struct({ - "type": Schema.Literal("response.incomplete"), - "response": OpenAIResponsesNonStreamingResponse, - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Event emitted when a response is incomplete" }) -export type OpenResponsesFailedEvent = { - readonly "type": "response.failed" - readonly "response": OpenAIResponsesNonStreamingResponse - readonly "sequence_number": number -} -export const OpenResponsesFailedEvent = Schema.Struct({ - "type": Schema.Literal("response.failed"), - "response": OpenAIResponsesNonStreamingResponse, - "sequence_number": Schema.Number.check(Schema.isFinite()) -}).annotate({ "description": "Event emitted when a response has failed" }) -export type OpenResponsesStreamEvent = - | OpenResponsesCreatedEvent - | OpenResponsesInProgressEvent - | OpenResponsesCompletedEvent - | OpenResponsesIncompleteEvent - | OpenResponsesFailedEvent - | OpenResponsesErrorEvent - | OpenResponsesOutputItemAddedEvent - | OpenResponsesOutputItemDoneEvent - | OpenResponsesContentPartAddedEvent - | OpenResponsesContentPartDoneEvent - | OpenResponsesTextDeltaEvent - | OpenResponsesTextDoneEvent - | OpenResponsesRefusalDeltaEvent - | OpenResponsesRefusalDoneEvent - | OpenResponsesOutputTextAnnotationAddedEvent - | OpenResponsesFunctionCallArgumentsDeltaEvent - | OpenResponsesFunctionCallArgumentsDoneEvent - | OpenResponsesReasoningDeltaEvent - | OpenResponsesReasoningDoneEvent - | OpenResponsesReasoningSummaryPartAddedEvent - | OpenResponsesReasoningSummaryPartDoneEvent - | OpenResponsesReasoningSummaryTextDeltaEvent - | OpenResponsesReasoningSummaryTextDoneEvent - | OpenResponsesImageGenCallInProgress - | OpenResponsesImageGenCallGenerating - | OpenResponsesImageGenCallPartialImage - | OpenResponsesImageGenCallCompleted -export const OpenResponsesStreamEvent = Schema.Union([ - OpenResponsesCreatedEvent, - OpenResponsesInProgressEvent, - OpenResponsesCompletedEvent, - OpenResponsesIncompleteEvent, - OpenResponsesFailedEvent, - OpenResponsesErrorEvent, - OpenResponsesOutputItemAddedEvent, - OpenResponsesOutputItemDoneEvent, - OpenResponsesContentPartAddedEvent, - OpenResponsesContentPartDoneEvent, - OpenResponsesTextDeltaEvent, - OpenResponsesTextDoneEvent, - OpenResponsesRefusalDeltaEvent, - OpenResponsesRefusalDoneEvent, - OpenResponsesOutputTextAnnotationAddedEvent, - OpenResponsesFunctionCallArgumentsDeltaEvent, - OpenResponsesFunctionCallArgumentsDoneEvent, - OpenResponsesReasoningDeltaEvent, - OpenResponsesReasoningDoneEvent, - OpenResponsesReasoningSummaryPartAddedEvent, - OpenResponsesReasoningSummaryPartDoneEvent, - OpenResponsesReasoningSummaryTextDeltaEvent, - OpenResponsesReasoningSummaryTextDoneEvent, - OpenResponsesImageGenCallInProgress, - OpenResponsesImageGenCallGenerating, - OpenResponsesImageGenCallPartialImage, - OpenResponsesImageGenCallCompleted -], { mode: "oneOf" }) -// schemas -export type CreateResponsesRequestJson = OpenResponsesRequest -export const CreateResponsesRequestJson = OpenResponsesRequest -export type CreateResponses200 = OpenResponsesNonStreamingResponse -export const CreateResponses200 = OpenResponsesNonStreamingResponse -export type CreateResponses200Sse = { readonly "data": OpenResponsesStreamEvent } -export const CreateResponses200Sse = Schema.Struct({ "data": OpenResponsesStreamEvent }) -export type CreateResponses400 = BadRequestResponse -export const CreateResponses400 = BadRequestResponse -export type CreateResponses401 = UnauthorizedResponse -export const CreateResponses401 = UnauthorizedResponse -export type CreateResponses402 = PaymentRequiredResponse -export const CreateResponses402 = PaymentRequiredResponse -export type CreateResponses404 = NotFoundResponse -export const CreateResponses404 = NotFoundResponse -export type CreateResponses408 = RequestTimeoutResponse -export const CreateResponses408 = RequestTimeoutResponse -export type CreateResponses413 = PayloadTooLargeResponse -export const CreateResponses413 = PayloadTooLargeResponse -export type CreateResponses422 = UnprocessableEntityResponse -export const CreateResponses422 = UnprocessableEntityResponse -export type CreateResponses429 = TooManyRequestsResponse -export const CreateResponses429 = TooManyRequestsResponse -export type CreateResponses500 = InternalServerResponse -export const CreateResponses500 = InternalServerResponse -export type CreateResponses502 = BadGatewayResponse -export const CreateResponses502 = BadGatewayResponse -export type CreateResponses503 = ServiceUnavailableResponse -export const CreateResponses503 = ServiceUnavailableResponse -export type CreateResponses524 = EdgeNetworkTimeoutResponse -export const CreateResponses524 = EdgeNetworkTimeoutResponse -export type CreateResponses529 = ProviderOverloadedResponse -export const CreateResponses529 = ProviderOverloadedResponse -export type CreateMessagesRequestJson = AnthropicMessagesRequest -export const CreateMessagesRequestJson = AnthropicMessagesRequest -export type CreateMessages200 = AnthropicMessagesResponse -export const CreateMessages200 = AnthropicMessagesResponse -export type CreateMessages200Sse = { readonly "event": string; readonly "data": AnthropicMessagesStreamEvent } -export const CreateMessages200Sse = Schema.Struct({ "event": Schema.String, "data": AnthropicMessagesStreamEvent }) -export type CreateMessages400 = { - readonly "type": "error" - readonly "error": { readonly "type": string; readonly "message": string } +export type CreateAuthKeysCode200 = { + readonly "data": { readonly "app_id": number; readonly "created_at": string; readonly "id": string } } -export const CreateMessages400 = Schema.Struct({ - "type": Schema.Literal("error"), - "error": Schema.Struct({ "type": Schema.String, "message": Schema.String }) +export const CreateAuthKeysCode200 = Schema.Struct({ + "data": Schema.Struct({ + "app_id": Schema.Number.annotate({ "description": "The application ID associated with this auth code" }).check( + Schema.isInt() + ), + "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the auth code was created" }), + "id": Schema.String.annotate({ "description": "The authorization code ID to use in the exchange request" }) + }).annotate({ "description": "Auth code data" }) }) -export type CreateMessages401 = { - readonly "type": "error" - readonly "error": { readonly "type": string; readonly "message": string } +export type CreateAuthKeysCode400 = BadRequestResponse +export const CreateAuthKeysCode400 = BadRequestResponse +export type CreateAuthKeysCode401 = UnauthorizedResponse +export const CreateAuthKeysCode401 = UnauthorizedResponse +export type CreateAuthKeysCode409 = ConflictResponse +export const CreateAuthKeysCode409 = ConflictResponse +export type CreateAuthKeysCode500 = InternalServerResponse +export const CreateAuthKeysCode500 = InternalServerResponse +export type ListBYOKKeysParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string + readonly "offset"?: number + readonly "limit"?: number + readonly "workspace_id"?: string + readonly "provider"?: + | "ai21" + | "aion-labs" + | "akashml" + | "alibaba" + | "amazon-bedrock" + | "amazon-nova" + | "ambient" + | "anthropic" + | "arcee-ai" + | "atlas-cloud" + | "avian" + | "azure" + | "baidu" + | "baseten" + | "black-forest-labs" + | "byteplus" + | "cerebras" + | "chutes" + | "cirrascale" + | "clarifai" + | "cloudflare" + | "cohere" + | "crusoe" + | "deepinfra" + | "deepseek" + | "dekallm" + | "digitalocean" + | "featherless" + | "fireworks" + | "friendli" + | "gmicloud" + | "google-ai-studio" + | "google-vertex" + | "groq" + | "hyperbolic" + | "inception" + | "inceptron" + | "inference-net" + | "infermatic" + | "inflection" + | "io-net" + | "ionstream" + | "liquid" + | "mancer" + | "mara" + | "minimax" + | "mistral" + | "modelrun" + | "modular" + | "moonshotai" + | "morph" + | "ncompass" + | "nebius" + | "nex-agi" + | "nextbit" + | "novita" + | "nvidia" + | "open-inference" + | "openai" + | "parasail" + | "perceptron" + | "perplexity" + | "phala" + | "poolside" + | "recraft" + | "reka" + | "relace" + | "sambanova" + | "seed" + | "siliconflow" + | "sourceful" + | "stepfun" + | "streamlake" + | "switchpoint" + | "together" + | "upstage" + | "venice" + | "wandb" + | "xai" + | "xiaomi" + | "z-ai" } -export const CreateMessages401 = Schema.Struct({ - "type": Schema.Literal("error"), - "error": Schema.Struct({ "type": Schema.String, "message": Schema.String }) +export const ListBYOKKeysParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String), + "offset": Schema.optionalKey( + Schema.Number.annotate({ "description": "Number of records to skip for pagination" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) + ) + ), + "limit": Schema.optionalKey( + Schema.Number.annotate({ "description": "Maximum number of records to return (max 100)" }).check(Schema.isInt()) + .check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(100)) + ), + "workspace_id": Schema.optionalKey( + Schema.String.annotate({ + "description": "Optional workspace ID to filter by. Defaults to the authenticated entity's default workspace.", + "format": "uuid" + }) + ), + "provider": Schema.optionalKey( + Schema.Literals([ + "ai21", + "aion-labs", + "akashml", + "alibaba", + "amazon-bedrock", + "amazon-nova", + "ambient", + "anthropic", + "arcee-ai", + "atlas-cloud", + "avian", + "azure", + "baidu", + "baseten", + "black-forest-labs", + "byteplus", + "cerebras", + "chutes", + "cirrascale", + "clarifai", + "cloudflare", + "cohere", + "crusoe", + "deepinfra", + "deepseek", + "dekallm", + "digitalocean", + "featherless", + "fireworks", + "friendli", + "gmicloud", + "google-ai-studio", + "google-vertex", + "groq", + "hyperbolic", + "inception", + "inceptron", + "inference-net", + "infermatic", + "inflection", + "io-net", + "ionstream", + "liquid", + "mancer", + "mara", + "minimax", + "mistral", + "modelrun", + "modular", + "moonshotai", + "morph", + "ncompass", + "nebius", + "nex-agi", + "nextbit", + "novita", + "nvidia", + "open-inference", + "openai", + "parasail", + "perceptron", + "perplexity", + "phala", + "poolside", + "recraft", + "reka", + "relace", + "sambanova", + "seed", + "siliconflow", + "sourceful", + "stepfun", + "streamlake", + "switchpoint", + "together", + "upstage", + "venice", + "wandb", + "xai", + "xiaomi", + "z-ai" + ]).annotate({ + "description": "Optional provider slug to filter by (e.g. `openai`, `anthropic`, `amazon-bedrock`)." + }) + ) }) -export type CreateMessages403 = { - readonly "type": "error" - readonly "error": { readonly "type": string; readonly "message": string } +export type ListBYOKKeys200 = ListBYOKKeysResponse +export const ListBYOKKeys200 = ListBYOKKeysResponse +export type ListBYOKKeys401 = UnauthorizedResponse +export const ListBYOKKeys401 = UnauthorizedResponse +export type ListBYOKKeys500 = InternalServerResponse +export const ListBYOKKeys500 = InternalServerResponse +export type CreateBYOKKeyParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string } -export const CreateMessages403 = Schema.Struct({ - "type": Schema.Literal("error"), - "error": Schema.Struct({ "type": Schema.String, "message": Schema.String }) +export const CreateBYOKKeyParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) }) -export type CreateMessages404 = { - readonly "type": "error" - readonly "error": { readonly "type": string; readonly "message": string } +export type CreateBYOKKeyRequestJson = CreateBYOKKeyRequest +export const CreateBYOKKeyRequestJson = CreateBYOKKeyRequest +export type CreateBYOKKey201 = CreateBYOKKeyResponse +export const CreateBYOKKey201 = CreateBYOKKeyResponse +export type CreateBYOKKey400 = BadRequestResponse +export const CreateBYOKKey400 = BadRequestResponse +export type CreateBYOKKey401 = UnauthorizedResponse +export const CreateBYOKKey401 = UnauthorizedResponse +export type CreateBYOKKey403 = ForbiddenResponse +export const CreateBYOKKey403 = ForbiddenResponse +export type CreateBYOKKey500 = InternalServerResponse +export const CreateBYOKKey500 = InternalServerResponse +export type GetBYOKKeyParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string } -export const CreateMessages404 = Schema.Struct({ - "type": Schema.Literal("error"), - "error": Schema.Struct({ "type": Schema.String, "message": Schema.String }) +export const GetBYOKKeyParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) }) -export type CreateMessages429 = { - readonly "type": "error" - readonly "error": { readonly "type": string; readonly "message": string } +export type GetBYOKKey200 = GetBYOKKeyResponse +export const GetBYOKKey200 = GetBYOKKeyResponse +export type GetBYOKKey401 = UnauthorizedResponse +export const GetBYOKKey401 = UnauthorizedResponse +export type GetBYOKKey404 = NotFoundResponse +export const GetBYOKKey404 = NotFoundResponse +export type GetBYOKKey500 = InternalServerResponse +export const GetBYOKKey500 = InternalServerResponse +export type DeleteBYOKKeyParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string } -export const CreateMessages429 = Schema.Struct({ - "type": Schema.Literal("error"), - "error": Schema.Struct({ "type": Schema.String, "message": Schema.String }) +export const DeleteBYOKKeyParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) }) -export type CreateMessages500 = { - readonly "type": "error" - readonly "error": { readonly "type": string; readonly "message": string } +export type DeleteBYOKKey200 = DeleteBYOKKeyResponse +export const DeleteBYOKKey200 = DeleteBYOKKeyResponse +export type DeleteBYOKKey401 = UnauthorizedResponse +export const DeleteBYOKKey401 = UnauthorizedResponse +export type DeleteBYOKKey404 = NotFoundResponse +export const DeleteBYOKKey404 = NotFoundResponse +export type DeleteBYOKKey500 = InternalServerResponse +export const DeleteBYOKKey500 = InternalServerResponse +export type UpdateBYOKKeyParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string } -export const CreateMessages500 = Schema.Struct({ - "type": Schema.Literal("error"), - "error": Schema.Struct({ "type": Schema.String, "message": Schema.String }) +export const UpdateBYOKKeyParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) }) -export type CreateMessages503 = { - readonly "type": "error" - readonly "error": { readonly "type": string; readonly "message": string } +export type UpdateBYOKKeyRequestJson = UpdateBYOKKeyRequest +export const UpdateBYOKKeyRequestJson = UpdateBYOKKeyRequest +export type UpdateBYOKKey200 = UpdateBYOKKeyResponse +export const UpdateBYOKKey200 = UpdateBYOKKeyResponse +export type UpdateBYOKKey400 = BadRequestResponse +export const UpdateBYOKKey400 = BadRequestResponse +export type UpdateBYOKKey401 = UnauthorizedResponse +export const UpdateBYOKKey401 = UnauthorizedResponse +export type UpdateBYOKKey404 = NotFoundResponse +export const UpdateBYOKKey404 = NotFoundResponse +export type UpdateBYOKKey500 = InternalServerResponse +export const UpdateBYOKKey500 = InternalServerResponse +export type SendChatCompletionRequestParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string + readonly "X-OpenRouter-Experimental-Metadata"?: MetadataLevel } -export const CreateMessages503 = Schema.Struct({ - "type": Schema.Literal("error"), - "error": Schema.Struct({ "type": Schema.String, "message": Schema.String }) +export const SendChatCompletionRequestParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String), + "X-OpenRouter-Experimental-Metadata": Schema.optionalKey(MetadataLevel) }) -export type CreateMessages529 = { - readonly "type": "error" - readonly "error": { readonly "type": string; readonly "message": string } +export type SendChatCompletionRequestRequestJson = ChatRequest +export const SendChatCompletionRequestRequestJson = ChatRequest +export type SendChatCompletionRequest200 = ChatResult +export const SendChatCompletionRequest200 = ChatResult +export type SendChatCompletionRequest200Sse = ChatStreamingResponse +export const SendChatCompletionRequest200Sse = ChatStreamingResponse +export type SendChatCompletionRequest400 = BadRequestResponse +export const SendChatCompletionRequest400 = BadRequestResponse +export type SendChatCompletionRequest401 = UnauthorizedResponse +export const SendChatCompletionRequest401 = UnauthorizedResponse +export type SendChatCompletionRequest402 = PaymentRequiredResponse +export const SendChatCompletionRequest402 = PaymentRequiredResponse +export type SendChatCompletionRequest403 = ForbiddenResponse +export const SendChatCompletionRequest403 = ForbiddenResponse +export type SendChatCompletionRequest404 = NotFoundResponse +export const SendChatCompletionRequest404 = NotFoundResponse +export type SendChatCompletionRequest408 = RequestTimeoutResponse +export const SendChatCompletionRequest408 = RequestTimeoutResponse +export type SendChatCompletionRequest413 = PayloadTooLargeResponse +export const SendChatCompletionRequest413 = PayloadTooLargeResponse +export type SendChatCompletionRequest422 = UnprocessableEntityResponse +export const SendChatCompletionRequest422 = UnprocessableEntityResponse +export type SendChatCompletionRequest429 = TooManyRequestsResponse +export const SendChatCompletionRequest429 = TooManyRequestsResponse +export type SendChatCompletionRequest500 = InternalServerResponse +export const SendChatCompletionRequest500 = InternalServerResponse +export type SendChatCompletionRequest502 = BadGatewayResponse +export const SendChatCompletionRequest502 = BadGatewayResponse +export type SendChatCompletionRequest503 = ServiceUnavailableResponse +export const SendChatCompletionRequest503 = ServiceUnavailableResponse +export type SendChatCompletionRequest524 = EdgeNetworkTimeoutResponse +export const SendChatCompletionRequest524 = EdgeNetworkTimeoutResponse +export type SendChatCompletionRequest529 = ProviderOverloadedResponse +export const SendChatCompletionRequest529 = ProviderOverloadedResponse +export type GetCreditsParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string } -export const CreateMessages529 = Schema.Struct({ - "type": Schema.Literal("error"), - "error": Schema.Struct({ "type": Schema.String, "message": Schema.String }) -}) -export type GetUserActivityParams = { readonly "date"?: string } -export const GetUserActivityParams = Schema.Struct({ - "date": Schema.optionalKey( - Schema.String.annotate({ "description": "Filter by a single UTC date in the last 30 days (YYYY-MM-DD format)." }) - ) -}) -export type GetUserActivity200 = { readonly "data": ReadonlyArray } -export const GetUserActivity200 = Schema.Struct({ - "data": Schema.Array(ActivityItem).annotate({ "description": "List of activity items" }) +export const GetCreditsParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) }) -export type GetUserActivity400 = BadRequestResponse -export const GetUserActivity400 = BadRequestResponse -export type GetUserActivity401 = UnauthorizedResponse -export const GetUserActivity401 = UnauthorizedResponse -export type GetUserActivity403 = ForbiddenResponse -export const GetUserActivity403 = ForbiddenResponse -export type GetUserActivity500 = InternalServerResponse -export const GetUserActivity500 = InternalServerResponse export type GetCredits200 = { readonly "data": { readonly "total_credits": number; readonly "total_usage": number } } export const GetCredits200 = Schema.Struct({ "data": Schema.Struct({ - "total_credits": Schema.Number.annotate({ "description": "Total credits purchased" }).check(Schema.isFinite()), - "total_usage": Schema.Number.annotate({ "description": "Total credits used" }).check(Schema.isFinite()) + "total_credits": Schema.Number.annotate({ "description": "Total credits purchased", "format": "double" }).check( + Schema.isFinite() + ), + "total_usage": Schema.Number.annotate({ "description": "Total credits used", "format": "double" }).check( + Schema.isFinite() + ) }) }).annotate({ "description": "Total credits purchased and used" }) export type GetCredits401 = UnauthorizedResponse @@ -7133,73 +20600,31 @@ export type GetCredits403 = ForbiddenResponse export const GetCredits403 = ForbiddenResponse export type GetCredits500 = InternalServerResponse export const GetCredits500 = InternalServerResponse -export type CreateCoinbaseChargeRequestJson = CreateChargeRequest -export const CreateCoinbaseChargeRequestJson = CreateChargeRequest -export type CreateCoinbaseCharge200 = { - readonly "data": { - readonly "id": string - readonly "created_at": string - readonly "expires_at": string - readonly "web3_data": { - readonly "transfer_intent": { - readonly "call_data": { - readonly "deadline": string - readonly "fee_amount": string - readonly "id": string - readonly "operator": string - readonly "prefix": string - readonly "recipient": string - readonly "recipient_amount": string - readonly "recipient_currency": string - readonly "refund_destination": string - readonly "signature": string - } - readonly "metadata": { - readonly "chain_id": number - readonly "contract_address": string - readonly "sender": string - } - } - } - } +export type CreateCoinbaseChargeParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string } -export const CreateCoinbaseCharge200 = Schema.Struct({ - "data": Schema.Struct({ - "id": Schema.String, - "created_at": Schema.String, - "expires_at": Schema.String, - "web3_data": Schema.Struct({ - "transfer_intent": Schema.Struct({ - "call_data": Schema.Struct({ - "deadline": Schema.String, - "fee_amount": Schema.String, - "id": Schema.String, - "operator": Schema.String, - "prefix": Schema.String, - "recipient": Schema.String, - "recipient_amount": Schema.String, - "recipient_currency": Schema.String, - "refund_destination": Schema.String, - "signature": Schema.String - }), - "metadata": Schema.Struct({ - "chain_id": Schema.Number.check(Schema.isFinite()), - "contract_address": Schema.String, - "sender": Schema.String - }) - }) - }) - }) +export const CreateCoinbaseChargeParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) +export type CreateCoinbaseCharge410 = GoneResponse +export const CreateCoinbaseCharge410 = GoneResponse +export type CreateEmbeddingsParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const CreateEmbeddingsParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) }) -export type CreateCoinbaseCharge400 = BadRequestResponse -export const CreateCoinbaseCharge400 = BadRequestResponse -export type CreateCoinbaseCharge401 = UnauthorizedResponse -export const CreateCoinbaseCharge401 = UnauthorizedResponse -export type CreateCoinbaseCharge429 = TooManyRequestsResponse -export const CreateCoinbaseCharge429 = TooManyRequestsResponse -export type CreateCoinbaseCharge500 = InternalServerResponse -export const CreateCoinbaseCharge500 = InternalServerResponse export type CreateEmbeddingsRequestJson = { + readonly "dimensions"?: number + readonly "encoding_format"?: "float" | "base64" readonly "input": | string | ReadonlyArray @@ -7208,72 +20633,219 @@ export type CreateEmbeddingsRequestJson = { | ReadonlyArray< { readonly "content": ReadonlyArray< - { readonly "type": "text"; readonly "text": string } | { - readonly "type": "image_url" - readonly "image_url": { readonly "url": string } - } + | { readonly "text": string; readonly "type": "text" } + | { readonly "image_url": { readonly "url": string }; readonly "type": "image_url" } + | ContentPartInputAudio + | ContentPartInputVideo + | ContentPartInputFile > } > + readonly "input_type"?: string readonly "model": string - readonly "encoding_format"?: "float" | "base64" - readonly "dimensions"?: number + readonly "provider"?: { + readonly "allow_fallbacks"?: boolean + readonly "data_collection"?: "deny" | "allow" | null + readonly "enforce_distillable_text"?: boolean + readonly "ignore"?: ReadonlyArray + readonly "max_price"?: { + readonly "audio"?: string + readonly "completion"?: string + readonly "image"?: string + readonly "prompt"?: BigNumberUnion + readonly "request"?: string + } + readonly "only"?: ReadonlyArray + readonly "order"?: ReadonlyArray + readonly "preferred_max_latency"?: PreferredMaxLatency + readonly "preferred_min_throughput"?: PreferredMinThroughput + readonly "quantizations"?: ReadonlyArray + readonly "require_parameters"?: boolean + readonly "sort"?: ProviderSort | ProviderSortConfig | unknown + readonly "zdr"?: boolean + } readonly "user"?: string - readonly "provider"?: ProviderPreferences - readonly "input_type"?: string } export const CreateEmbeddingsRequestJson = Schema.Struct({ + "dimensions": Schema.optionalKey( + Schema.Number.annotate({ "description": "The number of dimensions for the output embeddings" }).check( + Schema.isInt() + ).check(Schema.isGreaterThanOrEqualTo(1)) + ), + "encoding_format": Schema.optionalKey( + Schema.Literals(["float", "base64"]).annotate({ "description": "The format of the output embeddings" }) + ), "input": Schema.Union([ Schema.String, Schema.Array(Schema.String), Schema.Array(Schema.Number.check(Schema.isFinite())), Schema.Array(Schema.Array(Schema.Number.check(Schema.isFinite()))), - Schema.Array( - Schema.Struct({ - "content": Schema.Array( - Schema.Union([ - Schema.Struct({ "type": Schema.Literal("text"), "text": Schema.String }), - Schema.Struct({ "type": Schema.Literal("image_url"), "image_url": Schema.Struct({ "url": Schema.String }) }) - ], { mode: "oneOf" }) - ) - }) - ) - ]), - "model": Schema.String, - "encoding_format": Schema.optionalKey(Schema.Literals(["float", "base64"])), - "dimensions": Schema.optionalKey(Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0))), - "user": Schema.optionalKey(Schema.String), - "provider": Schema.optionalKey(ProviderPreferences), - "input_type": Schema.optionalKey(Schema.String) -}) + Schema.Array(Schema.Struct({ + "content": Schema.Array( + Schema.Union([ + Schema.Struct({ "text": Schema.String, "type": Schema.Literal("text") }), + Schema.Struct({ "image_url": Schema.Struct({ "url": Schema.String }), "type": Schema.Literal("image_url") }), + ContentPartInputAudio, + ContentPartInputVideo, + ContentPartInputFile + ], { mode: "oneOf" }) + ) + })) + ]).annotate({ "description": "Text, token, or multimodal input(s) to embed" }), + "input_type": Schema.optionalKey( + Schema.String.annotate({ "description": "The type of input (e.g. search_query, search_document)" }) + ), + "model": Schema.String.annotate({ "description": "The model to use for embeddings" }), + "provider": Schema.optionalKey( + Schema.Struct({ + "allow_fallbacks": Schema.optionalKey(Schema.Boolean.annotate({ + "description": + "Whether to allow backup providers to serve requests\n- true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider.\n- false: use only the primary/custom provider, and return the upstream error if it's unavailable.\n" + })), + "data_collection": Schema.optionalKey( + Schema.Union([Schema.Literal("deny"), Schema.Literal("allow"), Schema.Null]).annotate({ + "description": + "Data collection setting. If no available model provider meets the requirement, your request will return an error.\n- allow: (default) allow providers which store user data non-transiently and may train on it\n\n- deny: use only providers which do not collect user data." + }) + ), + "enforce_distillable_text": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used." + }) + ), + "ignore": Schema.optionalKey( + Schema.Array(Schema.Union([ProviderName, Schema.String])).annotate({ + "description": + "List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request." + }) + ), + "max_price": Schema.optionalKey( + Schema.Struct({ + "audio": Schema.optionalKey(Schema.String.annotate({ "description": "Price per audio unit" })), + "completion": Schema.optionalKey( + Schema.String.annotate({ "description": "Price per million completion tokens" }) + ), + "image": Schema.optionalKey(Schema.String.annotate({ "description": "Price per image" })), + "prompt": Schema.optionalKey(BigNumberUnion), + "request": Schema.optionalKey(Schema.String.annotate({ "description": "Price per request" })) + }).annotate({ + "description": + "The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion." + }) + ), + "only": Schema.optionalKey( + Schema.Array(Schema.Union([ProviderName, Schema.String])).annotate({ + "description": + "List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request." + }) + ), + "order": Schema.optionalKey( + Schema.Array(Schema.Union([ProviderName, Schema.String])).annotate({ + "description": + "An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message." + }) + ), + "preferred_max_latency": Schema.optionalKey(PreferredMaxLatency), + "preferred_min_throughput": Schema.optionalKey(PreferredMinThroughput), + "quantizations": Schema.optionalKey( + Schema.Array(Quantization).annotate({ + "description": "A list of quantization levels to filter the provider by." + }) + ), + "require_parameters": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest." + }) + ), + "sort": Schema.optionalKey( + Schema.Union([ProviderSort, ProviderSortConfig, Schema.Unknown]).annotate({ + "description": + "The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed." + }) + ), + "zdr": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used." + }) + ) + }).annotate({ "description": "Provider routing preferences for the request." }) + ), + "user": Schema.optionalKey(Schema.String.annotate({ "description": "A unique identifier for the end-user" })) +}).annotate({ "description": "Embeddings request input" }) export type CreateEmbeddings200 = { - readonly "id"?: string - readonly "object": "list" readonly "data": ReadonlyArray< - { readonly "object": "embedding"; readonly "embedding": ReadonlyArray | string; readonly "index"?: number } + { readonly "embedding": ReadonlyArray | string; readonly "index"?: number; readonly "object": "embedding" } > + readonly "id"?: string readonly "model": string - readonly "usage"?: { readonly "prompt_tokens": number; readonly "total_tokens": number; readonly "cost"?: number } + readonly "object": "list" + readonly "usage"?: { + readonly "cost"?: number + readonly "prompt_tokens": number + readonly "prompt_tokens_details"?: { + readonly "audio_tokens"?: number + readonly "file_tokens"?: number + readonly "image_tokens"?: number + readonly "text_tokens"?: number + readonly "video_tokens"?: number + } + readonly "total_tokens": number + } } export const CreateEmbeddings200 = Schema.Struct({ - "id": Schema.optionalKey(Schema.String), - "object": Schema.Literal("list"), "data": Schema.Array( Schema.Struct({ - "object": Schema.Literal("embedding"), - "embedding": Schema.Union([Schema.Array(Schema.Number.check(Schema.isFinite())), Schema.String]), - "index": Schema.optionalKey(Schema.Number.check(Schema.isFinite())) - }) - ), - "model": Schema.String, + "embedding": Schema.Union([Schema.Array(Schema.Number.check(Schema.isFinite())), Schema.String]).annotate({ + "description": "Embedding vector as an array of floats or a base64 string" + }), + "index": Schema.optionalKey( + Schema.Number.annotate({ "description": "Index of the embedding in the input list" }).check(Schema.isInt()) + ), + "object": Schema.Literal("embedding") + }).annotate({ "description": "A single embedding object" }) + ).annotate({ "description": "List of embedding objects" }), + "id": Schema.optionalKey(Schema.String.annotate({ "description": "Unique identifier for the embeddings response" })), + "model": Schema.String.annotate({ "description": "The model used for embeddings" }), + "object": Schema.Literal("list"), "usage": Schema.optionalKey( Schema.Struct({ - "prompt_tokens": Schema.Number.check(Schema.isFinite()), - "total_tokens": Schema.Number.check(Schema.isFinite()), - "cost": Schema.optionalKey(Schema.Number.check(Schema.isFinite())) - }) + "cost": Schema.optionalKey( + Schema.Number.annotate({ "description": "Cost of the request in credits", "format": "double" }).check( + Schema.isFinite() + ) + ), + "prompt_tokens": Schema.Number.annotate({ "description": "Number of tokens in the input" }).check(Schema.isInt()), + "prompt_tokens_details": Schema.optionalKey( + Schema.Struct({ + "audio_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Number of audio tokens in the input" }).check(Schema.isInt()) + ), + "file_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Number of file/document tokens in the input" }).check( + Schema.isInt() + ) + ), + "image_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Number of image tokens in the input" }).check(Schema.isInt()) + ), + "text_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Number of text tokens in the input" }).check(Schema.isInt()) + ), + "video_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Number of video tokens in the input" }).check(Schema.isInt()) + ) + }).annotate({ + "description": + "Per-modality token breakdown. Only present when the input contains 2+ modalities (e.g. text + image) and the upstream provider returns modality-level usage data. Only non-zero modality counts are included." + }) + ), + "total_tokens": Schema.Number.annotate({ "description": "Total number of tokens used" }).check(Schema.isInt()) + }).annotate({ "description": "Token usage statistics" }) ) -}) +}).annotate({ "description": "Embeddings response containing embedding vectors" }) export type CreateEmbeddings200Sse = string export const CreateEmbeddings200Sse = Schema.String.annotate({ "description": "Not used for embeddings - embeddings do not support streaming" @@ -7298,529 +20870,625 @@ export type CreateEmbeddings524 = EdgeNetworkTimeoutResponse export const CreateEmbeddings524 = EdgeNetworkTimeoutResponse export type CreateEmbeddings529 = ProviderOverloadedResponse export const CreateEmbeddings529 = ProviderOverloadedResponse +export type ListEmbeddingsModelsParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const ListEmbeddingsModelsParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) export type ListEmbeddingsModels200 = ModelsListResponse export const ListEmbeddingsModels200 = ModelsListResponse export type ListEmbeddingsModels400 = BadRequestResponse export const ListEmbeddingsModels400 = BadRequestResponse export type ListEmbeddingsModels500 = InternalServerResponse export const ListEmbeddingsModels500 = InternalServerResponse -export type GetGenerationParams = { readonly "id": string } -export const GetGenerationParams = Schema.Struct({ "id": Schema.String.check(Schema.isMinLength(1)) }) -export type GetGeneration200 = { +export type ListEndpointsZdrParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const ListEndpointsZdrParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) +export type ListEndpointsZdr200 = { readonly "data": ReadonlyArray } +export const ListEndpointsZdr200 = Schema.Struct({ "data": Schema.Array(PublicEndpoint) }) +export type ListEndpointsZdr500 = InternalServerResponse +export const ListEndpointsZdr500 = InternalServerResponse +export type GetGenerationParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string + readonly "id": string +} +export const GetGenerationParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String), + "id": Schema.String.annotate({ "description": "The generation ID" }).check(Schema.isMinLength(1)) +}) +export type GetGeneration200 = GenerationResponse +export const GetGeneration200 = GenerationResponse +export type GetGeneration401 = UnauthorizedResponse +export const GetGeneration401 = UnauthorizedResponse +export type GetGeneration402 = PaymentRequiredResponse +export const GetGeneration402 = PaymentRequiredResponse +export type GetGeneration404 = NotFoundResponse +export const GetGeneration404 = NotFoundResponse +export type GetGeneration429 = TooManyRequestsResponse +export const GetGeneration429 = TooManyRequestsResponse +export type GetGeneration500 = InternalServerResponse +export const GetGeneration500 = InternalServerResponse +export type GetGeneration502 = BadGatewayResponse +export const GetGeneration502 = BadGatewayResponse +export type GetGeneration524 = EdgeNetworkTimeoutResponse +export const GetGeneration524 = EdgeNetworkTimeoutResponse +export type GetGeneration529 = ProviderOverloadedResponse +export const GetGeneration529 = ProviderOverloadedResponse +export type ListGenerationContentParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string + readonly "id": string +} +export const ListGenerationContentParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String), + "id": Schema.String.annotate({ "description": "The generation ID" }).check(Schema.isMinLength(1)) +}) +export type ListGenerationContent200 = GenerationContentResponse +export const ListGenerationContent200 = GenerationContentResponse +export type ListGenerationContent401 = UnauthorizedResponse +export const ListGenerationContent401 = UnauthorizedResponse +export type ListGenerationContent403 = ForbiddenResponse +export const ListGenerationContent403 = ForbiddenResponse +export type ListGenerationContent404 = NotFoundResponse +export const ListGenerationContent404 = NotFoundResponse +export type ListGenerationContent429 = TooManyRequestsResponse +export const ListGenerationContent429 = TooManyRequestsResponse +export type ListGenerationContent500 = InternalServerResponse +export const ListGenerationContent500 = InternalServerResponse +export type ListGenerationContent502 = BadGatewayResponse +export const ListGenerationContent502 = BadGatewayResponse +export type ListGenerationContent524 = EdgeNetworkTimeoutResponse +export const ListGenerationContent524 = EdgeNetworkTimeoutResponse +export type ListGenerationContent529 = ProviderOverloadedResponse +export const ListGenerationContent529 = ProviderOverloadedResponse +export type ListGuardrailsParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string + readonly "offset"?: number + readonly "limit"?: number + readonly "workspace_id"?: string +} +export const ListGuardrailsParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String), + "offset": Schema.optionalKey( + Schema.Number.annotate({ "description": "Number of records to skip for pagination" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) + ) + ), + "limit": Schema.optionalKey( + Schema.Number.annotate({ "description": "Maximum number of records to return (max 100)" }).check(Schema.isInt()) + .check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(100)) + ), + "workspace_id": Schema.optionalKey( + Schema.String.annotate({ + "description": "Filter guardrails by workspace ID. By default, guardrails in the default workspace are returned.", + "format": "uuid" + }) + ) +}) +export type ListGuardrails200 = ListGuardrailsResponse +export const ListGuardrails200 = ListGuardrailsResponse +export type ListGuardrails401 = UnauthorizedResponse +export const ListGuardrails401 = UnauthorizedResponse +export type ListGuardrails500 = InternalServerResponse +export const ListGuardrails500 = InternalServerResponse +export type CreateGuardrailParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const CreateGuardrailParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) +export type CreateGuardrailRequestJson = CreateGuardrailRequest +export const CreateGuardrailRequestJson = CreateGuardrailRequest +export type CreateGuardrail201 = CreateGuardrailResponse +export const CreateGuardrail201 = CreateGuardrailResponse +export type CreateGuardrail400 = BadRequestResponse +export const CreateGuardrail400 = BadRequestResponse +export type CreateGuardrail401 = UnauthorizedResponse +export const CreateGuardrail401 = UnauthorizedResponse +export type CreateGuardrail403 = ForbiddenResponse +export const CreateGuardrail403 = ForbiddenResponse +export type CreateGuardrail500 = InternalServerResponse +export const CreateGuardrail500 = InternalServerResponse +export type GetGuardrailParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const GetGuardrailParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) +export type GetGuardrail200 = GetGuardrailResponse +export const GetGuardrail200 = GetGuardrailResponse +export type GetGuardrail401 = UnauthorizedResponse +export const GetGuardrail401 = UnauthorizedResponse +export type GetGuardrail404 = NotFoundResponse +export const GetGuardrail404 = NotFoundResponse +export type GetGuardrail500 = InternalServerResponse +export const GetGuardrail500 = InternalServerResponse +export type DeleteGuardrailParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const DeleteGuardrailParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) +export type DeleteGuardrail200 = DeleteGuardrailResponse +export const DeleteGuardrail200 = DeleteGuardrailResponse +export type DeleteGuardrail401 = UnauthorizedResponse +export const DeleteGuardrail401 = UnauthorizedResponse +export type DeleteGuardrail404 = NotFoundResponse +export const DeleteGuardrail404 = NotFoundResponse +export type DeleteGuardrail500 = InternalServerResponse +export const DeleteGuardrail500 = InternalServerResponse +export type UpdateGuardrailParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const UpdateGuardrailParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) +export type UpdateGuardrailRequestJson = UpdateGuardrailRequest +export const UpdateGuardrailRequestJson = UpdateGuardrailRequest +export type UpdateGuardrail200 = UpdateGuardrailResponse +export const UpdateGuardrail200 = UpdateGuardrailResponse +export type UpdateGuardrail400 = BadRequestResponse +export const UpdateGuardrail400 = BadRequestResponse +export type UpdateGuardrail401 = UnauthorizedResponse +export const UpdateGuardrail401 = UnauthorizedResponse +export type UpdateGuardrail404 = NotFoundResponse +export const UpdateGuardrail404 = NotFoundResponse +export type UpdateGuardrail500 = InternalServerResponse +export const UpdateGuardrail500 = InternalServerResponse +export type ListGuardrailKeyAssignmentsParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string + readonly "offset"?: number + readonly "limit"?: number +} +export const ListGuardrailKeyAssignmentsParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String), + "offset": Schema.optionalKey( + Schema.Number.annotate({ "description": "Number of records to skip for pagination" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) + ) + ), + "limit": Schema.optionalKey( + Schema.Number.annotate({ "description": "Maximum number of records to return (max 100)" }).check(Schema.isInt()) + .check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(100)) + ) +}) +export type ListGuardrailKeyAssignments200 = ListKeyAssignmentsResponse +export const ListGuardrailKeyAssignments200 = ListKeyAssignmentsResponse +export type ListGuardrailKeyAssignments401 = UnauthorizedResponse +export const ListGuardrailKeyAssignments401 = UnauthorizedResponse +export type ListGuardrailKeyAssignments404 = NotFoundResponse +export const ListGuardrailKeyAssignments404 = NotFoundResponse +export type ListGuardrailKeyAssignments500 = InternalServerResponse +export const ListGuardrailKeyAssignments500 = InternalServerResponse +export type BulkAssignKeysToGuardrailParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const BulkAssignKeysToGuardrailParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) +export type BulkAssignKeysToGuardrailRequestJson = BulkAssignKeysRequest +export const BulkAssignKeysToGuardrailRequestJson = BulkAssignKeysRequest +export type BulkAssignKeysToGuardrail200 = BulkAssignKeysResponse +export const BulkAssignKeysToGuardrail200 = BulkAssignKeysResponse +export type BulkAssignKeysToGuardrail400 = BadRequestResponse +export const BulkAssignKeysToGuardrail400 = BadRequestResponse +export type BulkAssignKeysToGuardrail401 = UnauthorizedResponse +export const BulkAssignKeysToGuardrail401 = UnauthorizedResponse +export type BulkAssignKeysToGuardrail404 = NotFoundResponse +export const BulkAssignKeysToGuardrail404 = NotFoundResponse +export type BulkAssignKeysToGuardrail500 = InternalServerResponse +export const BulkAssignKeysToGuardrail500 = InternalServerResponse +export type BulkUnassignKeysFromGuardrailParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const BulkUnassignKeysFromGuardrailParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) +export type BulkUnassignKeysFromGuardrailRequestJson = BulkUnassignKeysRequest +export const BulkUnassignKeysFromGuardrailRequestJson = BulkUnassignKeysRequest +export type BulkUnassignKeysFromGuardrail200 = BulkUnassignKeysResponse +export const BulkUnassignKeysFromGuardrail200 = BulkUnassignKeysResponse +export type BulkUnassignKeysFromGuardrail400 = BadRequestResponse +export const BulkUnassignKeysFromGuardrail400 = BadRequestResponse +export type BulkUnassignKeysFromGuardrail401 = UnauthorizedResponse +export const BulkUnassignKeysFromGuardrail401 = UnauthorizedResponse +export type BulkUnassignKeysFromGuardrail404 = NotFoundResponse +export const BulkUnassignKeysFromGuardrail404 = NotFoundResponse +export type BulkUnassignKeysFromGuardrail500 = InternalServerResponse +export const BulkUnassignKeysFromGuardrail500 = InternalServerResponse +export type ListGuardrailMemberAssignmentsParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string + readonly "offset"?: number + readonly "limit"?: number +} +export const ListGuardrailMemberAssignmentsParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String), + "offset": Schema.optionalKey( + Schema.Number.annotate({ "description": "Number of records to skip for pagination" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) + ) + ), + "limit": Schema.optionalKey( + Schema.Number.annotate({ "description": "Maximum number of records to return (max 100)" }).check(Schema.isInt()) + .check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(100)) + ) +}) +export type ListGuardrailMemberAssignments200 = ListMemberAssignmentsResponse +export const ListGuardrailMemberAssignments200 = ListMemberAssignmentsResponse +export type ListGuardrailMemberAssignments401 = UnauthorizedResponse +export const ListGuardrailMemberAssignments401 = UnauthorizedResponse +export type ListGuardrailMemberAssignments404 = NotFoundResponse +export const ListGuardrailMemberAssignments404 = NotFoundResponse +export type ListGuardrailMemberAssignments500 = InternalServerResponse +export const ListGuardrailMemberAssignments500 = InternalServerResponse +export type BulkAssignMembersToGuardrailParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const BulkAssignMembersToGuardrailParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) +export type BulkAssignMembersToGuardrailRequestJson = BulkAssignMembersRequest +export const BulkAssignMembersToGuardrailRequestJson = BulkAssignMembersRequest +export type BulkAssignMembersToGuardrail200 = BulkAssignMembersResponse +export const BulkAssignMembersToGuardrail200 = BulkAssignMembersResponse +export type BulkAssignMembersToGuardrail400 = BadRequestResponse +export const BulkAssignMembersToGuardrail400 = BadRequestResponse +export type BulkAssignMembersToGuardrail401 = UnauthorizedResponse +export const BulkAssignMembersToGuardrail401 = UnauthorizedResponse +export type BulkAssignMembersToGuardrail404 = NotFoundResponse +export const BulkAssignMembersToGuardrail404 = NotFoundResponse +export type BulkAssignMembersToGuardrail500 = InternalServerResponse +export const BulkAssignMembersToGuardrail500 = InternalServerResponse +export type BulkUnassignMembersFromGuardrailParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const BulkUnassignMembersFromGuardrailParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) +export type BulkUnassignMembersFromGuardrailRequestJson = BulkUnassignMembersRequest +export const BulkUnassignMembersFromGuardrailRequestJson = BulkUnassignMembersRequest +export type BulkUnassignMembersFromGuardrail200 = BulkUnassignMembersResponse +export const BulkUnassignMembersFromGuardrail200 = BulkUnassignMembersResponse +export type BulkUnassignMembersFromGuardrail400 = BadRequestResponse +export const BulkUnassignMembersFromGuardrail400 = BadRequestResponse +export type BulkUnassignMembersFromGuardrail401 = UnauthorizedResponse +export const BulkUnassignMembersFromGuardrail401 = UnauthorizedResponse +export type BulkUnassignMembersFromGuardrail404 = NotFoundResponse +export const BulkUnassignMembersFromGuardrail404 = NotFoundResponse +export type BulkUnassignMembersFromGuardrail500 = InternalServerResponse +export const BulkUnassignMembersFromGuardrail500 = InternalServerResponse +export type ListKeyAssignmentsParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string + readonly "offset"?: number + readonly "limit"?: number +} +export const ListKeyAssignmentsParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String), + "offset": Schema.optionalKey( + Schema.Number.annotate({ "description": "Number of records to skip for pagination" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) + ) + ), + "limit": Schema.optionalKey( + Schema.Number.annotate({ "description": "Maximum number of records to return (max 100)" }).check(Schema.isInt()) + .check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(100)) + ) +}) +export type ListKeyAssignments200 = ListKeyAssignmentsResponse +export const ListKeyAssignments200 = ListKeyAssignmentsResponse +export type ListKeyAssignments401 = UnauthorizedResponse +export const ListKeyAssignments401 = UnauthorizedResponse +export type ListKeyAssignments500 = InternalServerResponse +export const ListKeyAssignments500 = InternalServerResponse +export type ListMemberAssignmentsParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string + readonly "offset"?: number + readonly "limit"?: number +} +export const ListMemberAssignmentsParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String), + "offset": Schema.optionalKey( + Schema.Number.annotate({ "description": "Number of records to skip for pagination" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) + ) + ), + "limit": Schema.optionalKey( + Schema.Number.annotate({ "description": "Maximum number of records to return (max 100)" }).check(Schema.isInt()) + .check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(100)) + ) +}) +export type ListMemberAssignments200 = ListMemberAssignmentsResponse +export const ListMemberAssignments200 = ListMemberAssignmentsResponse +export type ListMemberAssignments401 = UnauthorizedResponse +export const ListMemberAssignments401 = UnauthorizedResponse +export type ListMemberAssignments500 = InternalServerResponse +export const ListMemberAssignments500 = InternalServerResponse +export type GetCurrentKeyParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const GetCurrentKeyParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) +export type GetCurrentKey200 = { readonly "data": { - readonly "id": string - readonly "upstream_id": string - readonly "total_cost": number - readonly "cache_discount": number - readonly "upstream_inference_cost": number - readonly "created_at": string - readonly "model": string - readonly "app_id": number - readonly "streamed": boolean - readonly "cancelled": boolean - readonly "provider_name": string - readonly "latency": number - readonly "moderation_latency": number - readonly "generation_time": number - readonly "finish_reason": string - readonly "tokens_prompt": number - readonly "tokens_completion": number - readonly "native_tokens_prompt": number - readonly "native_tokens_completion": number - readonly "native_tokens_completion_images": number - readonly "native_tokens_reasoning": number - readonly "native_tokens_cached": number - readonly "num_media_prompt": number - readonly "num_input_audio_prompt": number - readonly "num_media_completion": number - readonly "num_search_results": number - readonly "origin": string + readonly "byok_usage": number + readonly "byok_usage_daily": number + readonly "byok_usage_monthly": number + readonly "byok_usage_weekly": number + readonly "creator_user_id": string + readonly "expires_at"?: string + readonly "include_byok_in_limit": boolean + readonly "is_free_tier": boolean + readonly "is_management_key": boolean + readonly "is_provisioning_key": boolean + readonly "label": string + readonly "limit": number + readonly "limit_remaining": number + readonly "limit_reset": string + readonly "rate_limit": { readonly "interval": string; readonly "note": string; readonly "requests": number } readonly "usage": number - readonly "is_byok": boolean - readonly "native_finish_reason": string - readonly "external_user": string - readonly "api_type": "completions" | "embeddings" - readonly "router": string - readonly "provider_responses": ReadonlyArray< - { - readonly "id"?: string - readonly "endpoint_id"?: string - readonly "model_permaslug"?: string - readonly "provider_name"?: - | "AnyScale" - | "Atoma" - | "Cent-ML" - | "CrofAI" - | "Enfer" - | "GoPomelo" - | "HuggingFace" - | "Hyperbolic 2" - | "InoCloud" - | "Kluster" - | "Lambda" - | "Lepton" - | "Lynn 2" - | "Lynn" - | "Mancer" - | "Meta" - | "Modal" - | "Nineteen" - | "OctoAI" - | "Recursal" - | "Reflection" - | "Replicate" - | "SambaNova 2" - | "SF Compute" - | "Targon" - | "Together 2" - | "Ubicloud" - | "01.AI" - | "AI21" - | "AionLabs" - | "Alibaba" - | "Ambient" - | "Amazon Bedrock" - | "Amazon Nova" - | "Anthropic" - | "Arcee AI" - | "AtlasCloud" - | "Avian" - | "Azure" - | "BaseTen" - | "BytePlus" - | "Black Forest Labs" - | "Cerebras" - | "Chutes" - | "Cirrascale" - | "Clarifai" - | "Cloudflare" - | "Cohere" - | "Crusoe" - | "DeepInfra" - | "DeepSeek" - | "Featherless" - | "Fireworks" - | "Friendli" - | "GMICloud" - | "Google" - | "Google AI Studio" - | "Groq" - | "Hyperbolic" - | "Inception" - | "Inceptron" - | "InferenceNet" - | "Infermatic" - | "Io Net" - | "Inflection" - | "Liquid" - | "Mara" - | "Mancer 2" - | "Minimax" - | "ModelRun" - | "Mistral" - | "Modular" - | "Moonshot AI" - | "Morph" - | "NCompass" - | "Nebius" - | "NextBit" - | "Novita" - | "Nvidia" - | "OpenAI" - | "OpenInference" - | "Parasail" - | "Perplexity" - | "Phala" - | "Relace" - | "SambaNova" - | "Seed" - | "SiliconFlow" - | "Sourceful" - | "StepFun" - | "Stealth" - | "StreamLake" - | "Switchpoint" - | "Together" - | "Upstage" - | "Venice" - | "WandB" - | "Xiaomi" - | "xAI" - | "Z.AI" - | "FakeProvider" - readonly "status": number - readonly "latency"?: number - readonly "is_byok"?: boolean - } - > + readonly "usage_daily": number + readonly "usage_monthly": number + readonly "usage_weekly": number } } -export const GetGeneration200 = Schema.Struct({ +export const GetCurrentKey200 = Schema.Struct({ "data": Schema.Struct({ - "id": Schema.String.annotate({ "description": "Unique identifier for the generation" }), - "upstream_id": Schema.String.annotate({ "description": "Upstream provider's identifier for this generation" }), - "total_cost": Schema.Number.annotate({ "description": "Total cost of the generation in USD" }).check( - Schema.isFinite() - ), - "cache_discount": Schema.Number.annotate({ "description": "Discount applied due to caching" }).check( - Schema.isFinite() - ), - "upstream_inference_cost": Schema.Number.annotate({ "description": "Cost charged by the upstream provider" }).check( - Schema.isFinite() - ), - "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the generation was created" }), - "model": Schema.String.annotate({ "description": "Model used for the generation" }), - "app_id": Schema.Number.annotate({ "description": "ID of the app that made the request" }).check(Schema.isFinite()), - "streamed": Schema.Boolean.annotate({ "description": "Whether the response was streamed" }), - "cancelled": Schema.Boolean.annotate({ "description": "Whether the generation was cancelled" }), - "provider_name": Schema.String.annotate({ "description": "Name of the provider that served the request" }), - "latency": Schema.Number.annotate({ "description": "Total latency in milliseconds" }).check(Schema.isFinite()), - "moderation_latency": Schema.Number.annotate({ "description": "Moderation latency in milliseconds" }).check( - Schema.isFinite() - ), - "generation_time": Schema.Number.annotate({ "description": "Time taken for generation in milliseconds" }).check( - Schema.isFinite() - ), - "finish_reason": Schema.String.annotate({ "description": "Reason the generation finished" }), - "tokens_prompt": Schema.Number.annotate({ "description": "Number of tokens in the prompt" }).check( - Schema.isFinite() - ), - "tokens_completion": Schema.Number.annotate({ "description": "Number of tokens in the completion" }).check( - Schema.isFinite() - ), - "native_tokens_prompt": Schema.Number.annotate({ "description": "Native prompt tokens as reported by provider" }) - .check(Schema.isFinite()), - "native_tokens_completion": Schema.Number.annotate({ - "description": "Native completion tokens as reported by provider" + "byok_usage": Schema.Number.annotate({ + "description": "Total external BYOK usage (in USD) for the API key", + "format": "double" }).check(Schema.isFinite()), - "native_tokens_completion_images": Schema.Number.annotate({ - "description": "Native completion image tokens as reported by provider" + "byok_usage_daily": Schema.Number.annotate({ + "description": "External BYOK usage (in USD) for the current UTC day", + "format": "double" }).check(Schema.isFinite()), - "native_tokens_reasoning": Schema.Number.annotate({ - "description": "Native reasoning tokens as reported by provider" + "byok_usage_monthly": Schema.Number.annotate({ + "description": "External BYOK usage (in USD) for current UTC month", + "format": "double" }).check(Schema.isFinite()), - "native_tokens_cached": Schema.Number.annotate({ "description": "Native cached tokens as reported by provider" }) - .check(Schema.isFinite()), - "num_media_prompt": Schema.Number.annotate({ "description": "Number of media items in the prompt" }).check( - Schema.isFinite() - ), - "num_input_audio_prompt": Schema.Number.annotate({ "description": "Number of audio inputs in the prompt" }).check( - Schema.isFinite() - ), - "num_media_completion": Schema.Number.annotate({ "description": "Number of media items in the completion" }).check( - Schema.isFinite() - ), - "num_search_results": Schema.Number.annotate({ "description": "Number of search results included" }).check( - Schema.isFinite() + "byok_usage_weekly": Schema.Number.annotate({ + "description": "External BYOK usage (in USD) for the current UTC week (Monday-Sunday)", + "format": "double" + }).check(Schema.isFinite()), + "creator_user_id": Schema.String.annotate({ + "description": + "The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID." + }), + "expires_at": Schema.optionalKey( + Schema.String.annotate({ + "description": "ISO 8601 UTC timestamp when the API key expires, or null if no expiration", + "format": "date-time" + }) ), - "origin": Schema.String.annotate({ "description": "Origin URL of the request" }), - "usage": Schema.Number.annotate({ "description": "Usage amount in USD" }).check(Schema.isFinite()), - "is_byok": Schema.Boolean.annotate({ "description": "Whether this used bring-your-own-key" }), - "native_finish_reason": Schema.String.annotate({ "description": "Native finish reason as reported by provider" }), - "external_user": Schema.String.annotate({ "description": "External user identifier" }), - "api_type": Schema.Literals(["completions", "embeddings"]).annotate({ - "description": "Type of API used for the generation" + "include_byok_in_limit": Schema.Boolean.annotate({ + "description": "Whether to include external BYOK usage in the credit limit" }), - "router": Schema.String.annotate({ "description": "Router used for the request (e.g., openrouter/auto)" }), - "provider_responses": Schema.Array(Schema.Struct({ - "id": Schema.optionalKey(Schema.String), - "endpoint_id": Schema.optionalKey(Schema.String), - "model_permaslug": Schema.optionalKey(Schema.String), - "provider_name": Schema.optionalKey( - Schema.Literals([ - "AnyScale", - "Atoma", - "Cent-ML", - "CrofAI", - "Enfer", - "GoPomelo", - "HuggingFace", - "Hyperbolic 2", - "InoCloud", - "Kluster", - "Lambda", - "Lepton", - "Lynn 2", - "Lynn", - "Mancer", - "Meta", - "Modal", - "Nineteen", - "OctoAI", - "Recursal", - "Reflection", - "Replicate", - "SambaNova 2", - "SF Compute", - "Targon", - "Together 2", - "Ubicloud", - "01.AI", - "AI21", - "AionLabs", - "Alibaba", - "Ambient", - "Amazon Bedrock", - "Amazon Nova", - "Anthropic", - "Arcee AI", - "AtlasCloud", - "Avian", - "Azure", - "BaseTen", - "BytePlus", - "Black Forest Labs", - "Cerebras", - "Chutes", - "Cirrascale", - "Clarifai", - "Cloudflare", - "Cohere", - "Crusoe", - "DeepInfra", - "DeepSeek", - "Featherless", - "Fireworks", - "Friendli", - "GMICloud", - "Google", - "Google AI Studio", - "Groq", - "Hyperbolic", - "Inception", - "Inceptron", - "InferenceNet", - "Infermatic", - "Io Net", - "Inflection", - "Liquid", - "Mara", - "Mancer 2", - "Minimax", - "ModelRun", - "Mistral", - "Modular", - "Moonshot AI", - "Morph", - "NCompass", - "Nebius", - "NextBit", - "Novita", - "Nvidia", - "OpenAI", - "OpenInference", - "Parasail", - "Perplexity", - "Phala", - "Relace", - "SambaNova", - "Seed", - "SiliconFlow", - "Sourceful", - "StepFun", - "Stealth", - "StreamLake", - "Switchpoint", - "Together", - "Upstage", - "Venice", - "WandB", - "Xiaomi", - "xAI", - "Z.AI", - "FakeProvider" - ]) - ), - "status": Schema.Number.check(Schema.isFinite()), - "latency": Schema.optionalKey(Schema.Number.check(Schema.isFinite())), - "is_byok": Schema.optionalKey(Schema.Boolean) - })).annotate({ "description": "List of provider responses for this generation, including fallback attempts" }) - }).annotate({ "description": "Generation data" }) -}).annotate({ "description": "Generation response" }) -export type GetGeneration401 = UnauthorizedResponse -export const GetGeneration401 = UnauthorizedResponse -export type GetGeneration402 = PaymentRequiredResponse -export const GetGeneration402 = PaymentRequiredResponse -export type GetGeneration404 = NotFoundResponse -export const GetGeneration404 = NotFoundResponse -export type GetGeneration429 = TooManyRequestsResponse -export const GetGeneration429 = TooManyRequestsResponse -export type GetGeneration500 = InternalServerResponse -export const GetGeneration500 = InternalServerResponse -export type GetGeneration502 = BadGatewayResponse -export const GetGeneration502 = BadGatewayResponse -export type GetGeneration524 = EdgeNetworkTimeoutResponse -export const GetGeneration524 = EdgeNetworkTimeoutResponse -export type GetGeneration529 = ProviderOverloadedResponse -export const GetGeneration529 = ProviderOverloadedResponse -export type ListModelsCount200 = ModelsCountResponse -export const ListModelsCount200 = ModelsCountResponse -export type ListModelsCount500 = InternalServerResponse -export const ListModelsCount500 = InternalServerResponse -export type GetModelsParams = { - readonly "category"?: - | "programming" - | "roleplay" - | "marketing" - | "marketing/seo" - | "technology" - | "science" - | "translation" - | "legal" - | "finance" - | "health" - | "trivia" - | "academia" - readonly "supported_parameters"?: string -} -export const GetModelsParams = Schema.Struct({ - "category": Schema.optionalKey( - Schema.Literals([ - "programming", - "roleplay", - "marketing", - "marketing/seo", - "technology", - "science", - "translation", - "legal", - "finance", - "health", - "trivia", - "academia" - ]).annotate({ "description": "Filter models by use case category" }) - ), - "supported_parameters": Schema.optionalKey(Schema.String) + "is_free_tier": Schema.Boolean.annotate({ "description": "Whether this is a free tier API key" }), + "is_management_key": Schema.Boolean.annotate({ "description": "Whether this is a management key" }), + "is_provisioning_key": Schema.Boolean.annotate({ "description": "Whether this is a management key" }), + "label": Schema.String.annotate({ "description": "Human-readable label for the API key" }), + "limit": Schema.Number.annotate({ "description": "Spending limit for the API key in USD", "format": "double" }) + .check(Schema.isFinite()), + "limit_remaining": Schema.Number.annotate({ "description": "Remaining spending limit in USD", "format": "double" }) + .check(Schema.isFinite()), + "limit_reset": Schema.String.annotate({ "description": "Type of limit reset for the API key" }), + "rate_limit": Schema.Struct({ + "interval": Schema.String.annotate({ "description": "Rate limit interval" }), + "note": Schema.String.annotate({ "description": "Note about the rate limit" }), + "requests": Schema.Number.annotate({ "description": "Number of requests allowed per interval" }).check( + Schema.isInt() + ) + }).annotate({ "description": "Legacy rate limit information about a key. Will always return -1." }), + "usage": Schema.Number.annotate({ + "description": "Total OpenRouter credit usage (in USD) for the API key", + "format": "double" + }).check(Schema.isFinite()), + "usage_daily": Schema.Number.annotate({ + "description": "OpenRouter credit usage (in USD) for the current UTC day", + "format": "double" + }).check(Schema.isFinite()), + "usage_monthly": Schema.Number.annotate({ + "description": "OpenRouter credit usage (in USD) for the current UTC month", + "format": "double" + }).check(Schema.isFinite()), + "usage_weekly": Schema.Number.annotate({ + "description": "OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)", + "format": "double" + }).check(Schema.isFinite()) + }).annotate({ "description": "Current API key information" }) }) -export type GetModels200 = ModelsListResponse -export const GetModels200 = ModelsListResponse -export type GetModels400 = BadRequestResponse -export const GetModels400 = BadRequestResponse -export type GetModels500 = InternalServerResponse -export const GetModels500 = InternalServerResponse -export type ListModelsUser200 = ModelsListResponse -export const ListModelsUser200 = ModelsListResponse -export type ListModelsUser401 = UnauthorizedResponse -export const ListModelsUser401 = UnauthorizedResponse -export type ListModelsUser404 = NotFoundResponse -export const ListModelsUser404 = NotFoundResponse -export type ListModelsUser500 = InternalServerResponse -export const ListModelsUser500 = InternalServerResponse -export type ListEndpoints200 = { readonly "data": ListEndpointsResponse } -export const ListEndpoints200 = Schema.Struct({ "data": ListEndpointsResponse }) -export type ListEndpoints404 = NotFoundResponse -export const ListEndpoints404 = NotFoundResponse -export type ListEndpoints500 = InternalServerResponse -export const ListEndpoints500 = InternalServerResponse -export type ListEndpointsZdr200 = { readonly "data": ReadonlyArray } -export const ListEndpointsZdr200 = Schema.Struct({ "data": Schema.Array(PublicEndpoint) }) -export type ListEndpointsZdr500 = InternalServerResponse -export const ListEndpointsZdr500 = InternalServerResponse -export type ListProviders200 = { - readonly "data": ReadonlyArray< - { - readonly "name": string - readonly "slug": string - readonly "privacy_policy_url": string - readonly "terms_of_service_url"?: string - readonly "status_page_url"?: string - } - > +export type GetCurrentKey401 = UnauthorizedResponse +export const GetCurrentKey401 = UnauthorizedResponse +export type GetCurrentKey500 = InternalServerResponse +export const GetCurrentKey500 = InternalServerResponse +export type ListParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string + readonly "include_disabled"?: boolean + readonly "offset"?: number + readonly "workspace_id"?: string } -export const ListProviders200 = Schema.Struct({ - "data": Schema.Array(Schema.Struct({ - "name": Schema.String.annotate({ "description": "Display name of the provider" }), - "slug": Schema.String.annotate({ "description": "URL-friendly identifier for the provider" }), - "privacy_policy_url": Schema.String.annotate({ "description": "URL to the provider's privacy policy" }), - "terms_of_service_url": Schema.optionalKey( - Schema.String.annotate({ "description": "URL to the provider's terms of service" }) - ), - "status_page_url": Schema.optionalKey( - Schema.String.annotate({ "description": "URL to the provider's status page" }) - ) - })) -}) -export type ListProviders500 = InternalServerResponse -export const ListProviders500 = InternalServerResponse -export type ListParams = { readonly "include_disabled"?: string; readonly "offset"?: string } export const ListParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String), "include_disabled": Schema.optionalKey( - Schema.String.annotate({ "description": "Whether to include disabled API keys in the response" }) + Schema.Boolean.annotate({ "description": "Whether to include disabled API keys in the response" }) + ), + "offset": Schema.optionalKey( + Schema.Number.annotate({ "description": "Number of API keys to skip for pagination" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) + ) ), - "offset": Schema.optionalKey(Schema.String.annotate({ "description": "Number of API keys to skip for pagination" })) + "workspace_id": Schema.optionalKey( + Schema.String.annotate({ + "description": "Filter API keys by workspace ID. By default, keys in the default workspace are returned.", + "format": "uuid" + }) + ) }) export type List200 = { readonly "data": ReadonlyArray< { + readonly "byok_usage": number + readonly "byok_usage_daily": number + readonly "byok_usage_monthly": number + readonly "byok_usage_weekly": number + readonly "created_at": string + readonly "creator_user_id": string + readonly "disabled": boolean + readonly "expires_at"?: string readonly "hash": string - readonly "name": string + readonly "include_byok_in_limit": boolean readonly "label": string - readonly "disabled": boolean readonly "limit": number readonly "limit_remaining": number readonly "limit_reset": string - readonly "include_byok_in_limit": boolean + readonly "name": string + readonly "updated_at": string readonly "usage": number readonly "usage_daily": number - readonly "usage_weekly": number readonly "usage_monthly": number - readonly "byok_usage": number - readonly "byok_usage_daily": number - readonly "byok_usage_weekly": number - readonly "byok_usage_monthly": number - readonly "created_at": string - readonly "updated_at": string - readonly "expires_at"?: string + readonly "usage_weekly": number + readonly "workspace_id": string } > } export const List200 = Schema.Struct({ "data": Schema.Array(Schema.Struct({ - "hash": Schema.String.annotate({ "description": "Unique hash identifier for the API key" }), - "name": Schema.String.annotate({ "description": "Name of the API key" }), - "label": Schema.String.annotate({ "description": "Human-readable label for the API key" }), - "disabled": Schema.Boolean.annotate({ "description": "Whether the API key is disabled" }), - "limit": Schema.Number.annotate({ "description": "Spending limit for the API key in USD" }).check( - Schema.isFinite() - ), - "limit_remaining": Schema.Number.annotate({ "description": "Remaining spending limit in USD" }).check( - Schema.isFinite() - ), - "limit_reset": Schema.String.annotate({ "description": "Type of limit reset for the API key" }), - "include_byok_in_limit": Schema.Boolean.annotate({ - "description": "Whether to include external BYOK usage in the credit limit" - }), - "usage": Schema.Number.annotate({ "description": "Total OpenRouter credit usage (in USD) for the API key" }).check( - Schema.isFinite() - ), - "usage_daily": Schema.Number.annotate({ "description": "OpenRouter credit usage (in USD) for the current UTC day" }) - .check(Schema.isFinite()), - "usage_weekly": Schema.Number.annotate({ - "description": "OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)" - }).check(Schema.isFinite()), - "usage_monthly": Schema.Number.annotate({ - "description": "OpenRouter credit usage (in USD) for the current UTC month" - }).check(Schema.isFinite()), - "byok_usage": Schema.Number.annotate({ "description": "Total external BYOK usage (in USD) for the API key" }).check( - Schema.isFinite() - ), - "byok_usage_daily": Schema.Number.annotate({ - "description": "External BYOK usage (in USD) for the current UTC day" + "byok_usage": Schema.Number.annotate({ + "description": "Total external BYOK usage (in USD) for the API key", + "format": "double" }).check(Schema.isFinite()), - "byok_usage_weekly": Schema.Number.annotate({ - "description": "External BYOK usage (in USD) for the current UTC week (Monday-Sunday)" + "byok_usage_daily": Schema.Number.annotate({ + "description": "External BYOK usage (in USD) for the current UTC day", + "format": "double" }).check(Schema.isFinite()), "byok_usage_monthly": Schema.Number.annotate({ - "description": "External BYOK usage (in USD) for current UTC month" + "description": "External BYOK usage (in USD) for current UTC month", + "format": "double" + }).check(Schema.isFinite()), + "byok_usage_weekly": Schema.Number.annotate({ + "description": "External BYOK usage (in USD) for the current UTC week (Monday-Sunday)", + "format": "double" }).check(Schema.isFinite()), "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the API key was created" }), - "updated_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the API key was last updated" }), + "creator_user_id": Schema.String.annotate({ + "description": + "The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID." + }), + "disabled": Schema.Boolean.annotate({ "description": "Whether the API key is disabled" }), "expires_at": Schema.optionalKey( Schema.String.annotate({ "description": "ISO 8601 UTC timestamp when the API key expires, or null if no expiration", "format": "date-time" }) - ) + ), + "hash": Schema.String.annotate({ "description": "Unique hash identifier for the API key" }), + "include_byok_in_limit": Schema.Boolean.annotate({ + "description": "Whether to include external BYOK usage in the credit limit" + }), + "label": Schema.String.annotate({ "description": "Human-readable label for the API key" }), + "limit": Schema.Number.annotate({ "description": "Spending limit for the API key in USD", "format": "double" }) + .check(Schema.isFinite()), + "limit_remaining": Schema.Number.annotate({ "description": "Remaining spending limit in USD", "format": "double" }) + .check(Schema.isFinite()), + "limit_reset": Schema.String.annotate({ "description": "Type of limit reset for the API key" }), + "name": Schema.String.annotate({ "description": "Name of the API key" }), + "updated_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the API key was last updated" }), + "usage": Schema.Number.annotate({ + "description": "Total OpenRouter credit usage (in USD) for the API key", + "format": "double" + }).check(Schema.isFinite()), + "usage_daily": Schema.Number.annotate({ + "description": "OpenRouter credit usage (in USD) for the current UTC day", + "format": "double" + }).check(Schema.isFinite()), + "usage_monthly": Schema.Number.annotate({ + "description": "OpenRouter credit usage (in USD) for the current UTC month", + "format": "double" + }).check(Schema.isFinite()), + "usage_weekly": Schema.Number.annotate({ + "description": "OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)", + "format": "double" + }).check(Schema.isFinite()), + "workspace_id": Schema.String.annotate({ "description": "The workspace ID this API key belongs to." }) })).annotate({ "description": "List of API keys" }) }) export type List401 = UnauthorizedResponse @@ -7829,106 +21497,145 @@ export type List429 = TooManyRequestsResponse export const List429 = TooManyRequestsResponse export type List500 = InternalServerResponse export const List500 = InternalServerResponse +export type CreateKeysParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const CreateKeysParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) export type CreateKeysRequestJson = { - readonly "name": string - readonly "limit"?: number - readonly "limit_reset"?: "daily" | "weekly" | "monthly" - readonly "include_byok_in_limit"?: boolean + readonly "creator_user_id"?: string readonly "expires_at"?: string + readonly "include_byok_in_limit"?: boolean + readonly "limit"?: number + readonly "limit_reset"?: "daily" | "weekly" | "monthly" | null + readonly "name": string + readonly "workspace_id"?: string } export const CreateKeysRequestJson = Schema.Struct({ - "name": Schema.String.annotate({ "description": "Name for the new API key" }).check(Schema.isMinLength(1)), - "limit": Schema.optionalKey( - Schema.Number.annotate({ "description": "Optional spending limit for the API key in USD" }).check(Schema.isFinite()) + "creator_user_id": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Optional user ID of the key creator. Only meaningful for organization-owned keys where a specific member is creating the key." + }).check(Schema.isMinLength(1)) ), - "limit_reset": Schema.optionalKey( - Schema.Literals(["daily", "weekly", "monthly"]).annotate({ + "expires_at": Schema.optionalKey( + Schema.String.annotate({ "description": - "Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday." + "Optional ISO 8601 UTC timestamp when the API key should expire. Must be UTC, other timezones will be rejected", + "format": "date-time" }) ), "include_byok_in_limit": Schema.optionalKey( Schema.Boolean.annotate({ "description": "Whether to include BYOK usage in the limit" }) ), - "expires_at": Schema.optionalKey( - Schema.String.annotate({ + "limit": Schema.optionalKey( + Schema.Number.annotate({ "description": "Optional spending limit for the API key in USD", "format": "double" }) + .check(Schema.isFinite()) + ), + "limit_reset": Schema.optionalKey( + Schema.Union([Schema.Literal("daily"), Schema.Literal("weekly"), Schema.Literal("monthly"), Schema.Null]).annotate({ "description": - "Optional ISO 8601 UTC timestamp when the API key should expire. Must be UTC, other timezones will be rejected", - "format": "date-time" + "Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday." + }) + ), + "name": Schema.String.annotate({ "description": "Name for the new API key" }).check(Schema.isMinLength(1)), + "workspace_id": Schema.optionalKey( + Schema.String.annotate({ + "description": "The workspace to create the API key in. Defaults to the default workspace if not provided.", + "format": "uuid" }) ) }) export type CreateKeys201 = { readonly "data": { + readonly "byok_usage": number + readonly "byok_usage_daily": number + readonly "byok_usage_monthly": number + readonly "byok_usage_weekly": number + readonly "created_at": string + readonly "creator_user_id": string + readonly "disabled": boolean + readonly "expires_at"?: string readonly "hash": string - readonly "name": string + readonly "include_byok_in_limit": boolean readonly "label": string - readonly "disabled": boolean readonly "limit": number readonly "limit_remaining": number readonly "limit_reset": string - readonly "include_byok_in_limit": boolean + readonly "name": string + readonly "updated_at": string readonly "usage": number readonly "usage_daily": number - readonly "usage_weekly": number readonly "usage_monthly": number - readonly "byok_usage": number - readonly "byok_usage_daily": number - readonly "byok_usage_weekly": number - readonly "byok_usage_monthly": number - readonly "created_at": string - readonly "updated_at": string - readonly "expires_at"?: string + readonly "usage_weekly": number + readonly "workspace_id": string } readonly "key": string } export const CreateKeys201 = Schema.Struct({ "data": Schema.Struct({ - "hash": Schema.String.annotate({ "description": "Unique hash identifier for the API key" }), - "name": Schema.String.annotate({ "description": "Name of the API key" }), - "label": Schema.String.annotate({ "description": "Human-readable label for the API key" }), - "disabled": Schema.Boolean.annotate({ "description": "Whether the API key is disabled" }), - "limit": Schema.Number.annotate({ "description": "Spending limit for the API key in USD" }).check( - Schema.isFinite() - ), - "limit_remaining": Schema.Number.annotate({ "description": "Remaining spending limit in USD" }).check( - Schema.isFinite() - ), - "limit_reset": Schema.String.annotate({ "description": "Type of limit reset for the API key" }), - "include_byok_in_limit": Schema.Boolean.annotate({ - "description": "Whether to include external BYOK usage in the credit limit" - }), - "usage": Schema.Number.annotate({ "description": "Total OpenRouter credit usage (in USD) for the API key" }).check( - Schema.isFinite() - ), - "usage_daily": Schema.Number.annotate({ "description": "OpenRouter credit usage (in USD) for the current UTC day" }) - .check(Schema.isFinite()), - "usage_weekly": Schema.Number.annotate({ - "description": "OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)" - }).check(Schema.isFinite()), - "usage_monthly": Schema.Number.annotate({ - "description": "OpenRouter credit usage (in USD) for the current UTC month" + "byok_usage": Schema.Number.annotate({ + "description": "Total external BYOK usage (in USD) for the API key", + "format": "double" }).check(Schema.isFinite()), - "byok_usage": Schema.Number.annotate({ "description": "Total external BYOK usage (in USD) for the API key" }).check( - Schema.isFinite() - ), "byok_usage_daily": Schema.Number.annotate({ - "description": "External BYOK usage (in USD) for the current UTC day" - }).check(Schema.isFinite()), - "byok_usage_weekly": Schema.Number.annotate({ - "description": "External BYOK usage (in USD) for the current UTC week (Monday-Sunday)" + "description": "External BYOK usage (in USD) for the current UTC day", + "format": "double" }).check(Schema.isFinite()), "byok_usage_monthly": Schema.Number.annotate({ - "description": "External BYOK usage (in USD) for current UTC month" + "description": "External BYOK usage (in USD) for current UTC month", + "format": "double" + }).check(Schema.isFinite()), + "byok_usage_weekly": Schema.Number.annotate({ + "description": "External BYOK usage (in USD) for the current UTC week (Monday-Sunday)", + "format": "double" }).check(Schema.isFinite()), "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the API key was created" }), - "updated_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the API key was last updated" }), + "creator_user_id": Schema.String.annotate({ + "description": + "The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID." + }), + "disabled": Schema.Boolean.annotate({ "description": "Whether the API key is disabled" }), "expires_at": Schema.optionalKey( Schema.String.annotate({ "description": "ISO 8601 UTC timestamp when the API key expires, or null if no expiration", "format": "date-time" }) - ) + ), + "hash": Schema.String.annotate({ "description": "Unique hash identifier for the API key" }), + "include_byok_in_limit": Schema.Boolean.annotate({ + "description": "Whether to include external BYOK usage in the credit limit" + }), + "label": Schema.String.annotate({ "description": "Human-readable label for the API key" }), + "limit": Schema.Number.annotate({ "description": "Spending limit for the API key in USD", "format": "double" }) + .check(Schema.isFinite()), + "limit_remaining": Schema.Number.annotate({ "description": "Remaining spending limit in USD", "format": "double" }) + .check(Schema.isFinite()), + "limit_reset": Schema.String.annotate({ "description": "Type of limit reset for the API key" }), + "name": Schema.String.annotate({ "description": "Name of the API key" }), + "updated_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the API key was last updated" }), + "usage": Schema.Number.annotate({ + "description": "Total OpenRouter credit usage (in USD) for the API key", + "format": "double" + }).check(Schema.isFinite()), + "usage_daily": Schema.Number.annotate({ + "description": "OpenRouter credit usage (in USD) for the current UTC day", + "format": "double" + }).check(Schema.isFinite()), + "usage_monthly": Schema.Number.annotate({ + "description": "OpenRouter credit usage (in USD) for the current UTC month", + "format": "double" + }).check(Schema.isFinite()), + "usage_weekly": Schema.Number.annotate({ + "description": "OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)", + "format": "double" + }).check(Schema.isFinite()), + "workspace_id": Schema.String.annotate({ "description": "The workspace ID this API key belongs to." }) }).annotate({ "description": "The created API key information" }), "key": Schema.String.annotate({ "description": "The actual API key string (only shown once)" }) }) @@ -7936,80 +21643,106 @@ export type CreateKeys400 = BadRequestResponse export const CreateKeys400 = BadRequestResponse export type CreateKeys401 = UnauthorizedResponse export const CreateKeys401 = UnauthorizedResponse +export type CreateKeys403 = ForbiddenResponse +export const CreateKeys403 = ForbiddenResponse export type CreateKeys429 = TooManyRequestsResponse export const CreateKeys429 = TooManyRequestsResponse export type CreateKeys500 = InternalServerResponse export const CreateKeys500 = InternalServerResponse +export type GetKeyParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const GetKeyParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) export type GetKey200 = { readonly "data": { + readonly "byok_usage": number + readonly "byok_usage_daily": number + readonly "byok_usage_monthly": number + readonly "byok_usage_weekly": number + readonly "created_at": string + readonly "creator_user_id": string + readonly "disabled": boolean + readonly "expires_at"?: string readonly "hash": string - readonly "name": string + readonly "include_byok_in_limit": boolean readonly "label": string - readonly "disabled": boolean readonly "limit": number readonly "limit_remaining": number readonly "limit_reset": string - readonly "include_byok_in_limit": boolean + readonly "name": string + readonly "updated_at": string readonly "usage": number readonly "usage_daily": number - readonly "usage_weekly": number readonly "usage_monthly": number - readonly "byok_usage": number - readonly "byok_usage_daily": number - readonly "byok_usage_weekly": number - readonly "byok_usage_monthly": number - readonly "created_at": string - readonly "updated_at": string - readonly "expires_at"?: string + readonly "usage_weekly": number + readonly "workspace_id": string } } export const GetKey200 = Schema.Struct({ "data": Schema.Struct({ - "hash": Schema.String.annotate({ "description": "Unique hash identifier for the API key" }), - "name": Schema.String.annotate({ "description": "Name of the API key" }), - "label": Schema.String.annotate({ "description": "Human-readable label for the API key" }), - "disabled": Schema.Boolean.annotate({ "description": "Whether the API key is disabled" }), - "limit": Schema.Number.annotate({ "description": "Spending limit for the API key in USD" }).check( - Schema.isFinite() - ), - "limit_remaining": Schema.Number.annotate({ "description": "Remaining spending limit in USD" }).check( - Schema.isFinite() - ), - "limit_reset": Schema.String.annotate({ "description": "Type of limit reset for the API key" }), - "include_byok_in_limit": Schema.Boolean.annotate({ - "description": "Whether to include external BYOK usage in the credit limit" - }), - "usage": Schema.Number.annotate({ "description": "Total OpenRouter credit usage (in USD) for the API key" }).check( - Schema.isFinite() - ), - "usage_daily": Schema.Number.annotate({ "description": "OpenRouter credit usage (in USD) for the current UTC day" }) - .check(Schema.isFinite()), - "usage_weekly": Schema.Number.annotate({ - "description": "OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)" - }).check(Schema.isFinite()), - "usage_monthly": Schema.Number.annotate({ - "description": "OpenRouter credit usage (in USD) for the current UTC month" + "byok_usage": Schema.Number.annotate({ + "description": "Total external BYOK usage (in USD) for the API key", + "format": "double" }).check(Schema.isFinite()), - "byok_usage": Schema.Number.annotate({ "description": "Total external BYOK usage (in USD) for the API key" }).check( - Schema.isFinite() - ), "byok_usage_daily": Schema.Number.annotate({ - "description": "External BYOK usage (in USD) for the current UTC day" - }).check(Schema.isFinite()), - "byok_usage_weekly": Schema.Number.annotate({ - "description": "External BYOK usage (in USD) for the current UTC week (Monday-Sunday)" + "description": "External BYOK usage (in USD) for the current UTC day", + "format": "double" }).check(Schema.isFinite()), "byok_usage_monthly": Schema.Number.annotate({ - "description": "External BYOK usage (in USD) for current UTC month" + "description": "External BYOK usage (in USD) for current UTC month", + "format": "double" + }).check(Schema.isFinite()), + "byok_usage_weekly": Schema.Number.annotate({ + "description": "External BYOK usage (in USD) for the current UTC week (Monday-Sunday)", + "format": "double" }).check(Schema.isFinite()), "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the API key was created" }), - "updated_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the API key was last updated" }), + "creator_user_id": Schema.String.annotate({ + "description": + "The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID." + }), + "disabled": Schema.Boolean.annotate({ "description": "Whether the API key is disabled" }), "expires_at": Schema.optionalKey( Schema.String.annotate({ "description": "ISO 8601 UTC timestamp when the API key expires, or null if no expiration", "format": "date-time" }) - ) + ), + "hash": Schema.String.annotate({ "description": "Unique hash identifier for the API key" }), + "include_byok_in_limit": Schema.Boolean.annotate({ + "description": "Whether to include external BYOK usage in the credit limit" + }), + "label": Schema.String.annotate({ "description": "Human-readable label for the API key" }), + "limit": Schema.Number.annotate({ "description": "Spending limit for the API key in USD", "format": "double" }) + .check(Schema.isFinite()), + "limit_remaining": Schema.Number.annotate({ "description": "Remaining spending limit in USD", "format": "double" }) + .check(Schema.isFinite()), + "limit_reset": Schema.String.annotate({ "description": "Type of limit reset for the API key" }), + "name": Schema.String.annotate({ "description": "Name of the API key" }), + "updated_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the API key was last updated" }), + "usage": Schema.Number.annotate({ + "description": "Total OpenRouter credit usage (in USD) for the API key", + "format": "double" + }).check(Schema.isFinite()), + "usage_daily": Schema.Number.annotate({ + "description": "OpenRouter credit usage (in USD) for the current UTC day", + "format": "double" + }).check(Schema.isFinite()), + "usage_monthly": Schema.Number.annotate({ + "description": "OpenRouter credit usage (in USD) for the current UTC month", + "format": "double" + }).check(Schema.isFinite()), + "usage_weekly": Schema.Number.annotate({ + "description": "OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)", + "format": "double" + }).check(Schema.isFinite()), + "workspace_id": Schema.String.annotate({ "description": "The workspace ID this API key belongs to." }) }).annotate({ "description": "The API key information" }) }) export type GetKey401 = UnauthorizedResponse @@ -8020,6 +21753,16 @@ export type GetKey429 = TooManyRequestsResponse export const GetKey429 = TooManyRequestsResponse export type GetKey500 = InternalServerResponse export const GetKey500 = InternalServerResponse +export type DeleteKeysParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const DeleteKeysParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) export type DeleteKeys200 = { readonly "deleted": true } export const DeleteKeys200 = Schema.Struct({ "deleted": Schema.Literal(true).annotate({ "description": "Confirmation that the API key was deleted" }) @@ -8032,99 +21775,125 @@ export type DeleteKeys429 = TooManyRequestsResponse export const DeleteKeys429 = TooManyRequestsResponse export type DeleteKeys500 = InternalServerResponse export const DeleteKeys500 = InternalServerResponse +export type UpdateKeysParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const UpdateKeysParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) export type UpdateKeysRequestJson = { - readonly "name"?: string readonly "disabled"?: boolean - readonly "limit"?: number - readonly "limit_reset"?: "daily" | "weekly" | "monthly" readonly "include_byok_in_limit"?: boolean + readonly "limit"?: number + readonly "limit_reset"?: "daily" | "weekly" | "monthly" | null + readonly "name"?: string } export const UpdateKeysRequestJson = Schema.Struct({ - "name": Schema.optionalKey(Schema.String.annotate({ "description": "New name for the API key" })), "disabled": Schema.optionalKey(Schema.Boolean.annotate({ "description": "Whether to disable the API key" })), + "include_byok_in_limit": Schema.optionalKey( + Schema.Boolean.annotate({ "description": "Whether to include BYOK usage in the limit" }) + ), "limit": Schema.optionalKey( - Schema.Number.annotate({ "description": "New spending limit for the API key in USD" }).check(Schema.isFinite()) + Schema.Number.annotate({ "description": "New spending limit for the API key in USD", "format": "double" }).check( + Schema.isFinite() + ) ), "limit_reset": Schema.optionalKey( - Schema.Literals(["daily", "weekly", "monthly"]).annotate({ + Schema.Union([Schema.Literal("daily"), Schema.Literal("weekly"), Schema.Literal("monthly"), Schema.Null]).annotate({ "description": "New limit reset type for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday." }) ), - "include_byok_in_limit": Schema.optionalKey( - Schema.Boolean.annotate({ "description": "Whether to include BYOK usage in the limit" }) - ) + "name": Schema.optionalKey(Schema.String.annotate({ "description": "New name for the API key" })) }) export type UpdateKeys200 = { readonly "data": { + readonly "byok_usage": number + readonly "byok_usage_daily": number + readonly "byok_usage_monthly": number + readonly "byok_usage_weekly": number + readonly "created_at": string + readonly "creator_user_id": string + readonly "disabled": boolean + readonly "expires_at"?: string readonly "hash": string - readonly "name": string + readonly "include_byok_in_limit": boolean readonly "label": string - readonly "disabled": boolean readonly "limit": number readonly "limit_remaining": number readonly "limit_reset": string - readonly "include_byok_in_limit": boolean + readonly "name": string + readonly "updated_at": string readonly "usage": number readonly "usage_daily": number - readonly "usage_weekly": number readonly "usage_monthly": number - readonly "byok_usage": number - readonly "byok_usage_daily": number - readonly "byok_usage_weekly": number - readonly "byok_usage_monthly": number - readonly "created_at": string - readonly "updated_at": string - readonly "expires_at"?: string + readonly "usage_weekly": number + readonly "workspace_id": string } } export const UpdateKeys200 = Schema.Struct({ "data": Schema.Struct({ - "hash": Schema.String.annotate({ "description": "Unique hash identifier for the API key" }), - "name": Schema.String.annotate({ "description": "Name of the API key" }), - "label": Schema.String.annotate({ "description": "Human-readable label for the API key" }), - "disabled": Schema.Boolean.annotate({ "description": "Whether the API key is disabled" }), - "limit": Schema.Number.annotate({ "description": "Spending limit for the API key in USD" }).check( - Schema.isFinite() - ), - "limit_remaining": Schema.Number.annotate({ "description": "Remaining spending limit in USD" }).check( - Schema.isFinite() - ), - "limit_reset": Schema.String.annotate({ "description": "Type of limit reset for the API key" }), - "include_byok_in_limit": Schema.Boolean.annotate({ - "description": "Whether to include external BYOK usage in the credit limit" - }), - "usage": Schema.Number.annotate({ "description": "Total OpenRouter credit usage (in USD) for the API key" }).check( - Schema.isFinite() - ), - "usage_daily": Schema.Number.annotate({ "description": "OpenRouter credit usage (in USD) for the current UTC day" }) - .check(Schema.isFinite()), - "usage_weekly": Schema.Number.annotate({ - "description": "OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)" - }).check(Schema.isFinite()), - "usage_monthly": Schema.Number.annotate({ - "description": "OpenRouter credit usage (in USD) for the current UTC month" + "byok_usage": Schema.Number.annotate({ + "description": "Total external BYOK usage (in USD) for the API key", + "format": "double" }).check(Schema.isFinite()), - "byok_usage": Schema.Number.annotate({ "description": "Total external BYOK usage (in USD) for the API key" }).check( - Schema.isFinite() - ), "byok_usage_daily": Schema.Number.annotate({ - "description": "External BYOK usage (in USD) for the current UTC day" - }).check(Schema.isFinite()), - "byok_usage_weekly": Schema.Number.annotate({ - "description": "External BYOK usage (in USD) for the current UTC week (Monday-Sunday)" + "description": "External BYOK usage (in USD) for the current UTC day", + "format": "double" }).check(Schema.isFinite()), "byok_usage_monthly": Schema.Number.annotate({ - "description": "External BYOK usage (in USD) for current UTC month" + "description": "External BYOK usage (in USD) for current UTC month", + "format": "double" + }).check(Schema.isFinite()), + "byok_usage_weekly": Schema.Number.annotate({ + "description": "External BYOK usage (in USD) for the current UTC week (Monday-Sunday)", + "format": "double" }).check(Schema.isFinite()), "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the API key was created" }), - "updated_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the API key was last updated" }), + "creator_user_id": Schema.String.annotate({ + "description": + "The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user's own ID." + }), + "disabled": Schema.Boolean.annotate({ "description": "Whether the API key is disabled" }), "expires_at": Schema.optionalKey( Schema.String.annotate({ "description": "ISO 8601 UTC timestamp when the API key expires, or null if no expiration", "format": "date-time" }) - ) + ), + "hash": Schema.String.annotate({ "description": "Unique hash identifier for the API key" }), + "include_byok_in_limit": Schema.Boolean.annotate({ + "description": "Whether to include external BYOK usage in the credit limit" + }), + "label": Schema.String.annotate({ "description": "Human-readable label for the API key" }), + "limit": Schema.Number.annotate({ "description": "Spending limit for the API key in USD", "format": "double" }) + .check(Schema.isFinite()), + "limit_remaining": Schema.Number.annotate({ "description": "Remaining spending limit in USD", "format": "double" }) + .check(Schema.isFinite()), + "limit_reset": Schema.String.annotate({ "description": "Type of limit reset for the API key" }), + "name": Schema.String.annotate({ "description": "Name of the API key" }), + "updated_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the API key was last updated" }), + "usage": Schema.Number.annotate({ + "description": "Total OpenRouter credit usage (in USD) for the API key", + "format": "double" + }).check(Schema.isFinite()), + "usage_daily": Schema.Number.annotate({ + "description": "OpenRouter credit usage (in USD) for the current UTC day", + "format": "double" + }).check(Schema.isFinite()), + "usage_monthly": Schema.Number.annotate({ + "description": "OpenRouter credit usage (in USD) for the current UTC month", + "format": "double" + }).check(Schema.isFinite()), + "usage_weekly": Schema.Number.annotate({ + "description": "OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)", + "format": "double" + }).check(Schema.isFinite()), + "workspace_id": Schema.String.annotate({ "description": "The workspace ID this API key belongs to." }) }).annotate({ "description": "The updated API key information" }) }) export type UpdateKeys400 = BadRequestResponse @@ -8137,961 +21906,2705 @@ export type UpdateKeys429 = TooManyRequestsResponse export const UpdateKeys429 = TooManyRequestsResponse export type UpdateKeys500 = InternalServerResponse export const UpdateKeys500 = InternalServerResponse -export type ListGuardrailsParams = { readonly "offset"?: string; readonly "limit"?: string } -export const ListGuardrailsParams = Schema.Struct({ - "offset": Schema.optionalKey(Schema.String.annotate({ "description": "Number of records to skip for pagination" })), - "limit": Schema.optionalKey( - Schema.String.annotate({ "description": "Maximum number of records to return (max 100)" }) - ) -}) -export type ListGuardrails200 = { - readonly "data": ReadonlyArray< - { - readonly "id": string - readonly "name": string - readonly "description"?: string - readonly "limit_usd"?: number - readonly "reset_interval"?: "daily" | "weekly" | "monthly" - readonly "allowed_providers"?: ReadonlyArray - readonly "allowed_models"?: ReadonlyArray - readonly "enforce_zdr"?: boolean - readonly "created_at": string - readonly "updated_at"?: string - } - > - readonly "total_count": number +export type CreateMessagesParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string + readonly "X-OpenRouter-Experimental-Metadata"?: MetadataLevel } -export const ListGuardrails200 = Schema.Struct({ - "data": Schema.Array(Schema.Struct({ - "id": Schema.String.annotate({ "description": "Unique identifier for the guardrail", "format": "uuid" }), - "name": Schema.String.annotate({ "description": "Name of the guardrail" }), - "description": Schema.optionalKey(Schema.String.annotate({ "description": "Description of the guardrail" })), - "limit_usd": Schema.optionalKey( - Schema.Number.annotate({ "description": "Spending limit in USD" }).check(Schema.isFinite()).check( - Schema.isGreaterThanOrEqualTo(0) - ) - ), - "reset_interval": Schema.optionalKey( - Schema.Literals(["daily", "weekly", "monthly"]).annotate({ - "description": "Interval at which the limit resets (daily, weekly, monthly)" - }) - ), - "allowed_providers": Schema.optionalKey( - Schema.Array(Schema.String).annotate({ "description": "List of allowed provider IDs" }) - ), - "allowed_models": Schema.optionalKey( - Schema.Array(Schema.String).annotate({ "description": "Array of model canonical_slugs (immutable identifiers)" }) - ), - "enforce_zdr": Schema.optionalKey( - Schema.Boolean.annotate({ "description": "Whether to enforce zero data retention" }) - ), - "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the guardrail was created" }), - "updated_at": Schema.optionalKey( - Schema.String.annotate({ "description": "ISO 8601 timestamp of when the guardrail was last updated" }) - ) - })).annotate({ "description": "List of guardrails" }), - "total_count": Schema.Number.annotate({ "description": "Total number of guardrails" }).check(Schema.isFinite()) +export const CreateMessagesParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String), + "X-OpenRouter-Experimental-Metadata": Schema.optionalKey(MetadataLevel) }) -export type ListGuardrails401 = UnauthorizedResponse -export const ListGuardrails401 = UnauthorizedResponse -export type ListGuardrails500 = InternalServerResponse -export const ListGuardrails500 = InternalServerResponse -export type CreateGuardrailRequestJson = { - readonly "name": string - readonly "description"?: string - readonly "limit_usd"?: number - readonly "reset_interval"?: "daily" | "weekly" | "monthly" - readonly "allowed_providers"?: ReadonlyArray - readonly "allowed_models"?: ReadonlyArray - readonly "enforce_zdr"?: boolean +export type CreateMessagesRequestJson = MessagesRequest +export const CreateMessagesRequestJson = MessagesRequest +export type CreateMessages200 = MessagesResult +export const CreateMessages200 = MessagesResult +export type CreateMessages200Sse = MessagesStreamingResponse +export const CreateMessages200Sse = MessagesStreamingResponse +export type CreateMessages400 = MessagesErrorResponse +export const CreateMessages400 = MessagesErrorResponse +export type CreateMessages401 = MessagesErrorResponse +export const CreateMessages401 = MessagesErrorResponse +export type CreateMessages403 = ForbiddenResponse +export const CreateMessages403 = ForbiddenResponse +export type CreateMessages404 = MessagesErrorResponse +export const CreateMessages404 = MessagesErrorResponse +export type CreateMessages429 = MessagesErrorResponse +export const CreateMessages429 = MessagesErrorResponse +export type CreateMessages500 = MessagesErrorResponse +export const CreateMessages500 = MessagesErrorResponse +export type CreateMessages503 = MessagesErrorResponse +export const CreateMessages503 = MessagesErrorResponse +export type CreateMessages529 = MessagesErrorResponse +export const CreateMessages529 = MessagesErrorResponse +export type GetModelsParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string + readonly "category"?: + | "programming" + | "roleplay" + | "marketing" + | "marketing/seo" + | "technology" + | "science" + | "translation" + | "legal" + | "finance" + | "health" + | "trivia" + | "academia" + readonly "supported_parameters"?: string + readonly "output_modalities"?: string } -export const CreateGuardrailRequestJson = Schema.Struct({ - "name": Schema.String.annotate({ "description": "Name for the new guardrail" }).check(Schema.isMinLength(1)).check( - Schema.isMaxLength(200) - ), - "description": Schema.optionalKey( - Schema.String.annotate({ "description": "Description of the guardrail" }).check(Schema.isMaxLength(1000)) +export const GetModelsParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String), + "category": Schema.optionalKey( + Schema.Literals([ + "programming", + "roleplay", + "marketing", + "marketing/seo", + "technology", + "science", + "translation", + "legal", + "finance", + "health", + "trivia", + "academia" + ]).annotate({ "description": "Filter models by use case category" }) ), - "limit_usd": Schema.optionalKey( - Schema.Number.annotate({ "description": "Spending limit in USD" }).check(Schema.isFinite()).check( - Schema.isGreaterThanOrEqualTo(0) - ) + "supported_parameters": Schema.optionalKey( + Schema.String.annotate({ "description": "Filter models by supported parameter (comma-separated)" }) ), - "reset_interval": Schema.optionalKey( - Schema.Literals(["daily", "weekly", "monthly"]).annotate({ - "description": "Interval at which the limit resets (daily, weekly, monthly)" + "output_modalities": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\"." }) - ), - "allowed_providers": Schema.optionalKey( - Schema.Array(Schema.String).annotate({ "description": "List of allowed provider IDs" }).check(Schema.isMinLength(1)) - ), - "allowed_models": Schema.optionalKey( - Schema.Array(Schema.String).annotate({ - "description": "Array of model identifiers (slug or canonical_slug accepted)" - }).check(Schema.isMinLength(1)) - ), - "enforce_zdr": Schema.optionalKey( - Schema.Boolean.annotate({ "description": "Whether to enforce zero data retention" }) ) }) -export type CreateGuardrail201 = { - readonly "data": { - readonly "id": string - readonly "name": string - readonly "description"?: string - readonly "limit_usd"?: number - readonly "reset_interval"?: "daily" | "weekly" | "monthly" - readonly "allowed_providers"?: ReadonlyArray - readonly "allowed_models"?: ReadonlyArray - readonly "enforce_zdr"?: boolean - readonly "created_at": string - readonly "updated_at"?: string - } +export type GetModels200 = ModelsListResponse +export const GetModels200 = ModelsListResponse +export type GetModels400 = BadRequestResponse +export const GetModels400 = BadRequestResponse +export type GetModels500 = InternalServerResponse +export const GetModels500 = InternalServerResponse +export type ListEndpointsParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string } -export const CreateGuardrail201 = Schema.Struct({ - "data": Schema.Struct({ - "id": Schema.String.annotate({ "description": "Unique identifier for the guardrail", "format": "uuid" }), - "name": Schema.String.annotate({ "description": "Name of the guardrail" }), - "description": Schema.optionalKey(Schema.String.annotate({ "description": "Description of the guardrail" })), - "limit_usd": Schema.optionalKey( - Schema.Number.annotate({ "description": "Spending limit in USD" }).check(Schema.isFinite()).check( - Schema.isGreaterThanOrEqualTo(0) - ) - ), - "reset_interval": Schema.optionalKey( - Schema.Literals(["daily", "weekly", "monthly"]).annotate({ - "description": "Interval at which the limit resets (daily, weekly, monthly)" - }) - ), - "allowed_providers": Schema.optionalKey( - Schema.Array(Schema.String).annotate({ "description": "List of allowed provider IDs" }) - ), - "allowed_models": Schema.optionalKey( - Schema.Array(Schema.String).annotate({ "description": "Array of model canonical_slugs (immutable identifiers)" }) - ), - "enforce_zdr": Schema.optionalKey( - Schema.Boolean.annotate({ "description": "Whether to enforce zero data retention" }) - ), - "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the guardrail was created" }), - "updated_at": Schema.optionalKey( - Schema.String.annotate({ "description": "ISO 8601 timestamp of when the guardrail was last updated" }) - ) - }).annotate({ "description": "The created guardrail" }) +export const ListEndpointsParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) }) -export type CreateGuardrail400 = BadRequestResponse -export const CreateGuardrail400 = BadRequestResponse -export type CreateGuardrail401 = UnauthorizedResponse -export const CreateGuardrail401 = UnauthorizedResponse -export type CreateGuardrail500 = InternalServerResponse -export const CreateGuardrail500 = InternalServerResponse -export type GetGuardrail200 = { - readonly "data": { - readonly "id": string - readonly "name": string - readonly "description"?: string - readonly "limit_usd"?: number - readonly "reset_interval"?: "daily" | "weekly" | "monthly" - readonly "allowed_providers"?: ReadonlyArray - readonly "allowed_models"?: ReadonlyArray - readonly "enforce_zdr"?: boolean - readonly "created_at": string - readonly "updated_at"?: string - } +export type ListEndpoints200 = { readonly "data": ListEndpointsResponse } +export const ListEndpoints200 = Schema.Struct({ "data": ListEndpointsResponse }) +export type ListEndpoints404 = NotFoundResponse +export const ListEndpoints404 = NotFoundResponse +export type ListEndpoints500 = InternalServerResponse +export const ListEndpoints500 = InternalServerResponse +export type ListModelsCountParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string + readonly "output_modalities"?: string } -export const GetGuardrail200 = Schema.Struct({ - "data": Schema.Struct({ - "id": Schema.String.annotate({ "description": "Unique identifier for the guardrail", "format": "uuid" }), - "name": Schema.String.annotate({ "description": "Name of the guardrail" }), - "description": Schema.optionalKey(Schema.String.annotate({ "description": "Description of the guardrail" })), - "limit_usd": Schema.optionalKey( - Schema.Number.annotate({ "description": "Spending limit in USD" }).check(Schema.isFinite()).check( - Schema.isGreaterThanOrEqualTo(0) - ) - ), - "reset_interval": Schema.optionalKey( - Schema.Literals(["daily", "weekly", "monthly"]).annotate({ - "description": "Interval at which the limit resets (daily, weekly, monthly)" - }) - ), - "allowed_providers": Schema.optionalKey( - Schema.Array(Schema.String).annotate({ "description": "List of allowed provider IDs" }) - ), - "allowed_models": Schema.optionalKey( - Schema.Array(Schema.String).annotate({ "description": "Array of model canonical_slugs (immutable identifiers)" }) - ), - "enforce_zdr": Schema.optionalKey( - Schema.Boolean.annotate({ "description": "Whether to enforce zero data retention" }) - ), - "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the guardrail was created" }), - "updated_at": Schema.optionalKey( - Schema.String.annotate({ "description": "ISO 8601 timestamp of when the guardrail was last updated" }) - ) - }).annotate({ "description": "The guardrail" }) -}) -export type GetGuardrail401 = UnauthorizedResponse -export const GetGuardrail401 = UnauthorizedResponse -export type GetGuardrail404 = NotFoundResponse -export const GetGuardrail404 = NotFoundResponse -export type GetGuardrail500 = InternalServerResponse -export const GetGuardrail500 = InternalServerResponse -export type DeleteGuardrail200 = { readonly "deleted": true } -export const DeleteGuardrail200 = Schema.Struct({ - "deleted": Schema.Literal(true).annotate({ "description": "Confirmation that the guardrail was deleted" }) +export const ListModelsCountParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String), + "output_modalities": Schema.optionalKey( + Schema.String.annotate({ + "description": + "Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or \"all\" to include all models. Defaults to \"text\"." + }) + ) }) -export type DeleteGuardrail401 = UnauthorizedResponse -export const DeleteGuardrail401 = UnauthorizedResponse -export type DeleteGuardrail404 = NotFoundResponse -export const DeleteGuardrail404 = NotFoundResponse -export type DeleteGuardrail500 = InternalServerResponse -export const DeleteGuardrail500 = InternalServerResponse -export type UpdateGuardrailRequestJson = { - readonly "name"?: string - readonly "description"?: string - readonly "limit_usd"?: number - readonly "reset_interval"?: "daily" | "weekly" | "monthly" - readonly "allowed_providers"?: ReadonlyArray - readonly "allowed_models"?: ReadonlyArray - readonly "enforce_zdr"?: boolean +export type ListModelsCount200 = ModelsCountResponse +export const ListModelsCount200 = ModelsCountResponse +export type ListModelsCount400 = BadRequestResponse +export const ListModelsCount400 = BadRequestResponse +export type ListModelsCount500 = InternalServerResponse +export const ListModelsCount500 = InternalServerResponse +export type ListModelsUserParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string } -export const UpdateGuardrailRequestJson = Schema.Struct({ - "name": Schema.optionalKey( - Schema.String.annotate({ "description": "New name for the guardrail" }).check(Schema.isMinLength(1)).check( - Schema.isMaxLength(200) - ) - ), - "description": Schema.optionalKey( - Schema.String.annotate({ "description": "New description for the guardrail" }).check(Schema.isMaxLength(1000)) - ), - "limit_usd": Schema.optionalKey( - Schema.Number.annotate({ "description": "New spending limit in USD" }).check(Schema.isFinite()).check( - Schema.isGreaterThanOrEqualTo(0) - ) - ), - "reset_interval": Schema.optionalKey( - Schema.Literals(["daily", "weekly", "monthly"]).annotate({ - "description": "Interval at which the limit resets (daily, weekly, monthly)" - }) - ), - "allowed_providers": Schema.optionalKey( - Schema.Array(Schema.String).annotate({ "description": "New list of allowed provider IDs" }).check( - Schema.isMinLength(1) +export const ListModelsUserParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) +export type ListModelsUser200 = ModelsListResponse +export const ListModelsUser200 = ModelsListResponse +export type ListModelsUser401 = UnauthorizedResponse +export const ListModelsUser401 = UnauthorizedResponse +export type ListModelsUser404 = NotFoundResponse +export const ListModelsUser404 = NotFoundResponse +export type ListModelsUser500 = InternalServerResponse +export const ListModelsUser500 = InternalServerResponse +export type ListObservabilityDestinationsParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string + readonly "offset"?: number + readonly "limit"?: number + readonly "workspace_id"?: string +} +export const ListObservabilityDestinationsParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String), + "offset": Schema.optionalKey( + Schema.Number.annotate({ "description": "Number of records to skip for pagination" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) ) ), - "allowed_models": Schema.optionalKey( - Schema.Array(Schema.String).annotate({ - "description": "Array of model identifiers (slug or canonical_slug accepted)" - }).check(Schema.isMinLength(1)) + "limit": Schema.optionalKey( + Schema.Number.annotate({ "description": "Maximum number of records to return (max 100)" }).check(Schema.isInt()) + .check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(100)) ), - "enforce_zdr": Schema.optionalKey( - Schema.Boolean.annotate({ "description": "Whether to enforce zero data retention" }) + "workspace_id": Schema.optionalKey( + Schema.String.annotate({ + "description": "Optional workspace ID to filter by. Defaults to the authenticated entity's default workspace.", + "format": "uuid" + }) ) }) -export type UpdateGuardrail200 = { - readonly "data": { - readonly "id": string - readonly "name": string - readonly "description"?: string - readonly "limit_usd"?: number - readonly "reset_interval"?: "daily" | "weekly" | "monthly" - readonly "allowed_providers"?: ReadonlyArray - readonly "allowed_models"?: ReadonlyArray - readonly "enforce_zdr"?: boolean - readonly "created_at": string - readonly "updated_at"?: string - } +export type ListObservabilityDestinations200 = ListObservabilityDestinationsResponse +export const ListObservabilityDestinations200 = ListObservabilityDestinationsResponse +export type ListObservabilityDestinations401 = UnauthorizedResponse +export const ListObservabilityDestinations401 = UnauthorizedResponse +export type ListObservabilityDestinations500 = InternalServerResponse +export const ListObservabilityDestinations500 = InternalServerResponse +export type CreateObservabilityDestinationParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string } -export const UpdateGuardrail200 = Schema.Struct({ - "data": Schema.Struct({ - "id": Schema.String.annotate({ "description": "Unique identifier for the guardrail", "format": "uuid" }), - "name": Schema.String.annotate({ "description": "Name of the guardrail" }), - "description": Schema.optionalKey(Schema.String.annotate({ "description": "Description of the guardrail" })), - "limit_usd": Schema.optionalKey( - Schema.Number.annotate({ "description": "Spending limit in USD" }).check(Schema.isFinite()).check( - Schema.isGreaterThanOrEqualTo(0) - ) - ), - "reset_interval": Schema.optionalKey( - Schema.Literals(["daily", "weekly", "monthly"]).annotate({ - "description": "Interval at which the limit resets (daily, weekly, monthly)" - }) - ), - "allowed_providers": Schema.optionalKey( - Schema.Array(Schema.String).annotate({ "description": "List of allowed provider IDs" }) - ), - "allowed_models": Schema.optionalKey( - Schema.Array(Schema.String).annotate({ "description": "Array of model canonical_slugs (immutable identifiers)" }) - ), - "enforce_zdr": Schema.optionalKey( - Schema.Boolean.annotate({ "description": "Whether to enforce zero data retention" }) - ), - "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the guardrail was created" }), - "updated_at": Schema.optionalKey( - Schema.String.annotate({ "description": "ISO 8601 timestamp of when the guardrail was last updated" }) - ) - }).annotate({ "description": "The updated guardrail" }) +export const CreateObservabilityDestinationParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) }) -export type UpdateGuardrail400 = BadRequestResponse -export const UpdateGuardrail400 = BadRequestResponse -export type UpdateGuardrail401 = UnauthorizedResponse -export const UpdateGuardrail401 = UnauthorizedResponse -export type UpdateGuardrail404 = NotFoundResponse -export const UpdateGuardrail404 = NotFoundResponse -export type UpdateGuardrail500 = InternalServerResponse -export const UpdateGuardrail500 = InternalServerResponse -export type ListKeyAssignmentsParams = { readonly "offset"?: string; readonly "limit"?: string } -export const ListKeyAssignmentsParams = Schema.Struct({ - "offset": Schema.optionalKey(Schema.String.annotate({ "description": "Number of records to skip for pagination" })), +export type CreateObservabilityDestinationRequestJson = CreateObservabilityDestinationRequest +export const CreateObservabilityDestinationRequestJson = CreateObservabilityDestinationRequest +export type CreateObservabilityDestination201 = CreateObservabilityDestinationResponse +export const CreateObservabilityDestination201 = CreateObservabilityDestinationResponse +export type CreateObservabilityDestination400 = BadRequestResponse +export const CreateObservabilityDestination400 = BadRequestResponse +export type CreateObservabilityDestination401 = UnauthorizedResponse +export const CreateObservabilityDestination401 = UnauthorizedResponse +export type CreateObservabilityDestination403 = ForbiddenResponse +export const CreateObservabilityDestination403 = ForbiddenResponse +export type CreateObservabilityDestination409 = ConflictResponse +export const CreateObservabilityDestination409 = ConflictResponse +export type CreateObservabilityDestination500 = InternalServerResponse +export const CreateObservabilityDestination500 = InternalServerResponse +export type GetObservabilityDestinationParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const GetObservabilityDestinationParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) +export type GetObservabilityDestination200 = GetObservabilityDestinationResponse +export const GetObservabilityDestination200 = GetObservabilityDestinationResponse +export type GetObservabilityDestination401 = UnauthorizedResponse +export const GetObservabilityDestination401 = UnauthorizedResponse +export type GetObservabilityDestination404 = NotFoundResponse +export const GetObservabilityDestination404 = NotFoundResponse +export type GetObservabilityDestination500 = InternalServerResponse +export const GetObservabilityDestination500 = InternalServerResponse +export type DeleteObservabilityDestinationParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const DeleteObservabilityDestinationParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) +export type DeleteObservabilityDestination200 = DeleteObservabilityDestinationResponse +export const DeleteObservabilityDestination200 = DeleteObservabilityDestinationResponse +export type DeleteObservabilityDestination401 = UnauthorizedResponse +export const DeleteObservabilityDestination401 = UnauthorizedResponse +export type DeleteObservabilityDestination404 = NotFoundResponse +export const DeleteObservabilityDestination404 = NotFoundResponse +export type DeleteObservabilityDestination500 = InternalServerResponse +export const DeleteObservabilityDestination500 = InternalServerResponse +export type UpdateObservabilityDestinationParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const UpdateObservabilityDestinationParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) +export type UpdateObservabilityDestinationRequestJson = UpdateObservabilityDestinationRequest +export const UpdateObservabilityDestinationRequestJson = UpdateObservabilityDestinationRequest +export type UpdateObservabilityDestination200 = UpdateObservabilityDestinationResponse +export const UpdateObservabilityDestination200 = UpdateObservabilityDestinationResponse +export type UpdateObservabilityDestination400 = BadRequestResponse +export const UpdateObservabilityDestination400 = BadRequestResponse +export type UpdateObservabilityDestination401 = UnauthorizedResponse +export const UpdateObservabilityDestination401 = UnauthorizedResponse +export type UpdateObservabilityDestination404 = NotFoundResponse +export const UpdateObservabilityDestination404 = NotFoundResponse +export type UpdateObservabilityDestination409 = ConflictResponse +export const UpdateObservabilityDestination409 = ConflictResponse +export type UpdateObservabilityDestination500 = InternalServerResponse +export const UpdateObservabilityDestination500 = InternalServerResponse +export type ListOrganizationMembersParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string + readonly "offset"?: number + readonly "limit"?: number +} +export const ListOrganizationMembersParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String), + "offset": Schema.optionalKey( + Schema.Number.annotate({ "description": "Number of records to skip for pagination" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) + ) + ), "limit": Schema.optionalKey( - Schema.String.annotate({ "description": "Maximum number of records to return (max 100)" }) + Schema.Number.annotate({ "description": "Maximum number of records to return (max 100)" }).check(Schema.isInt()) + .check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(100)) ) }) -export type ListKeyAssignments200 = { +export type ListOrganizationMembers200 = { readonly "data": ReadonlyArray< { + readonly "email": string + readonly "first_name": string readonly "id": string - readonly "key_hash": string - readonly "guardrail_id": string - readonly "key_name": string - readonly "key_label": string - readonly "assigned_by": string - readonly "created_at": string + readonly "last_name": string + readonly "role": "org:admin" | "org:member" } > readonly "total_count": number } -export const ListKeyAssignments200 = Schema.Struct({ - "data": Schema.Array(Schema.Struct({ - "id": Schema.String.annotate({ "description": "Unique identifier for the assignment", "format": "uuid" }), - "key_hash": Schema.String.annotate({ "description": "Hash of the assigned API key" }), - "guardrail_id": Schema.String.annotate({ "description": "ID of the guardrail", "format": "uuid" }), - "key_name": Schema.String.annotate({ "description": "Name of the API key" }), - "key_label": Schema.String.annotate({ "description": "Label of the API key" }), - "assigned_by": Schema.String.annotate({ "description": "User ID of who made the assignment" }), - "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the assignment was created" }) - })).annotate({ "description": "List of key assignments" }), - "total_count": Schema.Number.annotate({ "description": "Total number of key assignments for this guardrail" }).check( - Schema.isFinite() - ) -}) -export type ListKeyAssignments401 = UnauthorizedResponse -export const ListKeyAssignments401 = UnauthorizedResponse -export type ListKeyAssignments500 = InternalServerResponse -export const ListKeyAssignments500 = InternalServerResponse -export type ListMemberAssignmentsParams = { readonly "offset"?: string; readonly "limit"?: string } -export const ListMemberAssignmentsParams = Schema.Struct({ - "offset": Schema.optionalKey(Schema.String.annotate({ "description": "Number of records to skip for pagination" })), - "limit": Schema.optionalKey( - Schema.String.annotate({ "description": "Maximum number of records to return (max 100)" }) - ) +export const ListOrganizationMembers200 = Schema.Struct({ + "data": Schema.Array(Schema.Struct({ + "email": Schema.String.annotate({ "description": "Email address of the member" }), + "first_name": Schema.String.annotate({ "description": "First name of the member" }), + "id": Schema.String.annotate({ "description": "User ID of the organization member" }), + "last_name": Schema.String.annotate({ "description": "Last name of the member" }), + "role": Schema.Literals(["org:admin", "org:member"]).annotate({ + "description": "Role of the member in the organization" + }) + })).annotate({ "description": "List of organization members" }), + "total_count": Schema.Number.annotate({ "description": "Total number of members in the organization" }).check( + Schema.isInt() + ) +}) +export type ListOrganizationMembers401 = UnauthorizedResponse +export const ListOrganizationMembers401 = UnauthorizedResponse +export type ListOrganizationMembers404 = NotFoundResponse +export const ListOrganizationMembers404 = NotFoundResponse +export type ListOrganizationMembers500 = InternalServerResponse +export const ListOrganizationMembers500 = InternalServerResponse +export type CreatePresetsChatCompletionsParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const CreatePresetsChatCompletionsParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) +export type CreatePresetsChatCompletionsRequestJson = ChatRequest +export const CreatePresetsChatCompletionsRequestJson = ChatRequest +export type CreatePresetsChatCompletions200 = CreatePresetFromInferenceResponse +export const CreatePresetsChatCompletions200 = CreatePresetFromInferenceResponse +export type CreatePresetsChatCompletions400 = BadRequestResponse +export const CreatePresetsChatCompletions400 = BadRequestResponse +export type CreatePresetsChatCompletions401 = UnauthorizedResponse +export const CreatePresetsChatCompletions401 = UnauthorizedResponse +export type CreatePresetsChatCompletions403 = ForbiddenResponse +export const CreatePresetsChatCompletions403 = ForbiddenResponse +export type CreatePresetsChatCompletions404 = NotFoundResponse +export const CreatePresetsChatCompletions404 = NotFoundResponse +export type CreatePresetsChatCompletions409 = ConflictResponse +export const CreatePresetsChatCompletions409 = ConflictResponse +export type CreatePresetsChatCompletions500 = InternalServerResponse +export const CreatePresetsChatCompletions500 = InternalServerResponse +export type ListProvidersParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const ListProvidersParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) +export type ListProviders200 = { + readonly "data": ReadonlyArray< + { + readonly "datacenters"?: ReadonlyArray< + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW" + > + readonly "headquarters"?: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW" + | null + readonly "name": string + readonly "privacy_policy_url": string + readonly "slug": string + readonly "status_page_url"?: string + readonly "terms_of_service_url"?: string + } + > +} +export const ListProviders200 = Schema.Struct({ + "data": Schema.Array(Schema.Struct({ + "datacenters": Schema.optionalKey( + Schema.Array( + Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW" + ]) + ).annotate({ "description": "ISO 3166-1 Alpha-2 country codes of the provider datacenter locations" }) + ), + "headquarters": Schema.optionalKey( + Schema.Union([ + Schema.Literal("AD"), + Schema.Literal("AE"), + Schema.Literal("AF"), + Schema.Literal("AG"), + Schema.Literal("AI"), + Schema.Literal("AL"), + Schema.Literal("AM"), + Schema.Literal("AO"), + Schema.Literal("AQ"), + Schema.Literal("AR"), + Schema.Literal("AS"), + Schema.Literal("AT"), + Schema.Literal("AU"), + Schema.Literal("AW"), + Schema.Literal("AX"), + Schema.Literal("AZ"), + Schema.Literal("BA"), + Schema.Literal("BB"), + Schema.Literal("BD"), + Schema.Literal("BE"), + Schema.Literal("BF"), + Schema.Literal("BG"), + Schema.Literal("BH"), + Schema.Literal("BI"), + Schema.Literal("BJ"), + Schema.Literal("BL"), + Schema.Literal("BM"), + Schema.Literal("BN"), + Schema.Literal("BO"), + Schema.Literal("BQ"), + Schema.Literal("BR"), + Schema.Literal("BS"), + Schema.Literal("BT"), + Schema.Literal("BV"), + Schema.Literal("BW"), + Schema.Literal("BY"), + Schema.Literal("BZ"), + Schema.Literal("CA"), + Schema.Literal("CC"), + Schema.Literal("CD"), + Schema.Literal("CF"), + Schema.Literal("CG"), + Schema.Literal("CH"), + Schema.Literal("CI"), + Schema.Literal("CK"), + Schema.Literal("CL"), + Schema.Literal("CM"), + Schema.Literal("CN"), + Schema.Literal("CO"), + Schema.Literal("CR"), + Schema.Literal("CU"), + Schema.Literal("CV"), + Schema.Literal("CW"), + Schema.Literal("CX"), + Schema.Literal("CY"), + Schema.Literal("CZ"), + Schema.Literal("DE"), + Schema.Literal("DJ"), + Schema.Literal("DK"), + Schema.Literal("DM"), + Schema.Literal("DO"), + Schema.Literal("DZ"), + Schema.Literal("EC"), + Schema.Literal("EE"), + Schema.Literal("EG"), + Schema.Literal("EH"), + Schema.Literal("ER"), + Schema.Literal("ES"), + Schema.Literal("ET"), + Schema.Literal("FI"), + Schema.Literal("FJ"), + Schema.Literal("FK"), + Schema.Literal("FM"), + Schema.Literal("FO"), + Schema.Literal("FR"), + Schema.Literal("GA"), + Schema.Literal("GB"), + Schema.Literal("GD"), + Schema.Literal("GE"), + Schema.Literal("GF"), + Schema.Literal("GG"), + Schema.Literal("GH"), + Schema.Literal("GI"), + Schema.Literal("GL"), + Schema.Literal("GM"), + Schema.Literal("GN"), + Schema.Literal("GP"), + Schema.Literal("GQ"), + Schema.Literal("GR"), + Schema.Literal("GS"), + Schema.Literal("GT"), + Schema.Literal("GU"), + Schema.Literal("GW"), + Schema.Literal("GY"), + Schema.Literal("HK"), + Schema.Literal("HM"), + Schema.Literal("HN"), + Schema.Literal("HR"), + Schema.Literal("HT"), + Schema.Literal("HU"), + Schema.Literal("ID"), + Schema.Literal("IE"), + Schema.Literal("IL"), + Schema.Literal("IM"), + Schema.Literal("IN"), + Schema.Literal("IO"), + Schema.Literal("IQ"), + Schema.Literal("IR"), + Schema.Literal("IS"), + Schema.Literal("IT"), + Schema.Literal("JE"), + Schema.Literal("JM"), + Schema.Literal("JO"), + Schema.Literal("JP"), + Schema.Literal("KE"), + Schema.Literal("KG"), + Schema.Literal("KH"), + Schema.Literal("KI"), + Schema.Literal("KM"), + Schema.Literal("KN"), + Schema.Literal("KP"), + Schema.Literal("KR"), + Schema.Literal("KW"), + Schema.Literal("KY"), + Schema.Literal("KZ"), + Schema.Literal("LA"), + Schema.Literal("LB"), + Schema.Literal("LC"), + Schema.Literal("LI"), + Schema.Literal("LK"), + Schema.Literal("LR"), + Schema.Literal("LS"), + Schema.Literal("LT"), + Schema.Literal("LU"), + Schema.Literal("LV"), + Schema.Literal("LY"), + Schema.Literal("MA"), + Schema.Literal("MC"), + Schema.Literal("MD"), + Schema.Literal("ME"), + Schema.Literal("MF"), + Schema.Literal("MG"), + Schema.Literal("MH"), + Schema.Literal("MK"), + Schema.Literal("ML"), + Schema.Literal("MM"), + Schema.Literal("MN"), + Schema.Literal("MO"), + Schema.Literal("MP"), + Schema.Literal("MQ"), + Schema.Literal("MR"), + Schema.Literal("MS"), + Schema.Literal("MT"), + Schema.Literal("MU"), + Schema.Literal("MV"), + Schema.Literal("MW"), + Schema.Literal("MX"), + Schema.Literal("MY"), + Schema.Literal("MZ"), + Schema.Literal("NA"), + Schema.Literal("NC"), + Schema.Literal("NE"), + Schema.Literal("NF"), + Schema.Literal("NG"), + Schema.Literal("NI"), + Schema.Literal("NL"), + Schema.Literal("NO"), + Schema.Literal("NP"), + Schema.Literal("NR"), + Schema.Literal("NU"), + Schema.Literal("NZ"), + Schema.Literal("OM"), + Schema.Literal("PA"), + Schema.Literal("PE"), + Schema.Literal("PF"), + Schema.Literal("PG"), + Schema.Literal("PH"), + Schema.Literal("PK"), + Schema.Literal("PL"), + Schema.Literal("PM"), + Schema.Literal("PN"), + Schema.Literal("PR"), + Schema.Literal("PS"), + Schema.Literal("PT"), + Schema.Literal("PW"), + Schema.Literal("PY"), + Schema.Literal("QA"), + Schema.Literal("RE"), + Schema.Literal("RO"), + Schema.Literal("RS"), + Schema.Literal("RU"), + Schema.Literal("RW"), + Schema.Literal("SA"), + Schema.Literal("SB"), + Schema.Literal("SC"), + Schema.Literal("SD"), + Schema.Literal("SE"), + Schema.Literal("SG"), + Schema.Literal("SH"), + Schema.Literal("SI"), + Schema.Literal("SJ"), + Schema.Literal("SK"), + Schema.Literal("SL"), + Schema.Literal("SM"), + Schema.Literal("SN"), + Schema.Literal("SO"), + Schema.Literal("SR"), + Schema.Literal("SS"), + Schema.Literal("ST"), + Schema.Literal("SV"), + Schema.Literal("SX"), + Schema.Literal("SY"), + Schema.Literal("SZ"), + Schema.Literal("TC"), + Schema.Literal("TD"), + Schema.Literal("TF"), + Schema.Literal("TG"), + Schema.Literal("TH"), + Schema.Literal("TJ"), + Schema.Literal("TK"), + Schema.Literal("TL"), + Schema.Literal("TM"), + Schema.Literal("TN"), + Schema.Literal("TO"), + Schema.Literal("TR"), + Schema.Literal("TT"), + Schema.Literal("TV"), + Schema.Literal("TW"), + Schema.Literal("TZ"), + Schema.Literal("UA"), + Schema.Literal("UG"), + Schema.Literal("UM"), + Schema.Literal("US"), + Schema.Literal("UY"), + Schema.Literal("UZ"), + Schema.Literal("VA"), + Schema.Literal("VC"), + Schema.Literal("VE"), + Schema.Literal("VG"), + Schema.Literal("VI"), + Schema.Literal("VN"), + Schema.Literal("VU"), + Schema.Literal("WF"), + Schema.Literal("WS"), + Schema.Literal("YE"), + Schema.Literal("YT"), + Schema.Literal("ZA"), + Schema.Literal("ZM"), + Schema.Literal("ZW"), + Schema.Null + ]).annotate({ "description": "ISO 3166-1 Alpha-2 country code of the provider headquarters" }) + ), + "name": Schema.String.annotate({ "description": "Display name of the provider" }), + "privacy_policy_url": Schema.String.annotate({ "description": "URL to the provider's privacy policy" }), + "slug": Schema.String.annotate({ "description": "URL-friendly identifier for the provider" }), + "status_page_url": Schema.optionalKey( + Schema.String.annotate({ "description": "URL to the provider's status page" }) + ), + "terms_of_service_url": Schema.optionalKey( + Schema.String.annotate({ "description": "URL to the provider's terms of service" }) + ) + })) +}) +export type ListProviders500 = InternalServerResponse +export const ListProviders500 = InternalServerResponse +export type CreateRerankParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const CreateRerankParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) +}) +export type CreateRerankRequestJson = { + readonly "documents": ReadonlyArray + readonly "model": string + readonly "provider"?: { + readonly "allow_fallbacks"?: boolean + readonly "data_collection"?: "deny" | "allow" | null + readonly "enforce_distillable_text"?: boolean + readonly "ignore"?: ReadonlyArray + readonly "max_price"?: { + readonly "audio"?: string + readonly "completion"?: string + readonly "image"?: string + readonly "prompt"?: BigNumberUnion + readonly "request"?: string + } + readonly "only"?: ReadonlyArray + readonly "order"?: ReadonlyArray + readonly "preferred_max_latency"?: PreferredMaxLatency + readonly "preferred_min_throughput"?: PreferredMinThroughput + readonly "quantizations"?: ReadonlyArray + readonly "require_parameters"?: boolean + readonly "sort"?: ProviderSort | ProviderSortConfig | unknown + readonly "zdr"?: boolean + } + readonly "query": string + readonly "top_n"?: number +} +export const CreateRerankRequestJson = Schema.Struct({ + "documents": Schema.Array(Schema.String).annotate({ "description": "The list of documents to rerank" }), + "model": Schema.String.annotate({ "description": "The rerank model to use" }), + "provider": Schema.optionalKey( + Schema.Struct({ + "allow_fallbacks": Schema.optionalKey(Schema.Boolean.annotate({ + "description": + "Whether to allow backup providers to serve requests\n- true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider.\n- false: use only the primary/custom provider, and return the upstream error if it's unavailable.\n" + })), + "data_collection": Schema.optionalKey( + Schema.Union([Schema.Literal("deny"), Schema.Literal("allow"), Schema.Null]).annotate({ + "description": + "Data collection setting. If no available model provider meets the requirement, your request will return an error.\n- allow: (default) allow providers which store user data non-transiently and may train on it\n\n- deny: use only providers which do not collect user data." + }) + ), + "enforce_distillable_text": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used." + }) + ), + "ignore": Schema.optionalKey( + Schema.Array(Schema.Union([ProviderName, Schema.String])).annotate({ + "description": + "List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request." + }) + ), + "max_price": Schema.optionalKey( + Schema.Struct({ + "audio": Schema.optionalKey(Schema.String.annotate({ "description": "Price per audio unit" })), + "completion": Schema.optionalKey( + Schema.String.annotate({ "description": "Price per million completion tokens" }) + ), + "image": Schema.optionalKey(Schema.String.annotate({ "description": "Price per image" })), + "prompt": Schema.optionalKey(BigNumberUnion), + "request": Schema.optionalKey(Schema.String.annotate({ "description": "Price per request" })) + }).annotate({ + "description": + "The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion." + }) + ), + "only": Schema.optionalKey( + Schema.Array(Schema.Union([ProviderName, Schema.String])).annotate({ + "description": + "List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request." + }) + ), + "order": Schema.optionalKey( + Schema.Array(Schema.Union([ProviderName, Schema.String])).annotate({ + "description": + "An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message." + }) + ), + "preferred_max_latency": Schema.optionalKey(PreferredMaxLatency), + "preferred_min_throughput": Schema.optionalKey(PreferredMinThroughput), + "quantizations": Schema.optionalKey( + Schema.Array(Quantization).annotate({ + "description": "A list of quantization levels to filter the provider by." + }) + ), + "require_parameters": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest." + }) + ), + "sort": Schema.optionalKey( + Schema.Union([ProviderSort, ProviderSortConfig, Schema.Unknown]).annotate({ + "description": + "The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed." + }) + ), + "zdr": Schema.optionalKey( + Schema.Boolean.annotate({ + "description": + "Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used." + }) + ) + }).annotate({ "description": "Provider routing preferences for the request." }) + ), + "query": Schema.String.annotate({ "description": "The search query to rerank documents against" }), + "top_n": Schema.optionalKey( + Schema.Number.annotate({ "description": "Number of most relevant documents to return" }).check(Schema.isInt()) + .check(Schema.isGreaterThanOrEqualTo(1)) + ) +}).annotate({ "description": "Rerank request input" }) +export type CreateRerank200 = { + readonly "id"?: string + readonly "model": string + readonly "provider"?: string + readonly "results": ReadonlyArray< + { readonly "document": { readonly "text": string }; readonly "index": number; readonly "relevance_score": number } + > + readonly "usage"?: { readonly "cost"?: number; readonly "search_units"?: number; readonly "total_tokens"?: number } +} +export const CreateRerank200 = Schema.Struct({ + "id": Schema.optionalKey( + Schema.String.annotate({ "description": "Unique identifier for the rerank response (ORID format)" }) + ), + "model": Schema.String.annotate({ "description": "The model used for reranking" }), + "provider": Schema.optionalKey( + Schema.String.annotate({ "description": "The provider that served the rerank request" }) + ), + "results": Schema.Array( + Schema.Struct({ + "document": Schema.Struct({ "text": Schema.String.annotate({ "description": "The document text" }) }).annotate({ + "description": "The document object containing the original text" + }), + "index": Schema.Number.annotate({ "description": "Index of the document in the original input list" }).check( + Schema.isInt() + ), + "relevance_score": Schema.Number.annotate({ + "description": "Relevance score of the document to the query", + "format": "double" + }).check(Schema.isFinite()) + }).annotate({ "description": "A single rerank result" }) + ).annotate({ "description": "List of rerank results sorted by relevance" }), + "usage": Schema.optionalKey( + Schema.Struct({ + "cost": Schema.optionalKey( + Schema.Number.annotate({ "description": "Cost of the request in credits", "format": "double" }).check( + Schema.isFinite() + ) + ), + "search_units": Schema.optionalKey( + Schema.Number.annotate({ "description": "Number of search units consumed (Cohere billing)" }).check( + Schema.isInt() + ) + ), + "total_tokens": Schema.optionalKey( + Schema.Number.annotate({ "description": "Total number of tokens used" }).check(Schema.isInt()) + ) + }).annotate({ "description": "Usage statistics" }) + ) +}).annotate({ "description": "Rerank response containing ranked results" }) +export type CreateRerank200Sse = string +export const CreateRerank200Sse = Schema.String.annotate({ + "description": "Not used for rerank - rerank does not support streaming" +}) +export type CreateRerank400 = BadRequestResponse +export const CreateRerank400 = BadRequestResponse +export type CreateRerank401 = UnauthorizedResponse +export const CreateRerank401 = UnauthorizedResponse +export type CreateRerank402 = PaymentRequiredResponse +export const CreateRerank402 = PaymentRequiredResponse +export type CreateRerank404 = NotFoundResponse +export const CreateRerank404 = NotFoundResponse +export type CreateRerank429 = TooManyRequestsResponse +export const CreateRerank429 = TooManyRequestsResponse +export type CreateRerank500 = InternalServerResponse +export const CreateRerank500 = InternalServerResponse +export type CreateRerank502 = BadGatewayResponse +export const CreateRerank502 = BadGatewayResponse +export type CreateRerank503 = ServiceUnavailableResponse +export const CreateRerank503 = ServiceUnavailableResponse +export type CreateRerank524 = EdgeNetworkTimeoutResponse +export const CreateRerank524 = EdgeNetworkTimeoutResponse +export type CreateRerank529 = ProviderOverloadedResponse +export const CreateRerank529 = ProviderOverloadedResponse +export type CreateResponsesParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string + readonly "X-OpenRouter-Experimental-Metadata"?: MetadataLevel +} +export const CreateResponsesParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String), + "X-OpenRouter-Experimental-Metadata": Schema.optionalKey(MetadataLevel) +}) +export type CreateResponsesRequestJson = ResponsesRequest +export const CreateResponsesRequestJson = ResponsesRequest +export type CreateResponses200 = OpenResponsesResult +export const CreateResponses200 = OpenResponsesResult +export type CreateResponses200Sse = ResponsesStreamingResponse +export const CreateResponses200Sse: Schema.Schema = ResponsesStreamingResponse +export type CreateResponses400 = BadRequestResponse +export const CreateResponses400 = BadRequestResponse +export type CreateResponses401 = UnauthorizedResponse +export const CreateResponses401 = UnauthorizedResponse +export type CreateResponses402 = PaymentRequiredResponse +export const CreateResponses402 = PaymentRequiredResponse +export type CreateResponses403 = ForbiddenResponse +export const CreateResponses403 = ForbiddenResponse +export type CreateResponses404 = NotFoundResponse +export const CreateResponses404 = NotFoundResponse +export type CreateResponses408 = RequestTimeoutResponse +export const CreateResponses408 = RequestTimeoutResponse +export type CreateResponses413 = PayloadTooLargeResponse +export const CreateResponses413 = PayloadTooLargeResponse +export type CreateResponses422 = UnprocessableEntityResponse +export const CreateResponses422 = UnprocessableEntityResponse +export type CreateResponses429 = TooManyRequestsResponse +export const CreateResponses429 = TooManyRequestsResponse +export type CreateResponses500 = InternalServerResponse +export const CreateResponses500 = InternalServerResponse +export type CreateResponses502 = BadGatewayResponse +export const CreateResponses502 = BadGatewayResponse +export type CreateResponses503 = ServiceUnavailableResponse +export const CreateResponses503 = ServiceUnavailableResponse +export type CreateResponses524 = EdgeNetworkTimeoutResponse +export const CreateResponses524 = EdgeNetworkTimeoutResponse +export type CreateResponses529 = ProviderOverloadedResponse +export const CreateResponses529 = ProviderOverloadedResponse +export type CreateVideosParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const CreateVideosParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) }) -export type ListMemberAssignments200 = { - readonly "data": ReadonlyArray< - { - readonly "id": string - readonly "user_id": string - readonly "organization_id": string - readonly "guardrail_id": string - readonly "assigned_by": string - readonly "created_at": string - } - > - readonly "total_count": number +export type CreateVideosRequestJson = VideoGenerationRequest +export const CreateVideosRequestJson = VideoGenerationRequest +export type CreateVideos202 = VideoGenerationResponse +export const CreateVideos202 = VideoGenerationResponse +export type CreateVideos400 = BadRequestResponse +export const CreateVideos400 = BadRequestResponse +export type CreateVideos401 = UnauthorizedResponse +export const CreateVideos401 = UnauthorizedResponse +export type CreateVideos402 = PaymentRequiredResponse +export const CreateVideos402 = PaymentRequiredResponse +export type CreateVideos404 = NotFoundResponse +export const CreateVideos404 = NotFoundResponse +export type CreateVideos429 = TooManyRequestsResponse +export const CreateVideos429 = TooManyRequestsResponse +export type CreateVideos500 = InternalServerResponse +export const CreateVideos500 = InternalServerResponse +export type GetVideosParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string } -export const ListMemberAssignments200 = Schema.Struct({ - "data": Schema.Array(Schema.Struct({ - "id": Schema.String.annotate({ "description": "Unique identifier for the assignment", "format": "uuid" }), - "user_id": Schema.String.annotate({ "description": "Clerk user ID of the assigned member" }), - "organization_id": Schema.String.annotate({ "description": "Organization ID" }), - "guardrail_id": Schema.String.annotate({ "description": "ID of the guardrail", "format": "uuid" }), - "assigned_by": Schema.String.annotate({ "description": "User ID of who made the assignment" }), - "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the assignment was created" }) - })).annotate({ "description": "List of member assignments" }), - "total_count": Schema.Number.annotate({ "description": "Total number of member assignments" }).check( - Schema.isFinite() - ) -}) -export type ListMemberAssignments401 = UnauthorizedResponse -export const ListMemberAssignments401 = UnauthorizedResponse -export type ListMemberAssignments500 = InternalServerResponse -export const ListMemberAssignments500 = InternalServerResponse -export type ListGuardrailKeyAssignmentsParams = { readonly "offset"?: string; readonly "limit"?: string } -export const ListGuardrailKeyAssignmentsParams = Schema.Struct({ - "offset": Schema.optionalKey(Schema.String.annotate({ "description": "Number of records to skip for pagination" })), - "limit": Schema.optionalKey( - Schema.String.annotate({ "description": "Maximum number of records to return (max 100)" }) - ) +export const GetVideosParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) }) -export type ListGuardrailKeyAssignments200 = { - readonly "data": ReadonlyArray< - { - readonly "id": string - readonly "key_hash": string - readonly "guardrail_id": string - readonly "key_name": string - readonly "key_label": string - readonly "assigned_by": string - readonly "created_at": string - } - > - readonly "total_count": number +export type GetVideos200 = VideoGenerationResponse +export const GetVideos200 = VideoGenerationResponse +export type GetVideos401 = UnauthorizedResponse +export const GetVideos401 = UnauthorizedResponse +export type GetVideos404 = NotFoundResponse +export const GetVideos404 = NotFoundResponse +export type GetVideos500 = InternalServerResponse +export const GetVideos500 = InternalServerResponse +export type ListVideosContentParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string + readonly "index"?: number } -export const ListGuardrailKeyAssignments200 = Schema.Struct({ - "data": Schema.Array(Schema.Struct({ - "id": Schema.String.annotate({ "description": "Unique identifier for the assignment", "format": "uuid" }), - "key_hash": Schema.String.annotate({ "description": "Hash of the assigned API key" }), - "guardrail_id": Schema.String.annotate({ "description": "ID of the guardrail", "format": "uuid" }), - "key_name": Schema.String.annotate({ "description": "Name of the API key" }), - "key_label": Schema.String.annotate({ "description": "Label of the API key" }), - "assigned_by": Schema.String.annotate({ "description": "User ID of who made the assignment" }), - "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the assignment was created" }) - })).annotate({ "description": "List of key assignments" }), - "total_count": Schema.Number.annotate({ "description": "Total number of key assignments for this guardrail" }).check( - Schema.isFinite() - ) -}) -export type ListGuardrailKeyAssignments401 = UnauthorizedResponse -export const ListGuardrailKeyAssignments401 = UnauthorizedResponse -export type ListGuardrailKeyAssignments404 = NotFoundResponse -export const ListGuardrailKeyAssignments404 = NotFoundResponse -export type ListGuardrailKeyAssignments500 = InternalServerResponse -export const ListGuardrailKeyAssignments500 = InternalServerResponse -export type BulkAssignKeysToGuardrailRequestJson = { readonly "key_hashes": ReadonlyArray } -export const BulkAssignKeysToGuardrailRequestJson = Schema.Struct({ - "key_hashes": Schema.Array(Schema.String.check(Schema.isMinLength(1))).annotate({ - "description": "Array of API key hashes to assign to the guardrail" - }).check(Schema.isMinLength(1)) +export const ListVideosContentParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String), + "index": Schema.optionalKey(Schema.Number.check(Schema.isInt()).check(Schema.isGreaterThanOrEqualTo(0))) }) -export type BulkAssignKeysToGuardrail200 = { readonly "assigned_count": number } -export const BulkAssignKeysToGuardrail200 = Schema.Struct({ - "assigned_count": Schema.Number.annotate({ "description": "Number of keys successfully assigned" }).check( - Schema.isFinite() - ) +export type ListVideosContent400 = BadRequestResponse +export const ListVideosContent400 = BadRequestResponse +export type ListVideosContent401 = UnauthorizedResponse +export const ListVideosContent401 = UnauthorizedResponse +export type ListVideosContent404 = NotFoundResponse +export const ListVideosContent404 = NotFoundResponse +export type ListVideosContent500 = InternalServerResponse +export const ListVideosContent500 = InternalServerResponse +export type ListVideosContent502 = BadGatewayResponse +export const ListVideosContent502 = BadGatewayResponse +export type ListVideosModelsParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const ListVideosModelsParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) }) -export type BulkAssignKeysToGuardrail400 = BadRequestResponse -export const BulkAssignKeysToGuardrail400 = BadRequestResponse -export type BulkAssignKeysToGuardrail401 = UnauthorizedResponse -export const BulkAssignKeysToGuardrail401 = UnauthorizedResponse -export type BulkAssignKeysToGuardrail404 = NotFoundResponse -export const BulkAssignKeysToGuardrail404 = NotFoundResponse -export type BulkAssignKeysToGuardrail500 = InternalServerResponse -export const BulkAssignKeysToGuardrail500 = InternalServerResponse -export type ListGuardrailMemberAssignmentsParams = { readonly "offset"?: string; readonly "limit"?: string } -export const ListGuardrailMemberAssignmentsParams = Schema.Struct({ - "offset": Schema.optionalKey(Schema.String.annotate({ "description": "Number of records to skip for pagination" })), +export type ListVideosModels200 = VideoModelsListResponse +export const ListVideosModels200 = VideoModelsListResponse +export type ListVideosModels400 = BadRequestResponse +export const ListVideosModels400 = BadRequestResponse +export type ListVideosModels500 = InternalServerResponse +export const ListVideosModels500 = InternalServerResponse +export type ListWorkspacesParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string + readonly "offset"?: number + readonly "limit"?: number +} +export const ListWorkspacesParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String), + "offset": Schema.optionalKey( + Schema.Number.annotate({ "description": "Number of records to skip for pagination" }).check(Schema.isInt()).check( + Schema.isGreaterThanOrEqualTo(0) + ) + ), "limit": Schema.optionalKey( - Schema.String.annotate({ "description": "Maximum number of records to return (max 100)" }) + Schema.Number.annotate({ "description": "Maximum number of records to return (max 100)" }).check(Schema.isInt()) + .check(Schema.isGreaterThanOrEqualTo(1)).check(Schema.isLessThanOrEqualTo(100)) ) }) -export type ListGuardrailMemberAssignments200 = { - readonly "data": ReadonlyArray< - { - readonly "id": string - readonly "user_id": string - readonly "organization_id": string - readonly "guardrail_id": string - readonly "assigned_by": string - readonly "created_at": string - } - > - readonly "total_count": number +export type ListWorkspaces200 = ListWorkspacesResponse +export const ListWorkspaces200 = ListWorkspacesResponse +export type ListWorkspaces401 = UnauthorizedResponse +export const ListWorkspaces401 = UnauthorizedResponse +export type ListWorkspaces500 = InternalServerResponse +export const ListWorkspaces500 = InternalServerResponse +export type CreateWorkspaceParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string } -export const ListGuardrailMemberAssignments200 = Schema.Struct({ - "data": Schema.Array(Schema.Struct({ - "id": Schema.String.annotate({ "description": "Unique identifier for the assignment", "format": "uuid" }), - "user_id": Schema.String.annotate({ "description": "Clerk user ID of the assigned member" }), - "organization_id": Schema.String.annotate({ "description": "Organization ID" }), - "guardrail_id": Schema.String.annotate({ "description": "ID of the guardrail", "format": "uuid" }), - "assigned_by": Schema.String.annotate({ "description": "User ID of who made the assignment" }), - "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the assignment was created" }) - })).annotate({ "description": "List of member assignments" }), - "total_count": Schema.Number.annotate({ "description": "Total number of member assignments" }).check( - Schema.isFinite() - ) -}) -export type ListGuardrailMemberAssignments401 = UnauthorizedResponse -export const ListGuardrailMemberAssignments401 = UnauthorizedResponse -export type ListGuardrailMemberAssignments404 = NotFoundResponse -export const ListGuardrailMemberAssignments404 = NotFoundResponse -export type ListGuardrailMemberAssignments500 = InternalServerResponse -export const ListGuardrailMemberAssignments500 = InternalServerResponse -export type BulkAssignMembersToGuardrailRequestJson = { readonly "member_user_ids": ReadonlyArray } -export const BulkAssignMembersToGuardrailRequestJson = Schema.Struct({ - "member_user_ids": Schema.Array(Schema.String.check(Schema.isMinLength(1))).annotate({ - "description": "Array of member user IDs to assign to the guardrail" - }).check(Schema.isMinLength(1)) +export const CreateWorkspaceParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) }) -export type BulkAssignMembersToGuardrail200 = { readonly "assigned_count": number } -export const BulkAssignMembersToGuardrail200 = Schema.Struct({ - "assigned_count": Schema.Number.annotate({ "description": "Number of members successfully assigned" }).check( - Schema.isFinite() - ) +export type CreateWorkspaceRequestJson = CreateWorkspaceRequest +export const CreateWorkspaceRequestJson = CreateWorkspaceRequest +export type CreateWorkspace201 = CreateWorkspaceResponse +export const CreateWorkspace201 = CreateWorkspaceResponse +export type CreateWorkspace400 = BadRequestResponse +export const CreateWorkspace400 = BadRequestResponse +export type CreateWorkspace401 = UnauthorizedResponse +export const CreateWorkspace401 = UnauthorizedResponse +export type CreateWorkspace403 = ForbiddenResponse +export const CreateWorkspace403 = ForbiddenResponse +export type CreateWorkspace500 = InternalServerResponse +export const CreateWorkspace500 = InternalServerResponse +export type GetWorkspaceParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const GetWorkspaceParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) }) -export type BulkAssignMembersToGuardrail400 = BadRequestResponse -export const BulkAssignMembersToGuardrail400 = BadRequestResponse -export type BulkAssignMembersToGuardrail401 = UnauthorizedResponse -export const BulkAssignMembersToGuardrail401 = UnauthorizedResponse -export type BulkAssignMembersToGuardrail404 = NotFoundResponse -export const BulkAssignMembersToGuardrail404 = NotFoundResponse -export type BulkAssignMembersToGuardrail500 = InternalServerResponse -export const BulkAssignMembersToGuardrail500 = InternalServerResponse -export type BulkUnassignKeysFromGuardrailRequestJson = { readonly "key_hashes": ReadonlyArray } -export const BulkUnassignKeysFromGuardrailRequestJson = Schema.Struct({ - "key_hashes": Schema.Array(Schema.String.check(Schema.isMinLength(1))).annotate({ - "description": "Array of API key hashes to unassign from the guardrail" - }).check(Schema.isMinLength(1)) +export type GetWorkspace200 = GetWorkspaceResponse +export const GetWorkspace200 = GetWorkspaceResponse +export type GetWorkspace401 = UnauthorizedResponse +export const GetWorkspace401 = UnauthorizedResponse +export type GetWorkspace404 = NotFoundResponse +export const GetWorkspace404 = NotFoundResponse +export type GetWorkspace500 = InternalServerResponse +export const GetWorkspace500 = InternalServerResponse +export type DeleteWorkspaceParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const DeleteWorkspaceParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) }) -export type BulkUnassignKeysFromGuardrail200 = { readonly "unassigned_count": number } -export const BulkUnassignKeysFromGuardrail200 = Schema.Struct({ - "unassigned_count": Schema.Number.annotate({ "description": "Number of keys successfully unassigned" }).check( - Schema.isFinite() - ) +export type DeleteWorkspace200 = DeleteWorkspaceResponse +export const DeleteWorkspace200 = DeleteWorkspaceResponse +export type DeleteWorkspace400 = BadRequestResponse +export const DeleteWorkspace400 = BadRequestResponse +export type DeleteWorkspace401 = UnauthorizedResponse +export const DeleteWorkspace401 = UnauthorizedResponse +export type DeleteWorkspace403 = ForbiddenResponse +export const DeleteWorkspace403 = ForbiddenResponse +export type DeleteWorkspace404 = NotFoundResponse +export const DeleteWorkspace404 = NotFoundResponse +export type DeleteWorkspace500 = InternalServerResponse +export const DeleteWorkspace500 = InternalServerResponse +export type UpdateWorkspaceParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const UpdateWorkspaceParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) }) -export type BulkUnassignKeysFromGuardrail400 = BadRequestResponse -export const BulkUnassignKeysFromGuardrail400 = BadRequestResponse -export type BulkUnassignKeysFromGuardrail401 = UnauthorizedResponse -export const BulkUnassignKeysFromGuardrail401 = UnauthorizedResponse -export type BulkUnassignKeysFromGuardrail404 = NotFoundResponse -export const BulkUnassignKeysFromGuardrail404 = NotFoundResponse -export type BulkUnassignKeysFromGuardrail500 = InternalServerResponse -export const BulkUnassignKeysFromGuardrail500 = InternalServerResponse -export type BulkUnassignMembersFromGuardrailRequestJson = { readonly "member_user_ids": ReadonlyArray } -export const BulkUnassignMembersFromGuardrailRequestJson = Schema.Struct({ - "member_user_ids": Schema.Array(Schema.String.check(Schema.isMinLength(1))).annotate({ - "description": "Array of member user IDs to unassign from the guardrail" - }).check(Schema.isMinLength(1)) +export type UpdateWorkspaceRequestJson = UpdateWorkspaceRequest +export const UpdateWorkspaceRequestJson = UpdateWorkspaceRequest +export type UpdateWorkspace200 = UpdateWorkspaceResponse +export const UpdateWorkspace200 = UpdateWorkspaceResponse +export type UpdateWorkspace400 = BadRequestResponse +export const UpdateWorkspace400 = BadRequestResponse +export type UpdateWorkspace401 = UnauthorizedResponse +export const UpdateWorkspace401 = UnauthorizedResponse +export type UpdateWorkspace403 = ForbiddenResponse +export const UpdateWorkspace403 = ForbiddenResponse +export type UpdateWorkspace404 = NotFoundResponse +export const UpdateWorkspace404 = NotFoundResponse +export type UpdateWorkspace500 = InternalServerResponse +export const UpdateWorkspace500 = InternalServerResponse +export type BulkAddWorkspaceMembersParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const BulkAddWorkspaceMembersParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) }) -export type BulkUnassignMembersFromGuardrail200 = { readonly "unassigned_count": number } -export const BulkUnassignMembersFromGuardrail200 = Schema.Struct({ - "unassigned_count": Schema.Number.annotate({ "description": "Number of members successfully unassigned" }).check( - Schema.isFinite() - ) +export type BulkAddWorkspaceMembersRequestJson = BulkAddWorkspaceMembersRequest +export const BulkAddWorkspaceMembersRequestJson = BulkAddWorkspaceMembersRequest +export type BulkAddWorkspaceMembers200 = BulkAddWorkspaceMembersResponse +export const BulkAddWorkspaceMembers200 = BulkAddWorkspaceMembersResponse +export type BulkAddWorkspaceMembers400 = BadRequestResponse +export const BulkAddWorkspaceMembers400 = BadRequestResponse +export type BulkAddWorkspaceMembers401 = UnauthorizedResponse +export const BulkAddWorkspaceMembers401 = UnauthorizedResponse +export type BulkAddWorkspaceMembers403 = ForbiddenResponse +export const BulkAddWorkspaceMembers403 = ForbiddenResponse +export type BulkAddWorkspaceMembers404 = NotFoundResponse +export const BulkAddWorkspaceMembers404 = NotFoundResponse +export type BulkAddWorkspaceMembers500 = InternalServerResponse +export const BulkAddWorkspaceMembers500 = InternalServerResponse +export type BulkRemoveWorkspaceMembersParams = { + readonly "HTTP-Referer"?: string + readonly "X-OpenRouter-Title"?: string + readonly "X-OpenRouter-Categories"?: string +} +export const BulkRemoveWorkspaceMembersParams = Schema.Struct({ + "HTTP-Referer": Schema.optionalKey(Schema.String), + "X-OpenRouter-Title": Schema.optionalKey(Schema.String), + "X-OpenRouter-Categories": Schema.optionalKey(Schema.String) }) -export type BulkUnassignMembersFromGuardrail400 = BadRequestResponse -export const BulkUnassignMembersFromGuardrail400 = BadRequestResponse -export type BulkUnassignMembersFromGuardrail401 = UnauthorizedResponse -export const BulkUnassignMembersFromGuardrail401 = UnauthorizedResponse -export type BulkUnassignMembersFromGuardrail404 = NotFoundResponse -export const BulkUnassignMembersFromGuardrail404 = NotFoundResponse -export type BulkUnassignMembersFromGuardrail500 = InternalServerResponse -export const BulkUnassignMembersFromGuardrail500 = InternalServerResponse -export type GetCurrentKey200 = { - readonly "data": { - readonly "label": string - readonly "limit": number - readonly "usage": number - readonly "usage_daily": number - readonly "usage_weekly": number - readonly "usage_monthly": number - readonly "byok_usage": number - readonly "byok_usage_daily": number - readonly "byok_usage_weekly": number - readonly "byok_usage_monthly": number - readonly "is_free_tier": boolean - readonly "is_management_key": boolean - readonly "is_provisioning_key": boolean - readonly "limit_remaining": number - readonly "limit_reset": string - readonly "include_byok_in_limit": boolean - readonly "expires_at"?: string - readonly "rate_limit": { readonly "requests": number; readonly "interval": string; readonly "note": string } - } +export type BulkRemoveWorkspaceMembersRequestJson = BulkRemoveWorkspaceMembersRequest +export const BulkRemoveWorkspaceMembersRequestJson = BulkRemoveWorkspaceMembersRequest +export type BulkRemoveWorkspaceMembers200 = BulkRemoveWorkspaceMembersResponse +export const BulkRemoveWorkspaceMembers200 = BulkRemoveWorkspaceMembersResponse +export type BulkRemoveWorkspaceMembers400 = BadRequestResponse +export const BulkRemoveWorkspaceMembers400 = BadRequestResponse +export type BulkRemoveWorkspaceMembers401 = UnauthorizedResponse +export const BulkRemoveWorkspaceMembers401 = UnauthorizedResponse +export type BulkRemoveWorkspaceMembers403 = ForbiddenResponse +export const BulkRemoveWorkspaceMembers403 = ForbiddenResponse +export type BulkRemoveWorkspaceMembers404 = NotFoundResponse +export const BulkRemoveWorkspaceMembers404 = NotFoundResponse +export type BulkRemoveWorkspaceMembers500 = InternalServerResponse +export const BulkRemoveWorkspaceMembers500 = InternalServerResponse + +export interface OperationConfig { + /** + * Whether or not the response should be included in the value returned from + * an operation. + * + * If set to `true`, a tuple of `[A, HttpClientResponse]` will be returned, + * where `A` is the success type of the operation. + * + * If set to `false`, only the success type of the operation will be returned. + */ + readonly includeResponse?: boolean | undefined } -export const GetCurrentKey200 = Schema.Struct({ - "data": Schema.Struct({ - "label": Schema.String.annotate({ "description": "Human-readable label for the API key" }), - "limit": Schema.Number.annotate({ "description": "Spending limit for the API key in USD" }).check( - Schema.isFinite() - ), - "usage": Schema.Number.annotate({ "description": "Total OpenRouter credit usage (in USD) for the API key" }).check( - Schema.isFinite() - ), - "usage_daily": Schema.Number.annotate({ "description": "OpenRouter credit usage (in USD) for the current UTC day" }) - .check(Schema.isFinite()), - "usage_weekly": Schema.Number.annotate({ - "description": "OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)" - }).check(Schema.isFinite()), - "usage_monthly": Schema.Number.annotate({ - "description": "OpenRouter credit usage (in USD) for the current UTC month" - }).check(Schema.isFinite()), - "byok_usage": Schema.Number.annotate({ "description": "Total external BYOK usage (in USD) for the API key" }).check( - Schema.isFinite() - ), - "byok_usage_daily": Schema.Number.annotate({ - "description": "External BYOK usage (in USD) for the current UTC day" - }).check(Schema.isFinite()), - "byok_usage_weekly": Schema.Number.annotate({ - "description": "External BYOK usage (in USD) for the current UTC week (Monday-Sunday)" - }).check(Schema.isFinite()), - "byok_usage_monthly": Schema.Number.annotate({ - "description": "External BYOK usage (in USD) for current UTC month" - }).check(Schema.isFinite()), - "is_free_tier": Schema.Boolean.annotate({ "description": "Whether this is a free tier API key" }), - "is_management_key": Schema.Boolean.annotate({ "description": "Whether this is a management key" }), - "is_provisioning_key": Schema.Boolean.annotate({ "description": "Whether this is a management key" }), - "limit_remaining": Schema.Number.annotate({ "description": "Remaining spending limit in USD" }).check( - Schema.isFinite() - ), - "limit_reset": Schema.String.annotate({ "description": "Type of limit reset for the API key" }), - "include_byok_in_limit": Schema.Boolean.annotate({ - "description": "Whether to include external BYOK usage in the credit limit" - }), - "expires_at": Schema.optionalKey( - Schema.String.annotate({ - "description": "ISO 8601 UTC timestamp when the API key expires, or null if no expiration", - "format": "date-time" - }) - ), - "rate_limit": Schema.Struct({ - "requests": Schema.Number.annotate({ "description": "Number of requests allowed per interval" }).check( - Schema.isFinite() + +/** + * A utility type which optionally includes the response in the return result + * of an operation based upon the value of the `includeResponse` configuration + * option. + */ +export type WithOptionalResponse = Config extends { + readonly includeResponse: true +} ? [A, HttpClientResponse.HttpClientResponse] : + A + +export const make = ( + httpClient: HttpClient.HttpClient, + options: { + readonly transformClient?: ((client: HttpClient.HttpClient) => Effect.Effect) | undefined + } = {} +): OpenRouterClient => { + const unexpectedStatus = (response: HttpClientResponse.HttpClientResponse) => + Effect.flatMap( + Effect.orElseSucceed(response.json, () => "Unexpected status code"), + (description) => + Effect.fail( + new HttpClientError.HttpClientError({ + reason: new HttpClientError.StatusCodeError({ + request: response.request, + response, + description: typeof description === "string" ? description : JSON.stringify(description) + }) + }) + ) + ) + const withResponse = (config: Config | undefined) => + ( + f: (response: HttpClientResponse.HttpClientResponse) => Effect.Effect + ): (request: HttpClientRequest.HttpClientRequest) => Effect.Effect => { + const withOptionalResponse = ( + config?.includeResponse + ? (response: HttpClientResponse.HttpClientResponse) => Effect.map(f(response), (a) => [a, response]) + : (response: HttpClientResponse.HttpClientResponse) => f(response) + ) as any + return options?.transformClient + ? (request) => + Effect.flatMap( + Effect.flatMap(options.transformClient!(httpClient), (client) => client.execute(request)), + withOptionalResponse + ) + : (request) => Effect.flatMap(httpClient.execute(request), withOptionalResponse) + } + const sseRequest = < + Type, + DecodingServices + >( + schema: Schema.Decoder + ) => + ( + request: HttpClientRequest.HttpClientRequest + ): Stream.Stream< + { readonly event: string; readonly id: string | undefined; readonly data: Type }, + HttpClientError.HttpClientError | SchemaError | Sse.Retry, + DecodingServices + > => + HttpClient.filterStatusOk(httpClient).execute(request).pipe( + Effect.map((response) => response.stream), + Stream.unwrap, + Stream.decodeText(), + Stream.pipeThroughChannel(Sse.decodeDataSchema(schema)) + ) + const binaryRequest = ( + request: HttpClientRequest.HttpClientRequest + ): Stream.Stream => + HttpClient.filterStatusOk(httpClient).execute(request).pipe( + Effect.map((response) => response.stream), + Stream.unwrap + ) + const decodeSuccess = + (schema: Schema) => (response: HttpClientResponse.HttpClientResponse) => + HttpClientResponse.schemaBodyJson(schema)(response) + const decodeError = + (tag: Tag, schema: Schema) => + (response: HttpClientResponse.HttpClientResponse) => + Effect.flatMap( + HttpClientResponse.schemaBodyJson(schema)(response), + (cause) => Effect.fail(OpenRouterClientError(tag, cause, response)) + ) + return { + httpClient, + "getUserActivity": (options) => + HttpClientRequest.get(`/activity`).pipe( + HttpClientRequest.setUrlParams({ + "date": options?.params?.["date"] as any, + "api_key_hash": options?.params?.["api_key_hash"] as any, + "user_id": options?.params?.["user_id"] as any + }), + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(GetUserActivity200), + "400": decodeError("GetUserActivity400", GetUserActivity400), + "401": decodeError("GetUserActivity401", GetUserActivity401), + "403": decodeError("GetUserActivity403", GetUserActivity403), + "404": decodeError("GetUserActivity404", GetUserActivity404), + "500": decodeError("GetUserActivity500", GetUserActivity500), + orElse: unexpectedStatus + })) + ), + "createAudioSpeech": (options) => + HttpClientRequest.post(`/audio/speech`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "400": decodeError("CreateAudioSpeech400", CreateAudioSpeech400), + "401": decodeError("CreateAudioSpeech401", CreateAudioSpeech401), + "402": decodeError("CreateAudioSpeech402", CreateAudioSpeech402), + "404": decodeError("CreateAudioSpeech404", CreateAudioSpeech404), + "429": decodeError("CreateAudioSpeech429", CreateAudioSpeech429), + "500": decodeError("CreateAudioSpeech500", CreateAudioSpeech500), + "502": decodeError("CreateAudioSpeech502", CreateAudioSpeech502), + "503": decodeError("CreateAudioSpeech503", CreateAudioSpeech503), + "524": decodeError("CreateAudioSpeech524", CreateAudioSpeech524), + "529": decodeError("CreateAudioSpeech529", CreateAudioSpeech529), + orElse: unexpectedStatus + })) + ), + "createAudioTranscriptions": (options) => + HttpClientRequest.post(`/audio/transcriptions`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(CreateAudioTranscriptions200), + "400": decodeError("CreateAudioTranscriptions400", CreateAudioTranscriptions400), + "401": decodeError("CreateAudioTranscriptions401", CreateAudioTranscriptions401), + "402": decodeError("CreateAudioTranscriptions402", CreateAudioTranscriptions402), + "404": decodeError("CreateAudioTranscriptions404", CreateAudioTranscriptions404), + "429": decodeError("CreateAudioTranscriptions429", CreateAudioTranscriptions429), + "500": decodeError("CreateAudioTranscriptions500", CreateAudioTranscriptions500), + "502": decodeError("CreateAudioTranscriptions502", CreateAudioTranscriptions502), + "503": decodeError("CreateAudioTranscriptions503", CreateAudioTranscriptions503), + "524": decodeError("CreateAudioTranscriptions524", CreateAudioTranscriptions524), + "529": decodeError("CreateAudioTranscriptions529", CreateAudioTranscriptions529), + orElse: unexpectedStatus + })) + ), + "exchangeAuthCodeForAPIKey": (options) => + HttpClientRequest.post(`/auth/keys`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(ExchangeAuthCodeForAPIKey200), + "400": decodeError("ExchangeAuthCodeForAPIKey400", ExchangeAuthCodeForAPIKey400), + "403": decodeError("ExchangeAuthCodeForAPIKey403", ExchangeAuthCodeForAPIKey403), + "500": decodeError("ExchangeAuthCodeForAPIKey500", ExchangeAuthCodeForAPIKey500), + orElse: unexpectedStatus + })) + ), + "createAuthKeysCode": (options) => + HttpClientRequest.post(`/auth/keys/code`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(CreateAuthKeysCode200), + "400": decodeError("CreateAuthKeysCode400", CreateAuthKeysCode400), + "401": decodeError("CreateAuthKeysCode401", CreateAuthKeysCode401), + "409": decodeError("CreateAuthKeysCode409", CreateAuthKeysCode409), + "500": decodeError("CreateAuthKeysCode500", CreateAuthKeysCode500), + orElse: unexpectedStatus + })) + ), + "listBYOKKeys": (options) => + HttpClientRequest.get(`/byok`).pipe( + HttpClientRequest.setUrlParams({ + "offset": options?.params?.["offset"] as any, + "limit": options?.params?.["limit"] as any, + "workspace_id": options?.params?.["workspace_id"] as any, + "provider": options?.params?.["provider"] as any + }), + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(ListBYOKKeys200), + "401": decodeError("ListBYOKKeys401", ListBYOKKeys401), + "500": decodeError("ListBYOKKeys500", ListBYOKKeys500), + orElse: unexpectedStatus + })) + ), + "createBYOKKey": (options) => + HttpClientRequest.post(`/byok`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(CreateBYOKKey201), + "400": decodeError("CreateBYOKKey400", CreateBYOKKey400), + "401": decodeError("CreateBYOKKey401", CreateBYOKKey401), + "403": decodeError("CreateBYOKKey403", CreateBYOKKey403), + "500": decodeError("CreateBYOKKey500", CreateBYOKKey500), + orElse: unexpectedStatus + })) + ), + "getBYOKKey": (id, options) => + HttpClientRequest.get(`/byok/${id}`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(GetBYOKKey200), + "401": decodeError("GetBYOKKey401", GetBYOKKey401), + "404": decodeError("GetBYOKKey404", GetBYOKKey404), + "500": decodeError("GetBYOKKey500", GetBYOKKey500), + orElse: unexpectedStatus + })) + ), + "deleteBYOKKey": (id, options) => + HttpClientRequest.delete(`/byok/${id}`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(DeleteBYOKKey200), + "401": decodeError("DeleteBYOKKey401", DeleteBYOKKey401), + "404": decodeError("DeleteBYOKKey404", DeleteBYOKKey404), + "500": decodeError("DeleteBYOKKey500", DeleteBYOKKey500), + orElse: unexpectedStatus + })) + ), + "updateBYOKKey": (id, options) => + HttpClientRequest.patch(`/byok/${id}`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(UpdateBYOKKey200), + "400": decodeError("UpdateBYOKKey400", UpdateBYOKKey400), + "401": decodeError("UpdateBYOKKey401", UpdateBYOKKey401), + "404": decodeError("UpdateBYOKKey404", UpdateBYOKKey404), + "500": decodeError("UpdateBYOKKey500", UpdateBYOKKey500), + orElse: unexpectedStatus + })) + ), + "sendChatCompletionRequest": (options) => + HttpClientRequest.post(`/chat/completions`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined, + "X-OpenRouter-Experimental-Metadata": options.params?.["X-OpenRouter-Experimental-Metadata"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(SendChatCompletionRequest200), + "400": decodeError("SendChatCompletionRequest400", SendChatCompletionRequest400), + "401": decodeError("SendChatCompletionRequest401", SendChatCompletionRequest401), + "402": decodeError("SendChatCompletionRequest402", SendChatCompletionRequest402), + "403": decodeError("SendChatCompletionRequest403", SendChatCompletionRequest403), + "404": decodeError("SendChatCompletionRequest404", SendChatCompletionRequest404), + "408": decodeError("SendChatCompletionRequest408", SendChatCompletionRequest408), + "413": decodeError("SendChatCompletionRequest413", SendChatCompletionRequest413), + "422": decodeError("SendChatCompletionRequest422", SendChatCompletionRequest422), + "429": decodeError("SendChatCompletionRequest429", SendChatCompletionRequest429), + "500": decodeError("SendChatCompletionRequest500", SendChatCompletionRequest500), + "502": decodeError("SendChatCompletionRequest502", SendChatCompletionRequest502), + "503": decodeError("SendChatCompletionRequest503", SendChatCompletionRequest503), + "524": decodeError("SendChatCompletionRequest524", SendChatCompletionRequest524), + "529": decodeError("SendChatCompletionRequest529", SendChatCompletionRequest529), + orElse: unexpectedStatus + })) + ), + "sendChatCompletionRequestSse": (options) => + HttpClientRequest.post(`/chat/completions`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined, + "X-OpenRouter-Experimental-Metadata": options.params?.["X-OpenRouter-Experimental-Metadata"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + sseRequest(SendChatCompletionRequest200Sse) + ), + "getCredits": (options) => + HttpClientRequest.get(`/credits`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(GetCredits200), + "401": decodeError("GetCredits401", GetCredits401), + "403": decodeError("GetCredits403", GetCredits403), + "500": decodeError("GetCredits500", GetCredits500), + orElse: unexpectedStatus + })) + ), + "createCoinbaseCharge": (options) => + HttpClientRequest.post(`/credits/coinbase`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "410": decodeError("CreateCoinbaseCharge410", CreateCoinbaseCharge410), + "200": () => Effect.void, + orElse: unexpectedStatus + })) + ), + "createEmbeddings": (options) => + HttpClientRequest.post(`/embeddings`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(CreateEmbeddings200), + "400": decodeError("CreateEmbeddings400", CreateEmbeddings400), + "401": decodeError("CreateEmbeddings401", CreateEmbeddings401), + "402": decodeError("CreateEmbeddings402", CreateEmbeddings402), + "404": decodeError("CreateEmbeddings404", CreateEmbeddings404), + "429": decodeError("CreateEmbeddings429", CreateEmbeddings429), + "500": decodeError("CreateEmbeddings500", CreateEmbeddings500), + "502": decodeError("CreateEmbeddings502", CreateEmbeddings502), + "503": decodeError("CreateEmbeddings503", CreateEmbeddings503), + "524": decodeError("CreateEmbeddings524", CreateEmbeddings524), + "529": decodeError("CreateEmbeddings529", CreateEmbeddings529), + orElse: unexpectedStatus + })) + ), + "createEmbeddingsSse": (options) => + HttpClientRequest.post(`/embeddings`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + sseRequest(CreateEmbeddings200Sse) + ), + "listEmbeddingsModels": (options) => + HttpClientRequest.get(`/embeddings/models`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(ListEmbeddingsModels200), + "400": decodeError("ListEmbeddingsModels400", ListEmbeddingsModels400), + "500": decodeError("ListEmbeddingsModels500", ListEmbeddingsModels500), + orElse: unexpectedStatus + })) + ), + "listEndpointsZdr": (options) => + HttpClientRequest.get(`/endpoints/zdr`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(ListEndpointsZdr200), + "500": decodeError("ListEndpointsZdr500", ListEndpointsZdr500), + orElse: unexpectedStatus + })) + ), + "getGeneration": (options) => + HttpClientRequest.get(`/generation`).pipe( + HttpClientRequest.setUrlParams({ "id": options.params["id"] as any }), + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params["X-OpenRouter-Categories"] ?? undefined + }), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(GetGeneration200), + "401": decodeError("GetGeneration401", GetGeneration401), + "402": decodeError("GetGeneration402", GetGeneration402), + "404": decodeError("GetGeneration404", GetGeneration404), + "429": decodeError("GetGeneration429", GetGeneration429), + "500": decodeError("GetGeneration500", GetGeneration500), + "502": decodeError("GetGeneration502", GetGeneration502), + "524": decodeError("GetGeneration524", GetGeneration524), + "529": decodeError("GetGeneration529", GetGeneration529), + orElse: unexpectedStatus + })) + ), + "listGenerationContent": (options) => + HttpClientRequest.get(`/generation/content`).pipe( + HttpClientRequest.setUrlParams({ "id": options.params["id"] as any }), + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params["X-OpenRouter-Categories"] ?? undefined + }), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(ListGenerationContent200), + "401": decodeError("ListGenerationContent401", ListGenerationContent401), + "403": decodeError("ListGenerationContent403", ListGenerationContent403), + "404": decodeError("ListGenerationContent404", ListGenerationContent404), + "429": decodeError("ListGenerationContent429", ListGenerationContent429), + "500": decodeError("ListGenerationContent500", ListGenerationContent500), + "502": decodeError("ListGenerationContent502", ListGenerationContent502), + "524": decodeError("ListGenerationContent524", ListGenerationContent524), + "529": decodeError("ListGenerationContent529", ListGenerationContent529), + orElse: unexpectedStatus + })) + ), + "listGuardrails": (options) => + HttpClientRequest.get(`/guardrails`).pipe( + HttpClientRequest.setUrlParams({ + "offset": options?.params?.["offset"] as any, + "limit": options?.params?.["limit"] as any, + "workspace_id": options?.params?.["workspace_id"] as any + }), + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(ListGuardrails200), + "401": decodeError("ListGuardrails401", ListGuardrails401), + "500": decodeError("ListGuardrails500", ListGuardrails500), + orElse: unexpectedStatus + })) + ), + "createGuardrail": (options) => + HttpClientRequest.post(`/guardrails`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(CreateGuardrail201), + "400": decodeError("CreateGuardrail400", CreateGuardrail400), + "401": decodeError("CreateGuardrail401", CreateGuardrail401), + "403": decodeError("CreateGuardrail403", CreateGuardrail403), + "500": decodeError("CreateGuardrail500", CreateGuardrail500), + orElse: unexpectedStatus + })) + ), + "getGuardrail": (id, options) => + HttpClientRequest.get(`/guardrails/${id}`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(GetGuardrail200), + "401": decodeError("GetGuardrail401", GetGuardrail401), + "404": decodeError("GetGuardrail404", GetGuardrail404), + "500": decodeError("GetGuardrail500", GetGuardrail500), + orElse: unexpectedStatus + })) + ), + "deleteGuardrail": (id, options) => + HttpClientRequest.delete(`/guardrails/${id}`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(DeleteGuardrail200), + "401": decodeError("DeleteGuardrail401", DeleteGuardrail401), + "404": decodeError("DeleteGuardrail404", DeleteGuardrail404), + "500": decodeError("DeleteGuardrail500", DeleteGuardrail500), + orElse: unexpectedStatus + })) ), - "interval": Schema.String.annotate({ "description": "Rate limit interval" }), - "note": Schema.String.annotate({ "description": "Note about the rate limit" }) - }).annotate({ "description": "Legacy rate limit information about a key. Will always return -1." }) - }).annotate({ "description": "Current API key information" }) -}) -export type GetCurrentKey401 = UnauthorizedResponse -export const GetCurrentKey401 = UnauthorizedResponse -export type GetCurrentKey500 = InternalServerResponse -export const GetCurrentKey500 = InternalServerResponse -export type ExchangeAuthCodeForAPIKeyRequestJson = { - readonly "code": string - readonly "code_verifier"?: string - readonly "code_challenge_method"?: "S256" | "plain" -} -export const ExchangeAuthCodeForAPIKeyRequestJson = Schema.Struct({ - "code": Schema.String.annotate({ "description": "The authorization code received from the OAuth redirect" }), - "code_verifier": Schema.optionalKey( - Schema.String.annotate({ - "description": "The code verifier if code_challenge was used in the authorization request" - }) - ), - "code_challenge_method": Schema.optionalKey( - Schema.Literals(["S256", "plain"]).annotate({ "description": "The method used to generate the code challenge" }) - ) -}) -export type ExchangeAuthCodeForAPIKey200 = { readonly "key": string; readonly "user_id": string } -export const ExchangeAuthCodeForAPIKey200 = Schema.Struct({ - "key": Schema.String.annotate({ "description": "The API key to use for OpenRouter requests" }), - "user_id": Schema.String.annotate({ "description": "User ID associated with the API key" }) -}) -export type ExchangeAuthCodeForAPIKey400 = BadRequestResponse -export const ExchangeAuthCodeForAPIKey400 = BadRequestResponse -export type ExchangeAuthCodeForAPIKey403 = ForbiddenResponse -export const ExchangeAuthCodeForAPIKey403 = ForbiddenResponse -export type ExchangeAuthCodeForAPIKey500 = InternalServerResponse -export const ExchangeAuthCodeForAPIKey500 = InternalServerResponse -export type CreateAuthKeysCodeRequestJson = { - readonly "callback_url": string - readonly "code_challenge"?: string - readonly "code_challenge_method"?: "S256" | "plain" - readonly "limit"?: number - readonly "expires_at"?: string -} -export const CreateAuthKeysCodeRequestJson = Schema.Struct({ - "callback_url": Schema.String.annotate({ - "description": - "The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed.", - "format": "uri" - }), - "code_challenge": Schema.optionalKey( - Schema.String.annotate({ "description": "PKCE code challenge for enhanced security" }) - ), - "code_challenge_method": Schema.optionalKey( - Schema.Literals(["S256", "plain"]).annotate({ "description": "The method used to generate the code challenge" }) - ), - "limit": Schema.optionalKey( - Schema.Number.annotate({ "description": "Credit limit for the API key to be created" }).check(Schema.isFinite()) - ), - "expires_at": Schema.optionalKey( - Schema.String.annotate({ - "description": "Optional expiration time for the API key to be created", - "format": "date-time" - }) - ) -}) -export type CreateAuthKeysCode200 = { - readonly "data": { readonly "id": string; readonly "app_id": number; readonly "created_at": string } -} -export const CreateAuthKeysCode200 = Schema.Struct({ - "data": Schema.Struct({ - "id": Schema.String.annotate({ "description": "The authorization code ID to use in the exchange request" }), - "app_id": Schema.Number.annotate({ "description": "The application ID associated with this auth code" }).check( - Schema.isFinite() - ), - "created_at": Schema.String.annotate({ "description": "ISO 8601 timestamp of when the auth code was created" }) - }).annotate({ "description": "Auth code data" }) -}) -export type CreateAuthKeysCode400 = BadRequestResponse -export const CreateAuthKeysCode400 = BadRequestResponse -export type CreateAuthKeysCode401 = UnauthorizedResponse -export const CreateAuthKeysCode401 = UnauthorizedResponse -export type CreateAuthKeysCode500 = InternalServerResponse -export const CreateAuthKeysCode500 = InternalServerResponse -export type SendChatCompletionRequestRequestJson = ChatGenerationParams -export const SendChatCompletionRequestRequestJson = ChatGenerationParams -export type SendChatCompletionRequest200 = { - readonly "id": string - readonly "choices": ReadonlyArray - readonly "created": number - readonly "model": string - readonly "object": "chat.completion" - readonly "system_fingerprint"?: string | null - readonly "usage"?: ChatGenerationTokenUsage -} -export const SendChatCompletionRequest200 = Schema.Struct({ - "id": Schema.String, - "choices": Schema.Array(ChatResponseChoice), - "created": Schema.Number.check(Schema.isFinite()), - "model": Schema.String, - "object": Schema.Literal("chat.completion"), - "system_fingerprint": Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])), - "usage": Schema.optionalKey(ChatGenerationTokenUsage) -}).annotate({ "description": "Chat completion response" }) -export type SendChatCompletionRequest200Sse = ChatStreamingResponseChunk -export const SendChatCompletionRequest200Sse = ChatStreamingResponseChunk -export type SendChatCompletionRequest400 = ChatError -export const SendChatCompletionRequest400 = ChatError -export type SendChatCompletionRequest401 = ChatError -export const SendChatCompletionRequest401 = ChatError -export type SendChatCompletionRequest429 = ChatError -export const SendChatCompletionRequest429 = ChatError -export type SendChatCompletionRequest500 = ChatError -export const SendChatCompletionRequest500 = ChatError - -export interface OperationConfig { - /** - * Whether or not the response should be included in the value returned from - * an operation. - * - * If set to `true`, a tuple of `[A, HttpClientResponse]` will be returned, - * where `A` is the success type of the operation. - * - * If set to `false`, only the success type of the operation will be returned. - */ - readonly includeResponse?: boolean | undefined -} - -/** - * A utility type which optionally includes the response in the return result - * of an operation based upon the value of the `includeResponse` configuration - * option. - */ -export type WithOptionalResponse = Config extends { - readonly includeResponse: true -} ? [A, HttpClientResponse.HttpClientResponse] : - A - -export const make = ( - httpClient: HttpClient.HttpClient, - options: { - readonly transformClient?: ((client: HttpClient.HttpClient) => Effect.Effect) | undefined - } = {} -): OpenRouterClient => { - const unexpectedStatus = (response: HttpClientResponse.HttpClientResponse) => - Effect.flatMap( - Effect.orElseSucceed(response.json, () => "Unexpected status code"), - (description) => - Effect.fail( - new HttpClientError.HttpClientError({ - reason: new HttpClientError.StatusCodeError({ - request: response.request, - response, - description: typeof description === "string" ? description : JSON.stringify(description) - }) - }) - ) - ) - const withResponse = (config: Config | undefined) => - ( - f: (response: HttpClientResponse.HttpClientResponse) => Effect.Effect - ): (request: HttpClientRequest.HttpClientRequest) => Effect.Effect => { - const withOptionalResponse = ( - config?.includeResponse - ? (response: HttpClientResponse.HttpClientResponse) => Effect.map(f(response), (a) => [a, response]) - : (response: HttpClientResponse.HttpClientResponse) => f(response) - ) as any - return options?.transformClient - ? (request) => - Effect.flatMap( - Effect.flatMap(options.transformClient!(httpClient), (client) => client.execute(request)), - withOptionalResponse - ) - : (request) => Effect.flatMap(httpClient.execute(request), withOptionalResponse) - } - const sseRequest = < - Type, - DecodingServices - >( - schema: Schema.Decoder - ) => - ( - request: HttpClientRequest.HttpClientRequest - ): Stream.Stream< - { readonly event: string; readonly id: string | undefined; readonly data: Type }, - HttpClientError.HttpClientError | SchemaError | Sse.Retry, - DecodingServices - > => - HttpClient.filterStatusOk(httpClient).execute(request).pipe( - Effect.map((response) => response.stream), - Stream.unwrap, - Stream.decodeText(), - Stream.pipeThroughChannel(Sse.decodeDataSchema(schema)) - ) - const decodeSuccess = - (schema: Schema) => (response: HttpClientResponse.HttpClientResponse) => - HttpClientResponse.schemaBodyJson(schema)(response) - const decodeError = - (tag: Tag, schema: Schema) => - (response: HttpClientResponse.HttpClientResponse) => - Effect.flatMap( - HttpClientResponse.schemaBodyJson(schema)(response), - (cause) => Effect.fail(OpenRouterClientError(tag, cause, response)) - ) - return { - httpClient, - "createResponses": (options) => - HttpClientRequest.post(`/responses`).pipe( + "updateGuardrail": (id, options) => + HttpClientRequest.patch(`/guardrails/${id}`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(CreateResponses200), - "400": decodeError("CreateResponses400", CreateResponses400), - "401": decodeError("CreateResponses401", CreateResponses401), - "402": decodeError("CreateResponses402", CreateResponses402), - "404": decodeError("CreateResponses404", CreateResponses404), - "408": decodeError("CreateResponses408", CreateResponses408), - "413": decodeError("CreateResponses413", CreateResponses413), - "422": decodeError("CreateResponses422", CreateResponses422), - "429": decodeError("CreateResponses429", CreateResponses429), - "500": decodeError("CreateResponses500", CreateResponses500), - "502": decodeError("CreateResponses502", CreateResponses502), - "503": decodeError("CreateResponses503", CreateResponses503), - "524": decodeError("CreateResponses524", CreateResponses524), - "529": decodeError("CreateResponses529", CreateResponses529), + "2xx": decodeSuccess(UpdateGuardrail200), + "400": decodeError("UpdateGuardrail400", UpdateGuardrail400), + "401": decodeError("UpdateGuardrail401", UpdateGuardrail401), + "404": decodeError("UpdateGuardrail404", UpdateGuardrail404), + "500": decodeError("UpdateGuardrail500", UpdateGuardrail500), + orElse: unexpectedStatus + })) + ), + "listGuardrailKeyAssignments": (id, options) => + HttpClientRequest.get(`/guardrails/${id}/assignments/keys`).pipe( + HttpClientRequest.setUrlParams({ + "offset": options?.params?.["offset"] as any, + "limit": options?.params?.["limit"] as any + }), + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(ListGuardrailKeyAssignments200), + "401": decodeError("ListGuardrailKeyAssignments401", ListGuardrailKeyAssignments401), + "404": decodeError("ListGuardrailKeyAssignments404", ListGuardrailKeyAssignments404), + "500": decodeError("ListGuardrailKeyAssignments500", ListGuardrailKeyAssignments500), + orElse: unexpectedStatus + })) + ), + "bulkAssignKeysToGuardrail": (id, options) => + HttpClientRequest.post(`/guardrails/${id}/assignments/keys`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BulkAssignKeysToGuardrail200), + "400": decodeError("BulkAssignKeysToGuardrail400", BulkAssignKeysToGuardrail400), + "401": decodeError("BulkAssignKeysToGuardrail401", BulkAssignKeysToGuardrail401), + "404": decodeError("BulkAssignKeysToGuardrail404", BulkAssignKeysToGuardrail404), + "500": decodeError("BulkAssignKeysToGuardrail500", BulkAssignKeysToGuardrail500), + orElse: unexpectedStatus + })) + ), + "bulkUnassignKeysFromGuardrail": (id, options) => + HttpClientRequest.post(`/guardrails/${id}/assignments/keys/remove`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BulkUnassignKeysFromGuardrail200), + "400": decodeError("BulkUnassignKeysFromGuardrail400", BulkUnassignKeysFromGuardrail400), + "401": decodeError("BulkUnassignKeysFromGuardrail401", BulkUnassignKeysFromGuardrail401), + "404": decodeError("BulkUnassignKeysFromGuardrail404", BulkUnassignKeysFromGuardrail404), + "500": decodeError("BulkUnassignKeysFromGuardrail500", BulkUnassignKeysFromGuardrail500), + orElse: unexpectedStatus + })) + ), + "listGuardrailMemberAssignments": (id, options) => + HttpClientRequest.get(`/guardrails/${id}/assignments/members`).pipe( + HttpClientRequest.setUrlParams({ + "offset": options?.params?.["offset"] as any, + "limit": options?.params?.["limit"] as any + }), + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(ListGuardrailMemberAssignments200), + "401": decodeError("ListGuardrailMemberAssignments401", ListGuardrailMemberAssignments401), + "404": decodeError("ListGuardrailMemberAssignments404", ListGuardrailMemberAssignments404), + "500": decodeError("ListGuardrailMemberAssignments500", ListGuardrailMemberAssignments500), orElse: unexpectedStatus })) ), - "createResponsesSse": (options) => - HttpClientRequest.post(`/responses`).pipe( + "bulkAssignMembersToGuardrail": (id, options) => + HttpClientRequest.post(`/guardrails/${id}/assignments/members`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), HttpClientRequest.bodyJsonUnsafe(options.payload), - sseRequest(CreateResponses200Sse) + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(BulkAssignMembersToGuardrail200), + "400": decodeError("BulkAssignMembersToGuardrail400", BulkAssignMembersToGuardrail400), + "401": decodeError("BulkAssignMembersToGuardrail401", BulkAssignMembersToGuardrail401), + "404": decodeError("BulkAssignMembersToGuardrail404", BulkAssignMembersToGuardrail404), + "500": decodeError("BulkAssignMembersToGuardrail500", BulkAssignMembersToGuardrail500), + orElse: unexpectedStatus + })) ), - "createMessages": (options) => - HttpClientRequest.post(`/messages`).pipe( + "bulkUnassignMembersFromGuardrail": (id, options) => + HttpClientRequest.post(`/guardrails/${id}/assignments/members/remove`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(CreateMessages200), - "400": decodeError("CreateMessages400", CreateMessages400), - "401": decodeError("CreateMessages401", CreateMessages401), - "403": decodeError("CreateMessages403", CreateMessages403), - "404": decodeError("CreateMessages404", CreateMessages404), - "429": decodeError("CreateMessages429", CreateMessages429), - "500": decodeError("CreateMessages500", CreateMessages500), - "503": decodeError("CreateMessages503", CreateMessages503), - "529": decodeError("CreateMessages529", CreateMessages529), + "2xx": decodeSuccess(BulkUnassignMembersFromGuardrail200), + "400": decodeError("BulkUnassignMembersFromGuardrail400", BulkUnassignMembersFromGuardrail400), + "401": decodeError("BulkUnassignMembersFromGuardrail401", BulkUnassignMembersFromGuardrail401), + "404": decodeError("BulkUnassignMembersFromGuardrail404", BulkUnassignMembersFromGuardrail404), + "500": decodeError("BulkUnassignMembersFromGuardrail500", BulkUnassignMembersFromGuardrail500), orElse: unexpectedStatus })) ), - "createMessagesSse": (options) => - HttpClientRequest.post(`/messages`).pipe( - HttpClientRequest.bodyJsonUnsafe(options.payload), - sseRequest(CreateMessages200Sse) + "listKeyAssignments": (options) => + HttpClientRequest.get(`/guardrails/assignments/keys`).pipe( + HttpClientRequest.setUrlParams({ + "offset": options?.params?.["offset"] as any, + "limit": options?.params?.["limit"] as any + }), + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(ListKeyAssignments200), + "401": decodeError("ListKeyAssignments401", ListKeyAssignments401), + "500": decodeError("ListKeyAssignments500", ListKeyAssignments500), + orElse: unexpectedStatus + })) ), - "getUserActivity": (options) => - HttpClientRequest.get(`/activity`).pipe( - HttpClientRequest.setUrlParams({ "date": options?.params?.["date"] as any }), + "listMemberAssignments": (options) => + HttpClientRequest.get(`/guardrails/assignments/members`).pipe( + HttpClientRequest.setUrlParams({ + "offset": options?.params?.["offset"] as any, + "limit": options?.params?.["limit"] as any + }), + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(GetUserActivity200), - "400": decodeError("GetUserActivity400", GetUserActivity400), - "401": decodeError("GetUserActivity401", GetUserActivity401), - "403": decodeError("GetUserActivity403", GetUserActivity403), - "500": decodeError("GetUserActivity500", GetUserActivity500), + "2xx": decodeSuccess(ListMemberAssignments200), + "401": decodeError("ListMemberAssignments401", ListMemberAssignments401), + "500": decodeError("ListMemberAssignments500", ListMemberAssignments500), orElse: unexpectedStatus })) ), - "getCredits": (options) => - HttpClientRequest.get(`/credits`).pipe( + "getCurrentKey": (options) => + HttpClientRequest.get(`/key`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(GetCredits200), - "401": decodeError("GetCredits401", GetCredits401), - "403": decodeError("GetCredits403", GetCredits403), - "500": decodeError("GetCredits500", GetCredits500), + "2xx": decodeSuccess(GetCurrentKey200), + "401": decodeError("GetCurrentKey401", GetCurrentKey401), + "500": decodeError("GetCurrentKey500", GetCurrentKey500), orElse: unexpectedStatus })) ), - "createCoinbaseCharge": (options) => - HttpClientRequest.post(`/credits/coinbase`).pipe( - HttpClientRequest.bodyJsonUnsafe(options.payload), - withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(CreateCoinbaseCharge200), - "400": decodeError("CreateCoinbaseCharge400", CreateCoinbaseCharge400), - "401": decodeError("CreateCoinbaseCharge401", CreateCoinbaseCharge401), - "429": decodeError("CreateCoinbaseCharge429", CreateCoinbaseCharge429), - "500": decodeError("CreateCoinbaseCharge500", CreateCoinbaseCharge500), + "list": (options) => + HttpClientRequest.get(`/keys`).pipe( + HttpClientRequest.setUrlParams({ + "include_disabled": options?.params?.["include_disabled"] as any, + "offset": options?.params?.["offset"] as any, + "workspace_id": options?.params?.["workspace_id"] as any + }), + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(List200), + "401": decodeError("List401", List401), + "429": decodeError("List429", List429), + "500": decodeError("List500", List500), orElse: unexpectedStatus })) ), - "createEmbeddings": (options) => - HttpClientRequest.post(`/embeddings`).pipe( + "createKeys": (options) => + HttpClientRequest.post(`/keys`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(CreateEmbeddings200), - "400": decodeError("CreateEmbeddings400", CreateEmbeddings400), - "401": decodeError("CreateEmbeddings401", CreateEmbeddings401), - "402": decodeError("CreateEmbeddings402", CreateEmbeddings402), - "404": decodeError("CreateEmbeddings404", CreateEmbeddings404), - "429": decodeError("CreateEmbeddings429", CreateEmbeddings429), - "500": decodeError("CreateEmbeddings500", CreateEmbeddings500), - "502": decodeError("CreateEmbeddings502", CreateEmbeddings502), - "503": decodeError("CreateEmbeddings503", CreateEmbeddings503), - "524": decodeError("CreateEmbeddings524", CreateEmbeddings524), - "529": decodeError("CreateEmbeddings529", CreateEmbeddings529), + "2xx": decodeSuccess(CreateKeys201), + "400": decodeError("CreateKeys400", CreateKeys400), + "401": decodeError("CreateKeys401", CreateKeys401), + "403": decodeError("CreateKeys403", CreateKeys403), + "429": decodeError("CreateKeys429", CreateKeys429), + "500": decodeError("CreateKeys500", CreateKeys500), orElse: unexpectedStatus })) ), - "createEmbeddingsSse": (options) => - HttpClientRequest.post(`/embeddings`).pipe( - HttpClientRequest.bodyJsonUnsafe(options.payload), - sseRequest(CreateEmbeddings200Sse) + "getKey": (hash, options) => + HttpClientRequest.get(`/keys/${hash}`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(GetKey200), + "401": decodeError("GetKey401", GetKey401), + "404": decodeError("GetKey404", GetKey404), + "429": decodeError("GetKey429", GetKey429), + "500": decodeError("GetKey500", GetKey500), + orElse: unexpectedStatus + })) ), - "listEmbeddingsModels": (options) => - HttpClientRequest.get(`/embeddings/models`).pipe( + "deleteKeys": (hash, options) => + HttpClientRequest.delete(`/keys/${hash}`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(ListEmbeddingsModels200), - "400": decodeError("ListEmbeddingsModels400", ListEmbeddingsModels400), - "500": decodeError("ListEmbeddingsModels500", ListEmbeddingsModels500), + "2xx": decodeSuccess(DeleteKeys200), + "401": decodeError("DeleteKeys401", DeleteKeys401), + "404": decodeError("DeleteKeys404", DeleteKeys404), + "429": decodeError("DeleteKeys429", DeleteKeys429), + "500": decodeError("DeleteKeys500", DeleteKeys500), orElse: unexpectedStatus })) ), - "getGeneration": (options) => - HttpClientRequest.get(`/generation`).pipe( - HttpClientRequest.setUrlParams({ "id": options.params["id"] as any }), + "updateKeys": (hash, options) => + HttpClientRequest.patch(`/keys/${hash}`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(GetGeneration200), - "401": decodeError("GetGeneration401", GetGeneration401), - "402": decodeError("GetGeneration402", GetGeneration402), - "404": decodeError("GetGeneration404", GetGeneration404), - "429": decodeError("GetGeneration429", GetGeneration429), - "500": decodeError("GetGeneration500", GetGeneration500), - "502": decodeError("GetGeneration502", GetGeneration502), - "524": decodeError("GetGeneration524", GetGeneration524), - "529": decodeError("GetGeneration529", GetGeneration529), + "2xx": decodeSuccess(UpdateKeys200), + "400": decodeError("UpdateKeys400", UpdateKeys400), + "401": decodeError("UpdateKeys401", UpdateKeys401), + "404": decodeError("UpdateKeys404", UpdateKeys404), + "429": decodeError("UpdateKeys429", UpdateKeys429), + "500": decodeError("UpdateKeys500", UpdateKeys500), orElse: unexpectedStatus })) ), - "listModelsCount": (options) => - HttpClientRequest.get(`/models/count`).pipe( - withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(ListModelsCount200), - "500": decodeError("ListModelsCount500", ListModelsCount500), + "createMessages": (options) => + HttpClientRequest.post(`/messages`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined, + "X-OpenRouter-Experimental-Metadata": options.params?.["X-OpenRouter-Experimental-Metadata"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(CreateMessages200), + "400": decodeError("CreateMessages400", CreateMessages400), + "401": decodeError("CreateMessages401", CreateMessages401), + "403": decodeError("CreateMessages403", CreateMessages403), + "404": decodeError("CreateMessages404", CreateMessages404), + "429": decodeError("CreateMessages429", CreateMessages429), + "500": decodeError("CreateMessages500", CreateMessages500), + "503": decodeError("CreateMessages503", CreateMessages503), + "529": decodeError("CreateMessages529", CreateMessages529), orElse: unexpectedStatus })) ), + "createMessagesSse": (options) => + HttpClientRequest.post(`/messages`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined, + "X-OpenRouter-Experimental-Metadata": options.params?.["X-OpenRouter-Experimental-Metadata"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + sseRequest(CreateMessages200Sse) + ), "getModels": (options) => HttpClientRequest.get(`/models`).pipe( HttpClientRequest.setUrlParams({ "category": options?.params?.["category"] as any, - "supported_parameters": options?.params?.["supported_parameters"] as any + "supported_parameters": options?.params?.["supported_parameters"] as any, + "output_modalities": options?.params?.["output_modalities"] as any + }), + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ "2xx": decodeSuccess(GetModels200), @@ -9100,18 +24613,13 @@ export const make = ( orElse: unexpectedStatus })) ), - "listModelsUser": (options) => - HttpClientRequest.get(`/models/user`).pipe( - withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(ListModelsUser200), - "401": decodeError("ListModelsUser401", ListModelsUser401), - "404": decodeError("ListModelsUser404", ListModelsUser404), - "500": decodeError("ListModelsUser500", ListModelsUser500), - orElse: unexpectedStatus - })) - ), "listEndpoints": (author, slug, options) => HttpClientRequest.get(`/models/${author}/${slug}/endpoints`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), withResponse(options?.config)(HttpClientResponse.matchStatus({ "2xx": decodeSuccess(ListEndpoints200), "404": decodeError("ListEndpoints404", ListEndpoints404), @@ -9119,288 +24627,439 @@ export const make = ( orElse: unexpectedStatus })) ), - "listEndpointsZdr": (options) => - HttpClientRequest.get(`/endpoints/zdr`).pipe( + "listModelsCount": (options) => + HttpClientRequest.get(`/models/count`).pipe( + HttpClientRequest.setUrlParams({ "output_modalities": options?.params?.["output_modalities"] as any }), + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(ListEndpointsZdr200), - "500": decodeError("ListEndpointsZdr500", ListEndpointsZdr500), + "2xx": decodeSuccess(ListModelsCount200), + "400": decodeError("ListModelsCount400", ListModelsCount400), + "500": decodeError("ListModelsCount500", ListModelsCount500), orElse: unexpectedStatus })) ), - "listProviders": (options) => - HttpClientRequest.get(`/providers`).pipe( + "listModelsUser": (options) => + HttpClientRequest.get(`/models/user`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(ListProviders200), - "500": decodeError("ListProviders500", ListProviders500), + "2xx": decodeSuccess(ListModelsUser200), + "401": decodeError("ListModelsUser401", ListModelsUser401), + "404": decodeError("ListModelsUser404", ListModelsUser404), + "500": decodeError("ListModelsUser500", ListModelsUser500), orElse: unexpectedStatus })) ), - "list": (options) => - HttpClientRequest.get(`/keys`).pipe( + "listObservabilityDestinations": (options) => + HttpClientRequest.get(`/observability/destinations`).pipe( HttpClientRequest.setUrlParams({ - "include_disabled": options?.params?.["include_disabled"] as any, - "offset": options?.params?.["offset"] as any + "offset": options?.params?.["offset"] as any, + "limit": options?.params?.["limit"] as any, + "workspace_id": options?.params?.["workspace_id"] as any + }), + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(List200), - "401": decodeError("List401", List401), - "429": decodeError("List429", List429), - "500": decodeError("List500", List500), + "2xx": decodeSuccess(ListObservabilityDestinations200), + "401": decodeError("ListObservabilityDestinations401", ListObservabilityDestinations401), + "500": decodeError("ListObservabilityDestinations500", ListObservabilityDestinations500), orElse: unexpectedStatus })) ), - "createKeys": (options) => - HttpClientRequest.post(`/keys`).pipe( + "createObservabilityDestination": (options) => + HttpClientRequest.post(`/observability/destinations`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(CreateKeys201), - "400": decodeError("CreateKeys400", CreateKeys400), - "401": decodeError("CreateKeys401", CreateKeys401), - "429": decodeError("CreateKeys429", CreateKeys429), - "500": decodeError("CreateKeys500", CreateKeys500), + "2xx": decodeSuccess(CreateObservabilityDestination201), + "400": decodeError("CreateObservabilityDestination400", CreateObservabilityDestination400), + "401": decodeError("CreateObservabilityDestination401", CreateObservabilityDestination401), + "403": decodeError("CreateObservabilityDestination403", CreateObservabilityDestination403), + "409": decodeError("CreateObservabilityDestination409", CreateObservabilityDestination409), + "500": decodeError("CreateObservabilityDestination500", CreateObservabilityDestination500), orElse: unexpectedStatus })) ), - "getKey": (hash, options) => - HttpClientRequest.get(`/keys/${hash}`).pipe( + "getObservabilityDestination": (id, options) => + HttpClientRequest.get(`/observability/destinations/${id}`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(GetKey200), - "401": decodeError("GetKey401", GetKey401), - "404": decodeError("GetKey404", GetKey404), - "429": decodeError("GetKey429", GetKey429), - "500": decodeError("GetKey500", GetKey500), + "2xx": decodeSuccess(GetObservabilityDestination200), + "401": decodeError("GetObservabilityDestination401", GetObservabilityDestination401), + "404": decodeError("GetObservabilityDestination404", GetObservabilityDestination404), + "500": decodeError("GetObservabilityDestination500", GetObservabilityDestination500), orElse: unexpectedStatus })) ), - "deleteKeys": (hash, options) => - HttpClientRequest.delete(`/keys/${hash}`).pipe( + "deleteObservabilityDestination": (id, options) => + HttpClientRequest.delete(`/observability/destinations/${id}`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(DeleteKeys200), - "401": decodeError("DeleteKeys401", DeleteKeys401), - "404": decodeError("DeleteKeys404", DeleteKeys404), - "429": decodeError("DeleteKeys429", DeleteKeys429), - "500": decodeError("DeleteKeys500", DeleteKeys500), + "2xx": decodeSuccess(DeleteObservabilityDestination200), + "401": decodeError("DeleteObservabilityDestination401", DeleteObservabilityDestination401), + "404": decodeError("DeleteObservabilityDestination404", DeleteObservabilityDestination404), + "500": decodeError("DeleteObservabilityDestination500", DeleteObservabilityDestination500), orElse: unexpectedStatus })) ), - "updateKeys": (hash, options) => - HttpClientRequest.patch(`/keys/${hash}`).pipe( + "updateObservabilityDestination": (id, options) => + HttpClientRequest.patch(`/observability/destinations/${id}`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(UpdateKeys200), - "400": decodeError("UpdateKeys400", UpdateKeys400), - "401": decodeError("UpdateKeys401", UpdateKeys401), - "404": decodeError("UpdateKeys404", UpdateKeys404), - "429": decodeError("UpdateKeys429", UpdateKeys429), - "500": decodeError("UpdateKeys500", UpdateKeys500), + "2xx": decodeSuccess(UpdateObservabilityDestination200), + "400": decodeError("UpdateObservabilityDestination400", UpdateObservabilityDestination400), + "401": decodeError("UpdateObservabilityDestination401", UpdateObservabilityDestination401), + "404": decodeError("UpdateObservabilityDestination404", UpdateObservabilityDestination404), + "409": decodeError("UpdateObservabilityDestination409", UpdateObservabilityDestination409), + "500": decodeError("UpdateObservabilityDestination500", UpdateObservabilityDestination500), orElse: unexpectedStatus })) ), - "listGuardrails": (options) => - HttpClientRequest.get(`/guardrails`).pipe( + "listOrganizationMembers": (options) => + HttpClientRequest.get(`/organization/members`).pipe( HttpClientRequest.setUrlParams({ "offset": options?.params?.["offset"] as any, "limit": options?.params?.["limit"] as any }), + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(ListGuardrails200), - "401": decodeError("ListGuardrails401", ListGuardrails401), - "500": decodeError("ListGuardrails500", ListGuardrails500), + "2xx": decodeSuccess(ListOrganizationMembers200), + "401": decodeError("ListOrganizationMembers401", ListOrganizationMembers401), + "404": decodeError("ListOrganizationMembers404", ListOrganizationMembers404), + "500": decodeError("ListOrganizationMembers500", ListOrganizationMembers500), orElse: unexpectedStatus })) ), - "createGuardrail": (options) => - HttpClientRequest.post(`/guardrails`).pipe( + "createPresetsChatCompletions": (slug, options) => + HttpClientRequest.post(`/presets/${slug}/chat/completions`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(CreateGuardrail201), - "400": decodeError("CreateGuardrail400", CreateGuardrail400), - "401": decodeError("CreateGuardrail401", CreateGuardrail401), - "500": decodeError("CreateGuardrail500", CreateGuardrail500), + "2xx": decodeSuccess(CreatePresetsChatCompletions200), + "400": decodeError("CreatePresetsChatCompletions400", CreatePresetsChatCompletions400), + "401": decodeError("CreatePresetsChatCompletions401", CreatePresetsChatCompletions401), + "403": decodeError("CreatePresetsChatCompletions403", CreatePresetsChatCompletions403), + "404": decodeError("CreatePresetsChatCompletions404", CreatePresetsChatCompletions404), + "409": decodeError("CreatePresetsChatCompletions409", CreatePresetsChatCompletions409), + "500": decodeError("CreatePresetsChatCompletions500", CreatePresetsChatCompletions500), orElse: unexpectedStatus })) ), - "getGuardrail": (id, options) => - HttpClientRequest.get(`/guardrails/${id}`).pipe( + "listProviders": (options) => + HttpClientRequest.get(`/providers`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(GetGuardrail200), - "401": decodeError("GetGuardrail401", GetGuardrail401), - "404": decodeError("GetGuardrail404", GetGuardrail404), - "500": decodeError("GetGuardrail500", GetGuardrail500), + "2xx": decodeSuccess(ListProviders200), + "500": decodeError("ListProviders500", ListProviders500), orElse: unexpectedStatus })) ), - "deleteGuardrail": (id, options) => - HttpClientRequest.delete(`/guardrails/${id}`).pipe( - withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(DeleteGuardrail200), - "401": decodeError("DeleteGuardrail401", DeleteGuardrail401), - "404": decodeError("DeleteGuardrail404", DeleteGuardrail404), - "500": decodeError("DeleteGuardrail500", DeleteGuardrail500), + "createRerank": (options) => + HttpClientRequest.post(`/rerank`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(CreateRerank200), + "400": decodeError("CreateRerank400", CreateRerank400), + "401": decodeError("CreateRerank401", CreateRerank401), + "402": decodeError("CreateRerank402", CreateRerank402), + "404": decodeError("CreateRerank404", CreateRerank404), + "429": decodeError("CreateRerank429", CreateRerank429), + "500": decodeError("CreateRerank500", CreateRerank500), + "502": decodeError("CreateRerank502", CreateRerank502), + "503": decodeError("CreateRerank503", CreateRerank503), + "524": decodeError("CreateRerank524", CreateRerank524), + "529": decodeError("CreateRerank529", CreateRerank529), orElse: unexpectedStatus })) ), - "updateGuardrail": (id, options) => - HttpClientRequest.patch(`/guardrails/${id}`).pipe( + "createRerankSse": (options) => + HttpClientRequest.post(`/rerank`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + sseRequest(CreateRerank200Sse) + ), + "createResponses": (options) => + HttpClientRequest.post(`/responses`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined, + "X-OpenRouter-Experimental-Metadata": options.params?.["X-OpenRouter-Experimental-Metadata"] ?? undefined + }), HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(UpdateGuardrail200), - "400": decodeError("UpdateGuardrail400", UpdateGuardrail400), - "401": decodeError("UpdateGuardrail401", UpdateGuardrail401), - "404": decodeError("UpdateGuardrail404", UpdateGuardrail404), - "500": decodeError("UpdateGuardrail500", UpdateGuardrail500), + "2xx": decodeSuccess(CreateResponses200), + "400": decodeError("CreateResponses400", CreateResponses400), + "401": decodeError("CreateResponses401", CreateResponses401), + "402": decodeError("CreateResponses402", CreateResponses402), + "403": decodeError("CreateResponses403", CreateResponses403), + "404": decodeError("CreateResponses404", CreateResponses404), + "408": decodeError("CreateResponses408", CreateResponses408), + "413": decodeError("CreateResponses413", CreateResponses413), + "422": decodeError("CreateResponses422", CreateResponses422), + "429": decodeError("CreateResponses429", CreateResponses429), + "500": decodeError("CreateResponses500", CreateResponses500), + "502": decodeError("CreateResponses502", CreateResponses502), + "503": decodeError("CreateResponses503", CreateResponses503), + "524": decodeError("CreateResponses524", CreateResponses524), + "529": decodeError("CreateResponses529", CreateResponses529), orElse: unexpectedStatus })) ), - "listKeyAssignments": (options) => - HttpClientRequest.get(`/guardrails/assignments/keys`).pipe( - HttpClientRequest.setUrlParams({ - "offset": options?.params?.["offset"] as any, - "limit": options?.params?.["limit"] as any + "createResponsesSse": (options) => + HttpClientRequest.post(`/responses`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined, + "X-OpenRouter-Experimental-Metadata": options.params?.["X-OpenRouter-Experimental-Metadata"] ?? undefined }), - withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(ListKeyAssignments200), - "401": decodeError("ListKeyAssignments401", ListKeyAssignments401), - "500": decodeError("ListKeyAssignments500", ListKeyAssignments500), + HttpClientRequest.bodyJsonUnsafe(options.payload), + sseRequest(CreateResponses200Sse) + ), + "createVideos": (options) => + HttpClientRequest.post(`/videos`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), + HttpClientRequest.bodyJsonUnsafe(options.payload), + withResponse(options.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(CreateVideos202), + "400": decodeError("CreateVideos400", CreateVideos400), + "401": decodeError("CreateVideos401", CreateVideos401), + "402": decodeError("CreateVideos402", CreateVideos402), + "404": decodeError("CreateVideos404", CreateVideos404), + "429": decodeError("CreateVideos429", CreateVideos429), + "500": decodeError("CreateVideos500", CreateVideos500), orElse: unexpectedStatus })) ), - "listMemberAssignments": (options) => - HttpClientRequest.get(`/guardrails/assignments/members`).pipe( - HttpClientRequest.setUrlParams({ - "offset": options?.params?.["offset"] as any, - "limit": options?.params?.["limit"] as any + "getVideos": (jobId, options) => + HttpClientRequest.get(`/videos/${jobId}`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(ListMemberAssignments200), - "401": decodeError("ListMemberAssignments401", ListMemberAssignments401), - "500": decodeError("ListMemberAssignments500", ListMemberAssignments500), + "2xx": decodeSuccess(GetVideos200), + "401": decodeError("GetVideos401", GetVideos401), + "404": decodeError("GetVideos404", GetVideos404), + "500": decodeError("GetVideos500", GetVideos500), orElse: unexpectedStatus })) ), - "listGuardrailKeyAssignments": (id, options) => - HttpClientRequest.get(`/guardrails/${id}/assignments/keys`).pipe( - HttpClientRequest.setUrlParams({ - "offset": options?.params?.["offset"] as any, - "limit": options?.params?.["limit"] as any + "listVideosContent": (jobId, options) => + HttpClientRequest.get(`/videos/${jobId}/content`).pipe( + HttpClientRequest.setUrlParams({ "index": options?.params?.["index"] as any }), + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(ListGuardrailKeyAssignments200), - "401": decodeError("ListGuardrailKeyAssignments401", ListGuardrailKeyAssignments401), - "404": decodeError("ListGuardrailKeyAssignments404", ListGuardrailKeyAssignments404), - "500": decodeError("ListGuardrailKeyAssignments500", ListGuardrailKeyAssignments500), + "400": decodeError("ListVideosContent400", ListVideosContent400), + "401": decodeError("ListVideosContent401", ListVideosContent401), + "404": decodeError("ListVideosContent404", ListVideosContent404), + "500": decodeError("ListVideosContent500", ListVideosContent500), + "502": decodeError("ListVideosContent502", ListVideosContent502), orElse: unexpectedStatus })) ), - "bulkAssignKeysToGuardrail": (id, options) => - HttpClientRequest.post(`/guardrails/${id}/assignments/keys`).pipe( - HttpClientRequest.bodyJsonUnsafe(options.payload), - withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BulkAssignKeysToGuardrail200), - "400": decodeError("BulkAssignKeysToGuardrail400", BulkAssignKeysToGuardrail400), - "401": decodeError("BulkAssignKeysToGuardrail401", BulkAssignKeysToGuardrail401), - "404": decodeError("BulkAssignKeysToGuardrail404", BulkAssignKeysToGuardrail404), - "500": decodeError("BulkAssignKeysToGuardrail500", BulkAssignKeysToGuardrail500), + "listVideosContentStream": (jobId, options) => + HttpClientRequest.get(`/videos/${jobId}/content`).pipe( + HttpClientRequest.setUrlParams({ "index": options?.params?.["index"] as any }), + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), + binaryRequest + ), + "listVideosModels": (options) => + HttpClientRequest.get(`/videos/models`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(ListVideosModels200), + "400": decodeError("ListVideosModels400", ListVideosModels400), + "500": decodeError("ListVideosModels500", ListVideosModels500), orElse: unexpectedStatus })) ), - "listGuardrailMemberAssignments": (id, options) => - HttpClientRequest.get(`/guardrails/${id}/assignments/members`).pipe( + "listWorkspaces": (options) => + HttpClientRequest.get(`/workspaces`).pipe( HttpClientRequest.setUrlParams({ "offset": options?.params?.["offset"] as any, "limit": options?.params?.["limit"] as any }), + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(ListGuardrailMemberAssignments200), - "401": decodeError("ListGuardrailMemberAssignments401", ListGuardrailMemberAssignments401), - "404": decodeError("ListGuardrailMemberAssignments404", ListGuardrailMemberAssignments404), - "500": decodeError("ListGuardrailMemberAssignments500", ListGuardrailMemberAssignments500), - orElse: unexpectedStatus - })) - ), - "bulkAssignMembersToGuardrail": (id, options) => - HttpClientRequest.post(`/guardrails/${id}/assignments/members`).pipe( - HttpClientRequest.bodyJsonUnsafe(options.payload), - withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BulkAssignMembersToGuardrail200), - "400": decodeError("BulkAssignMembersToGuardrail400", BulkAssignMembersToGuardrail400), - "401": decodeError("BulkAssignMembersToGuardrail401", BulkAssignMembersToGuardrail401), - "404": decodeError("BulkAssignMembersToGuardrail404", BulkAssignMembersToGuardrail404), - "500": decodeError("BulkAssignMembersToGuardrail500", BulkAssignMembersToGuardrail500), + "2xx": decodeSuccess(ListWorkspaces200), + "401": decodeError("ListWorkspaces401", ListWorkspaces401), + "500": decodeError("ListWorkspaces500", ListWorkspaces500), orElse: unexpectedStatus })) ), - "bulkUnassignKeysFromGuardrail": (id, options) => - HttpClientRequest.post(`/guardrails/${id}/assignments/keys/remove`).pipe( + "createWorkspace": (options) => + HttpClientRequest.post(`/workspaces`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BulkUnassignKeysFromGuardrail200), - "400": decodeError("BulkUnassignKeysFromGuardrail400", BulkUnassignKeysFromGuardrail400), - "401": decodeError("BulkUnassignKeysFromGuardrail401", BulkUnassignKeysFromGuardrail401), - "404": decodeError("BulkUnassignKeysFromGuardrail404", BulkUnassignKeysFromGuardrail404), - "500": decodeError("BulkUnassignKeysFromGuardrail500", BulkUnassignKeysFromGuardrail500), + "2xx": decodeSuccess(CreateWorkspace201), + "400": decodeError("CreateWorkspace400", CreateWorkspace400), + "401": decodeError("CreateWorkspace401", CreateWorkspace401), + "403": decodeError("CreateWorkspace403", CreateWorkspace403), + "500": decodeError("CreateWorkspace500", CreateWorkspace500), orElse: unexpectedStatus })) ), - "bulkUnassignMembersFromGuardrail": (id, options) => - HttpClientRequest.post(`/guardrails/${id}/assignments/members/remove`).pipe( - HttpClientRequest.bodyJsonUnsafe(options.payload), - withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(BulkUnassignMembersFromGuardrail200), - "400": decodeError("BulkUnassignMembersFromGuardrail400", BulkUnassignMembersFromGuardrail400), - "401": decodeError("BulkUnassignMembersFromGuardrail401", BulkUnassignMembersFromGuardrail401), - "404": decodeError("BulkUnassignMembersFromGuardrail404", BulkUnassignMembersFromGuardrail404), - "500": decodeError("BulkUnassignMembersFromGuardrail500", BulkUnassignMembersFromGuardrail500), + "getWorkspace": (id, options) => + HttpClientRequest.get(`/workspaces/${id}`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), + withResponse(options?.config)(HttpClientResponse.matchStatus({ + "2xx": decodeSuccess(GetWorkspace200), + "401": decodeError("GetWorkspace401", GetWorkspace401), + "404": decodeError("GetWorkspace404", GetWorkspace404), + "500": decodeError("GetWorkspace500", GetWorkspace500), orElse: unexpectedStatus })) ), - "getCurrentKey": (options) => - HttpClientRequest.get(`/key`).pipe( + "deleteWorkspace": (id, options) => + HttpClientRequest.delete(`/workspaces/${id}`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options?.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options?.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options?.params?.["X-OpenRouter-Categories"] ?? undefined + }), withResponse(options?.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(GetCurrentKey200), - "401": decodeError("GetCurrentKey401", GetCurrentKey401), - "500": decodeError("GetCurrentKey500", GetCurrentKey500), + "2xx": decodeSuccess(DeleteWorkspace200), + "400": decodeError("DeleteWorkspace400", DeleteWorkspace400), + "401": decodeError("DeleteWorkspace401", DeleteWorkspace401), + "403": decodeError("DeleteWorkspace403", DeleteWorkspace403), + "404": decodeError("DeleteWorkspace404", DeleteWorkspace404), + "500": decodeError("DeleteWorkspace500", DeleteWorkspace500), orElse: unexpectedStatus })) ), - "exchangeAuthCodeForAPIKey": (options) => - HttpClientRequest.post(`/auth/keys`).pipe( + "updateWorkspace": (id, options) => + HttpClientRequest.patch(`/workspaces/${id}`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(ExchangeAuthCodeForAPIKey200), - "400": decodeError("ExchangeAuthCodeForAPIKey400", ExchangeAuthCodeForAPIKey400), - "403": decodeError("ExchangeAuthCodeForAPIKey403", ExchangeAuthCodeForAPIKey403), - "500": decodeError("ExchangeAuthCodeForAPIKey500", ExchangeAuthCodeForAPIKey500), + "2xx": decodeSuccess(UpdateWorkspace200), + "400": decodeError("UpdateWorkspace400", UpdateWorkspace400), + "401": decodeError("UpdateWorkspace401", UpdateWorkspace401), + "403": decodeError("UpdateWorkspace403", UpdateWorkspace403), + "404": decodeError("UpdateWorkspace404", UpdateWorkspace404), + "500": decodeError("UpdateWorkspace500", UpdateWorkspace500), orElse: unexpectedStatus })) ), - "createAuthKeysCode": (options) => - HttpClientRequest.post(`/auth/keys/code`).pipe( + "bulkAddWorkspaceMembers": (id, options) => + HttpClientRequest.post(`/workspaces/${id}/members/add`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(CreateAuthKeysCode200), - "400": decodeError("CreateAuthKeysCode400", CreateAuthKeysCode400), - "401": decodeError("CreateAuthKeysCode401", CreateAuthKeysCode401), - "500": decodeError("CreateAuthKeysCode500", CreateAuthKeysCode500), + "2xx": decodeSuccess(BulkAddWorkspaceMembers200), + "400": decodeError("BulkAddWorkspaceMembers400", BulkAddWorkspaceMembers400), + "401": decodeError("BulkAddWorkspaceMembers401", BulkAddWorkspaceMembers401), + "403": decodeError("BulkAddWorkspaceMembers403", BulkAddWorkspaceMembers403), + "404": decodeError("BulkAddWorkspaceMembers404", BulkAddWorkspaceMembers404), + "500": decodeError("BulkAddWorkspaceMembers500", BulkAddWorkspaceMembers500), orElse: unexpectedStatus })) ), - "sendChatCompletionRequest": (options) => - HttpClientRequest.post(`/chat/completions`).pipe( + "bulkRemoveWorkspaceMembers": (id, options) => + HttpClientRequest.post(`/workspaces/${id}/members/remove`).pipe( + HttpClientRequest.setHeaders({ + "HTTP-Referer": options.params?.["HTTP-Referer"] ?? undefined, + "X-OpenRouter-Title": options.params?.["X-OpenRouter-Title"] ?? undefined, + "X-OpenRouter-Categories": options.params?.["X-OpenRouter-Categories"] ?? undefined + }), HttpClientRequest.bodyJsonUnsafe(options.payload), withResponse(options.config)(HttpClientResponse.matchStatus({ - "2xx": decodeSuccess(SendChatCompletionRequest200), - "400": decodeError("SendChatCompletionRequest400", SendChatCompletionRequest400), - "401": decodeError("SendChatCompletionRequest401", SendChatCompletionRequest401), - "429": decodeError("SendChatCompletionRequest429", SendChatCompletionRequest429), - "500": decodeError("SendChatCompletionRequest500", SendChatCompletionRequest500), + "2xx": decodeSuccess(BulkRemoveWorkspaceMembers200), + "400": decodeError("BulkRemoveWorkspaceMembers400", BulkRemoveWorkspaceMembers400), + "401": decodeError("BulkRemoveWorkspaceMembers401", BulkRemoveWorkspaceMembers401), + "403": decodeError("BulkRemoveWorkspaceMembers403", BulkRemoveWorkspaceMembers403), + "404": decodeError("BulkRemoveWorkspaceMembers404", BulkRemoveWorkspaceMembers404), + "500": decodeError("BulkRemoveWorkspaceMembers500", BulkRemoveWorkspaceMembers500), orElse: unexpectedStatus })) - ), - "sendChatCompletionRequestSse": (options) => - HttpClientRequest.post(`/chat/completions`).pipe( - HttpClientRequest.bodyJsonUnsafe(options.payload), - sseRequest(SendChatCompletionRequest200Sse) ) } } @@ -9408,88 +25067,241 @@ export const make = ( export interface OpenRouterClient { readonly httpClient: HttpClient.HttpClient /** - * Creates a streaming or non-streaming response using OpenResponses API format + * Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Management key](/docs/guides/overview/auth/management-api-keys) required. + */ + readonly "getUserActivity": ( + options: { + readonly params?: typeof GetUserActivityParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"GetUserActivity400", typeof GetUserActivity400.Type> + | OpenRouterClientError<"GetUserActivity401", typeof GetUserActivity401.Type> + | OpenRouterClientError<"GetUserActivity403", typeof GetUserActivity403.Type> + | OpenRouterClientError<"GetUserActivity404", typeof GetUserActivity404.Type> + | OpenRouterClientError<"GetUserActivity500", typeof GetUserActivity500.Type> + > + /** + * Synthesizes audio from the input text. Returns a raw audio bytestream in the requested format (e.g. mp3, pcm, wav). + */ + readonly "createAudioSpeech": ( + options: { + readonly params?: typeof CreateAudioSpeechParams.Encoded | undefined + readonly payload: typeof CreateAudioSpeechRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"CreateAudioSpeech400", typeof CreateAudioSpeech400.Type> + | OpenRouterClientError<"CreateAudioSpeech401", typeof CreateAudioSpeech401.Type> + | OpenRouterClientError<"CreateAudioSpeech402", typeof CreateAudioSpeech402.Type> + | OpenRouterClientError<"CreateAudioSpeech404", typeof CreateAudioSpeech404.Type> + | OpenRouterClientError<"CreateAudioSpeech429", typeof CreateAudioSpeech429.Type> + | OpenRouterClientError<"CreateAudioSpeech500", typeof CreateAudioSpeech500.Type> + | OpenRouterClientError<"CreateAudioSpeech502", typeof CreateAudioSpeech502.Type> + | OpenRouterClientError<"CreateAudioSpeech503", typeof CreateAudioSpeech503.Type> + | OpenRouterClientError<"CreateAudioSpeech524", typeof CreateAudioSpeech524.Type> + | OpenRouterClientError<"CreateAudioSpeech529", typeof CreateAudioSpeech529.Type> + > + /** + * Transcribes audio into text. Accepts base64-encoded audio input and returns the transcribed text. + */ + readonly "createAudioTranscriptions": ( + options: { + readonly params?: typeof CreateAudioTranscriptionsParams.Encoded | undefined + readonly payload: typeof CreateAudioTranscriptionsRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"CreateAudioTranscriptions400", typeof CreateAudioTranscriptions400.Type> + | OpenRouterClientError<"CreateAudioTranscriptions401", typeof CreateAudioTranscriptions401.Type> + | OpenRouterClientError<"CreateAudioTranscriptions402", typeof CreateAudioTranscriptions402.Type> + | OpenRouterClientError<"CreateAudioTranscriptions404", typeof CreateAudioTranscriptions404.Type> + | OpenRouterClientError<"CreateAudioTranscriptions429", typeof CreateAudioTranscriptions429.Type> + | OpenRouterClientError<"CreateAudioTranscriptions500", typeof CreateAudioTranscriptions500.Type> + | OpenRouterClientError<"CreateAudioTranscriptions502", typeof CreateAudioTranscriptions502.Type> + | OpenRouterClientError<"CreateAudioTranscriptions503", typeof CreateAudioTranscriptions503.Type> + | OpenRouterClientError<"CreateAudioTranscriptions524", typeof CreateAudioTranscriptions524.Type> + | OpenRouterClientError<"CreateAudioTranscriptions529", typeof CreateAudioTranscriptions529.Type> + > + /** + * Exchange an authorization code from the PKCE flow for a user-controlled API key + */ + readonly "exchangeAuthCodeForAPIKey": ( + options: { + readonly params?: typeof ExchangeAuthCodeForAPIKeyParams.Encoded | undefined + readonly payload: typeof ExchangeAuthCodeForAPIKeyRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"ExchangeAuthCodeForAPIKey400", typeof ExchangeAuthCodeForAPIKey400.Type> + | OpenRouterClientError<"ExchangeAuthCodeForAPIKey403", typeof ExchangeAuthCodeForAPIKey403.Type> + | OpenRouterClientError<"ExchangeAuthCodeForAPIKey500", typeof ExchangeAuthCodeForAPIKey500.Type> + > + /** + * Create an authorization code for the PKCE flow to generate a user-controlled API key + */ + readonly "createAuthKeysCode": ( + options: { + readonly params?: typeof CreateAuthKeysCodeParams.Encoded | undefined + readonly payload: typeof CreateAuthKeysCodeRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"CreateAuthKeysCode400", typeof CreateAuthKeysCode400.Type> + | OpenRouterClientError<"CreateAuthKeysCode401", typeof CreateAuthKeysCode401.Type> + | OpenRouterClientError<"CreateAuthKeysCode409", typeof CreateAuthKeysCode409.Type> + | OpenRouterClientError<"CreateAuthKeysCode500", typeof CreateAuthKeysCode500.Type> + > + /** + * List the bring-your-own-key (BYOK) provider credentials for the authenticated entity's default workspace. Use the `workspace_id` query parameter to scope the result to a different workspace, or the `provider` query parameter to filter by upstream provider. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "createResponses": ( - options: { readonly payload: typeof CreateResponsesRequestJson.Encoded; readonly config?: Config | undefined } + readonly "listBYOKKeys": ( + options: + | { readonly params?: typeof ListBYOKKeysParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"CreateResponses400", typeof CreateResponses400.Type> - | OpenRouterClientError<"CreateResponses401", typeof CreateResponses401.Type> - | OpenRouterClientError<"CreateResponses402", typeof CreateResponses402.Type> - | OpenRouterClientError<"CreateResponses404", typeof CreateResponses404.Type> - | OpenRouterClientError<"CreateResponses408", typeof CreateResponses408.Type> - | OpenRouterClientError<"CreateResponses413", typeof CreateResponses413.Type> - | OpenRouterClientError<"CreateResponses422", typeof CreateResponses422.Type> - | OpenRouterClientError<"CreateResponses429", typeof CreateResponses429.Type> - | OpenRouterClientError<"CreateResponses500", typeof CreateResponses500.Type> - | OpenRouterClientError<"CreateResponses502", typeof CreateResponses502.Type> - | OpenRouterClientError<"CreateResponses503", typeof CreateResponses503.Type> - | OpenRouterClientError<"CreateResponses524", typeof CreateResponses524.Type> - | OpenRouterClientError<"CreateResponses529", typeof CreateResponses529.Type> + | OpenRouterClientError<"ListBYOKKeys401", typeof ListBYOKKeys401.Type> + | OpenRouterClientError<"ListBYOKKeys500", typeof ListBYOKKeys500.Type> > /** - * Creates a streaming or non-streaming response using OpenResponses API format + * Create a new bring-your-own-key (BYOK) provider credential. The raw key is encrypted at rest and never returned in API responses. Defaults to the authenticated entity's default workspace; use the `workspace_id` body field to scope to a different workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "createResponsesSse": ( - options: { readonly payload: typeof CreateResponsesRequestJson.Encoded } - ) => Stream.Stream< - { readonly event: string; readonly id: string | undefined; readonly data: typeof CreateResponses200Sse.Type }, - HttpClientError.HttpClientError | SchemaError | Sse.Retry, - typeof CreateResponses200Sse.DecodingServices + readonly "createBYOKKey": ( + options: { + readonly params?: typeof CreateBYOKKeyParams.Encoded | undefined + readonly payload: typeof CreateBYOKKeyRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"CreateBYOKKey400", typeof CreateBYOKKey400.Type> + | OpenRouterClientError<"CreateBYOKKey401", typeof CreateBYOKKey401.Type> + | OpenRouterClientError<"CreateBYOKKey403", typeof CreateBYOKKey403.Type> + | OpenRouterClientError<"CreateBYOKKey500", typeof CreateBYOKKey500.Type> > /** - * Creates a message using the Anthropic Messages API format. Supports text, images, PDFs, tools, and extended thinking. + * Get a single bring-your-own-key (BYOK) provider credential by its `id`. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "createMessages": ( - options: { readonly payload: typeof CreateMessagesRequestJson.Encoded; readonly config?: Config | undefined } + readonly "getBYOKKey": ( + id: string, + options: + | { readonly params?: typeof GetBYOKKeyParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"CreateMessages400", typeof CreateMessages400.Type> - | OpenRouterClientError<"CreateMessages401", typeof CreateMessages401.Type> - | OpenRouterClientError<"CreateMessages403", typeof CreateMessages403.Type> - | OpenRouterClientError<"CreateMessages404", typeof CreateMessages404.Type> - | OpenRouterClientError<"CreateMessages429", typeof CreateMessages429.Type> - | OpenRouterClientError<"CreateMessages500", typeof CreateMessages500.Type> - | OpenRouterClientError<"CreateMessages503", typeof CreateMessages503.Type> - | OpenRouterClientError<"CreateMessages529", typeof CreateMessages529.Type> + | OpenRouterClientError<"GetBYOKKey401", typeof GetBYOKKey401.Type> + | OpenRouterClientError<"GetBYOKKey404", typeof GetBYOKKey404.Type> + | OpenRouterClientError<"GetBYOKKey500", typeof GetBYOKKey500.Type> > /** - * Creates a message using the Anthropic Messages API format. Supports text, images, PDFs, tools, and extended thinking. + * Delete (soft-delete) a bring-your-own-key (BYOK) provider credential by its `id`. The encrypted key material is wiped and the record is marked as deleted. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "createMessagesSse": ( - options: { readonly payload: typeof CreateMessagesRequestJson.Encoded } - ) => Stream.Stream< - { readonly event: string; readonly id: string | undefined; readonly data: typeof CreateMessages200Sse.Type }, - HttpClientError.HttpClientError | SchemaError | Sse.Retry, - typeof CreateMessages200Sse.DecodingServices + readonly "deleteBYOKKey": ( + id: string, + options: + | { readonly params?: typeof DeleteBYOKKeyParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"DeleteBYOKKey401", typeof DeleteBYOKKey401.Type> + | OpenRouterClientError<"DeleteBYOKKey404", typeof DeleteBYOKKey404.Type> + | OpenRouterClientError<"DeleteBYOKKey500", typeof DeleteBYOKKey500.Type> > /** - * Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Management key](/docs/guides/overview/auth/management-api-keys) required. + * Update an existing bring-your-own-key (BYOK) provider credential by its `id`. Include the `key` field to rotate the raw provider API key in-place (the previous key material is overwritten). [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "getUserActivity": ( + readonly "updateBYOKKey": ( + id: string, options: { - readonly params?: typeof GetUserActivityParams.Encoded | undefined + readonly params?: typeof UpdateBYOKKeyParams.Encoded | undefined + readonly payload: typeof UpdateBYOKKeyRequestJson.Encoded readonly config?: Config | undefined - } | undefined + } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"GetUserActivity400", typeof GetUserActivity400.Type> - | OpenRouterClientError<"GetUserActivity401", typeof GetUserActivity401.Type> - | OpenRouterClientError<"GetUserActivity403", typeof GetUserActivity403.Type> - | OpenRouterClientError<"GetUserActivity500", typeof GetUserActivity500.Type> + | OpenRouterClientError<"UpdateBYOKKey400", typeof UpdateBYOKKey400.Type> + | OpenRouterClientError<"UpdateBYOKKey401", typeof UpdateBYOKKey401.Type> + | OpenRouterClientError<"UpdateBYOKKey404", typeof UpdateBYOKKey404.Type> + | OpenRouterClientError<"UpdateBYOKKey500", typeof UpdateBYOKKey500.Type> + > + /** + * Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. + */ + readonly "sendChatCompletionRequest": ( + options: { + readonly params?: typeof SendChatCompletionRequestParams.Encoded | undefined + readonly payload: typeof SendChatCompletionRequestRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"SendChatCompletionRequest400", typeof SendChatCompletionRequest400.Type> + | OpenRouterClientError<"SendChatCompletionRequest401", typeof SendChatCompletionRequest401.Type> + | OpenRouterClientError<"SendChatCompletionRequest402", typeof SendChatCompletionRequest402.Type> + | OpenRouterClientError<"SendChatCompletionRequest403", typeof SendChatCompletionRequest403.Type> + | OpenRouterClientError<"SendChatCompletionRequest404", typeof SendChatCompletionRequest404.Type> + | OpenRouterClientError<"SendChatCompletionRequest408", typeof SendChatCompletionRequest408.Type> + | OpenRouterClientError<"SendChatCompletionRequest413", typeof SendChatCompletionRequest413.Type> + | OpenRouterClientError<"SendChatCompletionRequest422", typeof SendChatCompletionRequest422.Type> + | OpenRouterClientError<"SendChatCompletionRequest429", typeof SendChatCompletionRequest429.Type> + | OpenRouterClientError<"SendChatCompletionRequest500", typeof SendChatCompletionRequest500.Type> + | OpenRouterClientError<"SendChatCompletionRequest502", typeof SendChatCompletionRequest502.Type> + | OpenRouterClientError<"SendChatCompletionRequest503", typeof SendChatCompletionRequest503.Type> + | OpenRouterClientError<"SendChatCompletionRequest524", typeof SendChatCompletionRequest524.Type> + | OpenRouterClientError<"SendChatCompletionRequest529", typeof SendChatCompletionRequest529.Type> + > + /** + * Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. + */ + readonly "sendChatCompletionRequestSse": ( + options: { + readonly params?: typeof SendChatCompletionRequestParams.Encoded | undefined + readonly payload: typeof SendChatCompletionRequestRequestJson.Encoded + } + ) => Stream.Stream< + { + readonly event: string + readonly id: string | undefined + readonly data: typeof SendChatCompletionRequest200Sse.Type + }, + HttpClientError.HttpClientError | SchemaError | Sse.Retry, + typeof SendChatCompletionRequest200Sse.DecodingServices > /** * Get total credits purchased and used for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ readonly "getCredits": ( - options: { readonly config?: Config | undefined } | undefined + options: + | { readonly params?: typeof GetCreditsParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined ) => Effect.Effect< WithOptionalResponse, | HttpClientError.HttpClientError @@ -9499,152 +25311,358 @@ export interface OpenRouterClient { | OpenRouterClientError<"GetCredits500", typeof GetCredits500.Type> > /** - * Create a Coinbase charge for crypto payment + * Deprecated. The Coinbase APIs used by this endpoint have been deprecated, so Coinbase Commerce charges have been removed. Use the web credits purchase flow instead. */ readonly "createCoinbaseCharge": ( - options: { readonly payload: typeof CreateCoinbaseChargeRequestJson.Encoded; readonly config?: Config | undefined } + options: { + readonly params?: typeof CreateCoinbaseChargeParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"CreateCoinbaseCharge400", typeof CreateCoinbaseCharge400.Type> - | OpenRouterClientError<"CreateCoinbaseCharge401", typeof CreateCoinbaseCharge401.Type> - | OpenRouterClientError<"CreateCoinbaseCharge429", typeof CreateCoinbaseCharge429.Type> - | OpenRouterClientError<"CreateCoinbaseCharge500", typeof CreateCoinbaseCharge500.Type> + | OpenRouterClientError<"CreateCoinbaseCharge410", typeof CreateCoinbaseCharge410.Type> > /** * Submits an embedding request to the embeddings router */ readonly "createEmbeddings": ( - options: { readonly payload: typeof CreateEmbeddingsRequestJson.Encoded; readonly config?: Config | undefined } + options: { + readonly params?: typeof CreateEmbeddingsParams.Encoded | undefined + readonly payload: typeof CreateEmbeddingsRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"CreateEmbeddings400", typeof CreateEmbeddings400.Type> + | OpenRouterClientError<"CreateEmbeddings401", typeof CreateEmbeddings401.Type> + | OpenRouterClientError<"CreateEmbeddings402", typeof CreateEmbeddings402.Type> + | OpenRouterClientError<"CreateEmbeddings404", typeof CreateEmbeddings404.Type> + | OpenRouterClientError<"CreateEmbeddings429", typeof CreateEmbeddings429.Type> + | OpenRouterClientError<"CreateEmbeddings500", typeof CreateEmbeddings500.Type> + | OpenRouterClientError<"CreateEmbeddings502", typeof CreateEmbeddings502.Type> + | OpenRouterClientError<"CreateEmbeddings503", typeof CreateEmbeddings503.Type> + | OpenRouterClientError<"CreateEmbeddings524", typeof CreateEmbeddings524.Type> + | OpenRouterClientError<"CreateEmbeddings529", typeof CreateEmbeddings529.Type> + > + /** + * Submits an embedding request to the embeddings router + */ + readonly "createEmbeddingsSse": ( + options: { + readonly params?: typeof CreateEmbeddingsParams.Encoded | undefined + readonly payload: typeof CreateEmbeddingsRequestJson.Encoded + } + ) => Stream.Stream< + { readonly event: string; readonly id: string | undefined; readonly data: typeof CreateEmbeddings200Sse.Type }, + HttpClientError.HttpClientError | SchemaError | Sse.Retry, + typeof CreateEmbeddings200Sse.DecodingServices + > + /** + * Returns a list of all available embeddings models and their properties + */ + readonly "listEmbeddingsModels": ( + options: { + readonly params?: typeof ListEmbeddingsModelsParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"ListEmbeddingsModels400", typeof ListEmbeddingsModels400.Type> + | OpenRouterClientError<"ListEmbeddingsModels500", typeof ListEmbeddingsModels500.Type> + > + /** + * Preview the impact of ZDR on the available endpoints + */ + readonly "listEndpointsZdr": ( + options: { + readonly params?: typeof ListEndpointsZdrParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"ListEndpointsZdr500", typeof ListEndpointsZdr500.Type> + > + /** + * Get request & usage metadata for a generation + */ + readonly "getGeneration": ( + options: { readonly params: typeof GetGenerationParams.Encoded; readonly config?: Config | undefined } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"GetGeneration401", typeof GetGeneration401.Type> + | OpenRouterClientError<"GetGeneration402", typeof GetGeneration402.Type> + | OpenRouterClientError<"GetGeneration404", typeof GetGeneration404.Type> + | OpenRouterClientError<"GetGeneration429", typeof GetGeneration429.Type> + | OpenRouterClientError<"GetGeneration500", typeof GetGeneration500.Type> + | OpenRouterClientError<"GetGeneration502", typeof GetGeneration502.Type> + | OpenRouterClientError<"GetGeneration524", typeof GetGeneration524.Type> + | OpenRouterClientError<"GetGeneration529", typeof GetGeneration529.Type> + > + /** + * Get stored prompt and completion content for a generation + */ + readonly "listGenerationContent": ( + options: { readonly params: typeof ListGenerationContentParams.Encoded; readonly config?: Config | undefined } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"ListGenerationContent401", typeof ListGenerationContent401.Type> + | OpenRouterClientError<"ListGenerationContent403", typeof ListGenerationContent403.Type> + | OpenRouterClientError<"ListGenerationContent404", typeof ListGenerationContent404.Type> + | OpenRouterClientError<"ListGenerationContent429", typeof ListGenerationContent429.Type> + | OpenRouterClientError<"ListGenerationContent500", typeof ListGenerationContent500.Type> + | OpenRouterClientError<"ListGenerationContent502", typeof ListGenerationContent502.Type> + | OpenRouterClientError<"ListGenerationContent524", typeof ListGenerationContent524.Type> + | OpenRouterClientError<"ListGenerationContent529", typeof ListGenerationContent529.Type> + > + /** + * List all guardrails for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + */ + readonly "listGuardrails": ( + options: + | { readonly params?: typeof ListGuardrailsParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"ListGuardrails401", typeof ListGuardrails401.Type> + | OpenRouterClientError<"ListGuardrails500", typeof ListGuardrails500.Type> + > + /** + * Create a new guardrail for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + */ + readonly "createGuardrail": ( + options: { + readonly params?: typeof CreateGuardrailParams.Encoded | undefined + readonly payload: typeof CreateGuardrailRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"CreateGuardrail400", typeof CreateGuardrail400.Type> + | OpenRouterClientError<"CreateGuardrail401", typeof CreateGuardrail401.Type> + | OpenRouterClientError<"CreateGuardrail403", typeof CreateGuardrail403.Type> + | OpenRouterClientError<"CreateGuardrail500", typeof CreateGuardrail500.Type> + > + /** + * Get a single guardrail by ID. [Management key](/docs/guides/overview/auth/management-api-keys) required. + */ + readonly "getGuardrail": ( + id: string, + options: + | { readonly params?: typeof GetGuardrailParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"GetGuardrail401", typeof GetGuardrail401.Type> + | OpenRouterClientError<"GetGuardrail404", typeof GetGuardrail404.Type> + | OpenRouterClientError<"GetGuardrail500", typeof GetGuardrail500.Type> + > + /** + * Delete an existing guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + */ + readonly "deleteGuardrail": ( + id: string, + options: { + readonly params?: typeof DeleteGuardrailParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"DeleteGuardrail401", typeof DeleteGuardrail401.Type> + | OpenRouterClientError<"DeleteGuardrail404", typeof DeleteGuardrail404.Type> + | OpenRouterClientError<"DeleteGuardrail500", typeof DeleteGuardrail500.Type> + > + /** + * Update an existing guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + */ + readonly "updateGuardrail": ( + id: string, + options: { + readonly params?: typeof UpdateGuardrailParams.Encoded | undefined + readonly payload: typeof UpdateGuardrailRequestJson.Encoded + readonly config?: Config | undefined + } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"CreateEmbeddings400", typeof CreateEmbeddings400.Type> - | OpenRouterClientError<"CreateEmbeddings401", typeof CreateEmbeddings401.Type> - | OpenRouterClientError<"CreateEmbeddings402", typeof CreateEmbeddings402.Type> - | OpenRouterClientError<"CreateEmbeddings404", typeof CreateEmbeddings404.Type> - | OpenRouterClientError<"CreateEmbeddings429", typeof CreateEmbeddings429.Type> - | OpenRouterClientError<"CreateEmbeddings500", typeof CreateEmbeddings500.Type> - | OpenRouterClientError<"CreateEmbeddings502", typeof CreateEmbeddings502.Type> - | OpenRouterClientError<"CreateEmbeddings503", typeof CreateEmbeddings503.Type> - | OpenRouterClientError<"CreateEmbeddings524", typeof CreateEmbeddings524.Type> - | OpenRouterClientError<"CreateEmbeddings529", typeof CreateEmbeddings529.Type> + | OpenRouterClientError<"UpdateGuardrail400", typeof UpdateGuardrail400.Type> + | OpenRouterClientError<"UpdateGuardrail401", typeof UpdateGuardrail401.Type> + | OpenRouterClientError<"UpdateGuardrail404", typeof UpdateGuardrail404.Type> + | OpenRouterClientError<"UpdateGuardrail500", typeof UpdateGuardrail500.Type> > /** - * Submits an embedding request to the embeddings router + * List all API key assignments for a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "createEmbeddingsSse": ( - options: { readonly payload: typeof CreateEmbeddingsRequestJson.Encoded } - ) => Stream.Stream< - { readonly event: string; readonly id: string | undefined; readonly data: typeof CreateEmbeddings200Sse.Type }, - HttpClientError.HttpClientError | SchemaError | Sse.Retry, - typeof CreateEmbeddings200Sse.DecodingServices + readonly "listGuardrailKeyAssignments": ( + id: string, + options: { + readonly params?: typeof ListGuardrailKeyAssignmentsParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"ListGuardrailKeyAssignments401", typeof ListGuardrailKeyAssignments401.Type> + | OpenRouterClientError<"ListGuardrailKeyAssignments404", typeof ListGuardrailKeyAssignments404.Type> + | OpenRouterClientError<"ListGuardrailKeyAssignments500", typeof ListGuardrailKeyAssignments500.Type> > /** - * Returns a list of all available embeddings models and their properties + * Assign multiple API keys to a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "listEmbeddingsModels": ( - options: { readonly config?: Config | undefined } | undefined + readonly "bulkAssignKeysToGuardrail": ( + id: string, + options: { + readonly params?: typeof BulkAssignKeysToGuardrailParams.Encoded | undefined + readonly payload: typeof BulkAssignKeysToGuardrailRequestJson.Encoded + readonly config?: Config | undefined + } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"ListEmbeddingsModels400", typeof ListEmbeddingsModels400.Type> - | OpenRouterClientError<"ListEmbeddingsModels500", typeof ListEmbeddingsModels500.Type> + | OpenRouterClientError<"BulkAssignKeysToGuardrail400", typeof BulkAssignKeysToGuardrail400.Type> + | OpenRouterClientError<"BulkAssignKeysToGuardrail401", typeof BulkAssignKeysToGuardrail401.Type> + | OpenRouterClientError<"BulkAssignKeysToGuardrail404", typeof BulkAssignKeysToGuardrail404.Type> + | OpenRouterClientError<"BulkAssignKeysToGuardrail500", typeof BulkAssignKeysToGuardrail500.Type> > /** - * Get request & usage metadata for a generation + * Unassign multiple API keys from a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "getGeneration": ( - options: { readonly params: typeof GetGenerationParams.Encoded; readonly config?: Config | undefined } + readonly "bulkUnassignKeysFromGuardrail": ( + id: string, + options: { + readonly params?: typeof BulkUnassignKeysFromGuardrailParams.Encoded | undefined + readonly payload: typeof BulkUnassignKeysFromGuardrailRequestJson.Encoded + readonly config?: Config | undefined + } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"GetGeneration401", typeof GetGeneration401.Type> - | OpenRouterClientError<"GetGeneration402", typeof GetGeneration402.Type> - | OpenRouterClientError<"GetGeneration404", typeof GetGeneration404.Type> - | OpenRouterClientError<"GetGeneration429", typeof GetGeneration429.Type> - | OpenRouterClientError<"GetGeneration500", typeof GetGeneration500.Type> - | OpenRouterClientError<"GetGeneration502", typeof GetGeneration502.Type> - | OpenRouterClientError<"GetGeneration524", typeof GetGeneration524.Type> - | OpenRouterClientError<"GetGeneration529", typeof GetGeneration529.Type> + | OpenRouterClientError<"BulkUnassignKeysFromGuardrail400", typeof BulkUnassignKeysFromGuardrail400.Type> + | OpenRouterClientError<"BulkUnassignKeysFromGuardrail401", typeof BulkUnassignKeysFromGuardrail401.Type> + | OpenRouterClientError<"BulkUnassignKeysFromGuardrail404", typeof BulkUnassignKeysFromGuardrail404.Type> + | OpenRouterClientError<"BulkUnassignKeysFromGuardrail500", typeof BulkUnassignKeysFromGuardrail500.Type> > /** - * Get total count of available models + * List all organization member assignments for a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "listModelsCount": ( - options: { readonly config?: Config | undefined } | undefined + readonly "listGuardrailMemberAssignments": ( + id: string, + options: { + readonly params?: typeof ListGuardrailMemberAssignmentsParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"ListModelsCount500", typeof ListModelsCount500.Type> + | OpenRouterClientError<"ListGuardrailMemberAssignments401", typeof ListGuardrailMemberAssignments401.Type> + | OpenRouterClientError<"ListGuardrailMemberAssignments404", typeof ListGuardrailMemberAssignments404.Type> + | OpenRouterClientError<"ListGuardrailMemberAssignments500", typeof ListGuardrailMemberAssignments500.Type> > /** - * List all models and their properties + * Assign multiple organization members to a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "getModels": ( - options: - | { readonly params?: typeof GetModelsParams.Encoded | undefined; readonly config?: Config | undefined } - | undefined + readonly "bulkAssignMembersToGuardrail": ( + id: string, + options: { + readonly params?: typeof BulkAssignMembersToGuardrailParams.Encoded | undefined + readonly payload: typeof BulkAssignMembersToGuardrailRequestJson.Encoded + readonly config?: Config | undefined + } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"GetModels400", typeof GetModels400.Type> - | OpenRouterClientError<"GetModels500", typeof GetModels500.Type> + | OpenRouterClientError<"BulkAssignMembersToGuardrail400", typeof BulkAssignMembersToGuardrail400.Type> + | OpenRouterClientError<"BulkAssignMembersToGuardrail401", typeof BulkAssignMembersToGuardrail401.Type> + | OpenRouterClientError<"BulkAssignMembersToGuardrail404", typeof BulkAssignMembersToGuardrail404.Type> + | OpenRouterClientError<"BulkAssignMembersToGuardrail500", typeof BulkAssignMembersToGuardrail500.Type> > /** - * List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through `eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region routing](https://openrouter.ai/docs/guides/privacy/logging#enterprise-eu-in-region-routing). + * Unassign multiple organization members from a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "listModelsUser": ( - options: { readonly config?: Config | undefined } | undefined + readonly "bulkUnassignMembersFromGuardrail": ( + id: string, + options: { + readonly params?: typeof BulkUnassignMembersFromGuardrailParams.Encoded | undefined + readonly payload: typeof BulkUnassignMembersFromGuardrailRequestJson.Encoded + readonly config?: Config | undefined + } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"ListModelsUser401", typeof ListModelsUser401.Type> - | OpenRouterClientError<"ListModelsUser404", typeof ListModelsUser404.Type> - | OpenRouterClientError<"ListModelsUser500", typeof ListModelsUser500.Type> + | OpenRouterClientError<"BulkUnassignMembersFromGuardrail400", typeof BulkUnassignMembersFromGuardrail400.Type> + | OpenRouterClientError<"BulkUnassignMembersFromGuardrail401", typeof BulkUnassignMembersFromGuardrail401.Type> + | OpenRouterClientError<"BulkUnassignMembersFromGuardrail404", typeof BulkUnassignMembersFromGuardrail404.Type> + | OpenRouterClientError<"BulkUnassignMembersFromGuardrail500", typeof BulkUnassignMembersFromGuardrail500.Type> > /** - * List all endpoints for a model + * List all API key guardrail assignments for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "listEndpoints": ( - author: string, - slug: string, - options: { readonly config?: Config | undefined } | undefined + readonly "listKeyAssignments": ( + options: { + readonly params?: typeof ListKeyAssignmentsParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"ListEndpoints404", typeof ListEndpoints404.Type> - | OpenRouterClientError<"ListEndpoints500", typeof ListEndpoints500.Type> + | OpenRouterClientError<"ListKeyAssignments401", typeof ListKeyAssignments401.Type> + | OpenRouterClientError<"ListKeyAssignments500", typeof ListKeyAssignments500.Type> > /** - * Preview the impact of ZDR on the available endpoints + * List all organization member guardrail assignments for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "listEndpointsZdr": ( - options: { readonly config?: Config | undefined } | undefined + readonly "listMemberAssignments": ( + options: { + readonly params?: typeof ListMemberAssignmentsParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"ListEndpointsZdr500", typeof ListEndpointsZdr500.Type> + | OpenRouterClientError<"ListMemberAssignments401", typeof ListMemberAssignments401.Type> + | OpenRouterClientError<"ListMemberAssignments500", typeof ListMemberAssignments500.Type> > /** - * List all providers + * Get information on the API key associated with the current authentication session */ - readonly "listProviders": ( - options: { readonly config?: Config | undefined } | undefined + readonly "getCurrentKey": ( + options: + | { readonly params?: typeof GetCurrentKeyParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"ListProviders500", typeof ListProviders500.Type> + | OpenRouterClientError<"GetCurrentKey401", typeof GetCurrentKey401.Type> + | OpenRouterClientError<"GetCurrentKey500", typeof GetCurrentKey500.Type> > /** * List all API keys for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. @@ -9665,13 +25683,18 @@ export interface OpenRouterClient { * Create a new API key for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ readonly "createKeys": ( - options: { readonly payload: typeof CreateKeysRequestJson.Encoded; readonly config?: Config | undefined } + options: { + readonly params?: typeof CreateKeysParams.Encoded | undefined + readonly payload: typeof CreateKeysRequestJson.Encoded + readonly config?: Config | undefined + } ) => Effect.Effect< WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError | OpenRouterClientError<"CreateKeys400", typeof CreateKeys400.Type> | OpenRouterClientError<"CreateKeys401", typeof CreateKeys401.Type> + | OpenRouterClientError<"CreateKeys403", typeof CreateKeys403.Type> | OpenRouterClientError<"CreateKeys429", typeof CreateKeys429.Type> | OpenRouterClientError<"CreateKeys500", typeof CreateKeys500.Type> > @@ -9680,7 +25703,9 @@ export interface OpenRouterClient { */ readonly "getKey": ( hash: string, - options: { readonly config?: Config | undefined } | undefined + options: + | { readonly params?: typeof GetKeyParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined ) => Effect.Effect< WithOptionalResponse, | HttpClientError.HttpClientError @@ -9695,7 +25720,9 @@ export interface OpenRouterClient { */ readonly "deleteKeys": ( hash: string, - options: { readonly config?: Config | undefined } | undefined + options: + | { readonly params?: typeof DeleteKeysParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined ) => Effect.Effect< WithOptionalResponse, | HttpClientError.HttpClientError @@ -9710,294 +25737,535 @@ export interface OpenRouterClient { */ readonly "updateKeys": ( hash: string, - options: { readonly payload: typeof UpdateKeysRequestJson.Encoded; readonly config?: Config | undefined } + options: { + readonly params?: typeof UpdateKeysParams.Encoded | undefined + readonly payload: typeof UpdateKeysRequestJson.Encoded + readonly config?: Config | undefined + } ) => Effect.Effect< WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"UpdateKeys400", typeof UpdateKeys400.Type> - | OpenRouterClientError<"UpdateKeys401", typeof UpdateKeys401.Type> - | OpenRouterClientError<"UpdateKeys404", typeof UpdateKeys404.Type> - | OpenRouterClientError<"UpdateKeys429", typeof UpdateKeys429.Type> - | OpenRouterClientError<"UpdateKeys500", typeof UpdateKeys500.Type> + | OpenRouterClientError<"UpdateKeys400", typeof UpdateKeys400.Type> + | OpenRouterClientError<"UpdateKeys401", typeof UpdateKeys401.Type> + | OpenRouterClientError<"UpdateKeys404", typeof UpdateKeys404.Type> + | OpenRouterClientError<"UpdateKeys429", typeof UpdateKeys429.Type> + | OpenRouterClientError<"UpdateKeys500", typeof UpdateKeys500.Type> + > + /** + * Creates a message using the Anthropic Messages API format. Supports text, images, PDFs, tools, and extended thinking. + */ + readonly "createMessages": ( + options: { + readonly params?: typeof CreateMessagesParams.Encoded | undefined + readonly payload: typeof CreateMessagesRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"CreateMessages400", typeof CreateMessages400.Type> + | OpenRouterClientError<"CreateMessages401", typeof CreateMessages401.Type> + | OpenRouterClientError<"CreateMessages403", typeof CreateMessages403.Type> + | OpenRouterClientError<"CreateMessages404", typeof CreateMessages404.Type> + | OpenRouterClientError<"CreateMessages429", typeof CreateMessages429.Type> + | OpenRouterClientError<"CreateMessages500", typeof CreateMessages500.Type> + | OpenRouterClientError<"CreateMessages503", typeof CreateMessages503.Type> + | OpenRouterClientError<"CreateMessages529", typeof CreateMessages529.Type> + > + /** + * Creates a message using the Anthropic Messages API format. Supports text, images, PDFs, tools, and extended thinking. + */ + readonly "createMessagesSse": ( + options: { + readonly params?: typeof CreateMessagesParams.Encoded | undefined + readonly payload: typeof CreateMessagesRequestJson.Encoded + } + ) => Stream.Stream< + { readonly event: string; readonly id: string | undefined; readonly data: typeof CreateMessages200Sse.Type }, + HttpClientError.HttpClientError | SchemaError | Sse.Retry, + typeof CreateMessages200Sse.DecodingServices + > + /** + * List all models and their properties + */ + readonly "getModels": ( + options: + | { readonly params?: typeof GetModelsParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"GetModels400", typeof GetModels400.Type> + | OpenRouterClientError<"GetModels500", typeof GetModels500.Type> + > + /** + * List all endpoints for a model + */ + readonly "listEndpoints": ( + author: string, + slug: string, + options: + | { readonly params?: typeof ListEndpointsParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"ListEndpoints404", typeof ListEndpoints404.Type> + | OpenRouterClientError<"ListEndpoints500", typeof ListEndpoints500.Type> + > + /** + * Get total count of available models + */ + readonly "listModelsCount": ( + options: { + readonly params?: typeof ListModelsCountParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"ListModelsCount400", typeof ListModelsCount400.Type> + | OpenRouterClientError<"ListModelsCount500", typeof ListModelsCount500.Type> > /** - * List all guardrails for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + * List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/provider-logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through `eu.openrouter.ai/api/v1/...` the results will be filtered to models that satisfy [EU in-region routing](https://openrouter.ai/docs/guides/privacy/provider-logging#enterprise-eu-in-region-routing). */ - readonly "listGuardrails": ( + readonly "listModelsUser": ( options: - | { readonly params?: typeof ListGuardrailsParams.Encoded | undefined; readonly config?: Config | undefined } + | { readonly params?: typeof ListModelsUserParams.Encoded | undefined; readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"ListGuardrails401", typeof ListGuardrails401.Type> - | OpenRouterClientError<"ListGuardrails500", typeof ListGuardrails500.Type> + | OpenRouterClientError<"ListModelsUser401", typeof ListModelsUser401.Type> + | OpenRouterClientError<"ListModelsUser404", typeof ListModelsUser404.Type> + | OpenRouterClientError<"ListModelsUser500", typeof ListModelsUser500.Type> > /** - * Create a new guardrail for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + * List the observability destinations configured for the authenticated entity's default workspace. Use the `workspace_id` query parameter to scope the result to a different workspace. Only destinations with stable release status are surfaced — destinations of other types are excluded. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "createGuardrail": ( - options: { readonly payload: typeof CreateGuardrailRequestJson.Encoded; readonly config?: Config | undefined } + readonly "listObservabilityDestinations": ( + options: { + readonly params?: typeof ListObservabilityDestinationsParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"CreateGuardrail400", typeof CreateGuardrail400.Type> - | OpenRouterClientError<"CreateGuardrail401", typeof CreateGuardrail401.Type> - | OpenRouterClientError<"CreateGuardrail500", typeof CreateGuardrail500.Type> + | OpenRouterClientError<"ListObservabilityDestinations401", typeof ListObservabilityDestinations401.Type> + | OpenRouterClientError<"ListObservabilityDestinations500", typeof ListObservabilityDestinations500.Type> > /** - * Get a single guardrail by ID. [Management key](/docs/guides/overview/auth/management-api-keys) required. + * Create a new observability destination. A maximum of 5 destinations per type is allowed. Defaults to the authenticated entity's default workspace; use the `workspace_id` body field to scope to a different workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "getGuardrail": ( - id: string, - options: { readonly config?: Config | undefined } | undefined + readonly "createObservabilityDestination": ( + options: { + readonly params?: typeof CreateObservabilityDestinationParams.Encoded | undefined + readonly payload: typeof CreateObservabilityDestinationRequestJson.Encoded + readonly config?: Config | undefined + } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"GetGuardrail401", typeof GetGuardrail401.Type> - | OpenRouterClientError<"GetGuardrail404", typeof GetGuardrail404.Type> - | OpenRouterClientError<"GetGuardrail500", typeof GetGuardrail500.Type> + | OpenRouterClientError<"CreateObservabilityDestination400", typeof CreateObservabilityDestination400.Type> + | OpenRouterClientError<"CreateObservabilityDestination401", typeof CreateObservabilityDestination401.Type> + | OpenRouterClientError<"CreateObservabilityDestination403", typeof CreateObservabilityDestination403.Type> + | OpenRouterClientError<"CreateObservabilityDestination409", typeof CreateObservabilityDestination409.Type> + | OpenRouterClientError<"CreateObservabilityDestination500", typeof CreateObservabilityDestination500.Type> > /** - * Delete an existing guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + * Fetch a single observability destination by its UUID. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "deleteGuardrail": ( + readonly "getObservabilityDestination": ( id: string, - options: { readonly config?: Config | undefined } | undefined + options: { + readonly params?: typeof GetObservabilityDestinationParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"DeleteGuardrail401", typeof DeleteGuardrail401.Type> - | OpenRouterClientError<"DeleteGuardrail404", typeof DeleteGuardrail404.Type> - | OpenRouterClientError<"DeleteGuardrail500", typeof DeleteGuardrail500.Type> + | OpenRouterClientError<"GetObservabilityDestination401", typeof GetObservabilityDestination401.Type> + | OpenRouterClientError<"GetObservabilityDestination404", typeof GetObservabilityDestination404.Type> + | OpenRouterClientError<"GetObservabilityDestination500", typeof GetObservabilityDestination500.Type> > /** - * Update an existing guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + * Delete an existing observability destination. This performs a soft delete. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "updateGuardrail": ( + readonly "deleteObservabilityDestination": ( id: string, - options: { readonly payload: typeof UpdateGuardrailRequestJson.Encoded; readonly config?: Config | undefined } + options: { + readonly params?: typeof DeleteObservabilityDestinationParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"UpdateGuardrail400", typeof UpdateGuardrail400.Type> - | OpenRouterClientError<"UpdateGuardrail401", typeof UpdateGuardrail401.Type> - | OpenRouterClientError<"UpdateGuardrail404", typeof UpdateGuardrail404.Type> - | OpenRouterClientError<"UpdateGuardrail500", typeof UpdateGuardrail500.Type> + | OpenRouterClientError<"DeleteObservabilityDestination401", typeof DeleteObservabilityDestination401.Type> + | OpenRouterClientError<"DeleteObservabilityDestination404", typeof DeleteObservabilityDestination404.Type> + | OpenRouterClientError<"DeleteObservabilityDestination500", typeof DeleteObservabilityDestination500.Type> > /** - * List all API key guardrail assignments for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + * Update an existing observability destination. Only the fields provided in the request body are updated. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "listKeyAssignments": ( + readonly "updateObservabilityDestination": ( + id: string, options: { - readonly params?: typeof ListKeyAssignmentsParams.Encoded | undefined + readonly params?: typeof UpdateObservabilityDestinationParams.Encoded | undefined + readonly payload: typeof UpdateObservabilityDestinationRequestJson.Encoded readonly config?: Config | undefined - } | undefined + } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"ListKeyAssignments401", typeof ListKeyAssignments401.Type> - | OpenRouterClientError<"ListKeyAssignments500", typeof ListKeyAssignments500.Type> + | OpenRouterClientError<"UpdateObservabilityDestination400", typeof UpdateObservabilityDestination400.Type> + | OpenRouterClientError<"UpdateObservabilityDestination401", typeof UpdateObservabilityDestination401.Type> + | OpenRouterClientError<"UpdateObservabilityDestination404", typeof UpdateObservabilityDestination404.Type> + | OpenRouterClientError<"UpdateObservabilityDestination409", typeof UpdateObservabilityDestination409.Type> + | OpenRouterClientError<"UpdateObservabilityDestination500", typeof UpdateObservabilityDestination500.Type> > /** - * List all organization member guardrail assignments for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. + * List all members of the organization associated with the authenticated management key. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "listMemberAssignments": ( + readonly "listOrganizationMembers": ( options: { - readonly params?: typeof ListMemberAssignmentsParams.Encoded | undefined + readonly params?: typeof ListOrganizationMembersParams.Encoded | undefined readonly config?: Config | undefined } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"ListMemberAssignments401", typeof ListMemberAssignments401.Type> - | OpenRouterClientError<"ListMemberAssignments500", typeof ListMemberAssignments500.Type> + | OpenRouterClientError<"ListOrganizationMembers401", typeof ListOrganizationMembers401.Type> + | OpenRouterClientError<"ListOrganizationMembers404", typeof ListOrganizationMembers404.Type> + | OpenRouterClientError<"ListOrganizationMembers500", typeof ListOrganizationMembers500.Type> > /** - * List all API key assignments for a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + * Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored. */ - readonly "listGuardrailKeyAssignments": ( - id: string, + readonly "createPresetsChatCompletions": ( + slug: string, options: { - readonly params?: typeof ListGuardrailKeyAssignmentsParams.Encoded | undefined + readonly params?: typeof CreatePresetsChatCompletionsParams.Encoded | undefined + readonly payload: typeof CreatePresetsChatCompletionsRequestJson.Encoded readonly config?: Config | undefined - } | undefined + } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"ListGuardrailKeyAssignments401", typeof ListGuardrailKeyAssignments401.Type> - | OpenRouterClientError<"ListGuardrailKeyAssignments404", typeof ListGuardrailKeyAssignments404.Type> - | OpenRouterClientError<"ListGuardrailKeyAssignments500", typeof ListGuardrailKeyAssignments500.Type> + | OpenRouterClientError<"CreatePresetsChatCompletions400", typeof CreatePresetsChatCompletions400.Type> + | OpenRouterClientError<"CreatePresetsChatCompletions401", typeof CreatePresetsChatCompletions401.Type> + | OpenRouterClientError<"CreatePresetsChatCompletions403", typeof CreatePresetsChatCompletions403.Type> + | OpenRouterClientError<"CreatePresetsChatCompletions404", typeof CreatePresetsChatCompletions404.Type> + | OpenRouterClientError<"CreatePresetsChatCompletions409", typeof CreatePresetsChatCompletions409.Type> + | OpenRouterClientError<"CreatePresetsChatCompletions500", typeof CreatePresetsChatCompletions500.Type> > /** - * Assign multiple API keys to a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + * List all providers */ - readonly "bulkAssignKeysToGuardrail": ( - id: string, + readonly "listProviders": ( + options: + | { readonly params?: typeof ListProvidersParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"ListProviders500", typeof ListProviders500.Type> + > + /** + * Submits a rerank request to the rerank router + */ + readonly "createRerank": ( options: { - readonly payload: typeof BulkAssignKeysToGuardrailRequestJson.Encoded + readonly params?: typeof CreateRerankParams.Encoded | undefined + readonly payload: typeof CreateRerankRequestJson.Encoded readonly config?: Config | undefined } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"BulkAssignKeysToGuardrail400", typeof BulkAssignKeysToGuardrail400.Type> - | OpenRouterClientError<"BulkAssignKeysToGuardrail401", typeof BulkAssignKeysToGuardrail401.Type> - | OpenRouterClientError<"BulkAssignKeysToGuardrail404", typeof BulkAssignKeysToGuardrail404.Type> - | OpenRouterClientError<"BulkAssignKeysToGuardrail500", typeof BulkAssignKeysToGuardrail500.Type> + | OpenRouterClientError<"CreateRerank400", typeof CreateRerank400.Type> + | OpenRouterClientError<"CreateRerank401", typeof CreateRerank401.Type> + | OpenRouterClientError<"CreateRerank402", typeof CreateRerank402.Type> + | OpenRouterClientError<"CreateRerank404", typeof CreateRerank404.Type> + | OpenRouterClientError<"CreateRerank429", typeof CreateRerank429.Type> + | OpenRouterClientError<"CreateRerank500", typeof CreateRerank500.Type> + | OpenRouterClientError<"CreateRerank502", typeof CreateRerank502.Type> + | OpenRouterClientError<"CreateRerank503", typeof CreateRerank503.Type> + | OpenRouterClientError<"CreateRerank524", typeof CreateRerank524.Type> + | OpenRouterClientError<"CreateRerank529", typeof CreateRerank529.Type> > /** - * List all organization member assignments for a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + * Submits a rerank request to the rerank router */ - readonly "listGuardrailMemberAssignments": ( - id: string, + readonly "createRerankSse": ( options: { - readonly params?: typeof ListGuardrailMemberAssignmentsParams.Encoded | undefined + readonly params?: typeof CreateRerankParams.Encoded | undefined + readonly payload: typeof CreateRerankRequestJson.Encoded + } + ) => Stream.Stream< + { readonly event: string; readonly id: string | undefined; readonly data: typeof CreateRerank200Sse.Type }, + HttpClientError.HttpClientError | SchemaError | Sse.Retry, + typeof CreateRerank200Sse.DecodingServices + > + /** + * Creates a streaming or non-streaming response using OpenResponses API format + */ + readonly "createResponses": ( + options: { + readonly params?: typeof CreateResponsesParams.Encoded | undefined + readonly payload: typeof CreateResponsesRequestJson.Encoded readonly config?: Config | undefined - } | undefined + } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"ListGuardrailMemberAssignments401", typeof ListGuardrailMemberAssignments401.Type> - | OpenRouterClientError<"ListGuardrailMemberAssignments404", typeof ListGuardrailMemberAssignments404.Type> - | OpenRouterClientError<"ListGuardrailMemberAssignments500", typeof ListGuardrailMemberAssignments500.Type> + | OpenRouterClientError<"CreateResponses400", typeof CreateResponses400.Type> + | OpenRouterClientError<"CreateResponses401", typeof CreateResponses401.Type> + | OpenRouterClientError<"CreateResponses402", typeof CreateResponses402.Type> + | OpenRouterClientError<"CreateResponses403", typeof CreateResponses403.Type> + | OpenRouterClientError<"CreateResponses404", typeof CreateResponses404.Type> + | OpenRouterClientError<"CreateResponses408", typeof CreateResponses408.Type> + | OpenRouterClientError<"CreateResponses413", typeof CreateResponses413.Type> + | OpenRouterClientError<"CreateResponses422", typeof CreateResponses422.Type> + | OpenRouterClientError<"CreateResponses429", typeof CreateResponses429.Type> + | OpenRouterClientError<"CreateResponses500", typeof CreateResponses500.Type> + | OpenRouterClientError<"CreateResponses502", typeof CreateResponses502.Type> + | OpenRouterClientError<"CreateResponses503", typeof CreateResponses503.Type> + | OpenRouterClientError<"CreateResponses524", typeof CreateResponses524.Type> + | OpenRouterClientError<"CreateResponses529", typeof CreateResponses529.Type> > /** - * Assign multiple organization members to a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + * Creates a streaming or non-streaming response using OpenResponses API format */ - readonly "bulkAssignMembersToGuardrail": ( - id: string, + readonly "createResponsesSse": ( options: { - readonly payload: typeof BulkAssignMembersToGuardrailRequestJson.Encoded + readonly params?: typeof CreateResponsesParams.Encoded | undefined + readonly payload: typeof CreateResponsesRequestJson.Encoded + } + ) => Stream.Stream< + { readonly event: string; readonly id: string | undefined; readonly data: typeof CreateResponses200Sse.Type }, + HttpClientError.HttpClientError | SchemaError | Sse.Retry, + typeof CreateResponses200Sse.DecodingServices + > + /** + * Submits a video generation request and returns a polling URL to check status + */ + readonly "createVideos": ( + options: { + readonly params?: typeof CreateVideosParams.Encoded | undefined + readonly payload: typeof CreateVideosRequestJson.Encoded readonly config?: Config | undefined } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"BulkAssignMembersToGuardrail400", typeof BulkAssignMembersToGuardrail400.Type> - | OpenRouterClientError<"BulkAssignMembersToGuardrail401", typeof BulkAssignMembersToGuardrail401.Type> - | OpenRouterClientError<"BulkAssignMembersToGuardrail404", typeof BulkAssignMembersToGuardrail404.Type> - | OpenRouterClientError<"BulkAssignMembersToGuardrail500", typeof BulkAssignMembersToGuardrail500.Type> + | OpenRouterClientError<"CreateVideos400", typeof CreateVideos400.Type> + | OpenRouterClientError<"CreateVideos401", typeof CreateVideos401.Type> + | OpenRouterClientError<"CreateVideos402", typeof CreateVideos402.Type> + | OpenRouterClientError<"CreateVideos404", typeof CreateVideos404.Type> + | OpenRouterClientError<"CreateVideos429", typeof CreateVideos429.Type> + | OpenRouterClientError<"CreateVideos500", typeof CreateVideos500.Type> > /** - * Unassign multiple API keys from a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + * Returns job status and content URLs when completed */ - readonly "bulkUnassignKeysFromGuardrail": ( - id: string, + readonly "getVideos": ( + jobId: string, + options: + | { readonly params?: typeof GetVideosParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"GetVideos401", typeof GetVideos401.Type> + | OpenRouterClientError<"GetVideos404", typeof GetVideos404.Type> + | OpenRouterClientError<"GetVideos500", typeof GetVideos500.Type> + > + /** + * Streams the generated video content from the upstream provider + */ + readonly "listVideosContent": ( + jobId: string, options: { - readonly payload: typeof BulkUnassignKeysFromGuardrailRequestJson.Encoded + readonly params?: typeof ListVideosContentParams.Encoded | undefined readonly config?: Config | undefined - } + } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"BulkUnassignKeysFromGuardrail400", typeof BulkUnassignKeysFromGuardrail400.Type> - | OpenRouterClientError<"BulkUnassignKeysFromGuardrail401", typeof BulkUnassignKeysFromGuardrail401.Type> - | OpenRouterClientError<"BulkUnassignKeysFromGuardrail404", typeof BulkUnassignKeysFromGuardrail404.Type> - | OpenRouterClientError<"BulkUnassignKeysFromGuardrail500", typeof BulkUnassignKeysFromGuardrail500.Type> + | OpenRouterClientError<"ListVideosContent400", typeof ListVideosContent400.Type> + | OpenRouterClientError<"ListVideosContent401", typeof ListVideosContent401.Type> + | OpenRouterClientError<"ListVideosContent404", typeof ListVideosContent404.Type> + | OpenRouterClientError<"ListVideosContent500", typeof ListVideosContent500.Type> + | OpenRouterClientError<"ListVideosContent502", typeof ListVideosContent502.Type> > /** - * Unassign multiple organization members from a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required. + * Streams the generated video content from the upstream provider */ - readonly "bulkUnassignMembersFromGuardrail": ( - id: string, + readonly "listVideosContentStream": ( + jobId: string, + options: { readonly params?: typeof ListVideosContentParams.Encoded | undefined } | undefined + ) => Stream.Stream + /** + * Returns a list of all available video generation models and their properties + */ + readonly "listVideosModels": ( options: { - readonly payload: typeof BulkUnassignMembersFromGuardrailRequestJson.Encoded + readonly params?: typeof ListVideosModelsParams.Encoded | undefined readonly config?: Config | undefined - } + } | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"BulkUnassignMembersFromGuardrail400", typeof BulkUnassignMembersFromGuardrail400.Type> - | OpenRouterClientError<"BulkUnassignMembersFromGuardrail401", typeof BulkUnassignMembersFromGuardrail401.Type> - | OpenRouterClientError<"BulkUnassignMembersFromGuardrail404", typeof BulkUnassignMembersFromGuardrail404.Type> - | OpenRouterClientError<"BulkUnassignMembersFromGuardrail500", typeof BulkUnassignMembersFromGuardrail500.Type> + | OpenRouterClientError<"ListVideosModels400", typeof ListVideosModels400.Type> + | OpenRouterClientError<"ListVideosModels500", typeof ListVideosModels500.Type> > /** - * Get information on the API key associated with the current authentication session + * List all workspaces for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "getCurrentKey": ( - options: { readonly config?: Config | undefined } | undefined + readonly "listWorkspaces": ( + options: + | { readonly params?: typeof ListWorkspacesParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"GetCurrentKey401", typeof GetCurrentKey401.Type> - | OpenRouterClientError<"GetCurrentKey500", typeof GetCurrentKey500.Type> + | OpenRouterClientError<"ListWorkspaces401", typeof ListWorkspaces401.Type> + | OpenRouterClientError<"ListWorkspaces500", typeof ListWorkspaces500.Type> > /** - * Exchange an authorization code from the PKCE flow for a user-controlled API key + * Create a new workspace for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "exchangeAuthCodeForAPIKey": ( + readonly "createWorkspace": ( options: { - readonly payload: typeof ExchangeAuthCodeForAPIKeyRequestJson.Encoded + readonly params?: typeof CreateWorkspaceParams.Encoded | undefined + readonly payload: typeof CreateWorkspaceRequestJson.Encoded readonly config?: Config | undefined } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"ExchangeAuthCodeForAPIKey400", typeof ExchangeAuthCodeForAPIKey400.Type> - | OpenRouterClientError<"ExchangeAuthCodeForAPIKey403", typeof ExchangeAuthCodeForAPIKey403.Type> - | OpenRouterClientError<"ExchangeAuthCodeForAPIKey500", typeof ExchangeAuthCodeForAPIKey500.Type> + | OpenRouterClientError<"CreateWorkspace400", typeof CreateWorkspace400.Type> + | OpenRouterClientError<"CreateWorkspace401", typeof CreateWorkspace401.Type> + | OpenRouterClientError<"CreateWorkspace403", typeof CreateWorkspace403.Type> + | OpenRouterClientError<"CreateWorkspace500", typeof CreateWorkspace500.Type> > /** - * Create an authorization code for the PKCE flow to generate a user-controlled API key + * Get a single workspace by ID or slug. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "createAuthKeysCode": ( - options: { readonly payload: typeof CreateAuthKeysCodeRequestJson.Encoded; readonly config?: Config | undefined } + readonly "getWorkspace": ( + id: string, + options: + | { readonly params?: typeof GetWorkspaceParams.Encoded | undefined; readonly config?: Config | undefined } + | undefined ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"CreateAuthKeysCode400", typeof CreateAuthKeysCode400.Type> - | OpenRouterClientError<"CreateAuthKeysCode401", typeof CreateAuthKeysCode401.Type> - | OpenRouterClientError<"CreateAuthKeysCode500", typeof CreateAuthKeysCode500.Type> + | OpenRouterClientError<"GetWorkspace401", typeof GetWorkspace401.Type> + | OpenRouterClientError<"GetWorkspace404", typeof GetWorkspace404.Type> + | OpenRouterClientError<"GetWorkspace500", typeof GetWorkspace500.Type> > /** - * Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. + * Delete an existing workspace. The default workspace cannot be deleted. Workspaces with active API keys cannot be deleted. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "sendChatCompletionRequest": ( + readonly "deleteWorkspace": ( + id: string, options: { - readonly payload: typeof SendChatCompletionRequestRequestJson.Encoded + readonly params?: typeof DeleteWorkspaceParams.Encoded | undefined + readonly config?: Config | undefined + } | undefined + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"DeleteWorkspace400", typeof DeleteWorkspace400.Type> + | OpenRouterClientError<"DeleteWorkspace401", typeof DeleteWorkspace401.Type> + | OpenRouterClientError<"DeleteWorkspace403", typeof DeleteWorkspace403.Type> + | OpenRouterClientError<"DeleteWorkspace404", typeof DeleteWorkspace404.Type> + | OpenRouterClientError<"DeleteWorkspace500", typeof DeleteWorkspace500.Type> + > + /** + * Update an existing workspace by ID or slug. [Management key](/docs/guides/overview/auth/management-api-keys) required. + */ + readonly "updateWorkspace": ( + id: string, + options: { + readonly params?: typeof UpdateWorkspaceParams.Encoded | undefined + readonly payload: typeof UpdateWorkspaceRequestJson.Encoded readonly config?: Config | undefined } ) => Effect.Effect< - WithOptionalResponse, + WithOptionalResponse, | HttpClientError.HttpClientError | SchemaError - | OpenRouterClientError<"SendChatCompletionRequest400", typeof SendChatCompletionRequest400.Type> - | OpenRouterClientError<"SendChatCompletionRequest401", typeof SendChatCompletionRequest401.Type> - | OpenRouterClientError<"SendChatCompletionRequest429", typeof SendChatCompletionRequest429.Type> - | OpenRouterClientError<"SendChatCompletionRequest500", typeof SendChatCompletionRequest500.Type> + | OpenRouterClientError<"UpdateWorkspace400", typeof UpdateWorkspace400.Type> + | OpenRouterClientError<"UpdateWorkspace401", typeof UpdateWorkspace401.Type> + | OpenRouterClientError<"UpdateWorkspace403", typeof UpdateWorkspace403.Type> + | OpenRouterClientError<"UpdateWorkspace404", typeof UpdateWorkspace404.Type> + | OpenRouterClientError<"UpdateWorkspace500", typeof UpdateWorkspace500.Type> > /** - * Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. + * Add multiple organization members to a workspace. Members are assigned the same role they hold in the organization. [Management key](/docs/guides/overview/auth/management-api-keys) required. */ - readonly "sendChatCompletionRequestSse": ( - options: { readonly payload: typeof SendChatCompletionRequestRequestJson.Encoded } - ) => Stream.Stream< - { - readonly event: string - readonly id: string | undefined - readonly data: typeof SendChatCompletionRequest200Sse.Type - }, - HttpClientError.HttpClientError | SchemaError | Sse.Retry, - typeof SendChatCompletionRequest200Sse.DecodingServices + readonly "bulkAddWorkspaceMembers": ( + id: string, + options: { + readonly params?: typeof BulkAddWorkspaceMembersParams.Encoded | undefined + readonly payload: typeof BulkAddWorkspaceMembersRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"BulkAddWorkspaceMembers400", typeof BulkAddWorkspaceMembers400.Type> + | OpenRouterClientError<"BulkAddWorkspaceMembers401", typeof BulkAddWorkspaceMembers401.Type> + | OpenRouterClientError<"BulkAddWorkspaceMembers403", typeof BulkAddWorkspaceMembers403.Type> + | OpenRouterClientError<"BulkAddWorkspaceMembers404", typeof BulkAddWorkspaceMembers404.Type> + | OpenRouterClientError<"BulkAddWorkspaceMembers500", typeof BulkAddWorkspaceMembers500.Type> + > + /** + * Remove multiple members from a workspace. Members with active API keys in the workspace cannot be removed. [Management key](/docs/guides/overview/auth/management-api-keys) required. + */ + readonly "bulkRemoveWorkspaceMembers": ( + id: string, + options: { + readonly params?: typeof BulkRemoveWorkspaceMembersParams.Encoded | undefined + readonly payload: typeof BulkRemoveWorkspaceMembersRequestJson.Encoded + readonly config?: Config | undefined + } + ) => Effect.Effect< + WithOptionalResponse, + | HttpClientError.HttpClientError + | SchemaError + | OpenRouterClientError<"BulkRemoveWorkspaceMembers400", typeof BulkRemoveWorkspaceMembers400.Type> + | OpenRouterClientError<"BulkRemoveWorkspaceMembers401", typeof BulkRemoveWorkspaceMembers401.Type> + | OpenRouterClientError<"BulkRemoveWorkspaceMembers403", typeof BulkRemoveWorkspaceMembers403.Type> + | OpenRouterClientError<"BulkRemoveWorkspaceMembers404", typeof BulkRemoveWorkspaceMembers404.Type> + | OpenRouterClientError<"BulkRemoveWorkspaceMembers500", typeof BulkRemoveWorkspaceMembers500.Type> > } diff --git a/packages/ai/openrouter/src/OpenRouterClient.ts b/packages/ai/openrouter/src/OpenRouterClient.ts index 72801d672a..1bd1301f78 100644 --- a/packages/ai/openrouter/src/OpenRouterClient.ts +++ b/packages/ai/openrouter/src/OpenRouterClient.ts @@ -61,14 +61,14 @@ export interface Service { readonly client: Generated.OpenRouterClient readonly createChatCompletion: ( - options: typeof Generated.ChatGenerationParams.Encoded + options: typeof Generated.ChatRequest.Encoded ) => Effect.Effect< [body: typeof Generated.SendChatCompletionRequest200.Type, response: HttpClientResponse.HttpClientResponse], AiError.AiError > readonly createChatCompletionStream: ( - options: Omit + options: Omit ) => Effect.Effect< [ response: HttpClientResponse.HttpClientResponse, @@ -89,7 +89,7 @@ export interface Service { * @category models * @since 4.0.0 */ -export type ChatStreamingResponseChunkData = typeof Generated.ChatStreamingResponseChunk.fields.data.Type +export type ChatStreamingResponseChunkData = typeof Generated.ChatStreamingResponse.fields.data.Type // ============================================================================= // Service Identifier @@ -364,7 +364,7 @@ export const layerConfig = (options?: { // Internal Utilities // ============================================================================= -const ChatStreamingResponseChunkDataFromString = Schema.fromJsonString(Generated.ChatStreamingResponseChunk.fields.data) +const ChatStreamingResponseChunkDataFromString = Schema.fromJsonString(Generated.ChatStreamingResponse.fields.data) const decodeChatStreamingResponseChunkData = Schema.decodeUnknownEffect(ChatStreamingResponseChunkDataFromString) const decodeChatCompletionSseData = ( diff --git a/packages/ai/openrouter/src/OpenRouterLanguageModel.ts b/packages/ai/openrouter/src/OpenRouterLanguageModel.ts index 47158a3fec..79eef4ec0f 100644 --- a/packages/ai/openrouter/src/OpenRouterLanguageModel.ts +++ b/packages/ai/openrouter/src/OpenRouterLanguageModel.ts @@ -22,7 +22,6 @@ * @since 4.0.0 */ /** @effect-diagnostics preferSchemaOverJson:skip-file */ -import * as Arr from "effect/Array" import * as Context from "effect/Context" import * as DateTime from "effect/DateTime" import * as Effect from "effect/Effect" @@ -75,7 +74,7 @@ export class Config extends Context.Service< Simplify< & Partial< Omit< - typeof Generated.ChatGenerationParams.Encoded, + typeof Generated.ChatRequest.Encoded, "messages" | "response_format" | "tools" | "tool_choice" | "stream" | "stream_options" > > @@ -102,7 +101,7 @@ export class Config extends Context.Service< * @category models * @since 4.0.0 */ -export type ReasoningDetails = Exclude +export type ReasoningDetails = Exclude /** * File annotations emitted on OpenRouter assistant messages and exposed in @@ -112,7 +111,7 @@ export type ReasoningDetails = Exclude[number], + NonNullable[number], { type: "file" } > @@ -136,7 +135,7 @@ declare module "effect/unstable/ai/Prompt" { /** * A breakpoint which marks the end of reusable content eligible for caching. */ - readonly cacheControl?: typeof Generated.ChatMessageContentItemCacheControl.Encoded | null + readonly cacheControl?: typeof Generated.ChatContentCacheControl.Encoded | null } | null } @@ -159,7 +158,7 @@ declare module "effect/unstable/ai/Prompt" { /** * A breakpoint which marks the end of reusable content eligible for caching. */ - readonly cacheControl?: typeof Generated.ChatMessageContentItemCacheControl.Encoded | null + readonly cacheControl?: typeof Generated.ChatContentCacheControl.Encoded | null } | null } @@ -182,7 +181,7 @@ declare module "effect/unstable/ai/Prompt" { /** * A breakpoint which marks the end of reusable content eligible for caching. */ - readonly cacheControl?: typeof Generated.ChatMessageContentItemCacheControl.Encoded | null + readonly cacheControl?: typeof Generated.ChatContentCacheControl.Encoded | null /** * Reasoning details associated with the assistant message. */ @@ -209,7 +208,7 @@ declare module "effect/unstable/ai/Prompt" { /** * A breakpoint which marks the end of reusable content eligible for caching. */ - readonly cacheControl?: typeof Generated.ChatMessageContentItemCacheControl.Encoded | null + readonly cacheControl?: typeof Generated.ChatContentCacheControl.Encoded | null } | null } @@ -231,7 +230,7 @@ declare module "effect/unstable/ai/Prompt" { /** * A breakpoint which marks the end of reusable content eligible for caching. */ - readonly cacheControl?: typeof Generated.ChatMessageContentItemCacheControl.Encoded | null + readonly cacheControl?: typeof Generated.ChatContentCacheControl.Encoded | null } | null } @@ -254,7 +253,7 @@ declare module "effect/unstable/ai/Prompt" { /** * A breakpoint which marks the end of reusable content eligible for caching. */ - readonly cacheControl?: typeof Generated.ChatMessageContentItemCacheControl.Encoded | null + readonly cacheControl?: typeof Generated.ChatContentCacheControl.Encoded | null /** * Reasoning details associated with the reasoning part. */ @@ -285,7 +284,7 @@ declare module "effect/unstable/ai/Prompt" { /** * A breakpoint which marks the end of reusable content eligible for caching. */ - readonly cacheControl?: typeof Generated.ChatMessageContentItemCacheControl.Encoded | null + readonly cacheControl?: typeof Generated.ChatContentCacheControl.Encoded | null } | null } @@ -330,7 +329,7 @@ declare module "effect/unstable/ai/Prompt" { /** * A breakpoint which marks the end of reusable content eligible for caching. */ - readonly cacheControl?: typeof Generated.ChatMessageContentItemCacheControl.Encoded | null + readonly cacheControl?: typeof Generated.ChatContentCacheControl.Encoded | null } | null } } @@ -479,7 +478,7 @@ declare module "effect/unstable/ai/Response" { /** * Raw token usage reported by OpenRouter. */ - readonly usage?: typeof Generated.ChatGenerationTokenUsage.Encoded | null + readonly usage?: typeof Generated.ChatUsage.Encoded | null /** * File annotations returned by the provider. */ @@ -567,11 +566,11 @@ export const make = Effect.fnUntraced(function*({ model, config: providerConfig function*({ config, options }: { readonly config: typeof Config.Service readonly options: LanguageModel.ProviderOptions - }): Effect.fn.Return { + }): Effect.fn.Return { const messages = yield* prepareMessages({ options }) const { tools, toolChoice } = yield* prepareTools({ options, transformer: codecTransformer }) const responseFormat = yield* getResponseFormat({ config, options, transformer: codecTransformer }) - const request: typeof Generated.ChatGenerationParams.Encoded = { + const request: typeof Generated.ChatRequest.Encoded = { ...config, messages, ...(Predicate.isNotUndefined(responseFormat) ? { response_format: responseFormat } : undefined), @@ -680,8 +679,8 @@ export const withConfigOverride: { const prepareMessages = Effect.fnUntraced( function*({ options }: { readonly options: LanguageModel.ProviderOptions - }): Effect.fn.Return, AiError.AiError> { - const messages: Array = [] + }): Effect.fn.Return, AiError.AiError> { + const messages: Array = [] const reasoningDetailsTracker = new ReasoningDetailsDuplicateTracker() @@ -703,7 +702,7 @@ const prepareMessages = Effect.fnUntraced( } case "user": { - const content: Array = [] + const content: Array = [] // Get the message-level cache control const messageCacheControl = getCacheControl(message) @@ -798,7 +797,7 @@ const prepareMessages = Effect.fnUntraced( case "assistant": { let text = "" let reasoning = "" - const toolCalls: Array = [] + const toolCalls: Array = [] for (const part of message.content) { switch (part.type) { @@ -856,7 +855,7 @@ const prepareMessages = Effect.fnUntraced( messages.push({ role: "assistant", content: text, - reasoning: reasoning.length > 0 ? reasoning : null, + ...(reasoning.length > 0 ? { reasoning } : undefined), ...(Predicate.isNotNull(reasoningDetails) ? { reasoning_details: reasoningDetails } : undefined), ...(toolCalls.length > 0 ? { tool_calls: toolCalls } : undefined) }) @@ -997,7 +996,7 @@ const makeResponse = Effect.fnUntraced( if (content.length > 0) { parts.push({ type: "text", text: content }) } - } else { + } else if (Array.isArray(content)) { for (const item of content) { if (item.type === "text") { parts.push({ type: "text", text: item.text }) @@ -1234,8 +1233,12 @@ const makeStreamResponse = Effect.fnUntraced( if (Predicate.isNotUndefined(lastDetail) && lastDetail.type === "reasoning.text") { // Merge with the previous text detail lastDetail.text = (lastDetail.text ?? "") + (detail.text ?? "") - lastDetail.signature = lastDetail.signature ?? detail.signature ?? null - lastDetail.format = lastDetail.format ?? detail.format ?? null + if (Predicate.isUndefined(lastDetail.signature) && Predicate.isNotUndefined(detail.signature)) { + lastDetail.signature = detail.signature + } + if (Predicate.isUndefined(lastDetail.format) && Predicate.isNotUndefined(detail.format)) { + lastDetail.format = detail.format + } } else { // Start a new text detail accumulatedReasoningDetails.push({ ...detail }) @@ -1562,8 +1565,8 @@ const prepareTools = Effect.fnUntraced( readonly options: LanguageModel.ProviderOptions readonly transformer: LanguageModel.CodecTransformer }): Effect.fn.Return<{ - readonly tools: ReadonlyArray | undefined - readonly toolChoice: typeof Generated.ToolChoiceOption.Encoded | undefined + readonly tools: ReadonlyArray | undefined + readonly toolChoice: typeof Generated.ChatToolChoice.Encoded | undefined }, AiError.AiError> { if (options.tools.length === 0) { return { tools: undefined, toolChoice: undefined } @@ -1581,20 +1584,20 @@ const prepareTools = Effect.fnUntraced( }) } - let tools: Array = [] - let toolChoice: typeof Generated.ToolChoiceOption.Encoded | undefined = undefined + let tools: Array> = [] + let toolChoice: typeof Generated.ChatToolChoice.Encoded | undefined = undefined for (const tool of options.tools) { const description = Tool.getDescription(tool) const parameters = yield* tryJsonSchema(tool.parametersSchema, "prepareTools", transformer) - const strict = Tool.getStrictMode(tool) ?? null + const strict = Tool.getStrictMode(tool) tools.push({ type: "function", function: { name: tool.name, parameters, - strict, + ...(Predicate.isNotUndefined(strict) ? { strict } : undefined), ...(Predicate.isNotUndefined(description) ? { description } : undefined) } }) @@ -1624,7 +1627,7 @@ const prepareTools = Effect.fnUntraced( const annotateRequest = ( span: Span, - request: typeof Generated.ChatGenerationParams.Encoded + request: typeof Generated.ChatRequest.Encoded ): void => { addGenAIAnnotations(span, { system: "openrouter", @@ -1634,9 +1637,11 @@ const annotateRequest = ( temperature: request.temperature, topP: request.top_p, maxTokens: request.max_tokens, - stopSequences: Arr.ensure(request.stop).filter( - Predicate.isNotNullish - ) + stopSequences: typeof request.stop === "string" + ? [request.stop] + : Array.isArray(request.stop) + ? request.stop.filter(Predicate.isString) + : [] } }) } @@ -1691,7 +1696,7 @@ const getCacheControl = ( | Prompt.ReasoningPart | Prompt.FilePart | Prompt.ToolResultPart -): typeof Generated.ChatMessageContentItemCacheControl.Encoded | null => part.options.openrouter?.cacheControl ?? null +): typeof Generated.ChatContentCacheControl.Encoded | null => part.options.openrouter?.cacheControl ?? null const findFirstReasoningDetails = (content: ReadonlyArray): ReasoningDetails | null => { for (const part of content) { @@ -1754,7 +1759,7 @@ const getResponseFormat = Effect.fnUntraced(function*({ config, options, transfo readonly config: typeof Config.Service readonly options: LanguageModel.ProviderOptions readonly transformer: LanguageModel.CodecTransformer -}): Effect.fn.Return { +}): Effect.fn.Return { if (options.responseFormat.type === "json") { const description = SchemaAST.resolveDescription(options.responseFormat.schema.ast) const jsonSchema = yield* tryJsonSchema(options.responseFormat.schema, "getResponseFormat", transformer) @@ -1763,7 +1768,7 @@ const getResponseFormat = Effect.fnUntraced(function*({ config, options, transfo json_schema: { name: options.responseFormat.objectName, schema: jsonSchema, - strict: config.strictJsonSchema ?? null, + ...(Predicate.isNotUndefined(config.strictJsonSchema) ? { strict: config.strictJsonSchema } : undefined), ...(Predicate.isNotUndefined(description) ? { description } : undefined) } } @@ -1781,7 +1786,7 @@ const getBase64FromDataUrl = (dataUrl: string): string => { return match ? match[1]! : dataUrl } -const getUsage = (usage: Generated.ChatGenerationTokenUsage | undefined): Response.Usage => { +const getUsage = (usage: Generated.ChatUsage | undefined): Response.Usage => { if (Predicate.isUndefined(usage)) { return { inputTokens: { uncached: undefined, total: 0, cacheRead: undefined, cacheWrite: undefined },