diff --git a/bindings/typescript/src/generated/anthropic/WebSearchToolResultErrorCode.ts b/bindings/typescript/src/generated/anthropic/WebSearchToolResultErrorCode.ts index 2d502c0b..144d2859 100644 --- a/bindings/typescript/src/generated/anthropic/WebSearchToolResultErrorCode.ts +++ b/bindings/typescript/src/generated/anthropic/WebSearchToolResultErrorCode.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type WebSearchToolResultErrorCode = "invalid_tool_input" | "max_uses_exceeded" | "query_too_long" | "too_many_requests" | "unavailable"; +export type WebSearchToolResultErrorCode = "invalid_tool_input" | "max_uses_exceeded" | "query_too_long" | "request_too_large" | "too_many_requests" | "unavailable"; diff --git a/crates/generate-types/src/main.rs b/crates/generate-types/src/main.rs index 725d4131..2cd7471c 100644 --- a/crates/generate-types/src/main.rs +++ b/crates/generate-types/src/main.rs @@ -103,12 +103,12 @@ fn generate_anthropic_types() { } }; - println!("🔍 Parsing JSON OpenAPI spec..."); + println!("🔍 Parsing YAML OpenAPI spec..."); - let schema: serde_json::Value = match serde_json::from_str(&anthropic_spec) { + let schema: serde_json::Value = match serde_yaml::from_str(&anthropic_spec) { Ok(value) => value, Err(e) => { - println!("❌ Failed to parse Anthropic OpenAPI spec as JSON: {}", e); + println!("❌ Failed to parse Anthropic OpenAPI spec as YAML: {}", e); return; } }; @@ -424,9 +424,9 @@ fn extract_type_name_from_ref(ref_str: &str) -> Option { fn generate_anthropic_specific_types(anthropic_spec: &str) { println!("🏗️ Using quicktype for Anthropic type generation..."); - // Extract Anthropic OpenAPI spec + // Extract Anthropic OpenAPI spec (YAML format from Stainless) let full_spec: serde_json::Value = - serde_json::from_str(anthropic_spec).expect("Failed to parse Anthropic OpenAPI spec"); + serde_yaml::from_str(anthropic_spec).expect("Failed to parse Anthropic OpenAPI spec"); // Generate types using quicktype approach match generate_anthropic_types_with_quicktype( @@ -545,8 +545,11 @@ fn preprocess_anthropic_schema_for_separation(spec: &serde_json::Value) -> serde .and_then(|s| s.as_object()) .unwrap_or(&default_map); - // Step 1: Analyze endpoints to identify request vs response schemas - let (request_schemas, response_schemas) = analyze_anthropic_endpoints(spec); + // Use stable schemas (not Beta) - Beta schemas introduce breaking structural changes + // (new required fields on content blocks). Beta-only fields like `strict` are added + // manually to tool structs in tool_generator.rs instead. + let request_schemas = vec!["CreateMessageParams".to_string()]; + let response_schemas = vec!["Message".to_string()]; println!( "🔍 Identified {} request schemas, {} response schemas", @@ -556,7 +559,7 @@ fn preprocess_anthropic_schema_for_separation(spec: &serde_json::Value) -> serde let mut separated_schemas = serde_json::Map::new(); - // Step 2: Recursively add all dependencies for the original schemas. + // Recursively add all dependencies for the schemas. // Tool schemas will be pulled in automatically via $ref links from CreateMessageParams. for schema_name in &request_schemas { add_dependencies_recursively(schema_name, all_schemas, &mut separated_schemas); @@ -565,7 +568,7 @@ fn preprocess_anthropic_schema_for_separation(spec: &serde_json::Value) -> serde add_dependencies_recursively(schema_name, all_schemas, &mut separated_schemas); } - // Step 3: Now clean the main request/response schemas to remove conflicting fields + // Clean the main request/response schemas to remove conflicting fields for schema_name in &request_schemas { if let Some(schema) = separated_schemas.get(schema_name) { let cleaned_schema = remove_response_fields_from_schema(schema); @@ -581,7 +584,6 @@ fn preprocess_anthropic_schema_for_separation(spec: &serde_json::Value) -> serde } // Step 5: Create root schema with separated types - // Use a different approach: create separate top-level object types to avoid merging let root_schema = serde_json::json!({ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", @@ -607,66 +609,6 @@ fn preprocess_anthropic_schema_for_separation(spec: &serde_json::Value) -> serde root_schema } -fn analyze_anthropic_endpoints(spec: &serde_json::Value) -> (Vec, Vec) { - let mut request_schemas = Vec::new(); - let mut response_schemas = Vec::new(); - - // Analyze the /v1/messages endpoint - if let Some(paths) = spec.get("paths") { - if let Some(messages_path) = paths.get("/v1/messages") { - if let Some(post_op) = messages_path.get("post") { - // Extract request schema from requestBody - if let Some(request_body) = post_op.get("requestBody") { - if let Some(content) = request_body.get("content") { - if let Some(json_content) = content.get("application/json") { - if let Some(schema) = json_content.get("schema") { - if let Some(schema_ref) = schema.get("$ref") { - if let Some(schema_name) = extract_schema_name_from_ref( - schema_ref.as_str().unwrap_or(""), - ) { - request_schemas.push(schema_name); - } - } - } - } - } - } - - // Extract response schemas from responses - if let Some(responses) = post_op.get("responses") { - if let Some(success_response) = responses.get("200") { - if let Some(content) = success_response.get("content") { - if let Some(json_content) = content.get("application/json") { - if let Some(schema) = json_content.get("schema") { - if let Some(schema_ref) = schema.get("$ref") { - if let Some(schema_name) = extract_schema_name_from_ref( - schema_ref.as_str().unwrap_or(""), - ) { - response_schemas.push(schema_name); - } - } - } - } - } - } - } - } - } - } - - println!("🔍 Found request schemas: {:?}", request_schemas); - println!("🔍 Found response schemas: {:?}", response_schemas); - - (request_schemas, response_schemas) -} - -fn extract_schema_name_from_ref(ref_str: &str) -> Option { - // Extract schema name from "#/components/schemas/CreateMessageParams" - ref_str - .rfind('/') - .map(|last_slash| ref_str[last_slash + 1..].to_string()) -} - fn remove_response_fields_from_schema(schema: &serde_json::Value) -> serde_json::Value { let mut cleaned_schema = schema.clone(); diff --git a/crates/generate-types/src/tool_generator.rs b/crates/generate-types/src/tool_generator.rs index cb80d50e..81bf2e82 100644 --- a/crates/generate-types/src/tool_generator.rs +++ b/crates/generate-types/src/tool_generator.rs @@ -151,7 +151,8 @@ fn extract_anthropic_tool_schemas(spec: &serde_json::Value) -> ToolSchemas { let mut result = ToolSchemas::default(); for (schema_name, schema_def) in schemas { - // Skip beta tools for now - Lingua does not (yet) support Anthropic beta features + // Skip Beta schemas - they introduce breaking structural changes (new required + // fields on content blocks). We add Beta-only fields like `strict` manually below. if schema_name.starts_with("Beta") { continue; } @@ -365,6 +366,12 @@ fn generate_tool_struct_direct( } } + // Add `strict` field - this is a Beta-only field that we add manually since we use + // stable schemas to avoid breaking structural changes from Beta content blocks + output.push_str(" /// Whether to enforce strict schema validation for tool inputs.\n"); + output.push_str(" #[serde(skip_serializing_if = \"Option::is_none\")]\n"); + output.push_str(" pub strict: Option,\n"); + output.push_str("}\n"); output } diff --git a/crates/lingua/src/providers/anthropic/generated.rs b/crates/lingua/src/providers/anthropic/generated.rs index 77d46db1..b3189e9c 100644 --- a/crates/lingua/src/providers/anthropic/generated.rs +++ b/crates/lingua/src/providers/anthropic/generated.rs @@ -39,7 +39,7 @@ pub struct CreateMessageParams { /// specifies the absolute maximum number of tokens to generate. /// /// Different models have different maximum values for this parameter. See - /// [models](https://docs.anthropic.com/en/docs/models-overview) for details. + /// [models](https://docs.claude.com/en/docs/models-overview) for details. pub max_tokens: i64, /// Input messages. /// @@ -95,10 +95,10 @@ pub struct CreateMessageParams { /// {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]} /// ``` /// - /// See [input examples](https://docs.anthropic.com/en/api/messages-examples). + /// See [input examples](https://docs.claude.com/en/api/messages-examples). /// /// Note that if you want to include a [system - /// prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level + /// 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. /// /// There is a limit of 100,000 messages in a single request. @@ -111,7 +111,7 @@ pub struct CreateMessageParams { /// request. /// /// Anthropic offers different levels of service for your API requests. See - /// [service-tiers](https://docs.anthropic.com/en/api/service-tiers) for details. + /// [service-tiers](https://docs.claude.com/en/api/service-tiers) for details. #[serde(skip_serializing_if = "Option::is_none")] pub service_tier: Option, /// Custom text sequences that will cause the model to stop generating. @@ -127,14 +127,14 @@ pub struct CreateMessageParams { pub stop_sequences: Option>, /// Whether to incrementally stream the response using server-sent events. /// - /// See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for details. + /// See [streaming](https://docs.claude.com/en/api/messages-streaming) for details. #[serde(skip_serializing_if = "Option::is_none")] pub stream: Option, /// System prompt. /// /// A 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.anthropic.com/en/docs/system-prompts). + /// prompts](https://docs.claude.com/en/docs/system-prompts). #[serde(skip_serializing_if = "Option::is_none")] pub system: Option, /// Amount of randomness injected into the response. @@ -158,9 +158,9 @@ pub struct CreateMessageParams { /// /// There are two types of tools: **client tools** and **server tools**. The behavior /// described below applies to client tools. For [server - /// tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview\#server-tools), + /// 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.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)). + /// tool](https://docs.claude.com/en/docs/agents-and-tools/tool-use/web-search-tool)). /// /// Each tool definition includes: /// @@ -221,7 +221,7 @@ pub struct CreateMessageParams { /// more generally whenever you want the model to produce a particular JSON structure of /// output. /// - /// See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details. + /// See our [guide](https://docs.claude.com/en/docs/tool-use) for more details. #[serde(skip_serializing_if = "Option::is_none")] pub tools: Option>, /// Only sample from the top K options for each subsequent token. @@ -627,6 +627,8 @@ pub enum WebSearchToolResultErrorCode { MaxUsesExceeded, #[serde(rename = "query_too_long")] QueryTooLong, + #[serde(rename = "request_too_large")] + RequestTooLarge, #[serde(rename = "too_many_requests")] TooManyRequests, Unavailable, @@ -687,7 +689,7 @@ pub struct Metadata { /// request. /// /// Anthropic offers different levels of service for your API requests. See -/// [service-tiers](https://docs.anthropic.com/en/api/service-tiers) for details. +/// [service-tiers](https://docs.claude.com/en/api/service-tiers) for details. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] #[serde(rename_all = "snake_case")] #[ts(export_to = "anthropic/")] @@ -701,7 +703,7 @@ pub enum ServiceTierEnum { /// /// A 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.anthropic.com/en/docs/system-prompts). +/// prompts](https://docs.claude.com/en/docs/system-prompts). #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] #[serde(untagged)] #[ts(export_to = "anthropic/")] @@ -717,7 +719,7 @@ pub enum System { /// towards your `max_tokens` limit. /// /// See [extended -/// thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking) for +/// thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for /// details. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] #[ts(export_to = "anthropic/")] @@ -729,7 +731,7 @@ pub struct Thinking { /// Must be ≥1024 and less than `max_tokens`. /// /// See [extended - /// thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking) for + /// thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for /// details. pub budget_tokens: Option, #[serde(rename = "type")] @@ -803,6 +805,9 @@ pub struct CustomTool { /// /// This is how the tool will be called by the model and in `tool_use` blocks. pub name: String, + /// Whether to enforce strict schema validation for tool inputs. + #[serde(skip_serializing_if = "Option::is_none")] + pub strict: Option, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] @@ -816,6 +821,9 @@ pub struct BashTool20250124 { /// /// This is how the tool will be called by the model and in `tool_use` blocks. pub name: String, + /// Whether to enforce strict schema validation for tool inputs. + #[serde(skip_serializing_if = "Option::is_none")] + pub strict: Option, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] @@ -829,6 +837,9 @@ pub struct TextEditor20250124 { /// /// This is how the tool will be called by the model and in `tool_use` blocks. pub name: String, + /// Whether to enforce strict schema validation for tool inputs. + #[serde(skip_serializing_if = "Option::is_none")] + pub strict: Option, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] @@ -842,6 +853,9 @@ pub struct TextEditor20250429 { /// /// This is how the tool will be called by the model and in `tool_use` blocks. pub name: String, + /// Whether to enforce strict schema validation for tool inputs. + #[serde(skip_serializing_if = "Option::is_none")] + pub strict: Option, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] @@ -858,6 +872,9 @@ pub struct TextEditor20250728 { /// /// This is how the tool will be called by the model and in `tool_use` blocks. pub name: String, + /// Whether to enforce strict schema validation for tool inputs. + #[serde(skip_serializing_if = "Option::is_none")] + pub strict: Option, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] @@ -884,6 +901,9 @@ pub struct WebSearchTool20250305 { #[serde(skip_serializing_if = "Option::is_none")] #[ts(type = "unknown")] pub user_location: Option, + /// Whether to enforce strict schema validation for tool inputs. + #[serde(skip_serializing_if = "Option::is_none")] + pub strict: Option, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] @@ -1179,9 +1199,6 @@ pub enum ContentBlockType { WebSearchToolResult, } -/// Object type. -/// -/// For Messages, this is always `"message"`. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] #[serde(rename_all = "snake_case")] #[ts(export_to = "anthropic/")] @@ -1189,9 +1206,6 @@ pub enum ResponseType { Message, } -/// Conversational role of the generated message. -/// -/// This will always be `"assistant"`. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] #[serde(rename_all = "snake_case")] #[ts(export_to = "anthropic/")] @@ -1207,8 +1221,6 @@ pub enum StopReason { EndTurn, #[serde(rename = "max_tokens")] MaxTokens, - #[serde(rename = "model_context_window_exceeded")] - ModelContextWindowExceeded, #[serde(rename = "pause_turn")] PauseTurn, Refusal, diff --git a/pipelines/generate-provider-types.md b/pipelines/generate-provider-types.md index e2e1febd..c21596df 100644 --- a/pipelines/generate-provider-types.md +++ b/pipelines/generate-provider-types.md @@ -31,7 +31,7 @@ OpenAPI Spec Download → Automated Type Generation → Build Integration → Va **Spec sources**: - **OpenAI**: `https://app.stainless.com/api/spec/documented/openai/openapi.documented.yml` → `specs/openai/openapi.yml` -- **Anthropic**: `https://raw.githubusercontent.com/laszukdawid/anthropic-openapi-spec/main/hosted_spec.json` → `specs/anthropic/openapi.json` +- **Anthropic**: `https://app.stainless.com/api/spec/documented/anthropic/openapi.documented.yml` → `specs/anthropic/openapi.yml` **What this provides**: - Official API specification (always up-to-date) diff --git a/pipelines/generate-provider-types.sh b/pipelines/generate-provider-types.sh index 5dda0e0d..aba2dea1 100755 --- a/pipelines/generate-provider-types.sh +++ b/pipelines/generate-provider-types.sh @@ -55,24 +55,8 @@ download_provider_spec() { SPEC_FILE="$PROJECT_ROOT/specs/openai/openapi.yml" ;; "anthropic") - echo "Fetching official Anthropic OpenAPI spec URL from .stats.yml..." - STATS_URL="https://raw.githubusercontent.com/anthropics/anthropic-sdk-typescript/main/.stats.yml" - STATS_FILE="$PROJECT_ROOT/specs/anthropic/.stats.yml" - - # Download .stats.yml file - if ! curl -L -o "$STATS_FILE" "$STATS_URL"; then - echo "❌ Failed to download Anthropic .stats.yml" - exit 1 - fi - - # Extract the official OpenAPI spec URL from .stats.yml - SPEC_URL=$(grep "openapi_spec_url:" "$STATS_FILE" | sed 's/openapi_spec_url: *//') - if [ -z "$SPEC_URL" ]; then - echo "❌ Failed to extract OpenAPI spec URL from .stats.yml" - exit 1 - fi - - echo "Official spec URL: $SPEC_URL" + echo "Downloading Anthropic OpenAPI spec..." + SPEC_URL="https://app.stainless.com/api/spec/documented/anthropic/openapi.documented.yml" SPEC_FILE="$PROJECT_ROOT/specs/anthropic/openapi.yml" ;; "google") diff --git a/specs/anthropic/openapi.yml b/specs/anthropic/openapi.yml index a53f860d..fcba3d29 100644 --- a/specs/anthropic/openapi.yml +++ b/specs/anthropic/openapi.yml @@ -1,9917 +1,20101 @@ -{ - "openapi": "3.1.0", - "info": { "title": "Anthropic API", "version": "158" }, - "paths": { - "/v1/messages": { - "post": { - "summary": "Create a Message", - "description": "Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.\n\nThe Messages API can be used for either single queries or stateless multi-turn conversations.\n\nLearn more about the Messages API in our [user guide](/en/docs/initial-setup)", - "operationId": "messages_post", - "parameters": [ - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - } - ], - "responses": { - "200": { - "description": "Message object.", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Message" } } } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } - } - }, - "requestBody": { - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/CreateMessageParams" } } - }, - "required": true - } - } - }, - "/v1/complete": { - "post": { - "summary": "Create a Text Completion", - "description": "[Legacy] Create a Text Completion.\n\nThe Text Completions API is a legacy API. We recommend using the [Messages API](https://docs.anthropic.com/en/api/messages) going forward.\n\nFuture models and features will not be compatible with Text Completions. See our [migration guide](https://docs.anthropic.com/en/api/migrating-from-text-completions-to-messages) for guidance in migrating from Text Completions to Messages.", - "operationId": "complete_post", - "parameters": [ - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - }, - { - "name": "anthropic-beta", - "in": "header", - "required": false, - "schema": { - "type": "string", - "items": { "type": "string" }, - "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.", - "title": "Anthropic-Beta", - "x-stainless-override-schema": { - "x-stainless-param": "betas", - "x-stainless-extend-default": true, - "type": "array", - "description": "Optional header to specify the beta version(s) you want to use.", - "items": { "$ref": "#/components/schemas/AnthropicBeta" } - } - }, - "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." - } - ], - "responses": { - "200": { - "description": "Text Completion object.", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/CompletionResponse" } } +openapi: 3.1.0 +info: + title: Anthropic API + version: '227' +paths: + /v1/messages: + post: + summary: Create a Message + description: >- + 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) + operationId: messages_post + parameters: + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + responses: + '200': + description: Message object. + content: + application/json: + schema: + $ref: '#/components/schemas/Message' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateMessageParams' + required: true + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const message = await client.messages.create({ + max_tokens: 1024, + messages: [{ content: 'Hello, world', role: 'user' }], + model: 'claude-sonnet-4-5-20250929', + }); + + console.log(message.id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + message = client.messages.create( + max_tokens=1024, + messages=[{ + "content": "Hello, world", + "role": "user", + }], + model="claude-sonnet-4-5-20250929", + ) + print(message.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + message, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{ + MaxTokens: 1024, + Messages: []anthropic.MessageParam{anthropic.MessageParam{ + Content: []anthropic.ContentBlockParamUnion{anthropic.ContentBlockParamUnion{ + OfText: &anthropic.TextBlockParam{ + Text: "x", + }, + }}, + Role: anthropic.MessageParamRoleUser, + }}, + Model: anthropic.ModelClaudeSonnet4_5_20250929, + }) + if err != nil { + panic(err.Error()) } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } - } - }, - "requestBody": { - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/CompletionRequest" } } - }, - "required": true - } - } - }, - "/v1/models": { - "get": { - "summary": "List Models", - "description": "List available models.\n\nThe Models API response can be used to determine which models are available for use in the API. More recently released models are listed first.", - "operationId": "models_list", - "parameters": [ - { - "name": "before_id", - "in": "query", - "required": false, - "schema": { - "type": "string", - "description": "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object.", - "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." - }, - { - "name": "after_id", - "in": "query", - "required": false, - "schema": { - "type": "string", - "description": "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object.", - "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." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 1000, - "minimum": 1, - "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`.", - "default": 20, - "title": "Limit" - }, - "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - }, - { - "name": "x-api-key", - "in": "header", - "required": false, - "schema": { - "type": "string", - "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.", - "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." - }, - { - "name": "anthropic-beta", - "in": "header", - "required": false, - "schema": { - "type": "string", - "items": { "type": "string" }, - "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.", - "title": "Anthropic-Beta", - "x-stainless-override-schema": { - "x-stainless-param": "betas", - "x-stainless-extend-default": true, - "type": "array", - "description": "Optional header to specify the beta version(s) you want to use.", - "items": { "$ref": "#/components/schemas/AnthropicBeta" } + fmt.Printf("%+v\n", message.ID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.messages.Message; + import com.anthropic.models.messages.MessageCreateParams; + import com.anthropic.models.messages.Model; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + MessageCreateParams params = MessageCreateParams.builder() + .maxTokens(1024L) + .addUserMessage("Hello, world") + .model(Model.CLAUDE_SONNET_4_5_20250929) + .build(); + Message message = client.messages().create(params); } - }, - "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." } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ListResponse_ModelInfo_" } } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.messages.Message + import com.anthropic.models.messages.MessageCreateParams + import com.anthropic.models.messages.Model + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val params: MessageCreateParams = MessageCreateParams.builder() + .maxTokens(1024L) + .addUserMessage("Hello, world") + .model(Model.CLAUDE_SONNET_4_5_20250929) + .build() + val message: Message = client.messages().create(params) + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + message = anthropic.messages.create( + max_tokens: 1024, + messages: [{content: "Hello, world", role: :user}], + model: :"claude-sonnet-4-5-20250929" + ) + + puts(message) + /v1/complete: + post: + summary: Create a Text Completion + description: >- + [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. + operationId: complete_post + parameters: + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + responses: + '200': + description: Text Completion object. + content: + application/json: + schema: + $ref: '#/components/schemas/CompletionResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CompletionRequest' + required: true + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const completion = await client.completions.create({ + max_tokens_to_sample: 256, + model: 'claude-opus-4-5-20251101', + prompt: '\n\nHuman: Hello, world!\n\nAssistant:', + }); + + console.log(completion.id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + completion = client.completions.create( + max_tokens_to_sample=256, + model="claude-opus-4-5-20251101", + prompt="\n\nHuman: Hello, world!\n\nAssistant:", + ) + print(completion.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + completion, err := client.Completions.New(context.TODO(), anthropic.CompletionNewParams{ + MaxTokensToSample: 256, + Model: anthropic.ModelClaudeOpus4_5_20251101, + Prompt: "\n\nHuman: Hello, world!\n\nAssistant:", + }) + if err != nil { + panic(err.Error()) } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } - } - } - } - }, - "/v1/models/{model_id}": { - "get": { - "summary": "Get a Model", - "description": "Get a specific model.\n\nThe Models API response can be used to determine information about a specific model or resolve a model alias to a model ID.", - "operationId": "models_get", - "parameters": [ - { - "name": "model_id", - "in": "path", - "required": true, - "schema": { "type": "string", "description": "Model identifier or alias.", "title": "Model Id" }, - "description": "Model identifier or alias." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - }, - { - "name": "x-api-key", - "in": "header", - "required": false, - "schema": { - "type": "string", - "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.", - "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." - }, - { - "name": "anthropic-beta", - "in": "header", - "required": false, - "schema": { - "type": "string", - "items": { "type": "string" }, - "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.", - "title": "Anthropic-Beta", - "x-stainless-override-schema": { - "x-stainless-param": "betas", - "x-stainless-extend-default": true, - "type": "array", - "description": "Optional header to specify the beta version(s) you want to use.", - "items": { "$ref": "#/components/schemas/AnthropicBeta" } + fmt.Printf("%+v\n", completion.ID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.completions.Completion; + import com.anthropic.models.completions.CompletionCreateParams; + import com.anthropic.models.messages.Model; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + CompletionCreateParams params = CompletionCreateParams.builder() + .maxTokensToSample(256L) + .model(Model.of("claude-2.1")) + .prompt("\n\nHuman: Hello, world!\n\nAssistant:") + .build(); + Completion completion = client.completions().create(params); } - }, - "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." - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ModelInfo" } } } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } - } - } - } - }, - "/v1/messages/batches": { - "post": { - "summary": "Create a Message Batch", - "description": "Send a batch of Message creation requests.\n\nThe 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.\n\nLearn more about the Message Batches API in our [user guide](/en/docs/build-with-claude/batch-processing)", - "operationId": "message_batches_post", - "parameters": [ - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MessageBatch" } } } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } - } - }, - "requestBody": { - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/CreateMessageBatchParams" } } - }, - "required": true - } - }, - "get": { - "summary": "List Message Batches", - "description": "List all Message Batches within a Workspace. Most recently created batches are returned first.\n\nLearn more about the Message Batches API in our [user guide](/en/docs/build-with-claude/batch-processing)", - "operationId": "message_batches_list", - "parameters": [ - { - "name": "before_id", - "in": "query", - "required": false, - "schema": { - "type": "string", - "description": "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object.", - "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." - }, - { - "name": "after_id", - "in": "query", - "required": false, - "schema": { - "type": "string", - "description": "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object.", - "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." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 1000, - "minimum": 1, - "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`.", - "default": 20, - "title": "Limit" - }, - "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - }, - { - "name": "x-api-key", - "in": "header", - "required": false, - "schema": { - "type": "string", - "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.", - "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." - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/ListResponse_MessageBatch_" } } - } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } - } - } - } - }, - "/v1/messages/batches/{message_batch_id}": { - "get": { - "summary": "Retrieve a Message Batch", - "description": "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.\n\nLearn more about the Message Batches API in our [user guide](/en/docs/build-with-claude/batch-processing)", - "operationId": "message_batches_retrieve", - "parameters": [ - { - "name": "message_batch_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "description": "ID of the Message Batch.", - "title": "Message Batch Id" - }, - "description": "ID of the Message Batch." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - }, - { - "name": "x-api-key", - "in": "header", - "required": false, - "schema": { - "type": "string", - "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.", - "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." - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MessageBatch" } } } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } - } - } - }, - "delete": { - "summary": "Delete a Message Batch", - "description": "Delete a Message Batch.\n\nMessage 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.\n\nLearn more about the Message Batches API in our [user guide](/en/docs/build-with-claude/batch-processing)", - "operationId": "message_batches_delete", - "parameters": [ - { - "name": "message_batch_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "description": "ID of the Message Batch.", - "title": "Message Batch Id" - }, - "description": "ID of the Message Batch." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - }, - { - "name": "x-api-key", - "in": "header", - "required": false, - "schema": { - "type": "string", - "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.", - "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." } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/DeleteMessageBatchResponse" } } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.completions.Completion + import com.anthropic.models.completions.CompletionCreateParams + import com.anthropic.models.messages.Model + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val params: CompletionCreateParams = CompletionCreateParams.builder() + .maxTokensToSample(256L) + .model(Model.of("claude-2.1")) + .prompt("\n\nHuman: Hello, world!\n\nAssistant:") + .build() + val completion: Completion = client.completions().create(params) + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + completion = anthropic.completions.create( + max_tokens_to_sample: 256, + model: :"claude-opus-4-5-20251101", + prompt: "\n\nHuman: Hello, world!\n\nAssistant:" + ) + + puts(completion) + /v1/models: + get: + summary: List Models + description: >- + 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. + operationId: models_list + parameters: + - name: before_id + in: query + required: false + schema: + type: string + description: >- + ID of the object to use as a cursor for pagination. When provided, returns the page of results + immediately before this object. + 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. + - name: after_id + in: query + required: false + schema: + type: string + description: >- + ID of the object to use as a cursor for pagination. When provided, returns the page of results + immediately after this object. + 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. + - name: limit + in: query + required: false + schema: + type: integer + maximum: 1000 + minimum: 1 + description: |- + Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + default: 20 + title: Limit + description: |- + Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse_ModelInfo_' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const modelInfo of client.models.list()) { + console.log(modelInfo.id); + } + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + page = client.models.list() + page = page.data[0] + print(page.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Models.List(context.TODO(), anthropic.ModelListParams{ + + }) + if err != nil { + panic(err.Error()) } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } - } - } - } - }, - "/v1/messages/batches/{message_batch_id}/cancel": { - "post": { - "summary": "Cancel a Message Batch", - "description": "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.\n\nThe 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.\n\nLearn more about the Message Batches API in our [user guide](/en/docs/build-with-claude/batch-processing)", - "operationId": "message_batches_cancel", - "parameters": [ - { - "name": "message_batch_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "description": "ID of the Message Batch.", - "title": "Message Batch Id" - }, - "description": "ID of the Message Batch." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MessageBatch" } } } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } - } - } - } - }, - "/v1/messages/batches/{message_batch_id}/results": { - "get": { - "summary": "Retrieve Message Batch results", - "description": "Streams the results of a Message Batch as a `.jsonl` file.\n\nEach 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.\n\nLearn more about the Message Batches API in our [user guide](/en/docs/build-with-claude/batch-processing)", - "operationId": "message_batches_results", - "parameters": [ - { - "name": "message_batch_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "description": "ID of the Message Batch.", - "title": "Message Batch Id" - }, - "description": "ID of the Message Batch." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - }, - { - "name": "x-api-key", - "in": "header", - "required": false, - "schema": { - "type": "string", - "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.", - "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." - } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/x-jsonl": { - "schema": { "$ref": "#/components/schemas/MessageBatchIndividualResponse" } + fmt.Printf("%+v\n", page) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.models.ModelListPage; + import com.anthropic.models.models.ModelListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + ModelListPage page = client.models().list(); } - } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } - } - } - } - }, - "/v1/messages/count_tokens": { - "post": { - "summary": "Count tokens in a Message", - "description": "Count the number of tokens in a Message.\n\nThe Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it.\n\nLearn more about token counting in our [user guide](/en/docs/build-with-claude/token-counting)", - "operationId": "messages_count_tokens_post", - "parameters": [ - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/CountMessageTokensResponse" } } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.models.ModelListPage + import com.anthropic.models.models.ModelListParams + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val page: ModelListPage = client.models().list() + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + page = anthropic.models.list + + puts(page) + /v1/models/{model_id}: + get: + summary: Get a Model + description: >- + 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. + operationId: models_get + parameters: + - name: model_id + in: path + required: true + schema: + type: string + description: Model identifier or alias. + title: Model Id + description: Model identifier or alias. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/ModelInfo' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const modelInfo = await client.models.retrieve('model_id'); + + console.log(modelInfo.id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + model_info = client.models.retrieve( + model_id="model_id", + ) + print(model_info.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + modelInfo, err := client.Models.Get( + context.TODO(), + "model_id", + anthropic.ModelGetParams{ + + }, + ) + if err != nil { + panic(err.Error()) } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } - } - }, - "requestBody": { - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/CountMessageTokensParams" } } - }, - "required": true - } - } - }, - "/v1/files": { - "post": { - "summary": "Upload File", - "operationId": "upload_file_v1_files_post", - "parameters": [ - { - "name": "anthropic-beta", - "in": "header", - "required": false, - "schema": { - "type": "string", - "items": { "type": "string" }, - "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.", - "title": "Anthropic-Beta", - "x-stainless-override-schema": { - "x-stainless-param": "betas", - "x-stainless-extend-default": true, - "type": "array", - "description": "Optional header to specify the beta version(s) you want to use.", - "items": { "$ref": "#/components/schemas/AnthropicBeta" } + fmt.Printf("%+v\n", modelInfo.ID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.models.ModelInfo; + import com.anthropic.models.models.ModelRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + ModelInfo modelInfo = client.models().retrieve("model_id"); } - }, - "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." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/FileMetadataSchema" } } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.models.ModelInfo + import com.anthropic.models.models.ModelRetrieveParams + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val modelInfo: ModelInfo = client.models().retrieve("model_id") + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + model_info = anthropic.models.retrieve("model_id") + + puts(model_info) + /v1/messages/batches: + post: + summary: Create a Message Batch + description: >- + 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) + operationId: message_batches_post + parameters: + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/MessageBatch' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateMessageBatchParams' + required: true + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const messageBatch = await client.messages.batches.create({ + requests: [ + { + custom_id: 'my-custom-id-1', + params: { + max_tokens: 1024, + messages: [{ content: 'Hello, world', role: 'user' }], + model: 'claude-sonnet-4-5-20250929', + }, + }, + ], + }); + + console.log(messageBatch.id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + message_batch = client.messages.batches.create( + requests=[{ + "custom_id": "my-custom-id-1", + "params": { + "max_tokens": 1024, + "messages": [{ + "content": "Hello, world", + "role": "user", + }], + "model": "claude-sonnet-4-5-20250929", + }, + }], + ) + print(message_batch.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + messageBatch, err := client.Messages.Batches.New(context.TODO(), anthropic.MessageBatchNewParams{ + Requests: []anthropic.MessageBatchNewParamsRequest{anthropic.MessageBatchNewParamsRequest{ + CustomID: "my-custom-id-1", + Params: anthropic.MessageBatchNewParamsRequestParams{ + MaxTokens: 1024, + Messages: []anthropic.MessageParam{anthropic.MessageParam{ + Content: []anthropic.ContentBlockParamUnion{anthropic.ContentBlockParamUnion{ + OfText: &anthropic.TextBlockParam{ + Text: "x", + }, + }}, + Role: anthropic.MessageParamRoleUser, + }}, + Model: anthropic.ModelClaudeSonnet4_5_20250929, + }, + }}, + }) + if err != nil { + panic(err.Error()) } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } + fmt.Printf("%+v\n", messageBatch.ID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.messages.Model; + import com.anthropic.models.messages.batches.BatchCreateParams; + import com.anthropic.models.messages.batches.MessageBatch; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BatchCreateParams params = BatchCreateParams.builder() + .addRequest(BatchCreateParams.Request.builder() + .customId("my-custom-id-1") + .params(BatchCreateParams.Request.Params.builder() + .maxTokens(1024L) + .addUserMessage("Hello, world") + .model(Model.CLAUDE_SONNET_4_5_20250929) + .build()) + .build()) + .build(); + MessageBatch messageBatch = client.messages().batches().create(params); + } } - }, - "requestBody": { - "content": { - "multipart/form-data": { - "schema": { - "type": "object", - "properties": { - "file": { "type": "string", "format": "binary", "description": "The file to upload" } - }, - "required": ["file"] + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.messages.Model + import com.anthropic.models.messages.batches.BatchCreateParams + import com.anthropic.models.messages.batches.MessageBatch + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val params: BatchCreateParams = BatchCreateParams.builder() + .addRequest(BatchCreateParams.Request.builder() + .customId("my-custom-id-1") + .params(BatchCreateParams.Request.Params.builder() + .maxTokens(1024L) + .addUserMessage("Hello, world") + .model(Model.CLAUDE_SONNET_4_5_20250929) + .build()) + .build()) + .build() + val messageBatch: MessageBatch = client.messages().batches().create(params) + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + message_batch = anthropic.messages.batches.create( + requests: [ + { + custom_id: "my-custom-id-1", + params: {max_tokens: 1024, messages: [{content: "Hello, world", role: :user}], model: :"claude-sonnet-4-5-20250929"} } + ] + ) + + puts(message_batch) + get: + summary: List Message Batches + description: >- + 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) + operationId: message_batches_list + parameters: + - name: before_id + in: query + required: false + schema: + type: string + description: >- + ID of the object to use as a cursor for pagination. When provided, returns the page of results + immediately before this object. + 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. + - name: after_id + in: query + required: false + schema: + type: string + description: >- + ID of the object to use as a cursor for pagination. When provided, returns the page of results + immediately after this object. + 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. + - name: limit + in: query + required: false + schema: + type: integer + maximum: 1000 + minimum: 1 + description: |- + Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + default: 20 + title: Limit + description: |- + Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/ListResponse_MessageBatch_' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const messageBatch of client.messages.batches.list()) { + console.log(messageBatch.id); + } + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + page = client.messages.batches.list() + page = page.data[0] + print(page.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Messages.Batches.List(context.TODO(), anthropic.MessageBatchListParams{ + + }) + if err != nil { + panic(err.Error()) } - }, - "required": true - } - }, - "get": { - "summary": "List Files", - "operationId": "list_files_v1_files_get", - "parameters": [ - { - "name": "before_id", - "in": "query", - "required": false, - "schema": { - "type": "string", - "description": "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object.", - "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." - }, - { - "name": "after_id", - "in": "query", - "required": false, - "schema": { - "type": "string", - "description": "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object.", - "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." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 1000, - "minimum": 1, - "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`.", - "default": 20, - "title": "Limit" - }, - "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`." - }, - { - "name": "anthropic-beta", - "in": "header", - "required": false, - "schema": { - "type": "string", - "items": { "type": "string" }, - "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.", - "title": "Anthropic-Beta", - "x-stainless-override-schema": { - "x-stainless-param": "betas", - "x-stainless-extend-default": true, - "type": "array", - "description": "Optional header to specify the beta version(s) you want to use.", - "items": { "$ref": "#/components/schemas/AnthropicBeta" } + fmt.Printf("%+v\n", page) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.messages.batches.BatchListPage; + import com.anthropic.models.messages.batches.BatchListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BatchListPage page = client.messages().batches().list(); } - }, - "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." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - }, - { - "name": "x-api-key", - "in": "header", - "required": false, - "schema": { - "type": "string", - "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.", - "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." } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/FileListResponse" } } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.messages.batches.BatchListPage + import com.anthropic.models.messages.batches.BatchListParams + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val page: BatchListPage = client.messages().batches().list() + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + page = anthropic.messages.batches.list + + puts(page) + /v1/messages/batches/{message_batch_id}: + get: + summary: Retrieve a Message Batch + description: >- + 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) + operationId: message_batches_retrieve + parameters: + - name: message_batch_id + in: path + required: true + schema: + type: string + description: ID of the Message Batch. + title: Message Batch Id + description: ID of the Message Batch. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/MessageBatch' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const messageBatch = await client.messages.batches.retrieve('message_batch_id'); + + console.log(messageBatch.id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + message_batch = client.messages.batches.retrieve( + "message_batch_id", + ) + print(message_batch.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + messageBatch, err := client.Messages.Batches.Get(context.TODO(), "message_batch_id") + if err != nil { + panic(err.Error()) } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } - } - } - } - }, - "/v1/files/{file_id}": { - "get": { - "summary": "Get File Metadata", - "operationId": "get_file_metadata_v1_files__file_id__get", - "parameters": [ - { - "name": "file_id", - "in": "path", - "required": true, - "schema": { "type": "string", "description": "ID of the File.", "title": "File Id" }, - "description": "ID of the File." - }, - { - "name": "anthropic-beta", - "in": "header", - "required": false, - "schema": { - "type": "string", - "items": { "type": "string" }, - "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.", - "title": "Anthropic-Beta", - "x-stainless-override-schema": { - "x-stainless-param": "betas", - "x-stainless-extend-default": true, - "type": "array", - "description": "Optional header to specify the beta version(s) you want to use.", - "items": { "$ref": "#/components/schemas/AnthropicBeta" } + fmt.Printf("%+v\n", messageBatch.ID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.messages.batches.BatchRetrieveParams; + import com.anthropic.models.messages.batches.MessageBatch; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + MessageBatch messageBatch = client.messages().batches().retrieve("message_batch_id"); } - }, - "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." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - }, - { - "name": "x-api-key", - "in": "header", - "required": false, - "schema": { - "type": "string", - "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.", - "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." } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/FileMetadataSchema" } } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.messages.batches.BatchRetrieveParams + import com.anthropic.models.messages.batches.MessageBatch + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val messageBatch: MessageBatch = client.messages().batches().retrieve("message_batch_id") + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + message_batch = anthropic.messages.batches.retrieve("message_batch_id") + + puts(message_batch) + delete: + summary: Delete a Message Batch + description: >- + 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) + operationId: message_batches_delete + parameters: + - name: message_batch_id + in: path + required: true + schema: + type: string + description: ID of the Message Batch. + title: Message Batch Id + description: ID of the Message Batch. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteMessageBatchResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const deletedMessageBatch = await client.messages.batches.delete('message_batch_id'); + + console.log(deletedMessageBatch.id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + deleted_message_batch = client.messages.batches.delete( + "message_batch_id", + ) + print(deleted_message_batch.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + deletedMessageBatch, err := client.Messages.Batches.Delete(context.TODO(), "message_batch_id") + if err != nil { + panic(err.Error()) } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } - } - } - }, - "delete": { - "summary": "Delete File", - "operationId": "delete_file_v1_files__file_id__delete", - "parameters": [ - { - "name": "file_id", - "in": "path", - "required": true, - "schema": { "type": "string", "description": "ID of the File.", "title": "File Id" }, - "description": "ID of the File." - }, - { - "name": "anthropic-beta", - "in": "header", - "required": false, - "schema": { - "type": "string", - "items": { "type": "string" }, - "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.", - "title": "Anthropic-Beta", - "x-stainless-override-schema": { - "x-stainless-param": "betas", - "x-stainless-extend-default": true, - "type": "array", - "description": "Optional header to specify the beta version(s) you want to use.", - "items": { "$ref": "#/components/schemas/AnthropicBeta" } + fmt.Printf("%+v\n", deletedMessageBatch.ID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.messages.batches.BatchDeleteParams; + import com.anthropic.models.messages.batches.DeletedMessageBatch; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + DeletedMessageBatch deletedMessageBatch = client.messages().batches().delete("message_batch_id"); } - }, - "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." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - }, - { - "name": "x-api-key", - "in": "header", - "required": false, - "schema": { - "type": "string", - "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.", - "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." } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/FileDeleteResponse" } } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.messages.batches.BatchDeleteParams + import com.anthropic.models.messages.batches.DeletedMessageBatch + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val deletedMessageBatch: DeletedMessageBatch = client.messages().batches().delete("message_batch_id") + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + deleted_message_batch = anthropic.messages.batches.delete("message_batch_id") + + puts(deleted_message_batch) + /v1/messages/batches/{message_batch_id}/cancel: + post: + summary: Cancel a Message Batch + description: >- + 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) + operationId: message_batches_cancel + parameters: + - name: message_batch_id + in: path + required: true + schema: + type: string + description: ID of the Message Batch. + title: Message Batch Id + description: ID of the Message Batch. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/MessageBatch' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const messageBatch = await client.messages.batches.cancel('message_batch_id'); + + console.log(messageBatch.id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + message_batch = client.messages.batches.cancel( + "message_batch_id", + ) + print(message_batch.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + messageBatch, err := client.Messages.Batches.Cancel(context.TODO(), "message_batch_id") + if err != nil { + panic(err.Error()) } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } - } - } - } - }, - "/v1/files/{file_id}/content": { - "get": { - "summary": "Download File", - "operationId": "download_file_v1_files__file_id__content_get", - "parameters": [ - { - "name": "file_id", - "in": "path", - "required": true, - "schema": { "type": "string", "description": "ID of the File.", "title": "File Id" }, - "description": "ID of the File." - }, - { - "name": "anthropic-beta", - "in": "header", - "required": false, - "schema": { - "type": "string", - "items": { "type": "string" }, - "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.", - "title": "Anthropic-Beta", - "x-stainless-override-schema": { - "x-stainless-param": "betas", - "x-stainless-extend-default": true, - "type": "array", - "description": "Optional header to specify the beta version(s) you want to use.", - "items": { "$ref": "#/components/schemas/AnthropicBeta" } + fmt.Printf("%+v\n", messageBatch.ID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.messages.batches.BatchCancelParams; + import com.anthropic.models.messages.batches.MessageBatch; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + MessageBatch messageBatch = client.messages().batches().cancel("message_batch_id"); } - }, - "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." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - }, - { - "name": "x-api-key", - "in": "header", - "required": false, - "schema": { - "type": "string", - "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.", - "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." } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { "application/octet-stream": { "schema": { "type": "string" } } } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { - "application/octet-stream": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.messages.batches.BatchCancelParams + import com.anthropic.models.messages.batches.MessageBatch + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val messageBatch: MessageBatch = client.messages().batches().cancel("message_batch_id") + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + message_batch = anthropic.messages.batches.cancel("message_batch_id") + + puts(message_batch) + /v1/messages/batches/{message_batch_id}/results: + get: + summary: Retrieve Message Batch results + description: >- + 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) + operationId: message_batches_results + parameters: + - name: message_batch_id + in: path + required: true + schema: + type: string + description: ID of the Message Batch. + title: Message Batch Id + description: ID of the Message Batch. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/x-jsonl: + schema: + $ref: '#/components/schemas/MessageBatchIndividualResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const messageBatchIndividualResponse = await client.messages.batches.results('message_batch_id'); + + console.log(messageBatchIndividualResponse.custom_id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + message_batch_individual_response = client.messages.batches.results( + "message_batch_id", + ) + print(message_batch_individual_response.custom_id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + stream := client.Messages.Batches.ResultsStreaming(context.TODO(), "message_batch_id") + if stream.Err() != nil { + panic(err.Error()) } - } - } - } - }, - "/v1/messages?beta=true": { - "post": { - "summary": "Create a Message", - "description": "Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.\n\nThe Messages API can be used for either single queries or stateless multi-turn conversations.\n\nLearn more about the Messages API in our [user guide](/en/docs/initial-setup)", - "operationId": "beta_messages_post", - "parameters": [ - { - "name": "anthropic-beta", - "in": "header", - "required": false, - "schema": { - "type": "string", - "items": { "type": "string" }, - "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.", - "title": "Anthropic-Beta", - "x-stainless-override-schema": { - "x-stainless-param": "betas", - "x-stainless-extend-default": true, - "type": "array", - "description": "Optional header to specify the beta version(s) you want to use.", - "items": { "$ref": "#/components/schemas/AnthropicBeta" } + fmt.Printf("%+v\n", messageBatchIndividualResponse.CustomID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.core.http.StreamResponse; + import com.anthropic.models.messages.batches.BatchResultsParams; + import com.anthropic.models.messages.batches.MessageBatchIndividualResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + StreamResponse messageBatchIndividualResponse = client.messages().batches().resultsStreaming("message_batch_id"); } - }, - "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." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." } - ], - "responses": { - "200": { - "description": "Message object.", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BetaMessage" } } } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaErrorResponse" } } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.core.http.StreamResponse + import com.anthropic.models.messages.batches.BatchResultsParams + import com.anthropic.models.messages.batches.MessageBatchIndividualResponse + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val messageBatchIndividualResponse: StreamResponse = client.messages().batches().resultsStreaming("message_batch_id") + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + message_batch_individual_response = anthropic.messages.batches.results("message_batch_id") + + puts(message_batch_individual_response) + /v1/messages/count_tokens: + post: + summary: Count tokens in a Message + description: >- + 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) + operationId: messages_count_tokens_post + parameters: + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/CountMessageTokensResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CountMessageTokensParams' + required: true + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const messageTokensCount = await client.messages.countTokens({ + messages: [{ content: 'string', role: 'user' }], + model: 'claude-opus-4-5-20251101', + }); + + console.log(messageTokensCount.input_tokens); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + message_tokens_count = client.messages.count_tokens( + messages=[{ + "content": "string", + "role": "user", + }], + model="claude-opus-4-5-20251101", + ) + print(message_tokens_count.input_tokens) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + messageTokensCount, err := client.Messages.CountTokens(context.TODO(), anthropic.MessageCountTokensParams{ + Messages: []anthropic.MessageParam{anthropic.MessageParam{ + Content: []anthropic.ContentBlockParamUnion{anthropic.ContentBlockParamUnion{ + OfText: &anthropic.TextBlockParam{ + Text: "What is a quaternion?", + }, + }}, + Role: anthropic.MessageParamRoleUser, + }}, + Model: anthropic.ModelClaudeOpus4_5_20251101, + }) + if err != nil { + panic(err.Error()) } - } - }, - "requestBody": { - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaCreateMessageParams" } } - }, - "required": true - } - } - }, - "/v1/models?beta=true": { - "get": { - "summary": "List Models", - "description": "List available models.\n\nThe Models API response can be used to determine which models are available for use in the API. More recently released models are listed first.", - "operationId": "beta_models_list", - "parameters": [ - { - "name": "before_id", - "in": "query", - "required": false, - "schema": { - "type": "string", - "description": "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object.", - "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." - }, - { - "name": "after_id", - "in": "query", - "required": false, - "schema": { - "type": "string", - "description": "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object.", - "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." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 1000, - "minimum": 1, - "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`.", - "default": 20, - "title": "Limit" - }, - "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - }, - { - "name": "x-api-key", - "in": "header", - "required": false, - "schema": { - "type": "string", - "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.", - "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." - }, - { - "name": "anthropic-beta", - "in": "header", - "required": false, - "schema": { - "type": "string", - "items": { "type": "string" }, - "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.", - "title": "Anthropic-Beta", - "x-stainless-override-schema": { - "x-stainless-param": "betas", - "x-stainless-extend-default": true, - "type": "array", - "description": "Optional header to specify the beta version(s) you want to use.", - "items": { "$ref": "#/components/schemas/AnthropicBeta" } + fmt.Printf("%+v\n", messageTokensCount.InputTokens) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.messages.MessageCountTokensParams; + import com.anthropic.models.messages.MessageTokensCount; + import com.anthropic.models.messages.Model; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + MessageCountTokensParams params = MessageCountTokensParams.builder() + .addUserMessage("Hello, world") + .model(Model.CLAUDE_SONNET_4_5_20250929) + .build(); + MessageTokensCount messageTokensCount = client.messages().countTokens(params); } - }, - "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." } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaListResponse_ModelInfo_" } } - } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaErrorResponse" } } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.messages.MessageCountTokensParams + import com.anthropic.models.messages.MessageTokensCount + import com.anthropic.models.messages.Model + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val params: MessageCountTokensParams = MessageCountTokensParams.builder() + .addUserMessage("Hello, world") + .model(Model.CLAUDE_SONNET_4_5_20250929) + .build() + val messageTokensCount: MessageTokensCount = client.messages().countTokens(params) + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + message_tokens_count = anthropic.messages.count_tokens( + messages: [{content: "string", role: :user}], + model: :"claude-opus-4-5-20251101" + ) + + puts(message_tokens_count) + /v1/files: + post: + summary: Upload File + operationId: upload_file_v1_files_post + parameters: + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/FileMetadataSchema' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary + description: The file to upload + required: + - file + required: true + get: + summary: List Files + operationId: list_files_v1_files_get + parameters: + - name: before_id + in: query + required: false + schema: + type: string + description: >- + ID of the object to use as a cursor for pagination. When provided, returns the page of results + immediately before this object. + 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. + - name: after_id + in: query + required: false + schema: + type: string + description: >- + ID of the object to use as a cursor for pagination. When provided, returns the page of results + immediately after this object. + 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. + - name: limit + in: query + required: false + schema: + type: integer + maximum: 1000 + minimum: 1 + description: |- + Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + default: 20 + title: Limit + description: |- + Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/FileListResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + /v1/files/{file_id}: + get: + summary: Get File Metadata + operationId: get_file_metadata_v1_files__file_id__get + parameters: + - name: file_id + in: path + required: true + schema: + type: string + description: ID of the File. + title: File Id + description: ID of the File. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/FileMetadataSchema' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + delete: + summary: Delete File + operationId: delete_file_v1_files__file_id__delete + parameters: + - name: file_id + in: path + required: true + schema: + type: string + description: ID of the File. + title: File Id + description: ID of the File. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/FileDeleteResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + /v1/files/{file_id}/content: + get: + summary: Download File + operationId: download_file_v1_files__file_id__content_get + parameters: + - name: file_id + in: path + required: true + schema: + type: string + description: ID of the File. + title: File Id + description: ID of the File. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/octet-stream: + schema: + type: string + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/octet-stream: + schema: + $ref: '#/components/schemas/ErrorResponse' + /v1/skills: + post: + summary: Create Skill + operationId: create_skill_v1_skills_post + parameters: + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/Body_create_skill_v1_skills_post' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/CreateSkillResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + get: + summary: List Skills + operationId: list_skills_v1_skills_get + parameters: + - name: page + in: query + required: false + schema: + anyOf: + - type: string + - type: 'null' + description: |- + Pagination token for fetching a specific page of results. + + Pass the value from a previous response's `next_page` field to get the next page of results. + title: Page + description: |- + Pagination token for fetching a specific page of results. + + Pass the value from a previous response's `next_page` field to get the next page of results. + - name: limit + in: query + required: false + schema: + type: integer + description: |- + Number of results to return per page. + + Maximum value is 100. Defaults to 20. + default: 20 + title: Limit + description: |- + Number of results to return per page. + + Maximum value is 100. Defaults to 20. + - name: source + in: query + required: false + schema: + anyOf: + - type: string + - type: 'null' + description: |- + Filter skills by source. + + If provided, only skills from the specified source will be returned: + * `"custom"`: only return user-created skills + * `"anthropic"`: only return Anthropic-created skills + title: Source + description: |- + Filter skills by source. + + If provided, only skills from the specified source will be returned: + * `"custom"`: only return user-created skills + * `"anthropic"`: only return Anthropic-created skills + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/ListSkillsResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + /v1/skills/{skill_id}: + get: + summary: Get Skill + operationId: get_skill_v1_skills__skill_id__get + parameters: + - name: skill_id + in: path + required: true + schema: + type: string + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + title: Skill Id + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/GetSkillResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + delete: + summary: Delete Skill + operationId: delete_skill_v1_skills__skill_id__delete + parameters: + - name: skill_id + in: path + required: true + schema: + type: string + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + title: Skill Id + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteSkillResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + /v1/skills/{skill_id}/versions: + post: + summary: Create Skill Version + operationId: create_skill_version_v1_skills__skill_id__versions_post + parameters: + - name: skill_id + in: path + required: true + schema: + type: string + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + title: Skill Id + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/Body_create_skill_version_v1_skills__skill_id__versions_post' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/CreateSkillVersionResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + get: + summary: List Skill Versions + operationId: list_skill_versions_v1_skills__skill_id__versions_get + parameters: + - name: skill_id + in: path + required: true + schema: + type: string + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + title: Skill Id + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + - name: page + in: query + required: false + schema: + anyOf: + - type: string + - type: 'null' + description: Optionally set to the `next_page` token from the previous response. + title: Page + description: Optionally set to the `next_page` token from the previous response. + - name: limit + in: query + required: false + schema: + anyOf: + - type: integer + - type: 'null' + description: |- + Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + title: Limit + description: |- + Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/ListSkillVersionsResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + /v1/skills/{skill_id}/versions/{version}: + get: + summary: Get Skill Version + operationId: get_skill_version_v1_skills__skill_id__versions__version__get + parameters: + - name: skill_id + in: path + required: true + schema: + type: string + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + title: Skill Id + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + - name: version + in: path + required: true + schema: + type: string + description: |- + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + title: Version + description: |- + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/GetSkillVersionResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + delete: + summary: Delete Skill Version + operationId: delete_skill_version_v1_skills__skill_id__versions__version__delete + parameters: + - name: skill_id + in: path + required: true + schema: + type: string + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + title: Skill Id + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + - name: version + in: path + required: true + schema: + type: string + description: |- + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + title: Version + description: |- + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteSkillVersionResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + /v1/messages?beta=true: + post: + summary: Create a Message + description: >- + 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) + operationId: beta_messages_post + parameters: + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + responses: + '200': + description: Message object. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaMessage' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BetaCreateMessageParams' + required: true + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const betaMessage = await client.beta.messages.create({ + max_tokens: 1024, + messages: [{ content: 'Hello, world', role: 'user' }], + model: 'claude-sonnet-4-5-20250929', + }); + + console.log(betaMessage.id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + beta_message = client.beta.messages.create( + max_tokens=1024, + messages=[{ + "content": "Hello, world", + "role": "user", + }], + model="claude-sonnet-4-5-20250929", + ) + print(beta_message.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaMessage, err := client.Beta.Messages.New(context.TODO(), anthropic.BetaMessageNewParams{ + MaxTokens: 1024, + Messages: []anthropic.BetaMessageParam{anthropic.BetaMessageParam{ + Content: []anthropic.BetaContentBlockParamUnion{anthropic.BetaContentBlockParamUnion{ + OfText: &anthropic.BetaTextBlockParam{ + Text: "x", + }, + }}, + Role: anthropic.BetaMessageParamRoleUser, + }}, + Model: anthropic.ModelClaudeSonnet4_5_20250929, + }) + if err != nil { + panic(err.Error()) } - } - } - } - }, - "/v1/models/{model_id}?beta=true": { - "get": { - "summary": "Get a Model", - "description": "Get a specific model.\n\nThe Models API response can be used to determine information about a specific model or resolve a model alias to a model ID.", - "operationId": "beta_models_get", - "parameters": [ - { - "name": "model_id", - "in": "path", - "required": true, - "schema": { "type": "string", "description": "Model identifier or alias.", "title": "Model Id" }, - "description": "Model identifier or alias." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - }, - { - "name": "x-api-key", - "in": "header", - "required": false, - "schema": { - "type": "string", - "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.", - "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." - }, - { - "name": "anthropic-beta", - "in": "header", - "required": false, - "schema": { - "type": "string", - "items": { "type": "string" }, - "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.", - "title": "Anthropic-Beta", - "x-stainless-override-schema": { - "x-stainless-param": "betas", - "x-stainless-extend-default": true, - "type": "array", - "description": "Optional header to specify the beta version(s) you want to use.", - "items": { "$ref": "#/components/schemas/AnthropicBeta" } + fmt.Printf("%+v\n", betaMessage.ID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.beta.messages.BetaMessage; + import com.anthropic.models.beta.messages.MessageCreateParams; + import com.anthropic.models.messages.Model; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + MessageCreateParams params = MessageCreateParams.builder() + .maxTokens(1024L) + .addUserMessage("Hello, world") + .model(Model.CLAUDE_SONNET_4_5_20250929) + .build(); + BetaMessage betaMessage = client.beta().messages().create(params); } - }, - "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." } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BetaModelInfo" } } } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaErrorResponse" } } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.beta.messages.BetaMessage + import com.anthropic.models.beta.messages.MessageCreateParams + import com.anthropic.models.messages.Model + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val params: MessageCreateParams = MessageCreateParams.builder() + .maxTokens(1024L) + .addUserMessage("Hello, world") + .model(Model.CLAUDE_SONNET_4_5_20250929) + .build() + val betaMessage: BetaMessage = client.beta().messages().create(params) + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + beta_message = anthropic.beta.messages.create( + max_tokens: 1024, + messages: [{content: "Hello, world", role: :user}], + model: :"claude-sonnet-4-5-20250929" + ) + + puts(beta_message) + /v1/models?beta=true: + get: + summary: List Models + description: >- + 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. + operationId: beta_models_list + parameters: + - name: before_id + in: query + required: false + schema: + type: string + description: >- + ID of the object to use as a cursor for pagination. When provided, returns the page of results + immediately before this object. + 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. + - name: after_id + in: query + required: false + schema: + type: string + description: >- + ID of the object to use as a cursor for pagination. When provided, returns the page of results + immediately after this object. + 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. + - name: limit + in: query + required: false + schema: + type: integer + maximum: 1000 + minimum: 1 + description: |- + Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + default: 20 + title: Limit + description: |- + Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaListResponse_ModelInfo_' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const betaModelInfo of client.beta.models.list()) { + console.log(betaModelInfo.id); + } + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.models.list() + page = page.data[0] + print(page.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Models.List(context.TODO(), anthropic.BetaModelListParams{ + + }) + if err != nil { + panic(err.Error()) } - } - } - } - }, - "/v1/messages/batches?beta=true": { - "post": { - "summary": "Create a Message Batch", - "description": "Send a batch of Message creation requests.\n\nThe 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.\n\nLearn more about the Message Batches API in our [user guide](/en/docs/build-with-claude/batch-processing)", - "operationId": "beta_message_batches_post", - "parameters": [ - { - "name": "anthropic-beta", - "in": "header", - "required": false, - "schema": { - "type": "string", - "items": { "type": "string" }, - "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.", - "title": "Anthropic-Beta", - "x-stainless-override-schema": { - "x-stainless-param": "betas", - "x-stainless-extend-default": true, - "type": "array", - "description": "Optional header to specify the beta version(s) you want to use.", - "items": { "$ref": "#/components/schemas/AnthropicBeta" } + fmt.Printf("%+v\n", page) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.beta.models.ModelListPage; + import com.anthropic.models.beta.models.ModelListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + ModelListPage page = client.beta().models().list(); } - }, - "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." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaMessageBatch" } } - } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaErrorResponse" } } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.beta.models.ModelListPage + import com.anthropic.models.beta.models.ModelListParams + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val page: ModelListPage = client.beta().models().list() + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + page = anthropic.beta.models.list + + puts(page) + /v1/models/{model_id}?beta=true: + get: + summary: Get a Model + description: >- + 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. + operationId: beta_models_get + parameters: + - name: model_id + in: path + required: true + schema: + type: string + description: Model identifier or alias. + title: Model Id + description: Model identifier or alias. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaModelInfo' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const betaModelInfo = await client.beta.models.retrieve('model_id'); + + console.log(betaModelInfo.id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + beta_model_info = client.beta.models.retrieve( + model_id="model_id", + ) + print(beta_model_info.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaModelInfo, err := client.Beta.Models.Get( + context.TODO(), + "model_id", + anthropic.BetaModelGetParams{ + + }, + ) + if err != nil { + panic(err.Error()) } + fmt.Printf("%+v\n", betaModelInfo.ID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.beta.models.BetaModelInfo; + import com.anthropic.models.beta.models.ModelRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaModelInfo betaModelInfo = client.beta().models().retrieve("model_id"); + } } - }, - "requestBody": { - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaCreateMessageBatchParams" } } - }, - "required": true - } - }, - "get": { - "summary": "List Message Batches", - "description": "List all Message Batches within a Workspace. Most recently created batches are returned first.\n\nLearn more about the Message Batches API in our [user guide](/en/docs/build-with-claude/batch-processing)", - "operationId": "beta_message_batches_list", - "parameters": [ - { - "name": "before_id", - "in": "query", - "required": false, - "schema": { - "type": "string", - "description": "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object.", - "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." - }, - { - "name": "after_id", - "in": "query", - "required": false, - "schema": { - "type": "string", - "description": "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object.", - "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." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 1000, - "minimum": 1, - "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`.", - "default": 20, - "title": "Limit" - }, - "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`." - }, - { - "name": "anthropic-beta", - "in": "header", - "required": false, - "schema": { - "type": "string", - "items": { "type": "string" }, - "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.", - "title": "Anthropic-Beta", - "x-stainless-override-schema": { - "x-stainless-param": "betas", - "x-stainless-extend-default": true, - "type": "array", - "description": "Optional header to specify the beta version(s) you want to use.", - "items": { "$ref": "#/components/schemas/AnthropicBeta" } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.beta.models.BetaModelInfo + import com.anthropic.models.beta.models.ModelRetrieveParams + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val betaModelInfo: BetaModelInfo = client.beta().models().retrieve("model_id") + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + beta_model_info = anthropic.beta.models.retrieve("model_id") + + puts(beta_model_info) + /v1/messages/batches?beta=true: + post: + summary: Create a Message Batch + description: >- + 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) + operationId: beta_message_batches_post + parameters: + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaMessageBatch' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BetaCreateMessageBatchParams' + required: true + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const betaMessageBatch = await client.beta.messages.batches.create({ + requests: [ + { + custom_id: 'my-custom-id-1', + params: { + max_tokens: 1024, + messages: [{ content: 'Hello, world', role: 'user' }], + model: 'claude-sonnet-4-5-20250929', + }, + }, + ], + }); + + console.log(betaMessageBatch.id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + beta_message_batch = client.beta.messages.batches.create( + requests=[{ + "custom_id": "my-custom-id-1", + "params": { + "max_tokens": 1024, + "messages": [{ + "content": "Hello, world", + "role": "user", + }], + "model": "claude-sonnet-4-5-20250929", + }, + }], + ) + print(beta_message_batch.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaMessageBatch, err := client.Beta.Messages.Batches.New(context.TODO(), anthropic.BetaMessageBatchNewParams{ + Requests: []anthropic.BetaMessageBatchNewParamsRequest{anthropic.BetaMessageBatchNewParamsRequest{ + CustomID: "my-custom-id-1", + Params: anthropic.BetaMessageBatchNewParamsRequestParams{ + MaxTokens: 1024, + Messages: []anthropic.BetaMessageParam{anthropic.BetaMessageParam{ + Content: []anthropic.BetaContentBlockParamUnion{anthropic.BetaContentBlockParamUnion{ + OfText: &anthropic.BetaTextBlockParam{ + Text: "x", + }, + }}, + Role: anthropic.BetaMessageParamRoleUser, + }}, + Model: anthropic.ModelClaudeSonnet4_5_20250929, + }, + }}, + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", betaMessageBatch.ID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.beta.messages.batches.BatchCreateParams; + import com.anthropic.models.beta.messages.batches.BetaMessageBatch; + import com.anthropic.models.messages.Model; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BatchCreateParams params = BatchCreateParams.builder() + .addRequest(BatchCreateParams.Request.builder() + .customId("my-custom-id-1") + .params(BatchCreateParams.Request.Params.builder() + .maxTokens(1024L) + .addUserMessage("Hello, world") + .model(Model.CLAUDE_SONNET_4_5_20250929) + .build()) + .build()) + .build(); + BetaMessageBatch betaMessageBatch = client.beta().messages().batches().create(params); } - }, - "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." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - }, - { - "name": "x-api-key", - "in": "header", - "required": false, - "schema": { - "type": "string", - "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.", - "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." } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/BetaListResponse_MessageBatch_" } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.beta.messages.batches.BatchCreateParams + import com.anthropic.models.beta.messages.batches.BetaMessageBatch + import com.anthropic.models.messages.Model + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val params: BatchCreateParams = BatchCreateParams.builder() + .addRequest(BatchCreateParams.Request.builder() + .customId("my-custom-id-1") + .params(BatchCreateParams.Request.Params.builder() + .maxTokens(1024L) + .addUserMessage("Hello, world") + .model(Model.CLAUDE_SONNET_4_5_20250929) + .build()) + .build()) + .build() + val betaMessageBatch: BetaMessageBatch = client.beta().messages().batches().create(params) + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + beta_message_batch = anthropic.beta.messages.batches.create( + requests: [ + { + custom_id: "my-custom-id-1", + params: {max_tokens: 1024, messages: [{content: "Hello, world", role: :user}], model: :"claude-sonnet-4-5-20250929"} } + ] + ) + + puts(beta_message_batch) + get: + summary: List Message Batches + description: >- + 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) + operationId: beta_message_batches_list + parameters: + - name: before_id + in: query + required: false + schema: + type: string + description: >- + ID of the object to use as a cursor for pagination. When provided, returns the page of results + immediately before this object. + 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. + - name: after_id + in: query + required: false + schema: + type: string + description: >- + ID of the object to use as a cursor for pagination. When provided, returns the page of results + immediately after this object. + 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. + - name: limit + in: query + required: false + schema: + type: integer + maximum: 1000 + minimum: 1 + description: |- + Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + default: 20 + title: Limit + description: |- + Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaListResponse_MessageBatch_' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const betaMessageBatch of client.beta.messages.batches.list()) { + console.log(betaMessageBatch.id); + } + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.messages.batches.list() + page = page.data[0] + print(page.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Messages.Batches.List(context.TODO(), anthropic.BetaMessageBatchListParams{ + + }) + if err != nil { + panic(err.Error()) } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaErrorResponse" } } - } - } - } - } - }, - "/v1/messages/batches/{message_batch_id}?beta=true": { - "get": { - "summary": "Retrieve a Message Batch", - "description": "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.\n\nLearn more about the Message Batches API in our [user guide](/en/docs/build-with-claude/batch-processing)", - "operationId": "beta_message_batches_retrieve", - "parameters": [ - { - "name": "message_batch_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "description": "ID of the Message Batch.", - "title": "Message Batch Id" - }, - "description": "ID of the Message Batch." - }, - { - "name": "anthropic-beta", - "in": "header", - "required": false, - "schema": { - "type": "string", - "items": { "type": "string" }, - "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.", - "title": "Anthropic-Beta", - "x-stainless-override-schema": { - "x-stainless-param": "betas", - "x-stainless-extend-default": true, - "type": "array", - "description": "Optional header to specify the beta version(s) you want to use.", - "items": { "$ref": "#/components/schemas/AnthropicBeta" } + fmt.Printf("%+v\n", page) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.beta.messages.batches.BatchListPage; + import com.anthropic.models.beta.messages.batches.BatchListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BatchListPage page = client.beta().messages().batches().list(); } - }, - "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." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - }, - { - "name": "x-api-key", - "in": "header", - "required": false, - "schema": { - "type": "string", - "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.", - "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." } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaMessageBatch" } } - } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaErrorResponse" } } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.beta.messages.batches.BatchListPage + import com.anthropic.models.beta.messages.batches.BatchListParams + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val page: BatchListPage = client.beta().messages().batches().list() + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + page = anthropic.beta.messages.batches.list + + puts(page) + /v1/messages/batches/{message_batch_id}?beta=true: + get: + summary: Retrieve a Message Batch + description: >- + 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) + operationId: beta_message_batches_retrieve + parameters: + - name: message_batch_id + in: path + required: true + schema: + type: string + description: ID of the Message Batch. + title: Message Batch Id + description: ID of the Message Batch. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaMessageBatch' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const betaMessageBatch = await client.beta.messages.batches.retrieve('message_batch_id'); + + console.log(betaMessageBatch.id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + beta_message_batch = client.beta.messages.batches.retrieve( + message_batch_id="message_batch_id", + ) + print(beta_message_batch.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaMessageBatch, err := client.Beta.Messages.Batches.Get( + context.TODO(), + "message_batch_id", + anthropic.BetaMessageBatchGetParams{ + + }, + ) + if err != nil { + panic(err.Error()) } - } - } - }, - "delete": { - "summary": "Delete a Message Batch", - "description": "Delete a Message Batch.\n\nMessage 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.\n\nLearn more about the Message Batches API in our [user guide](/en/docs/build-with-claude/batch-processing)", - "operationId": "beta_message_batches_delete", - "parameters": [ - { - "name": "message_batch_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "description": "ID of the Message Batch.", - "title": "Message Batch Id" - }, - "description": "ID of the Message Batch." - }, - { - "name": "anthropic-beta", - "in": "header", - "required": false, - "schema": { - "type": "string", - "items": { "type": "string" }, - "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.", - "title": "Anthropic-Beta", - "x-stainless-override-schema": { - "x-stainless-param": "betas", - "x-stainless-extend-default": true, - "type": "array", - "description": "Optional header to specify the beta version(s) you want to use.", - "items": { "$ref": "#/components/schemas/AnthropicBeta" } + fmt.Printf("%+v\n", betaMessageBatch.ID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.beta.messages.batches.BatchRetrieveParams; + import com.anthropic.models.beta.messages.batches.BetaMessageBatch; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaMessageBatch betaMessageBatch = client.beta().messages().batches().retrieve("message_batch_id"); } - }, - "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." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - }, - { - "name": "x-api-key", - "in": "header", - "required": false, - "schema": { - "type": "string", - "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.", - "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." } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/BetaDeleteMessageBatchResponse" } - } - } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaErrorResponse" } } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.beta.messages.batches.BatchRetrieveParams + import com.anthropic.models.beta.messages.batches.BetaMessageBatch + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val betaMessageBatch: BetaMessageBatch = client.beta().messages().batches().retrieve("message_batch_id") + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + beta_message_batch = anthropic.beta.messages.batches.retrieve("message_batch_id") + + puts(beta_message_batch) + delete: + summary: Delete a Message Batch + description: >- + 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) + operationId: beta_message_batches_delete + parameters: + - name: message_batch_id + in: path + required: true + schema: + type: string + description: ID of the Message Batch. + title: Message Batch Id + description: ID of the Message Batch. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaDeleteMessageBatchResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const betaDeletedMessageBatch = await client.beta.messages.batches.delete('message_batch_id'); + + console.log(betaDeletedMessageBatch.id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + beta_deleted_message_batch = client.beta.messages.batches.delete( + message_batch_id="message_batch_id", + ) + print(beta_deleted_message_batch.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaDeletedMessageBatch, err := client.Beta.Messages.Batches.Delete( + context.TODO(), + "message_batch_id", + anthropic.BetaMessageBatchDeleteParams{ + + }, + ) + if err != nil { + panic(err.Error()) } - } - } - } - }, - "/v1/messages/batches/{message_batch_id}/cancel?beta=true": { - "post": { - "summary": "Cancel a Message Batch", - "description": "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.\n\nThe 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.\n\nLearn more about the Message Batches API in our [user guide](/en/docs/build-with-claude/batch-processing)", - "operationId": "beta_message_batches_cancel", - "parameters": [ - { - "name": "message_batch_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "description": "ID of the Message Batch.", - "title": "Message Batch Id" - }, - "description": "ID of the Message Batch." - }, - { - "name": "anthropic-beta", - "in": "header", - "required": false, - "schema": { - "type": "string", - "items": { "type": "string" }, - "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.", - "title": "Anthropic-Beta", - "x-stainless-override-schema": { - "x-stainless-param": "betas", - "x-stainless-extend-default": true, - "type": "array", - "description": "Optional header to specify the beta version(s) you want to use.", - "items": { "$ref": "#/components/schemas/AnthropicBeta" } + fmt.Printf("%+v\n", betaDeletedMessageBatch.ID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.beta.messages.batches.BatchDeleteParams; + import com.anthropic.models.beta.messages.batches.BetaDeletedMessageBatch; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaDeletedMessageBatch betaDeletedMessageBatch = client.beta().messages().batches().delete("message_batch_id"); } - }, - "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." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaMessageBatch" } } - } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaErrorResponse" } } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.beta.messages.batches.BatchDeleteParams + import com.anthropic.models.beta.messages.batches.BetaDeletedMessageBatch + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val betaDeletedMessageBatch: BetaDeletedMessageBatch = client.beta().messages().batches().delete("message_batch_id") + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + beta_deleted_message_batch = anthropic.beta.messages.batches.delete("message_batch_id") + + puts(beta_deleted_message_batch) + /v1/messages/batches/{message_batch_id}/cancel?beta=true: + post: + summary: Cancel a Message Batch + description: >- + 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) + operationId: beta_message_batches_cancel + parameters: + - name: message_batch_id + in: path + required: true + schema: + type: string + description: ID of the Message Batch. + title: Message Batch Id + description: ID of the Message Batch. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaMessageBatch' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const betaMessageBatch = await client.beta.messages.batches.cancel('message_batch_id'); + + console.log(betaMessageBatch.id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + beta_message_batch = client.beta.messages.batches.cancel( + message_batch_id="message_batch_id", + ) + print(beta_message_batch.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaMessageBatch, err := client.Beta.Messages.Batches.Cancel( + context.TODO(), + "message_batch_id", + anthropic.BetaMessageBatchCancelParams{ + + }, + ) + if err != nil { + panic(err.Error()) } - } - } - } - }, - "/v1/messages/batches/{message_batch_id}/results?beta=true": { - "get": { - "summary": "Retrieve Message Batch results", - "description": "Streams the results of a Message Batch as a `.jsonl` file.\n\nEach 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.\n\nLearn more about the Message Batches API in our [user guide](/en/docs/build-with-claude/batch-processing)", - "operationId": "beta_message_batches_results", - "parameters": [ - { - "name": "message_batch_id", - "in": "path", - "required": true, - "schema": { - "type": "string", - "description": "ID of the Message Batch.", - "title": "Message Batch Id" - }, - "description": "ID of the Message Batch." - }, - { - "name": "anthropic-beta", - "in": "header", - "required": false, - "schema": { - "type": "string", - "items": { "type": "string" }, - "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.", - "title": "Anthropic-Beta", - "x-stainless-override-schema": { - "x-stainless-param": "betas", - "x-stainless-extend-default": true, - "type": "array", - "description": "Optional header to specify the beta version(s) you want to use.", - "items": { "$ref": "#/components/schemas/AnthropicBeta" } + fmt.Printf("%+v\n", betaMessageBatch.ID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.beta.messages.batches.BatchCancelParams; + import com.anthropic.models.beta.messages.batches.BetaMessageBatch; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + BetaMessageBatch betaMessageBatch = client.beta().messages().batches().cancel("message_batch_id"); } - }, - "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." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - }, - { - "name": "x-api-key", - "in": "header", - "required": false, - "schema": { - "type": "string", - "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.", - "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." } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/x-jsonl": { - "schema": { "$ref": "#/components/schemas/BetaMessageBatchIndividualResponse" } - } - } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaErrorResponse" } } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.beta.messages.batches.BatchCancelParams + import com.anthropic.models.beta.messages.batches.BetaMessageBatch + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val betaMessageBatch: BetaMessageBatch = client.beta().messages().batches().cancel("message_batch_id") + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + beta_message_batch = anthropic.beta.messages.batches.cancel("message_batch_id") + + puts(beta_message_batch) + /v1/messages/batches/{message_batch_id}/results?beta=true: + get: + summary: Retrieve Message Batch results + description: >- + 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) + operationId: beta_message_batches_results + parameters: + - name: message_batch_id + in: path + required: true + schema: + type: string + description: ID of the Message Batch. + title: Message Batch Id + description: ID of the Message Batch. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/x-jsonl: + schema: + $ref: '#/components/schemas/BetaMessageBatchIndividualResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const betaMessageBatchIndividualResponse = await client.beta.messages.batches.results( + 'message_batch_id', + ); + + console.log(betaMessageBatchIndividualResponse.custom_id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + beta_message_batch_individual_response = client.beta.messages.batches.results( + message_batch_id="message_batch_id", + ) + print(beta_message_batch_individual_response.custom_id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + stream := client.Beta.Messages.Batches.ResultsStreaming( + context.TODO(), + "message_batch_id", + anthropic.BetaMessageBatchResultsParams{ + + }, + ) + if stream.Err() != nil { + panic(err.Error()) } - } - } - } - }, - "/v1/messages/count_tokens?beta=true": { - "post": { - "summary": "Count tokens in a Message", - "description": "Count the number of tokens in a Message.\n\nThe Token Count API can be used to count the number of tokens in a Message, including tools, images, and documents, without creating it.\n\nLearn more about token counting in our [user guide](/en/docs/build-with-claude/token-counting)", - "operationId": "beta_messages_count_tokens_post", - "parameters": [ - { - "name": "anthropic-beta", - "in": "header", - "required": false, - "schema": { - "type": "string", - "items": { "type": "string" }, - "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.", - "title": "Anthropic-Beta", - "x-stainless-override-schema": { - "x-stainless-param": "betas", - "x-stainless-extend-default": true, - "type": "array", - "description": "Optional header to specify the beta version(s) you want to use.", - "items": { "$ref": "#/components/schemas/AnthropicBeta" } + fmt.Printf("%+v\n", betaMessageBatchIndividualResponse.CustomID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.core.http.StreamResponse; + import com.anthropic.models.beta.messages.batches.BatchResultsParams; + import com.anthropic.models.beta.messages.batches.BetaMessageBatchIndividualResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + StreamResponse betaMessageBatchIndividualResponse = client.beta().messages().batches().resultsStreaming("message_batch_id"); } - }, - "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." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { - "schema": { "$ref": "#/components/schemas/BetaCountMessageTokensResponse" } - } - } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaErrorResponse" } } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.core.http.StreamResponse + import com.anthropic.models.beta.messages.batches.BatchResultsParams + import com.anthropic.models.beta.messages.batches.BetaMessageBatchIndividualResponse + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val betaMessageBatchIndividualResponse: StreamResponse = client.beta().messages().batches().resultsStreaming("message_batch_id") + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + beta_message_batch_individual_response = anthropic.beta.messages.batches.results("message_batch_id") + + puts(beta_message_batch_individual_response) + /v1/messages/count_tokens?beta=true: + post: + summary: Count tokens in a Message + description: >- + 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) + operationId: beta_messages_count_tokens_post + parameters: + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaCountMessageTokensResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BetaCountMessageTokensParams' + required: true + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const betaMessageTokensCount = await client.beta.messages.countTokens({ + messages: [{ content: 'string', role: 'user' }], + model: 'claude-opus-4-5-20251101', + }); + + console.log(betaMessageTokensCount.context_management); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + beta_message_tokens_count = client.beta.messages.count_tokens( + messages=[{ + "content": "string", + "role": "user", + }], + model="claude-opus-4-5-20251101", + ) + print(beta_message_tokens_count.context_management) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + betaMessageTokensCount, err := client.Beta.Messages.CountTokens(context.TODO(), anthropic.BetaMessageCountTokensParams{ + Messages: []anthropic.BetaMessageParam{anthropic.BetaMessageParam{ + Content: []anthropic.BetaContentBlockParamUnion{anthropic.BetaContentBlockParamUnion{ + OfText: &anthropic.BetaTextBlockParam{ + Text: "What is a quaternion?", + }, + }}, + Role: anthropic.BetaMessageParamRoleUser, + }}, + Model: anthropic.ModelClaudeOpus4_5_20251101, + }) + if err != nil { + panic(err.Error()) } - } - }, - "requestBody": { - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaCountMessageTokensParams" } } - }, - "required": true - } - } - }, - "/v1/files?beta=true": { - "post": { - "summary": "Upload File", - "operationId": "beta_upload_file_v1_files_post", - "parameters": [ - { - "name": "anthropic-beta", - "in": "header", - "required": false, - "schema": { - "type": "string", - "items": { "type": "string" }, - "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.", - "title": "Anthropic-Beta", - "x-stainless-override-schema": { - "x-stainless-param": "betas", - "x-stainless-extend-default": true, - "type": "array", - "description": "Optional header to specify the beta version(s) you want to use.", - "items": { "$ref": "#/components/schemas/AnthropicBeta" } + fmt.Printf("%+v\n", betaMessageTokensCount.ContextManagement) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.beta.messages.BetaMessageTokensCount; + import com.anthropic.models.beta.messages.MessageCountTokensParams; + import com.anthropic.models.messages.Model; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + MessageCountTokensParams params = MessageCountTokensParams.builder() + .addUserMessage("Hello, world") + .model(Model.CLAUDE_SONNET_4_5_20250929) + .build(); + BetaMessageTokensCount betaMessageTokensCount = client.beta().messages().countTokens(params); } - }, - "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." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaFileMetadataSchema" } } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.beta.messages.BetaMessageTokensCount + import com.anthropic.models.beta.messages.MessageCountTokensParams + import com.anthropic.models.messages.Model + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val params: MessageCountTokensParams = MessageCountTokensParams.builder() + .addUserMessage("Hello, world") + .model(Model.CLAUDE_SONNET_4_5_20250929) + .build() + val betaMessageTokensCount: BetaMessageTokensCount = client.beta().messages().countTokens(params) + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + beta_message_tokens_count = anthropic.beta.messages.count_tokens( + messages: [{content: "string", role: :user}], + model: :"claude-opus-4-5-20251101" + ) + + puts(beta_message_tokens_count) + /v1/files?beta=true: + post: + summary: Upload File + operationId: beta_upload_file_v1_files_post + parameters: + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaFileMetadataSchema' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary + description: The file to upload + required: + - file + required: true + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const fileMetadata = await client.beta.files.upload({ file: fs.createReadStream('path/to/file') }); + + console.log(fileMetadata.id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + file_metadata = client.beta.files.upload( + file=b"raw file contents", + ) + print(file_metadata.id) + go: | + package main + + import ( + "bytes" + "context" + "fmt" + "io" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + fileMetadata, err := client.Beta.Files.Upload(context.TODO(), anthropic.BetaFileUploadParams{ + File: io.Reader(bytes.NewBuffer([]byte("some file contents"))), + }) + if err != nil { + panic(err.Error()) } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaErrorResponse" } } - } - } - }, - "requestBody": { - "content": { - "multipart/form-data": { - "schema": { - "type": "object", - "properties": { - "file": { "type": "string", "format": "binary", "description": "The file to upload" } - }, - "required": ["file"] + fmt.Printf("%+v\n", fileMetadata.ID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.beta.files.FileMetadata; + import com.anthropic.models.beta.files.FileUploadParams; + import java.io.ByteArrayInputStream; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + FileUploadParams params = FileUploadParams.builder() + .file(ByteArrayInputStream("some content".getBytes())) + .build(); + FileMetadata fileMetadata = client.beta().files().upload(params); } + } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.beta.files.FileMetadata + import com.anthropic.models.beta.files.FileUploadParams + import java.io.ByteArrayInputStream + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val params: FileUploadParams = FileUploadParams.builder() + .file("some content".byteInputStream()) + .build() + val fileMetadata: FileMetadata = client.beta().files().upload(params) + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + file_metadata = anthropic.beta.files.upload(file: Pathname(__FILE__)) + + puts(file_metadata) + get: + summary: List Files + operationId: beta_list_files_v1_files_get + parameters: + - name: before_id + in: query + required: false + schema: + type: string + description: >- + ID of the object to use as a cursor for pagination. When provided, returns the page of results + immediately before this object. + 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. + - name: after_id + in: query + required: false + schema: + type: string + description: >- + ID of the object to use as a cursor for pagination. When provided, returns the page of results + immediately after this object. + 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. + - name: limit + in: query + required: false + schema: + type: integer + maximum: 1000 + minimum: 1 + description: |- + Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + default: 20 + title: Limit + description: |- + Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaFileListResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const fileMetadata of client.beta.files.list()) { + console.log(fileMetadata.id); + } + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.files.list() + page = page.data[0] + print(page.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Files.List(context.TODO(), anthropic.BetaFileListParams{ + + }) + if err != nil { + panic(err.Error()) } - }, - "required": true - } - }, - "get": { - "summary": "List Files", - "operationId": "beta_list_files_v1_files_get", - "parameters": [ - { - "name": "before_id", - "in": "query", - "required": false, - "schema": { - "type": "string", - "description": "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object.", - "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." - }, - { - "name": "after_id", - "in": "query", - "required": false, - "schema": { - "type": "string", - "description": "ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object.", - "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." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "maximum": 1000, - "minimum": 1, - "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`.", - "default": 20, - "title": "Limit" - }, - "description": "Number of items to return per page.\n\nDefaults to `20`. Ranges from `1` to `1000`." - }, - { - "name": "anthropic-beta", - "in": "header", - "required": false, - "schema": { - "type": "string", - "items": { "type": "string" }, - "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.", - "title": "Anthropic-Beta", - "x-stainless-override-schema": { - "x-stainless-param": "betas", - "x-stainless-extend-default": true, - "type": "array", - "description": "Optional header to specify the beta version(s) you want to use.", - "items": { "$ref": "#/components/schemas/AnthropicBeta" } + fmt.Printf("%+v\n", page) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.beta.files.FileListPage; + import com.anthropic.models.beta.files.FileListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + FileListPage page = client.beta().files().list(); } - }, - "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." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - }, - { - "name": "x-api-key", - "in": "header", - "required": false, - "schema": { - "type": "string", - "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.", - "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." } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaFileListResponse" } } - } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaErrorResponse" } } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.beta.files.FileListPage + import com.anthropic.models.beta.files.FileListParams + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val page: FileListPage = client.beta().files().list() + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + page = anthropic.beta.files.list + + puts(page) + /v1/files/{file_id}?beta=true: + get: + summary: Get File Metadata + operationId: beta_get_file_metadata_v1_files__file_id__get + parameters: + - name: file_id + in: path + required: true + schema: + type: string + description: ID of the File. + title: File Id + description: ID of the File. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaFileMetadataSchema' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const fileMetadata = await client.beta.files.retrieveMetadata('file_id'); + + console.log(fileMetadata.id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + file_metadata = client.beta.files.retrieve_metadata( + file_id="file_id", + ) + print(file_metadata.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + fileMetadata, err := client.Beta.Files.GetMetadata( + context.TODO(), + "file_id", + anthropic.BetaFileGetMetadataParams{ + + }, + ) + if err != nil { + panic(err.Error()) } - } - } - } - }, - "/v1/files/{file_id}?beta=true": { - "get": { - "summary": "Get File Metadata", - "operationId": "beta_get_file_metadata_v1_files__file_id__get", - "parameters": [ - { - "name": "file_id", - "in": "path", - "required": true, - "schema": { "type": "string", "description": "ID of the File.", "title": "File Id" }, - "description": "ID of the File." - }, - { - "name": "anthropic-beta", - "in": "header", - "required": false, - "schema": { - "type": "string", - "items": { "type": "string" }, - "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.", - "title": "Anthropic-Beta", - "x-stainless-override-schema": { - "x-stainless-param": "betas", - "x-stainless-extend-default": true, - "type": "array", - "description": "Optional header to specify the beta version(s) you want to use.", - "items": { "$ref": "#/components/schemas/AnthropicBeta" } + fmt.Printf("%+v\n", fileMetadata.ID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.beta.files.FileMetadata; + import com.anthropic.models.beta.files.FileRetrieveMetadataParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + FileMetadata fileMetadata = client.beta().files().retrieveMetadata("file_id"); } - }, - "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." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - }, - { - "name": "x-api-key", - "in": "header", - "required": false, - "schema": { - "type": "string", - "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.", - "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." } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaFileMetadataSchema" } } - } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaErrorResponse" } } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.beta.files.FileMetadata + import com.anthropic.models.beta.files.FileRetrieveMetadataParams + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val fileMetadata: FileMetadata = client.beta().files().retrieveMetadata("file_id") + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + file_metadata = anthropic.beta.files.retrieve_metadata("file_id") + + puts(file_metadata) + delete: + summary: Delete File + operationId: beta_delete_file_v1_files__file_id__delete + parameters: + - name: file_id + in: path + required: true + schema: + type: string + description: ID of the File. + title: File Id + description: ID of the File. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaFileDeleteResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const deletedFile = await client.beta.files.delete('file_id'); + + console.log(deletedFile.id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + deleted_file = client.beta.files.delete( + file_id="file_id", + ) + print(deleted_file.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + deletedFile, err := client.Beta.Files.Delete( + context.TODO(), + "file_id", + anthropic.BetaFileDeleteParams{ + + }, + ) + if err != nil { + panic(err.Error()) } - } - } - }, - "delete": { - "summary": "Delete File", - "operationId": "beta_delete_file_v1_files__file_id__delete", - "parameters": [ - { - "name": "file_id", - "in": "path", - "required": true, - "schema": { "type": "string", "description": "ID of the File.", "title": "File Id" }, - "description": "ID of the File." - }, - { - "name": "anthropic-beta", - "in": "header", - "required": false, - "schema": { - "type": "string", - "items": { "type": "string" }, - "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.", - "title": "Anthropic-Beta", - "x-stainless-override-schema": { - "x-stainless-param": "betas", - "x-stainless-extend-default": true, - "type": "array", - "description": "Optional header to specify the beta version(s) you want to use.", - "items": { "$ref": "#/components/schemas/AnthropicBeta" } + fmt.Printf("%+v\n", deletedFile.ID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.beta.files.DeletedFile; + import com.anthropic.models.beta.files.FileDeleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + DeletedFile deletedFile = client.beta().files().delete("file_id"); } - }, - "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." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - }, - { - "name": "x-api-key", - "in": "header", - "required": false, - "schema": { - "type": "string", - "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.", - "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." } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaFileDeleteResponse" } } - } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { - "application/json": { "schema": { "$ref": "#/components/schemas/BetaErrorResponse" } } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.beta.files.DeletedFile + import com.anthropic.models.beta.files.FileDeleteParams + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val deletedFile: DeletedFile = client.beta().files().delete("file_id") + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + deleted_file = anthropic.beta.files.delete("file_id") + + puts(deleted_file) + /v1/files/{file_id}/content?beta=true: + get: + summary: Download File + operationId: beta_download_file_v1_files__file_id__content_get + parameters: + - name: file_id + in: path + required: true + schema: + type: string + description: ID of the File. + title: File Id + description: ID of the File. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/octet-stream: + schema: + type: string + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/octet-stream: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const response = await client.beta.files.download('file_id'); + + console.log(response); + + const content = await response.blob(); + console.log(content); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + response = client.beta.files.download( + file_id="file_id", + ) + print(response) + content = response.read() + print(content) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + response, err := client.Beta.Files.Download( + context.TODO(), + "file_id", + anthropic.BetaFileDownloadParams{ + + }, + ) + if err != nil { + panic(err.Error()) } - } - } - } - }, - "/v1/files/{file_id}/content?beta=true": { - "get": { - "summary": "Download File", - "operationId": "beta_download_file_v1_files__file_id__content_get", - "parameters": [ - { - "name": "file_id", - "in": "path", - "required": true, - "schema": { "type": "string", "description": "ID of the File.", "title": "File Id" }, - "description": "ID of the File." - }, - { - "name": "anthropic-beta", - "in": "header", - "required": false, - "schema": { - "type": "string", - "items": { "type": "string" }, - "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.", - "title": "Anthropic-Beta", - "x-stainless-override-schema": { - "x-stainless-param": "betas", - "x-stainless-extend-default": true, - "type": "array", - "description": "Optional header to specify the beta version(s) you want to use.", - "items": { "$ref": "#/components/schemas/AnthropicBeta" } + fmt.Printf("%+v\n", response) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.core.http.HttpResponse; + import com.anthropic.models.beta.files.FileDownloadParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + HttpResponse response = client.beta().files().download("file_id"); } - }, - "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." - }, - { - "name": "anthropic-version", - "in": "header", - "required": false, - "schema": { - "type": "string", - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning).", - "title": "Anthropic-Version" - }, - "description": "The version of the Anthropic API you want to use.\n\nRead more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning)." - }, - { - "name": "x-api-key", - "in": "header", - "required": false, - "schema": { - "type": "string", - "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.", - "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." } - ], - "responses": { - "200": { - "description": "Successful Response", - "content": { "application/octet-stream": { "schema": { "type": "string" } } } - }, - "4XX": { - "description": "Error response.\n\nSee our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details.", - "content": { - "application/octet-stream": { "schema": { "$ref": "#/components/schemas/BetaErrorResponse" } } + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.core.http.HttpResponse + import com.anthropic.models.beta.files.FileDownloadParams + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val response: HttpResponse = client.beta().files().download("file_id") + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + response = anthropic.beta.files.download("file_id") + + puts(response) + /v1/skills?beta=true: + post: + summary: Create Skill + operationId: beta_create_skill_v1_skills_post + parameters: + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/BetaBody_create_skill_v1_skills_post' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaCreateSkillResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const skill = await client.beta.skills.create(); + + console.log(skill.id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + skill = client.beta.skills.create() + print(skill.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + skill, err := client.Beta.Skills.New(context.TODO(), anthropic.BetaSkillNewParams{ + + }) + if err != nil { + panic(err.Error()) } + fmt.Printf("%+v\n", skill.ID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.beta.skills.SkillCreateParams; + import com.anthropic.models.beta.skills.SkillCreateResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + SkillCreateResponse skill = client.beta().skills().create(); + } } - } - } - } - }, - "components": { - "schemas": { - "APIError": { - "properties": { - "message": { "default": "Internal server error", "title": "Message", "type": "string" }, - "type": { - "const": "api_error", - "default": "api_error", - "enum": ["api_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["message", "type"], - "title": "APIError", - "type": "object" - }, - "AuthenticationError": { - "properties": { - "message": { "default": "Authentication error", "title": "Message", "type": "string" }, - "type": { - "const": "authentication_error", - "default": "authentication_error", - "enum": ["authentication_error"], - "title": "Type", - "type": "string" + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.beta.skills.SkillCreateParams + import com.anthropic.models.beta.skills.SkillCreateResponse + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val skill: SkillCreateResponse = client.beta().skills().create() + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + skill = anthropic.beta.skills.create + + puts(skill) + get: + summary: List Skills + operationId: beta_list_skills_v1_skills_get + parameters: + - name: page + in: query + required: false + schema: + anyOf: + - type: string + - type: 'null' + description: |- + Pagination token for fetching a specific page of results. + + Pass the value from a previous response's `next_page` field to get the next page of results. + title: Page + x-stainless-pagination-property: + purpose: next_cursor_param + description: |- + Pagination token for fetching a specific page of results. + + Pass the value from a previous response's `next_page` field to get the next page of results. + - name: limit + in: query + required: false + schema: + type: integer + description: |- + Number of results to return per page. + + Maximum value is 100. Defaults to 20. + default: 20 + title: Limit + description: |- + Number of results to return per page. + + Maximum value is 100. Defaults to 20. + - name: source + in: query + required: false + schema: + anyOf: + - type: string + - type: 'null' + description: |- + Filter skills by source. + + If provided, only skills from the specified source will be returned: + * `"custom"`: only return user-created skills + * `"anthropic"`: only return Anthropic-created skills + title: Source + description: |- + Filter skills by source. + + If provided, only skills from the specified source will be returned: + * `"custom"`: only return user-created skills + * `"anthropic"`: only return Anthropic-created skills + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaListSkillsResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const skillListResponse of client.beta.skills.list()) { + console.log(skillListResponse.id); + } + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.skills.list() + page = page.data[0] + print(page.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Skills.List(context.TODO(), anthropic.BetaSkillListParams{ + + }) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.beta.skills.SkillListPage; + import com.anthropic.models.beta.skills.SkillListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + SkillListPage page = client.beta().skills().list(); + } } - }, - "required": ["message", "type"], - "title": "AuthenticationError", - "type": "object" - }, - "Base64ImageSource": { - "additionalProperties": false, - "properties": { - "data": { "format": "byte", "title": "Data", "type": "string" }, - "media_type": { - "enum": ["image/jpeg", "image/png", "image/gif", "image/webp"], - "title": "Media Type", - "type": "string" - }, - "type": { "const": "base64", "enum": ["base64"], "title": "Type", "type": "string" } - }, - "required": ["data", "media_type", "type"], - "title": "Base64ImageSource", - "type": "object" - }, - "Base64PDFSource": { - "additionalProperties": false, - "properties": { - "data": { "format": "byte", "title": "Data", "type": "string" }, - "media_type": { - "const": "application/pdf", - "enum": ["application/pdf"], - "title": "Media Type", - "type": "string" - }, - "type": { "const": "base64", "enum": ["base64"], "title": "Type", "type": "string" } - }, - "required": ["data", "media_type", "type"], - "title": "Base64PDFSource", - "type": "object" - }, - "BashTool_20250124": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/CacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/CacheControlEphemeral" }] + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.beta.skills.SkillListPage + import com.anthropic.models.beta.skills.SkillListParams + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val page: SkillListPage = client.beta().skills().list() + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + page = anthropic.beta.skills.list + + puts(page) + /v1/skills/{skill_id}?beta=true: + get: + summary: Get Skill + operationId: beta_get_skill_v1_skills__skill_id__get + parameters: + - name: skill_id + in: path + required: true + schema: + type: string + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + title: Skill Id + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaGetSkillResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const skill = await client.beta.skills.retrieve('skill_id'); + + console.log(skill.id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + skill = client.beta.skills.retrieve( + skill_id="skill_id", + ) + print(skill.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + skill, err := client.Beta.Skills.Get( + context.TODO(), + "skill_id", + anthropic.BetaSkillGetParams{ + }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "name": { - "const": "bash", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks.", - "enum": ["bash"], - "title": "Name", - "type": "string" - }, - "type": { "const": "bash_20250124", "enum": ["bash_20250124"], "title": "Type", "type": "string" } - }, - "required": ["name", "type"], - "title": "BashTool_20250124", - "type": "object" - }, - "BetaAPIError": { - "properties": { - "message": { "default": "Internal server error", "title": "Message", "type": "string" }, - "type": { - "const": "api_error", - "default": "api_error", - "enum": ["api_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["message", "type"], - "title": "APIError", - "type": "object" - }, - "BetaAuthenticationError": { - "properties": { - "message": { "default": "Authentication error", "title": "Message", "type": "string" }, - "type": { - "const": "authentication_error", - "default": "authentication_error", - "enum": ["authentication_error"], - "title": "Type", - "type": "string" + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", skill.ID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.beta.skills.SkillRetrieveParams; + import com.anthropic.models.beta.skills.SkillRetrieveResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + SkillRetrieveResponse skill = client.beta().skills().retrieve("skill_id"); + } } - }, - "required": ["message", "type"], - "title": "AuthenticationError", - "type": "object" - }, - "BetaBase64ImageSource": { - "additionalProperties": false, - "properties": { - "data": { "format": "byte", "title": "Data", "type": "string" }, - "media_type": { - "enum": ["image/jpeg", "image/png", "image/gif", "image/webp"], - "title": "Media Type", - "type": "string" - }, - "type": { "const": "base64", "enum": ["base64"], "title": "Type", "type": "string" } - }, - "required": ["data", "media_type", "type"], - "title": "Base64ImageSource", - "type": "object" - }, - "BetaBase64PDFSource": { - "additionalProperties": false, - "properties": { - "data": { "format": "byte", "title": "Data", "type": "string" }, - "media_type": { - "const": "application/pdf", - "enum": ["application/pdf"], - "title": "Media Type", - "type": "string" - }, - "type": { "const": "base64", "enum": ["base64"], "title": "Type", "type": "string" } - }, - "required": ["data", "media_type", "type"], - "title": "Base64PDFSource", - "type": "object" - }, - "BetaBashCodeExecutionToolResultErrorCode": { - "enum": [ - "invalid_tool_input", - "unavailable", - "too_many_requests", - "execution_time_exceeded", - "output_file_too_large" - ], - "title": "BashCodeExecutionToolResultErrorCode", - "type": "string" - }, - "BetaBashTool_20241022": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "name": { - "const": "bash", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks.", - "enum": ["bash"], - "title": "Name", - "type": "string" - }, - "type": { "const": "bash_20241022", "enum": ["bash_20241022"], "title": "Type", "type": "string" } - }, - "required": ["name", "type"], - "title": "BashTool_20241022", - "type": "object" - }, - "BetaBashTool_20250124": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.beta.skills.SkillRetrieveParams + import com.anthropic.models.beta.skills.SkillRetrieveResponse + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val skill: SkillRetrieveResponse = client.beta().skills().retrieve("skill_id") + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + skill = anthropic.beta.skills.retrieve("skill_id") + + puts(skill) + delete: + summary: Delete Skill + operationId: beta_delete_skill_v1_skills__skill_id__delete + parameters: + - name: skill_id + in: path + required: true + schema: + type: string + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + title: Skill Id + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaDeleteSkillResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const skill = await client.beta.skills.delete('skill_id'); + + console.log(skill.id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + skill = client.beta.skills.delete( + skill_id="skill_id", + ) + print(skill.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + skill, err := client.Beta.Skills.Delete( + context.TODO(), + "skill_id", + anthropic.BetaSkillDeleteParams{ + }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "name": { - "const": "bash", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks.", - "enum": ["bash"], - "title": "Name", - "type": "string" - }, - "type": { "const": "bash_20250124", "enum": ["bash_20250124"], "title": "Type", "type": "string" } - }, - "required": ["name", "type"], - "title": "BashTool_20250124", - "type": "object" - }, - "BetaBillingError": { - "properties": { - "message": { "default": "Billing error", "title": "Message", "type": "string" }, - "type": { - "const": "billing_error", - "default": "billing_error", - "enum": ["billing_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["message", "type"], - "title": "BillingError", - "type": "object" - }, - "BetaCacheControlEphemeral": { - "additionalProperties": false, - "properties": { - "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`.", - "enum": ["5m", "1h"], - "title": "Ttl", - "type": "string", - "x-stainless-renameMap": { "ttl_5m": "5m", "ttl_1h": "1h" } - }, - "type": { "const": "ephemeral", "enum": ["ephemeral"], "title": "Type", "type": "string" } - }, - "required": ["type"], - "title": "CacheControlEphemeral", - "type": "object", - "x-stainless-go-constant-constructor": true - }, - "BetaCacheCreation": { - "properties": { - "ephemeral_1h_input_tokens": { - "default": 0, - "description": "The number of input tokens used to create the 1 hour cache entry.", - "minimum": 0, - "title": "Ephemeral 1H Input Tokens", - "type": "integer" - }, - "ephemeral_5m_input_tokens": { - "default": 0, - "description": "The number of input tokens used to create the 5 minute cache entry.", - "minimum": 0, - "title": "Ephemeral 5M Input Tokens", - "type": "integer" - } - }, - "required": ["ephemeral_1h_input_tokens", "ephemeral_5m_input_tokens"], - "title": "CacheCreation", - "type": "object" - }, - "BetaCanceledResult": { - "properties": { - "type": { - "const": "canceled", - "default": "canceled", - "enum": ["canceled"], - "title": "Type", - "type": "string" + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", skill.ID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.beta.skills.SkillDeleteParams; + import com.anthropic.models.beta.skills.SkillDeleteResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + SkillDeleteResponse skill = client.beta().skills().delete("skill_id"); + } } - }, - "required": ["type"], - "title": "CanceledResult", - "type": "object" - }, - "BetaCitationsDelta": { - "properties": { - "citation": { - "discriminator": { - "mapping": { - "char_location": "#/components/schemas/BetaResponseCharLocationCitation", - "content_block_location": "#/components/schemas/BetaResponseContentBlockLocationCitation", - "page_location": "#/components/schemas/BetaResponsePageLocationCitation", - "search_result_location": "#/components/schemas/BetaResponseSearchResultLocationCitation", - "web_search_result_location": "#/components/schemas/BetaResponseWebSearchResultLocationCitation" + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.beta.skills.SkillDeleteParams + import com.anthropic.models.beta.skills.SkillDeleteResponse + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val skill: SkillDeleteResponse = client.beta().skills().delete("skill_id") + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + skill = anthropic.beta.skills.delete("skill_id") + + puts(skill) + /v1/skills/{skill_id}/versions?beta=true: + post: + summary: Create Skill Version + operationId: beta_create_skill_version_v1_skills__skill_id__versions_post + parameters: + - name: skill_id + in: path + required: true + schema: + type: string + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + title: Skill Id + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/BetaBody_create_skill_version_v1_skills__skill_id__versions_post' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaCreateSkillVersionResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const version = await client.beta.skills.versions.create('skill_id'); + + console.log(version.id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + version = client.beta.skills.versions.create( + skill_id="skill_id", + ) + print(version.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + version, err := client.Beta.Skills.Versions.New( + context.TODO(), + "skill_id", + anthropic.BetaSkillVersionNewParams{ + }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/BetaResponseCharLocationCitation" }, - { "$ref": "#/components/schemas/BetaResponsePageLocationCitation" }, - { "$ref": "#/components/schemas/BetaResponseContentBlockLocationCitation" }, - { "$ref": "#/components/schemas/BetaResponseWebSearchResultLocationCitation" }, - { "$ref": "#/components/schemas/BetaResponseSearchResultLocationCitation" } - ], - "title": "Citation" - }, - "type": { - "const": "citations_delta", - "default": "citations_delta", - "enum": ["citations_delta"], - "title": "Type", - "type": "string" + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", version.ID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.beta.skills.versions.VersionCreateParams; + import com.anthropic.models.beta.skills.versions.VersionCreateResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + VersionCreateResponse version = client.beta().skills().versions().create("skill_id"); + } } - }, - "required": ["citation", "type"], - "title": "CitationsDelta", - "type": "object" - }, - "BetaClearToolUses20250919": { - "additionalProperties": false, - "properties": { - "clear_at_least": { - "anyOf": [{ "$ref": "#/components/schemas/BetaInputTokensClearAtLeast" }, { "type": "null" }], - "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": { - "anyOf": [ - { "type": "boolean" }, - { "items": { "type": "string" }, "type": "array" }, - { "type": "null" } - ], - "description": "Whether to clear all tool inputs (bool) or specific tool inputs to clear (list)", - "title": "Clear Tool Inputs" - }, - "exclude_tools": { - "anyOf": [{ "items": { "type": "string" }, "type": "array" }, { "type": "null" }], - "description": "Tool names whose uses are preserved from clearing", - "title": "Exclude Tools" - }, - "keep": { - "description": "Number of tool uses to retain in the conversation", - "discriminator": { - "mapping": { "tool_uses": "#/components/schemas/BetaToolUsesKeep" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaToolUsesKeep" }], - "title": "Keep" - }, - "trigger": { - "description": "Condition that triggers the context management strategy", - "discriminator": { - "mapping": { - "input_tokens": "#/components/schemas/BetaInputTokensTrigger", - "tool_uses": "#/components/schemas/BetaToolUsesTrigger" + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.beta.skills.versions.VersionCreateParams + import com.anthropic.models.beta.skills.versions.VersionCreateResponse + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val version: VersionCreateResponse = client.beta().skills().versions().create("skill_id") + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + version = anthropic.beta.skills.versions.create("skill_id") + + puts(version) + get: + summary: List Skill Versions + operationId: beta_list_skill_versions_v1_skills__skill_id__versions_get + parameters: + - name: skill_id + in: path + required: true + schema: + type: string + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + title: Skill Id + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + - name: page + in: query + required: false + schema: + anyOf: + - type: string + - type: 'null' + description: Optionally set to the `next_page` token from the previous response. + title: Page + x-stainless-pagination-property: + purpose: next_cursor_param + description: Optionally set to the `next_page` token from the previous response. + - name: limit + in: query + required: false + schema: + anyOf: + - type: integer + - type: 'null' + description: |- + Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + title: Limit + description: |- + Number of items to return per page. + + Defaults to `20`. Ranges from `1` to `1000`. + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaListSkillVersionsResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + // Automatically fetches more pages as needed. + for await (const versionListResponse of client.beta.skills.versions.list('skill_id')) { + console.log(versionListResponse.id); + } + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.skills.versions.list( + skill_id="skill_id", + ) + page = page.data[0] + print(page.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + page, err := client.Beta.Skills.Versions.List( + context.TODO(), + "skill_id", + anthropic.BetaSkillVersionListParams{ + }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/BetaInputTokensTrigger" }, - { "$ref": "#/components/schemas/BetaToolUsesTrigger" } - ], - "title": "Trigger" - }, - "type": { - "const": "clear_tool_uses_20250919", - "enum": ["clear_tool_uses_20250919"], - "title": "Type", - "type": "string" + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", page) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.beta.skills.versions.VersionListPage; + import com.anthropic.models.beta.skills.versions.VersionListParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + VersionListPage page = client.beta().skills().versions().list("skill_id"); + } } - }, - "required": ["type"], - "title": "ClearToolUses20250919", - "type": "object" - }, - "BetaCodeExecutionToolResultErrorCode": { - "enum": ["invalid_tool_input", "unavailable", "too_many_requests", "execution_time_exceeded"], - "title": "CodeExecutionToolResultErrorCode", - "type": "string" - }, - "BetaCodeExecutionTool_20250522": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.beta.skills.versions.VersionListPage + import com.anthropic.models.beta.skills.versions.VersionListParams + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val page: VersionListPage = client.beta().skills().versions().list("skill_id") + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + page = anthropic.beta.skills.versions.list("skill_id") + + puts(page) + /v1/skills/{skill_id}/versions/{version}?beta=true: + get: + summary: Get Skill Version + operationId: beta_get_skill_version_v1_skills__skill_id__versions__version__get + parameters: + - name: skill_id + in: path + required: true + schema: + type: string + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + title: Skill Id + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + - name: version + in: path + required: true + schema: + type: string + description: |- + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + title: Version + description: |- + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaGetSkillVersionResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const version = await client.beta.skills.versions.retrieve('version', { skill_id: 'skill_id' }); + + console.log(version.id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + version = client.beta.skills.versions.retrieve( + version="version", + skill_id="skill_id", + ) + print(version.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + version, err := client.Beta.Skills.Versions.Get( + context.TODO(), + "version", + anthropic.BetaSkillVersionGetParams{ + SkillID: "skill_id", }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "name": { - "const": "code_execution", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks.", - "enum": ["code_execution"], - "title": "Name", - "type": "string" - }, - "type": { - "const": "code_execution_20250522", - "enum": ["code_execution_20250522"], - "title": "Type", - "type": "string" + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", version.ID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.beta.skills.versions.VersionRetrieveParams; + import com.anthropic.models.beta.skills.versions.VersionRetrieveResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + VersionRetrieveParams params = VersionRetrieveParams.builder() + .skillId("skill_id") + .version("version") + .build(); + VersionRetrieveResponse version = client.beta().skills().versions().retrieve(params); + } } - }, - "required": ["name", "type"], - "title": "CodeExecutionTool_20250522", - "type": "object" - }, - "BetaCodeExecutionTool_20250825": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.beta.skills.versions.VersionRetrieveParams + import com.anthropic.models.beta.skills.versions.VersionRetrieveResponse + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val params: VersionRetrieveParams = VersionRetrieveParams.builder() + .skillId("skill_id") + .version("version") + .build() + val version: VersionRetrieveResponse = client.beta().skills().versions().retrieve(params) + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + version = anthropic.beta.skills.versions.retrieve("version", skill_id: "skill_id") + + puts(version) + delete: + summary: Delete Skill Version + operationId: beta_delete_skill_version_v1_skills__skill_id__versions__version__delete + parameters: + - name: skill_id + in: path + required: true + schema: + type: string + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + title: Skill Id + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + - name: version + in: path + required: true + schema: + type: string + description: |- + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + title: Version + description: |- + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + - name: anthropic-beta + in: header + required: false + schema: + type: string + items: + type: string + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + title: Anthropic-Beta + x-stainless-override-schema: + x-stainless-param: betas + x-stainless-extend-default: true + type: array + description: Optional header to specify the beta version(s) you want to use. + items: + $ref: '#/components/schemas/AnthropicBeta' + description: >- + Optional header to specify the beta version(s) you want to use. + + + To use multiple betas, use a comma separated list like `beta1,beta2` or specify the header + multiple times for each beta. + - name: anthropic-version + in: header + required: false + schema: + type: string + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + title: Anthropic-Version + description: >- + The version of the Claude API you want to use. + + + Read more about versioning and our version history + [here](https://docs.claude.com/en/api/versioning). + - name: x-api-key + in: header + required: false + schema: + type: string + description: >- + Your unique API key for authentication. + + + This 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. + title: X-Api-Key + description: >- + Your unique API key for authentication. + + + This 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. + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/BetaDeleteSkillVersionResponse' + 4XX: + description: |- + Error response. + + See our [errors documentation](https://docs.claude.com/en/api/errors) for more details. + content: + application/json: + schema: + $ref: '#/components/schemas/BetaErrorResponse' + x-stainless-snippets: + typescript: |- + import Anthropic from '@anthropic-ai/sdk'; + + const client = new Anthropic({ + apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted + }); + + const version = await client.beta.skills.versions.delete('version', { skill_id: 'skill_id' }); + + console.log(version.id); + python: |- + import os + from anthropic import Anthropic + + client = Anthropic( + api_key=os.environ.get("ANTHROPIC_API_KEY"), # This is the default and can be omitted + ) + version = client.beta.skills.versions.delete( + version="version", + skill_id="skill_id", + ) + print(version.id) + go: | + package main + + import ( + "context" + "fmt" + + "github.com/anthropics/anthropic-sdk-go" + "github.com/anthropics/anthropic-sdk-go/option" + ) + + func main() { + client := anthropic.NewClient( + option.WithAPIKey("my-anthropic-api-key"), + ) + version, err := client.Beta.Skills.Versions.Delete( + context.TODO(), + "version", + anthropic.BetaSkillVersionDeleteParams{ + SkillID: "skill_id", }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "name": { - "const": "code_execution", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks.", - "enum": ["code_execution"], - "title": "Name", - "type": "string" - }, - "type": { - "const": "code_execution_20250825", - "enum": ["code_execution_20250825"], - "title": "Type", - "type": "string" + ) + if err != nil { + panic(err.Error()) + } + fmt.Printf("%+v\n", version.ID) + } + java: |- + package com.anthropic.example; + + import com.anthropic.client.AnthropicClient; + import com.anthropic.client.okhttp.AnthropicOkHttpClient; + import com.anthropic.models.beta.skills.versions.VersionDeleteParams; + import com.anthropic.models.beta.skills.versions.VersionDeleteResponse; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + AnthropicClient client = AnthropicOkHttpClient.fromEnv(); + + VersionDeleteParams params = VersionDeleteParams.builder() + .skillId("skill_id") + .version("version") + .build(); + VersionDeleteResponse version = client.beta().skills().versions().delete(params); + } } - }, - "required": ["name", "type"], - "title": "CodeExecutionTool_20250825", - "type": "object" - }, - "BetaComputerUseTool_20241022": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ + kotlin: |- + package com.anthropic.example + + import com.anthropic.client.AnthropicClient + import com.anthropic.client.okhttp.AnthropicOkHttpClient + import com.anthropic.models.beta.skills.versions.VersionDeleteParams + import com.anthropic.models.beta.skills.versions.VersionDeleteResponse + + fun main() { + val client: AnthropicClient = AnthropicOkHttpClient.fromEnv() + + val params: VersionDeleteParams = VersionDeleteParams.builder() + .skillId("skill_id") + .version("version") + .build() + val version: VersionDeleteResponse = client.beta().skills().versions().delete(params) + } + ruby: |- + require "anthropic" + + anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key") + + version = anthropic.beta.skills.versions.delete("version", skill_id: "skill_id") + + puts(version) +components: + schemas: + APIError: + properties: + message: + default: Internal server error + title: Message + type: string + type: + const: api_error + default: api_error + title: Type + type: string + required: + - message + - type + title: APIError + type: object + AuthenticationError: + properties: + message: + default: Authentication error + title: Message + type: string + type: + const: authentication_error + default: authentication_error + title: Type + type: string + required: + - message + - type + title: AuthenticationError + type: object + Base64ImageSource: + additionalProperties: false + properties: + data: + format: byte + title: Data + type: string + media_type: + enum: + - image/jpeg + - image/png + - image/gif + - image/webp + title: Media Type + type: string + type: + const: base64 + title: Type + type: string + required: + - data + - media_type + - type + title: Base64ImageSource + type: object + Base64PDFSource: + additionalProperties: false + properties: + data: + format: byte + title: Data + type: string + media_type: + const: application/pdf + title: Media Type + type: string + type: + const: base64 + title: Type + type: string + required: + - data + - media_type + - type + title: Base64PDFSource + type: object + BashTool_20250124: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/CacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/CacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + name: + const: bash + description: |- + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + title: Name + type: string + type: + const: bash_20250124 + title: Type + type: string + required: + - name + - type + title: BashTool_20250124 + type: object + BetaAPIError: + properties: + message: + default: Internal server error + title: Message + type: string + type: + const: api_error + default: api_error + title: Type + type: string + required: + - message + - type + title: APIError + type: object + BetaAllThinkingTurns: + additionalProperties: false + properties: + type: + const: all + title: Type + type: string + required: + - type + title: AllThinkingTurns + type: object + BetaAuthenticationError: + properties: + message: + default: Authentication error + title: Message + type: string + type: + const: authentication_error + default: authentication_error + title: Type + type: string + required: + - message + - type + title: AuthenticationError + type: object + BetaBase64ImageSource: + additionalProperties: false + properties: + data: + format: byte + title: Data + type: string + media_type: + enum: + - image/jpeg + - image/png + - image/gif + - image/webp + title: Media Type + type: string + type: + const: base64 + title: Type + type: string + required: + - data + - media_type + - type + title: Base64ImageSource + type: object + BetaBase64PDFSource: + additionalProperties: false + properties: + data: + format: byte + title: Data + type: string + media_type: + const: application/pdf + title: Media Type + type: string + type: + const: base64 + title: Type + type: string + required: + - data + - media_type + - type + title: Base64PDFSource + type: object + BetaBashCodeExecutionToolResultErrorCode: + enum: + - invalid_tool_input + - unavailable + - too_many_requests + - execution_time_exceeded + - output_file_too_large + title: BashCodeExecutionToolResultErrorCode + type: string + BetaBashTool_20241022: + additionalProperties: false + properties: + allowed_callers: + items: + enum: + - direct + - code_execution_20250825 + type: string + title: Allowed Callers + type: array + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + defer_loading: + description: >- + If true, tool will not be included in initial system prompt. Only loaded when returned via + tool_reference from tool search. + title: Defer Loading + type: boolean + input_examples: + items: + additionalProperties: + $ref: '#/components/schemas/BetaJsonValue' + type: object + title: Input Examples + type: array + name: + const: bash + description: |- + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + title: Name + type: string + strict: + title: Strict + type: boolean + type: + const: bash_20241022 + title: Type + type: string + required: + - name + - type + title: BashTool_20241022 + type: object + BetaBashTool_20250124: + additionalProperties: false + properties: + allowed_callers: + items: + enum: + - direct + - code_execution_20250825 + type: string + title: Allowed Callers + type: array + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + defer_loading: + description: >- + If true, tool will not be included in initial system prompt. Only loaded when returned via + tool_reference from tool search. + title: Defer Loading + type: boolean + input_examples: + items: + additionalProperties: + $ref: '#/components/schemas/BetaJsonValue' + type: object + title: Input Examples + type: array + name: + const: bash + description: |- + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + title: Name + type: string + strict: + title: Strict + type: boolean + type: + const: bash_20250124 + title: Type + type: string + required: + - name + - type + title: BashTool_20250124 + type: object + BetaBillingError: + properties: + message: + default: Billing error + title: Message + type: string + type: + const: billing_error + default: billing_error + title: Type + type: string + required: + - message + - type + title: BillingError + type: object + BetaBody_create_skill_v1_skills_post: + properties: + display_title: + anyOf: + - type: string + - type: 'null' + title: Display Title + description: |- + Display title for the skill. + + This is a human-readable label that is not included in the prompt sent to the model. + files: + anyOf: + - items: + type: string + format: binary + type: array + - type: 'null' + title: Files + description: >- + Files to upload for the skill. + + + All files must be in the same top-level directory and must include a SKILL.md file at the root of + that directory. + type: object + title: Body_create_skill_v1_skills_post + BetaBody_create_skill_version_v1_skills__skill_id__versions_post: + properties: + files: + anyOf: + - items: + type: string + format: binary + type: array + - type: 'null' + title: Files + description: >- + Files to upload for the skill. + + + All files must be in the same top-level directory and must include a SKILL.md file at the root of + that directory. + type: object + title: Body_create_skill_version_v1_skills__skill_id__versions_post + BetaCacheControlEphemeral: + additionalProperties: false + properties: + ttl: + description: |- + The time-to-live for the cache control breakpoint. + + This may be one the following values: + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + enum: + - 5m + - 1h + title: Ttl + type: string + x-stainless-renameMap: + ttl_5m: 5m + ttl_1h: 1h + type: + const: ephemeral + title: Type + type: string + required: + - type + title: CacheControlEphemeral + type: object + x-stainless-go-constant-constructor: true + BetaCacheCreation: + properties: + ephemeral_1h_input_tokens: + default: 0 + description: The number of input tokens used to create the 1 hour cache entry. + minimum: 0 + title: Ephemeral 1H Input Tokens + type: integer + ephemeral_5m_input_tokens: + default: 0 + description: The number of input tokens used to create the 5 minute cache entry. + minimum: 0 + title: Ephemeral 5M Input Tokens + type: integer + required: + - ephemeral_1h_input_tokens + - ephemeral_5m_input_tokens + title: CacheCreation + type: object + BetaCanceledResult: + properties: + type: + const: canceled + default: canceled + title: Type + type: string + required: + - type + title: CanceledResult + type: object + BetaCitationsDelta: + properties: + citation: + discriminator: + mapping: + char_location: '#/components/schemas/BetaResponseCharLocationCitation' + content_block_location: '#/components/schemas/BetaResponseContentBlockLocationCitation' + page_location: '#/components/schemas/BetaResponsePageLocationCitation' + search_result_location: '#/components/schemas/BetaResponseSearchResultLocationCitation' + web_search_result_location: '#/components/schemas/BetaResponseWebSearchResultLocationCitation' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaResponseCharLocationCitation' + - $ref: '#/components/schemas/BetaResponsePageLocationCitation' + - $ref: '#/components/schemas/BetaResponseContentBlockLocationCitation' + - $ref: '#/components/schemas/BetaResponseWebSearchResultLocationCitation' + - $ref: '#/components/schemas/BetaResponseSearchResultLocationCitation' + title: Citation + type: + const: citations_delta + default: citations_delta + title: Type + type: string + required: + - citation + - type + title: CitationsDelta + type: object + BetaClearThinking20251015: + additionalProperties: false + properties: + keep: + anyOf: + - discriminator: + mapping: + all: '#/components/schemas/BetaAllThinkingTurns' + thinking_turns: '#/components/schemas/BetaThinkingTurns' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaThinkingTurns' + - $ref: '#/components/schemas/BetaAllThinkingTurns' + - const: all + type: string + description: >- + Number of most recent assistant turns to keep thinking blocks for. Older turns will have their + thinking blocks removed. + title: Keep + type: + const: clear_thinking_20251015 + title: Type + type: string + required: + - type + title: ClearThinking20251015 + type: object + BetaClearToolUses20250919: + additionalProperties: false + properties: + clear_at_least: + anyOf: + - $ref: '#/components/schemas/BetaInputTokensClearAtLeast' + - type: 'null' + 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: + anyOf: + - type: boolean + - items: + type: string + type: array + - type: 'null' + description: Whether to clear all tool inputs (bool) or specific tool inputs to clear (list) + title: Clear Tool Inputs + exclude_tools: + anyOf: + - items: + type: string + type: array + - type: 'null' + description: Tool names whose uses are preserved from clearing + title: Exclude Tools + keep: + description: Number of tool uses to retain in the conversation + discriminator: + mapping: + tool_uses: '#/components/schemas/BetaToolUsesKeep' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaToolUsesKeep' + title: Keep + trigger: + description: Condition that triggers the context management strategy + discriminator: + mapping: + input_tokens: '#/components/schemas/BetaInputTokensTrigger' + tool_uses: '#/components/schemas/BetaToolUsesTrigger' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaInputTokensTrigger' + - $ref: '#/components/schemas/BetaToolUsesTrigger' + title: Trigger + type: + const: clear_tool_uses_20250919 + title: Type + type: string + required: + - type + title: ClearToolUses20250919 + type: object + BetaCodeExecutionToolResultErrorCode: + enum: + - invalid_tool_input + - unavailable + - too_many_requests + - execution_time_exceeded + title: CodeExecutionToolResultErrorCode + type: string + BetaCodeExecutionTool_20250522: + additionalProperties: false + properties: + allowed_callers: + items: + enum: + - direct + - code_execution_20250825 + type: string + title: Allowed Callers + type: array + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + defer_loading: + description: >- + If true, tool will not be included in initial system prompt. Only loaded when returned via + tool_reference from tool search. + title: Defer Loading + type: boolean + name: + const: code_execution + description: |- + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + title: Name + type: string + strict: + title: Strict + type: boolean + type: + const: code_execution_20250522 + title: Type + type: string + required: + - name + - type + title: CodeExecutionTool_20250522 + type: object + BetaCodeExecutionTool_20250825: + additionalProperties: false + properties: + allowed_callers: + items: + enum: + - direct + - code_execution_20250825 + type: string + title: Allowed Callers + type: array + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + defer_loading: + description: >- + If true, tool will not be included in initial system prompt. Only loaded when returned via + tool_reference from tool search. + title: Defer Loading + type: boolean + name: + const: code_execution + description: |- + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + title: Name + type: string + strict: + title: Strict + type: boolean + type: + const: code_execution_20250825 + title: Type + type: string + required: + - name + - type + title: CodeExecutionTool_20250825 + type: object + BetaComputerUseTool_20241022: + additionalProperties: false + properties: + allowed_callers: + items: + enum: + - direct + - code_execution_20250825 + type: string + title: Allowed Callers + type: array + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + defer_loading: + description: >- + If true, tool will not be included in initial system prompt. Only loaded when returned via + tool_reference from tool search. + title: Defer Loading + type: boolean + display_height_px: + description: The height of the display in pixels. + minimum: 1 + title: Display Height Px + type: integer + display_number: + anyOf: + - minimum: 0 + type: integer + - type: 'null' + description: The X11 display number (e.g. 0, 1) for the display. + title: Display Number + display_width_px: + description: The width of the display in pixels. + minimum: 1 + title: Display Width Px + type: integer + input_examples: + items: + additionalProperties: + $ref: '#/components/schemas/BetaJsonValue' + type: object + title: Input Examples + type: array + name: + const: computer + description: |- + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + title: Name + type: string + strict: + title: Strict + type: boolean + type: + const: computer_20241022 + title: Type + type: string + required: + - display_height_px + - display_width_px + - name + - type + title: ComputerUseTool_20241022 + type: object + BetaComputerUseTool_20250124: + additionalProperties: false + properties: + allowed_callers: + items: + enum: + - direct + - code_execution_20250825 + type: string + title: Allowed Callers + type: array + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + defer_loading: + description: >- + If true, tool will not be included in initial system prompt. Only loaded when returned via + tool_reference from tool search. + title: Defer Loading + type: boolean + display_height_px: + description: The height of the display in pixels. + minimum: 1 + title: Display Height Px + type: integer + display_number: + anyOf: + - minimum: 0 + type: integer + - type: 'null' + description: The X11 display number (e.g. 0, 1) for the display. + title: Display Number + display_width_px: + description: The width of the display in pixels. + minimum: 1 + title: Display Width Px + type: integer + input_examples: + items: + additionalProperties: + $ref: '#/components/schemas/BetaJsonValue' + type: object + title: Input Examples + type: array + name: + const: computer + description: |- + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + title: Name + type: string + strict: + title: Strict + type: boolean + type: + const: computer_20250124 + title: Type + type: string + required: + - display_height_px + - display_width_px + - name + - type + title: ComputerUseTool_20250124 + type: object + BetaComputerUseTool_20251124: + additionalProperties: false + properties: + allowed_callers: + items: + enum: + - direct + - code_execution_20250825 + type: string + title: Allowed Callers + type: array + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + defer_loading: + description: >- + If true, tool will not be included in initial system prompt. Only loaded when returned via + tool_reference from tool search. + title: Defer Loading + type: boolean + display_height_px: + description: The height of the display in pixels. + minimum: 1 + title: Display Height Px + type: integer + display_number: + anyOf: + - minimum: 0 + type: integer + - type: 'null' + description: The X11 display number (e.g. 0, 1) for the display. + title: Display Number + display_width_px: + description: The width of the display in pixels. + minimum: 1 + title: Display Width Px + type: integer + enable_zoom: + description: Whether to enable an action to take a zoomed-in screenshot of the screen. + title: Enable Zoom + type: boolean + input_examples: + items: + additionalProperties: + $ref: '#/components/schemas/BetaJsonValue' + type: object + title: Input Examples + type: array + name: + const: computer + description: |- + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + title: Name + type: string + strict: + title: Strict + type: boolean + type: + const: computer_20251124 + title: Type + type: string + required: + - display_height_px + - display_width_px + - name + - type + title: ComputerUseTool_20251124 + type: object + BetaContainer: + description: Information about the container used in the request (for the code execution tool) + properties: + expires_at: + description: The time at which the container will expire. + format: date-time + title: Expires At + type: string + id: + description: Identifier for the container used in this request + title: Id + type: string + skills: + anyOf: + - items: + $ref: '#/components/schemas/BetaSkill' + type: array + - type: 'null' + default: null + description: Skills loaded in the container + title: Skills + required: + - expires_at + - id + - skills + title: Container + type: object + BetaContainerParams: + additionalProperties: false + description: Container parameters with skills to be loaded. + properties: + id: + anyOf: + - type: string + - type: 'null' + description: Container id + title: Id + skills: + anyOf: + - items: + $ref: '#/components/schemas/BetaSkillParams' + maxItems: 8 + type: array + - type: 'null' + description: List of skills to load in the container + title: Skills + title: ContainerParams + type: object + BetaContentBlockDeltaEvent: + properties: + delta: + discriminator: + mapping: + citations_delta: '#/components/schemas/BetaCitationsDelta' + input_json_delta: '#/components/schemas/BetaInputJsonContentBlockDelta' + signature_delta: '#/components/schemas/BetaSignatureContentBlockDelta' + text_delta: '#/components/schemas/BetaTextContentBlockDelta' + thinking_delta: '#/components/schemas/BetaThinkingContentBlockDelta' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaTextContentBlockDelta' + - $ref: '#/components/schemas/BetaInputJsonContentBlockDelta' + - $ref: '#/components/schemas/BetaCitationsDelta' + - $ref: '#/components/schemas/BetaThinkingContentBlockDelta' + - $ref: '#/components/schemas/BetaSignatureContentBlockDelta' + title: Delta + index: + title: Index + type: integer + type: + const: content_block_delta + default: content_block_delta + title: Type + type: string + required: + - delta + - index + - type + title: ContentBlockDeltaEvent + type: object + BetaContentBlockSource: + additionalProperties: false + properties: + content: + anyOf: + - type: string + - items: + discriminator: + mapping: + image: '#/components/schemas/BetaRequestImageBlock' + text: '#/components/schemas/BetaRequestTextBlock' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaRequestTextBlock' + - $ref: '#/components/schemas/BetaRequestImageBlock' + title: beta_content_block_source_content_item + type: array + title: beta_content_block_source_content + title: Content + type: + const: content + title: Type + type: string + required: + - content + - type + title: ContentBlockSource + type: object + BetaContentBlockStartEvent: + properties: + content_block: + discriminator: + mapping: + bash_code_execution_tool_result: '#/components/schemas/BetaResponseBashCodeExecutionToolResultBlock' + code_execution_tool_result: '#/components/schemas/BetaResponseCodeExecutionToolResultBlock' + container_upload: '#/components/schemas/BetaResponseContainerUploadBlock' + mcp_tool_result: '#/components/schemas/BetaResponseMCPToolResultBlock' + mcp_tool_use: '#/components/schemas/BetaResponseMCPToolUseBlock' + redacted_thinking: '#/components/schemas/BetaResponseRedactedThinkingBlock' + server_tool_use: '#/components/schemas/BetaResponseServerToolUseBlock' + text: '#/components/schemas/BetaResponseTextBlock' + text_editor_code_execution_tool_result: '#/components/schemas/BetaResponseTextEditorCodeExecutionToolResultBlock' + thinking: '#/components/schemas/BetaResponseThinkingBlock' + tool_search_tool_result: '#/components/schemas/BetaResponseToolSearchToolResultBlock' + tool_use: '#/components/schemas/BetaResponseToolUseBlock' + web_fetch_tool_result: '#/components/schemas/BetaResponseWebFetchToolResultBlock' + web_search_tool_result: '#/components/schemas/BetaResponseWebSearchToolResultBlock' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaResponseTextBlock' + - $ref: '#/components/schemas/BetaResponseThinkingBlock' + - $ref: '#/components/schemas/BetaResponseRedactedThinkingBlock' + - $ref: '#/components/schemas/BetaResponseToolUseBlock' + - $ref: '#/components/schemas/BetaResponseServerToolUseBlock' + - $ref: '#/components/schemas/BetaResponseWebSearchToolResultBlock' + - $ref: '#/components/schemas/BetaResponseWebFetchToolResultBlock' + - $ref: '#/components/schemas/BetaResponseCodeExecutionToolResultBlock' + - $ref: '#/components/schemas/BetaResponseBashCodeExecutionToolResultBlock' + - $ref: '#/components/schemas/BetaResponseTextEditorCodeExecutionToolResultBlock' + - $ref: '#/components/schemas/BetaResponseToolSearchToolResultBlock' + - $ref: '#/components/schemas/BetaResponseMCPToolUseBlock' + - $ref: '#/components/schemas/BetaResponseMCPToolResultBlock' + - $ref: '#/components/schemas/BetaResponseContainerUploadBlock' + title: Content Block + index: + title: Index + type: integer + type: + const: content_block_start + default: content_block_start + title: Type + type: string + required: + - content_block + - index + - type + title: ContentBlockStartEvent + type: object + BetaContentBlockStopEvent: + properties: + index: + title: Index + type: integer + type: + const: content_block_stop + default: content_block_stop + title: Type + type: string + required: + - index + - type + title: ContentBlockStopEvent + type: object + BetaContextManagementConfig: + additionalProperties: false + properties: + edits: + description: List of context management edits to apply + items: + discriminator: + mapping: + clear_thinking_20251015: '#/components/schemas/BetaClearThinking20251015' + clear_tool_uses_20250919: '#/components/schemas/BetaClearToolUses20250919' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaClearToolUses20250919' + - $ref: '#/components/schemas/BetaClearThinking20251015' + minItems: 0 + title: Edits + type: array + title: ContextManagementConfig + type: object + BetaContextManagementResponse: + properties: + original_input_tokens: + type: integer + title: Original Input Tokens + description: The original token count before context management was applied + type: object + required: + - original_input_tokens + title: ContextManagementResponse + BetaCountMessageTokensParams: + additionalProperties: false + examples: + - messages: + - content: Hello, world + role: user + model: claude-sonnet-4-5-20250929 + properties: + context_management: + anyOf: + - $ref: '#/components/schemas/BetaContextManagementConfig' + - type: 'null' + description: >- + Context management configuration. + + + This allows you to control how Claude manages context across multiple requests, such as whether to + clear function results or not. + mcp_servers: + description: MCP servers to be utilized in this request + items: + $ref: '#/components/schemas/BetaRequestMCPServerURLDefinition' + maxItems: 20 + title: Mcp Servers + type: array + messages: + description: >- + Input messages. + + + Our 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. + + + Each 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. + + + If 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. + + + Example with a single `user` message: + + + ```json + + [{"role": "user", "content": "Hello, Claude"}] + + ``` + + + Example with multiple conversational turns: + + + ```json + + [ + {"role": "user", "content": "Hello there."}, + {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"}, + {"role": "user", "content": "Can you explain LLMs in plain English?"}, + ] + + ``` + + + Example with a partially-filled response from Claude: + + + ```json + + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("}, + ] + + ``` + + + Each 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: + + + ```json + + {"role": "user", "content": "Hello, Claude"} + + ``` + + + ```json + + {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]} + + ``` + + + See [input examples](https://docs.claude.com/en/api/messages-examples). + + + Note 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. + + + There is a limit of 100,000 messages in a single request. + items: + $ref: '#/components/schemas/BetaInputMessage' + title: Messages + type: array + model: + $ref: '#/components/schemas/Model' + output_config: + $ref: '#/components/schemas/BetaOutputConfig' + description: >- + Configuration options for the model's output. Controls aspects like output format or how much + effort the model puts into its response. + output_format: + anyOf: + - $ref: '#/components/schemas/BetaJsonOutputFormat' + - type: 'null' + deprecated: true + description: >- + Deprecated: Use `output_config.format` instead. See [structured + outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) + + + A schema to specify Claude's output format in responses. This parameter will be removed in a + future release. + system: + anyOf: + - type: string + - items: + $ref: '#/components/schemas/BetaRequestTextBlock' + type: array + description: >- + System prompt. + + + A 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). + examples: + - - text: Today's date is 2024-06-01. + type: text + - Today's date is 2023-01-01. + title: System + thinking: + $ref: '#/components/schemas/BetaThinkingConfigParam' + tool_choice: + $ref: '#/components/schemas/BetaToolChoice' + tools: + description: >- + Definitions of tools that the model may use. + + + If 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. + + + There 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)). + + + Each tool definition includes: + + + * `name`: Name of the tool. + + * `description`: Optional, but strongly-recommended description of the tool. + + * `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. + + + For example, if you defined `tools` as: + + + ```json + + [ { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "display_height_px": { - "description": "The height of the display in pixels.", - "minimum": 1, - "title": "Display Height Px", - "type": "integer" - }, - "display_number": { - "anyOf": [{ "minimum": 0, "type": "integer" }, { "type": "null" }], - "description": "The X11 display number (e.g. 0, 1) for the display.", - "title": "Display Number" - }, - "display_width_px": { - "description": "The width of the display in pixels.", - "minimum": 1, - "title": "Display Width Px", - "type": "integer" - }, - "name": { - "const": "computer", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks.", - "enum": ["computer"], - "title": "Name", - "type": "string" - }, - "type": { - "const": "computer_20241022", - "enum": ["computer_20241022"], - "title": "Type", - "type": "string" - } - }, - "required": ["display_height_px", "display_width_px", "name", "type"], - "title": "ComputerUseTool_20241022", - "type": "object" - }, - "BetaComputerUseTool_20250124": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ + "name": "get_stock_price", + "description": "Get the current stock price for a given ticker symbol.", + "input_schema": { + "type": "object", + "properties": { + "ticker": { + "type": "string", + "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." + } + }, + "required": ["ticker"] + } + } + ] + + ``` + + + And 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: + + + ```json + + [ { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "display_height_px": { - "description": "The height of the display in pixels.", - "minimum": 1, - "title": "Display Height Px", - "type": "integer" - }, - "display_number": { - "anyOf": [{ "minimum": 0, "type": "integer" }, { "type": "null" }], - "description": "The X11 display number (e.g. 0, 1) for the display.", - "title": "Display Number" - }, - "display_width_px": { - "description": "The width of the display in pixels.", - "minimum": 1, - "title": "Display Width Px", - "type": "integer" - }, - "name": { - "const": "computer", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks.", - "enum": ["computer"], - "title": "Name", - "type": "string" - }, - "type": { - "const": "computer_20250124", - "enum": ["computer_20250124"], - "title": "Type", - "type": "string" - } - }, - "required": ["display_height_px", "display_width_px", "name", "type"], - "title": "ComputerUseTool_20250124", - "type": "object" - }, - "BetaContainer": { - "description": "Information about the container used in the request (for the code execution tool)", - "properties": { - "expires_at": { - "description": "The time at which the container will expire.", - "format": "date-time", - "title": "Expires At", - "type": "string" - }, - "id": { - "description": "Identifier for the container used in this request", - "title": "Id", - "type": "string" - } - }, - "required": ["expires_at", "id"], - "title": "Container", - "type": "object" - }, - "BetaContentBlockDeltaEvent": { - "properties": { - "delta": { - "discriminator": { - "mapping": { - "citations_delta": "#/components/schemas/BetaCitationsDelta", - "input_json_delta": "#/components/schemas/BetaInputJsonContentBlockDelta", - "signature_delta": "#/components/schemas/BetaSignatureContentBlockDelta", - "text_delta": "#/components/schemas/BetaTextContentBlockDelta", - "thinking_delta": "#/components/schemas/BetaThinkingContentBlockDelta" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/BetaTextContentBlockDelta" }, - { "$ref": "#/components/schemas/BetaInputJsonContentBlockDelta" }, - { "$ref": "#/components/schemas/BetaCitationsDelta" }, - { "$ref": "#/components/schemas/BetaThinkingContentBlockDelta" }, - { "$ref": "#/components/schemas/BetaSignatureContentBlockDelta" } - ], - "title": "Delta" - }, - "index": { "title": "Index", "type": "integer" }, - "type": { - "const": "content_block_delta", - "default": "content_block_delta", - "enum": ["content_block_delta"], - "title": "Type", - "type": "string" - } - }, - "required": ["delta", "index", "type"], - "title": "ContentBlockDeltaEvent", - "type": "object" - }, - "BetaContentBlockSource": { - "additionalProperties": false, - "properties": { - "content": { - "anyOf": [ - { "type": "string" }, + "type": "tool_use", + "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "name": "get_stock_price", + "input": { "ticker": "^GSPC" } + } + ] + + ``` + + + You 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: + + + ```json + + [ { - "items": { - "discriminator": { - "mapping": { - "image": "#/components/schemas/BetaRequestImageBlock", - "text": "#/components/schemas/BetaRequestTextBlock" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/BetaRequestTextBlock" }, - { "$ref": "#/components/schemas/BetaRequestImageBlock" } - ], - "title": "beta_content_block_source_content_item" - }, - "type": "array", - "title": "beta_content_block_source_content" + "type": "tool_result", + "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "content": "259.75 USD" } - ], - "title": "Content" - }, - "type": { "const": "content", "enum": ["content"], "title": "Type", "type": "string" } - }, - "required": ["content", "type"], - "title": "ContentBlockSource", - "type": "object" - }, - "BetaContentBlockStartEvent": { - "properties": { - "content_block": { - "discriminator": { - "mapping": { - "bash_code_execution_tool_result": "#/components/schemas/BetaResponseBashCodeExecutionToolResultBlock", - "code_execution_tool_result": "#/components/schemas/BetaResponseCodeExecutionToolResultBlock", - "container_upload": "#/components/schemas/BetaResponseContainerUploadBlock", - "mcp_tool_result": "#/components/schemas/BetaResponseMCPToolResultBlock", - "mcp_tool_use": "#/components/schemas/BetaResponseMCPToolUseBlock", - "redacted_thinking": "#/components/schemas/BetaResponseRedactedThinkingBlock", - "server_tool_use": "#/components/schemas/BetaResponseServerToolUseBlock", - "text": "#/components/schemas/BetaResponseTextBlock", - "text_editor_code_execution_tool_result": "#/components/schemas/BetaResponseTextEditorCodeExecutionToolResultBlock", - "thinking": "#/components/schemas/BetaResponseThinkingBlock", - "tool_use": "#/components/schemas/BetaResponseToolUseBlock", - "web_fetch_tool_result": "#/components/schemas/BetaResponseWebFetchToolResultBlock", - "web_search_tool_result": "#/components/schemas/BetaResponseWebSearchToolResultBlock" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/BetaResponseTextBlock" }, - { "$ref": "#/components/schemas/BetaResponseThinkingBlock" }, - { "$ref": "#/components/schemas/BetaResponseRedactedThinkingBlock" }, - { "$ref": "#/components/schemas/BetaResponseToolUseBlock" }, - { "$ref": "#/components/schemas/BetaResponseServerToolUseBlock" }, - { "$ref": "#/components/schemas/BetaResponseWebSearchToolResultBlock" }, - { "$ref": "#/components/schemas/BetaResponseWebFetchToolResultBlock" }, - { "$ref": "#/components/schemas/BetaResponseCodeExecutionToolResultBlock" }, - { "$ref": "#/components/schemas/BetaResponseBashCodeExecutionToolResultBlock" }, - { "$ref": "#/components/schemas/BetaResponseTextEditorCodeExecutionToolResultBlock" }, - { "$ref": "#/components/schemas/BetaResponseMCPToolUseBlock" }, - { "$ref": "#/components/schemas/BetaResponseMCPToolResultBlock" }, - { "$ref": "#/components/schemas/BetaResponseContainerUploadBlock" } - ], - "title": "Content Block" - }, - "index": { "title": "Index", "type": "integer" }, - "type": { - "const": "content_block_start", - "default": "content_block_start", - "enum": ["content_block_start"], - "title": "Type", - "type": "string" - } - }, - "required": ["content_block", "index", "type"], - "title": "ContentBlockStartEvent", - "type": "object" - }, - "BetaContentBlockStopEvent": { - "properties": { - "index": { "title": "Index", "type": "integer" }, - "type": { - "const": "content_block_stop", - "default": "content_block_stop", - "enum": ["content_block_stop"], - "title": "Type", - "type": "string" - } - }, - "required": ["index", "type"], - "title": "ContentBlockStopEvent", - "type": "object" - }, - "BetaContextManagementConfig": { - "additionalProperties": false, - "description": "Configuration for context management operations.", - "properties": { - "edits": { - "description": "List of context management edits to apply", - "items": { - "discriminator": { - "mapping": { "clear_tool_uses_20250919": "#/components/schemas/BetaClearToolUses20250919" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaClearToolUses20250919" }] - }, - "minItems": 0, - "title": "Edits", - "type": "array" - } - }, - "title": "ContextManagementConfig", - "type": "object" - }, - "BetaContextManagementResponse": { - "properties": { - "original_input_tokens": { - "type": "integer", - "title": "Original Input Tokens", - "description": "The original token count before context management was applied" - } - }, - "type": "object", - "required": ["original_input_tokens"], - "title": "ContextManagementResponse" - }, - "BetaCountMessageTokensParams": { - "additionalProperties": false, - "examples": [ - { "messages": [{ "content": "Hello, world", "role": "user" }], "model": "claude-sonnet-4-20250514" } - ], - "properties": { - "context_management": { - "anyOf": [{ "$ref": "#/components/schemas/BetaContextManagementConfig" }, { "type": "null" }], - "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": { - "description": "MCP servers to be utilized in this request", - "items": { "$ref": "#/components/schemas/BetaRequestMCPServerURLDefinition" }, - "maxItems": 20, - "title": "Mcp Servers", - "type": "array" - }, - "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.anthropic.com/en/api/messages-examples).\n\nNote that if you want to include a [system prompt](https://docs.anthropic.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.", - "items": { "$ref": "#/components/schemas/BetaInputMessage" }, - "title": "Messages", - "type": "array" - }, - "model": { "$ref": "#/components/schemas/Model" }, - "system": { - "anyOf": [ - { "type": "string" }, - { "items": { "$ref": "#/components/schemas/BetaRequestTextBlock" }, "type": "array" } - ], - "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.anthropic.com/en/docs/system-prompts).", - "examples": [ - [{ "text": "Today's date is 2024-06-01.", "type": "text" }], - "Today's date is 2023-01-01." - ], - "title": "System" - }, - "thinking": { "$ref": "#/components/schemas/BetaThinkingConfigParam" }, - "tool_choice": { "$ref": "#/components/schemas/BetaToolChoice" }, - "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.anthropic.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.anthropic.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.anthropic.com/en/docs/tool-use) for more details.", - "examples": [ + ] + + ``` + + + Tools 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. + + + See our [guide](https://docs.claude.com/en/docs/tool-use) for more details. + examples: + - description: Get the current weather in a given location + input_schema: + properties: + location: + description: The city and state, e.g. San Francisco, CA + type: string + unit: + description: Unit for the output - one of (celsius, fahrenheit) + type: string + required: + - location + type: object + name: get_weather + items: + oneOf: + - $ref: '#/components/schemas/BetaTool' + - $ref: '#/components/schemas/BetaBashTool_20241022' + - $ref: '#/components/schemas/BetaBashTool_20250124' + - $ref: '#/components/schemas/BetaCodeExecutionTool_20250522' + - $ref: '#/components/schemas/BetaCodeExecutionTool_20250825' + - $ref: '#/components/schemas/BetaComputerUseTool_20241022' + - $ref: '#/components/schemas/BetaMemoryTool_20250818' + - $ref: '#/components/schemas/BetaComputerUseTool_20250124' + - $ref: '#/components/schemas/BetaTextEditor_20241022' + - $ref: '#/components/schemas/BetaComputerUseTool_20251124' + - $ref: '#/components/schemas/BetaTextEditor_20250124' + - $ref: '#/components/schemas/BetaTextEditor_20250429' + - $ref: '#/components/schemas/BetaTextEditor_20250728' + - $ref: '#/components/schemas/BetaWebSearchTool_20250305' + - $ref: '#/components/schemas/BetaWebFetchTool_20250910' + - $ref: '#/components/schemas/BetaToolSearchToolBM25_20251119' + - $ref: '#/components/schemas/BetaToolSearchToolRegex_20251119' + - $ref: '#/components/schemas/BetaMCPToolset' + title: Tools + type: array + required: + - messages + - model + title: CountMessageTokensParams + type: object + BetaCountMessageTokensResponse: + properties: + context_management: + anyOf: + - $ref: '#/components/schemas/BetaContextManagementResponse' + - type: 'null' + description: Information about context management applied to the message. + input_tokens: + type: integer + title: Input Tokens + description: The total number of tokens across the provided list of messages, system prompt, and tools. + examples: + - 2095 + type: object + required: + - context_management + - input_tokens + title: CountMessageTokensResponse + examples: + - input_tokens: 2095 + BetaCreateMessageBatchParams: + additionalProperties: false + properties: + requests: + description: List of requests for prompt completion. Each is an individual request to create a Message. + items: + $ref: '#/components/schemas/BetaMessageBatchIndividualRequestParams' + maxItems: 100000 + minItems: 1 + title: Requests + type: array + required: + - requests + title: CreateMessageBatchParams + type: object + BetaCreateMessageParams: + additionalProperties: false + example: + max_tokens: 1024 + messages: + - content: Hello, world + role: user + model: claude-sonnet-4-5-20250929 + properties: + model: + $ref: '#/components/schemas/Model' + messages: + description: >- + Input messages. + + + Our 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. + + + Each 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. + + + If 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. + + + Example with a single `user` message: + + + ```json + + [{"role": "user", "content": "Hello, Claude"}] + + ``` + + + Example with multiple conversational turns: + + + ```json + + [ + {"role": "user", "content": "Hello there."}, + {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"}, + {"role": "user", "content": "Can you explain LLMs in plain English?"}, + ] + + ``` + + + Example with a partially-filled response from Claude: + + + ```json + + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("}, + ] + + ``` + + + Each 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: + + + ```json + + {"role": "user", "content": "Hello, Claude"} + + ``` + + + ```json + + {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]} + + ``` + + + See [input examples](https://docs.claude.com/en/api/messages-examples). + + + Note 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. + + + There is a limit of 100,000 messages in a single request. + items: + $ref: '#/components/schemas/BetaInputMessage' + title: Messages + type: array + container: + anyOf: + - $ref: '#/components/schemas/BetaContainerParams' + - type: string + - type: 'null' + description: Container identifier for reuse across requests. + title: Container + context_management: + anyOf: + - $ref: '#/components/schemas/BetaContextManagementConfig' + - type: 'null' + description: >- + Context management configuration. + + + This allows you to control how Claude manages context across multiple requests, such as whether to + clear function results or not. + max_tokens: + description: >- + The maximum number of tokens to generate before stopping. + + + Note that our models may stop _before_ reaching this maximum. This parameter only specifies the + absolute maximum number of tokens to generate. + + + Different models have different maximum values for this parameter. See + [models](https://docs.claude.com/en/docs/models-overview) for details. + examples: + - 1024 + minimum: 1 + title: Max Tokens + type: integer + mcp_servers: + description: MCP servers to be utilized in this request + items: + $ref: '#/components/schemas/BetaRequestMCPServerURLDefinition' + maxItems: 20 + title: Mcp Servers + type: array + metadata: + $ref: '#/components/schemas/BetaMetadata' + description: An object describing metadata about the request. + output_config: + $ref: '#/components/schemas/BetaOutputConfig' + description: >- + Configuration options for the model's output. Controls aspects like output format or how much + effort the model puts into its response. + output_format: + anyOf: + - $ref: '#/components/schemas/BetaJsonOutputFormat' + - type: 'null' + deprecated: true + description: >- + Deprecated: Use `output_config.format` instead. See [structured + outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) + + + A schema to specify Claude's output format in responses. This parameter will be removed in a + future release. + service_tier: + description: >- + Determines whether to use priority capacity (if available) or standard capacity for this request. + + + Anthropic offers different levels of service for your API requests. See + [service-tiers](https://docs.claude.com/en/api/service-tiers) for details. + enum: + - auto + - standard_only + title: Service Tier + type: string + stop_sequences: + description: >- + Custom text sequences that will cause the model to stop generating. + + + Our models will normally stop when they have naturally completed their turn, which will result in + a response `stop_reason` of `"end_turn"`. + + + If 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. + items: + type: string + title: Stop Sequences + type: array + stream: + description: |- + Whether to incrementally stream the response using server-sent events. + + See [streaming](https://docs.claude.com/en/api/messages-streaming) for details. + title: Stream + type: boolean + system: + anyOf: + - type: string + x-stainless-skip: + - go + - cli + - items: + $ref: '#/components/schemas/BetaRequestTextBlock' + type: array + description: >- + System prompt. + + + A 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). + examples: + - - text: Today's date is 2024-06-01. + type: text + - Today's date is 2023-01-01. + title: System + temperature: + description: >- + Amount of randomness injected into the response. + + + Defaults 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. + + + Note that even with `temperature` of `0.0`, the results will not be fully deterministic. + examples: + - 1 + maximum: 1 + minimum: 0 + title: Temperature + type: number + thinking: + $ref: '#/components/schemas/BetaThinkingConfigParam' + tool_choice: + $ref: '#/components/schemas/BetaToolChoice' + tools: + description: >- + Definitions of tools that the model may use. + + + If 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. + + + There 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)). + + + Each tool definition includes: + + + * `name`: Name of the tool. + + * `description`: Optional, but strongly-recommended description of the tool. + + * `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. + + + For example, if you defined `tools` as: + + + ```json + + [ { - "description": "Get the current weather in a given location", + "name": "get_stock_price", + "description": "Get the current stock price for a given ticker symbol.", "input_schema": { + "type": "object", "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string" - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string" + "ticker": { + "type": "string", + "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." } }, - "required": ["location"], - "type": "object" - }, - "name": "get_weather" + "required": ["ticker"] + } } - ], - "items": { - "oneOf": [ - { "$ref": "#/components/schemas/BetaTool" }, - { "$ref": "#/components/schemas/BetaBashTool_20241022" }, - { "$ref": "#/components/schemas/BetaBashTool_20250124" }, - { "$ref": "#/components/schemas/BetaCodeExecutionTool_20250522" }, - { "$ref": "#/components/schemas/BetaCodeExecutionTool_20250825" }, - { "$ref": "#/components/schemas/BetaComputerUseTool_20241022" }, - { "$ref": "#/components/schemas/BetaMemoryTool_20250818" }, - { "$ref": "#/components/schemas/BetaComputerUseTool_20250124" }, - { "$ref": "#/components/schemas/BetaTextEditor_20241022" }, - { "$ref": "#/components/schemas/BetaTextEditor_20250124" }, - { "$ref": "#/components/schemas/BetaTextEditor_20250429" }, - { "$ref": "#/components/schemas/BetaTextEditor_20250728" }, - { "$ref": "#/components/schemas/BetaWebSearchTool_20250305" }, - { "$ref": "#/components/schemas/BetaWebFetchTool_20250910" } - ] - }, - "title": "Tools", - "type": "array" - } - }, - "required": ["messages", "model"], - "title": "CountMessageTokensParams", - "type": "object" - }, - "BetaCountMessageTokensResponse": { - "properties": { - "context_management": { - "anyOf": [{ "$ref": "#/components/schemas/BetaContextManagementResponse" }, { "type": "null" }], - "description": "Information about context management applied to the message." - }, - "input_tokens": { - "type": "integer", - "title": "Input Tokens", - "description": "The total number of tokens across the provided list of messages, system prompt, and tools.", - "examples": [2095] - } - }, - "type": "object", - "required": ["context_management", "input_tokens"], - "title": "CountMessageTokensResponse", - "examples": [{ "input_tokens": 2095 }] - }, - "BetaCreateMessageBatchParams": { - "additionalProperties": false, - "properties": { - "requests": { - "description": "List of requests for prompt completion. Each is an individual request to create a Message.", - "items": { "$ref": "#/components/schemas/BetaMessageBatchIndividualRequestParams" }, - "maxItems": 10000, - "minItems": 1, - "title": "Requests", - "type": "array" - } - }, - "required": ["requests"], - "title": "CreateMessageBatchParams", - "type": "object" - }, - "BetaCreateMessageParams": { - "additionalProperties": false, - "example": { - "max_tokens": 1024, - "messages": [{ "content": "Hello, world", "role": "user" }], - "model": "claude-sonnet-4-20250514" - }, - "properties": { - "model": { "$ref": "#/components/schemas/Model" }, - "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.anthropic.com/en/api/messages-examples).\n\nNote that if you want to include a [system prompt](https://docs.anthropic.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.", - "items": { "$ref": "#/components/schemas/BetaInputMessage" }, - "title": "Messages", - "type": "array" - }, - "container": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "description": "Container identifier for reuse across requests.", - "title": "Container" - }, - "context_management": { - "anyOf": [{ "$ref": "#/components/schemas/BetaContextManagementConfig" }, { "type": "null" }], - "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." - }, - "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.anthropic.com/en/docs/models-overview) for details.", - "examples": [1024], - "minimum": 1, - "title": "Max Tokens", - "type": "integer" - }, - "mcp_servers": { - "description": "MCP servers to be utilized in this request", - "items": { "$ref": "#/components/schemas/BetaRequestMCPServerURLDefinition" }, - "maxItems": 20, - "title": "Mcp Servers", - "type": "array" - }, - "metadata": { - "$ref": "#/components/schemas/BetaMetadata", - "description": "An object describing metadata about the request." - }, - "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.anthropic.com/en/api/service-tiers) for details.", - "enum": ["auto", "standard_only"], - "title": "Service Tier", - "type": "string" - }, - "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.", - "items": { "type": "string" }, - "title": "Stop Sequences", - "type": "array" - }, - "stream": { - "description": "Whether to incrementally stream the response using server-sent events.\n\nSee [streaming](https://docs.anthropic.com/en/api/messages-streaming) for details.", - "title": "Stream", - "type": "boolean" - }, - "system": { - "anyOf": [ - { "type": "string", "x-stainless-skip": ["go", "cli"] }, - { "items": { "$ref": "#/components/schemas/BetaRequestTextBlock" }, "type": "array" } - ], - "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.anthropic.com/en/docs/system-prompts).", - "examples": [ - [{ "text": "Today's date is 2024-06-01.", "type": "text" }], - "Today's date is 2023-01-01." - ], - "title": "System" - }, - "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.", - "examples": [1], - "maximum": 1, - "minimum": 0, - "title": "Temperature", - "type": "number" - }, - "thinking": { "$ref": "#/components/schemas/BetaThinkingConfigParam" }, - "tool_choice": { "$ref": "#/components/schemas/BetaToolChoice" }, - "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.anthropic.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.anthropic.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.anthropic.com/en/docs/tool-use) for more details.", - "examples": [ + ] + + ``` + + + And 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: + + + ```json + + [ + { + "type": "tool_use", + "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "name": "get_stock_price", + "input": { "ticker": "^GSPC" } + } + ] + + ``` + + + You 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: + + + ```json + + [ + { + "type": "tool_result", + "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "content": "259.75 USD" + } + ] + + ``` + + + Tools 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. + + + See our [guide](https://docs.claude.com/en/docs/tool-use) for more details. + examples: + - description: Get the current weather in a given location + input_schema: + properties: + location: + description: The city and state, e.g. San Francisco, CA + type: string + unit: + description: Unit for the output - one of (celsius, fahrenheit) + type: string + required: + - location + type: object + name: get_weather + items: + oneOf: + - $ref: '#/components/schemas/BetaTool' + - $ref: '#/components/schemas/BetaBashTool_20241022' + - $ref: '#/components/schemas/BetaBashTool_20250124' + - $ref: '#/components/schemas/BetaCodeExecutionTool_20250522' + - $ref: '#/components/schemas/BetaCodeExecutionTool_20250825' + - $ref: '#/components/schemas/BetaComputerUseTool_20241022' + - $ref: '#/components/schemas/BetaMemoryTool_20250818' + - $ref: '#/components/schemas/BetaComputerUseTool_20250124' + - $ref: '#/components/schemas/BetaTextEditor_20241022' + - $ref: '#/components/schemas/BetaComputerUseTool_20251124' + - $ref: '#/components/schemas/BetaTextEditor_20250124' + - $ref: '#/components/schemas/BetaTextEditor_20250429' + - $ref: '#/components/schemas/BetaTextEditor_20250728' + - $ref: '#/components/schemas/BetaWebSearchTool_20250305' + - $ref: '#/components/schemas/BetaWebFetchTool_20250910' + - $ref: '#/components/schemas/BetaToolSearchToolBM25_20251119' + - $ref: '#/components/schemas/BetaToolSearchToolRegex_20251119' + - $ref: '#/components/schemas/BetaMCPToolset' + title: Tools + type: array + top_k: + description: >- + Only sample from the top K options for each subsequent token. + + + Used to remove "long tail" low probability responses. [Learn more technical details + here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277). + + + Recommended for advanced use cases only. You usually only need to use `temperature`. + examples: + - 5 + minimum: 0 + title: Top K + type: integer + top_p: + description: >- + Use nucleus sampling. + + + In 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. + + + Recommended for advanced use cases only. You usually only need to use `temperature`. + examples: + - 0.7 + maximum: 1 + minimum: 0 + title: Top P + type: number + required: + - model + - messages + - max_tokens + title: CreateMessageParams + type: object + BetaCreateSkillResponse: + properties: + created_at: + type: string + title: Created At + description: ISO 8601 timestamp of when the skill was created. + examples: + - '2024-10-30T23:58:27.427722Z' + display_title: + anyOf: + - type: string + - type: 'null' + title: Display Title + description: |- + Display title for the skill. + + This is a human-readable label that is not included in the prompt sent to the model. + examples: + - My Custom Skill + id: + type: string + title: Id + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + examples: + - skill_01JAbcdefghijklmnopqrstuvw + latest_version: + anyOf: + - type: string + - type: 'null' + title: Latest Version + description: |- + The latest version identifier for the skill. + + This represents the most recent version of the skill that has been created. + examples: + - '1759178010641129' + source: + type: string + title: Source + description: |- + Source of the skill. + + This may be one of the following values: + * `"custom"`: the skill was created by a user + * `"anthropic"`: the skill was created by Anthropic + examples: + - custom + type: + type: string + title: Type + description: |- + Object type. + + For Skills, this is always `"skill"`. + default: skill + updated_at: + type: string + title: Updated At + description: ISO 8601 timestamp of when the skill was last updated. + examples: + - '2024-10-30T23:58:27.427722Z' + type: object + required: + - created_at + - display_title + - id + - latest_version + - source + - type + - updated_at + title: CreateSkillResponse + BetaCreateSkillVersionResponse: + properties: + created_at: + type: string + title: Created At + description: ISO 8601 timestamp of when the skill version was created. + examples: + - '2024-10-30T23:58:27.427722Z' + description: + type: string + title: Description + description: |- + Description of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + examples: + - A custom skill for doing something useful + directory: + type: string + title: Directory + description: |- + Directory name of the skill version. + + This is the top-level directory name that was extracted from the uploaded files. + examples: + - my-skill + id: + type: string + title: Id + description: |- + Unique identifier for the skill version. + + The format and length of IDs may change over time. + examples: + - skillver_01JAbcdefghijklmnopqrstuvw + name: + type: string + title: Name + description: |- + Human-readable name of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + examples: + - my-skill + skill_id: + type: string + title: Skill Id + description: Identifier for the skill that this version belongs to. + examples: + - skill_01JAbcdefghijklmnopqrstuvw + type: + type: string + title: Type + description: |- + Object type. + + For Skill Versions, this is always `"skill_version"`. + default: skill_version + version: + type: string + title: Version + description: |- + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + examples: + - '1759178010641129' + type: object + required: + - created_at + - description + - directory + - id + - name + - skill_id + - type + - version + title: CreateSkillVersionResponse + BetaDeleteMessageBatchResponse: + properties: + id: + type: string + title: Id + description: ID of the Message Batch. + examples: + - msgbatch_013Zva2CMHLNnXjNJJKqJ2EF + type: + type: string + const: message_batch_deleted + title: Type + description: |- + Deleted object type. + + For Message Batches, this is always `"message_batch_deleted"`. + default: message_batch_deleted + type: object + required: + - id + - type + title: DeleteMessageBatchResponse + BetaDeleteSkillResponse: + properties: + id: + type: string + title: Id + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + examples: + - skill_01JAbcdefghijklmnopqrstuvw + type: + type: string + title: Type + description: |- + Deleted object type. + + For Skills, this is always `"skill_deleted"`. + default: skill_deleted + type: object + required: + - id + - type + title: DeleteSkillResponse + BetaDeleteSkillVersionResponse: + properties: + id: + type: string + title: Id + description: |- + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + examples: + - '1759178010641129' + type: + type: string + title: Type + description: |- + Deleted object type. + + For Skill Versions, this is always `"skill_version_deleted"`. + default: skill_version_deleted + type: object + required: + - id + - type + title: DeleteSkillVersionResponse + BetaDirectCaller: + additionalProperties: false + description: Tool invocation directly from the model. + properties: + type: + const: direct + title: Type + type: string + required: + - type + title: DirectCaller + type: object + BetaEffortLevel: + description: All possible effort levels. + enum: + - low + - medium + - high + title: EffortLevel + type: string + BetaErrorResponse: + properties: + error: + discriminator: + mapping: + api_error: '#/components/schemas/BetaAPIError' + authentication_error: '#/components/schemas/BetaAuthenticationError' + billing_error: '#/components/schemas/BetaBillingError' + invalid_request_error: '#/components/schemas/BetaInvalidRequestError' + not_found_error: '#/components/schemas/BetaNotFoundError' + overloaded_error: '#/components/schemas/BetaOverloadedError' + permission_error: '#/components/schemas/BetaPermissionError' + rate_limit_error: '#/components/schemas/BetaRateLimitError' + timeout_error: '#/components/schemas/BetaGatewayTimeoutError' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaInvalidRequestError' + - $ref: '#/components/schemas/BetaAuthenticationError' + - $ref: '#/components/schemas/BetaBillingError' + - $ref: '#/components/schemas/BetaPermissionError' + - $ref: '#/components/schemas/BetaNotFoundError' + - $ref: '#/components/schemas/BetaRateLimitError' + - $ref: '#/components/schemas/BetaGatewayTimeoutError' + - $ref: '#/components/schemas/BetaAPIError' + - $ref: '#/components/schemas/BetaOverloadedError' + title: Error + request_id: + anyOf: + - type: string + - type: 'null' + default: null + title: Request Id + type: + const: error + default: error + title: Type + type: string + required: + - error + - request_id + - type + title: ErrorResponse + type: object + BetaErrorType: + enum: + - invalid_request_error + - authentication_error + - permission_error + - not_found_error + - rate_limit_error + - timeout_error + - overloaded_error + - api_error + - billing_error + title: ErrorType + type: string + BetaErroredResult: + properties: + error: + $ref: '#/components/schemas/BetaErrorResponse' + type: + const: errored + default: errored + title: Type + type: string + required: + - error + - type + title: ErroredResult + type: object + BetaExpiredResult: + properties: + type: + const: expired + default: expired + title: Type + type: string + required: + - type + title: ExpiredResult + type: object + BetaFileDeleteResponse: + properties: + id: + type: string + title: Id + description: ID of the deleted file. + type: + type: string + const: file_deleted + title: Type + description: |- + Deleted object type. + + For file deletion, this is always `"file_deleted"`. + default: file_deleted + type: object + required: + - id + title: FileDeleteResponse + BetaFileDocumentSource: + additionalProperties: false + properties: + file_id: + title: File Id + type: string + type: + const: file + title: Type + type: string + required: + - file_id + - type + title: FileDocumentSource + type: object + BetaFileImageSource: + additionalProperties: false + properties: + file_id: + title: File Id + type: string + type: + const: file + title: Type + type: string + required: + - file_id + - type + title: FileImageSource + type: object + BetaFileListResponse: + properties: + data: + items: + $ref: '#/components/schemas/BetaFileMetadataSchema' + type: array + title: Data + description: List of file metadata objects. + first_id: + anyOf: + - type: string + - type: 'null' + title: First Id + description: ID of the first file in this page of results. + has_more: + type: boolean + title: Has More + description: Whether there are more results available. + default: false + last_id: + anyOf: + - type: string + - type: 'null' + title: Last Id + description: ID of the last file in this page of results. + type: object + required: + - data + title: FileListResponse + BetaFileMetadataSchema: + properties: + created_at: + type: string + format: date-time + title: Created At + description: RFC 3339 datetime string representing when the file was created. + downloadable: + type: boolean + title: Downloadable + description: Whether the file can be downloaded. + default: false + filename: + type: string + maxLength: 500 + minLength: 1 + title: Filename + description: Original filename of the uploaded file. + id: + type: string + title: Id + description: |- + Unique object identifier. + + The format and length of IDs may change over time. + mime_type: + type: string + maxLength: 255 + minLength: 1 + title: Mime Type + description: MIME type of the file. + size_bytes: + type: integer + minimum: 0 + title: Size Bytes + description: Size of the file in bytes. + type: + type: string + const: file + title: Type + description: |- + Object type. + + For files, this is always `"file"`. + type: object + required: + - created_at + - filename + - id + - mime_type + - size_bytes + - type + title: FileMetadataSchema + BetaGatewayTimeoutError: + properties: + message: + default: Request timeout + title: Message + type: string + type: + const: timeout_error + default: timeout_error + title: Type + type: string + required: + - message + - type + title: GatewayTimeoutError + type: object + BetaGetSkillResponse: + properties: + created_at: + type: string + title: Created At + description: ISO 8601 timestamp of when the skill was created. + examples: + - '2024-10-30T23:58:27.427722Z' + display_title: + anyOf: + - type: string + - type: 'null' + title: Display Title + description: |- + Display title for the skill. + + This is a human-readable label that is not included in the prompt sent to the model. + examples: + - My Custom Skill + id: + type: string + title: Id + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + examples: + - skill_01JAbcdefghijklmnopqrstuvw + latest_version: + anyOf: + - type: string + - type: 'null' + title: Latest Version + description: |- + The latest version identifier for the skill. + + This represents the most recent version of the skill that has been created. + examples: + - '1759178010641129' + source: + type: string + title: Source + description: |- + Source of the skill. + + This may be one of the following values: + * `"custom"`: the skill was created by a user + * `"anthropic"`: the skill was created by Anthropic + examples: + - custom + type: + type: string + title: Type + description: |- + Object type. + + For Skills, this is always `"skill"`. + default: skill + updated_at: + type: string + title: Updated At + description: ISO 8601 timestamp of when the skill was last updated. + examples: + - '2024-10-30T23:58:27.427722Z' + type: object + required: + - created_at + - display_title + - id + - latest_version + - source + - type + - updated_at + title: GetSkillResponse + BetaGetSkillVersionResponse: + properties: + created_at: + type: string + title: Created At + description: ISO 8601 timestamp of when the skill version was created. + examples: + - '2024-10-30T23:58:27.427722Z' + description: + type: string + title: Description + description: |- + Description of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + examples: + - A custom skill for doing something useful + directory: + type: string + title: Directory + description: |- + Directory name of the skill version. + + This is the top-level directory name that was extracted from the uploaded files. + examples: + - my-skill + id: + type: string + title: Id + description: |- + Unique identifier for the skill version. + + The format and length of IDs may change over time. + examples: + - skillver_01JAbcdefghijklmnopqrstuvw + name: + type: string + title: Name + description: |- + Human-readable name of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + examples: + - my-skill + skill_id: + type: string + title: Skill Id + description: Identifier for the skill that this version belongs to. + examples: + - skill_01JAbcdefghijklmnopqrstuvw + type: + type: string + title: Type + description: |- + Object type. + + For Skill Versions, this is always `"skill_version"`. + default: skill_version + version: + type: string + title: Version + description: |- + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + examples: + - '1759178010641129' + type: object + required: + - created_at + - description + - directory + - id + - name + - skill_id + - type + - version + title: GetSkillVersionResponse + BetaInputJsonContentBlockDelta: + properties: + partial_json: + title: Partial Json + type: string + type: + const: input_json_delta + default: input_json_delta + title: Type + type: string + required: + - partial_json + - type + title: InputJsonContentBlockDelta + type: object + BetaInputMessage: + additionalProperties: false + properties: + content: + anyOf: + - type: string + x-stainless-skip: + - go + - cli + - items: + $ref: '#/components/schemas/BetaInputContentBlock' + type: array + example: + - type: text + text: What is a quaternion? + title: Content + role: + enum: + - user + - assistant + title: Role + type: string + required: + - content + - role + title: InputMessage + type: object + discriminator: + propertyName: role + BetaInputSchema: + additionalProperties: true + properties: + properties: + anyOf: + - additionalProperties: true + type: object + - type: 'null' + title: Properties + required: + anyOf: + - items: + type: string + type: array + - type: 'null' + title: Required + type: + const: object + title: Type + type: string + required: + - type + title: InputSchema + type: object + BetaInputTokensClearAtLeast: + additionalProperties: false + properties: + type: + const: input_tokens + title: Type + type: string + value: + minimum: 0 + title: Value + type: integer + required: + - type + - value + title: InputTokensClearAtLeast + type: object + BetaInputTokensTrigger: + additionalProperties: false + properties: + type: + const: input_tokens + title: Type + type: string + value: + minimum: 1 + title: Value + type: integer + required: + - type + - value + title: InputTokensTrigger + type: object + BetaInvalidRequestError: + properties: + message: + default: Invalid request + title: Message + type: string + type: + const: invalid_request_error + default: invalid_request_error + title: Type + type: string + required: + - message + - type + title: InvalidRequestError + type: object + BetaJsonOutputFormat: + additionalProperties: false + properties: + schema: + additionalProperties: true + description: The JSON schema of the format + title: Schema + type: object + type: + const: json_schema + title: Type + type: string + required: + - schema + - type + title: JsonOutputFormat + type: object + BetaJsonValue: {} + BetaListResponse_MessageBatch_: + properties: + data: + items: + $ref: '#/components/schemas/BetaMessageBatch' + type: array + title: Data + first_id: + anyOf: + - type: string + - type: 'null' + title: First Id + description: First ID in the `data` list. Can be used as the `before_id` for the previous page. + has_more: + type: boolean + title: Has More + description: Indicates if there are more results in the requested page direction. + last_id: + anyOf: + - type: string + - type: 'null' + title: Last Id + description: Last ID in the `data` list. Can be used as the `after_id` for the next page. + type: object + required: + - data + - first_id + - has_more + - last_id + title: ListResponse[MessageBatch] + BetaListResponse_ModelInfo_: + properties: + data: + items: + $ref: '#/components/schemas/BetaModelInfo' + type: array + title: Data + first_id: + anyOf: + - type: string + - type: 'null' + title: First Id + description: First ID in the `data` list. Can be used as the `before_id` for the previous page. + has_more: + type: boolean + title: Has More + description: Indicates if there are more results in the requested page direction. + last_id: + anyOf: + - type: string + - type: 'null' + title: Last Id + description: Last ID in the `data` list. Can be used as the `after_id` for the next page. + type: object + required: + - data + - first_id + - has_more + - last_id + title: ListResponse[ModelInfo] + BetaListSkillVersionsResponse: + properties: + data: + items: + $ref: '#/components/schemas/BetaSkillVersion' + type: array + title: Data + description: List of skill versions. + x-stainless-pagination-property: + purpose: items + has_more: + type: boolean + title: Has More + description: Indicates if there are more results in the requested page direction. + next_page: + anyOf: + - type: string + - type: 'null' + title: Next Page + description: Token to provide in as `page` in the subsequent request to retrieve the next page of data. + examples: + - page_MjAyNS0wNS0xNFQwMDowMDowMFo= + - null + x-stainless-pagination-property: + purpose: next_cursor_field + type: object + required: + - data + - has_more + - next_page + title: ListSkillVersionsResponse + BetaListSkillsResponse: + properties: + data: + items: + $ref: '#/components/schemas/Betaapi__schemas__skills__Skill' + type: array + title: Data + description: List of skills. + x-stainless-pagination-property: + purpose: items + has_more: + type: boolean + title: Has More + description: |- + Whether there are more results available. + + If `true`, there are additional results that can be fetched using the `next_page` token. + next_page: + anyOf: + - type: string + - type: 'null' + title: Next Page + description: >- + Token for fetching the next page of results. + + + If `null`, there are no more results available. Pass this value to the `page_token` parameter in + the next request to get the next page. + examples: + - page_MjAyNS0wNS0xNFQwMDowMDowMFo= + - null + x-stainless-pagination-property: + purpose: next_cursor_field + type: object + required: + - data + - has_more + - next_page + title: ListSkillsResponse + BetaMCPToolConfig: + additionalProperties: false + description: Configuration for a specific tool in an MCP toolset. + properties: + defer_loading: + title: Defer Loading + type: boolean + enabled: + title: Enabled + type: boolean + title: MCPToolConfig + type: object + BetaMCPToolDefaultConfig: + additionalProperties: false + description: Default configuration for tools in an MCP toolset. + properties: + defer_loading: + title: Defer Loading + type: boolean + enabled: + title: Enabled + type: boolean + title: MCPToolDefaultConfig + type: object + BetaMCPToolset: + additionalProperties: false + description: |- + Configuration for a group of tools from an MCP server. + + Allows configuring enabled status and defer_loading for all tools + from an MCP server, with optional per-tool overrides. + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + configs: + anyOf: + - additionalProperties: + $ref: '#/components/schemas/BetaMCPToolConfig' + type: object + - type: 'null' + description: Configuration overrides for specific tools, keyed by tool name + title: Configs + default_config: + $ref: '#/components/schemas/BetaMCPToolDefaultConfig' + description: Default configuration applied to all tools from this server + mcp_server_name: + description: Name of the MCP server to configure tools for + maxLength: 255 + minLength: 1 + title: Mcp Server Name + type: string + type: + const: mcp_toolset + title: Type + type: string + required: + - mcp_server_name + - type + title: MCPToolset + type: object + BetaMemoryTool_20250818: + additionalProperties: false + properties: + allowed_callers: + items: + enum: + - direct + - code_execution_20250825 + type: string + title: Allowed Callers + type: array + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + defer_loading: + description: >- + If true, tool will not be included in initial system prompt. Only loaded when returned via + tool_reference from tool search. + title: Defer Loading + type: boolean + input_examples: + items: + additionalProperties: + $ref: '#/components/schemas/BetaJsonValue' + type: object + title: Input Examples + type: array + name: + const: memory + description: |- + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + title: Name + type: string + strict: + title: Strict + type: boolean + type: + const: memory_20250818 + title: Type + type: string + required: + - name + - type + title: MemoryTool_20250818 + type: object + BetaMessage: + examples: + - content: + - citations: null + text: Hi! My name is Claude. + type: text + id: msg_013Zva2CMHLNnXjNJJKqJ2EF + model: claude-sonnet-4-5-20250929 + role: assistant + stop_reason: end_turn + stop_sequence: null + type: message + usage: + input_tokens: 2095 + output_tokens: 503 + properties: + id: + description: |- + Unique object identifier. + + The format and length of IDs may change over time. + examples: + - msg_013Zva2CMHLNnXjNJJKqJ2EF + title: Id + type: string + type: + const: message + default: message + description: |- + Object type. + + For Messages, this is always `"message"`. + title: Type + type: string + role: + const: assistant + default: assistant + description: |- + Conversational role of the generated message. + + This will always be `"assistant"`. + title: Role + type: string + content: + description: >- + Content generated by the model. + + + This is an array of content blocks, each of which has a `type` that determines its shape. + + + Example: + + + ```json + + [{"type": "text", "text": "Hi, I'm Claude."}] + + ``` + + + If 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. + + + For example, if the input `messages` were: + + ```json + + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + + ``` + + + Then the response `content` might be: + + + ```json + + [{"type": "text", "text": "B)"}] + + ``` + examples: + - - citations: null + text: Hi! My name is Claude. + type: text + items: + $ref: '#/components/schemas/BetaContentBlock' + title: Content + type: array + model: + $ref: '#/components/schemas/Model' + stop_reason: + anyOf: + - $ref: '#/components/schemas/BetaStopReason' + - type: 'null' + description: >- + The reason that we stopped. + + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + + * `"tool_use"`: the model invoked one or more tools + + * `"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. + + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the + `message_start` event and non-null otherwise. + title: Stop Reason + stop_sequence: + anyOf: + - type: string + - type: 'null' + default: null + description: |- + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + title: Stop Sequence + usage: + $ref: '#/components/schemas/BetaUsage' + description: >- + Billing and rate-limit usage. + + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to + our systems. + + + Under 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. + + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, + and `cache_read_input_tokens`. + examples: + - input_tokens: 2095 + output_tokens: 503 + context_management: + anyOf: + - $ref: '#/components/schemas/BetaResponseContextManagement' + - type: 'null' + default: null + description: |- + Context management response. + + Information about context management strategies applied during the request. + container: + anyOf: + - $ref: '#/components/schemas/BetaContainer' + - type: 'null' + default: null + description: |- + Information about the container used in this request. + + This will be non-null if a container tool (e.g. code execution) was used. + required: + - id + - type + - role + - content + - model + - stop_reason + - stop_sequence + - usage + - context_management + - container + title: Message + type: object + x-stainless-python-custom-imports: + - from .beta_content_block import BetaContentBlock as BetaContentBlock + BetaMessageBatch: + properties: + archived_at: + anyOf: + - type: string + format: date-time + - type: 'null' + title: Archived At + description: >- + RFC 3339 datetime string representing the time at which the Message Batch was archived and its + results became unavailable. + examples: + - '2024-08-20T18:37:24.100435Z' + cancel_initiated_at: + anyOf: + - type: string + format: date-time + - type: 'null' + 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. + examples: + - '2024-08-20T18:37:24.100435Z' + created_at: + type: string + format: date-time + title: Created At + description: RFC 3339 datetime string representing the time at which the Message Batch was created. + examples: + - '2024-08-20T18:37:24.100435Z' + ended_at: + anyOf: + - type: string + format: date-time + - type: 'null' + title: Ended At + description: >- + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. + Specified only once processing ends. + + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or + expired. + examples: + - '2024-08-20T18:37:24.100435Z' + expires_at: + type: string + format: date-time + 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. + examples: + - '2024-08-20T18:37:24.100435Z' + id: + type: string + title: Id + description: |- + Unique object identifier. + + The format and length of IDs may change over time. + examples: + - msgbatch_013Zva2CMHLNnXjNJJKqJ2EF + processing_status: + type: string + enum: + - in_progress + - canceling + - ended + title: Processing Status + description: Processing status of the Message Batch. + request_counts: + $ref: '#/components/schemas/BetaRequestCounts' + description: >- + Tallies requests within the Message Batch, categorized by their status. + + + Requests 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: + anyOf: + - type: string + - type: 'null' + title: Results Url + description: >- + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once + processing ends. + + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` + field to match results to requests. + examples: + - https://api.anthropic.com/v1/messages/batches/msgbatch_013Zva2CMHLNnXjNJJKqJ2EF/results + type: + type: string + const: message_batch + title: Type + description: |- + Object type. + + For Message Batches, this is always `"message_batch"`. + default: message_batch + type: object + required: + - archived_at + - cancel_initiated_at + - created_at + - ended_at + - expires_at + - id + - processing_status + - request_counts + - results_url + - type + title: MessageBatch + BetaMessageBatchIndividualRequestParams: + additionalProperties: false + properties: + 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. + + + Must be unique for each request within the Message Batch. + examples: + - my-custom-id-1 + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9_-]{1,64}$ + title: Custom Id + type: string + params: + $ref: '#/components/schemas/BetaCreateMessageParams' + description: >- + Messages API creation parameters for the individual request. + + + See the [Messages API reference](https://docs.claude.com/en/api/messages) for full documentation + on available parameters. + required: + - custom_id + - params + title: MessageBatchIndividualRequestParams + type: object + BetaMessageBatchIndividualResponse: + description: This is a single line in the response `.jsonl` file and does not represent the response as a whole. + properties: + 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. + + + Must be unique for each request within the Message Batch. + examples: + - my-custom-id-1 + title: Custom Id + type: string + result: + description: >- + Processing result for this request. + + + Contains a Message output if processing was successful, an error response if processing failed, or + the reason why processing was not attempted, such as cancellation or expiration. + discriminator: + mapping: + canceled: '#/components/schemas/BetaCanceledResult' + errored: '#/components/schemas/BetaErroredResult' + expired: '#/components/schemas/BetaExpiredResult' + succeeded: '#/components/schemas/BetaSucceededResult' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaSucceededResult' + - $ref: '#/components/schemas/BetaErroredResult' + - $ref: '#/components/schemas/BetaCanceledResult' + - $ref: '#/components/schemas/BetaExpiredResult' + title: Result + required: + - custom_id + - result + title: MessageBatchIndividualResponse + type: object + BetaMessageDelta: + properties: + container: + anyOf: + - $ref: '#/components/schemas/BetaContainer' + - type: 'null' + default: null + description: |- + Information about the container used in this request. + + This will be non-null if a container tool (e.g. code execution) was used. + stop_reason: + anyOf: + - $ref: '#/components/schemas/BetaStopReason' + - type: 'null' + default: null + title: Stop Reason + stop_sequence: + anyOf: + - type: string + - type: 'null' + default: null + title: Stop Sequence + required: + - container + - stop_reason + - stop_sequence + title: MessageDelta + type: object + BetaMessageDeltaEvent: + properties: + context_management: + anyOf: + - $ref: '#/components/schemas/BetaResponseContextManagement' + - type: 'null' + default: null + description: Information about context management strategies applied during the request + delta: + $ref: '#/components/schemas/BetaMessageDelta' + type: + const: message_delta + default: message_delta + title: Type + type: string + usage: + $ref: '#/components/schemas/BetaMessageDeltaUsage' + description: >- + Billing and rate-limit usage. + + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to + our systems. + + + Under 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. + + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, + and `cache_read_input_tokens`. + examples: + - output_tokens: 503 + required: + - context_management + - delta + - type + - usage + title: MessageDeltaEvent + type: object + BetaMessageDeltaUsage: + properties: + cache_creation_input_tokens: + anyOf: + - minimum: 0 + type: integer + - type: 'null' + default: null + description: The cumulative number of input tokens used to create the cache entry. + examples: + - 2051 + title: Cache Creation Input Tokens + cache_read_input_tokens: + anyOf: + - minimum: 0 + type: integer + - type: 'null' + default: null + description: The cumulative number of input tokens read from the cache. + examples: + - 2051 + title: Cache Read Input Tokens + input_tokens: + anyOf: + - minimum: 0 + type: integer + - type: 'null' + default: null + description: The cumulative number of input tokens which were used. + examples: + - 2095 + title: Input Tokens + output_tokens: + description: The cumulative number of output tokens which were used. + examples: + - 503 + title: Output Tokens + type: integer + server_tool_use: + anyOf: + - $ref: '#/components/schemas/BetaServerToolUsage' + - type: 'null' + default: null + description: The number of server tool requests. + required: + - cache_creation_input_tokens + - cache_read_input_tokens + - input_tokens + - output_tokens + - server_tool_use + title: MessageDeltaUsage + type: object + BetaMessageStartEvent: + properties: + message: + $ref: '#/components/schemas/BetaMessage' + type: + const: message_start + default: message_start + title: Type + type: string + required: + - message + - type + title: MessageStartEvent + type: object + BetaMessageStopEvent: + properties: + type: + const: message_stop + default: message_stop + title: Type + type: string + required: + - type + title: MessageStopEvent + type: object + BetaMessageStreamEvent: + discriminator: + mapping: + content_block_delta: '#/components/schemas/BetaContentBlockDeltaEvent' + content_block_start: '#/components/schemas/BetaContentBlockStartEvent' + content_block_stop: '#/components/schemas/BetaContentBlockStopEvent' + message_delta: '#/components/schemas/BetaMessageDeltaEvent' + message_start: '#/components/schemas/BetaMessageStartEvent' + message_stop: '#/components/schemas/BetaMessageStopEvent' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaMessageStartEvent' + - $ref: '#/components/schemas/BetaMessageDeltaEvent' + - $ref: '#/components/schemas/BetaMessageStopEvent' + - $ref: '#/components/schemas/BetaContentBlockStartEvent' + - $ref: '#/components/schemas/BetaContentBlockDeltaEvent' + - $ref: '#/components/schemas/BetaContentBlockStopEvent' + title: MessageStreamEvent + BetaMetadata: + additionalProperties: false + properties: + user_id: + anyOf: + - maxLength: 256 + type: string + - type: 'null' + description: >- + An external identifier for the user who is associated with the request. + + + This 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. + examples: + - 13803d75-b4b5-4c3e-b2a2-6f21399b021b + title: User Id + title: Metadata + type: object + BetaModelInfo: + properties: + created_at: + type: string + format: date-time + 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. + examples: + - '2025-02-19T00:00:00Z' + display_name: + type: string + title: Display Name + description: A human-readable name for the model. + examples: + - Claude Sonnet 4 + id: + type: string + title: Id + description: Unique model identifier. + examples: + - claude-sonnet-4-20250514 + type: + type: string + const: model + title: Type + description: |- + Object type. + + For Models, this is always `"model"`. + default: model + type: object + required: + - created_at + - display_name + - id + - type + title: ModelInfo + BetaNotFoundError: + properties: + message: + default: Not found + title: Message + type: string + type: + const: not_found_error + default: not_found_error + title: Type + type: string + required: + - message + - type + title: NotFoundError + type: object + BetaOutputConfig: + additionalProperties: false + properties: + effort: + anyOf: + - $ref: '#/components/schemas/BetaEffortLevel' + - type: 'null' + 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`, or `high`. + format: + anyOf: + - $ref: '#/components/schemas/BetaJsonOutputFormat' + - type: 'null' + 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) + title: OutputConfig + type: object + BetaOverloadedError: + properties: + message: + default: Overloaded + title: Message + type: string + type: + const: overloaded_error + default: overloaded_error + title: Type + type: string + required: + - message + - type + title: OverloadedError + type: object + BetaPermissionError: + properties: + message: + default: Permission denied + title: Message + type: string + type: + const: permission_error + default: permission_error + title: Type + type: string + required: + - message + - type + title: PermissionError + type: object + BetaPlainTextSource: + additionalProperties: false + properties: + data: + title: Data + type: string + media_type: + const: text/plain + title: Media Type + type: string + type: + const: text + title: Type + type: string + required: + - data + - media_type + - type + title: PlainTextSource + type: object + BetaRateLimitError: + properties: + message: + default: Rate limited + title: Message + type: string + type: + const: rate_limit_error + default: rate_limit_error + title: Type + type: string + required: + - message + - type + title: RateLimitError + type: object + BetaRequestBashCodeExecutionOutputBlock: + additionalProperties: false + properties: + file_id: + title: File Id + type: string + type: + const: bash_code_execution_output + title: Type + type: string + required: + - file_id + - type + title: RequestBashCodeExecutionOutputBlock + type: object + BetaRequestBashCodeExecutionResultBlock: + additionalProperties: false + properties: + content: + items: + $ref: '#/components/schemas/BetaRequestBashCodeExecutionOutputBlock' + title: Content + type: array + return_code: + title: Return Code + type: integer + stderr: + title: Stderr + type: string + stdout: + title: Stdout + type: string + type: + const: bash_code_execution_result + title: Type + type: string + required: + - content + - return_code + - stderr + - stdout + - type + title: RequestBashCodeExecutionResultBlock + type: object + BetaRequestBashCodeExecutionToolResultBlock: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + content: + anyOf: + - $ref: '#/components/schemas/BetaRequestBashCodeExecutionToolResultError' + - $ref: '#/components/schemas/BetaRequestBashCodeExecutionResultBlock' + title: Content + tool_use_id: + pattern: ^srvtoolu_[a-zA-Z0-9_]+$ + title: Tool Use Id + type: string + type: + const: bash_code_execution_tool_result + title: Type + type: string + required: + - content + - tool_use_id + - type + title: RequestBashCodeExecutionToolResultBlock + type: object + BetaRequestBashCodeExecutionToolResultError: + additionalProperties: false + properties: + error_code: + $ref: '#/components/schemas/BetaBashCodeExecutionToolResultErrorCode' + type: + const: bash_code_execution_tool_result_error + title: Type + type: string + required: + - error_code + - type + title: RequestBashCodeExecutionToolResultError + type: object + BetaRequestCharLocationCitation: + additionalProperties: false + properties: + cited_text: + title: Cited Text + type: string + document_index: + minimum: 0 + title: Document Index + type: integer + document_title: + anyOf: + - maxLength: 255 + minLength: 1 + type: string + - type: 'null' + title: Document Title + end_char_index: + title: End Char Index + type: integer + start_char_index: + minimum: 0 + title: Start Char Index + type: integer + type: + const: char_location + title: Type + type: string + required: + - cited_text + - document_index + - document_title + - end_char_index + - start_char_index + - type + title: RequestCharLocationCitation + type: object + BetaRequestCitationsConfig: + additionalProperties: false + properties: + enabled: + title: Enabled + type: boolean + title: RequestCitationsConfig + type: object + BetaRequestCodeExecutionOutputBlock: + additionalProperties: false + properties: + file_id: + title: File Id + type: string + type: + const: code_execution_output + title: Type + type: string + required: + - file_id + - type + title: RequestCodeExecutionOutputBlock + type: object + BetaRequestCodeExecutionResultBlock: + additionalProperties: false + properties: + content: + items: + $ref: '#/components/schemas/BetaRequestCodeExecutionOutputBlock' + title: Content + type: array + return_code: + title: Return Code + type: integer + stderr: + title: Stderr + type: string + stdout: + title: Stdout + type: string + type: + const: code_execution_result + title: Type + type: string + required: + - content + - return_code + - stderr + - stdout + - type + title: Result Block + type: object + BetaRequestCodeExecutionToolResultBlock: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + content: + anyOf: + - $ref: '#/components/schemas/BetaRequestCodeExecutionToolResultError' + x-stainless-naming: + go: + variant_constructor: BetaNewCodeExecutionToolRequestError + - $ref: '#/components/schemas/BetaRequestCodeExecutionResultBlock' + title: Content + tool_use_id: + pattern: ^srvtoolu_[a-zA-Z0-9_]+$ + title: Tool Use Id + type: string + type: + const: code_execution_tool_result + title: Type + type: string + required: + - content + - tool_use_id + - type + title: RequestCodeExecutionToolResultBlock + type: object + BetaRequestCodeExecutionToolResultError: + additionalProperties: false + properties: + error_code: + $ref: '#/components/schemas/BetaCodeExecutionToolResultErrorCode' + type: + const: code_execution_tool_result_error + title: Type + type: string + required: + - error_code + - type + title: Error + type: object + BetaRequestContainerUploadBlock: + additionalProperties: false + description: |- + A content block that represents a file to be uploaded to the container + Files uploaded via this block will be available in the container's input directory. + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + file_id: + title: File Id + type: string + type: + const: container_upload + title: Type + type: string + required: + - file_id + - type + title: RequestContainerUploadBlock + type: object + BetaRequestContentBlockLocationCitation: + additionalProperties: false + properties: + cited_text: + title: Cited Text + type: string + document_index: + minimum: 0 + title: Document Index + type: integer + document_title: + anyOf: + - maxLength: 255 + minLength: 1 + type: string + - type: 'null' + title: Document Title + end_block_index: + title: End Block Index + type: integer + start_block_index: + minimum: 0 + title: Start Block Index + type: integer + type: + const: content_block_location + title: Type + type: string + required: + - cited_text + - document_index + - document_title + - end_block_index + - start_block_index + - type + title: RequestContentBlockLocationCitation + type: object + BetaRequestCounts: + properties: + canceled: + type: integer + title: Canceled + description: |- + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + default: 0 + examples: + - 10 + errored: + type: integer + title: Errored + description: |- + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + default: 0 + examples: + - 30 + expired: + type: integer + title: Expired + description: |- + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + default: 0 + examples: + - 10 + processing: + type: integer + title: Processing + description: Number of requests in the Message Batch that are processing. + default: 0 + examples: + - 100 + succeeded: + type: integer + title: Succeeded + description: |- + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + default: 0 + examples: + - 50 + type: object + required: + - canceled + - errored + - expired + - processing + - succeeded + title: RequestCounts + BetaRequestDocumentBlock: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + citations: + anyOf: + - $ref: '#/components/schemas/BetaRequestCitationsConfig' + - type: 'null' + context: + anyOf: + - minLength: 1 + type: string + - type: 'null' + title: Context + source: + discriminator: + mapping: + base64: '#/components/schemas/BetaBase64PDFSource' + content: '#/components/schemas/BetaContentBlockSource' + file: '#/components/schemas/BetaFileDocumentSource' + text: '#/components/schemas/BetaPlainTextSource' + url: '#/components/schemas/BetaURLPDFSource' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaBase64PDFSource' + - $ref: '#/components/schemas/BetaPlainTextSource' + - $ref: '#/components/schemas/BetaContentBlockSource' + - $ref: '#/components/schemas/BetaURLPDFSource' + - $ref: '#/components/schemas/BetaFileDocumentSource' + title: Source + title: + anyOf: + - maxLength: 500 + minLength: 1 + type: string + - type: 'null' + title: Title + type: + const: document + title: Type + type: string + required: + - source + - type + title: RequestDocumentBlock + type: object + BetaRequestImageBlock: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + source: + discriminator: + mapping: + base64: '#/components/schemas/BetaBase64ImageSource' + file: '#/components/schemas/BetaFileImageSource' + url: '#/components/schemas/BetaURLImageSource' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaBase64ImageSource' + - $ref: '#/components/schemas/BetaURLImageSource' + - $ref: '#/components/schemas/BetaFileImageSource' + title: Source + type: + const: image + title: Type + type: string + required: + - source + - type + title: RequestImageBlock + type: object + BetaRequestMCPServerToolConfiguration: + additionalProperties: false + properties: + allowed_tools: + anyOf: + - items: + type: string + type: array + - type: 'null' + title: Allowed Tools + enabled: + anyOf: + - type: boolean + - type: 'null' + title: Enabled + title: RequestMCPServerToolConfiguration + type: object + BetaRequestMCPServerURLDefinition: + additionalProperties: false + properties: + authorization_token: + anyOf: + - type: string + - type: 'null' + title: Authorization Token + name: + title: Name + type: string + tool_configuration: + anyOf: + - $ref: '#/components/schemas/BetaRequestMCPServerToolConfiguration' + - type: 'null' + type: + const: url + title: Type + type: string + url: + title: Url + type: string + required: + - name + - type + - url + title: RequestMCPServerURLDefinition + type: object + BetaRequestMCPToolResultBlock: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + content: + anyOf: + - type: string + - items: + $ref: '#/components/schemas/BetaRequestTextBlock' + title: beta_mcp_tool_result_block_param_content_item + type: array + title: beta_mcp_tool_result_block_param_content + title: Content + is_error: + title: Is Error + type: boolean + tool_use_id: + pattern: ^[a-zA-Z0-9_-]+$ + title: Tool Use Id + type: string + type: + const: mcp_tool_result + title: Type + type: string + required: + - tool_use_id + - type + title: RequestMCPToolResultBlock + type: object + BetaRequestMCPToolUseBlock: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + id: + pattern: ^[a-zA-Z0-9_-]+$ + title: Id + type: string + input: + additionalProperties: true + title: Input + type: object + name: + title: Name + type: string + server_name: + description: The name of the MCP server + title: Server Name + type: string + type: + const: mcp_tool_use + title: Type + type: string + required: + - id + - input + - name + - server_name + - type + title: RequestMCPToolUseBlock + type: object + BetaRequestPageLocationCitation: + additionalProperties: false + properties: + cited_text: + title: Cited Text + type: string + document_index: + minimum: 0 + title: Document Index + type: integer + document_title: + anyOf: + - maxLength: 255 + minLength: 1 + type: string + - type: 'null' + title: Document Title + end_page_number: + title: End Page Number + type: integer + start_page_number: + minimum: 1 + title: Start Page Number + type: integer + type: + const: page_location + title: Type + type: string + required: + - cited_text + - document_index + - document_title + - end_page_number + - start_page_number + - type + title: RequestPageLocationCitation + type: object + BetaRequestRedactedThinkingBlock: + additionalProperties: false + properties: + data: + title: Data + type: string + type: + const: redacted_thinking + title: Type + type: string + required: + - data + - type + title: RequestRedactedThinkingBlock + type: object + BetaRequestSearchResultBlock: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + citations: + $ref: '#/components/schemas/BetaRequestCitationsConfig' + content: + items: + $ref: '#/components/schemas/BetaRequestTextBlock' + title: Content + type: array + source: + title: Source + type: string + title: + title: Title + type: string + type: + const: search_result + title: Type + type: string + required: + - content + - source + - title + - type + title: RequestSearchResultBlock + type: object + BetaRequestSearchResultLocationCitation: + additionalProperties: false + properties: + cited_text: + title: Cited Text + type: string + end_block_index: + title: End Block Index + type: integer + search_result_index: + minimum: 0 + title: Search Result Index + type: integer + source: + title: Source + type: string + start_block_index: + minimum: 0 + title: Start Block Index + type: integer + title: + anyOf: + - type: string + - type: 'null' + title: Title + type: + const: search_result_location + title: Type + type: string + required: + - cited_text + - end_block_index + - search_result_index + - source + - start_block_index + - title + - type + title: RequestSearchResultLocationCitation + type: object + BetaRequestServerToolUseBlock: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + caller: + discriminator: + mapping: + code_execution_20250825: '#/components/schemas/BetaServerToolCaller' + direct: '#/components/schemas/BetaDirectCaller' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaDirectCaller' + - $ref: '#/components/schemas/BetaServerToolCaller' + title: Caller + id: + pattern: ^srvtoolu_[a-zA-Z0-9_]+$ + title: Id + type: string + input: + additionalProperties: true + title: Input + type: object + name: + enum: + - web_search + - web_fetch + - code_execution + - bash_code_execution + - text_editor_code_execution + - tool_search_tool_regex + - tool_search_tool_bm25 + title: Name + type: string + type: + const: server_tool_use + title: Type + type: string + required: + - id + - input + - name + - type + title: RequestServerToolUseBlock + type: object + BetaRequestTextBlock: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + citations: + anyOf: + - items: + discriminator: + mapping: + char_location: '#/components/schemas/BetaRequestCharLocationCitation' + content_block_location: '#/components/schemas/BetaRequestContentBlockLocationCitation' + page_location: '#/components/schemas/BetaRequestPageLocationCitation' + search_result_location: '#/components/schemas/BetaRequestSearchResultLocationCitation' + web_search_result_location: '#/components/schemas/BetaRequestWebSearchResultLocationCitation' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaRequestCharLocationCitation' + - $ref: '#/components/schemas/BetaRequestPageLocationCitation' + - $ref: '#/components/schemas/BetaRequestContentBlockLocationCitation' + - $ref: '#/components/schemas/BetaRequestWebSearchResultLocationCitation' + - $ref: '#/components/schemas/BetaRequestSearchResultLocationCitation' + type: array + - type: 'null' + title: Citations + text: + minLength: 1 + title: Text + type: string + type: + const: text + title: Type + type: string + required: + - text + - type + title: RequestTextBlock + type: object + BetaRequestTextEditorCodeExecutionCreateResultBlock: + additionalProperties: false + properties: + is_file_update: + title: Is File Update + type: boolean + type: + const: text_editor_code_execution_create_result + title: Type + type: string + required: + - is_file_update + - type + title: RequestTextEditorCodeExecutionCreateResultBlock + type: object + BetaRequestTextEditorCodeExecutionStrReplaceResultBlock: + additionalProperties: false + properties: + lines: + anyOf: + - items: + type: string + type: array + - type: 'null' + title: Lines + new_lines: + anyOf: + - type: integer + - type: 'null' + title: New Lines + new_start: + anyOf: + - type: integer + - type: 'null' + title: New Start + old_lines: + anyOf: + - type: integer + - type: 'null' + title: Old Lines + old_start: + anyOf: + - type: integer + - type: 'null' + title: Old Start + type: + const: text_editor_code_execution_str_replace_result + title: Type + type: string + required: + - type + title: RequestTextEditorCodeExecutionStrReplaceResultBlock + type: object + BetaRequestTextEditorCodeExecutionToolResultBlock: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + content: + anyOf: + - $ref: '#/components/schemas/BetaRequestTextEditorCodeExecutionToolResultError' + - $ref: '#/components/schemas/BetaRequestTextEditorCodeExecutionViewResultBlock' + - $ref: '#/components/schemas/BetaRequestTextEditorCodeExecutionCreateResultBlock' + - $ref: '#/components/schemas/BetaRequestTextEditorCodeExecutionStrReplaceResultBlock' + title: Content + tool_use_id: + pattern: ^srvtoolu_[a-zA-Z0-9_]+$ + title: Tool Use Id + type: string + type: + const: text_editor_code_execution_tool_result + title: Type + type: string + required: + - content + - tool_use_id + - type + title: RequestTextEditorCodeExecutionToolResultBlock + type: object + BetaRequestTextEditorCodeExecutionToolResultError: + additionalProperties: false + properties: + error_code: + $ref: '#/components/schemas/BetaTextEditorCodeExecutionToolResultErrorCode' + error_message: + anyOf: + - type: string + - type: 'null' + title: Error Message + type: + const: text_editor_code_execution_tool_result_error + title: Type + type: string + required: + - error_code + - type + title: RequestTextEditorCodeExecutionToolResultError + type: object + BetaRequestTextEditorCodeExecutionViewResultBlock: + additionalProperties: false + properties: + content: + title: Content + type: string + file_type: + enum: + - text + - image + - pdf + title: File Type + type: string + num_lines: + anyOf: + - type: integer + - type: 'null' + title: Num Lines + start_line: + anyOf: + - type: integer + - type: 'null' + title: Start Line + total_lines: + anyOf: + - type: integer + - type: 'null' + title: Total Lines + type: + const: text_editor_code_execution_view_result + title: Type + type: string + required: + - content + - file_type + - type + title: RequestTextEditorCodeExecutionViewResultBlock + type: object + BetaRequestThinkingBlock: + additionalProperties: false + properties: + signature: + title: Signature + type: string + thinking: + title: Thinking + type: string + type: + const: thinking + title: Type + type: string + required: + - signature + - thinking + - type + title: RequestThinkingBlock + type: object + BetaRequestToolReferenceBlock: + additionalProperties: false + description: Tool reference block that can be included in tool_result content. + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + tool_name: + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9_-]{1,64}$ + title: Tool Name + type: string + type: + const: tool_reference + title: Type + type: string + required: + - tool_name + - type + title: RequestToolReferenceBlock + type: object + BetaRequestToolResultBlock: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + content: + anyOf: + - type: string + x-stainless-skip: + - go + - cli + - items: + discriminator: + mapping: + document: '#/components/schemas/BetaRequestDocumentBlock' + image: '#/components/schemas/BetaRequestImageBlock' + search_result: '#/components/schemas/BetaRequestSearchResultBlock' + text: '#/components/schemas/BetaRequestTextBlock' + tool_reference: '#/components/schemas/BetaRequestToolReferenceBlock' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaRequestTextBlock' + - $ref: '#/components/schemas/BetaRequestImageBlock' + - $ref: '#/components/schemas/BetaRequestSearchResultBlock' + - $ref: '#/components/schemas/BetaRequestDocumentBlock' + - $ref: '#/components/schemas/BetaRequestToolReferenceBlock' + title: Block + type: array + x-stainless-naming: + python: + type_name: Content + ruby: + type_name: Content + title: Content + is_error: + title: Is Error + type: boolean + tool_use_id: + pattern: ^[a-zA-Z0-9_-]+$ + title: Tool Use Id + type: string + type: + const: tool_result + title: Type + type: string + required: + - tool_use_id + - type + title: RequestToolResultBlock + type: object + BetaRequestToolSearchToolResultBlock: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + content: + anyOf: + - $ref: '#/components/schemas/BetaRequestToolSearchToolResultError' + - $ref: '#/components/schemas/BetaRequestToolSearchToolSearchResultBlock' + title: Content + tool_use_id: + pattern: ^srvtoolu_[a-zA-Z0-9_]+$ + title: Tool Use Id + type: string + type: + const: tool_search_tool_result + title: Type + type: string + required: + - content + - tool_use_id + - type + title: RequestToolSearchToolResultBlock + type: object + BetaRequestToolSearchToolResultError: + additionalProperties: false + properties: + error_code: + $ref: '#/components/schemas/BetaToolSearchToolResultErrorCode' + type: + const: tool_search_tool_result_error + title: Type + type: string + required: + - error_code + - type + title: RequestToolSearchToolResultError + type: object + BetaRequestToolSearchToolSearchResultBlock: + additionalProperties: false + properties: + tool_references: + items: + $ref: '#/components/schemas/BetaRequestToolReferenceBlock' + title: Tool References + type: array + type: + const: tool_search_tool_search_result + title: Type + type: string + required: + - tool_references + - type + title: RequestToolSearchToolSearchResultBlock + type: object + BetaRequestToolUseBlock: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + caller: + discriminator: + mapping: + code_execution_20250825: '#/components/schemas/BetaServerToolCaller' + direct: '#/components/schemas/BetaDirectCaller' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaDirectCaller' + - $ref: '#/components/schemas/BetaServerToolCaller' + title: Caller + id: + pattern: ^[a-zA-Z0-9_-]+$ + title: Id + type: string + input: + additionalProperties: true + title: Input + type: object + name: + maxLength: 200 + minLength: 1 + title: Name + type: string + type: + const: tool_use + title: Type + type: string + required: + - id + - input + - name + - type + title: RequestToolUseBlock + type: object + BetaRequestWebFetchResultBlock: + additionalProperties: false + properties: + content: + $ref: '#/components/schemas/BetaRequestDocumentBlock' + retrieved_at: + anyOf: + - type: string + - type: 'null' + description: ISO 8601 timestamp when the content was retrieved + title: Retrieved At + type: + const: web_fetch_result + title: Type + type: string + url: + description: Fetched content URL + title: Url + type: string + required: + - content + - type + - url + title: RequestWebFetchResultBlock + type: object + BetaRequestWebFetchToolResultBlock: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + content: + anyOf: + - $ref: '#/components/schemas/BetaRequestWebFetchToolResultError' + - $ref: '#/components/schemas/BetaRequestWebFetchResultBlock' + title: Content + tool_use_id: + pattern: ^srvtoolu_[a-zA-Z0-9_]+$ + title: Tool Use Id + type: string + type: + const: web_fetch_tool_result + title: Type + type: string + required: + - content + - tool_use_id + - type + title: RequestWebFetchToolResultBlock + type: object + BetaRequestWebFetchToolResultError: + additionalProperties: false + properties: + error_code: + $ref: '#/components/schemas/BetaWebFetchToolResultErrorCode' + type: + const: web_fetch_tool_result_error + title: Type + type: string + required: + - error_code + - type + title: RequestWebFetchToolResultError + type: object + BetaRequestWebSearchResultBlock: + additionalProperties: false + properties: + encrypted_content: + title: Encrypted Content + type: string + page_age: + anyOf: + - type: string + - type: 'null' + title: Page Age + title: + title: Title + type: string + type: + const: web_search_result + title: Type + type: string + url: + title: Url + type: string + required: + - encrypted_content + - title + - type + - url + title: RequestWebSearchResultBlock + type: object + BetaRequestWebSearchResultLocationCitation: + additionalProperties: false + properties: + cited_text: + title: Cited Text + type: string + encrypted_index: + title: Encrypted Index + type: string + title: + anyOf: + - maxLength: 512 + minLength: 1 + type: string + - type: 'null' + title: Title + type: + const: web_search_result_location + title: Type + type: string + url: + maxLength: 2048 + minLength: 1 + title: Url + type: string + required: + - cited_text + - encrypted_index + - title + - type + - url + title: RequestWebSearchResultLocationCitation + type: object + BetaRequestWebSearchToolResultBlock: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + content: + anyOf: + - items: + $ref: '#/components/schemas/BetaRequestWebSearchResultBlock' + type: array + title: Result Block + - $ref: '#/components/schemas/BetaRequestWebSearchToolResultError' + x-stainless-naming: + go: + variant_constructor: BetaNewWebSearchToolRequestError + title: Content + tool_use_id: + pattern: ^srvtoolu_[a-zA-Z0-9_]+$ + title: Tool Use Id + type: string + type: + const: web_search_tool_result + title: Type + type: string + required: + - content + - tool_use_id + - type + title: RequestWebSearchToolResultBlock + type: object + BetaRequestWebSearchToolResultError: + additionalProperties: false + properties: + error_code: + $ref: '#/components/schemas/BetaWebSearchToolResultErrorCode' + type: + const: web_search_tool_result_error + title: Type + type: string + required: + - error_code + - type + title: Error + type: object + BetaResponseBashCodeExecutionOutputBlock: + properties: + file_id: + title: File Id + type: string + type: + const: bash_code_execution_output + default: bash_code_execution_output + title: Type + type: string + required: + - file_id + - type + title: ResponseBashCodeExecutionOutputBlock + type: object + BetaResponseBashCodeExecutionResultBlock: + properties: + content: + items: + $ref: '#/components/schemas/BetaResponseBashCodeExecutionOutputBlock' + title: Content + type: array + return_code: + title: Return Code + type: integer + stderr: + title: Stderr + type: string + stdout: + title: Stdout + type: string + type: + const: bash_code_execution_result + default: bash_code_execution_result + title: Type + type: string + required: + - content + - return_code + - stderr + - stdout + - type + title: ResponseBashCodeExecutionResultBlock + type: object + BetaResponseBashCodeExecutionToolResultBlock: + properties: + content: + anyOf: + - $ref: '#/components/schemas/BetaResponseBashCodeExecutionToolResultError' + - $ref: '#/components/schemas/BetaResponseBashCodeExecutionResultBlock' + title: Content + tool_use_id: + pattern: ^srvtoolu_[a-zA-Z0-9_]+$ + title: Tool Use Id + type: string + type: + const: bash_code_execution_tool_result + default: bash_code_execution_tool_result + title: Type + type: string + required: + - content + - tool_use_id + - type + title: ResponseBashCodeExecutionToolResultBlock + type: object + BetaResponseBashCodeExecutionToolResultError: + properties: + error_code: + $ref: '#/components/schemas/BetaBashCodeExecutionToolResultErrorCode' + type: + const: bash_code_execution_tool_result_error + default: bash_code_execution_tool_result_error + title: Type + type: string + required: + - error_code + - type + title: ResponseBashCodeExecutionToolResultError + type: object + BetaResponseCharLocationCitation: + properties: + cited_text: + title: Cited Text + type: string + document_index: + minimum: 0 + title: Document Index + type: integer + document_title: + anyOf: + - type: string + - type: 'null' + title: Document Title + end_char_index: + title: End Char Index + type: integer + file_id: + anyOf: + - type: string + - type: 'null' + default: null + title: File Id + start_char_index: + minimum: 0 + title: Start Char Index + type: integer + type: + const: char_location + default: char_location + title: Type + type: string + required: + - cited_text + - document_index + - document_title + - end_char_index + - file_id + - start_char_index + - type + title: ResponseCharLocationCitation + type: object + BetaResponseCitationsConfig: + properties: + enabled: + default: false + title: Enabled + type: boolean + required: + - enabled + title: ResponseCitationsConfig + type: object + BetaResponseClearThinking20251015Edit: + properties: + cleared_input_tokens: + description: Number of input tokens cleared by this edit. + minimum: 0 + title: Cleared Input Tokens + type: integer + cleared_thinking_turns: + description: Number of thinking turns that were cleared. + minimum: 0 + title: Cleared Thinking Turns + type: integer + type: + const: clear_thinking_20251015 + default: clear_thinking_20251015 + description: The type of context management edit applied. + title: Type + type: string + required: + - cleared_input_tokens + - cleared_thinking_turns + - type + title: ResponseClearThinking20251015Edit + type: object + BetaResponseClearToolUses20250919Edit: + properties: + cleared_input_tokens: + description: Number of input tokens cleared by this edit. + minimum: 0 + title: Cleared Input Tokens + type: integer + cleared_tool_uses: + description: Number of tool uses that were cleared. + minimum: 0 + title: Cleared Tool Uses + type: integer + type: + const: clear_tool_uses_20250919 + default: clear_tool_uses_20250919 + description: The type of context management edit applied. + title: Type + type: string + required: + - cleared_input_tokens + - cleared_tool_uses + - type + title: ResponseClearToolUses20250919Edit + type: object + BetaResponseCodeExecutionOutputBlock: + properties: + file_id: + title: File Id + type: string + type: + const: code_execution_output + default: code_execution_output + title: Type + type: string + required: + - file_id + - type + title: ResponseCodeExecutionOutputBlock + type: object + BetaResponseCodeExecutionResultBlock: + properties: + content: + items: + $ref: '#/components/schemas/BetaResponseCodeExecutionOutputBlock' + title: Content + type: array + return_code: + title: Return Code + type: integer + stderr: + title: Stderr + type: string + stdout: + title: Stdout + type: string + type: + const: code_execution_result + default: code_execution_result + title: Type + type: string + required: + - content + - return_code + - stderr + - stdout + - type + title: ResponseCodeExecutionResultBlock + type: object + BetaResponseCodeExecutionToolResultBlock: + properties: + content: + anyOf: + - $ref: '#/components/schemas/BetaResponseCodeExecutionToolResultError' + - $ref: '#/components/schemas/BetaResponseCodeExecutionResultBlock' + title: Content + tool_use_id: + pattern: ^srvtoolu_[a-zA-Z0-9_]+$ + title: Tool Use Id + type: string + type: + const: code_execution_tool_result + default: code_execution_tool_result + title: Type + type: string + required: + - content + - tool_use_id + - type + title: ResponseCodeExecutionToolResultBlock + type: object + BetaResponseCodeExecutionToolResultError: + properties: + error_code: + $ref: '#/components/schemas/BetaCodeExecutionToolResultErrorCode' + type: + const: code_execution_tool_result_error + default: code_execution_tool_result_error + title: Type + type: string + required: + - error_code + - type + title: ResponseCodeExecutionToolResultError + type: object + BetaResponseContainerUploadBlock: + description: Response model for a file uploaded to the container. + properties: + file_id: + title: File Id + type: string + type: + const: container_upload + default: container_upload + title: Type + type: string + required: + - file_id + - type + title: ResponseContainerUploadBlock + type: object + BetaResponseContentBlockLocationCitation: + properties: + cited_text: + title: Cited Text + type: string + document_index: + minimum: 0 + title: Document Index + type: integer + document_title: + anyOf: + - type: string + - type: 'null' + title: Document Title + end_block_index: + title: End Block Index + type: integer + file_id: + anyOf: + - type: string + - type: 'null' + default: null + title: File Id + start_block_index: + minimum: 0 + title: Start Block Index + type: integer + type: + const: content_block_location + default: content_block_location + title: Type + type: string + required: + - cited_text + - document_index + - document_title + - end_block_index + - file_id + - start_block_index + - type + title: ResponseContentBlockLocationCitation + type: object + BetaResponseContextManagement: + properties: + applied_edits: + description: List of context management edits that were applied. + items: + discriminator: + mapping: + clear_thinking_20251015: '#/components/schemas/BetaResponseClearThinking20251015Edit' + clear_tool_uses_20250919: '#/components/schemas/BetaResponseClearToolUses20250919Edit' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaResponseClearToolUses20250919Edit' + - $ref: '#/components/schemas/BetaResponseClearThinking20251015Edit' + title: Applied Edits + type: array + required: + - applied_edits + title: ResponseContextManagement + type: object + BetaResponseDocumentBlock: + properties: + citations: + anyOf: + - $ref: '#/components/schemas/BetaResponseCitationsConfig' + - type: 'null' + default: null + description: Citation configuration for the document + source: + discriminator: + mapping: + base64: '#/components/schemas/BetaBase64PDFSource' + text: '#/components/schemas/BetaPlainTextSource' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaBase64PDFSource' + - $ref: '#/components/schemas/BetaPlainTextSource' + title: Source + title: + anyOf: + - type: string + - type: 'null' + default: null + description: The title of the document + title: Title + type: + const: document + default: document + title: Type + type: string + required: + - citations + - source + - title + - type + title: ResponseDocumentBlock + type: object + BetaResponseMCPToolResultBlock: + properties: + content: + anyOf: + - type: string + - items: + $ref: '#/components/schemas/BetaResponseTextBlock' + title: beta_mcp_tool_result_block_content_item + type: array + title: beta_mcp_tool_result_block_content + title: Content + is_error: + default: false + title: Is Error + type: boolean + tool_use_id: + pattern: ^[a-zA-Z0-9_-]+$ + title: Tool Use Id + type: string + type: + const: mcp_tool_result + default: mcp_tool_result + title: Type + type: string + required: + - content + - is_error + - tool_use_id + - type + title: ResponseMCPToolResultBlock + type: object + BetaResponseMCPToolUseBlock: + properties: + id: + pattern: ^[a-zA-Z0-9_-]+$ + title: Id + type: string + input: + additionalProperties: true + title: Input + type: object + name: + description: The name of the MCP tool + title: Name + type: string + server_name: + description: The name of the MCP server + title: Server Name + type: string + type: + const: mcp_tool_use + default: mcp_tool_use + title: Type + type: string + required: + - id + - input + - name + - server_name + - type + title: ResponseMCPToolUseBlock + type: object + BetaResponsePageLocationCitation: + properties: + cited_text: + title: Cited Text + type: string + document_index: + minimum: 0 + title: Document Index + type: integer + document_title: + anyOf: + - type: string + - type: 'null' + title: Document Title + end_page_number: + title: End Page Number + type: integer + file_id: + anyOf: + - type: string + - type: 'null' + default: null + title: File Id + start_page_number: + minimum: 1 + title: Start Page Number + type: integer + type: + const: page_location + default: page_location + title: Type + type: string + required: + - cited_text + - document_index + - document_title + - end_page_number + - file_id + - start_page_number + - type + title: ResponsePageLocationCitation + type: object + BetaResponseRedactedThinkingBlock: + properties: + data: + title: Data + type: string + type: + const: redacted_thinking + default: redacted_thinking + title: Type + type: string + required: + - data + - type + title: ResponseRedactedThinkingBlock + type: object + BetaResponseSearchResultLocationCitation: + properties: + cited_text: + title: Cited Text + type: string + end_block_index: + title: End Block Index + type: integer + search_result_index: + minimum: 0 + title: Search Result Index + type: integer + source: + title: Source + type: string + start_block_index: + minimum: 0 + title: Start Block Index + type: integer + title: + anyOf: + - type: string + - type: 'null' + title: Title + type: + const: search_result_location + default: search_result_location + title: Type + type: string + required: + - cited_text + - end_block_index + - search_result_index + - source + - start_block_index + - title + - type + title: ResponseSearchResultLocationCitation + type: object + BetaResponseServerToolUseBlock: + properties: + caller: + default: + type: direct + discriminator: + mapping: + code_execution_20250825: '#/components/schemas/BetaServerToolCaller' + direct: '#/components/schemas/BetaDirectCaller' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaDirectCaller' + - $ref: '#/components/schemas/BetaServerToolCaller' + title: Caller + id: + pattern: ^srvtoolu_[a-zA-Z0-9_]+$ + title: Id + type: string + input: + additionalProperties: true + title: Input + type: object + name: + enum: + - web_search + - web_fetch + - code_execution + - bash_code_execution + - text_editor_code_execution + - tool_search_tool_regex + - tool_search_tool_bm25 + title: Name + type: string + type: + const: server_tool_use + default: server_tool_use + title: Type + type: string + required: + - id + - input + - name + - type + title: ResponseServerToolUseBlock + type: object + BetaResponseTextBlock: + properties: + citations: + anyOf: + - items: + discriminator: + mapping: + char_location: '#/components/schemas/BetaResponseCharLocationCitation' + content_block_location: '#/components/schemas/BetaResponseContentBlockLocationCitation' + page_location: '#/components/schemas/BetaResponsePageLocationCitation' + search_result_location: '#/components/schemas/BetaResponseSearchResultLocationCitation' + web_search_result_location: '#/components/schemas/BetaResponseWebSearchResultLocationCitation' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaResponseCharLocationCitation' + - $ref: '#/components/schemas/BetaResponsePageLocationCitation' + - $ref: '#/components/schemas/BetaResponseContentBlockLocationCitation' + - $ref: '#/components/schemas/BetaResponseWebSearchResultLocationCitation' + - $ref: '#/components/schemas/BetaResponseSearchResultLocationCitation' + type: array + - type: 'null' + default: null + description: >- + Citations supporting the text block. + + + The 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`. + title: Citations + text: + maxLength: 5000000 + minLength: 0 + title: Text + type: string + type: + const: text + default: text + title: Type + type: string + required: + - citations + - text + - type + title: ResponseTextBlock + type: object + BetaResponseTextEditorCodeExecutionCreateResultBlock: + properties: + is_file_update: + title: Is File Update + type: boolean + type: + const: text_editor_code_execution_create_result + default: text_editor_code_execution_create_result + title: Type + type: string + required: + - is_file_update + - type + title: ResponseTextEditorCodeExecutionCreateResultBlock + type: object + BetaResponseTextEditorCodeExecutionStrReplaceResultBlock: + properties: + lines: + anyOf: + - items: + type: string + type: array + - type: 'null' + default: null + title: Lines + new_lines: + anyOf: + - type: integer + - type: 'null' + default: null + title: New Lines + new_start: + anyOf: + - type: integer + - type: 'null' + default: null + title: New Start + old_lines: + anyOf: + - type: integer + - type: 'null' + default: null + title: Old Lines + old_start: + anyOf: + - type: integer + - type: 'null' + default: null + title: Old Start + type: + const: text_editor_code_execution_str_replace_result + default: text_editor_code_execution_str_replace_result + title: Type + type: string + required: + - lines + - new_lines + - new_start + - old_lines + - old_start + - type + title: ResponseTextEditorCodeExecutionStrReplaceResultBlock + type: object + BetaResponseTextEditorCodeExecutionToolResultBlock: + properties: + content: + anyOf: + - $ref: '#/components/schemas/BetaResponseTextEditorCodeExecutionToolResultError' + - $ref: '#/components/schemas/BetaResponseTextEditorCodeExecutionViewResultBlock' + - $ref: '#/components/schemas/BetaResponseTextEditorCodeExecutionCreateResultBlock' + - $ref: '#/components/schemas/BetaResponseTextEditorCodeExecutionStrReplaceResultBlock' + title: Content + tool_use_id: + pattern: ^srvtoolu_[a-zA-Z0-9_]+$ + title: Tool Use Id + type: string + type: + const: text_editor_code_execution_tool_result + default: text_editor_code_execution_tool_result + title: Type + type: string + required: + - content + - tool_use_id + - type + title: ResponseTextEditorCodeExecutionToolResultBlock + type: object + BetaResponseTextEditorCodeExecutionToolResultError: + properties: + error_code: + $ref: '#/components/schemas/BetaTextEditorCodeExecutionToolResultErrorCode' + error_message: + anyOf: + - type: string + - type: 'null' + default: null + title: Error Message + type: + const: text_editor_code_execution_tool_result_error + default: text_editor_code_execution_tool_result_error + title: Type + type: string + required: + - error_code + - error_message + - type + title: ResponseTextEditorCodeExecutionToolResultError + type: object + BetaResponseTextEditorCodeExecutionViewResultBlock: + properties: + content: + title: Content + type: string + file_type: + enum: + - text + - image + - pdf + title: File Type + type: string + num_lines: + anyOf: + - type: integer + - type: 'null' + default: null + title: Num Lines + start_line: + anyOf: + - type: integer + - type: 'null' + default: null + title: Start Line + total_lines: + anyOf: + - type: integer + - type: 'null' + default: null + title: Total Lines + type: + const: text_editor_code_execution_view_result + default: text_editor_code_execution_view_result + title: Type + type: string + required: + - content + - file_type + - num_lines + - start_line + - total_lines + - type + title: ResponseTextEditorCodeExecutionViewResultBlock + type: object + BetaResponseThinkingBlock: + properties: + signature: + title: Signature + type: string + thinking: + title: Thinking + type: string + type: + const: thinking + default: thinking + title: Type + type: string + required: + - signature + - thinking + - type + title: ResponseThinkingBlock + type: object + BetaResponseToolReferenceBlock: + properties: + tool_name: + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9_-]{1,64}$ + title: Tool Name + type: string + type: + const: tool_reference + default: tool_reference + title: Type + type: string + required: + - tool_name + - type + title: ResponseToolReferenceBlock + type: object + BetaResponseToolSearchToolResultBlock: + properties: + content: + anyOf: + - $ref: '#/components/schemas/BetaResponseToolSearchToolResultError' + - $ref: '#/components/schemas/BetaResponseToolSearchToolSearchResultBlock' + title: Content + tool_use_id: + pattern: ^srvtoolu_[a-zA-Z0-9_]+$ + title: Tool Use Id + type: string + type: + const: tool_search_tool_result + default: tool_search_tool_result + title: Type + type: string + required: + - content + - tool_use_id + - type + title: ResponseToolSearchToolResultBlock + type: object + BetaResponseToolSearchToolResultError: + properties: + error_code: + $ref: '#/components/schemas/BetaToolSearchToolResultErrorCode' + error_message: + anyOf: + - type: string + - type: 'null' + default: null + title: Error Message + type: + const: tool_search_tool_result_error + default: tool_search_tool_result_error + title: Type + type: string + required: + - error_code + - error_message + - type + title: ResponseToolSearchToolResultError + type: object + BetaResponseToolSearchToolSearchResultBlock: + properties: + tool_references: + items: + $ref: '#/components/schemas/BetaResponseToolReferenceBlock' + title: Tool References + type: array + type: + const: tool_search_tool_search_result + default: tool_search_tool_search_result + title: Type + type: string + required: + - tool_references + - type + title: ResponseToolSearchToolSearchResultBlock + type: object + BetaResponseToolUseBlock: + properties: + caller: + default: + type: direct + discriminator: + mapping: + code_execution_20250825: '#/components/schemas/BetaServerToolCaller' + direct: '#/components/schemas/BetaDirectCaller' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaDirectCaller' + - $ref: '#/components/schemas/BetaServerToolCaller' + title: Caller + id: + pattern: ^[a-zA-Z0-9_-]+$ + title: Id + type: string + input: + additionalProperties: true + title: Input + type: object + name: + minLength: 1 + title: Name + type: string + type: + const: tool_use + default: tool_use + title: Type + type: string + required: + - id + - input + - name + - type + title: ResponseToolUseBlock + type: object + BetaResponseWebFetchResultBlock: + properties: + content: + $ref: '#/components/schemas/BetaResponseDocumentBlock' + retrieved_at: + anyOf: + - type: string + - type: 'null' + default: null + description: ISO 8601 timestamp when the content was retrieved + title: Retrieved At + type: + const: web_fetch_result + default: web_fetch_result + title: Type + type: string + url: + description: Fetched content URL + title: Url + type: string + required: + - content + - retrieved_at + - type + - url + title: ResponseWebFetchResultBlock + type: object + BetaResponseWebFetchToolResultBlock: + properties: + content: + anyOf: + - $ref: '#/components/schemas/BetaResponseWebFetchToolResultError' + - $ref: '#/components/schemas/BetaResponseWebFetchResultBlock' + title: Content + tool_use_id: + pattern: ^srvtoolu_[a-zA-Z0-9_]+$ + title: Tool Use Id + type: string + type: + const: web_fetch_tool_result + default: web_fetch_tool_result + title: Type + type: string + required: + - content + - tool_use_id + - type + title: ResponseWebFetchToolResultBlock + type: object + BetaResponseWebFetchToolResultError: + properties: + error_code: + $ref: '#/components/schemas/BetaWebFetchToolResultErrorCode' + type: + const: web_fetch_tool_result_error + default: web_fetch_tool_result_error + title: Type + type: string + required: + - error_code + - type + title: ResponseWebFetchToolResultError + type: object + BetaResponseWebSearchResultBlock: + properties: + encrypted_content: + title: Encrypted Content + type: string + page_age: + anyOf: + - type: string + - type: 'null' + default: null + title: Page Age + title: + title: Title + type: string + type: + const: web_search_result + default: web_search_result + title: Type + type: string + url: + title: Url + type: string + required: + - encrypted_content + - page_age + - title + - type + - url + title: ResponseWebSearchResultBlock + type: object + BetaResponseWebSearchResultLocationCitation: + properties: + cited_text: + title: Cited Text + type: string + encrypted_index: + title: Encrypted Index + type: string + title: + anyOf: + - maxLength: 512 + type: string + - type: 'null' + title: Title + type: + const: web_search_result_location + default: web_search_result_location + title: Type + type: string + url: + title: Url + type: string + required: + - cited_text + - encrypted_index + - title + - type + - url + title: ResponseWebSearchResultLocationCitation + type: object + BetaResponseWebSearchToolResultBlock: + properties: + content: + anyOf: + - $ref: '#/components/schemas/BetaResponseWebSearchToolResultError' + - items: + $ref: '#/components/schemas/BetaResponseWebSearchResultBlock' + type: array + title: Content + tool_use_id: + pattern: ^srvtoolu_[a-zA-Z0-9_]+$ + title: Tool Use Id + type: string + type: + const: web_search_tool_result + default: web_search_tool_result + title: Type + type: string + required: + - content + - tool_use_id + - type + title: ResponseWebSearchToolResultBlock + type: object + BetaResponseWebSearchToolResultError: + properties: + error_code: + $ref: '#/components/schemas/BetaWebSearchToolResultErrorCode' + type: + const: web_search_tool_result_error + default: web_search_tool_result_error + title: Type + type: string + required: + - error_code + - type + title: ResponseWebSearchToolResultError + type: object + BetaServerToolCaller: + additionalProperties: false + description: Tool invocation generated by a server-side tool. + properties: + tool_id: + pattern: ^srvtoolu_[a-zA-Z0-9_]+$ + title: Tool Id + type: string + type: + const: code_execution_20250825 + title: Type + type: string + required: + - tool_id + - type + title: ServerToolCaller + type: object + BetaServerToolUsage: + properties: + web_fetch_requests: + default: 0 + description: The number of web fetch tool requests. + examples: + - 2 + minimum: 0 + title: Web Fetch Requests + type: integer + web_search_requests: + default: 0 + description: The number of web search tool requests. + examples: + - 0 + minimum: 0 + title: Web Search Requests + type: integer + required: + - web_fetch_requests + - web_search_requests + title: ServerToolUsage + type: object + BetaSignatureContentBlockDelta: + properties: + signature: + title: Signature + type: string + type: + const: signature_delta + default: signature_delta + title: Type + type: string + required: + - signature + - type + title: SignatureContentBlockDelta + type: object + BetaSkill: + description: A skill that was loaded in a container (response model). + properties: + skill_id: + description: Skill ID + maxLength: 64 + minLength: 1 + title: Skill Id + type: string + type: + description: Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + enum: + - anthropic + - custom + title: Type + type: string + version: + description: Skill version or 'latest' for most recent version + maxLength: 64 + minLength: 1 + title: Version + type: string + required: + - skill_id + - type + - version + title: Skill + type: object + BetaSkillParams: + additionalProperties: false + description: Specification for a skill to be loaded in a container (request model). + properties: + skill_id: + description: Skill ID + maxLength: 64 + minLength: 1 + title: Skill Id + type: string + type: + description: Type of skill - either 'anthropic' (built-in) or 'custom' (user-defined) + enum: + - anthropic + - custom + title: Type + type: string + version: + description: Skill version or 'latest' for most recent version + maxLength: 64 + minLength: 1 + title: Version + type: string + required: + - skill_id + - type + title: SkillParams + type: object + BetaSkillVersion: + properties: + created_at: + type: string + title: Created At + description: ISO 8601 timestamp of when the skill version was created. + examples: + - '2024-10-30T23:58:27.427722Z' + description: + type: string + title: Description + description: |- + Description of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + examples: + - A custom skill for doing something useful + directory: + type: string + title: Directory + description: |- + Directory name of the skill version. + + This is the top-level directory name that was extracted from the uploaded files. + examples: + - my-skill + id: + type: string + title: Id + description: |- + Unique identifier for the skill version. + + The format and length of IDs may change over time. + examples: + - skillver_01JAbcdefghijklmnopqrstuvw + name: + type: string + title: Name + description: |- + Human-readable name of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + examples: + - my-skill + skill_id: + type: string + title: Skill Id + description: Identifier for the skill that this version belongs to. + examples: + - skill_01JAbcdefghijklmnopqrstuvw + type: + type: string + title: Type + description: |- + Object type. + + For Skill Versions, this is always `"skill_version"`. + default: skill_version + version: + type: string + title: Version + description: |- + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + examples: + - '1759178010641129' + type: object + required: + - created_at + - description + - directory + - id + - name + - skill_id + - type + - version + title: SkillVersion + BetaSucceededResult: + properties: + message: + $ref: '#/components/schemas/BetaMessage' + type: + const: succeeded + default: succeeded + title: Type + type: string + required: + - message + - type + title: SucceededResult + type: object + BetaTextContentBlockDelta: + properties: + text: + title: Text + type: string + type: + const: text_delta + default: text_delta + title: Type + type: string + required: + - text + - type + title: TextContentBlockDelta + type: object + BetaTextEditorCodeExecutionToolResultErrorCode: + enum: + - invalid_tool_input + - unavailable + - too_many_requests + - execution_time_exceeded + - file_not_found + title: TextEditorCodeExecutionToolResultErrorCode + type: string + BetaTextEditor_20241022: + additionalProperties: false + properties: + allowed_callers: + items: + enum: + - direct + - code_execution_20250825 + type: string + title: Allowed Callers + type: array + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + defer_loading: + description: >- + If true, tool will not be included in initial system prompt. Only loaded when returned via + tool_reference from tool search. + title: Defer Loading + type: boolean + input_examples: + items: + additionalProperties: + $ref: '#/components/schemas/BetaJsonValue' + type: object + title: Input Examples + type: array + name: + const: str_replace_editor + description: |- + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + title: Name + type: string + strict: + title: Strict + type: boolean + type: + const: text_editor_20241022 + title: Type + type: string + required: + - name + - type + title: TextEditor_20241022 + type: object + BetaTextEditor_20250124: + additionalProperties: false + properties: + allowed_callers: + items: + enum: + - direct + - code_execution_20250825 + type: string + title: Allowed Callers + type: array + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + defer_loading: + description: >- + If true, tool will not be included in initial system prompt. Only loaded when returned via + tool_reference from tool search. + title: Defer Loading + type: boolean + input_examples: + items: + additionalProperties: + $ref: '#/components/schemas/BetaJsonValue' + type: object + title: Input Examples + type: array + name: + const: str_replace_editor + description: |- + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + title: Name + type: string + strict: + title: Strict + type: boolean + type: + const: text_editor_20250124 + title: Type + type: string + required: + - name + - type + title: TextEditor_20250124 + type: object + BetaTextEditor_20250429: + additionalProperties: false + properties: + allowed_callers: + items: + enum: + - direct + - code_execution_20250825 + type: string + title: Allowed Callers + type: array + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + defer_loading: + description: >- + If true, tool will not be included in initial system prompt. Only loaded when returned via + tool_reference from tool search. + title: Defer Loading + type: boolean + input_examples: + items: + additionalProperties: + $ref: '#/components/schemas/BetaJsonValue' + type: object + title: Input Examples + type: array + name: + const: str_replace_based_edit_tool + description: |- + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + title: Name + type: string + strict: + title: Strict + type: boolean + type: + const: text_editor_20250429 + title: Type + type: string + required: + - name + - type + title: TextEditor_20250429 + type: object + BetaTextEditor_20250728: + additionalProperties: false + properties: + allowed_callers: + items: + enum: + - direct + - code_execution_20250825 + type: string + title: Allowed Callers + type: array + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + defer_loading: + description: >- + If true, tool will not be included in initial system prompt. Only loaded when returned via + tool_reference from tool search. + title: Defer Loading + type: boolean + input_examples: + items: + additionalProperties: + $ref: '#/components/schemas/BetaJsonValue' + type: object + title: Input Examples + type: array + max_characters: + anyOf: + - minimum: 1 + type: integer + - type: 'null' + description: >- + Maximum number of characters to display when viewing a file. If not specified, defaults to + displaying the full file. + title: Max Characters + name: + const: str_replace_based_edit_tool + description: |- + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + title: Name + type: string + strict: + title: Strict + type: boolean + type: + const: text_editor_20250728 + title: Type + type: string + required: + - name + - type + title: TextEditor_20250728 + type: object + BetaThinkingConfigDisabled: + additionalProperties: false + properties: + type: + const: disabled + title: Type + type: string + required: + - type + title: ThinkingConfigDisabled + type: object + x-stainless-go-constant-constructor: true + BetaThinkingConfigEnabled: + additionalProperties: false + properties: + 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. + + + Must be ≥1024 and less than `max_tokens`. + + + See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for + details. + minimum: 1024 + title: Budget Tokens + type: integer + type: + const: enabled + title: Type + type: string + required: + - budget_tokens + - type + title: ThinkingConfigEnabled + type: object + BetaThinkingContentBlockDelta: + properties: + thinking: + title: Thinking + type: string + type: + const: thinking_delta + default: thinking_delta + title: Type + type: string + required: + - thinking + - type + title: ThinkingContentBlockDelta + type: object + BetaThinkingTurns: + additionalProperties: false + properties: + type: + const: thinking_turns + title: Type + type: string + value: + minimum: 1 + title: Value + type: integer + required: + - type + - value + title: ThinkingTurns + type: object + BetaTool: + additionalProperties: false + properties: + type: + anyOf: + - type: 'null' + - const: custom + type: string + title: Type + description: + description: >- + Description of what this tool does. + + + Tool 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. + examples: + - Get the current weather in a given location + title: Description + type: string + name: + description: |- + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + maxLength: 128 + minLength: 1 + pattern: ^[a-zA-Z0-9_-]{1,128}$ + title: Name + type: string + input_schema: + $ref: '#/components/schemas/BetaInputSchema' + description: |- + [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input. + + This defines the shape of the `input` that your tool accepts and that the model will produce. + examples: + - properties: + location: + description: The city and state, e.g. San Francisco, CA + type: string + unit: + description: Unit for the output - one of (celsius, fahrenheit) + type: string + required: + - location + type: object + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + strict: + title: Strict + type: boolean + allowed_callers: + items: + enum: + - direct + - code_execution_20250825 + type: string + title: Allowed Callers + type: array + defer_loading: + description: >- + If true, tool will not be included in initial system prompt. Only loaded when returned via + tool_reference from tool search. + title: Defer Loading + type: boolean + input_examples: + items: + additionalProperties: + $ref: '#/components/schemas/BetaJsonValue' + type: object + title: Input Examples + type: array + required: + - name + - input_schema + title: Tool + type: object + BetaToolChoiceAny: + additionalProperties: false + description: The model will use any available tools. + properties: + disable_parallel_tool_use: + description: |- + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output exactly one tool use. + title: Disable Parallel Tool Use + type: boolean + type: + const: any + title: Type + type: string + required: + - type + title: ToolChoiceAny + type: object + BetaToolChoiceAuto: + additionalProperties: false + description: The model will automatically decide whether to use tools. + properties: + disable_parallel_tool_use: + description: |- + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output at most one tool use. + title: Disable Parallel Tool Use + type: boolean + type: + const: auto + title: Type + type: string + required: + - type + title: ToolChoiceAuto + type: object + BetaToolChoiceNone: + additionalProperties: false + description: The model will not be allowed to use tools. + properties: + type: + const: none + title: Type + type: string + required: + - type + title: ToolChoiceNone + type: object + x-stainless-go-constant-constructor: true + BetaToolChoiceTool: + additionalProperties: false + description: The model will use the specified tool with `tool_choice.name`. + properties: + disable_parallel_tool_use: + description: |- + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output exactly one tool use. + title: Disable Parallel Tool Use + type: boolean + name: + description: The name of the tool to use. + title: Name + type: string + type: + const: tool + title: Type + type: string + required: + - name + - type + title: ToolChoiceTool + type: object + BetaToolSearchToolBM25_20251119: + additionalProperties: false + properties: + allowed_callers: + items: + enum: + - direct + - code_execution_20250825 + type: string + title: Allowed Callers + type: array + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + defer_loading: + description: >- + If true, tool will not be included in initial system prompt. Only loaded when returned via + tool_reference from tool search. + title: Defer Loading + type: boolean + name: + const: tool_search_tool_bm25 + description: |- + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + title: Name + type: string + strict: + title: Strict + type: boolean + type: + enum: + - tool_search_tool_bm25_20251119 + - tool_search_tool_bm25 + title: Type + type: string + required: + - name + - type + title: ToolSearchToolBM25_20251119 + type: object + BetaToolSearchToolRegex_20251119: + additionalProperties: false + properties: + allowed_callers: + items: + enum: + - direct + - code_execution_20250825 + type: string + title: Allowed Callers + type: array + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + defer_loading: + description: >- + If true, tool will not be included in initial system prompt. Only loaded when returned via + tool_reference from tool search. + title: Defer Loading + type: boolean + name: + const: tool_search_tool_regex + description: |- + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + title: Name + type: string + strict: + title: Strict + type: boolean + type: + enum: + - tool_search_tool_regex_20251119 + - tool_search_tool_regex + title: Type + type: string + required: + - name + - type + title: ToolSearchToolRegex_20251119 + type: object + BetaToolSearchToolResultErrorCode: + enum: + - invalid_tool_input + - unavailable + - too_many_requests + - execution_time_exceeded + title: ToolSearchToolResultErrorCode + type: string + BetaToolUsesKeep: + additionalProperties: false + properties: + type: + const: tool_uses + title: Type + type: string + value: + minimum: 0 + title: Value + type: integer + required: + - type + - value + title: ToolUsesKeep + type: object + BetaToolUsesTrigger: + additionalProperties: false + properties: + type: + const: tool_uses + title: Type + type: string + value: + minimum: 1 + title: Value + type: integer + required: + - type + - value + title: ToolUsesTrigger + type: object + BetaURLImageSource: + additionalProperties: false + properties: + type: + const: url + title: Type + type: string + url: + title: Url + type: string + required: + - type + - url + title: URLImageSource + type: object + BetaURLPDFSource: + additionalProperties: false + properties: + type: + const: url + title: Type + type: string + url: + title: Url + type: string + required: + - type + - url + title: URLPDFSource + type: object + BetaUsage: + properties: + cache_creation: + anyOf: + - $ref: '#/components/schemas/BetaCacheCreation' + - type: 'null' + default: null + description: Breakdown of cached tokens by TTL + cache_creation_input_tokens: + anyOf: + - minimum: 0 + type: integer + - type: 'null' + default: null + description: The number of input tokens used to create the cache entry. + examples: + - 2051 + title: Cache Creation Input Tokens + cache_read_input_tokens: + anyOf: + - minimum: 0 + type: integer + - type: 'null' + default: null + description: The number of input tokens read from the cache. + examples: + - 2051 + title: Cache Read Input Tokens + input_tokens: + description: The number of input tokens which were used. + examples: + - 2095 + minimum: 0 + title: Input Tokens + type: integer + output_tokens: + description: The number of output tokens which were used. + examples: + - 503 + minimum: 0 + title: Output Tokens + type: integer + server_tool_use: + anyOf: + - $ref: '#/components/schemas/BetaServerToolUsage' + - type: 'null' + default: null + description: The number of server tool requests. + service_tier: + anyOf: + - enum: + - standard + - priority + - batch + type: string + - type: 'null' + default: null + description: If the request used the priority, standard, or batch tier. + title: Service Tier + required: + - cache_creation + - cache_creation_input_tokens + - cache_read_input_tokens + - input_tokens + - output_tokens + - server_tool_use + - service_tier + title: Usage + type: object + BetaUserLocation: + additionalProperties: false + properties: + city: + anyOf: + - maxLength: 255 + minLength: 1 + type: string + - type: 'null' + description: The city of the user. + examples: + - New York + - Tokyo + - Los Angeles + title: City + country: + anyOf: + - maxLength: 2 + minLength: 2 + type: string + - type: 'null' + description: The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. + examples: + - US + - JP + - GB + title: Country + region: + anyOf: + - maxLength: 255 + minLength: 1 + type: string + - type: 'null' + description: The region of the user. + examples: + - California + - Ontario + - Wales + title: Region + timezone: + anyOf: + - maxLength: 255 + minLength: 1 + type: string + - type: 'null' + description: The [IANA timezone](https://nodatime.org/TimeZones) of the user. + examples: + - America/New_York + - Asia/Tokyo + - Europe/London + title: Timezone + type: + const: approximate + title: Type + type: string + required: + - type + title: UserLocation + type: object + BetaWebFetchToolResultErrorCode: + enum: + - invalid_tool_input + - url_too_long + - url_not_allowed + - url_not_accessible + - unsupported_content_type + - too_many_requests + - max_uses_exceeded + - unavailable + title: WebFetchToolResultErrorCode + type: string + BetaWebFetchTool_20250910: + additionalProperties: false + properties: + allowed_callers: + items: + enum: + - direct + - code_execution_20250825 + type: string + title: Allowed Callers + type: array + allowed_domains: + anyOf: + - items: + type: string + type: array + - type: 'null' + description: List of domains to allow fetching from + title: Allowed Domains + blocked_domains: + anyOf: + - items: + type: string + type: array + - type: 'null' + description: List of domains to block fetching from + title: Blocked Domains + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + citations: + anyOf: + - $ref: '#/components/schemas/BetaRequestCitationsConfig' + - type: 'null' + description: Citations configuration for fetched documents. Citations are disabled by default. + defer_loading: + description: >- + If true, tool will not be included in initial system prompt. Only loaded when returned via + tool_reference from tool search. + title: Defer Loading + type: boolean + max_content_tokens: + anyOf: + - exclusiveMinimum: 0 + type: integer + - type: 'null' + 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. + title: Max Content Tokens + max_uses: + anyOf: + - exclusiveMinimum: 0 + type: integer + - type: 'null' + description: Maximum number of times the tool can be used in the API request. + title: Max Uses + name: + const: web_fetch + description: |- + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + title: Name + type: string + strict: + title: Strict + type: boolean + type: + const: web_fetch_20250910 + title: Type + type: string + required: + - name + - type + title: WebFetchTool_20250910 + type: object + BetaWebSearchToolResultErrorCode: + enum: + - invalid_tool_input + - unavailable + - max_uses_exceeded + - too_many_requests + - query_too_long + - request_too_large + title: WebSearchToolResultErrorCode + type: string + BetaWebSearchTool_20250305: + additionalProperties: false + properties: + allowed_callers: + items: + enum: + - direct + - code_execution_20250825 + type: string + title: Allowed Callers + type: array + allowed_domains: + anyOf: + - items: + type: string + type: array + - type: 'null' + description: >- + If provided, only these domains will be included in results. Cannot be used alongside + `blocked_domains`. + title: Allowed Domains + blocked_domains: + anyOf: + - items: + type: string + type: array + - type: 'null' + description: >- + If provided, these domains will never appear in results. Cannot be used alongside + `allowed_domains`. + title: Blocked Domains + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/BetaCacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaCacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + defer_loading: + description: >- + If true, tool will not be included in initial system prompt. Only loaded when returned via + tool_reference from tool search. + title: Defer Loading + type: boolean + max_uses: + anyOf: + - exclusiveMinimum: 0 + type: integer + - type: 'null' + description: Maximum number of times the tool can be used in the API request. + title: Max Uses + name: + const: web_search + description: |- + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + title: Name + type: string + strict: + title: Strict + type: boolean + type: + const: web_search_20250305 + title: Type + type: string + user_location: + anyOf: + - $ref: '#/components/schemas/BetaUserLocation' + - type: 'null' + description: Parameters for the user's location. Used to provide more relevant search results. + required: + - name + - type + title: WebSearchTool_20250305 + type: object + Betaapi__schemas__skills__Skill: + properties: + created_at: + type: string + title: Created At + description: ISO 8601 timestamp of when the skill was created. + examples: + - '2024-10-30T23:58:27.427722Z' + display_title: + anyOf: + - type: string + - type: 'null' + title: Display Title + description: |- + Display title for the skill. + + This is a human-readable label that is not included in the prompt sent to the model. + examples: + - My Custom Skill + id: + type: string + title: Id + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + examples: + - skill_01JAbcdefghijklmnopqrstuvw + latest_version: + anyOf: + - type: string + - type: 'null' + title: Latest Version + description: |- + The latest version identifier for the skill. + + This represents the most recent version of the skill that has been created. + examples: + - '1759178010641129' + source: + type: string + title: Source + description: |- + Source of the skill. + + This may be one of the following values: + * `"custom"`: the skill was created by a user + * `"anthropic"`: the skill was created by Anthropic + examples: + - custom + type: + type: string + title: Type + description: |- + Object type. + + For Skills, this is always `"skill"`. + default: skill + updated_at: + type: string + title: Updated At + description: ISO 8601 timestamp of when the skill was last updated. + examples: + - '2024-10-30T23:58:27.427722Z' + type: object + required: + - created_at + - display_title + - id + - latest_version + - source + - type + - updated_at + title: Skill + BillingError: + properties: + message: + default: Billing error + title: Message + type: string + type: + const: billing_error + default: billing_error + title: Type + type: string + required: + - message + - type + title: BillingError + type: object + Body_create_skill_v1_skills_post: + properties: + display_title: + anyOf: + - type: string + - type: 'null' + title: Display Title + description: |- + Display title for the skill. + + This is a human-readable label that is not included in the prompt sent to the model. + files: + anyOf: + - items: + type: string + format: binary + type: array + - type: 'null' + title: Files + description: >- + Files to upload for the skill. + + + All files must be in the same top-level directory and must include a SKILL.md file at the root of + that directory. + type: object + title: Body_create_skill_v1_skills_post + Body_create_skill_version_v1_skills__skill_id__versions_post: + properties: + files: + anyOf: + - items: + type: string + format: binary + type: array + - type: 'null' + title: Files + description: >- + Files to upload for the skill. + + + All files must be in the same top-level directory and must include a SKILL.md file at the root of + that directory. + type: object + title: Body_create_skill_version_v1_skills__skill_id__versions_post + CacheControlEphemeral: + additionalProperties: false + properties: + ttl: + description: |- + The time-to-live for the cache control breakpoint. + + This may be one the following values: + - `5m`: 5 minutes + - `1h`: 1 hour + + Defaults to `5m`. + enum: + - 5m + - 1h + title: Ttl + type: string + x-stainless-renameMap: + ttl_5m: 5m + ttl_1h: 1h + type: + const: ephemeral + title: Type + type: string + required: + - type + title: CacheControlEphemeral + type: object + x-stainless-go-constant-constructor: true + CacheCreation: + properties: + ephemeral_1h_input_tokens: + default: 0 + description: The number of input tokens used to create the 1 hour cache entry. + minimum: 0 + title: Ephemeral 1H Input Tokens + type: integer + ephemeral_5m_input_tokens: + default: 0 + description: The number of input tokens used to create the 5 minute cache entry. + minimum: 0 + title: Ephemeral 5M Input Tokens + type: integer + required: + - ephemeral_1h_input_tokens + - ephemeral_5m_input_tokens + title: CacheCreation + type: object + CanceledResult: + properties: + type: + const: canceled + default: canceled + title: Type + type: string + required: + - type + title: CanceledResult + type: object + CitationsDelta: + properties: + citation: + discriminator: + mapping: + char_location: '#/components/schemas/ResponseCharLocationCitation' + content_block_location: '#/components/schemas/ResponseContentBlockLocationCitation' + page_location: '#/components/schemas/ResponsePageLocationCitation' + search_result_location: '#/components/schemas/ResponseSearchResultLocationCitation' + web_search_result_location: '#/components/schemas/ResponseWebSearchResultLocationCitation' + propertyName: type + oneOf: + - $ref: '#/components/schemas/ResponseCharLocationCitation' + - $ref: '#/components/schemas/ResponsePageLocationCitation' + - $ref: '#/components/schemas/ResponseContentBlockLocationCitation' + - $ref: '#/components/schemas/ResponseWebSearchResultLocationCitation' + - $ref: '#/components/schemas/ResponseSearchResultLocationCitation' + title: Citation + type: + const: citations_delta + default: citations_delta + title: Type + type: string + required: + - citation + - type + title: CitationsDelta + type: object + CompletionRequest: + additionalProperties: false + examples: + - max_tokens_to_sample: 256 + model: claude-2.1 + prompt: |- + + + Human: Hello, world! + + Assistant: + properties: + model: + $ref: '#/components/schemas/Model' + prompt: + description: >- + The prompt that you want Claude to complete. + + + For proper response generation you will need to format your prompt using alternating `\n\nHuman:` + and `\n\nAssistant:` conversational turns. For example: + + + ``` + + "\n\nHuman: {userQuestion}\n\nAssistant:" + + ``` + + + See [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. + examples: + - |- + + + Human: Hello, world! + + Assistant: + minLength: 1 + title: Prompt + type: string + max_tokens_to_sample: + description: >- + The maximum number of tokens to generate before stopping. + + + Note that our models may stop _before_ reaching this maximum. This parameter only specifies the + absolute maximum number of tokens to generate. + examples: + - 256 + minimum: 1 + title: Max Tokens To Sample + type: integer + stop_sequences: + description: >- + Sequences that will cause the model to stop generating. + + + Our 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. + items: + type: string + title: Stop Sequences + type: array + temperature: + description: >- + Amount of randomness injected into the response. + + + Defaults 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. + + + Note that even with `temperature` of `0.0`, the results will not be fully deterministic. + examples: + - 1 + maximum: 1 + minimum: 0 + title: Temperature + type: number + top_p: + description: >- + Use nucleus sampling. + + + In 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. + + + Recommended for advanced use cases only. You usually only need to use `temperature`. + examples: + - 0.7 + maximum: 1 + minimum: 0 + title: Top P + type: number + top_k: + description: >- + Only sample from the top K options for each subsequent token. + + + Used to remove "long tail" low probability responses. [Learn more technical details + here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277). + + + Recommended for advanced use cases only. You usually only need to use `temperature`. + examples: + - 5 + minimum: 0 + title: Top K + type: integer + metadata: + $ref: '#/components/schemas/Metadata' + description: An object describing metadata about the request. + stream: + description: |- + Whether to incrementally stream the response using server-sent events. + + See [streaming](https://docs.claude.com/en/api/streaming) for details. + title: Stream + type: boolean + required: + - max_tokens_to_sample + - model + - prompt + title: CompletionRequest + type: object + CompletionResponse: + properties: + completion: + type: string + title: Completion + description: The resulting completion up to and excluding the stop sequences. + examples: + - ' Hello! My name is Claude.' + id: + type: string + title: Id + description: |- + Unique object identifier. + + The format and length of IDs may change over time. + model: + $ref: '#/components/schemas/Model' + stop_reason: + anyOf: + - type: string + - type: 'null' + title: Stop Reason + description: >- + The reason that we stopped. + + + This may be one the following values: + + * `"stop_sequence"`: we reached a stop sequence — either provided by you via the `stop_sequences` + parameter, or a stop sequence built into the model + + * `"max_tokens"`: we exceeded `max_tokens_to_sample` or the model's maximum + examples: + - stop_sequence + type: + type: string + const: completion + title: Type + description: |- + Object type. + + For Text Completions, this is always `"completion"`. + default: completion + type: object + required: + - completion + - id + - model + - stop_reason + - type + title: CompletionResponse + example: + completion: ' Hello! My name is Claude.' + id: compl_018CKm6gsux7P8yMcwZbeCPw + model: claude-2.1 + stop_reason: stop_sequence + type: completion + ContentBlockDeltaEvent: + properties: + delta: + discriminator: + mapping: + citations_delta: '#/components/schemas/CitationsDelta' + input_json_delta: '#/components/schemas/InputJsonContentBlockDelta' + signature_delta: '#/components/schemas/SignatureContentBlockDelta' + text_delta: '#/components/schemas/TextContentBlockDelta' + thinking_delta: '#/components/schemas/ThinkingContentBlockDelta' + propertyName: type + oneOf: + - $ref: '#/components/schemas/TextContentBlockDelta' + - $ref: '#/components/schemas/InputJsonContentBlockDelta' + - $ref: '#/components/schemas/CitationsDelta' + - $ref: '#/components/schemas/ThinkingContentBlockDelta' + - $ref: '#/components/schemas/SignatureContentBlockDelta' + title: Delta + index: + title: Index + type: integer + type: + const: content_block_delta + default: content_block_delta + title: Type + type: string + required: + - delta + - index + - type + title: ContentBlockDeltaEvent + type: object + x-stainless-naming: + go: + model_name: ContentBlockDeltaEvent + ContentBlockSource: + additionalProperties: false + properties: + content: + anyOf: + - type: string + - items: + discriminator: + mapping: + image: '#/components/schemas/RequestImageBlock' + text: '#/components/schemas/RequestTextBlock' + propertyName: type + oneOf: + - $ref: '#/components/schemas/RequestTextBlock' + - $ref: '#/components/schemas/RequestImageBlock' + x-stainless-naming: + go: + type_name: ContentBlockSourceContentItem + title: content_block_source_content_item + type: array + title: content_block_source_content + title: Content + type: + const: content + title: Type + type: string + required: + - content + - type + title: ContentBlockSource + type: object + ContentBlockStartEvent: + properties: + content_block: + discriminator: + mapping: + redacted_thinking: '#/components/schemas/ResponseRedactedThinkingBlock' + server_tool_use: '#/components/schemas/ResponseServerToolUseBlock' + text: '#/components/schemas/ResponseTextBlock' + thinking: '#/components/schemas/ResponseThinkingBlock' + tool_use: '#/components/schemas/ResponseToolUseBlock' + web_search_tool_result: '#/components/schemas/ResponseWebSearchToolResultBlock' + propertyName: type + oneOf: + - $ref: '#/components/schemas/ResponseTextBlock' + - $ref: '#/components/schemas/ResponseThinkingBlock' + - $ref: '#/components/schemas/ResponseRedactedThinkingBlock' + - $ref: '#/components/schemas/ResponseToolUseBlock' + - $ref: '#/components/schemas/ResponseServerToolUseBlock' + - $ref: '#/components/schemas/ResponseWebSearchToolResultBlock' + title: Content Block + index: + title: Index + type: integer + type: + const: content_block_start + default: content_block_start + title: Type + type: string + required: + - content_block + - index + - type + title: ContentBlockStartEvent + type: object + x-stainless-naming: + go: + model_name: ContentBlockStartEvent + ContentBlockStopEvent: + properties: + index: + title: Index + type: integer + type: + const: content_block_stop + default: content_block_stop + title: Type + type: string + required: + - index + - type + title: ContentBlockStopEvent + type: object + x-stainless-naming: + go: + model_name: ContentBlockStopEvent + CountMessageTokensParams: + additionalProperties: false + examples: + - messages: + - content: Hello, world + role: user + model: claude-sonnet-4-5-20250929 + properties: + messages: + description: >- + Input messages. + + + Our 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. + + + Each 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. + + + If 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. + + + Example with a single `user` message: + + + ```json + + [{"role": "user", "content": "Hello, Claude"}] + + ``` + + + Example with multiple conversational turns: + + + ```json + + [ + {"role": "user", "content": "Hello there."}, + {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"}, + {"role": "user", "content": "Can you explain LLMs in plain English?"}, + ] + + ``` + + + Example with a partially-filled response from Claude: + + + ```json + + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("}, + ] + + ``` + + + Each 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: + + + ```json + + {"role": "user", "content": "Hello, Claude"} + + ``` + + + ```json + + {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]} + + ``` + + + See [input examples](https://docs.claude.com/en/api/messages-examples). + + + Note 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. + + + There is a limit of 100,000 messages in a single request. + items: + $ref: '#/components/schemas/InputMessage' + title: Messages + type: array + model: + $ref: '#/components/schemas/Model' + system: + anyOf: + - type: string + - items: + $ref: '#/components/schemas/RequestTextBlock' + type: array + description: >- + System prompt. + + + A 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). + examples: + - - text: Today's date is 2024-06-01. + type: text + - Today's date is 2023-01-01. + title: System + thinking: + $ref: '#/components/schemas/ThinkingConfigParam' + tool_choice: + $ref: '#/components/schemas/ToolChoice' + tools: + description: >- + Definitions of tools that the model may use. + + + If 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. + + + There 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)). + + + Each tool definition includes: + + + * `name`: Name of the tool. + + * `description`: Optional, but strongly-recommended description of the tool. + + * `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. + + + For example, if you defined `tools` as: + + + ```json + + [ { - "description": "Get the current weather in a given location", + "name": "get_stock_price", + "description": "Get the current stock price for a given ticker symbol.", "input_schema": { + "type": "object", "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string" - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string" + "ticker": { + "type": "string", + "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." } }, - "required": ["location"], - "type": "object" - }, - "name": "get_weather" + "required": ["ticker"] + } } - ], - "items": { - "oneOf": [ - { "$ref": "#/components/schemas/BetaTool" }, - { "$ref": "#/components/schemas/BetaBashTool_20241022" }, - { "$ref": "#/components/schemas/BetaBashTool_20250124" }, - { "$ref": "#/components/schemas/BetaCodeExecutionTool_20250522" }, - { "$ref": "#/components/schemas/BetaCodeExecutionTool_20250825" }, - { "$ref": "#/components/schemas/BetaComputerUseTool_20241022" }, - { "$ref": "#/components/schemas/BetaMemoryTool_20250818" }, - { "$ref": "#/components/schemas/BetaComputerUseTool_20250124" }, - { "$ref": "#/components/schemas/BetaTextEditor_20241022" }, - { "$ref": "#/components/schemas/BetaTextEditor_20250124" }, - { "$ref": "#/components/schemas/BetaTextEditor_20250429" }, - { "$ref": "#/components/schemas/BetaTextEditor_20250728" }, - { "$ref": "#/components/schemas/BetaWebSearchTool_20250305" }, - { "$ref": "#/components/schemas/BetaWebFetchTool_20250910" } - ] - }, - "title": "Tools", - "type": "array" - }, - "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`.", - "examples": [5], - "minimum": 0, - "title": "Top K", - "type": "integer" - }, - "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`.", - "examples": [0.7], - "maximum": 1, - "minimum": 0, - "title": "Top P", - "type": "number" - } - }, - "required": ["model", "messages", "max_tokens"], - "title": "CreateMessageParams", - "type": "object" - }, - "BetaDeleteMessageBatchResponse": { - "properties": { - "id": { - "type": "string", - "title": "Id", - "description": "ID of the Message Batch.", - "examples": ["msgbatch_013Zva2CMHLNnXjNJJKqJ2EF"] - }, - "type": { - "type": "string", - "enum": ["message_batch_deleted"], - "const": "message_batch_deleted", - "title": "Type", - "description": "Deleted object type.\n\nFor Message Batches, this is always `\"message_batch_deleted\"`.", - "default": "message_batch_deleted" - } - }, - "type": "object", - "required": ["id", "type"], - "title": "DeleteMessageBatchResponse" - }, - "BetaErrorResponse": { - "properties": { - "error": { - "discriminator": { - "mapping": { - "api_error": "#/components/schemas/BetaAPIError", - "authentication_error": "#/components/schemas/BetaAuthenticationError", - "billing_error": "#/components/schemas/BetaBillingError", - "invalid_request_error": "#/components/schemas/BetaInvalidRequestError", - "not_found_error": "#/components/schemas/BetaNotFoundError", - "overloaded_error": "#/components/schemas/BetaOverloadedError", - "permission_error": "#/components/schemas/BetaPermissionError", - "rate_limit_error": "#/components/schemas/BetaRateLimitError", - "timeout_error": "#/components/schemas/BetaGatewayTimeoutError" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/BetaInvalidRequestError" }, - { "$ref": "#/components/schemas/BetaAuthenticationError" }, - { "$ref": "#/components/schemas/BetaBillingError" }, - { "$ref": "#/components/schemas/BetaPermissionError" }, - { "$ref": "#/components/schemas/BetaNotFoundError" }, - { "$ref": "#/components/schemas/BetaRateLimitError" }, - { "$ref": "#/components/schemas/BetaGatewayTimeoutError" }, - { "$ref": "#/components/schemas/BetaAPIError" }, - { "$ref": "#/components/schemas/BetaOverloadedError" } - ], - "title": "Error" - }, - "request_id": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "default": null, - "title": "Request Id" - }, - "type": { - "const": "error", - "default": "error", - "enum": ["error"], - "title": "Type", - "type": "string" - } - }, - "required": ["error", "request_id", "type"], - "title": "ErrorResponse", - "type": "object" - }, - "BetaErroredResult": { - "properties": { - "error": { "$ref": "#/components/schemas/BetaErrorResponse" }, - "type": { - "const": "errored", - "default": "errored", - "enum": ["errored"], - "title": "Type", - "type": "string" - } - }, - "required": ["error", "type"], - "title": "ErroredResult", - "type": "object" - }, - "BetaExpiredResult": { - "properties": { - "type": { - "const": "expired", - "default": "expired", - "enum": ["expired"], - "title": "Type", - "type": "string" - } - }, - "required": ["type"], - "title": "ExpiredResult", - "type": "object" - }, - "BetaFileDeleteResponse": { - "properties": { - "id": { "type": "string", "title": "Id", "description": "ID of the deleted file." }, - "type": { - "type": "string", - "enum": ["file_deleted"], - "const": "file_deleted", - "title": "Type", - "description": "Deleted object type.\n\nFor file deletion, this is always `\"file_deleted\"`.", - "default": "file_deleted" - } - }, - "type": "object", - "required": ["id"], - "title": "FileDeleteResponse" - }, - "BetaFileDocumentSource": { - "additionalProperties": false, - "properties": { - "file_id": { "title": "File Id", "type": "string" }, - "type": { "const": "file", "enum": ["file"], "title": "Type", "type": "string" } - }, - "required": ["file_id", "type"], - "title": "FileDocumentSource", - "type": "object" - }, - "BetaFileImageSource": { - "additionalProperties": false, - "properties": { - "file_id": { "title": "File Id", "type": "string" }, - "type": { "const": "file", "enum": ["file"], "title": "Type", "type": "string" } - }, - "required": ["file_id", "type"], - "title": "FileImageSource", - "type": "object" - }, - "BetaFileListResponse": { - "properties": { - "data": { - "items": { "$ref": "#/components/schemas/BetaFileMetadataSchema" }, - "type": "array", - "title": "Data", - "description": "List of file metadata objects." - }, - "first_id": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "First Id", - "description": "ID of the first file in this page of results." - }, - "has_more": { - "type": "boolean", - "title": "Has More", - "description": "Whether there are more results available.", - "default": false - }, - "last_id": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Last Id", - "description": "ID of the last file in this page of results." - } - }, - "type": "object", - "required": ["data"], - "title": "FileListResponse" - }, - "BetaFileMetadataSchema": { - "properties": { - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At", - "description": "RFC 3339 datetime string representing when the file was created." - }, - "downloadable": { - "type": "boolean", - "title": "Downloadable", - "description": "Whether the file can be downloaded.", - "default": false - }, - "filename": { - "type": "string", - "maxLength": 500, - "minLength": 1, - "title": "Filename", - "description": "Original filename of the uploaded file." - }, - "id": { - "type": "string", - "title": "Id", - "description": "Unique object identifier.\n\nThe format and length of IDs may change over time." - }, - "mime_type": { - "type": "string", - "maxLength": 255, - "minLength": 1, - "title": "Mime Type", - "description": "MIME type of the file." - }, - "size_bytes": { - "type": "integer", - "minimum": 0, - "title": "Size Bytes", - "description": "Size of the file in bytes." - }, - "type": { - "type": "string", - "enum": ["file"], - "const": "file", - "title": "Type", - "description": "Object type.\n\nFor files, this is always `\"file\"`." - } - }, - "type": "object", - "required": ["created_at", "filename", "id", "mime_type", "size_bytes", "type"], - "title": "FileMetadataSchema" - }, - "BetaGatewayTimeoutError": { - "properties": { - "message": { "default": "Request timeout", "title": "Message", "type": "string" }, - "type": { - "const": "timeout_error", - "default": "timeout_error", - "enum": ["timeout_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["message", "type"], - "title": "GatewayTimeoutError", - "type": "object" - }, - "BetaInputJsonContentBlockDelta": { - "properties": { - "partial_json": { "title": "Partial Json", "type": "string" }, - "type": { - "const": "input_json_delta", - "default": "input_json_delta", - "enum": ["input_json_delta"], - "title": "Type", - "type": "string" - } - }, - "required": ["partial_json", "type"], - "title": "InputJsonContentBlockDelta", - "type": "object" - }, - "BetaInputMessage": { - "additionalProperties": false, - "properties": { - "content": { - "anyOf": [ - { "type": "string", "x-stainless-skip": ["go", "cli"] }, + ] + + ``` + + + And 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: + + + ```json + + [ { - "items": { "$ref": "#/components/schemas/BetaInputContentBlock" }, - "type": "array", - "example": [{ "type": "text", "text": "What is a quaternion?" }] + "type": "tool_use", + "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "name": "get_stock_price", + "input": { "ticker": "^GSPC" } } - ], - "title": "Content" - }, - "role": { "enum": ["user", "assistant"], "title": "Role", "type": "string" } - }, - "required": ["content", "role"], - "title": "InputMessage", - "type": "object", - "discriminator": { "propertyName": "role" } - }, - "BetaInputSchema": { - "additionalProperties": true, - "properties": { - "properties": { "anyOf": [{ "type": "object" }, { "type": "null" }], "title": "Properties" }, - "required": { - "anyOf": [{ "items": { "type": "string" }, "type": "array" }, { "type": "null" }], - "title": "Required" - }, - "type": { "const": "object", "enum": ["object"], "title": "Type", "type": "string" } - }, - "required": ["type"], - "title": "InputSchema", - "type": "object" - }, - "BetaInputTokensClearAtLeast": { - "additionalProperties": false, - "properties": { - "type": { "const": "input_tokens", "enum": ["input_tokens"], "title": "Type", "type": "string" }, - "value": { "minimum": 0, "title": "Value", "type": "integer" } - }, - "required": ["type", "value"], - "title": "InputTokensClearAtLeast", - "type": "object" - }, - "BetaInputTokensTrigger": { - "additionalProperties": false, - "properties": { - "type": { "const": "input_tokens", "enum": ["input_tokens"], "title": "Type", "type": "string" }, - "value": { "minimum": 1, "title": "Value", "type": "integer" } - }, - "required": ["type", "value"], - "title": "InputTokensTrigger", - "type": "object" - }, - "BetaInvalidRequestError": { - "properties": { - "message": { "default": "Invalid request", "title": "Message", "type": "string" }, - "type": { - "const": "invalid_request_error", - "default": "invalid_request_error", - "enum": ["invalid_request_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["message", "type"], - "title": "InvalidRequestError", - "type": "object" - }, - "BetaListResponse_MessageBatch_": { - "properties": { - "data": { - "items": { "$ref": "#/components/schemas/BetaMessageBatch" }, - "type": "array", - "title": "Data" - }, - "first_id": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "First Id", - "description": "First ID in the `data` list. Can be used as the `before_id` for the previous page." - }, - "has_more": { - "type": "boolean", - "title": "Has More", - "description": "Indicates if there are more results in the requested page direction." - }, - "last_id": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Last Id", - "description": "Last ID in the `data` list. Can be used as the `after_id` for the next page." - } - }, - "type": "object", - "required": ["data", "first_id", "has_more", "last_id"], - "title": "ListResponse[MessageBatch]" - }, - "BetaListResponse_ModelInfo_": { - "properties": { - "data": { - "items": { "$ref": "#/components/schemas/BetaModelInfo" }, - "type": "array", - "title": "Data" - }, - "first_id": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "First Id", - "description": "First ID in the `data` list. Can be used as the `before_id` for the previous page." - }, - "has_more": { - "type": "boolean", - "title": "Has More", - "description": "Indicates if there are more results in the requested page direction." - }, - "last_id": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Last Id", - "description": "Last ID in the `data` list. Can be used as the `after_id` for the next page." - } - }, - "type": "object", - "required": ["data", "first_id", "has_more", "last_id"], - "title": "ListResponse[ModelInfo]" - }, - "BetaMemoryTool_20250818": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "name": { - "const": "memory", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks.", - "enum": ["memory"], - "title": "Name", - "type": "string" - }, - "type": { - "const": "memory_20250818", - "enum": ["memory_20250818"], - "title": "Type", - "type": "string" - } - }, - "required": ["name", "type"], - "title": "MemoryTool_20250818", - "type": "object" - }, - "BetaMessage": { - "examples": [ - { - "content": [{ "citations": null, "text": "Hi! My name is Claude.", "type": "text" }], - "id": "msg_013Zva2CMHLNnXjNJJKqJ2EF", - "model": "claude-sonnet-4-20250514", - "role": "assistant", - "stop_reason": "end_turn", - "stop_sequence": null, - "type": "message", - "usage": { "input_tokens": 2095, "output_tokens": 503 } - } - ], - "properties": { - "id": { - "description": "Unique object identifier.\n\nThe format and length of IDs may change over time.", - "examples": ["msg_013Zva2CMHLNnXjNJJKqJ2EF"], - "title": "Id", - "type": "string" - }, - "type": { - "const": "message", - "default": "message", - "description": "Object type.\n\nFor Messages, this is always `\"message\"`.", - "enum": ["message"], - "title": "Type", - "type": "string" - }, - "role": { - "const": "assistant", - "default": "assistant", - "description": "Conversational role of the generated message.\n\nThis will always be `\"assistant\"`.", - "enum": ["assistant"], - "title": "Role", - "type": "string" - }, - "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```", - "examples": [[{ "citations": null, "text": "Hi! My name is Claude.", "type": "text" }]], - "items": { "$ref": "#/components/schemas/BetaContentBlock" }, - "title": "Content", - "type": "array" - }, - "model": { "$ref": "#/components/schemas/Model" }, - "stop_reason": { - "anyOf": [{ "$ref": "#/components/schemas/BetaStopReason" }, { "type": "null" }], - "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.", - "title": "Stop Reason" - }, - "stop_sequence": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "default": null, - "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.", - "title": "Stop Sequence" - }, - "usage": { - "$ref": "#/components/schemas/BetaUsage", - "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`.", - "examples": [{ "input_tokens": 2095, "output_tokens": 503 }] - }, - "context_management": { - "anyOf": [{ "$ref": "#/components/schemas/BetaResponseContextManagement" }, { "type": "null" }], - "default": null, - "description": "Information about context management strategies applied during the request" - }, - "container": { - "anyOf": [{ "$ref": "#/components/schemas/BetaContainer" }, { "type": "null" }], - "default": null, - "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." - } - }, - "required": [ - "id", - "type", - "role", - "content", - "model", - "stop_reason", - "stop_sequence", - "usage", - "context_management", - "container" - ], - "title": "Message", - "type": "object", - "x-stainless-python-custom-imports": [ - "from .beta_content_block import BetaContentBlock as BetaContentBlock" - ] - }, - "BetaMessageBatch": { - "properties": { - "archived_at": { - "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }], - "title": "Archived At", - "description": "RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable.", - "examples": ["2024-08-20T18:37:24.100435Z"] - }, - "cancel_initiated_at": { - "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }], - "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.", - "examples": ["2024-08-20T18:37:24.100435Z"] - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At", - "description": "RFC 3339 datetime string representing the time at which the Message Batch was created.", - "examples": ["2024-08-20T18:37:24.100435Z"] - }, - "ended_at": { - "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }], - "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.", - "examples": ["2024-08-20T18:37:24.100435Z"] - }, - "expires_at": { - "type": "string", - "format": "date-time", - "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.", - "examples": ["2024-08-20T18:37:24.100435Z"] - }, - "id": { - "type": "string", - "title": "Id", - "description": "Unique object identifier.\n\nThe format and length of IDs may change over time.", - "examples": ["msgbatch_013Zva2CMHLNnXjNJJKqJ2EF"] - }, - "processing_status": { - "type": "string", - "enum": ["in_progress", "canceling", "ended"], - "title": "Processing Status", - "description": "Processing status of the Message Batch." - }, - "request_counts": { - "$ref": "#/components/schemas/BetaRequestCounts", - "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": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Results Url", - "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.", - "examples": [ - "https://api.anthropic.com/v1/messages/batches/msgbatch_013Zva2CMHLNnXjNJJKqJ2EF/results" ] - }, - "type": { - "type": "string", - "enum": ["message_batch"], - "const": "message_batch", - "title": "Type", - "description": "Object type.\n\nFor Message Batches, this is always `\"message_batch\"`.", - "default": "message_batch" - } - }, - "type": "object", - "required": [ - "archived_at", - "cancel_initiated_at", - "created_at", - "ended_at", - "expires_at", - "id", - "processing_status", - "request_counts", - "results_url", - "type" - ], - "title": "MessageBatch" - }, - "BetaMessageBatchIndividualRequestParams": { - "additionalProperties": false, - "properties": { - "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.", - "examples": ["my-custom-id-1"], - "maxLength": 64, - "minLength": 1, - "pattern": "^[a-zA-Z0-9_-]{1,64}$", - "title": "Custom Id", - "type": "string" - }, - "params": { - "$ref": "#/components/schemas/BetaCreateMessageParams", - "description": "Messages API creation parameters for the individual request. \n\nSee the [Messages API reference](/en/api/messages) for full documentation on available parameters." - } - }, - "required": ["custom_id", "params"], - "title": "MessageBatchIndividualRequestParams", - "type": "object" - }, - "BetaMessageBatchIndividualResponse": { - "description": "This is a single line in the response `.jsonl` file and does not represent the response as a whole.", - "properties": { - "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.", - "examples": ["my-custom-id-1"], - "title": "Custom Id", - "type": "string" - }, - "result": { - "description": "Processing result for this request.\n\nContains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration.", - "discriminator": { - "mapping": { - "canceled": "#/components/schemas/BetaCanceledResult", - "errored": "#/components/schemas/BetaErroredResult", - "expired": "#/components/schemas/BetaExpiredResult", - "succeeded": "#/components/schemas/BetaSucceededResult" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/BetaSucceededResult" }, - { "$ref": "#/components/schemas/BetaErroredResult" }, - { "$ref": "#/components/schemas/BetaCanceledResult" }, - { "$ref": "#/components/schemas/BetaExpiredResult" } - ], - "title": "Result" - } - }, - "required": ["custom_id", "result"], - "title": "MessageBatchIndividualResponse", - "type": "object" - }, - "BetaMessageDelta": { - "properties": { - "container": { - "anyOf": [{ "$ref": "#/components/schemas/BetaContainer" }, { "type": "null" }], - "default": null, - "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." - }, - "stop_reason": { - "anyOf": [{ "$ref": "#/components/schemas/BetaStopReason" }, { "type": "null" }], - "default": null, - "title": "Stop Reason" - }, - "stop_sequence": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "default": null, - "title": "Stop Sequence" - } - }, - "required": ["container", "stop_reason", "stop_sequence"], - "title": "MessageDelta", - "type": "object" - }, - "BetaMessageDeltaEvent": { - "properties": { - "context_management": { - "anyOf": [{ "$ref": "#/components/schemas/BetaResponseContextManagement" }, { "type": "null" }], - "default": null, - "description": "Information about context management strategies applied during the request" - }, - "delta": { "$ref": "#/components/schemas/BetaMessageDelta" }, - "type": { - "const": "message_delta", - "default": "message_delta", - "enum": ["message_delta"], - "title": "Type", - "type": "string" - }, - "usage": { - "$ref": "#/components/schemas/BetaMessageDeltaUsage", - "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`.", - "examples": [{ "output_tokens": 503 }] - } - }, - "required": ["context_management", "delta", "type", "usage"], - "title": "MessageDeltaEvent", - "type": "object" - }, - "BetaMessageDeltaUsage": { - "properties": { - "cache_creation_input_tokens": { - "anyOf": [{ "minimum": 0, "type": "integer" }, { "type": "null" }], - "default": null, - "description": "The cumulative number of input tokens used to create the cache entry.", - "examples": [2051], - "title": "Cache Creation Input Tokens" - }, - "cache_read_input_tokens": { - "anyOf": [{ "minimum": 0, "type": "integer" }, { "type": "null" }], - "default": null, - "description": "The cumulative number of input tokens read from the cache.", - "examples": [2051], - "title": "Cache Read Input Tokens" - }, - "input_tokens": { - "anyOf": [{ "minimum": 0, "type": "integer" }, { "type": "null" }], - "default": null, - "description": "The cumulative number of input tokens which were used.", - "examples": [2095], - "title": "Input Tokens" - }, - "output_tokens": { - "description": "The cumulative number of output tokens which were used.", - "examples": [503], - "title": "Output Tokens", - "type": "integer" - }, - "server_tool_use": { - "anyOf": [{ "$ref": "#/components/schemas/BetaServerToolUsage" }, { "type": "null" }], - "default": null, - "description": "The number of server tool requests." - } - }, - "required": [ - "cache_creation_input_tokens", - "cache_read_input_tokens", - "input_tokens", - "output_tokens", - "server_tool_use" - ], - "title": "MessageDeltaUsage", - "type": "object" - }, - "BetaMessageStartEvent": { - "properties": { - "message": { "$ref": "#/components/schemas/BetaMessage" }, - "type": { - "const": "message_start", - "default": "message_start", - "enum": ["message_start"], - "title": "Type", - "type": "string" - } - }, - "required": ["message", "type"], - "title": "MessageStartEvent", - "type": "object" - }, - "BetaMessageStopEvent": { - "properties": { - "type": { - "const": "message_stop", - "default": "message_stop", - "enum": ["message_stop"], - "title": "Type", - "type": "string" - } - }, - "required": ["type"], - "title": "MessageStopEvent", - "type": "object" - }, - "BetaMessageStreamEvent": { - "discriminator": { - "mapping": { - "content_block_delta": "#/components/schemas/BetaContentBlockDeltaEvent", - "content_block_start": "#/components/schemas/BetaContentBlockStartEvent", - "content_block_stop": "#/components/schemas/BetaContentBlockStopEvent", - "message_delta": "#/components/schemas/BetaMessageDeltaEvent", - "message_start": "#/components/schemas/BetaMessageStartEvent", - "message_stop": "#/components/schemas/BetaMessageStopEvent" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/BetaMessageStartEvent" }, - { "$ref": "#/components/schemas/BetaMessageDeltaEvent" }, - { "$ref": "#/components/schemas/BetaMessageStopEvent" }, - { "$ref": "#/components/schemas/BetaContentBlockStartEvent" }, - { "$ref": "#/components/schemas/BetaContentBlockDeltaEvent" }, - { "$ref": "#/components/schemas/BetaContentBlockStopEvent" } - ], - "title": "MessageStreamEvent" - }, - "BetaMetadata": { - "additionalProperties": false, - "properties": { - "user_id": { - "anyOf": [{ "maxLength": 256, "type": "string" }, { "type": "null" }], - "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.", - "examples": ["13803d75-b4b5-4c3e-b2a2-6f21399b021b"], - "title": "User Id" - } - }, - "title": "Metadata", - "type": "object" - }, - "BetaModelInfo": { - "properties": { - "created_at": { - "type": "string", - "format": "date-time", - "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.", - "examples": ["2025-02-19T00:00:00Z"] - }, - "display_name": { - "type": "string", - "title": "Display Name", - "description": "A human-readable name for the model.", - "examples": ["Claude Sonnet 4"] - }, - "id": { - "type": "string", - "title": "Id", - "description": "Unique model identifier.", - "examples": ["claude-sonnet-4-20250514"] - }, - "type": { - "type": "string", - "enum": ["model"], - "const": "model", - "title": "Type", - "description": "Object type.\n\nFor Models, this is always `\"model\"`.", - "default": "model" - } - }, - "type": "object", - "required": ["created_at", "display_name", "id", "type"], - "title": "ModelInfo" - }, - "BetaNotFoundError": { - "properties": { - "message": { "default": "Not found", "title": "Message", "type": "string" }, - "type": { - "const": "not_found_error", - "default": "not_found_error", - "enum": ["not_found_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["message", "type"], - "title": "NotFoundError", - "type": "object" - }, - "BetaOverloadedError": { - "properties": { - "message": { "default": "Overloaded", "title": "Message", "type": "string" }, - "type": { - "const": "overloaded_error", - "default": "overloaded_error", - "enum": ["overloaded_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["message", "type"], - "title": "OverloadedError", - "type": "object" - }, - "BetaPermissionError": { - "properties": { - "message": { "default": "Permission denied", "title": "Message", "type": "string" }, - "type": { - "const": "permission_error", - "default": "permission_error", - "enum": ["permission_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["message", "type"], - "title": "PermissionError", - "type": "object" - }, - "BetaPlainTextSource": { - "additionalProperties": false, - "properties": { - "data": { "title": "Data", "type": "string" }, - "media_type": { - "const": "text/plain", - "enum": ["text/plain"], - "title": "Media Type", - "type": "string" - }, - "type": { "const": "text", "enum": ["text"], "title": "Type", "type": "string" } - }, - "required": ["data", "media_type", "type"], - "title": "PlainTextSource", - "type": "object" - }, - "BetaRateLimitError": { - "properties": { - "message": { "default": "Rate limited", "title": "Message", "type": "string" }, - "type": { - "const": "rate_limit_error", - "default": "rate_limit_error", - "enum": ["rate_limit_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["message", "type"], - "title": "RateLimitError", - "type": "object" - }, - "BetaRequestBashCodeExecutionOutputBlock": { - "additionalProperties": false, - "properties": { - "file_id": { "title": "File Id", "type": "string" }, - "type": { - "const": "bash_code_execution_output", - "enum": ["bash_code_execution_output"], - "title": "Type", - "type": "string" - } - }, - "required": ["file_id", "type"], - "title": "RequestBashCodeExecutionOutputBlock", - "type": "object" - }, - "BetaRequestBashCodeExecutionResultBlock": { - "additionalProperties": false, - "properties": { - "content": { - "items": { "$ref": "#/components/schemas/BetaRequestBashCodeExecutionOutputBlock" }, - "title": "Content", - "type": "array" - }, - "return_code": { "title": "Return Code", "type": "integer" }, - "stderr": { "title": "Stderr", "type": "string" }, - "stdout": { "title": "Stdout", "type": "string" }, - "type": { - "const": "bash_code_execution_result", - "enum": ["bash_code_execution_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["content", "return_code", "stderr", "stdout", "type"], - "title": "RequestBashCodeExecutionResultBlock", - "type": "object" - }, - "BetaRequestBashCodeExecutionToolResultBlock": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "content": { - "anyOf": [ - { "$ref": "#/components/schemas/BetaRequestBashCodeExecutionToolResultError" }, - { "$ref": "#/components/schemas/BetaRequestBashCodeExecutionResultBlock" } - ], - "title": "Content" - }, - "tool_use_id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Tool Use Id", "type": "string" }, - "type": { - "const": "bash_code_execution_tool_result", - "enum": ["bash_code_execution_tool_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["content", "tool_use_id", "type"], - "title": "RequestBashCodeExecutionToolResultBlock", - "type": "object" - }, - "BetaRequestBashCodeExecutionToolResultError": { - "additionalProperties": false, - "properties": { - "error_code": { "$ref": "#/components/schemas/BetaBashCodeExecutionToolResultErrorCode" }, - "type": { - "const": "bash_code_execution_tool_result_error", - "enum": ["bash_code_execution_tool_result_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["error_code", "type"], - "title": "RequestBashCodeExecutionToolResultError", - "type": "object" - }, - "BetaRequestCharLocationCitation": { - "additionalProperties": false, - "properties": { - "cited_text": { "title": "Cited Text", "type": "string" }, - "document_index": { "minimum": 0, "title": "Document Index", "type": "integer" }, - "document_title": { - "anyOf": [{ "maxLength": 255, "minLength": 1, "type": "string" }, { "type": "null" }], - "title": "Document Title" - }, - "end_char_index": { "title": "End Char Index", "type": "integer" }, - "start_char_index": { "minimum": 0, "title": "Start Char Index", "type": "integer" }, - "type": { "const": "char_location", "enum": ["char_location"], "title": "Type", "type": "string" } - }, - "required": [ - "cited_text", - "document_index", - "document_title", - "end_char_index", - "start_char_index", - "type" - ], - "title": "RequestCharLocationCitation", - "type": "object" - }, - "BetaRequestCitationsConfig": { - "additionalProperties": false, - "properties": { "enabled": { "title": "Enabled", "type": "boolean" } }, - "title": "RequestCitationsConfig", - "type": "object" - }, - "BetaRequestCodeExecutionOutputBlock": { - "additionalProperties": false, - "properties": { - "file_id": { "title": "File Id", "type": "string" }, - "type": { - "const": "code_execution_output", - "enum": ["code_execution_output"], - "title": "Type", - "type": "string" - } - }, - "required": ["file_id", "type"], - "title": "RequestCodeExecutionOutputBlock", - "type": "object" - }, - "BetaRequestCodeExecutionResultBlock": { - "additionalProperties": false, - "properties": { - "content": { - "items": { "$ref": "#/components/schemas/BetaRequestCodeExecutionOutputBlock" }, - "title": "Content", - "type": "array" - }, - "return_code": { "title": "Return Code", "type": "integer" }, - "stderr": { "title": "Stderr", "type": "string" }, - "stdout": { "title": "Stdout", "type": "string" }, - "type": { - "const": "code_execution_result", - "enum": ["code_execution_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["content", "return_code", "stderr", "stdout", "type"], - "title": "Result Block", - "type": "object" - }, - "BetaRequestCodeExecutionToolResultBlock": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ + + ``` + + + You 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: + + + ```json + + [ { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "content": { - "anyOf": [ + "type": "tool_result", + "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "content": "259.75 USD" + } + ] + + ``` + + + Tools 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. + + + See our [guide](https://docs.claude.com/en/docs/tool-use) for more details. + examples: + - description: Get the current weather in a given location + input_schema: + properties: + location: + description: The city and state, e.g. San Francisco, CA + type: string + unit: + description: Unit for the output - one of (celsius, fahrenheit) + type: string + required: + - location + type: object + name: get_weather + items: + oneOf: + - $ref: '#/components/schemas/Tool' + - $ref: '#/components/schemas/BashTool_20250124' + - $ref: '#/components/schemas/TextEditor_20250124' + - $ref: '#/components/schemas/TextEditor_20250429' + - $ref: '#/components/schemas/TextEditor_20250728' + - $ref: '#/components/schemas/WebSearchTool_20250305' + title: Tools + type: array + required: + - messages + - model + title: CountMessageTokensParams + type: object + CountMessageTokensResponse: + properties: + input_tokens: + type: integer + title: Input Tokens + description: The total number of tokens across the provided list of messages, system prompt, and tools. + examples: + - 2095 + type: object + required: + - input_tokens + title: CountMessageTokensResponse + examples: + - input_tokens: 2095 + CreateMessageBatchParams: + additionalProperties: false + properties: + requests: + description: List of requests for prompt completion. Each is an individual request to create a Message. + items: + $ref: '#/components/schemas/MessageBatchIndividualRequestParams' + maxItems: 100000 + minItems: 1 + title: Requests + type: array + required: + - requests + title: CreateMessageBatchParams + type: object + CreateMessageParams: + additionalProperties: false + example: + max_tokens: 1024 + messages: + - content: Hello, world + role: user + model: claude-sonnet-4-5-20250929 + properties: + model: + $ref: '#/components/schemas/Model' + messages: + description: >- + Input messages. + + + Our 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. + + + Each 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. + + + If 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. + + + Example with a single `user` message: + + + ```json + + [{"role": "user", "content": "Hello, Claude"}] + + ``` + + + Example with multiple conversational turns: + + + ```json + + [ + {"role": "user", "content": "Hello there."}, + {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"}, + {"role": "user", "content": "Can you explain LLMs in plain English?"}, + ] + + ``` + + + Example with a partially-filled response from Claude: + + + ```json + + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("}, + ] + + ``` + + + Each 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: + + + ```json + + {"role": "user", "content": "Hello, Claude"} + + ``` + + + ```json + + {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]} + + ``` + + + See [input examples](https://docs.claude.com/en/api/messages-examples). + + + Note 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. + + + There is a limit of 100,000 messages in a single request. + items: + $ref: '#/components/schemas/InputMessage' + title: Messages + type: array + max_tokens: + description: >- + The maximum number of tokens to generate before stopping. + + + Note that our models may stop _before_ reaching this maximum. This parameter only specifies the + absolute maximum number of tokens to generate. + + + Different models have different maximum values for this parameter. See + [models](https://docs.claude.com/en/docs/models-overview) for details. + examples: + - 1024 + minimum: 1 + title: Max Tokens + type: integer + metadata: + $ref: '#/components/schemas/Metadata' + description: An object describing metadata about the request. + service_tier: + description: >- + Determines whether to use priority capacity (if available) or standard capacity for this request. + + + Anthropic offers different levels of service for your API requests. See + [service-tiers](https://docs.claude.com/en/api/service-tiers) for details. + enum: + - auto + - standard_only + title: Service Tier + type: string + stop_sequences: + description: >- + Custom text sequences that will cause the model to stop generating. + + + Our models will normally stop when they have naturally completed their turn, which will result in + a response `stop_reason` of `"end_turn"`. + + + If 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. + items: + type: string + title: Stop Sequences + type: array + stream: + description: |- + Whether to incrementally stream the response using server-sent events. + + See [streaming](https://docs.claude.com/en/api/messages-streaming) for details. + title: Stream + type: boolean + system: + anyOf: + - type: string + x-stainless-skip: + - go + - cli + - items: + $ref: '#/components/schemas/RequestTextBlock' + type: array + description: >- + System prompt. + + + A 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). + examples: + - - text: Today's date is 2024-06-01. + type: text + - Today's date is 2023-01-01. + title: System + temperature: + description: >- + Amount of randomness injected into the response. + + + Defaults 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. + + + Note that even with `temperature` of `0.0`, the results will not be fully deterministic. + examples: + - 1 + maximum: 1 + minimum: 0 + title: Temperature + type: number + thinking: + $ref: '#/components/schemas/ThinkingConfigParam' + tool_choice: + $ref: '#/components/schemas/ToolChoice' + tools: + description: >- + Definitions of tools that the model may use. + + + If 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. + + + There 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)). + + + Each tool definition includes: + + + * `name`: Name of the tool. + + * `description`: Optional, but strongly-recommended description of the tool. + + * `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. + + + For example, if you defined `tools` as: + + + ```json + + [ { - "$ref": "#/components/schemas/BetaRequestCodeExecutionToolResultError", - "x-stainless-naming": { - "go": { "variant_constructor": "BetaNewCodeExecutionToolRequestError" } + "name": "get_stock_price", + "description": "Get the current stock price for a given ticker symbol.", + "input_schema": { + "type": "object", + "properties": { + "ticker": { + "type": "string", + "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." + } + }, + "required": ["ticker"] } - }, - { "$ref": "#/components/schemas/BetaRequestCodeExecutionResultBlock" } - ], - "title": "Content" - }, - "tool_use_id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Tool Use Id", "type": "string" }, - "type": { - "const": "code_execution_tool_result", - "enum": ["code_execution_tool_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["content", "tool_use_id", "type"], - "title": "RequestCodeExecutionToolResultBlock", - "type": "object" - }, - "BetaRequestCodeExecutionToolResultError": { - "additionalProperties": false, - "properties": { - "error_code": { "$ref": "#/components/schemas/BetaCodeExecutionToolResultErrorCode" }, - "type": { - "const": "code_execution_tool_result_error", - "enum": ["code_execution_tool_result_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["error_code", "type"], - "title": "Error", - "type": "object" - }, - "BetaRequestContainerUploadBlock": { - "additionalProperties": false, - "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.", - "properties": { - "cache_control": { - "anyOf": [ + } + ] + + ``` + + + And 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: + + + ```json + + [ { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "file_id": { "title": "File Id", "type": "string" }, - "type": { - "const": "container_upload", - "enum": ["container_upload"], - "title": "Type", - "type": "string" - } - }, - "required": ["file_id", "type"], - "title": "RequestContainerUploadBlock", - "type": "object" - }, - "BetaRequestContentBlockLocationCitation": { - "additionalProperties": false, - "properties": { - "cited_text": { "title": "Cited Text", "type": "string" }, - "document_index": { "minimum": 0, "title": "Document Index", "type": "integer" }, - "document_title": { - "anyOf": [{ "maxLength": 255, "minLength": 1, "type": "string" }, { "type": "null" }], - "title": "Document Title" - }, - "end_block_index": { "title": "End Block Index", "type": "integer" }, - "start_block_index": { "minimum": 0, "title": "Start Block Index", "type": "integer" }, - "type": { - "const": "content_block_location", - "enum": ["content_block_location"], - "title": "Type", - "type": "string" - } - }, - "required": [ - "cited_text", - "document_index", - "document_title", - "end_block_index", - "start_block_index", - "type" - ], - "title": "RequestContentBlockLocationCitation", - "type": "object" - }, - "BetaRequestCounts": { - "properties": { - "canceled": { - "type": "integer", - "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, - "examples": [10] - }, - "errored": { - "type": "integer", - "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, - "examples": [30] - }, - "expired": { - "type": "integer", - "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, - "examples": [10] - }, - "processing": { - "type": "integer", - "title": "Processing", - "description": "Number of requests in the Message Batch that are processing.", - "default": 0, - "examples": [100] - }, - "succeeded": { - "type": "integer", - "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, - "examples": [50] - } - }, - "type": "object", - "required": ["canceled", "errored", "expired", "processing", "succeeded"], - "title": "RequestCounts" - }, - "BetaRequestDocumentBlock": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "citations": { - "anyOf": [{ "$ref": "#/components/schemas/BetaRequestCitationsConfig" }, { "type": "null" }] - }, - "context": { - "anyOf": [{ "minLength": 1, "type": "string" }, { "type": "null" }], - "title": "Context" - }, - "source": { - "discriminator": { - "mapping": { - "base64": "#/components/schemas/BetaBase64PDFSource", - "content": "#/components/schemas/BetaContentBlockSource", - "file": "#/components/schemas/BetaFileDocumentSource", - "text": "#/components/schemas/BetaPlainTextSource", - "url": "#/components/schemas/BetaURLPDFSource" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/BetaBase64PDFSource" }, - { "$ref": "#/components/schemas/BetaPlainTextSource" }, - { "$ref": "#/components/schemas/BetaContentBlockSource" }, - { "$ref": "#/components/schemas/BetaURLPDFSource" }, - { "$ref": "#/components/schemas/BetaFileDocumentSource" } - ], - "title": "Source" - }, - "title": { - "anyOf": [{ "maxLength": 500, "minLength": 1, "type": "string" }, { "type": "null" }], - "title": "Title" - }, - "type": { "const": "document", "enum": ["document"], "title": "Type", "type": "string" } - }, - "required": ["source", "type"], - "title": "RequestDocumentBlock", - "type": "object" - }, - "BetaRequestImageBlock": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "source": { - "discriminator": { - "mapping": { - "base64": "#/components/schemas/BetaBase64ImageSource", - "file": "#/components/schemas/BetaFileImageSource", - "url": "#/components/schemas/BetaURLImageSource" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/BetaBase64ImageSource" }, - { "$ref": "#/components/schemas/BetaURLImageSource" }, - { "$ref": "#/components/schemas/BetaFileImageSource" } - ], - "title": "Source" - }, - "type": { "const": "image", "enum": ["image"], "title": "Type", "type": "string" } - }, - "required": ["source", "type"], - "title": "RequestImageBlock", - "type": "object" - }, - "BetaRequestMCPServerToolConfiguration": { - "additionalProperties": false, - "properties": { - "allowed_tools": { - "anyOf": [{ "items": { "type": "string" }, "type": "array" }, { "type": "null" }], - "title": "Allowed Tools" - }, - "enabled": { "anyOf": [{ "type": "boolean" }, { "type": "null" }], "title": "Enabled" } - }, - "title": "RequestMCPServerToolConfiguration", - "type": "object" - }, - "BetaRequestMCPServerURLDefinition": { - "additionalProperties": false, - "properties": { - "authorization_token": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Authorization Token" - }, - "name": { "title": "Name", "type": "string" }, - "tool_configuration": { - "anyOf": [ - { "$ref": "#/components/schemas/BetaRequestMCPServerToolConfiguration" }, - { "type": "null" } - ] - }, - "type": { "const": "url", "enum": ["url"], "title": "Type", "type": "string" }, - "url": { "title": "Url", "type": "string" } - }, - "required": ["name", "type", "url"], - "title": "RequestMCPServerURLDefinition", - "type": "object" - }, - "BetaRequestMCPToolResultBlock": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "content": { - "anyOf": [ - { "type": "string" }, - { - "items": { - "$ref": "#/components/schemas/BetaRequestTextBlock", - "title": "beta_mcp_tool_result_block_param_content_item" - }, - "type": "array", - "title": "beta_mcp_tool_result_block_param_content" - } - ], - "title": "Content" - }, - "is_error": { "title": "Is Error", "type": "boolean" }, - "tool_use_id": { "pattern": "^[a-zA-Z0-9_-]+$", "title": "Tool Use Id", "type": "string" }, - "type": { - "const": "mcp_tool_result", - "enum": ["mcp_tool_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["tool_use_id", "type"], - "title": "RequestMCPToolResultBlock", - "type": "object" - }, - "BetaRequestMCPToolUseBlock": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "id": { "pattern": "^[a-zA-Z0-9_-]+$", "title": "Id", "type": "string" }, - "input": { "title": "Input", "type": "object" }, - "name": { "title": "Name", "type": "string" }, - "server_name": { - "description": "The name of the MCP server", - "title": "Server Name", - "type": "string" - }, - "type": { "const": "mcp_tool_use", "enum": ["mcp_tool_use"], "title": "Type", "type": "string" } - }, - "required": ["id", "input", "name", "server_name", "type"], - "title": "RequestMCPToolUseBlock", - "type": "object" - }, - "BetaRequestPageLocationCitation": { - "additionalProperties": false, - "properties": { - "cited_text": { "title": "Cited Text", "type": "string" }, - "document_index": { "minimum": 0, "title": "Document Index", "type": "integer" }, - "document_title": { - "anyOf": [{ "maxLength": 255, "minLength": 1, "type": "string" }, { "type": "null" }], - "title": "Document Title" - }, - "end_page_number": { "title": "End Page Number", "type": "integer" }, - "start_page_number": { "minimum": 1, "title": "Start Page Number", "type": "integer" }, - "type": { "const": "page_location", "enum": ["page_location"], "title": "Type", "type": "string" } - }, - "required": [ - "cited_text", - "document_index", - "document_title", - "end_page_number", - "start_page_number", - "type" - ], - "title": "RequestPageLocationCitation", - "type": "object" - }, - "BetaRequestRedactedThinkingBlock": { - "additionalProperties": false, - "properties": { - "data": { "title": "Data", "type": "string" }, - "type": { - "const": "redacted_thinking", - "enum": ["redacted_thinking"], - "title": "Type", - "type": "string" - } - }, - "required": ["data", "type"], - "title": "RequestRedactedThinkingBlock", - "type": "object" - }, - "BetaRequestSearchResultBlock": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "citations": { "$ref": "#/components/schemas/BetaRequestCitationsConfig" }, - "content": { - "items": { "$ref": "#/components/schemas/BetaRequestTextBlock" }, - "title": "Content", - "type": "array" - }, - "source": { "title": "Source", "type": "string" }, - "title": { "title": "Title", "type": "string" }, - "type": { "const": "search_result", "enum": ["search_result"], "title": "Type", "type": "string" } - }, - "required": ["content", "source", "title", "type"], - "title": "RequestSearchResultBlock", - "type": "object" - }, - "BetaRequestSearchResultLocationCitation": { - "additionalProperties": false, - "properties": { - "cited_text": { "title": "Cited Text", "type": "string" }, - "end_block_index": { "title": "End Block Index", "type": "integer" }, - "search_result_index": { "minimum": 0, "title": "Search Result Index", "type": "integer" }, - "source": { "title": "Source", "type": "string" }, - "start_block_index": { "minimum": 0, "title": "Start Block Index", "type": "integer" }, - "title": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Title" }, - "type": { - "const": "search_result_location", - "enum": ["search_result_location"], - "title": "Type", - "type": "string" - } - }, - "required": [ - "cited_text", - "end_block_index", - "search_result_index", - "source", - "start_block_index", - "title", - "type" - ], - "title": "RequestSearchResultLocationCitation", - "type": "object" - }, - "BetaRequestServerToolUseBlock": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Id", "type": "string" }, - "input": { "title": "Input", "type": "object" }, - "name": { - "enum": [ - "web_search", - "web_fetch", - "code_execution", - "bash_code_execution", - "text_editor_code_execution" - ], - "title": "Name", - "type": "string" - }, - "type": { - "const": "server_tool_use", - "enum": ["server_tool_use"], - "title": "Type", - "type": "string" - } - }, - "required": ["id", "input", "name", "type"], - "title": "RequestServerToolUseBlock", - "type": "object" - }, - "BetaRequestTextBlock": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "citations": { - "anyOf": [ - { - "items": { - "discriminator": { - "mapping": { - "char_location": "#/components/schemas/BetaRequestCharLocationCitation", - "content_block_location": "#/components/schemas/BetaRequestContentBlockLocationCitation", - "page_location": "#/components/schemas/BetaRequestPageLocationCitation", - "search_result_location": "#/components/schemas/BetaRequestSearchResultLocationCitation", - "web_search_result_location": "#/components/schemas/BetaRequestWebSearchResultLocationCitation" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/BetaRequestCharLocationCitation" }, - { "$ref": "#/components/schemas/BetaRequestPageLocationCitation" }, - { "$ref": "#/components/schemas/BetaRequestContentBlockLocationCitation" }, - { "$ref": "#/components/schemas/BetaRequestWebSearchResultLocationCitation" }, - { "$ref": "#/components/schemas/BetaRequestSearchResultLocationCitation" } - ] - }, - "type": "array" - }, - { "type": "null" } - ], - "title": "Citations" - }, - "text": { "minLength": 1, "title": "Text", "type": "string" }, - "type": { "const": "text", "enum": ["text"], "title": "Type", "type": "string" } - }, - "required": ["text", "type"], - "title": "RequestTextBlock", - "type": "object" - }, - "BetaRequestTextEditorCodeExecutionCreateResultBlock": { - "additionalProperties": false, - "properties": { - "is_file_update": { "title": "Is File Update", "type": "boolean" }, - "type": { - "const": "text_editor_code_execution_create_result", - "enum": ["text_editor_code_execution_create_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["is_file_update", "type"], - "title": "RequestTextEditorCodeExecutionCreateResultBlock", - "type": "object" - }, - "BetaRequestTextEditorCodeExecutionStrReplaceResultBlock": { - "additionalProperties": false, - "properties": { - "lines": { - "anyOf": [{ "items": { "type": "string" }, "type": "array" }, { "type": "null" }], - "title": "Lines" - }, - "new_lines": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "New Lines" }, - "new_start": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "New Start" }, - "old_lines": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "Old Lines" }, - "old_start": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "Old Start" }, - "type": { - "const": "text_editor_code_execution_str_replace_result", - "enum": ["text_editor_code_execution_str_replace_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["type"], - "title": "RequestTextEditorCodeExecutionStrReplaceResultBlock", - "type": "object" - }, - "BetaRequestTextEditorCodeExecutionToolResultBlock": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "content": { - "anyOf": [ - { "$ref": "#/components/schemas/BetaRequestTextEditorCodeExecutionToolResultError" }, - { "$ref": "#/components/schemas/BetaRequestTextEditorCodeExecutionViewResultBlock" }, - { "$ref": "#/components/schemas/BetaRequestTextEditorCodeExecutionCreateResultBlock" }, - { "$ref": "#/components/schemas/BetaRequestTextEditorCodeExecutionStrReplaceResultBlock" } - ], - "title": "Content" - }, - "tool_use_id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Tool Use Id", "type": "string" }, - "type": { - "const": "text_editor_code_execution_tool_result", - "enum": ["text_editor_code_execution_tool_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["content", "tool_use_id", "type"], - "title": "RequestTextEditorCodeExecutionToolResultBlock", - "type": "object" - }, - "BetaRequestTextEditorCodeExecutionToolResultError": { - "additionalProperties": false, - "properties": { - "error_code": { "$ref": "#/components/schemas/BetaTextEditorCodeExecutionToolResultErrorCode" }, - "error_message": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Error Message" }, - "type": { - "const": "text_editor_code_execution_tool_result_error", - "enum": ["text_editor_code_execution_tool_result_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["error_code", "type"], - "title": "RequestTextEditorCodeExecutionToolResultError", - "type": "object" - }, - "BetaRequestTextEditorCodeExecutionViewResultBlock": { - "additionalProperties": false, - "properties": { - "content": { "title": "Content", "type": "string" }, - "file_type": { "enum": ["text", "image", "pdf"], "title": "File Type", "type": "string" }, - "num_lines": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "Num Lines" }, - "start_line": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "Start Line" }, - "total_lines": { "anyOf": [{ "type": "integer" }, { "type": "null" }], "title": "Total Lines" }, - "type": { - "const": "text_editor_code_execution_view_result", - "enum": ["text_editor_code_execution_view_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["content", "file_type", "type"], - "title": "RequestTextEditorCodeExecutionViewResultBlock", - "type": "object" - }, - "BetaRequestThinkingBlock": { - "additionalProperties": false, - "properties": { - "signature": { "title": "Signature", "type": "string" }, - "thinking": { "title": "Thinking", "type": "string" }, - "type": { "const": "thinking", "enum": ["thinking"], "title": "Type", "type": "string" } - }, - "required": ["signature", "thinking", "type"], - "title": "RequestThinkingBlock", - "type": "object" - }, - "BetaRequestToolResultBlock": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "content": { - "anyOf": [ - { "type": "string", "x-stainless-skip": ["go", "cli"] }, - { - "items": { - "discriminator": { - "mapping": { - "document": "#/components/schemas/BetaRequestDocumentBlock", - "image": "#/components/schemas/BetaRequestImageBlock", - "search_result": "#/components/schemas/BetaRequestSearchResultBlock", - "text": "#/components/schemas/BetaRequestTextBlock" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/BetaRequestTextBlock" }, - { "$ref": "#/components/schemas/BetaRequestImageBlock" }, - { "$ref": "#/components/schemas/BetaRequestSearchResultBlock" }, - { "$ref": "#/components/schemas/BetaRequestDocumentBlock" } - ], - "title": "Block" - }, - "type": "array", - "x-stainless-naming": { - "python": { "type_name": "Content" }, - "ruby": { "type_name": "Content" } - } - } - ], - "title": "Content" - }, - "is_error": { "title": "Is Error", "type": "boolean" }, - "tool_use_id": { "pattern": "^[a-zA-Z0-9_-]+$", "title": "Tool Use Id", "type": "string" }, - "type": { "const": "tool_result", "enum": ["tool_result"], "title": "Type", "type": "string" } - }, - "required": ["tool_use_id", "type"], - "title": "RequestToolResultBlock", - "type": "object" - }, - "BetaRequestToolUseBlock": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "id": { "pattern": "^[a-zA-Z0-9_-]+$", "title": "Id", "type": "string" }, - "input": { "title": "Input", "type": "object" }, - "name": { "maxLength": 200, "minLength": 1, "title": "Name", "type": "string" }, - "type": { "const": "tool_use", "enum": ["tool_use"], "title": "Type", "type": "string" } - }, - "required": ["id", "input", "name", "type"], - "title": "RequestToolUseBlock", - "type": "object" - }, - "BetaRequestWebFetchResultBlock": { - "additionalProperties": false, - "properties": { - "content": { "$ref": "#/components/schemas/BetaRequestDocumentBlock" }, - "retrieved_at": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "description": "ISO 8601 timestamp when the content was retrieved", - "title": "Retrieved At" - }, - "type": { - "const": "web_fetch_result", - "enum": ["web_fetch_result"], - "title": "Type", - "type": "string" - }, - "url": { "description": "Fetched content URL", "title": "Url", "type": "string" } - }, - "required": ["content", "type", "url"], - "title": "RequestWebFetchResultBlock", - "type": "object" - }, - "BetaRequestWebFetchToolResultBlock": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "content": { - "anyOf": [ - { "$ref": "#/components/schemas/BetaRequestWebFetchToolResultError" }, - { "$ref": "#/components/schemas/BetaRequestWebFetchResultBlock" } - ], - "title": "Content" - }, - "tool_use_id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Tool Use Id", "type": "string" }, - "type": { - "const": "web_fetch_tool_result", - "enum": ["web_fetch_tool_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["content", "tool_use_id", "type"], - "title": "RequestWebFetchToolResultBlock", - "type": "object" - }, - "BetaRequestWebFetchToolResultError": { - "additionalProperties": false, - "properties": { - "error_code": { "$ref": "#/components/schemas/BetaWebFetchToolResultErrorCode" }, - "type": { - "const": "web_fetch_tool_result_error", - "enum": ["web_fetch_tool_result_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["error_code", "type"], - "title": "RequestWebFetchToolResultError", - "type": "object" - }, - "BetaRequestWebSearchResultBlock": { - "additionalProperties": false, - "properties": { - "encrypted_content": { "title": "Encrypted Content", "type": "string" }, - "page_age": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Page Age" }, - "title": { "title": "Title", "type": "string" }, - "type": { - "const": "web_search_result", - "enum": ["web_search_result"], - "title": "Type", - "type": "string" - }, - "url": { "title": "Url", "type": "string" } - }, - "required": ["encrypted_content", "title", "type", "url"], - "title": "RequestWebSearchResultBlock", - "type": "object" - }, - "BetaRequestWebSearchResultLocationCitation": { - "additionalProperties": false, - "properties": { - "cited_text": { "title": "Cited Text", "type": "string" }, - "encrypted_index": { "title": "Encrypted Index", "type": "string" }, - "title": { - "anyOf": [{ "maxLength": 512, "minLength": 1, "type": "string" }, { "type": "null" }], - "title": "Title" - }, - "type": { - "const": "web_search_result_location", - "enum": ["web_search_result_location"], - "title": "Type", - "type": "string" - }, - "url": { "maxLength": 2048, "minLength": 1, "title": "Url", "type": "string" } - }, - "required": ["cited_text", "encrypted_index", "title", "type", "url"], - "title": "RequestWebSearchResultLocationCitation", - "type": "object" - }, - "BetaRequestWebSearchToolResultBlock": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "content": { - "anyOf": [ - { - "items": { "$ref": "#/components/schemas/BetaRequestWebSearchResultBlock" }, - "type": "array", - "title": "Result Block" - }, - { - "$ref": "#/components/schemas/BetaRequestWebSearchToolResultError", - "x-stainless-naming": { "go": { "variant_constructor": "BetaNewWebSearchToolRequestError" } } - } - ], - "title": "Content" - }, - "tool_use_id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Tool Use Id", "type": "string" }, - "type": { - "const": "web_search_tool_result", - "enum": ["web_search_tool_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["content", "tool_use_id", "type"], - "title": "RequestWebSearchToolResultBlock", - "type": "object" - }, - "BetaRequestWebSearchToolResultError": { - "additionalProperties": false, - "properties": { - "error_code": { "$ref": "#/components/schemas/BetaWebSearchToolResultErrorCode" }, - "type": { - "const": "web_search_tool_result_error", - "enum": ["web_search_tool_result_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["error_code", "type"], - "title": "Error", - "type": "object" - }, - "BetaResponseBashCodeExecutionOutputBlock": { - "properties": { - "file_id": { "title": "File Id", "type": "string" }, - "type": { - "const": "bash_code_execution_output", - "default": "bash_code_execution_output", - "enum": ["bash_code_execution_output"], - "title": "Type", - "type": "string" - } - }, - "required": ["file_id", "type"], - "title": "ResponseBashCodeExecutionOutputBlock", - "type": "object" - }, - "BetaResponseBashCodeExecutionResultBlock": { - "properties": { - "content": { - "items": { "$ref": "#/components/schemas/BetaResponseBashCodeExecutionOutputBlock" }, - "title": "Content", - "type": "array" - }, - "return_code": { "title": "Return Code", "type": "integer" }, - "stderr": { "title": "Stderr", "type": "string" }, - "stdout": { "title": "Stdout", "type": "string" }, - "type": { - "const": "bash_code_execution_result", - "default": "bash_code_execution_result", - "enum": ["bash_code_execution_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["content", "return_code", "stderr", "stdout", "type"], - "title": "ResponseBashCodeExecutionResultBlock", - "type": "object" - }, - "BetaResponseBashCodeExecutionToolResultBlock": { - "properties": { - "content": { - "anyOf": [ - { "$ref": "#/components/schemas/BetaResponseBashCodeExecutionToolResultError" }, - { "$ref": "#/components/schemas/BetaResponseBashCodeExecutionResultBlock" } - ], - "title": "Content" - }, - "tool_use_id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Tool Use Id", "type": "string" }, - "type": { - "const": "bash_code_execution_tool_result", - "default": "bash_code_execution_tool_result", - "enum": ["bash_code_execution_tool_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["content", "tool_use_id", "type"], - "title": "ResponseBashCodeExecutionToolResultBlock", - "type": "object" - }, - "BetaResponseBashCodeExecutionToolResultError": { - "properties": { - "error_code": { "$ref": "#/components/schemas/BetaBashCodeExecutionToolResultErrorCode" }, - "type": { - "const": "bash_code_execution_tool_result_error", - "default": "bash_code_execution_tool_result_error", - "enum": ["bash_code_execution_tool_result_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["error_code", "type"], - "title": "ResponseBashCodeExecutionToolResultError", - "type": "object" - }, - "BetaResponseCharLocationCitation": { - "properties": { - "cited_text": { "title": "Cited Text", "type": "string" }, - "document_index": { "minimum": 0, "title": "Document Index", "type": "integer" }, - "document_title": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Document Title" - }, - "end_char_index": { "title": "End Char Index", "type": "integer" }, - "file_id": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "default": null, - "title": "File Id" - }, - "start_char_index": { "minimum": 0, "title": "Start Char Index", "type": "integer" }, - "type": { - "const": "char_location", - "default": "char_location", - "enum": ["char_location"], - "title": "Type", - "type": "string" - } - }, - "required": [ - "cited_text", - "document_index", - "document_title", - "end_char_index", - "file_id", - "start_char_index", - "type" - ], - "title": "ResponseCharLocationCitation", - "type": "object" - }, - "BetaResponseCitationsConfig": { - "properties": { "enabled": { "default": false, "title": "Enabled", "type": "boolean" } }, - "required": ["enabled"], - "title": "ResponseCitationsConfig", - "type": "object" - }, - "BetaResponseClearToolUses20250919Edit": { - "description": "Results for clear_tool_uses_20250919 edit.", - "properties": { - "cleared_input_tokens": { - "description": "Number of input tokens cleared by this edit.", - "minimum": 0, - "title": "Cleared Input Tokens", - "type": "integer" - }, - "cleared_tool_uses": { - "description": "Number of tool uses that were cleared.", - "minimum": 0, - "title": "Cleared Tool Uses", - "type": "integer" - }, - "type": { - "const": "clear_tool_uses_20250919", - "default": "clear_tool_uses_20250919", - "description": "The type of context management edit applied.", - "enum": ["clear_tool_uses_20250919"], - "title": "Type", - "type": "string" - } - }, - "required": ["cleared_input_tokens", "cleared_tool_uses", "type"], - "title": "ResponseClearToolUses20250919Edit", - "type": "object" - }, - "BetaResponseCodeExecutionOutputBlock": { - "properties": { - "file_id": { "title": "File Id", "type": "string" }, - "type": { - "const": "code_execution_output", - "default": "code_execution_output", - "enum": ["code_execution_output"], - "title": "Type", - "type": "string" - } - }, - "required": ["file_id", "type"], - "title": "ResponseCodeExecutionOutputBlock", - "type": "object" - }, - "BetaResponseCodeExecutionResultBlock": { - "properties": { - "content": { - "items": { "$ref": "#/components/schemas/BetaResponseCodeExecutionOutputBlock" }, - "title": "Content", - "type": "array" - }, - "return_code": { "title": "Return Code", "type": "integer" }, - "stderr": { "title": "Stderr", "type": "string" }, - "stdout": { "title": "Stdout", "type": "string" }, - "type": { - "const": "code_execution_result", - "default": "code_execution_result", - "enum": ["code_execution_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["content", "return_code", "stderr", "stdout", "type"], - "title": "ResponseCodeExecutionResultBlock", - "type": "object" - }, - "BetaResponseCodeExecutionToolResultBlock": { - "properties": { - "content": { - "anyOf": [ - { "$ref": "#/components/schemas/BetaResponseCodeExecutionToolResultError" }, - { "$ref": "#/components/schemas/BetaResponseCodeExecutionResultBlock" } - ], - "title": "Content" - }, - "tool_use_id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Tool Use Id", "type": "string" }, - "type": { - "const": "code_execution_tool_result", - "default": "code_execution_tool_result", - "enum": ["code_execution_tool_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["content", "tool_use_id", "type"], - "title": "ResponseCodeExecutionToolResultBlock", - "type": "object" - }, - "BetaResponseCodeExecutionToolResultError": { - "properties": { - "error_code": { "$ref": "#/components/schemas/BetaCodeExecutionToolResultErrorCode" }, - "type": { - "const": "code_execution_tool_result_error", - "default": "code_execution_tool_result_error", - "enum": ["code_execution_tool_result_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["error_code", "type"], - "title": "ResponseCodeExecutionToolResultError", - "type": "object" - }, - "BetaResponseContainerUploadBlock": { - "description": "Response model for a file uploaded to the container.", - "properties": { - "file_id": { "title": "File Id", "type": "string" }, - "type": { - "const": "container_upload", - "default": "container_upload", - "enum": ["container_upload"], - "title": "Type", - "type": "string" - } - }, - "required": ["file_id", "type"], - "title": "ResponseContainerUploadBlock", - "type": "object" - }, - "BetaResponseContentBlockLocationCitation": { - "properties": { - "cited_text": { "title": "Cited Text", "type": "string" }, - "document_index": { "minimum": 0, "title": "Document Index", "type": "integer" }, - "document_title": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Document Title" - }, - "end_block_index": { "title": "End Block Index", "type": "integer" }, - "file_id": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "default": null, - "title": "File Id" - }, - "start_block_index": { "minimum": 0, "title": "Start Block Index", "type": "integer" }, - "type": { - "const": "content_block_location", - "default": "content_block_location", - "enum": ["content_block_location"], - "title": "Type", - "type": "string" - } - }, - "required": [ - "cited_text", - "document_index", - "document_title", - "end_block_index", - "file_id", - "start_block_index", - "type" - ], - "title": "ResponseContentBlockLocationCitation", - "type": "object" - }, - "BetaResponseContextManagement": { - "description": "Information about context management operations applied during the request.", - "properties": { - "applied_edits": { - "description": "List of context management edits that were applied.", - "items": { "$ref": "#/components/schemas/BetaResponseClearToolUses20250919Edit" }, - "title": "Applied Edits", - "type": "array" - } - }, - "required": ["applied_edits"], - "title": "ResponseContextManagement", - "type": "object" - }, - "BetaResponseDocumentBlock": { - "properties": { - "citations": { - "anyOf": [{ "$ref": "#/components/schemas/BetaResponseCitationsConfig" }, { "type": "null" }], - "default": null, - "description": "Citation configuration for the document" - }, - "source": { - "discriminator": { - "mapping": { - "base64": "#/components/schemas/BetaBase64PDFSource", - "text": "#/components/schemas/BetaPlainTextSource" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/BetaBase64PDFSource" }, - { "$ref": "#/components/schemas/BetaPlainTextSource" } - ], - "title": "Source" - }, - "title": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "default": null, - "description": "The title of the document", - "title": "Title" - }, - "type": { - "const": "document", - "default": "document", - "enum": ["document"], - "title": "Type", - "type": "string" - } - }, - "required": ["citations", "source", "title", "type"], - "title": "ResponseDocumentBlock", - "type": "object" - }, - "BetaResponseMCPToolResultBlock": { - "properties": { - "content": { - "anyOf": [ - { "type": "string" }, - { - "items": { - "$ref": "#/components/schemas/BetaResponseTextBlock", - "title": "beta_mcp_tool_result_block_content_item" - }, - "type": "array", - "title": "beta_mcp_tool_result_block_content" - } - ], - "title": "Content" - }, - "is_error": { "default": false, "title": "Is Error", "type": "boolean" }, - "tool_use_id": { "pattern": "^[a-zA-Z0-9_-]+$", "title": "Tool Use Id", "type": "string" }, - "type": { - "const": "mcp_tool_result", - "default": "mcp_tool_result", - "enum": ["mcp_tool_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["content", "is_error", "tool_use_id", "type"], - "title": "ResponseMCPToolResultBlock", - "type": "object" - }, - "BetaResponseMCPToolUseBlock": { - "properties": { - "id": { "pattern": "^[a-zA-Z0-9_-]+$", "title": "Id", "type": "string" }, - "input": { "title": "Input", "type": "object" }, - "name": { "description": "The name of the MCP tool", "title": "Name", "type": "string" }, - "server_name": { - "description": "The name of the MCP server", - "title": "Server Name", - "type": "string" - }, - "type": { - "const": "mcp_tool_use", - "default": "mcp_tool_use", - "enum": ["mcp_tool_use"], - "title": "Type", - "type": "string" - } - }, - "required": ["id", "input", "name", "server_name", "type"], - "title": "ResponseMCPToolUseBlock", - "type": "object" - }, - "BetaResponsePageLocationCitation": { - "properties": { - "cited_text": { "title": "Cited Text", "type": "string" }, - "document_index": { "minimum": 0, "title": "Document Index", "type": "integer" }, - "document_title": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Document Title" - }, - "end_page_number": { "title": "End Page Number", "type": "integer" }, - "file_id": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "default": null, - "title": "File Id" - }, - "start_page_number": { "minimum": 1, "title": "Start Page Number", "type": "integer" }, - "type": { - "const": "page_location", - "default": "page_location", - "enum": ["page_location"], - "title": "Type", - "type": "string" - } - }, - "required": [ - "cited_text", - "document_index", - "document_title", - "end_page_number", - "file_id", - "start_page_number", - "type" - ], - "title": "ResponsePageLocationCitation", - "type": "object" - }, - "BetaResponseRedactedThinkingBlock": { - "properties": { - "data": { "title": "Data", "type": "string" }, - "type": { - "const": "redacted_thinking", - "default": "redacted_thinking", - "enum": ["redacted_thinking"], - "title": "Type", - "type": "string" - } - }, - "required": ["data", "type"], - "title": "ResponseRedactedThinkingBlock", - "type": "object" - }, - "BetaResponseSearchResultLocationCitation": { - "properties": { - "cited_text": { "title": "Cited Text", "type": "string" }, - "end_block_index": { "title": "End Block Index", "type": "integer" }, - "search_result_index": { "minimum": 0, "title": "Search Result Index", "type": "integer" }, - "source": { "title": "Source", "type": "string" }, - "start_block_index": { "minimum": 0, "title": "Start Block Index", "type": "integer" }, - "title": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Title" }, - "type": { - "const": "search_result_location", - "default": "search_result_location", - "enum": ["search_result_location"], - "title": "Type", - "type": "string" - } - }, - "required": [ - "cited_text", - "end_block_index", - "search_result_index", - "source", - "start_block_index", - "title", - "type" - ], - "title": "ResponseSearchResultLocationCitation", - "type": "object" - }, - "BetaResponseServerToolUseBlock": { - "properties": { - "id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Id", "type": "string" }, - "input": { "title": "Input", "type": "object" }, - "name": { - "enum": [ - "web_search", - "web_fetch", - "code_execution", - "bash_code_execution", - "text_editor_code_execution" - ], - "title": "Name", - "type": "string" - }, - "type": { - "const": "server_tool_use", - "default": "server_tool_use", - "enum": ["server_tool_use"], - "title": "Type", - "type": "string" - } - }, - "required": ["id", "input", "name", "type"], - "title": "ResponseServerToolUseBlock", - "type": "object" - }, - "BetaResponseTextBlock": { - "properties": { - "citations": { - "anyOf": [ - { - "items": { - "discriminator": { - "mapping": { - "char_location": "#/components/schemas/BetaResponseCharLocationCitation", - "content_block_location": "#/components/schemas/BetaResponseContentBlockLocationCitation", - "page_location": "#/components/schemas/BetaResponsePageLocationCitation", - "search_result_location": "#/components/schemas/BetaResponseSearchResultLocationCitation", - "web_search_result_location": "#/components/schemas/BetaResponseWebSearchResultLocationCitation" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/BetaResponseCharLocationCitation" }, - { "$ref": "#/components/schemas/BetaResponsePageLocationCitation" }, - { "$ref": "#/components/schemas/BetaResponseContentBlockLocationCitation" }, - { "$ref": "#/components/schemas/BetaResponseWebSearchResultLocationCitation" }, - { "$ref": "#/components/schemas/BetaResponseSearchResultLocationCitation" } - ] - }, - "type": "array" - }, - { "type": "null" } - ], - "default": null, - "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`.", - "title": "Citations" - }, - "text": { "maxLength": 5000000, "minLength": 0, "title": "Text", "type": "string" }, - "type": { "const": "text", "default": "text", "enum": ["text"], "title": "Type", "type": "string" } - }, - "required": ["citations", "text", "type"], - "title": "ResponseTextBlock", - "type": "object" - }, - "BetaResponseTextEditorCodeExecutionCreateResultBlock": { - "properties": { - "is_file_update": { "title": "Is File Update", "type": "boolean" }, - "type": { - "const": "text_editor_code_execution_create_result", - "default": "text_editor_code_execution_create_result", - "enum": ["text_editor_code_execution_create_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["is_file_update", "type"], - "title": "ResponseTextEditorCodeExecutionCreateResultBlock", - "type": "object" - }, - "BetaResponseTextEditorCodeExecutionStrReplaceResultBlock": { - "properties": { - "lines": { - "anyOf": [{ "items": { "type": "string" }, "type": "array" }, { "type": "null" }], - "default": null, - "title": "Lines" - }, - "new_lines": { - "anyOf": [{ "type": "integer" }, { "type": "null" }], - "default": null, - "title": "New Lines" - }, - "new_start": { - "anyOf": [{ "type": "integer" }, { "type": "null" }], - "default": null, - "title": "New Start" - }, - "old_lines": { - "anyOf": [{ "type": "integer" }, { "type": "null" }], - "default": null, - "title": "Old Lines" - }, - "old_start": { - "anyOf": [{ "type": "integer" }, { "type": "null" }], - "default": null, - "title": "Old Start" - }, - "type": { - "const": "text_editor_code_execution_str_replace_result", - "default": "text_editor_code_execution_str_replace_result", - "enum": ["text_editor_code_execution_str_replace_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["lines", "new_lines", "new_start", "old_lines", "old_start", "type"], - "title": "ResponseTextEditorCodeExecutionStrReplaceResultBlock", - "type": "object" - }, - "BetaResponseTextEditorCodeExecutionToolResultBlock": { - "properties": { - "content": { - "anyOf": [ - { "$ref": "#/components/schemas/BetaResponseTextEditorCodeExecutionToolResultError" }, - { "$ref": "#/components/schemas/BetaResponseTextEditorCodeExecutionViewResultBlock" }, - { "$ref": "#/components/schemas/BetaResponseTextEditorCodeExecutionCreateResultBlock" }, - { "$ref": "#/components/schemas/BetaResponseTextEditorCodeExecutionStrReplaceResultBlock" } - ], - "title": "Content" - }, - "tool_use_id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Tool Use Id", "type": "string" }, - "type": { - "const": "text_editor_code_execution_tool_result", - "default": "text_editor_code_execution_tool_result", - "enum": ["text_editor_code_execution_tool_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["content", "tool_use_id", "type"], - "title": "ResponseTextEditorCodeExecutionToolResultBlock", - "type": "object" - }, - "BetaResponseTextEditorCodeExecutionToolResultError": { - "properties": { - "error_code": { "$ref": "#/components/schemas/BetaTextEditorCodeExecutionToolResultErrorCode" }, - "error_message": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "default": null, - "title": "Error Message" - }, - "type": { - "const": "text_editor_code_execution_tool_result_error", - "default": "text_editor_code_execution_tool_result_error", - "enum": ["text_editor_code_execution_tool_result_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["error_code", "error_message", "type"], - "title": "ResponseTextEditorCodeExecutionToolResultError", - "type": "object" - }, - "BetaResponseTextEditorCodeExecutionViewResultBlock": { - "properties": { - "content": { "title": "Content", "type": "string" }, - "file_type": { "enum": ["text", "image", "pdf"], "title": "File Type", "type": "string" }, - "num_lines": { - "anyOf": [{ "type": "integer" }, { "type": "null" }], - "default": null, - "title": "Num Lines" - }, - "start_line": { - "anyOf": [{ "type": "integer" }, { "type": "null" }], - "default": null, - "title": "Start Line" - }, - "total_lines": { - "anyOf": [{ "type": "integer" }, { "type": "null" }], - "default": null, - "title": "Total Lines" - }, - "type": { - "const": "text_editor_code_execution_view_result", - "default": "text_editor_code_execution_view_result", - "enum": ["text_editor_code_execution_view_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["content", "file_type", "num_lines", "start_line", "total_lines", "type"], - "title": "ResponseTextEditorCodeExecutionViewResultBlock", - "type": "object" - }, - "BetaResponseThinkingBlock": { - "properties": { - "signature": { "title": "Signature", "type": "string" }, - "thinking": { "title": "Thinking", "type": "string" }, - "type": { - "const": "thinking", - "default": "thinking", - "enum": ["thinking"], - "title": "Type", - "type": "string" - } - }, - "required": ["signature", "thinking", "type"], - "title": "ResponseThinkingBlock", - "type": "object" - }, - "BetaResponseToolUseBlock": { - "properties": { - "id": { "pattern": "^[a-zA-Z0-9_-]+$", "title": "Id", "type": "string" }, - "input": { "title": "Input", "type": "object" }, - "name": { "minLength": 1, "title": "Name", "type": "string" }, - "type": { - "const": "tool_use", - "default": "tool_use", - "enum": ["tool_use"], - "title": "Type", - "type": "string" - } - }, - "required": ["id", "input", "name", "type"], - "title": "ResponseToolUseBlock", - "type": "object" - }, - "BetaResponseWebFetchResultBlock": { - "properties": { - "content": { "$ref": "#/components/schemas/BetaResponseDocumentBlock" }, - "retrieved_at": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "default": null, - "description": "ISO 8601 timestamp when the content was retrieved", - "title": "Retrieved At" - }, - "type": { - "const": "web_fetch_result", - "default": "web_fetch_result", - "enum": ["web_fetch_result"], - "title": "Type", - "type": "string" - }, - "url": { "description": "Fetched content URL", "title": "Url", "type": "string" } - }, - "required": ["content", "retrieved_at", "type", "url"], - "title": "ResponseWebFetchResultBlock", - "type": "object" - }, - "BetaResponseWebFetchToolResultBlock": { - "properties": { - "content": { - "anyOf": [ - { "$ref": "#/components/schemas/BetaResponseWebFetchToolResultError" }, - { "$ref": "#/components/schemas/BetaResponseWebFetchResultBlock" } - ], - "title": "Content" - }, - "tool_use_id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Tool Use Id", "type": "string" }, - "type": { - "const": "web_fetch_tool_result", - "default": "web_fetch_tool_result", - "enum": ["web_fetch_tool_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["content", "tool_use_id", "type"], - "title": "ResponseWebFetchToolResultBlock", - "type": "object" - }, - "BetaResponseWebFetchToolResultError": { - "properties": { - "error_code": { "$ref": "#/components/schemas/BetaWebFetchToolResultErrorCode" }, - "type": { - "const": "web_fetch_tool_result_error", - "default": "web_fetch_tool_result_error", - "enum": ["web_fetch_tool_result_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["error_code", "type"], - "title": "ResponseWebFetchToolResultError", - "type": "object" - }, - "BetaResponseWebSearchResultBlock": { - "properties": { - "encrypted_content": { "title": "Encrypted Content", "type": "string" }, - "page_age": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "default": null, - "title": "Page Age" - }, - "title": { "title": "Title", "type": "string" }, - "type": { - "const": "web_search_result", - "default": "web_search_result", - "enum": ["web_search_result"], - "title": "Type", - "type": "string" - }, - "url": { "title": "Url", "type": "string" } - }, - "required": ["encrypted_content", "page_age", "title", "type", "url"], - "title": "ResponseWebSearchResultBlock", - "type": "object" - }, - "BetaResponseWebSearchResultLocationCitation": { - "properties": { - "cited_text": { "title": "Cited Text", "type": "string" }, - "encrypted_index": { "title": "Encrypted Index", "type": "string" }, - "title": { - "anyOf": [{ "maxLength": 512, "type": "string" }, { "type": "null" }], - "title": "Title" - }, - "type": { - "const": "web_search_result_location", - "default": "web_search_result_location", - "enum": ["web_search_result_location"], - "title": "Type", - "type": "string" - }, - "url": { "title": "Url", "type": "string" } - }, - "required": ["cited_text", "encrypted_index", "title", "type", "url"], - "title": "ResponseWebSearchResultLocationCitation", - "type": "object" - }, - "BetaResponseWebSearchToolResultBlock": { - "properties": { - "content": { - "anyOf": [ - { "$ref": "#/components/schemas/BetaResponseWebSearchToolResultError" }, - { - "items": { "$ref": "#/components/schemas/BetaResponseWebSearchResultBlock" }, - "type": "array" - } - ], - "title": "Content" - }, - "tool_use_id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Tool Use Id", "type": "string" }, - "type": { - "const": "web_search_tool_result", - "default": "web_search_tool_result", - "enum": ["web_search_tool_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["content", "tool_use_id", "type"], - "title": "ResponseWebSearchToolResultBlock", - "type": "object" - }, - "BetaResponseWebSearchToolResultError": { - "properties": { - "error_code": { "$ref": "#/components/schemas/BetaWebSearchToolResultErrorCode" }, - "type": { - "const": "web_search_tool_result_error", - "default": "web_search_tool_result_error", - "enum": ["web_search_tool_result_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["error_code", "type"], - "title": "ResponseWebSearchToolResultError", - "type": "object" - }, - "BetaServerToolUsage": { - "properties": { - "web_fetch_requests": { - "default": 0, - "description": "The number of web fetch tool requests.", - "examples": [2], - "minimum": 0, - "title": "Web Fetch Requests", - "type": "integer" - }, - "web_search_requests": { - "default": 0, - "description": "The number of web search tool requests.", - "examples": [0], - "minimum": 0, - "title": "Web Search Requests", - "type": "integer" - } - }, - "required": ["web_fetch_requests", "web_search_requests"], - "title": "ServerToolUsage", - "type": "object" - }, - "BetaSignatureContentBlockDelta": { - "properties": { - "signature": { "title": "Signature", "type": "string" }, - "type": { - "const": "signature_delta", - "default": "signature_delta", - "enum": ["signature_delta"], - "title": "Type", - "type": "string" - } - }, - "required": ["signature", "type"], - "title": "SignatureContentBlockDelta", - "type": "object" - }, - "BetaSucceededResult": { - "properties": { - "message": { "$ref": "#/components/schemas/BetaMessage" }, - "type": { - "const": "succeeded", - "default": "succeeded", - "enum": ["succeeded"], - "title": "Type", - "type": "string" - } - }, - "required": ["message", "type"], - "title": "SucceededResult", - "type": "object" - }, - "BetaTextContentBlockDelta": { - "properties": { - "text": { "title": "Text", "type": "string" }, - "type": { - "const": "text_delta", - "default": "text_delta", - "enum": ["text_delta"], - "title": "Type", - "type": "string" - } - }, - "required": ["text", "type"], - "title": "TextContentBlockDelta", - "type": "object" - }, - "BetaTextEditorCodeExecutionToolResultErrorCode": { - "enum": [ - "invalid_tool_input", - "unavailable", - "too_many_requests", - "execution_time_exceeded", - "file_not_found" - ], - "title": "TextEditorCodeExecutionToolResultErrorCode", - "type": "string" - }, - "BetaTextEditor_20241022": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "name": { - "const": "str_replace_editor", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks.", - "enum": ["str_replace_editor"], - "title": "Name", - "type": "string" - }, - "type": { - "const": "text_editor_20241022", - "enum": ["text_editor_20241022"], - "title": "Type", - "type": "string" - } - }, - "required": ["name", "type"], - "title": "TextEditor_20241022", - "type": "object" - }, - "BetaTextEditor_20250124": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "name": { - "const": "str_replace_editor", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks.", - "enum": ["str_replace_editor"], - "title": "Name", - "type": "string" - }, - "type": { - "const": "text_editor_20250124", - "enum": ["text_editor_20250124"], - "title": "Type", - "type": "string" - } - }, - "required": ["name", "type"], - "title": "TextEditor_20250124", - "type": "object" - }, - "BetaTextEditor_20250429": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "name": { - "const": "str_replace_based_edit_tool", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks.", - "enum": ["str_replace_based_edit_tool"], - "title": "Name", - "type": "string" - }, - "type": { - "const": "text_editor_20250429", - "enum": ["text_editor_20250429"], - "title": "Type", - "type": "string" - } - }, - "required": ["name", "type"], - "title": "TextEditor_20250429", - "type": "object" - }, - "BetaTextEditor_20250728": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "max_characters": { - "anyOf": [{ "minimum": 1, "type": "integer" }, { "type": "null" }], - "description": "Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file.", - "title": "Max Characters" - }, - "name": { - "const": "str_replace_based_edit_tool", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks.", - "enum": ["str_replace_based_edit_tool"], - "title": "Name", - "type": "string" - }, - "type": { - "const": "text_editor_20250728", - "enum": ["text_editor_20250728"], - "title": "Type", - "type": "string" - } - }, - "required": ["name", "type"], - "title": "TextEditor_20250728", - "type": "object" - }, - "BetaThinkingConfigDisabled": { - "additionalProperties": false, - "properties": { - "type": { "const": "disabled", "enum": ["disabled"], "title": "Type", "type": "string" } - }, - "required": ["type"], - "title": "ThinkingConfigDisabled", - "type": "object", - "x-stainless-go-constant-constructor": true - }, - "BetaThinkingConfigEnabled": { - "additionalProperties": false, - "properties": { - "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.anthropic.com/en/docs/build-with-claude/extended-thinking) for details.", - "minimum": 1024, - "title": "Budget Tokens", - "type": "integer" - }, - "type": { "const": "enabled", "enum": ["enabled"], "title": "Type", "type": "string" } - }, - "required": ["budget_tokens", "type"], - "title": "ThinkingConfigEnabled", - "type": "object" - }, - "BetaThinkingContentBlockDelta": { - "properties": { - "thinking": { "title": "Thinking", "type": "string" }, - "type": { - "const": "thinking_delta", - "default": "thinking_delta", - "enum": ["thinking_delta"], - "title": "Type", - "type": "string" - } - }, - "required": ["thinking", "type"], - "title": "ThinkingContentBlockDelta", - "type": "object" - }, - "BetaTool": { - "additionalProperties": false, - "properties": { - "type": { - "anyOf": [{ "type": "null" }, { "const": "custom", "enum": ["custom"], "type": "string" }], - "title": "Type" - }, - "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.", - "examples": ["Get the current weather in a given location"], - "title": "Description", - "type": "string" - }, - "name": { - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks.", - "maxLength": 128, - "minLength": 1, - "pattern": "^[a-zA-Z0-9_-]{1,128}$", - "title": "Name", - "type": "string" - }, - "input_schema": { - "$ref": "#/components/schemas/BetaInputSchema", - "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.", - "examples": [ - { - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string" - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string" - } - }, - "required": ["location"], - "type": "object" + "type": "tool_use", + "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "name": "get_stock_price", + "input": { "ticker": "^GSPC" } } ] - }, - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - } - }, - "required": ["name", "input_schema"], - "title": "Tool", - "type": "object" - }, - "BetaToolChoiceAny": { - "additionalProperties": false, - "description": "The model will use any available tools.", - "properties": { - "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.", - "title": "Disable Parallel Tool Use", - "type": "boolean" - }, - "type": { "const": "any", "enum": ["any"], "title": "Type", "type": "string" } - }, - "required": ["type"], - "title": "ToolChoiceAny", - "type": "object" - }, - "BetaToolChoiceAuto": { - "additionalProperties": false, - "description": "The model will automatically decide whether to use tools.", - "properties": { - "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.", - "title": "Disable Parallel Tool Use", - "type": "boolean" - }, - "type": { "const": "auto", "enum": ["auto"], "title": "Type", "type": "string" } - }, - "required": ["type"], - "title": "ToolChoiceAuto", - "type": "object" - }, - "BetaToolChoiceNone": { - "additionalProperties": false, - "description": "The model will not be allowed to use tools.", - "properties": { "type": { "const": "none", "enum": ["none"], "title": "Type", "type": "string" } }, - "required": ["type"], - "title": "ToolChoiceNone", - "type": "object", - "x-stainless-go-constant-constructor": true - }, - "BetaToolChoiceTool": { - "additionalProperties": false, - "description": "The model will use the specified tool with `tool_choice.name`.", - "properties": { - "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.", - "title": "Disable Parallel Tool Use", - "type": "boolean" - }, - "name": { "description": "The name of the tool to use.", "title": "Name", "type": "string" }, - "type": { "const": "tool", "enum": ["tool"], "title": "Type", "type": "string" } - }, - "required": ["name", "type"], - "title": "ToolChoiceTool", - "type": "object" - }, - "BetaToolUsesKeep": { - "additionalProperties": false, - "properties": { - "type": { "const": "tool_uses", "enum": ["tool_uses"], "title": "Type", "type": "string" }, - "value": { "minimum": 0, "title": "Value", "type": "integer" } - }, - "required": ["type", "value"], - "title": "ToolUsesKeep", - "type": "object" - }, - "BetaToolUsesTrigger": { - "additionalProperties": false, - "properties": { - "type": { "const": "tool_uses", "enum": ["tool_uses"], "title": "Type", "type": "string" }, - "value": { "minimum": 1, "title": "Value", "type": "integer" } - }, - "required": ["type", "value"], - "title": "ToolUsesTrigger", - "type": "object" - }, - "BetaURLImageSource": { - "additionalProperties": false, - "properties": { - "type": { "const": "url", "enum": ["url"], "title": "Type", "type": "string" }, - "url": { "title": "Url", "type": "string" } - }, - "required": ["type", "url"], - "title": "URLImageSource", - "type": "object" - }, - "BetaURLPDFSource": { - "additionalProperties": false, - "properties": { - "type": { "const": "url", "enum": ["url"], "title": "Type", "type": "string" }, - "url": { "title": "Url", "type": "string" } - }, - "required": ["type", "url"], - "title": "URLPDFSource", - "type": "object" - }, - "BetaUsage": { - "properties": { - "cache_creation": { - "anyOf": [{ "$ref": "#/components/schemas/BetaCacheCreation" }, { "type": "null" }], - "default": null, - "description": "Breakdown of cached tokens by TTL" - }, - "cache_creation_input_tokens": { - "anyOf": [{ "minimum": 0, "type": "integer" }, { "type": "null" }], - "default": null, - "description": "The number of input tokens used to create the cache entry.", - "examples": [2051], - "title": "Cache Creation Input Tokens" - }, - "cache_read_input_tokens": { - "anyOf": [{ "minimum": 0, "type": "integer" }, { "type": "null" }], - "default": null, - "description": "The number of input tokens read from the cache.", - "examples": [2051], - "title": "Cache Read Input Tokens" - }, - "input_tokens": { - "description": "The number of input tokens which were used.", - "examples": [2095], - "minimum": 0, - "title": "Input Tokens", - "type": "integer" - }, - "output_tokens": { - "description": "The number of output tokens which were used.", - "examples": [503], - "minimum": 0, - "title": "Output Tokens", - "type": "integer" - }, - "server_tool_use": { - "anyOf": [{ "$ref": "#/components/schemas/BetaServerToolUsage" }, { "type": "null" }], - "default": null, - "description": "The number of server tool requests." - }, - "service_tier": { - "anyOf": [{ "enum": ["standard", "priority", "batch"], "type": "string" }, { "type": "null" }], - "default": null, - "description": "If the request used the priority, standard, or batch tier.", - "title": "Service Tier" - } - }, - "required": [ - "cache_creation", - "cache_creation_input_tokens", - "cache_read_input_tokens", - "input_tokens", - "output_tokens", - "server_tool_use", - "service_tier" - ], - "title": "Usage", - "type": "object" - }, - "BetaUserLocation": { - "additionalProperties": false, - "properties": { - "city": { - "anyOf": [{ "maxLength": 255, "minLength": 1, "type": "string" }, { "type": "null" }], - "description": "The city of the user.", - "examples": ["New York", "Tokyo", "Los Angeles"], - "title": "City" - }, - "country": { - "anyOf": [{ "maxLength": 2, "minLength": 2, "type": "string" }, { "type": "null" }], - "description": "The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user.", - "examples": ["US", "JP", "GB"], - "title": "Country" - }, - "region": { - "anyOf": [{ "maxLength": 255, "minLength": 1, "type": "string" }, { "type": "null" }], - "description": "The region of the user.", - "examples": ["California", "Ontario", "Wales"], - "title": "Region" - }, - "timezone": { - "anyOf": [{ "maxLength": 255, "minLength": 1, "type": "string" }, { "type": "null" }], - "description": "The [IANA timezone](https://nodatime.org/TimeZones) of the user.", - "examples": ["America/New_York", "Asia/Tokyo", "Europe/London"], - "title": "Timezone" - }, - "type": { "const": "approximate", "enum": ["approximate"], "title": "Type", "type": "string" } - }, - "required": ["type"], - "title": "UserLocation", - "type": "object" - }, - "BetaWebFetchToolResultErrorCode": { - "enum": [ - "invalid_tool_input", - "url_too_long", - "url_not_allowed", - "url_not_accessible", - "unsupported_content_type", - "too_many_requests", - "max_uses_exceeded", - "unavailable" - ], - "title": "WebFetchToolResultErrorCode", - "type": "string" - }, - "BetaWebFetchTool_20250910": { - "additionalProperties": false, - "properties": { - "allowed_domains": { - "anyOf": [{ "items": { "type": "string" }, "type": "array" }, { "type": "null" }], - "description": "List of domains to allow fetching from", - "title": "Allowed Domains" - }, - "blocked_domains": { - "anyOf": [{ "items": { "type": "string" }, "type": "array" }, { "type": "null" }], - "description": "List of domains to block fetching from", - "title": "Blocked Domains" - }, - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "citations": { - "anyOf": [{ "$ref": "#/components/schemas/BetaRequestCitationsConfig" }, { "type": "null" }], - "description": "Citations configuration for fetched documents. Citations are disabled by default." - }, - "max_content_tokens": { - "anyOf": [{ "exclusiveMinimum": 0, "type": "integer" }, { "type": "null" }], - "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.", - "title": "Max Content Tokens" - }, - "max_uses": { - "anyOf": [{ "exclusiveMinimum": 0, "type": "integer" }, { "type": "null" }], - "description": "Maximum number of times the tool can be used in the API request.", - "title": "Max Uses" - }, - "name": { - "const": "web_fetch", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks.", - "enum": ["web_fetch"], - "title": "Name", - "type": "string" - }, - "type": { - "const": "web_fetch_20250910", - "enum": ["web_fetch_20250910"], - "title": "Type", - "type": "string" - } - }, - "required": ["name", "type"], - "title": "WebFetchTool_20250910", - "type": "object" - }, - "BetaWebSearchToolResultErrorCode": { - "enum": [ - "invalid_tool_input", - "unavailable", - "max_uses_exceeded", - "too_many_requests", - "query_too_long" - ], - "title": "WebSearchToolResultErrorCode", - "type": "string" - }, - "BetaWebSearchTool_20250305": { - "additionalProperties": false, - "properties": { - "allowed_domains": { - "anyOf": [{ "items": { "type": "string" }, "type": "array" }, { "type": "null" }], - "description": "If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`.", - "title": "Allowed Domains" - }, - "blocked_domains": { - "anyOf": [{ "items": { "type": "string" }, "type": "array" }, { "type": "null" }], - "description": "If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`.", - "title": "Blocked Domains" - }, - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/BetaCacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/BetaCacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "max_uses": { - "anyOf": [{ "exclusiveMinimum": 0, "type": "integer" }, { "type": "null" }], - "description": "Maximum number of times the tool can be used in the API request.", - "title": "Max Uses" - }, - "name": { - "const": "web_search", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks.", - "enum": ["web_search"], - "title": "Name", - "type": "string" - }, - "type": { - "const": "web_search_20250305", - "enum": ["web_search_20250305"], - "title": "Type", - "type": "string" - }, - "user_location": { - "anyOf": [{ "$ref": "#/components/schemas/BetaUserLocation" }, { "type": "null" }], - "description": "Parameters for the user's location. Used to provide more relevant search results." - } - }, - "required": ["name", "type"], - "title": "WebSearchTool_20250305", - "type": "object" - }, - "BillingError": { - "properties": { - "message": { "default": "Billing error", "title": "Message", "type": "string" }, - "type": { - "const": "billing_error", - "default": "billing_error", - "enum": ["billing_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["message", "type"], - "title": "BillingError", - "type": "object" - }, - "CacheControlEphemeral": { - "additionalProperties": false, - "properties": { - "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`.", - "enum": ["5m", "1h"], - "title": "Ttl", - "type": "string", - "x-stainless-renameMap": { "ttl_5m": "5m", "ttl_1h": "1h" } - }, - "type": { "const": "ephemeral", "enum": ["ephemeral"], "title": "Type", "type": "string" } - }, - "required": ["type"], - "title": "CacheControlEphemeral", - "type": "object", - "x-stainless-go-constant-constructor": true - }, - "CacheCreation": { - "properties": { - "ephemeral_1h_input_tokens": { - "default": 0, - "description": "The number of input tokens used to create the 1 hour cache entry.", - "minimum": 0, - "title": "Ephemeral 1H Input Tokens", - "type": "integer" - }, - "ephemeral_5m_input_tokens": { - "default": 0, - "description": "The number of input tokens used to create the 5 minute cache entry.", - "minimum": 0, - "title": "Ephemeral 5M Input Tokens", - "type": "integer" - } - }, - "required": ["ephemeral_1h_input_tokens", "ephemeral_5m_input_tokens"], - "title": "CacheCreation", - "type": "object" - }, - "CanceledResult": { - "properties": { - "type": { - "const": "canceled", - "default": "canceled", - "enum": ["canceled"], - "title": "Type", - "type": "string" - } - }, - "required": ["type"], - "title": "CanceledResult", - "type": "object" - }, - "CitationsDelta": { - "properties": { - "citation": { - "discriminator": { - "mapping": { - "char_location": "#/components/schemas/ResponseCharLocationCitation", - "content_block_location": "#/components/schemas/ResponseContentBlockLocationCitation", - "page_location": "#/components/schemas/ResponsePageLocationCitation", - "search_result_location": "#/components/schemas/ResponseSearchResultLocationCitation", - "web_search_result_location": "#/components/schemas/ResponseWebSearchResultLocationCitation" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/ResponseCharLocationCitation" }, - { "$ref": "#/components/schemas/ResponsePageLocationCitation" }, - { "$ref": "#/components/schemas/ResponseContentBlockLocationCitation" }, - { "$ref": "#/components/schemas/ResponseWebSearchResultLocationCitation" }, - { "$ref": "#/components/schemas/ResponseSearchResultLocationCitation" } - ], - "title": "Citation" - }, - "type": { - "const": "citations_delta", - "default": "citations_delta", - "enum": ["citations_delta"], - "title": "Type", - "type": "string" - } - }, - "required": ["citation", "type"], - "title": "CitationsDelta", - "type": "object" - }, - "CompletionRequest": { - "additionalProperties": false, - "examples": [ - { - "model": "claude-2.1", - "prompt": "\n\nHuman: Hello, world!\n\nAssistant:", - "max_tokens_to_sample": 256 - } - ], - "properties": { - "model": { "$ref": "#/components/schemas/Model" }, - "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.anthropic.com/en/api/prompt-validation) and our guide to [prompt design](https://docs.anthropic.com/en/docs/intro-to-prompting) for more details.", - "examples": ["\n\nHuman: Hello, world!\n\nAssistant:"], - "minLength": 1, - "title": "Prompt", - "type": "string" - }, - "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.", - "examples": [256], - "minimum": 1, - "title": "Max Tokens To Sample", - "type": "integer" - }, - "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.", - "items": { "type": "string" }, - "title": "Stop Sequences", - "type": "array" - }, - "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.", - "examples": [1], - "maximum": 1, - "minimum": 0, - "title": "Temperature", - "type": "number" - }, - "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`.", - "examples": [0.7], - "maximum": 1, - "minimum": 0, - "title": "Top P", - "type": "number" - }, - "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`.", - "examples": [5], - "minimum": 0, - "title": "Top K", - "type": "integer" - }, - "metadata": { - "$ref": "#/components/schemas/Metadata", - "description": "An object describing metadata about the request." - }, - "stream": { - "description": "Whether to incrementally stream the response using server-sent events.\n\nSee [streaming](https://docs.anthropic.com/en/api/streaming) for details.", - "title": "Stream", - "type": "boolean" - } - }, - "required": ["max_tokens_to_sample", "model", "prompt"], - "title": "CompletionRequest", - "type": "object" - }, - "CompletionResponse": { - "properties": { - "completion": { - "type": "string", - "title": "Completion", - "description": "The resulting completion up to and excluding the stop sequences.", - "examples": [" Hello! My name is Claude."] - }, - "id": { - "type": "string", - "title": "Id", - "description": "Unique object identifier.\n\nThe format and length of IDs may change over time." - }, - "model": { "$ref": "#/components/schemas/Model" }, - "stop_reason": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "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", - "examples": ["stop_sequence"] - }, - "type": { - "type": "string", - "enum": ["completion"], - "const": "completion", - "title": "Type", - "description": "Object type.\n\nFor Text Completions, this is always `\"completion\"`.", - "default": "completion" - } - }, - "type": "object", - "required": ["completion", "id", "model", "stop_reason", "type"], - "title": "CompletionResponse", - "example": { - "completion": " Hello! My name is Claude.", - "id": "compl_018CKm6gsux7P8yMcwZbeCPw", - "model": "claude-2.1", - "stop_reason": "stop_sequence", - "type": "completion" - } - }, - "ContentBlockDeltaEvent": { - "properties": { - "delta": { - "discriminator": { - "mapping": { - "citations_delta": "#/components/schemas/CitationsDelta", - "input_json_delta": "#/components/schemas/InputJsonContentBlockDelta", - "signature_delta": "#/components/schemas/SignatureContentBlockDelta", - "text_delta": "#/components/schemas/TextContentBlockDelta", - "thinking_delta": "#/components/schemas/ThinkingContentBlockDelta" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/TextContentBlockDelta" }, - { "$ref": "#/components/schemas/InputJsonContentBlockDelta" }, - { "$ref": "#/components/schemas/CitationsDelta" }, - { "$ref": "#/components/schemas/ThinkingContentBlockDelta" }, - { "$ref": "#/components/schemas/SignatureContentBlockDelta" } - ], - "title": "Delta" - }, - "index": { "title": "Index", "type": "integer" }, - "type": { - "const": "content_block_delta", - "default": "content_block_delta", - "enum": ["content_block_delta"], - "title": "Type", - "type": "string" - } - }, - "required": ["delta", "index", "type"], - "title": "ContentBlockDeltaEvent", - "type": "object", - "x-stainless-naming": { "go": { "model_name": "ContentBlockDeltaEvent" } } - }, - "ContentBlockSource": { - "additionalProperties": false, - "properties": { - "content": { - "anyOf": [ - { "type": "string" }, + + ``` + + + You 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: + + + ```json + + [ { - "items": { - "discriminator": { - "mapping": { - "image": "#/components/schemas/RequestImageBlock", - "text": "#/components/schemas/RequestTextBlock" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/RequestTextBlock" }, - { "$ref": "#/components/schemas/RequestImageBlock" } - ], - "x-stainless-naming": { "go": { "type_name": "ContentBlockSourceContentItem" } }, - "title": "content_block_source_content_item" - }, - "type": "array", - "title": "content_block_source_content" + "type": "tool_result", + "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "content": "259.75 USD" } - ], - "title": "Content" - }, - "type": { "const": "content", "enum": ["content"], "title": "Type", "type": "string" } - }, - "required": ["content", "type"], - "title": "ContentBlockSource", - "type": "object" - }, - "ContentBlockStartEvent": { - "properties": { - "content_block": { - "discriminator": { - "mapping": { - "redacted_thinking": "#/components/schemas/ResponseRedactedThinkingBlock", - "server_tool_use": "#/components/schemas/ResponseServerToolUseBlock", - "text": "#/components/schemas/ResponseTextBlock", - "thinking": "#/components/schemas/ResponseThinkingBlock", - "tool_use": "#/components/schemas/ResponseToolUseBlock", - "web_search_tool_result": "#/components/schemas/ResponseWebSearchToolResultBlock" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/ResponseTextBlock" }, - { "$ref": "#/components/schemas/ResponseThinkingBlock" }, - { "$ref": "#/components/schemas/ResponseRedactedThinkingBlock" }, - { "$ref": "#/components/schemas/ResponseToolUseBlock" }, - { "$ref": "#/components/schemas/ResponseServerToolUseBlock" }, - { "$ref": "#/components/schemas/ResponseWebSearchToolResultBlock" } - ], - "title": "Content Block" - }, - "index": { "title": "Index", "type": "integer" }, - "type": { - "const": "content_block_start", - "default": "content_block_start", - "enum": ["content_block_start"], - "title": "Type", - "type": "string" - } - }, - "required": ["content_block", "index", "type"], - "title": "ContentBlockStartEvent", - "type": "object", - "x-stainless-naming": { "go": { "model_name": "ContentBlockStartEvent" } } - }, - "ContentBlockStopEvent": { - "properties": { - "index": { "title": "Index", "type": "integer" }, - "type": { - "const": "content_block_stop", - "default": "content_block_stop", - "enum": ["content_block_stop"], - "title": "Type", - "type": "string" - } - }, - "required": ["index", "type"], - "title": "ContentBlockStopEvent", - "type": "object", - "x-stainless-naming": { "go": { "model_name": "ContentBlockStopEvent" } } - }, - "CountMessageTokensParams": { - "additionalProperties": false, - "examples": [ - { "messages": [{ "content": "Hello, world", "role": "user" }], "model": "claude-sonnet-4-20250514" } - ], - "properties": { - "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.anthropic.com/en/api/messages-examples).\n\nNote that if you want to include a [system prompt](https://docs.anthropic.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.", - "items": { "$ref": "#/components/schemas/InputMessage" }, - "title": "Messages", - "type": "array" - }, - "model": { "$ref": "#/components/schemas/Model" }, - "system": { - "anyOf": [ - { "type": "string" }, - { "items": { "$ref": "#/components/schemas/RequestTextBlock" }, "type": "array" } - ], - "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.anthropic.com/en/docs/system-prompts).", - "examples": [ - [{ "text": "Today's date is 2024-06-01.", "type": "text" }], - "Today's date is 2023-01-01." - ], - "title": "System" - }, - "thinking": { "$ref": "#/components/schemas/ThinkingConfigParam" }, - "tool_choice": { "$ref": "#/components/schemas/ToolChoice" }, - "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.anthropic.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.anthropic.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.anthropic.com/en/docs/tool-use) for more details.", - "examples": [ - { - "description": "Get the current weather in a given location", - "input_schema": { - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string" - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string" - } - }, - "required": ["location"], - "type": "object" - }, - "name": "get_weather" - } - ], - "items": { - "oneOf": [ - { "$ref": "#/components/schemas/Tool" }, - { "$ref": "#/components/schemas/BashTool_20250124" }, - { "$ref": "#/components/schemas/TextEditor_20250124" }, - { "$ref": "#/components/schemas/TextEditor_20250429" }, - { "$ref": "#/components/schemas/TextEditor_20250728" }, - { "$ref": "#/components/schemas/WebSearchTool_20250305" } - ] - }, - "title": "Tools", - "type": "array" - } - }, - "required": ["messages", "model"], - "title": "CountMessageTokensParams", - "type": "object" - }, - "CountMessageTokensResponse": { - "properties": { - "input_tokens": { - "type": "integer", - "title": "Input Tokens", - "description": "The total number of tokens across the provided list of messages, system prompt, and tools.", - "examples": [2095] - } - }, - "type": "object", - "required": ["input_tokens"], - "title": "CountMessageTokensResponse", - "examples": [{ "input_tokens": 2095 }] - }, - "CreateMessageBatchParams": { - "additionalProperties": false, - "properties": { - "requests": { - "description": "List of requests for prompt completion. Each is an individual request to create a Message.", - "items": { "$ref": "#/components/schemas/MessageBatchIndividualRequestParams" }, - "maxItems": 10000, - "minItems": 1, - "title": "Requests", - "type": "array" - } - }, - "required": ["requests"], - "title": "CreateMessageBatchParams", - "type": "object" - }, - "CreateMessageParams": { - "additionalProperties": false, - "example": { - "max_tokens": 1024, - "messages": [{ "content": "Hello, world", "role": "user" }], - "model": "claude-sonnet-4-20250514" - }, - "properties": { - "model": { "$ref": "#/components/schemas/Model" }, - "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.anthropic.com/en/api/messages-examples).\n\nNote that if you want to include a [system prompt](https://docs.anthropic.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.", - "items": { "$ref": "#/components/schemas/InputMessage" }, - "title": "Messages", - "type": "array" - }, - "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.anthropic.com/en/docs/models-overview) for details.", - "examples": [1024], - "minimum": 1, - "title": "Max Tokens", - "type": "integer" - }, - "metadata": { - "$ref": "#/components/schemas/Metadata", - "description": "An object describing metadata about the request." - }, - "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.anthropic.com/en/api/service-tiers) for details.", - "enum": ["auto", "standard_only"], - "title": "Service Tier", - "type": "string" - }, - "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.", - "items": { "type": "string" }, - "title": "Stop Sequences", - "type": "array" - }, - "stream": { - "description": "Whether to incrementally stream the response using server-sent events.\n\nSee [streaming](https://docs.anthropic.com/en/api/messages-streaming) for details.", - "title": "Stream", - "type": "boolean" - }, - "system": { - "anyOf": [ - { "type": "string", "x-stainless-skip": ["go", "cli"] }, - { "items": { "$ref": "#/components/schemas/RequestTextBlock" }, "type": "array" } - ], - "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.anthropic.com/en/docs/system-prompts).", - "examples": [ - [{ "text": "Today's date is 2024-06-01.", "type": "text" }], - "Today's date is 2023-01-01." - ], - "title": "System" - }, - "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.", - "examples": [1], - "maximum": 1, - "minimum": 0, - "title": "Temperature", - "type": "number" - }, - "thinking": { "$ref": "#/components/schemas/ThinkingConfigParam" }, - "tool_choice": { "$ref": "#/components/schemas/ToolChoice" }, - "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.anthropic.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.anthropic.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.anthropic.com/en/docs/tool-use) for more details.", - "examples": [ + ] + + ``` + + + Tools 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. + + + See our [guide](https://docs.claude.com/en/docs/tool-use) for more details. + examples: + - description: Get the current weather in a given location + input_schema: + properties: + location: + description: The city and state, e.g. San Francisco, CA + type: string + unit: + description: Unit for the output - one of (celsius, fahrenheit) + type: string + required: + - location + type: object + name: get_weather + items: + oneOf: + - $ref: '#/components/schemas/Tool' + - $ref: '#/components/schemas/BashTool_20250124' + - $ref: '#/components/schemas/TextEditor_20250124' + - $ref: '#/components/schemas/TextEditor_20250429' + - $ref: '#/components/schemas/TextEditor_20250728' + - $ref: '#/components/schemas/WebSearchTool_20250305' + title: Tools + type: array + top_k: + description: >- + Only sample from the top K options for each subsequent token. + + + Used to remove "long tail" low probability responses. [Learn more technical details + here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277). + + + Recommended for advanced use cases only. You usually only need to use `temperature`. + examples: + - 5 + minimum: 0 + title: Top K + type: integer + top_p: + description: >- + Use nucleus sampling. + + + In 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. + + + Recommended for advanced use cases only. You usually only need to use `temperature`. + examples: + - 0.7 + maximum: 1 + minimum: 0 + title: Top P + type: number + required: + - model + - messages + - max_tokens + title: CreateMessageParams + type: object + CreateSkillResponse: + properties: + created_at: + type: string + title: Created At + description: ISO 8601 timestamp of when the skill was created. + examples: + - '2024-10-30T23:58:27.427722Z' + display_title: + anyOf: + - type: string + - type: 'null' + title: Display Title + description: |- + Display title for the skill. + + This is a human-readable label that is not included in the prompt sent to the model. + examples: + - My Custom Skill + id: + type: string + title: Id + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + examples: + - skill_01JAbcdefghijklmnopqrstuvw + latest_version: + anyOf: + - type: string + - type: 'null' + title: Latest Version + description: |- + The latest version identifier for the skill. + + This represents the most recent version of the skill that has been created. + examples: + - '1759178010641129' + source: + type: string + title: Source + description: |- + Source of the skill. + + This may be one of the following values: + * `"custom"`: the skill was created by a user + * `"anthropic"`: the skill was created by Anthropic + examples: + - custom + type: + type: string + title: Type + description: |- + Object type. + + For Skills, this is always `"skill"`. + default: skill + updated_at: + type: string + title: Updated At + description: ISO 8601 timestamp of when the skill was last updated. + examples: + - '2024-10-30T23:58:27.427722Z' + type: object + required: + - created_at + - display_title + - id + - latest_version + - source + - type + - updated_at + title: CreateSkillResponse + CreateSkillVersionResponse: + properties: + created_at: + type: string + title: Created At + description: ISO 8601 timestamp of when the skill version was created. + examples: + - '2024-10-30T23:58:27.427722Z' + description: + type: string + title: Description + description: |- + Description of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + examples: + - A custom skill for doing something useful + directory: + type: string + title: Directory + description: |- + Directory name of the skill version. + + This is the top-level directory name that was extracted from the uploaded files. + examples: + - my-skill + id: + type: string + title: Id + description: |- + Unique identifier for the skill version. + + The format and length of IDs may change over time. + examples: + - skillver_01JAbcdefghijklmnopqrstuvw + name: + type: string + title: Name + description: |- + Human-readable name of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + examples: + - my-skill + skill_id: + type: string + title: Skill Id + description: Identifier for the skill that this version belongs to. + examples: + - skill_01JAbcdefghijklmnopqrstuvw + type: + type: string + title: Type + description: |- + Object type. + + For Skill Versions, this is always `"skill_version"`. + default: skill_version + version: + type: string + title: Version + description: |- + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + examples: + - '1759178010641129' + type: object + required: + - created_at + - description + - directory + - id + - name + - skill_id + - type + - version + title: CreateSkillVersionResponse + DeleteMessageBatchResponse: + properties: + id: + type: string + title: Id + description: ID of the Message Batch. + examples: + - msgbatch_013Zva2CMHLNnXjNJJKqJ2EF + type: + type: string + const: message_batch_deleted + title: Type + description: |- + Deleted object type. + + For Message Batches, this is always `"message_batch_deleted"`. + default: message_batch_deleted + type: object + required: + - id + - type + title: DeleteMessageBatchResponse + DeleteSkillResponse: + properties: + id: + type: string + title: Id + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + examples: + - skill_01JAbcdefghijklmnopqrstuvw + type: + type: string + title: Type + description: |- + Deleted object type. + + For Skills, this is always `"skill_deleted"`. + default: skill_deleted + type: object + required: + - id + - type + title: DeleteSkillResponse + DeleteSkillVersionResponse: + properties: + id: + type: string + title: Id + description: |- + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + examples: + - '1759178010641129' + type: + type: string + title: Type + description: |- + Deleted object type. + + For Skill Versions, this is always `"skill_version_deleted"`. + default: skill_version_deleted + type: object + required: + - id + - type + title: DeleteSkillVersionResponse + ErrorResponse: + properties: + error: + discriminator: + mapping: + api_error: '#/components/schemas/APIError' + authentication_error: '#/components/schemas/AuthenticationError' + billing_error: '#/components/schemas/BillingError' + invalid_request_error: '#/components/schemas/InvalidRequestError' + not_found_error: '#/components/schemas/NotFoundError' + overloaded_error: '#/components/schemas/OverloadedError' + permission_error: '#/components/schemas/PermissionError' + rate_limit_error: '#/components/schemas/RateLimitError' + timeout_error: '#/components/schemas/GatewayTimeoutError' + propertyName: type + oneOf: + - $ref: '#/components/schemas/InvalidRequestError' + - $ref: '#/components/schemas/AuthenticationError' + - $ref: '#/components/schemas/BillingError' + - $ref: '#/components/schemas/PermissionError' + - $ref: '#/components/schemas/NotFoundError' + - $ref: '#/components/schemas/RateLimitError' + - $ref: '#/components/schemas/GatewayTimeoutError' + - $ref: '#/components/schemas/APIError' + - $ref: '#/components/schemas/OverloadedError' + title: Error + request_id: + anyOf: + - type: string + - type: 'null' + default: null + title: Request Id + type: + const: error + default: error + title: Type + type: string + required: + - error + - request_id + - type + title: ErrorResponse + type: object + ErrorType: + enum: + - invalid_request_error + - authentication_error + - permission_error + - not_found_error + - rate_limit_error + - timeout_error + - overloaded_error + - api_error + - billing_error + title: ErrorType + type: string + ErroredResult: + properties: + error: + $ref: '#/components/schemas/ErrorResponse' + type: + const: errored + default: errored + title: Type + type: string + required: + - error + - type + title: ErroredResult + type: object + ExpiredResult: + properties: + type: + const: expired + default: expired + title: Type + type: string + required: + - type + title: ExpiredResult + type: object + FileDeleteResponse: + properties: + id: + type: string + title: Id + description: ID of the deleted file. + type: + type: string + const: file_deleted + title: Type + description: |- + Deleted object type. + + For file deletion, this is always `"file_deleted"`. + default: file_deleted + type: object + required: + - id + title: FileDeleteResponse + FileListResponse: + properties: + data: + items: + $ref: '#/components/schemas/FileMetadataSchema' + type: array + title: Data + description: List of file metadata objects. + first_id: + anyOf: + - type: string + - type: 'null' + title: First Id + description: ID of the first file in this page of results. + has_more: + type: boolean + title: Has More + description: Whether there are more results available. + default: false + last_id: + anyOf: + - type: string + - type: 'null' + title: Last Id + description: ID of the last file in this page of results. + type: object + required: + - data + title: FileListResponse + FileMetadataSchema: + properties: + created_at: + type: string + format: date-time + title: Created At + description: RFC 3339 datetime string representing when the file was created. + downloadable: + type: boolean + title: Downloadable + description: Whether the file can be downloaded. + default: false + filename: + type: string + maxLength: 500 + minLength: 1 + title: Filename + description: Original filename of the uploaded file. + id: + type: string + title: Id + description: |- + Unique object identifier. + + The format and length of IDs may change over time. + mime_type: + type: string + maxLength: 255 + minLength: 1 + title: Mime Type + description: MIME type of the file. + size_bytes: + type: integer + minimum: 0 + title: Size Bytes + description: Size of the file in bytes. + type: + type: string + const: file + title: Type + description: |- + Object type. + + For files, this is always `"file"`. + type: object + required: + - created_at + - filename + - id + - mime_type + - size_bytes + - type + title: FileMetadataSchema + GatewayTimeoutError: + properties: + message: + default: Request timeout + title: Message + type: string + type: + const: timeout_error + default: timeout_error + title: Type + type: string + required: + - message + - type + title: GatewayTimeoutError + type: object + GetSkillResponse: + properties: + created_at: + type: string + title: Created At + description: ISO 8601 timestamp of when the skill was created. + examples: + - '2024-10-30T23:58:27.427722Z' + display_title: + anyOf: + - type: string + - type: 'null' + title: Display Title + description: |- + Display title for the skill. + + This is a human-readable label that is not included in the prompt sent to the model. + examples: + - My Custom Skill + id: + type: string + title: Id + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + examples: + - skill_01JAbcdefghijklmnopqrstuvw + latest_version: + anyOf: + - type: string + - type: 'null' + title: Latest Version + description: |- + The latest version identifier for the skill. + + This represents the most recent version of the skill that has been created. + examples: + - '1759178010641129' + source: + type: string + title: Source + description: |- + Source of the skill. + + This may be one of the following values: + * `"custom"`: the skill was created by a user + * `"anthropic"`: the skill was created by Anthropic + examples: + - custom + type: + type: string + title: Type + description: |- + Object type. + + For Skills, this is always `"skill"`. + default: skill + updated_at: + type: string + title: Updated At + description: ISO 8601 timestamp of when the skill was last updated. + examples: + - '2024-10-30T23:58:27.427722Z' + type: object + required: + - created_at + - display_title + - id + - latest_version + - source + - type + - updated_at + title: GetSkillResponse + GetSkillVersionResponse: + properties: + created_at: + type: string + title: Created At + description: ISO 8601 timestamp of when the skill version was created. + examples: + - '2024-10-30T23:58:27.427722Z' + description: + type: string + title: Description + description: |- + Description of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + examples: + - A custom skill for doing something useful + directory: + type: string + title: Directory + description: |- + Directory name of the skill version. + + This is the top-level directory name that was extracted from the uploaded files. + examples: + - my-skill + id: + type: string + title: Id + description: |- + Unique identifier for the skill version. + + The format and length of IDs may change over time. + examples: + - skillver_01JAbcdefghijklmnopqrstuvw + name: + type: string + title: Name + description: |- + Human-readable name of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + examples: + - my-skill + skill_id: + type: string + title: Skill Id + description: Identifier for the skill that this version belongs to. + examples: + - skill_01JAbcdefghijklmnopqrstuvw + type: + type: string + title: Type + description: |- + Object type. + + For Skill Versions, this is always `"skill_version"`. + default: skill_version + version: + type: string + title: Version + description: |- + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + examples: + - '1759178010641129' + type: object + required: + - created_at + - description + - directory + - id + - name + - skill_id + - type + - version + title: GetSkillVersionResponse + InputJsonContentBlockDelta: + properties: + partial_json: + title: Partial Json + type: string + type: + const: input_json_delta + default: input_json_delta + title: Type + type: string + required: + - partial_json + - type + title: InputJsonContentBlockDelta + type: object + InputMessage: + additionalProperties: false + properties: + content: + anyOf: + - type: string + x-stainless-skip: + - go + - cli + - items: + $ref: '#/components/schemas/InputContentBlock' + type: array + example: + - type: text + text: What is a quaternion? + title: Content + role: + enum: + - user + - assistant + title: Role + type: string + required: + - content + - role + title: InputMessage + type: object + discriminator: + propertyName: role + InputSchema: + additionalProperties: true + properties: + properties: + anyOf: + - additionalProperties: true + type: object + - type: 'null' + title: Properties + required: + anyOf: + - items: + type: string + type: array + - type: 'null' + title: Required + type: + const: object + title: Type + type: string + required: + - type + title: InputSchema + type: object + InvalidRequestError: + properties: + message: + default: Invalid request + title: Message + type: string + type: + const: invalid_request_error + default: invalid_request_error + title: Type + type: string + required: + - message + - type + title: InvalidRequestError + type: object + ListResponse_MessageBatch_: + properties: + data: + items: + $ref: '#/components/schemas/MessageBatch' + type: array + title: Data + first_id: + anyOf: + - type: string + - type: 'null' + title: First Id + description: First ID in the `data` list. Can be used as the `before_id` for the previous page. + has_more: + type: boolean + title: Has More + description: Indicates if there are more results in the requested page direction. + last_id: + anyOf: + - type: string + - type: 'null' + title: Last Id + description: Last ID in the `data` list. Can be used as the `after_id` for the next page. + type: object + required: + - data + - first_id + - has_more + - last_id + title: ListResponse[MessageBatch] + ListResponse_ModelInfo_: + properties: + data: + items: + $ref: '#/components/schemas/ModelInfo' + type: array + title: Data + first_id: + anyOf: + - type: string + - type: 'null' + title: First Id + description: First ID in the `data` list. Can be used as the `before_id` for the previous page. + has_more: + type: boolean + title: Has More + description: Indicates if there are more results in the requested page direction. + last_id: + anyOf: + - type: string + - type: 'null' + title: Last Id + description: Last ID in the `data` list. Can be used as the `after_id` for the next page. + type: object + required: + - data + - first_id + - has_more + - last_id + title: ListResponse[ModelInfo] + ListSkillVersionsResponse: + properties: + data: + items: + $ref: '#/components/schemas/SkillVersion' + type: array + title: Data + description: List of skill versions. + has_more: + type: boolean + title: Has More + description: Indicates if there are more results in the requested page direction. + next_page: + anyOf: + - type: string + - type: 'null' + title: Next Page + description: Token to provide in as `page` in the subsequent request to retrieve the next page of data. + examples: + - page_MjAyNS0wNS0xNFQwMDowMDowMFo= + - null + type: object + required: + - data + - has_more + - next_page + title: ListSkillVersionsResponse + ListSkillsResponse: + properties: + data: + items: + $ref: '#/components/schemas/Skill' + type: array + title: Data + description: List of skills. + has_more: + type: boolean + title: Has More + description: |- + Whether there are more results available. + + If `true`, there are additional results that can be fetched using the `next_page` token. + next_page: + anyOf: + - type: string + - type: 'null' + title: Next Page + description: >- + Token for fetching the next page of results. + + + If `null`, there are no more results available. Pass this value to the `page_token` parameter in + the next request to get the next page. + examples: + - page_MjAyNS0wNS0xNFQwMDowMDowMFo= + - null + type: object + required: + - data + - has_more + - next_page + title: ListSkillsResponse + Message: + examples: + - content: + - citations: null + text: Hi! My name is Claude. + type: text + id: msg_013Zva2CMHLNnXjNJJKqJ2EF + model: claude-sonnet-4-5-20250929 + role: assistant + stop_reason: end_turn + stop_sequence: null + type: message + usage: + input_tokens: 2095 + output_tokens: 503 + properties: + id: + description: |- + Unique object identifier. + + The format and length of IDs may change over time. + examples: + - msg_013Zva2CMHLNnXjNJJKqJ2EF + title: Id + type: string + type: + const: message + default: message + description: |- + Object type. + + For Messages, this is always `"message"`. + title: Type + type: string + role: + const: assistant + default: assistant + description: |- + Conversational role of the generated message. + + This will always be `"assistant"`. + title: Role + type: string + content: + description: >- + Content generated by the model. + + + This is an array of content blocks, each of which has a `type` that determines its shape. + + + Example: + + + ```json + + [{"type": "text", "text": "Hi, I'm Claude."}] + + ``` + + + If 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. + + + For example, if the input `messages` were: + + ```json + + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("} + ] + + ``` + + + Then the response `content` might be: + + + ```json + + [{"type": "text", "text": "B)"}] + + ``` + examples: + - - citations: null + text: Hi! My name is Claude. + type: text + items: + $ref: '#/components/schemas/ContentBlock' + title: Content + type: array + model: + $ref: '#/components/schemas/Model' + stop_reason: + anyOf: + - $ref: '#/components/schemas/StopReason' + - type: 'null' + description: >- + The reason that we stopped. + + + This may be one the following values: + + * `"end_turn"`: the model reached a natural stopping point + + * `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum + + * `"stop_sequence"`: one of your provided custom `stop_sequences` was generated + + * `"tool_use"`: the model invoked one or more tools + + * `"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. + + * `"refusal"`: when streaming classifiers intervene to handle potential policy violations + + + In non-streaming mode this value is always non-null. In streaming mode, it is null in the + `message_start` event and non-null otherwise. + title: Stop Reason + stop_sequence: + anyOf: + - type: string + - type: 'null' + default: null + description: |- + Which custom stop sequence was generated, if any. + + This value will be a non-null string if one of your custom stop sequences was generated. + title: Stop Sequence + usage: + $ref: '#/components/schemas/Usage' + description: >- + Billing and rate-limit usage. + + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to + our systems. + + + Under 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. + + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, + and `cache_read_input_tokens`. + examples: + - input_tokens: 2095 + output_tokens: 503 + required: + - id + - type + - role + - content + - model + - stop_reason + - stop_sequence + - usage + title: Message + type: object + x-stainless-python-custom-imports: + - from .content_block import ContentBlock as ContentBlock + MessageBatch: + properties: + archived_at: + anyOf: + - type: string + format: date-time + - type: 'null' + title: Archived At + description: >- + RFC 3339 datetime string representing the time at which the Message Batch was archived and its + results became unavailable. + examples: + - '2024-08-20T18:37:24.100435Z' + cancel_initiated_at: + anyOf: + - type: string + format: date-time + - type: 'null' + 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. + examples: + - '2024-08-20T18:37:24.100435Z' + created_at: + type: string + format: date-time + title: Created At + description: RFC 3339 datetime string representing the time at which the Message Batch was created. + examples: + - '2024-08-20T18:37:24.100435Z' + ended_at: + anyOf: + - type: string + format: date-time + - type: 'null' + title: Ended At + description: >- + RFC 3339 datetime string representing the time at which processing for the Message Batch ended. + Specified only once processing ends. + + + Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or + expired. + examples: + - '2024-08-20T18:37:24.100435Z' + expires_at: + type: string + format: date-time + 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. + examples: + - '2024-08-20T18:37:24.100435Z' + id: + type: string + title: Id + description: |- + Unique object identifier. + + The format and length of IDs may change over time. + examples: + - msgbatch_013Zva2CMHLNnXjNJJKqJ2EF + processing_status: + type: string + enum: + - in_progress + - canceling + - ended + title: Processing Status + description: Processing status of the Message Batch. + request_counts: + $ref: '#/components/schemas/RequestCounts' + description: >- + Tallies requests within the Message Batch, categorized by their status. + + + Requests 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: + anyOf: + - type: string + - type: 'null' + title: Results Url + description: >- + URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once + processing ends. + + + Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` + field to match results to requests. + examples: + - https://api.anthropic.com/v1/messages/batches/msgbatch_013Zva2CMHLNnXjNJJKqJ2EF/results + type: + type: string + const: message_batch + title: Type + description: |- + Object type. + + For Message Batches, this is always `"message_batch"`. + default: message_batch + type: object + required: + - archived_at + - cancel_initiated_at + - created_at + - ended_at + - expires_at + - id + - processing_status + - request_counts + - results_url + - type + title: MessageBatch + MessageBatchIndividualRequestParams: + additionalProperties: false + properties: + 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. + + + Must be unique for each request within the Message Batch. + examples: + - my-custom-id-1 + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9_-]{1,64}$ + title: Custom Id + type: string + params: + $ref: '#/components/schemas/CreateMessageParams' + description: >- + Messages API creation parameters for the individual request. + + + See the [Messages API reference](https://docs.claude.com/en/api/messages) for full documentation + on available parameters. + required: + - custom_id + - params + title: MessageBatchIndividualRequestParams + type: object + MessageBatchIndividualResponse: + description: This is a single line in the response `.jsonl` file and does not represent the response as a whole. + properties: + 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. + + + Must be unique for each request within the Message Batch. + examples: + - my-custom-id-1 + title: Custom Id + type: string + result: + description: >- + Processing result for this request. + + + Contains a Message output if processing was successful, an error response if processing failed, or + the reason why processing was not attempted, such as cancellation or expiration. + discriminator: + mapping: + canceled: '#/components/schemas/CanceledResult' + errored: '#/components/schemas/ErroredResult' + expired: '#/components/schemas/ExpiredResult' + succeeded: '#/components/schemas/SucceededResult' + propertyName: type + oneOf: + - $ref: '#/components/schemas/SucceededResult' + - $ref: '#/components/schemas/ErroredResult' + - $ref: '#/components/schemas/CanceledResult' + - $ref: '#/components/schemas/ExpiredResult' + title: Result + required: + - custom_id + - result + title: MessageBatchIndividualResponse + type: object + MessageDelta: + properties: + stop_reason: + anyOf: + - $ref: '#/components/schemas/StopReason' + - type: 'null' + default: null + title: Stop Reason + stop_sequence: + anyOf: + - type: string + - type: 'null' + default: null + title: Stop Sequence + required: + - stop_reason + - stop_sequence + title: MessageDelta + type: object + MessageDeltaEvent: + properties: + delta: + $ref: '#/components/schemas/MessageDelta' + type: + const: message_delta + default: message_delta + title: Type + type: string + usage: + $ref: '#/components/schemas/MessageDeltaUsage' + description: >- + Billing and rate-limit usage. + + + Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to + our systems. + + + Under 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. + + + For example, `output_tokens` will be non-zero, even for an empty string response from Claude. + + + Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, + and `cache_read_input_tokens`. + examples: + - output_tokens: 503 + required: + - delta + - type + - usage + title: MessageDeltaEvent + type: object + x-stainless-naming: + go: + model_name: MessageDeltaEvent + MessageDeltaUsage: + properties: + cache_creation_input_tokens: + anyOf: + - minimum: 0 + type: integer + - type: 'null' + default: null + description: The cumulative number of input tokens used to create the cache entry. + examples: + - 2051 + title: Cache Creation Input Tokens + cache_read_input_tokens: + anyOf: + - minimum: 0 + type: integer + - type: 'null' + default: null + description: The cumulative number of input tokens read from the cache. + examples: + - 2051 + title: Cache Read Input Tokens + input_tokens: + anyOf: + - minimum: 0 + type: integer + - type: 'null' + default: null + description: The cumulative number of input tokens which were used. + examples: + - 2095 + title: Input Tokens + output_tokens: + description: The cumulative number of output tokens which were used. + examples: + - 503 + title: Output Tokens + type: integer + server_tool_use: + anyOf: + - $ref: '#/components/schemas/ServerToolUsage' + - type: 'null' + default: null + description: The number of server tool requests. + required: + - cache_creation_input_tokens + - cache_read_input_tokens + - input_tokens + - output_tokens + - server_tool_use + title: MessageDeltaUsage + type: object + MessageStartEvent: + properties: + message: + $ref: '#/components/schemas/Message' + type: + const: message_start + default: message_start + title: Type + type: string + required: + - message + - type + title: MessageStartEvent + type: object + x-stainless-naming: + go: + model_name: MessageStartEvent + MessageStopEvent: + properties: + type: + const: message_stop + default: message_stop + title: Type + type: string + required: + - type + title: MessageStopEvent + type: object + x-stainless-naming: + go: + model_name: MessageStopEvent + MessageStreamEvent: + discriminator: + mapping: + content_block_delta: '#/components/schemas/ContentBlockDeltaEvent' + content_block_start: '#/components/schemas/ContentBlockStartEvent' + content_block_stop: '#/components/schemas/ContentBlockStopEvent' + message_delta: '#/components/schemas/MessageDeltaEvent' + message_start: '#/components/schemas/MessageStartEvent' + message_stop: '#/components/schemas/MessageStopEvent' + propertyName: type + oneOf: + - $ref: '#/components/schemas/MessageStartEvent' + - $ref: '#/components/schemas/MessageDeltaEvent' + - $ref: '#/components/schemas/MessageStopEvent' + - $ref: '#/components/schemas/ContentBlockStartEvent' + - $ref: '#/components/schemas/ContentBlockDeltaEvent' + - $ref: '#/components/schemas/ContentBlockStopEvent' + title: MessageStreamEvent + x-stainless-naming: + go: + model_name: MessageStreamEvent + Metadata: + additionalProperties: false + properties: + user_id: + anyOf: + - maxLength: 256 + type: string + - type: 'null' + description: >- + An external identifier for the user who is associated with the request. + + + This 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. + examples: + - 13803d75-b4b5-4c3e-b2a2-6f21399b021b + title: User Id + title: Metadata + type: object + ModelInfo: + properties: + created_at: + type: string + format: date-time + 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. + examples: + - '2025-02-19T00:00:00Z' + display_name: + type: string + title: Display Name + description: A human-readable name for the model. + examples: + - Claude Sonnet 4 + id: + type: string + title: Id + description: Unique model identifier. + examples: + - claude-sonnet-4-20250514 + type: + type: string + const: model + title: Type + description: |- + Object type. + + For Models, this is always `"model"`. + default: model + type: object + required: + - created_at + - display_name + - id + - type + title: ModelInfo + NotFoundError: + properties: + message: + default: Not found + title: Message + type: string + type: + const: not_found_error + default: not_found_error + title: Type + type: string + required: + - message + - type + title: NotFoundError + type: object + OverloadedError: + properties: + message: + default: Overloaded + title: Message + type: string + type: + const: overloaded_error + default: overloaded_error + title: Type + type: string + required: + - message + - type + title: OverloadedError + type: object + PermissionError: + properties: + message: + default: Permission denied + title: Message + type: string + type: + const: permission_error + default: permission_error + title: Type + type: string + required: + - message + - type + title: PermissionError + type: object + PlainTextSource: + additionalProperties: false + properties: + data: + title: Data + type: string + media_type: + const: text/plain + title: Media Type + type: string + type: + const: text + title: Type + type: string + required: + - data + - media_type + - type + title: PlainTextSource + type: object + RateLimitError: + properties: + message: + default: Rate limited + title: Message + type: string + type: + const: rate_limit_error + default: rate_limit_error + title: Type + type: string + required: + - message + - type + title: RateLimitError + type: object + RequestCharLocationCitation: + additionalProperties: false + properties: + cited_text: + title: Cited Text + type: string + document_index: + minimum: 0 + title: Document Index + type: integer + document_title: + anyOf: + - maxLength: 255 + minLength: 1 + type: string + - type: 'null' + title: Document Title + end_char_index: + title: End Char Index + type: integer + start_char_index: + minimum: 0 + title: Start Char Index + type: integer + type: + const: char_location + title: Type + type: string + required: + - cited_text + - document_index + - document_title + - end_char_index + - start_char_index + - type + title: RequestCharLocationCitation + type: object + RequestCitationsConfig: + additionalProperties: false + properties: + enabled: + title: Enabled + type: boolean + title: RequestCitationsConfig + type: object + RequestContentBlockLocationCitation: + additionalProperties: false + properties: + cited_text: + title: Cited Text + type: string + document_index: + minimum: 0 + title: Document Index + type: integer + document_title: + anyOf: + - maxLength: 255 + minLength: 1 + type: string + - type: 'null' + title: Document Title + end_block_index: + title: End Block Index + type: integer + start_block_index: + minimum: 0 + title: Start Block Index + type: integer + type: + const: content_block_location + title: Type + type: string + required: + - cited_text + - document_index + - document_title + - end_block_index + - start_block_index + - type + title: RequestContentBlockLocationCitation + type: object + RequestCounts: + properties: + canceled: + type: integer + title: Canceled + description: |- + Number of requests in the Message Batch that have been canceled. + + This is zero until processing of the entire Message Batch has ended. + default: 0 + examples: + - 10 + errored: + type: integer + title: Errored + description: |- + Number of requests in the Message Batch that encountered an error. + + This is zero until processing of the entire Message Batch has ended. + default: 0 + examples: + - 30 + expired: + type: integer + title: Expired + description: |- + Number of requests in the Message Batch that have expired. + + This is zero until processing of the entire Message Batch has ended. + default: 0 + examples: + - 10 + processing: + type: integer + title: Processing + description: Number of requests in the Message Batch that are processing. + default: 0 + examples: + - 100 + succeeded: + type: integer + title: Succeeded + description: |- + Number of requests in the Message Batch that have completed successfully. + + This is zero until processing of the entire Message Batch has ended. + default: 0 + examples: + - 50 + type: object + required: + - canceled + - errored + - expired + - processing + - succeeded + title: RequestCounts + RequestDocumentBlock: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/CacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/CacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + citations: + anyOf: + - $ref: '#/components/schemas/RequestCitationsConfig' + - type: 'null' + context: + anyOf: + - minLength: 1 + type: string + - type: 'null' + title: Context + source: + discriminator: + mapping: + base64: '#/components/schemas/Base64PDFSource' + content: '#/components/schemas/ContentBlockSource' + text: '#/components/schemas/PlainTextSource' + url: '#/components/schemas/URLPDFSource' + propertyName: type + oneOf: + - $ref: '#/components/schemas/Base64PDFSource' + - $ref: '#/components/schemas/PlainTextSource' + - $ref: '#/components/schemas/ContentBlockSource' + - $ref: '#/components/schemas/URLPDFSource' + title: Source + title: + anyOf: + - maxLength: 500 + minLength: 1 + type: string + - type: 'null' + title: Title + type: + const: document + title: Type + type: string + required: + - source + - type + title: RequestDocumentBlock + type: object + RequestImageBlock: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/CacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/CacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + source: + discriminator: + mapping: + base64: '#/components/schemas/Base64ImageSource' + url: '#/components/schemas/URLImageSource' + propertyName: type + oneOf: + - $ref: '#/components/schemas/Base64ImageSource' + - $ref: '#/components/schemas/URLImageSource' + title: Source + type: + const: image + title: Type + type: string + required: + - source + - type + title: RequestImageBlock + type: object + RequestPageLocationCitation: + additionalProperties: false + properties: + cited_text: + title: Cited Text + type: string + document_index: + minimum: 0 + title: Document Index + type: integer + document_title: + anyOf: + - maxLength: 255 + minLength: 1 + type: string + - type: 'null' + title: Document Title + end_page_number: + title: End Page Number + type: integer + start_page_number: + minimum: 1 + title: Start Page Number + type: integer + type: + const: page_location + title: Type + type: string + required: + - cited_text + - document_index + - document_title + - end_page_number + - start_page_number + - type + title: RequestPageLocationCitation + type: object + RequestRedactedThinkingBlock: + additionalProperties: false + properties: + data: + title: Data + type: string + type: + const: redacted_thinking + title: Type + type: string + required: + - data + - type + title: RequestRedactedThinkingBlock + type: object + RequestSearchResultBlock: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/CacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/CacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + citations: + $ref: '#/components/schemas/RequestCitationsConfig' + content: + items: + $ref: '#/components/schemas/RequestTextBlock' + title: Content + type: array + source: + title: Source + type: string + title: + title: Title + type: string + type: + const: search_result + title: Type + type: string + required: + - content + - source + - title + - type + title: RequestSearchResultBlock + type: object + RequestSearchResultLocationCitation: + additionalProperties: false + properties: + cited_text: + title: Cited Text + type: string + end_block_index: + title: End Block Index + type: integer + search_result_index: + minimum: 0 + title: Search Result Index + type: integer + source: + title: Source + type: string + start_block_index: + minimum: 0 + title: Start Block Index + type: integer + title: + anyOf: + - type: string + - type: 'null' + title: Title + type: + const: search_result_location + title: Type + type: string + required: + - cited_text + - end_block_index + - search_result_index + - source + - start_block_index + - title + - type + title: RequestSearchResultLocationCitation + type: object + RequestServerToolUseBlock: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/CacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/CacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + id: + pattern: ^srvtoolu_[a-zA-Z0-9_]+$ + title: Id + type: string + input: + additionalProperties: true + title: Input + type: object + name: + const: web_search + title: Name + type: string + type: + const: server_tool_use + title: Type + type: string + required: + - id + - input + - name + - type + title: RequestServerToolUseBlock + type: object + RequestTextBlock: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/CacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/CacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + citations: + anyOf: + - items: + discriminator: + mapping: + char_location: '#/components/schemas/RequestCharLocationCitation' + content_block_location: '#/components/schemas/RequestContentBlockLocationCitation' + page_location: '#/components/schemas/RequestPageLocationCitation' + search_result_location: '#/components/schemas/RequestSearchResultLocationCitation' + web_search_result_location: '#/components/schemas/RequestWebSearchResultLocationCitation' + propertyName: type + oneOf: + - $ref: '#/components/schemas/RequestCharLocationCitation' + - $ref: '#/components/schemas/RequestPageLocationCitation' + - $ref: '#/components/schemas/RequestContentBlockLocationCitation' + - $ref: '#/components/schemas/RequestWebSearchResultLocationCitation' + - $ref: '#/components/schemas/RequestSearchResultLocationCitation' + type: array + - type: 'null' + title: Citations + text: + minLength: 1 + title: Text + type: string + type: + const: text + title: Type + type: string + required: + - text + - type + title: RequestTextBlock + type: object + RequestThinkingBlock: + additionalProperties: false + properties: + signature: + title: Signature + type: string + thinking: + title: Thinking + type: string + type: + const: thinking + title: Type + type: string + required: + - signature + - thinking + - type + title: RequestThinkingBlock + type: object + RequestToolResultBlock: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/CacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/CacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + content: + anyOf: + - type: string + x-stainless-skip: + - go + - cli + - items: + discriminator: + mapping: + document: '#/components/schemas/RequestDocumentBlock' + image: '#/components/schemas/RequestImageBlock' + search_result: '#/components/schemas/RequestSearchResultBlock' + text: '#/components/schemas/RequestTextBlock' + propertyName: type + oneOf: + - $ref: '#/components/schemas/RequestTextBlock' + - $ref: '#/components/schemas/RequestImageBlock' + - $ref: '#/components/schemas/RequestSearchResultBlock' + - $ref: '#/components/schemas/RequestDocumentBlock' + title: Block + type: array + x-stainless-naming: + python: + type_name: Content + ruby: + type_name: Content + title: Content + is_error: + title: Is Error + type: boolean + tool_use_id: + pattern: ^[a-zA-Z0-9_-]+$ + title: Tool Use Id + type: string + type: + const: tool_result + title: Type + type: string + required: + - tool_use_id + - type + title: RequestToolResultBlock + type: object + RequestToolUseBlock: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/CacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/CacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + id: + pattern: ^[a-zA-Z0-9_-]+$ + title: Id + type: string + input: + additionalProperties: true + title: Input + type: object + name: + maxLength: 200 + minLength: 1 + title: Name + type: string + type: + const: tool_use + title: Type + type: string + required: + - id + - input + - name + - type + title: RequestToolUseBlock + type: object + RequestWebSearchResultBlock: + additionalProperties: false + properties: + encrypted_content: + title: Encrypted Content + type: string + page_age: + anyOf: + - type: string + - type: 'null' + title: Page Age + title: + title: Title + type: string + type: + const: web_search_result + title: Type + type: string + url: + title: Url + type: string + required: + - encrypted_content + - title + - type + - url + title: RequestWebSearchResultBlock + type: object + RequestWebSearchResultLocationCitation: + additionalProperties: false + properties: + cited_text: + title: Cited Text + type: string + encrypted_index: + title: Encrypted Index + type: string + title: + anyOf: + - maxLength: 512 + minLength: 1 + type: string + - type: 'null' + title: Title + type: + const: web_search_result_location + title: Type + type: string + url: + maxLength: 2048 + minLength: 1 + title: Url + type: string + required: + - cited_text + - encrypted_index + - title + - type + - url + title: RequestWebSearchResultLocationCitation + type: object + RequestWebSearchToolResultBlock: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/CacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/CacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + content: + anyOf: + - items: + $ref: '#/components/schemas/RequestWebSearchResultBlock' + type: array + title: web_search_tool_result_block_item + - $ref: '#/components/schemas/RequestWebSearchToolResultError' + x-stainless-naming: + go: + variant_constructor: NewWebSearchToolRequestError + title: Content + tool_use_id: + pattern: ^srvtoolu_[a-zA-Z0-9_]+$ + title: Tool Use Id + type: string + type: + const: web_search_tool_result + title: Type + type: string + required: + - content + - tool_use_id + - type + title: RequestWebSearchToolResultBlock + type: object + RequestWebSearchToolResultError: + additionalProperties: false + properties: + error_code: + $ref: '#/components/schemas/WebSearchToolResultErrorCode' + type: + const: web_search_tool_result_error + title: Type + type: string + required: + - error_code + - type + title: RequestWebSearchToolResultError + type: object + ResponseCharLocationCitation: + properties: + cited_text: + title: Cited Text + type: string + document_index: + minimum: 0 + title: Document Index + type: integer + document_title: + anyOf: + - type: string + - type: 'null' + title: Document Title + end_char_index: + title: End Char Index + type: integer + file_id: + anyOf: + - type: string + - type: 'null' + default: null + title: File Id + start_char_index: + minimum: 0 + title: Start Char Index + type: integer + type: + const: char_location + default: char_location + title: Type + type: string + required: + - cited_text + - document_index + - document_title + - end_char_index + - file_id + - start_char_index + - type + title: ResponseCharLocationCitation + type: object + ResponseContentBlockLocationCitation: + properties: + cited_text: + title: Cited Text + type: string + document_index: + minimum: 0 + title: Document Index + type: integer + document_title: + anyOf: + - type: string + - type: 'null' + title: Document Title + end_block_index: + title: End Block Index + type: integer + file_id: + anyOf: + - type: string + - type: 'null' + default: null + title: File Id + start_block_index: + minimum: 0 + title: Start Block Index + type: integer + type: + const: content_block_location + default: content_block_location + title: Type + type: string + required: + - cited_text + - document_index + - document_title + - end_block_index + - file_id + - start_block_index + - type + title: ResponseContentBlockLocationCitation + type: object + ResponsePageLocationCitation: + properties: + cited_text: + title: Cited Text + type: string + document_index: + minimum: 0 + title: Document Index + type: integer + document_title: + anyOf: + - type: string + - type: 'null' + title: Document Title + end_page_number: + title: End Page Number + type: integer + file_id: + anyOf: + - type: string + - type: 'null' + default: null + title: File Id + start_page_number: + minimum: 1 + title: Start Page Number + type: integer + type: + const: page_location + default: page_location + title: Type + type: string + required: + - cited_text + - document_index + - document_title + - end_page_number + - file_id + - start_page_number + - type + title: ResponsePageLocationCitation + type: object + ResponseRedactedThinkingBlock: + properties: + data: + title: Data + type: string + type: + const: redacted_thinking + default: redacted_thinking + title: Type + type: string + required: + - data + - type + title: ResponseRedactedThinkingBlock + type: object + ResponseSearchResultLocationCitation: + properties: + cited_text: + title: Cited Text + type: string + end_block_index: + title: End Block Index + type: integer + search_result_index: + minimum: 0 + title: Search Result Index + type: integer + source: + title: Source + type: string + start_block_index: + minimum: 0 + title: Start Block Index + type: integer + title: + anyOf: + - type: string + - type: 'null' + title: Title + type: + const: search_result_location + default: search_result_location + title: Type + type: string + required: + - cited_text + - end_block_index + - search_result_index + - source + - start_block_index + - title + - type + title: ResponseSearchResultLocationCitation + type: object + ResponseServerToolUseBlock: + properties: + id: + pattern: ^srvtoolu_[a-zA-Z0-9_]+$ + title: Id + type: string + input: + additionalProperties: true + title: Input + type: object + name: + const: web_search + title: Name + type: string + type: + const: server_tool_use + default: server_tool_use + title: Type + type: string + required: + - id + - input + - name + - type + title: ResponseServerToolUseBlock + type: object + ResponseTextBlock: + properties: + citations: + anyOf: + - items: + discriminator: + mapping: + char_location: '#/components/schemas/ResponseCharLocationCitation' + content_block_location: '#/components/schemas/ResponseContentBlockLocationCitation' + page_location: '#/components/schemas/ResponsePageLocationCitation' + search_result_location: '#/components/schemas/ResponseSearchResultLocationCitation' + web_search_result_location: '#/components/schemas/ResponseWebSearchResultLocationCitation' + propertyName: type + oneOf: + - $ref: '#/components/schemas/ResponseCharLocationCitation' + - $ref: '#/components/schemas/ResponsePageLocationCitation' + - $ref: '#/components/schemas/ResponseContentBlockLocationCitation' + - $ref: '#/components/schemas/ResponseWebSearchResultLocationCitation' + - $ref: '#/components/schemas/ResponseSearchResultLocationCitation' + type: array + - type: 'null' + default: null + description: >- + Citations supporting the text block. + + + The 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`. + title: Citations + text: + maxLength: 5000000 + minLength: 0 + title: Text + type: string + type: + const: text + default: text + title: Type + type: string + required: + - citations + - text + - type + title: ResponseTextBlock + type: object + ResponseThinkingBlock: + properties: + signature: + title: Signature + type: string + thinking: + title: Thinking + type: string + type: + const: thinking + default: thinking + title: Type + type: string + required: + - signature + - thinking + - type + title: ResponseThinkingBlock + type: object + ResponseToolUseBlock: + properties: + id: + pattern: ^[a-zA-Z0-9_-]+$ + title: Id + type: string + input: + additionalProperties: true + title: Input + type: object + name: + minLength: 1 + title: Name + type: string + type: + const: tool_use + default: tool_use + title: Type + type: string + required: + - id + - input + - name + - type + title: ResponseToolUseBlock + type: object + ResponseWebSearchResultBlock: + properties: + encrypted_content: + title: Encrypted Content + type: string + page_age: + anyOf: + - type: string + - type: 'null' + default: null + title: Page Age + title: + title: Title + type: string + type: + const: web_search_result + default: web_search_result + title: Type + type: string + url: + title: Url + type: string + required: + - encrypted_content + - page_age + - title + - type + - url + title: ResponseWebSearchResultBlock + type: object + ResponseWebSearchResultLocationCitation: + properties: + cited_text: + title: Cited Text + type: string + encrypted_index: + title: Encrypted Index + type: string + title: + anyOf: + - maxLength: 512 + type: string + - type: 'null' + title: Title + type: + const: web_search_result_location + default: web_search_result_location + title: Type + type: string + url: + title: Url + type: string + required: + - cited_text + - encrypted_index + - title + - type + - url + title: ResponseWebSearchResultLocationCitation + type: object + ResponseWebSearchToolResultBlock: + properties: + content: + anyOf: + - $ref: '#/components/schemas/ResponseWebSearchToolResultError' + - items: + $ref: '#/components/schemas/ResponseWebSearchResultBlock' + type: array + title: Content + tool_use_id: + pattern: ^srvtoolu_[a-zA-Z0-9_]+$ + title: Tool Use Id + type: string + type: + const: web_search_tool_result + default: web_search_tool_result + title: Type + type: string + required: + - content + - tool_use_id + - type + title: ResponseWebSearchToolResultBlock + type: object + ResponseWebSearchToolResultError: + properties: + error_code: + $ref: '#/components/schemas/WebSearchToolResultErrorCode' + type: + const: web_search_tool_result_error + default: web_search_tool_result_error + title: Type + type: string + required: + - error_code + - type + title: ResponseWebSearchToolResultError + type: object + ServerToolUsage: + properties: + web_search_requests: + default: 0 + description: The number of web search tool requests. + examples: + - 0 + minimum: 0 + title: Web Search Requests + type: integer + required: + - web_search_requests + title: ServerToolUsage + type: object + SignatureContentBlockDelta: + properties: + signature: + title: Signature + type: string + type: + const: signature_delta + default: signature_delta + title: Type + type: string + required: + - signature + - type + title: SignatureContentBlockDelta + type: object + Skill: + properties: + created_at: + type: string + title: Created At + description: ISO 8601 timestamp of when the skill was created. + examples: + - '2024-10-30T23:58:27.427722Z' + display_title: + anyOf: + - type: string + - type: 'null' + title: Display Title + description: |- + Display title for the skill. + + This is a human-readable label that is not included in the prompt sent to the model. + examples: + - My Custom Skill + id: + type: string + title: Id + description: |- + Unique identifier for the skill. + + The format and length of IDs may change over time. + examples: + - skill_01JAbcdefghijklmnopqrstuvw + latest_version: + anyOf: + - type: string + - type: 'null' + title: Latest Version + description: |- + The latest version identifier for the skill. + + This represents the most recent version of the skill that has been created. + examples: + - '1759178010641129' + source: + type: string + title: Source + description: |- + Source of the skill. + + This may be one of the following values: + * `"custom"`: the skill was created by a user + * `"anthropic"`: the skill was created by Anthropic + examples: + - custom + type: + type: string + title: Type + description: |- + Object type. + + For Skills, this is always `"skill"`. + default: skill + updated_at: + type: string + title: Updated At + description: ISO 8601 timestamp of when the skill was last updated. + examples: + - '2024-10-30T23:58:27.427722Z' + type: object + required: + - created_at + - display_title + - id + - latest_version + - source + - type + - updated_at + title: Skill + SkillVersion: + properties: + created_at: + type: string + title: Created At + description: ISO 8601 timestamp of when the skill version was created. + examples: + - '2024-10-30T23:58:27.427722Z' + description: + type: string + title: Description + description: |- + Description of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + examples: + - A custom skill for doing something useful + directory: + type: string + title: Directory + description: |- + Directory name of the skill version. + + This is the top-level directory name that was extracted from the uploaded files. + examples: + - my-skill + id: + type: string + title: Id + description: |- + Unique identifier for the skill version. + + The format and length of IDs may change over time. + examples: + - skillver_01JAbcdefghijklmnopqrstuvw + name: + type: string + title: Name + description: |- + Human-readable name of the skill version. + + This is extracted from the SKILL.md file in the skill upload. + examples: + - my-skill + skill_id: + type: string + title: Skill Id + description: Identifier for the skill that this version belongs to. + examples: + - skill_01JAbcdefghijklmnopqrstuvw + type: + type: string + title: Type + description: |- + Object type. + + For Skill Versions, this is always `"skill_version"`. + default: skill_version + version: + type: string + title: Version + description: |- + Version identifier for the skill. + + Each version is identified by a Unix epoch timestamp (e.g., "1759178010641129"). + examples: + - '1759178010641129' + type: object + required: + - created_at + - description + - directory + - id + - name + - skill_id + - type + - version + title: SkillVersion + SucceededResult: + properties: + message: + $ref: '#/components/schemas/Message' + type: + const: succeeded + default: succeeded + title: Type + type: string + required: + - message + - type + title: SucceededResult + type: object + TextContentBlockDelta: + properties: + text: + title: Text + type: string + type: + const: text_delta + default: text_delta + title: Type + type: string + required: + - text + - type + title: TextContentBlockDelta + type: object + TextEditor_20250124: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/CacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/CacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + name: + const: str_replace_editor + description: |- + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + title: Name + type: string + type: + const: text_editor_20250124 + title: Type + type: string + required: + - name + - type + title: TextEditor_20250124 + type: object + TextEditor_20250429: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/CacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/CacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + name: + const: str_replace_based_edit_tool + description: |- + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + title: Name + type: string + type: + const: text_editor_20250429 + title: Type + type: string + required: + - name + - type + title: TextEditor_20250429 + type: object + TextEditor_20250728: + additionalProperties: false + properties: + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/CacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/CacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + max_characters: + anyOf: + - minimum: 1 + type: integer + - type: 'null' + description: >- + Maximum number of characters to display when viewing a file. If not specified, defaults to + displaying the full file. + title: Max Characters + name: + const: str_replace_based_edit_tool + description: |- + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + title: Name + type: string + type: + const: text_editor_20250728 + title: Type + type: string + required: + - name + - type + title: TextEditor_20250728 + type: object + ThinkingConfigDisabled: + additionalProperties: false + properties: + type: + const: disabled + title: Type + type: string + required: + - type + title: ThinkingConfigDisabled + type: object + x-stainless-go-constant-constructor: true + ThinkingConfigEnabled: + additionalProperties: false + properties: + 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. + + + Must be ≥1024 and less than `max_tokens`. + + + See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for + details. + minimum: 1024 + title: Budget Tokens + type: integer + type: + const: enabled + title: Type + type: string + required: + - budget_tokens + - type + title: ThinkingConfigEnabled + type: object + ThinkingContentBlockDelta: + properties: + thinking: + title: Thinking + type: string + type: + const: thinking_delta + default: thinking_delta + title: Type + type: string + required: + - thinking + - type + title: ThinkingContentBlockDelta + type: object + Tool: + additionalProperties: false + properties: + type: + anyOf: + - type: 'null' + - const: custom + type: string + title: Type + description: + description: >- + Description of what this tool does. + + + Tool 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. + examples: + - Get the current weather in a given location + title: Description + type: string + name: + description: |- + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + maxLength: 128 + minLength: 1 + pattern: ^[a-zA-Z0-9_-]{1,128}$ + title: Name + type: string + input_schema: + $ref: '#/components/schemas/InputSchema' + description: |- + [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input. + + This defines the shape of the `input` that your tool accepts and that the model will produce. + examples: + - properties: + location: + description: The city and state, e.g. San Francisco, CA + type: string + unit: + description: Unit for the output - one of (celsius, fahrenheit) + type: string + required: + - location + type: object + x-stainless-skip: + - cli + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/CacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/CacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + required: + - name + - input_schema + title: Tool + type: object + ToolChoiceAny: + additionalProperties: false + description: The model will use any available tools. + properties: + disable_parallel_tool_use: + description: |- + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output exactly one tool use. + title: Disable Parallel Tool Use + type: boolean + type: + const: any + title: Type + type: string + required: + - type + title: ToolChoiceAny + type: object + ToolChoiceAuto: + additionalProperties: false + description: The model will automatically decide whether to use tools. + properties: + disable_parallel_tool_use: + description: |- + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output at most one tool use. + title: Disable Parallel Tool Use + type: boolean + type: + const: auto + title: Type + type: string + required: + - type + title: ToolChoiceAuto + type: object + ToolChoiceNone: + additionalProperties: false + description: The model will not be allowed to use tools. + properties: + type: + const: none + title: Type + type: string + required: + - type + title: ToolChoiceNone + type: object + x-stainless-go-constant-constructor: true + ToolChoiceTool: + additionalProperties: false + description: The model will use the specified tool with `tool_choice.name`. + properties: + disable_parallel_tool_use: + description: |- + Whether to disable parallel tool use. + + Defaults to `false`. If set to `true`, the model will output exactly one tool use. + title: Disable Parallel Tool Use + type: boolean + name: + description: The name of the tool to use. + title: Name + type: string + type: + const: tool + title: Type + type: string + required: + - name + - type + title: ToolChoiceTool + type: object + URLImageSource: + additionalProperties: false + properties: + type: + const: url + title: Type + type: string + url: + title: Url + type: string + required: + - type + - url + title: URLImageSource + type: object + URLPDFSource: + additionalProperties: false + properties: + type: + const: url + title: Type + type: string + url: + title: Url + type: string + required: + - type + - url + title: URLPDFSource + type: object + Usage: + properties: + cache_creation: + anyOf: + - $ref: '#/components/schemas/CacheCreation' + - type: 'null' + default: null + description: Breakdown of cached tokens by TTL + cache_creation_input_tokens: + anyOf: + - minimum: 0 + type: integer + - type: 'null' + default: null + description: The number of input tokens used to create the cache entry. + examples: + - 2051 + title: Cache Creation Input Tokens + cache_read_input_tokens: + anyOf: + - minimum: 0 + type: integer + - type: 'null' + default: null + description: The number of input tokens read from the cache. + examples: + - 2051 + title: Cache Read Input Tokens + input_tokens: + description: The number of input tokens which were used. + examples: + - 2095 + minimum: 0 + title: Input Tokens + type: integer + output_tokens: + description: The number of output tokens which were used. + examples: + - 503 + minimum: 0 + title: Output Tokens + type: integer + server_tool_use: + anyOf: + - $ref: '#/components/schemas/ServerToolUsage' + - type: 'null' + default: null + description: The number of server tool requests. + service_tier: + anyOf: + - enum: + - standard + - priority + - batch + type: string + - type: 'null' + default: null + description: If the request used the priority, standard, or batch tier. + title: Service Tier + required: + - cache_creation + - cache_creation_input_tokens + - cache_read_input_tokens + - input_tokens + - output_tokens + - server_tool_use + - service_tier + title: Usage + type: object + UserLocation: + additionalProperties: false + properties: + city: + anyOf: + - maxLength: 255 + minLength: 1 + type: string + - type: 'null' + description: The city of the user. + examples: + - New York + - Tokyo + - Los Angeles + title: City + country: + anyOf: + - maxLength: 2 + minLength: 2 + type: string + - type: 'null' + description: The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user. + examples: + - US + - JP + - GB + title: Country + region: + anyOf: + - maxLength: 255 + minLength: 1 + type: string + - type: 'null' + description: The region of the user. + examples: + - California + - Ontario + - Wales + title: Region + timezone: + anyOf: + - maxLength: 255 + minLength: 1 + type: string + - type: 'null' + description: The [IANA timezone](https://nodatime.org/TimeZones) of the user. + examples: + - America/New_York + - Asia/Tokyo + - Europe/London + title: Timezone + type: + const: approximate + title: Type + type: string + required: + - type + title: UserLocation + type: object + WebSearchToolResultErrorCode: + enum: + - invalid_tool_input + - unavailable + - max_uses_exceeded + - too_many_requests + - query_too_long + - request_too_large + title: WebSearchToolResultErrorCode + type: string + WebSearchTool_20250305: + additionalProperties: false + properties: + allowed_domains: + anyOf: + - items: + type: string + type: array + - type: 'null' + description: >- + If provided, only these domains will be included in results. Cannot be used alongside + `blocked_domains`. + title: Allowed Domains + blocked_domains: + anyOf: + - items: + type: string + type: array + - type: 'null' + description: >- + If provided, these domains will never appear in results. Cannot be used alongside + `allowed_domains`. + title: Blocked Domains + cache_control: + anyOf: + - discriminator: + mapping: + ephemeral: '#/components/schemas/CacheControlEphemeral' + propertyName: type + oneOf: + - $ref: '#/components/schemas/CacheControlEphemeral' + - type: 'null' + description: Create a cache control breakpoint at this content block. + title: Cache Control + max_uses: + anyOf: + - exclusiveMinimum: 0 + type: integer + - type: 'null' + description: Maximum number of times the tool can be used in the API request. + title: Max Uses + name: + const: web_search + description: |- + Name of the tool. + + This is how the tool will be called by the model and in `tool_use` blocks. + title: Name + type: string + type: + const: web_search_20250305 + title: Type + type: string + user_location: + anyOf: + - $ref: '#/components/schemas/UserLocation' + - type: 'null' + description: Parameters for the user's location. Used to provide more relevant search results. + required: + - name + - type + title: WebSearchTool_20250305 + type: object + CreateMessageParamsWithoutStream: + additionalProperties: false + example: + max_tokens: 1024 + messages: + - content: Hello, world + role: user + model: claude-sonnet-4-5-20250929 + properties: + model: + $ref: '#/components/schemas/Model' + messages: + description: >- + Input messages. + + + Our 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. + + + Each 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. + + + If 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. + + + Example with a single `user` message: + + + ```json + + [{"role": "user", "content": "Hello, Claude"}] + + ``` + + + Example with multiple conversational turns: + + + ```json + + [ + {"role": "user", "content": "Hello there."}, + {"role": "assistant", "content": "Hi, I'm Claude. How can I help you?"}, + {"role": "user", "content": "Can you explain LLMs in plain English?"}, + ] + + ``` + + + Example with a partially-filled response from Claude: + + + ```json + + [ + {"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, + {"role": "assistant", "content": "The best answer is ("}, + ] + + ``` + + + Each 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: + + + ```json + + {"role": "user", "content": "Hello, Claude"} + + ``` + + + ```json + + {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]} + + ``` + + + See [input examples](https://docs.claude.com/en/api/messages-examples). + + + Note 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. + + + There is a limit of 100,000 messages in a single request. + items: + $ref: '#/components/schemas/InputMessage' + title: Messages + type: array + max_tokens: + description: >- + The maximum number of tokens to generate before stopping. + + + Note that our models may stop _before_ reaching this maximum. This parameter only specifies the + absolute maximum number of tokens to generate. + + + Different models have different maximum values for this parameter. See + [models](https://docs.claude.com/en/docs/models-overview) for details. + examples: + - 1024 + minimum: 1 + title: Max Tokens + type: integer + metadata: + $ref: '#/components/schemas/Metadata' + description: An object describing metadata about the request. + service_tier: + description: >- + Determines whether to use priority capacity (if available) or standard capacity for this request. + + + Anthropic offers different levels of service for your API requests. See + [service-tiers](https://docs.claude.com/en/api/service-tiers) for details. + enum: + - auto + - standard_only + title: Service Tier + type: string + stop_sequences: + description: >- + Custom text sequences that will cause the model to stop generating. + + + Our models will normally stop when they have naturally completed their turn, which will result in + a response `stop_reason` of `"end_turn"`. + + + If 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. + items: + type: string + title: Stop Sequences + type: array + system: + anyOf: + - type: string + - items: + $ref: '#/components/schemas/RequestTextBlock' + type: array + description: >- + System prompt. + + + A 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). + examples: + - - text: Today's date is 2024-06-01. + type: text + - Today's date is 2023-01-01. + title: System + temperature: + description: >- + Amount of randomness injected into the response. + + + Defaults 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. + + + Note that even with `temperature` of `0.0`, the results will not be fully deterministic. + examples: + - 1 + maximum: 1 + minimum: 0 + title: Temperature + type: number + thinking: + $ref: '#/components/schemas/ThinkingConfigParam' + tool_choice: + $ref: '#/components/schemas/ToolChoice' + tools: + description: >- + Definitions of tools that the model may use. + + + If 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. + + + There 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)). + + + Each tool definition includes: + + + * `name`: Name of the tool. + + * `description`: Optional, but strongly-recommended description of the tool. + + * `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. + + + For example, if you defined `tools` as: + + + ```json + + [ { - "description": "Get the current weather in a given location", + "name": "get_stock_price", + "description": "Get the current stock price for a given ticker symbol.", "input_schema": { + "type": "object", "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string" - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string" + "ticker": { + "type": "string", + "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." } }, - "required": ["location"], - "type": "object" - }, - "name": "get_weather" - } - ], - "items": { - "oneOf": [ - { "$ref": "#/components/schemas/Tool" }, - { "$ref": "#/components/schemas/BashTool_20250124" }, - { "$ref": "#/components/schemas/TextEditor_20250124" }, - { "$ref": "#/components/schemas/TextEditor_20250429" }, - { "$ref": "#/components/schemas/TextEditor_20250728" }, - { "$ref": "#/components/schemas/WebSearchTool_20250305" } - ] - }, - "title": "Tools", - "type": "array" - }, - "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`.", - "examples": [5], - "minimum": 0, - "title": "Top K", - "type": "integer" - }, - "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`.", - "examples": [0.7], - "maximum": 1, - "minimum": 0, - "title": "Top P", - "type": "number" - } - }, - "required": ["model", "messages", "max_tokens"], - "title": "CreateMessageParams", - "type": "object" - }, - "DeleteMessageBatchResponse": { - "properties": { - "id": { - "type": "string", - "title": "Id", - "description": "ID of the Message Batch.", - "examples": ["msgbatch_013Zva2CMHLNnXjNJJKqJ2EF"] - }, - "type": { - "type": "string", - "enum": ["message_batch_deleted"], - "const": "message_batch_deleted", - "title": "Type", - "description": "Deleted object type.\n\nFor Message Batches, this is always `\"message_batch_deleted\"`.", - "default": "message_batch_deleted" - } - }, - "type": "object", - "required": ["id", "type"], - "title": "DeleteMessageBatchResponse" - }, - "ErrorResponse": { - "properties": { - "error": { - "discriminator": { - "mapping": { - "api_error": "#/components/schemas/APIError", - "authentication_error": "#/components/schemas/AuthenticationError", - "billing_error": "#/components/schemas/BillingError", - "invalid_request_error": "#/components/schemas/InvalidRequestError", - "not_found_error": "#/components/schemas/NotFoundError", - "overloaded_error": "#/components/schemas/OverloadedError", - "permission_error": "#/components/schemas/PermissionError", - "rate_limit_error": "#/components/schemas/RateLimitError", - "timeout_error": "#/components/schemas/GatewayTimeoutError" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/InvalidRequestError" }, - { "$ref": "#/components/schemas/AuthenticationError" }, - { "$ref": "#/components/schemas/BillingError" }, - { "$ref": "#/components/schemas/PermissionError" }, - { "$ref": "#/components/schemas/NotFoundError" }, - { "$ref": "#/components/schemas/RateLimitError" }, - { "$ref": "#/components/schemas/GatewayTimeoutError" }, - { "$ref": "#/components/schemas/APIError" }, - { "$ref": "#/components/schemas/OverloadedError" } - ], - "title": "Error" - }, - "request_id": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "default": null, - "title": "Request Id" - }, - "type": { - "const": "error", - "default": "error", - "enum": ["error"], - "title": "Type", - "type": "string" - } - }, - "required": ["error", "request_id", "type"], - "title": "ErrorResponse", - "type": "object" - }, - "ErroredResult": { - "properties": { - "error": { "$ref": "#/components/schemas/ErrorResponse" }, - "type": { - "const": "errored", - "default": "errored", - "enum": ["errored"], - "title": "Type", - "type": "string" - } - }, - "required": ["error", "type"], - "title": "ErroredResult", - "type": "object" - }, - "ExpiredResult": { - "properties": { - "type": { - "const": "expired", - "default": "expired", - "enum": ["expired"], - "title": "Type", - "type": "string" - } - }, - "required": ["type"], - "title": "ExpiredResult", - "type": "object" - }, - "FileDeleteResponse": { - "properties": { - "id": { "type": "string", "title": "Id", "description": "ID of the deleted file." }, - "type": { - "type": "string", - "enum": ["file_deleted"], - "const": "file_deleted", - "title": "Type", - "description": "Deleted object type.\n\nFor file deletion, this is always `\"file_deleted\"`.", - "default": "file_deleted" - } - }, - "type": "object", - "required": ["id"], - "title": "FileDeleteResponse" - }, - "FileListResponse": { - "properties": { - "data": { - "items": { "$ref": "#/components/schemas/FileMetadataSchema" }, - "type": "array", - "title": "Data", - "description": "List of file metadata objects." - }, - "first_id": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "First Id", - "description": "ID of the first file in this page of results." - }, - "has_more": { - "type": "boolean", - "title": "Has More", - "description": "Whether there are more results available.", - "default": false - }, - "last_id": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Last Id", - "description": "ID of the last file in this page of results." - } - }, - "type": "object", - "required": ["data"], - "title": "FileListResponse" - }, - "FileMetadataSchema": { - "properties": { - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At", - "description": "RFC 3339 datetime string representing when the file was created." - }, - "downloadable": { - "type": "boolean", - "title": "Downloadable", - "description": "Whether the file can be downloaded.", - "default": false - }, - "filename": { - "type": "string", - "maxLength": 500, - "minLength": 1, - "title": "Filename", - "description": "Original filename of the uploaded file." - }, - "id": { - "type": "string", - "title": "Id", - "description": "Unique object identifier.\n\nThe format and length of IDs may change over time." - }, - "mime_type": { - "type": "string", - "maxLength": 255, - "minLength": 1, - "title": "Mime Type", - "description": "MIME type of the file." - }, - "size_bytes": { - "type": "integer", - "minimum": 0, - "title": "Size Bytes", - "description": "Size of the file in bytes." - }, - "type": { - "type": "string", - "enum": ["file"], - "const": "file", - "title": "Type", - "description": "Object type.\n\nFor files, this is always `\"file\"`." - } - }, - "type": "object", - "required": ["created_at", "filename", "id", "mime_type", "size_bytes", "type"], - "title": "FileMetadataSchema" - }, - "GatewayTimeoutError": { - "properties": { - "message": { "default": "Request timeout", "title": "Message", "type": "string" }, - "type": { - "const": "timeout_error", - "default": "timeout_error", - "enum": ["timeout_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["message", "type"], - "title": "GatewayTimeoutError", - "type": "object" - }, - "InputJsonContentBlockDelta": { - "properties": { - "partial_json": { "title": "Partial Json", "type": "string" }, - "type": { - "const": "input_json_delta", - "default": "input_json_delta", - "enum": ["input_json_delta"], - "title": "Type", - "type": "string" - } - }, - "required": ["partial_json", "type"], - "title": "InputJsonContentBlockDelta", - "type": "object" - }, - "InputMessage": { - "additionalProperties": false, - "properties": { - "content": { - "anyOf": [ - { "type": "string", "x-stainless-skip": ["go", "cli"] }, - { - "items": { "$ref": "#/components/schemas/InputContentBlock" }, - "type": "array", - "example": [{ "type": "text", "text": "What is a quaternion?" }] - } - ], - "title": "Content" - }, - "role": { "enum": ["user", "assistant"], "title": "Role", "type": "string" } - }, - "required": ["content", "role"], - "title": "InputMessage", - "type": "object", - "discriminator": { "propertyName": "role" } - }, - "InputSchema": { - "additionalProperties": true, - "properties": { - "properties": { "anyOf": [{ "type": "object" }, { "type": "null" }], "title": "Properties" }, - "required": { - "anyOf": [{ "items": { "type": "string" }, "type": "array" }, { "type": "null" }], - "title": "Required" - }, - "type": { "const": "object", "enum": ["object"], "title": "Type", "type": "string" } - }, - "required": ["type"], - "title": "InputSchema", - "type": "object" - }, - "InvalidRequestError": { - "properties": { - "message": { "default": "Invalid request", "title": "Message", "type": "string" }, - "type": { - "const": "invalid_request_error", - "default": "invalid_request_error", - "enum": ["invalid_request_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["message", "type"], - "title": "InvalidRequestError", - "type": "object" - }, - "ListResponse_MessageBatch_": { - "properties": { - "data": { - "items": { "$ref": "#/components/schemas/MessageBatch" }, - "type": "array", - "title": "Data" - }, - "first_id": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "First Id", - "description": "First ID in the `data` list. Can be used as the `before_id` for the previous page." - }, - "has_more": { - "type": "boolean", - "title": "Has More", - "description": "Indicates if there are more results in the requested page direction." - }, - "last_id": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Last Id", - "description": "Last ID in the `data` list. Can be used as the `after_id` for the next page." - } - }, - "type": "object", - "required": ["data", "first_id", "has_more", "last_id"], - "title": "ListResponse[MessageBatch]" - }, - "ListResponse_ModelInfo_": { - "properties": { - "data": { "items": { "$ref": "#/components/schemas/ModelInfo" }, "type": "array", "title": "Data" }, - "first_id": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "First Id", - "description": "First ID in the `data` list. Can be used as the `before_id` for the previous page." - }, - "has_more": { - "type": "boolean", - "title": "Has More", - "description": "Indicates if there are more results in the requested page direction." - }, - "last_id": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Last Id", - "description": "Last ID in the `data` list. Can be used as the `after_id` for the next page." - } - }, - "type": "object", - "required": ["data", "first_id", "has_more", "last_id"], - "title": "ListResponse[ModelInfo]" - }, - "Message": { - "examples": [ - { - "content": [{ "citations": null, "text": "Hi! My name is Claude.", "type": "text" }], - "id": "msg_013Zva2CMHLNnXjNJJKqJ2EF", - "model": "claude-sonnet-4-20250514", - "role": "assistant", - "stop_reason": "end_turn", - "stop_sequence": null, - "type": "message", - "usage": { "input_tokens": 2095, "output_tokens": 503 } - } - ], - "properties": { - "id": { - "description": "Unique object identifier.\n\nThe format and length of IDs may change over time.", - "examples": ["msg_013Zva2CMHLNnXjNJJKqJ2EF"], - "title": "Id", - "type": "string" - }, - "type": { - "const": "message", - "default": "message", - "description": "Object type.\n\nFor Messages, this is always `\"message\"`.", - "enum": ["message"], - "title": "Type", - "type": "string" - }, - "role": { - "const": "assistant", - "default": "assistant", - "description": "Conversational role of the generated message.\n\nThis will always be `\"assistant\"`.", - "enum": ["assistant"], - "title": "Role", - "type": "string" - }, - "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```", - "examples": [[{ "citations": null, "text": "Hi! My name is Claude.", "type": "text" }]], - "items": { "$ref": "#/components/schemas/ContentBlock" }, - "title": "Content", - "type": "array" - }, - "model": { "$ref": "#/components/schemas/Model" }, - "stop_reason": { - "anyOf": [{ "$ref": "#/components/schemas/StopReason" }, { "type": "null" }], - "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.", - "title": "Stop Reason" - }, - "stop_sequence": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "default": null, - "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.", - "title": "Stop Sequence" - }, - "usage": { - "$ref": "#/components/schemas/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`.", - "examples": [{ "input_tokens": 2095, "output_tokens": 503 }] - } - }, - "required": ["id", "type", "role", "content", "model", "stop_reason", "stop_sequence", "usage"], - "title": "Message", - "type": "object", - "x-stainless-python-custom-imports": ["from .content_block import ContentBlock as ContentBlock"] - }, - "MessageBatch": { - "properties": { - "archived_at": { - "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }], - "title": "Archived At", - "description": "RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable.", - "examples": ["2024-08-20T18:37:24.100435Z"] - }, - "cancel_initiated_at": { - "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }], - "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.", - "examples": ["2024-08-20T18:37:24.100435Z"] - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At", - "description": "RFC 3339 datetime string representing the time at which the Message Batch was created.", - "examples": ["2024-08-20T18:37:24.100435Z"] - }, - "ended_at": { - "anyOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }], - "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.", - "examples": ["2024-08-20T18:37:24.100435Z"] - }, - "expires_at": { - "type": "string", - "format": "date-time", - "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.", - "examples": ["2024-08-20T18:37:24.100435Z"] - }, - "id": { - "type": "string", - "title": "Id", - "description": "Unique object identifier.\n\nThe format and length of IDs may change over time.", - "examples": ["msgbatch_013Zva2CMHLNnXjNJJKqJ2EF"] - }, - "processing_status": { - "type": "string", - "enum": ["in_progress", "canceling", "ended"], - "title": "Processing Status", - "description": "Processing status of the Message Batch." - }, - "request_counts": { - "$ref": "#/components/schemas/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." - }, - "results_url": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Results Url", - "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.", - "examples": [ - "https://api.anthropic.com/v1/messages/batches/msgbatch_013Zva2CMHLNnXjNJJKqJ2EF/results" - ] - }, - "type": { - "type": "string", - "enum": ["message_batch"], - "const": "message_batch", - "title": "Type", - "description": "Object type.\n\nFor Message Batches, this is always `\"message_batch\"`.", - "default": "message_batch" - } - }, - "type": "object", - "required": [ - "archived_at", - "cancel_initiated_at", - "created_at", - "ended_at", - "expires_at", - "id", - "processing_status", - "request_counts", - "results_url", - "type" - ], - "title": "MessageBatch" - }, - "MessageBatchIndividualRequestParams": { - "additionalProperties": false, - "properties": { - "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.", - "examples": ["my-custom-id-1"], - "maxLength": 64, - "minLength": 1, - "pattern": "^[a-zA-Z0-9_-]{1,64}$", - "title": "Custom Id", - "type": "string" - }, - "params": { - "$ref": "#/components/schemas/CreateMessageParams", - "description": "Messages API creation parameters for the individual request. \n\nSee the [Messages API reference](/en/api/messages) for full documentation on available parameters." - } - }, - "required": ["custom_id", "params"], - "title": "MessageBatchIndividualRequestParams", - "type": "object" - }, - "MessageBatchIndividualResponse": { - "description": "This is a single line in the response `.jsonl` file and does not represent the response as a whole.", - "properties": { - "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.", - "examples": ["my-custom-id-1"], - "title": "Custom Id", - "type": "string" - }, - "result": { - "description": "Processing result for this request.\n\nContains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration.", - "discriminator": { - "mapping": { - "canceled": "#/components/schemas/CanceledResult", - "errored": "#/components/schemas/ErroredResult", - "expired": "#/components/schemas/ExpiredResult", - "succeeded": "#/components/schemas/SucceededResult" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/SucceededResult" }, - { "$ref": "#/components/schemas/ErroredResult" }, - { "$ref": "#/components/schemas/CanceledResult" }, - { "$ref": "#/components/schemas/ExpiredResult" } - ], - "title": "Result" - } - }, - "required": ["custom_id", "result"], - "title": "MessageBatchIndividualResponse", - "type": "object" - }, - "MessageDelta": { - "properties": { - "stop_reason": { - "anyOf": [{ "$ref": "#/components/schemas/StopReason" }, { "type": "null" }], - "default": null, - "title": "Stop Reason" - }, - "stop_sequence": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "default": null, - "title": "Stop Sequence" - } - }, - "required": ["stop_reason", "stop_sequence"], - "title": "MessageDelta", - "type": "object" - }, - "MessageDeltaEvent": { - "properties": { - "delta": { "$ref": "#/components/schemas/MessageDelta" }, - "type": { - "const": "message_delta", - "default": "message_delta", - "enum": ["message_delta"], - "title": "Type", - "type": "string" - }, - "usage": { - "$ref": "#/components/schemas/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`.", - "examples": [{ "output_tokens": 503 }] - } - }, - "required": ["delta", "type", "usage"], - "title": "MessageDeltaEvent", - "type": "object", - "x-stainless-naming": { "go": { "model_name": "MessageDeltaEvent" } } - }, - "MessageDeltaUsage": { - "properties": { - "cache_creation_input_tokens": { - "anyOf": [{ "minimum": 0, "type": "integer" }, { "type": "null" }], - "default": null, - "description": "The cumulative number of input tokens used to create the cache entry.", - "examples": [2051], - "title": "Cache Creation Input Tokens" - }, - "cache_read_input_tokens": { - "anyOf": [{ "minimum": 0, "type": "integer" }, { "type": "null" }], - "default": null, - "description": "The cumulative number of input tokens read from the cache.", - "examples": [2051], - "title": "Cache Read Input Tokens" - }, - "input_tokens": { - "anyOf": [{ "minimum": 0, "type": "integer" }, { "type": "null" }], - "default": null, - "description": "The cumulative number of input tokens which were used.", - "examples": [2095], - "title": "Input Tokens" - }, - "output_tokens": { - "description": "The cumulative number of output tokens which were used.", - "examples": [503], - "title": "Output Tokens", - "type": "integer" - }, - "server_tool_use": { - "anyOf": [{ "$ref": "#/components/schemas/ServerToolUsage" }, { "type": "null" }], - "default": null, - "description": "The number of server tool requests." - } - }, - "required": [ - "cache_creation_input_tokens", - "cache_read_input_tokens", - "input_tokens", - "output_tokens", - "server_tool_use" - ], - "title": "MessageDeltaUsage", - "type": "object" - }, - "MessageStartEvent": { - "properties": { - "message": { "$ref": "#/components/schemas/Message" }, - "type": { - "const": "message_start", - "default": "message_start", - "enum": ["message_start"], - "title": "Type", - "type": "string" - } - }, - "required": ["message", "type"], - "title": "MessageStartEvent", - "type": "object", - "x-stainless-naming": { "go": { "model_name": "MessageStartEvent" } } - }, - "MessageStopEvent": { - "properties": { - "type": { - "const": "message_stop", - "default": "message_stop", - "enum": ["message_stop"], - "title": "Type", - "type": "string" - } - }, - "required": ["type"], - "title": "MessageStopEvent", - "type": "object", - "x-stainless-naming": { "go": { "model_name": "MessageStopEvent" } } - }, - "MessageStreamEvent": { - "discriminator": { - "mapping": { - "content_block_delta": "#/components/schemas/ContentBlockDeltaEvent", - "content_block_start": "#/components/schemas/ContentBlockStartEvent", - "content_block_stop": "#/components/schemas/ContentBlockStopEvent", - "message_delta": "#/components/schemas/MessageDeltaEvent", - "message_start": "#/components/schemas/MessageStartEvent", - "message_stop": "#/components/schemas/MessageStopEvent" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/MessageStartEvent" }, - { "$ref": "#/components/schemas/MessageDeltaEvent" }, - { "$ref": "#/components/schemas/MessageStopEvent" }, - { "$ref": "#/components/schemas/ContentBlockStartEvent" }, - { "$ref": "#/components/schemas/ContentBlockDeltaEvent" }, - { "$ref": "#/components/schemas/ContentBlockStopEvent" } - ], - "title": "MessageStreamEvent", - "x-stainless-naming": { "go": { "model_name": "MessageStreamEvent" } } - }, - "Metadata": { - "additionalProperties": false, - "properties": { - "user_id": { - "anyOf": [{ "maxLength": 256, "type": "string" }, { "type": "null" }], - "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.", - "examples": ["13803d75-b4b5-4c3e-b2a2-6f21399b021b"], - "title": "User Id" - } - }, - "title": "Metadata", - "type": "object" - }, - "ModelInfo": { - "properties": { - "created_at": { - "type": "string", - "format": "date-time", - "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.", - "examples": ["2025-02-19T00:00:00Z"] - }, - "display_name": { - "type": "string", - "title": "Display Name", - "description": "A human-readable name for the model.", - "examples": ["Claude Sonnet 4"] - }, - "id": { - "type": "string", - "title": "Id", - "description": "Unique model identifier.", - "examples": ["claude-sonnet-4-20250514"] - }, - "type": { - "type": "string", - "enum": ["model"], - "const": "model", - "title": "Type", - "description": "Object type.\n\nFor Models, this is always `\"model\"`.", - "default": "model" - } - }, - "type": "object", - "required": ["created_at", "display_name", "id", "type"], - "title": "ModelInfo" - }, - "NotFoundError": { - "properties": { - "message": { "default": "Not found", "title": "Message", "type": "string" }, - "type": { - "const": "not_found_error", - "default": "not_found_error", - "enum": ["not_found_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["message", "type"], - "title": "NotFoundError", - "type": "object" - }, - "OverloadedError": { - "properties": { - "message": { "default": "Overloaded", "title": "Message", "type": "string" }, - "type": { - "const": "overloaded_error", - "default": "overloaded_error", - "enum": ["overloaded_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["message", "type"], - "title": "OverloadedError", - "type": "object" - }, - "PermissionError": { - "properties": { - "message": { "default": "Permission denied", "title": "Message", "type": "string" }, - "type": { - "const": "permission_error", - "default": "permission_error", - "enum": ["permission_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["message", "type"], - "title": "PermissionError", - "type": "object" - }, - "PlainTextSource": { - "additionalProperties": false, - "properties": { - "data": { "title": "Data", "type": "string" }, - "media_type": { - "const": "text/plain", - "enum": ["text/plain"], - "title": "Media Type", - "type": "string" - }, - "type": { "const": "text", "enum": ["text"], "title": "Type", "type": "string" } - }, - "required": ["data", "media_type", "type"], - "title": "PlainTextSource", - "type": "object" - }, - "RateLimitError": { - "properties": { - "message": { "default": "Rate limited", "title": "Message", "type": "string" }, - "type": { - "const": "rate_limit_error", - "default": "rate_limit_error", - "enum": ["rate_limit_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["message", "type"], - "title": "RateLimitError", - "type": "object" - }, - "RequestCharLocationCitation": { - "additionalProperties": false, - "properties": { - "cited_text": { "title": "Cited Text", "type": "string" }, - "document_index": { "minimum": 0, "title": "Document Index", "type": "integer" }, - "document_title": { - "anyOf": [{ "maxLength": 255, "minLength": 1, "type": "string" }, { "type": "null" }], - "title": "Document Title" - }, - "end_char_index": { "title": "End Char Index", "type": "integer" }, - "start_char_index": { "minimum": 0, "title": "Start Char Index", "type": "integer" }, - "type": { "const": "char_location", "enum": ["char_location"], "title": "Type", "type": "string" } - }, - "required": [ - "cited_text", - "document_index", - "document_title", - "end_char_index", - "start_char_index", - "type" - ], - "title": "RequestCharLocationCitation", - "type": "object" - }, - "RequestCitationsConfig": { - "additionalProperties": false, - "properties": { "enabled": { "title": "Enabled", "type": "boolean" } }, - "title": "RequestCitationsConfig", - "type": "object" - }, - "RequestContentBlockLocationCitation": { - "additionalProperties": false, - "properties": { - "cited_text": { "title": "Cited Text", "type": "string" }, - "document_index": { "minimum": 0, "title": "Document Index", "type": "integer" }, - "document_title": { - "anyOf": [{ "maxLength": 255, "minLength": 1, "type": "string" }, { "type": "null" }], - "title": "Document Title" - }, - "end_block_index": { "title": "End Block Index", "type": "integer" }, - "start_block_index": { "minimum": 0, "title": "Start Block Index", "type": "integer" }, - "type": { - "const": "content_block_location", - "enum": ["content_block_location"], - "title": "Type", - "type": "string" - } - }, - "required": [ - "cited_text", - "document_index", - "document_title", - "end_block_index", - "start_block_index", - "type" - ], - "title": "RequestContentBlockLocationCitation", - "type": "object" - }, - "RequestCounts": { - "properties": { - "canceled": { - "type": "integer", - "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, - "examples": [10] - }, - "errored": { - "type": "integer", - "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, - "examples": [30] - }, - "expired": { - "type": "integer", - "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, - "examples": [10] - }, - "processing": { - "type": "integer", - "title": "Processing", - "description": "Number of requests in the Message Batch that are processing.", - "default": 0, - "examples": [100] - }, - "succeeded": { - "type": "integer", - "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, - "examples": [50] - } - }, - "type": "object", - "required": ["canceled", "errored", "expired", "processing", "succeeded"], - "title": "RequestCounts" - }, - "RequestDocumentBlock": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/CacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/CacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "citations": { - "anyOf": [{ "$ref": "#/components/schemas/RequestCitationsConfig" }, { "type": "null" }] - }, - "context": { - "anyOf": [{ "minLength": 1, "type": "string" }, { "type": "null" }], - "title": "Context" - }, - "source": { - "discriminator": { - "mapping": { - "base64": "#/components/schemas/Base64PDFSource", - "content": "#/components/schemas/ContentBlockSource", - "text": "#/components/schemas/PlainTextSource", - "url": "#/components/schemas/URLPDFSource" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/Base64PDFSource" }, - { "$ref": "#/components/schemas/PlainTextSource" }, - { "$ref": "#/components/schemas/ContentBlockSource" }, - { "$ref": "#/components/schemas/URLPDFSource" } - ], - "title": "Source" - }, - "title": { - "anyOf": [{ "maxLength": 500, "minLength": 1, "type": "string" }, { "type": "null" }], - "title": "Title" - }, - "type": { "const": "document", "enum": ["document"], "title": "Type", "type": "string" } - }, - "required": ["source", "type"], - "title": "RequestDocumentBlock", - "type": "object" - }, - "RequestImageBlock": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/CacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/CacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "source": { - "discriminator": { - "mapping": { - "base64": "#/components/schemas/Base64ImageSource", - "url": "#/components/schemas/URLImageSource" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/Base64ImageSource" }, - { "$ref": "#/components/schemas/URLImageSource" } - ], - "title": "Source" - }, - "type": { "const": "image", "enum": ["image"], "title": "Type", "type": "string" } - }, - "required": ["source", "type"], - "title": "RequestImageBlock", - "type": "object" - }, - "RequestPageLocationCitation": { - "additionalProperties": false, - "properties": { - "cited_text": { "title": "Cited Text", "type": "string" }, - "document_index": { "minimum": 0, "title": "Document Index", "type": "integer" }, - "document_title": { - "anyOf": [{ "maxLength": 255, "minLength": 1, "type": "string" }, { "type": "null" }], - "title": "Document Title" - }, - "end_page_number": { "title": "End Page Number", "type": "integer" }, - "start_page_number": { "minimum": 1, "title": "Start Page Number", "type": "integer" }, - "type": { "const": "page_location", "enum": ["page_location"], "title": "Type", "type": "string" } - }, - "required": [ - "cited_text", - "document_index", - "document_title", - "end_page_number", - "start_page_number", - "type" - ], - "title": "RequestPageLocationCitation", - "type": "object" - }, - "RequestRedactedThinkingBlock": { - "additionalProperties": false, - "properties": { - "data": { "title": "Data", "type": "string" }, - "type": { - "const": "redacted_thinking", - "enum": ["redacted_thinking"], - "title": "Type", - "type": "string" - } - }, - "required": ["data", "type"], - "title": "RequestRedactedThinkingBlock", - "type": "object" - }, - "RequestSearchResultBlock": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/CacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/CacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "citations": { "$ref": "#/components/schemas/RequestCitationsConfig" }, - "content": { - "items": { "$ref": "#/components/schemas/RequestTextBlock" }, - "title": "Content", - "type": "array" - }, - "source": { "title": "Source", "type": "string" }, - "title": { "title": "Title", "type": "string" }, - "type": { "const": "search_result", "enum": ["search_result"], "title": "Type", "type": "string" } - }, - "required": ["content", "source", "title", "type"], - "title": "RequestSearchResultBlock", - "type": "object" - }, - "RequestSearchResultLocationCitation": { - "additionalProperties": false, - "properties": { - "cited_text": { "title": "Cited Text", "type": "string" }, - "end_block_index": { "title": "End Block Index", "type": "integer" }, - "search_result_index": { "minimum": 0, "title": "Search Result Index", "type": "integer" }, - "source": { "title": "Source", "type": "string" }, - "start_block_index": { "minimum": 0, "title": "Start Block Index", "type": "integer" }, - "title": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Title" }, - "type": { - "const": "search_result_location", - "enum": ["search_result_location"], - "title": "Type", - "type": "string" - } - }, - "required": [ - "cited_text", - "end_block_index", - "search_result_index", - "source", - "start_block_index", - "title", - "type" - ], - "title": "RequestSearchResultLocationCitation", - "type": "object" - }, - "RequestServerToolUseBlock": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/CacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/CacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Id", "type": "string" }, - "input": { "title": "Input", "type": "object" }, - "name": { "const": "web_search", "enum": ["web_search"], "title": "Name", "type": "string" }, - "type": { - "const": "server_tool_use", - "enum": ["server_tool_use"], - "title": "Type", - "type": "string" - } - }, - "required": ["id", "input", "name", "type"], - "title": "RequestServerToolUseBlock", - "type": "object" - }, - "RequestTextBlock": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/CacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/CacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "citations": { - "anyOf": [ - { - "items": { - "discriminator": { - "mapping": { - "char_location": "#/components/schemas/RequestCharLocationCitation", - "content_block_location": "#/components/schemas/RequestContentBlockLocationCitation", - "page_location": "#/components/schemas/RequestPageLocationCitation", - "search_result_location": "#/components/schemas/RequestSearchResultLocationCitation", - "web_search_result_location": "#/components/schemas/RequestWebSearchResultLocationCitation" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/RequestCharLocationCitation" }, - { "$ref": "#/components/schemas/RequestPageLocationCitation" }, - { "$ref": "#/components/schemas/RequestContentBlockLocationCitation" }, - { "$ref": "#/components/schemas/RequestWebSearchResultLocationCitation" }, - { "$ref": "#/components/schemas/RequestSearchResultLocationCitation" } - ] - }, - "type": "array" - }, - { "type": "null" } - ], - "title": "Citations" - }, - "text": { "minLength": 1, "title": "Text", "type": "string" }, - "type": { "const": "text", "enum": ["text"], "title": "Type", "type": "string" } - }, - "required": ["text", "type"], - "title": "RequestTextBlock", - "type": "object" - }, - "RequestThinkingBlock": { - "additionalProperties": false, - "properties": { - "signature": { "title": "Signature", "type": "string" }, - "thinking": { "title": "Thinking", "type": "string" }, - "type": { "const": "thinking", "enum": ["thinking"], "title": "Type", "type": "string" } - }, - "required": ["signature", "thinking", "type"], - "title": "RequestThinkingBlock", - "type": "object" - }, - "RequestToolResultBlock": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/CacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/CacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "content": { - "anyOf": [ - { "type": "string", "x-stainless-skip": ["go", "cli"] }, - { - "items": { - "discriminator": { - "mapping": { - "document": "#/components/schemas/RequestDocumentBlock", - "image": "#/components/schemas/RequestImageBlock", - "search_result": "#/components/schemas/RequestSearchResultBlock", - "text": "#/components/schemas/RequestTextBlock" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/RequestTextBlock" }, - { "$ref": "#/components/schemas/RequestImageBlock" }, - { "$ref": "#/components/schemas/RequestSearchResultBlock" }, - { "$ref": "#/components/schemas/RequestDocumentBlock" } - ], - "title": "Block" - }, - "type": "array", - "x-stainless-naming": { - "python": { "type_name": "Content" }, - "ruby": { "type_name": "Content" } + "required": ["ticker"] } } - ], - "title": "Content" - }, - "is_error": { "title": "Is Error", "type": "boolean" }, - "tool_use_id": { "pattern": "^[a-zA-Z0-9_-]+$", "title": "Tool Use Id", "type": "string" }, - "type": { "const": "tool_result", "enum": ["tool_result"], "title": "Type", "type": "string" } - }, - "required": ["tool_use_id", "type"], - "title": "RequestToolResultBlock", - "type": "object" - }, - "RequestToolUseBlock": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/CacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/CacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "id": { "pattern": "^[a-zA-Z0-9_-]+$", "title": "Id", "type": "string" }, - "input": { "title": "Input", "type": "object" }, - "name": { "maxLength": 200, "minLength": 1, "title": "Name", "type": "string" }, - "type": { "const": "tool_use", "enum": ["tool_use"], "title": "Type", "type": "string" } - }, - "required": ["id", "input", "name", "type"], - "title": "RequestToolUseBlock", - "type": "object" - }, - "RequestWebSearchResultBlock": { - "additionalProperties": false, - "properties": { - "encrypted_content": { "title": "Encrypted Content", "type": "string" }, - "page_age": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Page Age" }, - "title": { "title": "Title", "type": "string" }, - "type": { - "const": "web_search_result", - "enum": ["web_search_result"], - "title": "Type", - "type": "string" - }, - "url": { "title": "Url", "type": "string" } - }, - "required": ["encrypted_content", "title", "type", "url"], - "title": "RequestWebSearchResultBlock", - "type": "object" - }, - "RequestWebSearchResultLocationCitation": { - "additionalProperties": false, - "properties": { - "cited_text": { "title": "Cited Text", "type": "string" }, - "encrypted_index": { "title": "Encrypted Index", "type": "string" }, - "title": { - "anyOf": [{ "maxLength": 512, "minLength": 1, "type": "string" }, { "type": "null" }], - "title": "Title" - }, - "type": { - "const": "web_search_result_location", - "enum": ["web_search_result_location"], - "title": "Type", - "type": "string" - }, - "url": { "maxLength": 2048, "minLength": 1, "title": "Url", "type": "string" } - }, - "required": ["cited_text", "encrypted_index", "title", "type", "url"], - "title": "RequestWebSearchResultLocationCitation", - "type": "object" - }, - "RequestWebSearchToolResultBlock": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/CacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/CacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "content": { - "anyOf": [ - { - "items": { "$ref": "#/components/schemas/RequestWebSearchResultBlock" }, - "type": "array", - "title": "web_search_tool_result_block_item" - }, - { - "$ref": "#/components/schemas/RequestWebSearchToolResultError", - "x-stainless-naming": { "go": { "variant_constructor": "NewWebSearchToolRequestError" } } - } - ], - "title": "Content" - }, - "tool_use_id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Tool Use Id", "type": "string" }, - "type": { - "const": "web_search_tool_result", - "enum": ["web_search_tool_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["content", "tool_use_id", "type"], - "title": "RequestWebSearchToolResultBlock", - "type": "object" - }, - "RequestWebSearchToolResultError": { - "additionalProperties": false, - "properties": { - "error_code": { "$ref": "#/components/schemas/WebSearchToolResultErrorCode" }, - "type": { - "const": "web_search_tool_result_error", - "enum": ["web_search_tool_result_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["error_code", "type"], - "title": "RequestWebSearchToolResultError", - "type": "object" - }, - "ResponseCharLocationCitation": { - "properties": { - "cited_text": { "title": "Cited Text", "type": "string" }, - "document_index": { "minimum": 0, "title": "Document Index", "type": "integer" }, - "document_title": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Document Title" - }, - "end_char_index": { "title": "End Char Index", "type": "integer" }, - "file_id": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "default": null, - "title": "File Id" - }, - "start_char_index": { "minimum": 0, "title": "Start Char Index", "type": "integer" }, - "type": { - "const": "char_location", - "default": "char_location", - "enum": ["char_location"], - "title": "Type", - "type": "string" - } - }, - "required": [ - "cited_text", - "document_index", - "document_title", - "end_char_index", - "file_id", - "start_char_index", - "type" - ], - "title": "ResponseCharLocationCitation", - "type": "object" - }, - "ResponseContentBlockLocationCitation": { - "properties": { - "cited_text": { "title": "Cited Text", "type": "string" }, - "document_index": { "minimum": 0, "title": "Document Index", "type": "integer" }, - "document_title": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Document Title" - }, - "end_block_index": { "title": "End Block Index", "type": "integer" }, - "file_id": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "default": null, - "title": "File Id" - }, - "start_block_index": { "minimum": 0, "title": "Start Block Index", "type": "integer" }, - "type": { - "const": "content_block_location", - "default": "content_block_location", - "enum": ["content_block_location"], - "title": "Type", - "type": "string" - } - }, - "required": [ - "cited_text", - "document_index", - "document_title", - "end_block_index", - "file_id", - "start_block_index", - "type" - ], - "title": "ResponseContentBlockLocationCitation", - "type": "object" - }, - "ResponsePageLocationCitation": { - "properties": { - "cited_text": { "title": "Cited Text", "type": "string" }, - "document_index": { "minimum": 0, "title": "Document Index", "type": "integer" }, - "document_title": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "title": "Document Title" - }, - "end_page_number": { "title": "End Page Number", "type": "integer" }, - "file_id": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "default": null, - "title": "File Id" - }, - "start_page_number": { "minimum": 1, "title": "Start Page Number", "type": "integer" }, - "type": { - "const": "page_location", - "default": "page_location", - "enum": ["page_location"], - "title": "Type", - "type": "string" - } - }, - "required": [ - "cited_text", - "document_index", - "document_title", - "end_page_number", - "file_id", - "start_page_number", - "type" - ], - "title": "ResponsePageLocationCitation", - "type": "object" - }, - "ResponseRedactedThinkingBlock": { - "properties": { - "data": { "title": "Data", "type": "string" }, - "type": { - "const": "redacted_thinking", - "default": "redacted_thinking", - "enum": ["redacted_thinking"], - "title": "Type", - "type": "string" - } - }, - "required": ["data", "type"], - "title": "ResponseRedactedThinkingBlock", - "type": "object" - }, - "ResponseSearchResultLocationCitation": { - "properties": { - "cited_text": { "title": "Cited Text", "type": "string" }, - "end_block_index": { "title": "End Block Index", "type": "integer" }, - "search_result_index": { "minimum": 0, "title": "Search Result Index", "type": "integer" }, - "source": { "title": "Source", "type": "string" }, - "start_block_index": { "minimum": 0, "title": "Start Block Index", "type": "integer" }, - "title": { "anyOf": [{ "type": "string" }, { "type": "null" }], "title": "Title" }, - "type": { - "const": "search_result_location", - "default": "search_result_location", - "enum": ["search_result_location"], - "title": "Type", - "type": "string" - } - }, - "required": [ - "cited_text", - "end_block_index", - "search_result_index", - "source", - "start_block_index", - "title", - "type" - ], - "title": "ResponseSearchResultLocationCitation", - "type": "object" - }, - "ResponseServerToolUseBlock": { - "properties": { - "id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Id", "type": "string" }, - "input": { "title": "Input", "type": "object" }, - "name": { "const": "web_search", "enum": ["web_search"], "title": "Name", "type": "string" }, - "type": { - "const": "server_tool_use", - "default": "server_tool_use", - "enum": ["server_tool_use"], - "title": "Type", - "type": "string" - } - }, - "required": ["id", "input", "name", "type"], - "title": "ResponseServerToolUseBlock", - "type": "object" - }, - "ResponseTextBlock": { - "properties": { - "citations": { - "anyOf": [ - { - "items": { - "discriminator": { - "mapping": { - "char_location": "#/components/schemas/ResponseCharLocationCitation", - "content_block_location": "#/components/schemas/ResponseContentBlockLocationCitation", - "page_location": "#/components/schemas/ResponsePageLocationCitation", - "search_result_location": "#/components/schemas/ResponseSearchResultLocationCitation", - "web_search_result_location": "#/components/schemas/ResponseWebSearchResultLocationCitation" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/ResponseCharLocationCitation" }, - { "$ref": "#/components/schemas/ResponsePageLocationCitation" }, - { "$ref": "#/components/schemas/ResponseContentBlockLocationCitation" }, - { "$ref": "#/components/schemas/ResponseWebSearchResultLocationCitation" }, - { "$ref": "#/components/schemas/ResponseSearchResultLocationCitation" } - ] - }, - "type": "array" - }, - { "type": "null" } - ], - "default": null, - "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`.", - "title": "Citations" - }, - "text": { "maxLength": 5000000, "minLength": 0, "title": "Text", "type": "string" }, - "type": { "const": "text", "default": "text", "enum": ["text"], "title": "Type", "type": "string" } - }, - "required": ["citations", "text", "type"], - "title": "ResponseTextBlock", - "type": "object" - }, - "ResponseThinkingBlock": { - "properties": { - "signature": { "title": "Signature", "type": "string" }, - "thinking": { "title": "Thinking", "type": "string" }, - "type": { - "const": "thinking", - "default": "thinking", - "enum": ["thinking"], - "title": "Type", - "type": "string" - } - }, - "required": ["signature", "thinking", "type"], - "title": "ResponseThinkingBlock", - "type": "object" - }, - "ResponseToolUseBlock": { - "properties": { - "id": { "pattern": "^[a-zA-Z0-9_-]+$", "title": "Id", "type": "string" }, - "input": { "title": "Input", "type": "object" }, - "name": { "minLength": 1, "title": "Name", "type": "string" }, - "type": { - "const": "tool_use", - "default": "tool_use", - "enum": ["tool_use"], - "title": "Type", - "type": "string" - } - }, - "required": ["id", "input", "name", "type"], - "title": "ResponseToolUseBlock", - "type": "object" - }, - "ResponseWebSearchResultBlock": { - "properties": { - "encrypted_content": { "title": "Encrypted Content", "type": "string" }, - "page_age": { - "anyOf": [{ "type": "string" }, { "type": "null" }], - "default": null, - "title": "Page Age" - }, - "title": { "title": "Title", "type": "string" }, - "type": { - "const": "web_search_result", - "default": "web_search_result", - "enum": ["web_search_result"], - "title": "Type", - "type": "string" - }, - "url": { "title": "Url", "type": "string" } - }, - "required": ["encrypted_content", "page_age", "title", "type", "url"], - "title": "ResponseWebSearchResultBlock", - "type": "object" - }, - "ResponseWebSearchResultLocationCitation": { - "properties": { - "cited_text": { "title": "Cited Text", "type": "string" }, - "encrypted_index": { "title": "Encrypted Index", "type": "string" }, - "title": { - "anyOf": [{ "maxLength": 512, "type": "string" }, { "type": "null" }], - "title": "Title" - }, - "type": { - "const": "web_search_result_location", - "default": "web_search_result_location", - "enum": ["web_search_result_location"], - "title": "Type", - "type": "string" - }, - "url": { "title": "Url", "type": "string" } - }, - "required": ["cited_text", "encrypted_index", "title", "type", "url"], - "title": "ResponseWebSearchResultLocationCitation", - "type": "object" - }, - "ResponseWebSearchToolResultBlock": { - "properties": { - "content": { - "anyOf": [ - { "$ref": "#/components/schemas/ResponseWebSearchToolResultError" }, - { "items": { "$ref": "#/components/schemas/ResponseWebSearchResultBlock" }, "type": "array" } - ], - "title": "Content" - }, - "tool_use_id": { "pattern": "^srvtoolu_[a-zA-Z0-9_]+$", "title": "Tool Use Id", "type": "string" }, - "type": { - "const": "web_search_tool_result", - "default": "web_search_tool_result", - "enum": ["web_search_tool_result"], - "title": "Type", - "type": "string" - } - }, - "required": ["content", "tool_use_id", "type"], - "title": "ResponseWebSearchToolResultBlock", - "type": "object" - }, - "ResponseWebSearchToolResultError": { - "properties": { - "error_code": { "$ref": "#/components/schemas/WebSearchToolResultErrorCode" }, - "type": { - "const": "web_search_tool_result_error", - "default": "web_search_tool_result_error", - "enum": ["web_search_tool_result_error"], - "title": "Type", - "type": "string" - } - }, - "required": ["error_code", "type"], - "title": "ResponseWebSearchToolResultError", - "type": "object" - }, - "ServerToolUsage": { - "properties": { - "web_search_requests": { - "default": 0, - "description": "The number of web search tool requests.", - "examples": [0], - "minimum": 0, - "title": "Web Search Requests", - "type": "integer" - } - }, - "required": ["web_search_requests"], - "title": "ServerToolUsage", - "type": "object" - }, - "SignatureContentBlockDelta": { - "properties": { - "signature": { "title": "Signature", "type": "string" }, - "type": { - "const": "signature_delta", - "default": "signature_delta", - "enum": ["signature_delta"], - "title": "Type", - "type": "string" - } - }, - "required": ["signature", "type"], - "title": "SignatureContentBlockDelta", - "type": "object" - }, - "SucceededResult": { - "properties": { - "message": { "$ref": "#/components/schemas/Message" }, - "type": { - "const": "succeeded", - "default": "succeeded", - "enum": ["succeeded"], - "title": "Type", - "type": "string" - } - }, - "required": ["message", "type"], - "title": "SucceededResult", - "type": "object" - }, - "TextContentBlockDelta": { - "properties": { - "text": { "title": "Text", "type": "string" }, - "type": { - "const": "text_delta", - "default": "text_delta", - "enum": ["text_delta"], - "title": "Type", - "type": "string" - } - }, - "required": ["text", "type"], - "title": "TextContentBlockDelta", - "type": "object" - }, - "TextEditor_20250124": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/CacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/CacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "name": { - "const": "str_replace_editor", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks.", - "enum": ["str_replace_editor"], - "title": "Name", - "type": "string" - }, - "type": { - "const": "text_editor_20250124", - "enum": ["text_editor_20250124"], - "title": "Type", - "type": "string" - } - }, - "required": ["name", "type"], - "title": "TextEditor_20250124", - "type": "object" - }, - "TextEditor_20250429": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/CacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/CacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "name": { - "const": "str_replace_based_edit_tool", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks.", - "enum": ["str_replace_based_edit_tool"], - "title": "Name", - "type": "string" - }, - "type": { - "const": "text_editor_20250429", - "enum": ["text_editor_20250429"], - "title": "Type", - "type": "string" - } - }, - "required": ["name", "type"], - "title": "TextEditor_20250429", - "type": "object" - }, - "TextEditor_20250728": { - "additionalProperties": false, - "properties": { - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/CacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/CacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "max_characters": { - "anyOf": [{ "minimum": 1, "type": "integer" }, { "type": "null" }], - "description": "Maximum number of characters to display when viewing a file. If not specified, defaults to displaying the full file.", - "title": "Max Characters" - }, - "name": { - "const": "str_replace_based_edit_tool", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks.", - "enum": ["str_replace_based_edit_tool"], - "title": "Name", - "type": "string" - }, - "type": { - "const": "text_editor_20250728", - "enum": ["text_editor_20250728"], - "title": "Type", - "type": "string" - } - }, - "required": ["name", "type"], - "title": "TextEditor_20250728", - "type": "object" - }, - "ThinkingConfigDisabled": { - "additionalProperties": false, - "properties": { - "type": { "const": "disabled", "enum": ["disabled"], "title": "Type", "type": "string" } - }, - "required": ["type"], - "title": "ThinkingConfigDisabled", - "type": "object", - "x-stainless-go-constant-constructor": true - }, - "ThinkingConfigEnabled": { - "additionalProperties": false, - "properties": { - "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.anthropic.com/en/docs/build-with-claude/extended-thinking) for details.", - "minimum": 1024, - "title": "Budget Tokens", - "type": "integer" - }, - "type": { "const": "enabled", "enum": ["enabled"], "title": "Type", "type": "string" } - }, - "required": ["budget_tokens", "type"], - "title": "ThinkingConfigEnabled", - "type": "object" - }, - "ThinkingContentBlockDelta": { - "properties": { - "thinking": { "title": "Thinking", "type": "string" }, - "type": { - "const": "thinking_delta", - "default": "thinking_delta", - "enum": ["thinking_delta"], - "title": "Type", - "type": "string" - } - }, - "required": ["thinking", "type"], - "title": "ThinkingContentBlockDelta", - "type": "object" - }, - "Tool": { - "additionalProperties": false, - "properties": { - "type": { - "anyOf": [{ "type": "null" }, { "const": "custom", "enum": ["custom"], "type": "string" }], - "title": "Type" - }, - "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.", - "examples": ["Get the current weather in a given location"], - "title": "Description", - "type": "string" - }, - "name": { - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks.", - "maxLength": 128, - "minLength": 1, - "pattern": "^[a-zA-Z0-9_-]{1,128}$", - "title": "Name", - "type": "string" - }, - "input_schema": { - "$ref": "#/components/schemas/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.", - "examples": [ + ] + + ``` + + + And 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: + + + ```json + + [ { - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string" - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string" - } - }, - "required": ["location"], - "type": "object" + "type": "tool_use", + "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "name": "get_stock_price", + "input": { "ticker": "^GSPC" } } - ], - "x-stainless-skip": ["cli"] - }, - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/CacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/CacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - } - }, - "required": ["name", "input_schema"], - "title": "Tool", - "type": "object" - }, - "ToolChoiceAny": { - "additionalProperties": false, - "description": "The model will use any available tools.", - "properties": { - "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.", - "title": "Disable Parallel Tool Use", - "type": "boolean" - }, - "type": { "const": "any", "enum": ["any"], "title": "Type", "type": "string" } - }, - "required": ["type"], - "title": "ToolChoiceAny", - "type": "object" - }, - "ToolChoiceAuto": { - "additionalProperties": false, - "description": "The model will automatically decide whether to use tools.", - "properties": { - "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.", - "title": "Disable Parallel Tool Use", - "type": "boolean" - }, - "type": { "const": "auto", "enum": ["auto"], "title": "Type", "type": "string" } - }, - "required": ["type"], - "title": "ToolChoiceAuto", - "type": "object" - }, - "ToolChoiceNone": { - "additionalProperties": false, - "description": "The model will not be allowed to use tools.", - "properties": { "type": { "const": "none", "enum": ["none"], "title": "Type", "type": "string" } }, - "required": ["type"], - "title": "ToolChoiceNone", - "type": "object", - "x-stainless-go-constant-constructor": true - }, - "ToolChoiceTool": { - "additionalProperties": false, - "description": "The model will use the specified tool with `tool_choice.name`.", - "properties": { - "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.", - "title": "Disable Parallel Tool Use", - "type": "boolean" - }, - "name": { "description": "The name of the tool to use.", "title": "Name", "type": "string" }, - "type": { "const": "tool", "enum": ["tool"], "title": "Type", "type": "string" } - }, - "required": ["name", "type"], - "title": "ToolChoiceTool", - "type": "object" - }, - "URLImageSource": { - "additionalProperties": false, - "properties": { - "type": { "const": "url", "enum": ["url"], "title": "Type", "type": "string" }, - "url": { "title": "Url", "type": "string" } - }, - "required": ["type", "url"], - "title": "URLImageSource", - "type": "object" - }, - "URLPDFSource": { - "additionalProperties": false, - "properties": { - "type": { "const": "url", "enum": ["url"], "title": "Type", "type": "string" }, - "url": { "title": "Url", "type": "string" } - }, - "required": ["type", "url"], - "title": "URLPDFSource", - "type": "object" - }, - "Usage": { - "properties": { - "cache_creation": { - "anyOf": [{ "$ref": "#/components/schemas/CacheCreation" }, { "type": "null" }], - "default": null, - "description": "Breakdown of cached tokens by TTL" - }, - "cache_creation_input_tokens": { - "anyOf": [{ "minimum": 0, "type": "integer" }, { "type": "null" }], - "default": null, - "description": "The number of input tokens used to create the cache entry.", - "examples": [2051], - "title": "Cache Creation Input Tokens" - }, - "cache_read_input_tokens": { - "anyOf": [{ "minimum": 0, "type": "integer" }, { "type": "null" }], - "default": null, - "description": "The number of input tokens read from the cache.", - "examples": [2051], - "title": "Cache Read Input Tokens" - }, - "input_tokens": { - "description": "The number of input tokens which were used.", - "examples": [2095], - "minimum": 0, - "title": "Input Tokens", - "type": "integer" - }, - "output_tokens": { - "description": "The number of output tokens which were used.", - "examples": [503], - "minimum": 0, - "title": "Output Tokens", - "type": "integer" - }, - "server_tool_use": { - "anyOf": [{ "$ref": "#/components/schemas/ServerToolUsage" }, { "type": "null" }], - "default": null, - "description": "The number of server tool requests." - }, - "service_tier": { - "anyOf": [{ "enum": ["standard", "priority", "batch"], "type": "string" }, { "type": "null" }], - "default": null, - "description": "If the request used the priority, standard, or batch tier.", - "title": "Service Tier" - } - }, - "required": [ - "cache_creation", - "cache_creation_input_tokens", - "cache_read_input_tokens", - "input_tokens", - "output_tokens", - "server_tool_use", - "service_tier" - ], - "title": "Usage", - "type": "object" - }, - "UserLocation": { - "additionalProperties": false, - "properties": { - "city": { - "anyOf": [{ "maxLength": 255, "minLength": 1, "type": "string" }, { "type": "null" }], - "description": "The city of the user.", - "examples": ["New York", "Tokyo", "Los Angeles"], - "title": "City" - }, - "country": { - "anyOf": [{ "maxLength": 2, "minLength": 2, "type": "string" }, { "type": "null" }], - "description": "The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the user.", - "examples": ["US", "JP", "GB"], - "title": "Country" - }, - "region": { - "anyOf": [{ "maxLength": 255, "minLength": 1, "type": "string" }, { "type": "null" }], - "description": "The region of the user.", - "examples": ["California", "Ontario", "Wales"], - "title": "Region" - }, - "timezone": { - "anyOf": [{ "maxLength": 255, "minLength": 1, "type": "string" }, { "type": "null" }], - "description": "The [IANA timezone](https://nodatime.org/TimeZones) of the user.", - "examples": ["America/New_York", "Asia/Tokyo", "Europe/London"], - "title": "Timezone" - }, - "type": { "const": "approximate", "enum": ["approximate"], "title": "Type", "type": "string" } - }, - "required": ["type"], - "title": "UserLocation", - "type": "object" - }, - "WebSearchToolResultErrorCode": { - "enum": [ - "invalid_tool_input", - "unavailable", - "max_uses_exceeded", - "too_many_requests", - "query_too_long" - ], - "title": "WebSearchToolResultErrorCode", - "type": "string" - }, - "WebSearchTool_20250305": { - "additionalProperties": false, - "properties": { - "allowed_domains": { - "anyOf": [{ "items": { "type": "string" }, "type": "array" }, { "type": "null" }], - "description": "If provided, only these domains will be included in results. Cannot be used alongside `blocked_domains`.", - "title": "Allowed Domains" - }, - "blocked_domains": { - "anyOf": [{ "items": { "type": "string" }, "type": "array" }, { "type": "null" }], - "description": "If provided, these domains will never appear in results. Cannot be used alongside `allowed_domains`.", - "title": "Blocked Domains" - }, - "cache_control": { - "anyOf": [ - { - "discriminator": { - "mapping": { "ephemeral": "#/components/schemas/CacheControlEphemeral" }, - "propertyName": "type" - }, - "oneOf": [{ "$ref": "#/components/schemas/CacheControlEphemeral" }] - }, - { "type": "null" } - ], - "description": "Create a cache control breakpoint at this content block.", - "title": "Cache Control" - }, - "max_uses": { - "anyOf": [{ "exclusiveMinimum": 0, "type": "integer" }, { "type": "null" }], - "description": "Maximum number of times the tool can be used in the API request.", - "title": "Max Uses" - }, - "name": { - "const": "web_search", - "description": "Name of the tool.\n\nThis is how the tool will be called by the model and in `tool_use` blocks.", - "enum": ["web_search"], - "title": "Name", - "type": "string" - }, - "type": { - "const": "web_search_20250305", - "enum": ["web_search_20250305"], - "title": "Type", - "type": "string" - }, - "user_location": { - "anyOf": [{ "$ref": "#/components/schemas/UserLocation" }, { "type": "null" }], - "description": "Parameters for the user's location. Used to provide more relevant search results." - } - }, - "required": ["name", "type"], - "title": "WebSearchTool_20250305", - "type": "object" - }, - "CreateMessageParamsWithoutStream": { - "additionalProperties": false, - "example": { - "max_tokens": 1024, - "messages": [{ "content": "Hello, world", "role": "user" }], - "model": "claude-sonnet-4-20250514" - }, - "properties": { - "model": { "$ref": "#/components/schemas/Model" }, - "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.anthropic.com/en/api/messages-examples).\n\nNote that if you want to include a [system prompt](https://docs.anthropic.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.", - "items": { "$ref": "#/components/schemas/InputMessage" }, - "title": "Messages", - "type": "array" - }, - "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.anthropic.com/en/docs/models-overview) for details.", - "examples": [1024], - "minimum": 1, - "title": "Max Tokens", - "type": "integer" - }, - "metadata": { - "$ref": "#/components/schemas/Metadata", - "description": "An object describing metadata about the request." - }, - "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.anthropic.com/en/api/service-tiers) for details.", - "enum": ["auto", "standard_only"], - "title": "Service Tier", - "type": "string" - }, - "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.", - "items": { "type": "string" }, - "title": "Stop Sequences", - "type": "array" - }, - "system": { - "anyOf": [ - { "type": "string" }, - { "items": { "$ref": "#/components/schemas/RequestTextBlock" }, "type": "array" } - ], - "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.anthropic.com/en/docs/system-prompts).", - "examples": [ - [{ "text": "Today's date is 2024-06-01.", "type": "text" }], - "Today's date is 2023-01-01." - ], - "title": "System" - }, - "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.", - "examples": [1], - "maximum": 1, - "minimum": 0, - "title": "Temperature", - "type": "number" - }, - "thinking": { "$ref": "#/components/schemas/ThinkingConfigParam" }, - "tool_choice": { "$ref": "#/components/schemas/ToolChoice" }, - "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.anthropic.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.anthropic.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.anthropic.com/en/docs/tool-use) for more details.", - "examples": [ + ] + + ``` + + + You 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: + + + ```json + + [ { - "description": "Get the current weather in a given location", - "input_schema": { - "properties": { - "location": { - "description": "The city and state, e.g. San Francisco, CA", - "type": "string" - }, - "unit": { - "description": "Unit for the output - one of (celsius, fahrenheit)", - "type": "string" - } - }, - "required": ["location"], - "type": "object" - }, - "name": "get_weather" + "type": "tool_result", + "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", + "content": "259.75 USD" } - ], - "items": { - "oneOf": [ - { "$ref": "#/components/schemas/Tool" }, - { "$ref": "#/components/schemas/BashTool_20250124" }, - { "$ref": "#/components/schemas/TextEditor_20250124" }, - { "$ref": "#/components/schemas/TextEditor_20250429" }, - { "$ref": "#/components/schemas/TextEditor_20250728" }, - { "$ref": "#/components/schemas/WebSearchTool_20250305" } - ] - }, - "title": "Tools", - "type": "array" - }, - "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`.", - "examples": [5], - "minimum": 0, - "title": "Top K", - "type": "integer" - }, - "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`.", - "examples": [0.7], - "maximum": 1, - "minimum": 0, - "title": "Top P", - "type": "number" - } - }, - "required": ["model", "messages", "max_tokens"], - "title": "CreateMessageParams", - "type": "object" - }, - "AnthropicBeta": { - "anyOf": [ - { "type": "string" }, - { - "type": "string", - "enum": [ - "message-batches-2024-09-24", - "prompt-caching-2024-07-31", - "computer-use-2024-10-22", - "computer-use-2025-01-24", - "pdfs-2024-09-25", - "token-counting-2024-11-01", - "token-efficient-tools-2025-02-19", - "output-128k-2025-02-19", - "files-api-2025-04-14", - "mcp-client-2025-04-04", - "dev-full-thinking-2025-05-14", - "interleaved-thinking-2025-05-14", - "code-execution-2025-05-22", - "extended-cache-ttl-2025-04-11", - "context-1m-2025-08-07" - ], - "x-stainless-nominal": false - } - ] - }, - "ThinkingConfigParam": { - "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.anthropic.com/en/docs/build-with-claude/extended-thinking) for details.", - "discriminator": { - "mapping": { - "disabled": "#/components/schemas/ThinkingConfigDisabled", - "enabled": "#/components/schemas/ThinkingConfigEnabled" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/ThinkingConfigEnabled" }, - { "$ref": "#/components/schemas/ThinkingConfigDisabled" } - ], - "title": "Thinking" - }, - "BetaThinkingConfigParam": { - "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.anthropic.com/en/docs/build-with-claude/extended-thinking) for details.", - "discriminator": { - "mapping": { - "disabled": "#/components/schemas/BetaThinkingConfigDisabled", - "enabled": "#/components/schemas/BetaThinkingConfigEnabled" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/BetaThinkingConfigEnabled" }, - { "$ref": "#/components/schemas/BetaThinkingConfigDisabled" } - ], - "title": "Thinking" - }, - "ToolChoice": { - "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.", - "discriminator": { - "mapping": { - "any": "#/components/schemas/ToolChoiceAny", - "auto": "#/components/schemas/ToolChoiceAuto", - "none": "#/components/schemas/ToolChoiceNone", - "tool": "#/components/schemas/ToolChoiceTool" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/ToolChoiceAuto" }, - { "$ref": "#/components/schemas/ToolChoiceAny" }, - { "$ref": "#/components/schemas/ToolChoiceTool" }, - { "$ref": "#/components/schemas/ToolChoiceNone" } - ], - "title": "Tool Choice" - }, - "BetaToolChoice": { - "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.", - "discriminator": { - "mapping": { - "any": "#/components/schemas/BetaToolChoiceAny", - "auto": "#/components/schemas/BetaToolChoiceAuto", - "none": "#/components/schemas/BetaToolChoiceNone", - "tool": "#/components/schemas/BetaToolChoiceTool" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/BetaToolChoiceAuto" }, - { "$ref": "#/components/schemas/BetaToolChoiceAny" }, - { "$ref": "#/components/schemas/BetaToolChoiceTool" }, - { "$ref": "#/components/schemas/BetaToolChoiceNone" } - ], - "title": "Tool Choice" - }, - "ContentBlock": { - "discriminator": { - "mapping": { - "redacted_thinking": "#/components/schemas/ResponseRedactedThinkingBlock", - "server_tool_use": "#/components/schemas/ResponseServerToolUseBlock", - "text": "#/components/schemas/ResponseTextBlock", - "thinking": "#/components/schemas/ResponseThinkingBlock", - "tool_use": "#/components/schemas/ResponseToolUseBlock", - "web_search_tool_result": "#/components/schemas/ResponseWebSearchToolResultBlock" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/ResponseTextBlock" }, - { "$ref": "#/components/schemas/ResponseThinkingBlock" }, - { "$ref": "#/components/schemas/ResponseRedactedThinkingBlock" }, - { "$ref": "#/components/schemas/ResponseToolUseBlock" }, - { "$ref": "#/components/schemas/ResponseServerToolUseBlock" }, - { "$ref": "#/components/schemas/ResponseWebSearchToolResultBlock" } - ] - }, - "InputContentBlock": { - "discriminator": { - "mapping": { - "document": "#/components/schemas/RequestDocumentBlock", - "image": "#/components/schemas/RequestImageBlock", - "redacted_thinking": "#/components/schemas/RequestRedactedThinkingBlock", - "search_result": "#/components/schemas/RequestSearchResultBlock", - "server_tool_use": "#/components/schemas/RequestServerToolUseBlock", - "text": "#/components/schemas/RequestTextBlock", - "thinking": "#/components/schemas/RequestThinkingBlock", - "tool_result": "#/components/schemas/RequestToolResultBlock", - "tool_use": "#/components/schemas/RequestToolUseBlock", - "web_search_tool_result": "#/components/schemas/RequestWebSearchToolResultBlock" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/RequestTextBlock", "description": "Regular text content." }, - { - "$ref": "#/components/schemas/RequestImageBlock", - "description": "Image content specified directly as base64 data or as a reference via a URL." - }, - { - "$ref": "#/components/schemas/RequestDocumentBlock", - "description": "Document content, either specified directly as base64 data, as text, or as a reference via a URL." - }, - { - "$ref": "#/components/schemas/RequestSearchResultBlock", - "description": "A search result block containing source, title, and content from search operations." - }, - { - "$ref": "#/components/schemas/RequestThinkingBlock", - "description": "A block specifying internal thinking by the model." - }, - { - "$ref": "#/components/schemas/RequestRedactedThinkingBlock", - "description": "A block specifying internal, redacted thinking by the model." - }, - { - "$ref": "#/components/schemas/RequestToolUseBlock", - "description": "A block indicating a tool use by the model." - }, - { - "$ref": "#/components/schemas/RequestToolResultBlock", - "description": "A block specifying the results of a tool use by the model." - }, - { "$ref": "#/components/schemas/RequestServerToolUseBlock" }, - { "$ref": "#/components/schemas/RequestWebSearchToolResultBlock" } - ], - "x-stainless-python-extend-union": ["ContentBlock"], - "x-stainless-python-extend-union-imports": ["from .content_block import ContentBlock"], - "x-stainless-go-variant-constructor": { "naming": "new_{variant}_block" } - }, - "BetaContentBlock": { - "discriminator": { - "mapping": { - "bash_code_execution_tool_result": "#/components/schemas/BetaResponseBashCodeExecutionToolResultBlock", - "code_execution_tool_result": "#/components/schemas/BetaResponseCodeExecutionToolResultBlock", - "container_upload": "#/components/schemas/BetaResponseContainerUploadBlock", - "mcp_tool_result": "#/components/schemas/BetaResponseMCPToolResultBlock", - "mcp_tool_use": "#/components/schemas/BetaResponseMCPToolUseBlock", - "redacted_thinking": "#/components/schemas/BetaResponseRedactedThinkingBlock", - "server_tool_use": "#/components/schemas/BetaResponseServerToolUseBlock", - "text": "#/components/schemas/BetaResponseTextBlock", - "text_editor_code_execution_tool_result": "#/components/schemas/BetaResponseTextEditorCodeExecutionToolResultBlock", - "thinking": "#/components/schemas/BetaResponseThinkingBlock", - "tool_use": "#/components/schemas/BetaResponseToolUseBlock", - "web_fetch_tool_result": "#/components/schemas/BetaResponseWebFetchToolResultBlock", - "web_search_tool_result": "#/components/schemas/BetaResponseWebSearchToolResultBlock" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/BetaResponseTextBlock" }, - { "$ref": "#/components/schemas/BetaResponseThinkingBlock" }, - { "$ref": "#/components/schemas/BetaResponseRedactedThinkingBlock" }, - { "$ref": "#/components/schemas/BetaResponseToolUseBlock" }, - { "$ref": "#/components/schemas/BetaResponseServerToolUseBlock" }, - { "$ref": "#/components/schemas/BetaResponseWebSearchToolResultBlock" }, - { "$ref": "#/components/schemas/BetaResponseWebFetchToolResultBlock" }, - { "$ref": "#/components/schemas/BetaResponseCodeExecutionToolResultBlock" }, - { "$ref": "#/components/schemas/BetaResponseBashCodeExecutionToolResultBlock" }, - { "$ref": "#/components/schemas/BetaResponseTextEditorCodeExecutionToolResultBlock" }, - { "$ref": "#/components/schemas/BetaResponseMCPToolUseBlock" }, - { "$ref": "#/components/schemas/BetaResponseMCPToolResultBlock" }, - { "$ref": "#/components/schemas/BetaResponseContainerUploadBlock" } - ] - }, - "BetaInputContentBlock": { - "discriminator": { - "mapping": { - "bash_code_execution_tool_result": "#/components/schemas/BetaRequestBashCodeExecutionToolResultBlock", - "code_execution_tool_result": "#/components/schemas/BetaRequestCodeExecutionToolResultBlock", - "container_upload": "#/components/schemas/BetaRequestContainerUploadBlock", - "document": "#/components/schemas/BetaRequestDocumentBlock", - "image": "#/components/schemas/BetaRequestImageBlock", - "mcp_tool_result": "#/components/schemas/BetaRequestMCPToolResultBlock", - "mcp_tool_use": "#/components/schemas/BetaRequestMCPToolUseBlock", - "redacted_thinking": "#/components/schemas/BetaRequestRedactedThinkingBlock", - "search_result": "#/components/schemas/BetaRequestSearchResultBlock", - "server_tool_use": "#/components/schemas/BetaRequestServerToolUseBlock", - "text": "#/components/schemas/BetaRequestTextBlock", - "text_editor_code_execution_tool_result": "#/components/schemas/BetaRequestTextEditorCodeExecutionToolResultBlock", - "thinking": "#/components/schemas/BetaRequestThinkingBlock", - "tool_result": "#/components/schemas/BetaRequestToolResultBlock", - "tool_use": "#/components/schemas/BetaRequestToolUseBlock", - "web_fetch_tool_result": "#/components/schemas/BetaRequestWebFetchToolResultBlock", - "web_search_tool_result": "#/components/schemas/BetaRequestWebSearchToolResultBlock" - }, - "propertyName": "type" - }, - "oneOf": [ - { "$ref": "#/components/schemas/BetaRequestTextBlock", "description": "Regular text content." }, - { - "$ref": "#/components/schemas/BetaRequestImageBlock", - "description": "Image content specified directly as base64 data or as a reference via a URL." - }, - { - "$ref": "#/components/schemas/BetaRequestDocumentBlock", - "description": "Document content, either specified directly as base64 data, as text, or as a reference via a URL." - }, - { - "$ref": "#/components/schemas/BetaRequestSearchResultBlock", - "description": "A search result block containing source, title, and content from search operations." - }, - { - "$ref": "#/components/schemas/BetaRequestThinkingBlock", - "description": "A block specifying internal thinking by the model." - }, - { - "$ref": "#/components/schemas/BetaRequestRedactedThinkingBlock", - "description": "A block specifying internal, redacted thinking by the model." - }, - { - "$ref": "#/components/schemas/BetaRequestToolUseBlock", - "description": "A block indicating a tool use by the model." - }, - { - "$ref": "#/components/schemas/BetaRequestToolResultBlock", - "description": "A block specifying the results of a tool use by the model." - }, - { "$ref": "#/components/schemas/BetaRequestServerToolUseBlock" }, - { "$ref": "#/components/schemas/BetaRequestWebSearchToolResultBlock" }, - { "$ref": "#/components/schemas/BetaRequestWebFetchToolResultBlock" }, - { "$ref": "#/components/schemas/BetaRequestCodeExecutionToolResultBlock" }, - { "$ref": "#/components/schemas/BetaRequestBashCodeExecutionToolResultBlock" }, - { "$ref": "#/components/schemas/BetaRequestTextEditorCodeExecutionToolResultBlock" }, - { "$ref": "#/components/schemas/BetaRequestMCPToolUseBlock" }, - { "$ref": "#/components/schemas/BetaRequestMCPToolResultBlock" }, - { "$ref": "#/components/schemas/BetaRequestContainerUploadBlock" } - ], - "x-stainless-go-variant-constructor": { "naming": "new_beta_{variant}_block" } - }, - "StopReason": { - "enum": [ - "end_turn", - "max_tokens", - "stop_sequence", - "tool_use", - "pause_turn", - "refusal", - "model_context_window_exceeded" - ], - "type": "string" - }, - "BetaStopReason": { - "enum": [ - "end_turn", - "max_tokens", - "stop_sequence", - "tool_use", - "pause_turn", - "refusal", - "model_context_window_exceeded" - ], - "type": "string" - }, - "Model": { - "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.", - "anyOf": [ - { "type": "string" }, - { - "const": "claude-3-7-sonnet-latest", - "description": "High-performance model with early extended thinking", - "x-stainless-nominal": false - }, - { - "const": "claude-3-7-sonnet-20250219", - "description": "High-performance model with early extended thinking", - "x-stainless-nominal": false - }, - { - "const": "claude-3-5-haiku-latest", - "description": "Fastest and most compact model for near-instant responsiveness", - "x-stainless-nominal": false - }, - { - "const": "claude-3-5-haiku-20241022", - "description": "Our fastest model", - "x-stainless-nominal": false - }, - { - "const": "claude-sonnet-4-20250514", - "description": "High-performance model with extended thinking", - "x-stainless-nominal": false - }, - { - "const": "claude-sonnet-4-0", - "description": "High-performance model with extended thinking", - "x-stainless-nominal": false - }, - { - "const": "claude-4-sonnet-20250514", - "description": "High-performance model with extended thinking", - "x-stainless-nominal": false - }, - { - "const": "claude-sonnet-4-5", - "description": "Our best model for real-world agents and coding", - "x-stainless-nominal": false - }, - { - "const": "claude-sonnet-4-5-20250929", - "description": "Our best model for real-world agents and coding", - "x-stainless-nominal": false - }, - { - "const": "claude-3-5-sonnet-latest", - "description": "Our previous most intelligent model", - "x-stainless-nominal": false - }, - { - "const": "claude-3-5-sonnet-20241022", - "description": "Our previous most intelligent model", - "x-stainless-nominal": false - }, - { "const": "claude-3-5-sonnet-20240620", "x-stainless-nominal": false }, - { "const": "claude-opus-4-0", "description": "Our most capable model" }, - { "const": "claude-opus-4-20250514", "description": "Our most capable model" }, - { - "const": "claude-4-opus-20250514", - "description": "Our most capable model", - "x-stainless-nominal": false - }, - { "const": "claude-opus-4-1-20250805", "description": "Our most capable model" }, - { - "const": "claude-3-opus-latest", - "description": "Excels at writing and complex tasks", - "deprecated": true, - "x-stainless-deprecation-message": "Will reach end-of-life on January 5th, 2026. Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.", - "x-stainless-nominal": false - }, - { - "const": "claude-3-opus-20240229", - "description": "Excels at writing and complex tasks", - "deprecated": true, - "x-stainless-deprecation-message": "Will reach end-of-life on January 5th, 2026. Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.", - "x-stainless-nominal": false - }, - { - "const": "claude-3-haiku-20240307", - "description": "Our previous most fast and cost-effective", - "x-stainless-nominal": false - } - ] - }, - "BetaMemoryTool_20250818_ViewCommand": { - "type": "object", - "required": ["command", "path"], - "properties": { - "command": { - "type": "string", - "enum": ["view"], - "const": "view", - "default": "view", - "description": "Command type identifier" - }, - "path": { - "type": "string", - "description": "Path to directory or file to view", - "example": "/memories" - }, - "view_range": { - "type": "array", - "description": "Optional line range for viewing specific lines", - "items": { "type": "integer" }, - "minItems": 2, - "maxItems": 2, - "example": [1, 10] - } - } - }, - "BetaMemoryTool_20250818_CreateCommand": { - "type": "object", - "required": ["command", "path", "file_text"], - "properties": { - "command": { - "type": "string", - "enum": ["create"], - "const": "create", - "default": "create", - "description": "Command type identifier" - }, - "path": { - "type": "string", - "description": "Path where the file should be created", - "example": "/memories/notes.txt" - }, - "file_text": { - "type": "string", - "description": "Content to write to the file", - "example": "Meeting notes:\n- Discussed project timeline\n- Next steps defined\n" - } - } - }, - "BetaMemoryTool_20250818_StrReplaceCommand": { - "type": "object", - "required": ["command", "path", "old_str", "new_str"], - "properties": { - "command": { - "type": "string", - "enum": ["str_replace"], - "const": "str_replace", - "default": "str_replace", - "description": "Command type identifier" - }, - "path": { - "type": "string", - "description": "Path to the file where text should be replaced", - "example": "/memories/preferences.txt" - }, - "old_str": { - "type": "string", - "description": "Text to search for and replace", - "example": "Favorite color: blue" - }, - "new_str": { - "type": "string", - "description": "Text to replace with", - "example": "Favorite color: green" - } - } - }, - "BetaMemoryTool_20250818_InsertCommand": { - "type": "object", - "required": ["command", "path", "insert_line", "insert_text"], - "properties": { - "command": { - "type": "string", - "enum": ["insert"], - "const": "insert", - "default": "insert", - "description": "Command type identifier" - }, - "path": { - "type": "string", - "description": "Path to the file where text should be inserted", - "example": "/memories/todo.txt" - }, - "insert_line": { - "type": "integer", - "description": "Line number where text should be inserted", - "minimum": 1, - "example": 2 - }, - "insert_text": { - "type": "string", - "description": "Text to insert at the specified line", - "example": "- Review memory tool documentation\n" - } - } - }, - "BetaMemoryTool_20250818_DeleteCommand": { - "type": "object", - "required": ["command", "path"], - "properties": { - "command": { - "type": "string", - "enum": ["delete"], - "const": "delete", - "default": "delete", - "description": "Command type identifier" - }, - "path": { - "type": "string", - "description": "Path to the file or directory to delete", - "example": "/memories/old_file.txt" - } - } - }, - "BetaMemoryTool_20250818_RenameCommand": { - "type": "object", - "required": ["command", "old_path", "new_path"], - "properties": { - "command": { - "type": "string", - "enum": ["rename"], - "const": "rename", - "default": "rename", - "description": "Command type identifier" - }, - "old_path": { - "type": "string", - "description": "Current path of the file or directory", - "example": "/memories/draft.txt" - }, - "new_path": { - "type": "string", - "description": "New path for the file or directory", - "example": "/memories/final.txt" - } - } - }, - "BetaMemoryTool_20250818_Command": { - "oneOf": [ - { "$ref": "#/components/schemas/BetaMemoryTool_20250818_ViewCommand" }, - { "$ref": "#/components/schemas/BetaMemoryTool_20250818_CreateCommand" }, - { "$ref": "#/components/schemas/BetaMemoryTool_20250818_StrReplaceCommand" }, - { "$ref": "#/components/schemas/BetaMemoryTool_20250818_InsertCommand" }, - { "$ref": "#/components/schemas/BetaMemoryTool_20250818_DeleteCommand" }, - { "$ref": "#/components/schemas/BetaMemoryTool_20250818_RenameCommand" } - ], - "discriminator": { - "propertyName": "command", - "mapping": { - "view": "#/components/schemas/BetaMemoryTool_20250818_ViewCommand", - "create": "#/components/schemas/BetaMemoryTool_20250818_CreateCommand", - "str_replace": "#/components/schemas/BetaMemoryTool_20250818_StrReplaceCommand", - "insert": "#/components/schemas/BetaMemoryTool_20250818_InsertCommand", - "delete": "#/components/schemas/BetaMemoryTool_20250818_DeleteCommand", - "rename": "#/components/schemas/BetaMemoryTool_20250818_RenameCommand" - } - } - } - } - }, - "servers": [{ "url": "https://api.anthropic.com" }] -} + ] + + ``` + + + Tools 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. + + + See our [guide](https://docs.claude.com/en/docs/tool-use) for more details. + examples: + - description: Get the current weather in a given location + input_schema: + properties: + location: + description: The city and state, e.g. San Francisco, CA + type: string + unit: + description: Unit for the output - one of (celsius, fahrenheit) + type: string + required: + - location + type: object + name: get_weather + items: + oneOf: + - $ref: '#/components/schemas/Tool' + - $ref: '#/components/schemas/BashTool_20250124' + - $ref: '#/components/schemas/TextEditor_20250124' + - $ref: '#/components/schemas/TextEditor_20250429' + - $ref: '#/components/schemas/TextEditor_20250728' + - $ref: '#/components/schemas/WebSearchTool_20250305' + title: Tools + type: array + top_k: + description: >- + Only sample from the top K options for each subsequent token. + + + Used to remove "long tail" low probability responses. [Learn more technical details + here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277). + + + Recommended for advanced use cases only. You usually only need to use `temperature`. + examples: + - 5 + minimum: 0 + title: Top K + type: integer + top_p: + description: >- + Use nucleus sampling. + + + In 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. + + + Recommended for advanced use cases only. You usually only need to use `temperature`. + examples: + - 0.7 + maximum: 1 + minimum: 0 + title: Top P + type: number + required: + - model + - messages + - max_tokens + title: CreateMessageParams + type: object + AnthropicBeta: + anyOf: + - type: string + - type: string + enum: + - message-batches-2024-09-24 + - prompt-caching-2024-07-31 + - computer-use-2024-10-22 + - computer-use-2025-01-24 + - pdfs-2024-09-25 + - token-counting-2024-11-01 + - token-efficient-tools-2025-02-19 + - output-128k-2025-02-19 + - files-api-2025-04-14 + - mcp-client-2025-04-04 + - mcp-client-2025-11-20 + - dev-full-thinking-2025-05-14 + - interleaved-thinking-2025-05-14 + - code-execution-2025-05-22 + - extended-cache-ttl-2025-04-11 + - context-1m-2025-08-07 + - context-management-2025-06-27 + - model-context-window-exceeded-2025-08-26 + - skills-2025-10-02 + x-stainless-nominal: false + ThinkingConfigParam: + description: >- + Configuration for enabling Claude's extended thinking. + + + When 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. + + + See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for + details. + discriminator: + mapping: + disabled: '#/components/schemas/ThinkingConfigDisabled' + enabled: '#/components/schemas/ThinkingConfigEnabled' + propertyName: type + oneOf: + - $ref: '#/components/schemas/ThinkingConfigEnabled' + - $ref: '#/components/schemas/ThinkingConfigDisabled' + title: Thinking + BetaThinkingConfigParam: + description: >- + Configuration for enabling Claude's extended thinking. + + + When 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. + + + See [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) for + details. + discriminator: + mapping: + disabled: '#/components/schemas/BetaThinkingConfigDisabled' + enabled: '#/components/schemas/BetaThinkingConfigEnabled' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaThinkingConfigEnabled' + - $ref: '#/components/schemas/BetaThinkingConfigDisabled' + title: Thinking + ToolChoice: + 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. + discriminator: + mapping: + any: '#/components/schemas/ToolChoiceAny' + auto: '#/components/schemas/ToolChoiceAuto' + none: '#/components/schemas/ToolChoiceNone' + tool: '#/components/schemas/ToolChoiceTool' + propertyName: type + oneOf: + - $ref: '#/components/schemas/ToolChoiceAuto' + - $ref: '#/components/schemas/ToolChoiceAny' + - $ref: '#/components/schemas/ToolChoiceTool' + - $ref: '#/components/schemas/ToolChoiceNone' + title: Tool Choice + BetaToolChoice: + 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. + discriminator: + mapping: + any: '#/components/schemas/BetaToolChoiceAny' + auto: '#/components/schemas/BetaToolChoiceAuto' + none: '#/components/schemas/BetaToolChoiceNone' + tool: '#/components/schemas/BetaToolChoiceTool' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaToolChoiceAuto' + - $ref: '#/components/schemas/BetaToolChoiceAny' + - $ref: '#/components/schemas/BetaToolChoiceTool' + - $ref: '#/components/schemas/BetaToolChoiceNone' + title: Tool Choice + ContentBlock: + discriminator: + mapping: + redacted_thinking: '#/components/schemas/ResponseRedactedThinkingBlock' + server_tool_use: '#/components/schemas/ResponseServerToolUseBlock' + text: '#/components/schemas/ResponseTextBlock' + thinking: '#/components/schemas/ResponseThinkingBlock' + tool_use: '#/components/schemas/ResponseToolUseBlock' + web_search_tool_result: '#/components/schemas/ResponseWebSearchToolResultBlock' + propertyName: type + oneOf: + - $ref: '#/components/schemas/ResponseTextBlock' + - $ref: '#/components/schemas/ResponseThinkingBlock' + - $ref: '#/components/schemas/ResponseRedactedThinkingBlock' + - $ref: '#/components/schemas/ResponseToolUseBlock' + - $ref: '#/components/schemas/ResponseServerToolUseBlock' + - $ref: '#/components/schemas/ResponseWebSearchToolResultBlock' + InputContentBlock: + discriminator: + mapping: + document: '#/components/schemas/RequestDocumentBlock' + image: '#/components/schemas/RequestImageBlock' + redacted_thinking: '#/components/schemas/RequestRedactedThinkingBlock' + search_result: '#/components/schemas/RequestSearchResultBlock' + server_tool_use: '#/components/schemas/RequestServerToolUseBlock' + text: '#/components/schemas/RequestTextBlock' + thinking: '#/components/schemas/RequestThinkingBlock' + tool_result: '#/components/schemas/RequestToolResultBlock' + tool_use: '#/components/schemas/RequestToolUseBlock' + web_search_tool_result: '#/components/schemas/RequestWebSearchToolResultBlock' + propertyName: type + oneOf: + - $ref: '#/components/schemas/RequestTextBlock' + description: Regular text content. + - $ref: '#/components/schemas/RequestImageBlock' + description: Image content specified directly as base64 data or as a reference via a URL. + - $ref: '#/components/schemas/RequestDocumentBlock' + description: Document content, either specified directly as base64 data, as text, or as a reference via a URL. + - $ref: '#/components/schemas/RequestSearchResultBlock' + description: A search result block containing source, title, and content from search operations. + - $ref: '#/components/schemas/RequestThinkingBlock' + description: A block specifying internal thinking by the model. + - $ref: '#/components/schemas/RequestRedactedThinkingBlock' + description: A block specifying internal, redacted thinking by the model. + - $ref: '#/components/schemas/RequestToolUseBlock' + description: A block indicating a tool use by the model. + - $ref: '#/components/schemas/RequestToolResultBlock' + description: A block specifying the results of a tool use by the model. + - $ref: '#/components/schemas/RequestServerToolUseBlock' + - $ref: '#/components/schemas/RequestWebSearchToolResultBlock' + x-stainless-python-extend-union: + - ContentBlock + x-stainless-python-extend-union-imports: + - from .content_block import ContentBlock + x-stainless-go-variant-constructor: + naming: new_{variant}_block + BetaContentBlock: + discriminator: + mapping: + bash_code_execution_tool_result: '#/components/schemas/BetaResponseBashCodeExecutionToolResultBlock' + code_execution_tool_result: '#/components/schemas/BetaResponseCodeExecutionToolResultBlock' + container_upload: '#/components/schemas/BetaResponseContainerUploadBlock' + mcp_tool_result: '#/components/schemas/BetaResponseMCPToolResultBlock' + mcp_tool_use: '#/components/schemas/BetaResponseMCPToolUseBlock' + redacted_thinking: '#/components/schemas/BetaResponseRedactedThinkingBlock' + server_tool_use: '#/components/schemas/BetaResponseServerToolUseBlock' + text: '#/components/schemas/BetaResponseTextBlock' + text_editor_code_execution_tool_result: '#/components/schemas/BetaResponseTextEditorCodeExecutionToolResultBlock' + thinking: '#/components/schemas/BetaResponseThinkingBlock' + tool_search_tool_result: '#/components/schemas/BetaResponseToolSearchToolResultBlock' + tool_use: '#/components/schemas/BetaResponseToolUseBlock' + web_fetch_tool_result: '#/components/schemas/BetaResponseWebFetchToolResultBlock' + web_search_tool_result: '#/components/schemas/BetaResponseWebSearchToolResultBlock' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaResponseTextBlock' + - $ref: '#/components/schemas/BetaResponseThinkingBlock' + - $ref: '#/components/schemas/BetaResponseRedactedThinkingBlock' + - $ref: '#/components/schemas/BetaResponseToolUseBlock' + - $ref: '#/components/schemas/BetaResponseServerToolUseBlock' + - $ref: '#/components/schemas/BetaResponseWebSearchToolResultBlock' + - $ref: '#/components/schemas/BetaResponseWebFetchToolResultBlock' + - $ref: '#/components/schemas/BetaResponseCodeExecutionToolResultBlock' + - $ref: '#/components/schemas/BetaResponseBashCodeExecutionToolResultBlock' + - $ref: '#/components/schemas/BetaResponseTextEditorCodeExecutionToolResultBlock' + - $ref: '#/components/schemas/BetaResponseToolSearchToolResultBlock' + - $ref: '#/components/schemas/BetaResponseMCPToolUseBlock' + - $ref: '#/components/schemas/BetaResponseMCPToolResultBlock' + - $ref: '#/components/schemas/BetaResponseContainerUploadBlock' + BetaInputContentBlock: + discriminator: + mapping: + bash_code_execution_tool_result: '#/components/schemas/BetaRequestBashCodeExecutionToolResultBlock' + code_execution_tool_result: '#/components/schemas/BetaRequestCodeExecutionToolResultBlock' + container_upload: '#/components/schemas/BetaRequestContainerUploadBlock' + document: '#/components/schemas/BetaRequestDocumentBlock' + image: '#/components/schemas/BetaRequestImageBlock' + mcp_tool_result: '#/components/schemas/BetaRequestMCPToolResultBlock' + mcp_tool_use: '#/components/schemas/BetaRequestMCPToolUseBlock' + redacted_thinking: '#/components/schemas/BetaRequestRedactedThinkingBlock' + search_result: '#/components/schemas/BetaRequestSearchResultBlock' + server_tool_use: '#/components/schemas/BetaRequestServerToolUseBlock' + text: '#/components/schemas/BetaRequestTextBlock' + text_editor_code_execution_tool_result: '#/components/schemas/BetaRequestTextEditorCodeExecutionToolResultBlock' + thinking: '#/components/schemas/BetaRequestThinkingBlock' + tool_result: '#/components/schemas/BetaRequestToolResultBlock' + tool_search_tool_result: '#/components/schemas/BetaRequestToolSearchToolResultBlock' + tool_use: '#/components/schemas/BetaRequestToolUseBlock' + web_fetch_tool_result: '#/components/schemas/BetaRequestWebFetchToolResultBlock' + web_search_tool_result: '#/components/schemas/BetaRequestWebSearchToolResultBlock' + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaRequestTextBlock' + description: Regular text content. + - $ref: '#/components/schemas/BetaRequestImageBlock' + description: Image content specified directly as base64 data or as a reference via a URL. + - $ref: '#/components/schemas/BetaRequestDocumentBlock' + description: Document content, either specified directly as base64 data, as text, or as a reference via a URL. + - $ref: '#/components/schemas/BetaRequestSearchResultBlock' + description: A search result block containing source, title, and content from search operations. + - $ref: '#/components/schemas/BetaRequestThinkingBlock' + description: A block specifying internal thinking by the model. + - $ref: '#/components/schemas/BetaRequestRedactedThinkingBlock' + description: A block specifying internal, redacted thinking by the model. + - $ref: '#/components/schemas/BetaRequestToolUseBlock' + description: A block indicating a tool use by the model. + - $ref: '#/components/schemas/BetaRequestToolResultBlock' + description: A block specifying the results of a tool use by the model. + - $ref: '#/components/schemas/BetaRequestServerToolUseBlock' + - $ref: '#/components/schemas/BetaRequestWebSearchToolResultBlock' + - $ref: '#/components/schemas/BetaRequestWebFetchToolResultBlock' + - $ref: '#/components/schemas/BetaRequestCodeExecutionToolResultBlock' + - $ref: '#/components/schemas/BetaRequestBashCodeExecutionToolResultBlock' + - $ref: '#/components/schemas/BetaRequestTextEditorCodeExecutionToolResultBlock' + - $ref: '#/components/schemas/BetaRequestToolSearchToolResultBlock' + - $ref: '#/components/schemas/BetaRequestMCPToolUseBlock' + - $ref: '#/components/schemas/BetaRequestMCPToolResultBlock' + - $ref: '#/components/schemas/BetaRequestContainerUploadBlock' + x-stainless-go-variant-constructor: + naming: new_beta_{variant}_block + StopReason: + enum: + - end_turn + - max_tokens + - stop_sequence + - tool_use + - pause_turn + - refusal + type: string + BetaStopReason: + enum: + - end_turn + - max_tokens + - stop_sequence + - tool_use + - pause_turn + - refusal + - model_context_window_exceeded + type: string + Model: + 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. + anyOf: + - type: string + - const: claude-opus-4-5-20251101 + description: Premium model combining maximum intelligence with practical performance + x-stainless-nominal: false + - const: claude-opus-4-5 + description: Premium model combining maximum intelligence with practical performance + x-stainless-nominal: false + - const: claude-3-7-sonnet-latest + description: High-performance model with early extended thinking + x-stainless-nominal: false + deprecated: true + x-stainless-deprecation-message: >- + Will reach end-of-life on February 19th, 2026. Please migrate to a newer model. Visit + https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - const: claude-3-7-sonnet-20250219 + description: High-performance model with early extended thinking + x-stainless-nominal: false + deprecated: true + x-stainless-deprecation-message: >- + Will reach end-of-life on February 19th, 2026. Please migrate to a newer model. Visit + https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - const: claude-3-5-haiku-latest + description: Fastest and most compact model for near-instant responsiveness + x-stainless-nominal: false + deprecated: true + x-stainless-deprecation-message: >- + Will reach end-of-life on February 19th, 2026. Please migrate to a newer model. Visit + https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - const: claude-3-5-haiku-20241022 + description: Our fastest model + x-stainless-nominal: false + deprecated: true + x-stainless-deprecation-message: >- + Will reach end-of-life on February 19th, 2026. Please migrate to a newer model. Visit + https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + - const: claude-haiku-4-5 + description: Hybrid model, capable of near-instant responses and extended thinking + x-stainless-nominal: false + - const: claude-haiku-4-5-20251001 + description: Hybrid model, capable of near-instant responses and extended thinking + x-stainless-nominal: false + - const: claude-sonnet-4-20250514 + description: High-performance model with extended thinking + x-stainless-nominal: false + - const: claude-sonnet-4-0 + description: High-performance model with extended thinking + x-stainless-nominal: false + - const: claude-4-sonnet-20250514 + description: High-performance model with extended thinking + x-stainless-nominal: false + - const: claude-sonnet-4-5 + description: Our best model for real-world agents and coding + x-stainless-nominal: false + - const: claude-sonnet-4-5-20250929 + description: Our best model for real-world agents and coding + x-stainless-nominal: false + - const: claude-opus-4-0 + description: Our most capable model + - const: claude-opus-4-20250514 + description: Our most capable model + - const: claude-4-opus-20250514 + description: Our most capable model + x-stainless-nominal: false + - const: claude-opus-4-1-20250805 + description: Our most capable model + - const: claude-3-opus-latest + description: Excels at writing and complex tasks + deprecated: true + x-stainless-deprecation-message: >- + Will reach end-of-life on January 5th, 2026. Please migrate to a newer model. Visit + https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + x-stainless-nominal: false + - const: claude-3-opus-20240229 + description: Excels at writing and complex tasks + deprecated: true + x-stainless-deprecation-message: >- + Will reach end-of-life on January 5th, 2026. Please migrate to a newer model. Visit + https://docs.anthropic.com/en/docs/resources/model-deprecations for more information. + x-stainless-nominal: false + - const: claude-3-haiku-20240307 + description: Our previous most fast and cost-effective + x-stainless-nominal: false + BetaMemoryTool_20250818_ViewCommand: + type: object + required: + - command + - path + properties: + command: + type: string + enum: + - view + const: view + default: view + description: Command type identifier + path: + type: string + description: Path to directory or file to view + example: /memories + view_range: + type: array + description: Optional line range for viewing specific lines + items: + type: integer + minItems: 2 + maxItems: 2 + example: + - 1 + - 10 + BetaMemoryTool_20250818_CreateCommand: + type: object + required: + - command + - path + - file_text + properties: + command: + type: string + enum: + - create + const: create + default: create + description: Command type identifier + path: + type: string + description: Path where the file should be created + example: /memories/notes.txt + file_text: + type: string + description: Content to write to the file + example: | + Meeting notes: + - Discussed project timeline + - Next steps defined + BetaMemoryTool_20250818_StrReplaceCommand: + type: object + required: + - command + - path + - old_str + - new_str + properties: + command: + type: string + enum: + - str_replace + const: str_replace + default: str_replace + description: Command type identifier + path: + type: string + description: Path to the file where text should be replaced + example: /memories/preferences.txt + old_str: + type: string + description: Text to search for and replace + example: 'Favorite color: blue' + new_str: + type: string + description: Text to replace with + example: 'Favorite color: green' + BetaMemoryTool_20250818_InsertCommand: + type: object + required: + - command + - path + - insert_line + - insert_text + properties: + command: + type: string + enum: + - insert + const: insert + default: insert + description: Command type identifier + path: + type: string + description: Path to the file where text should be inserted + example: /memories/todo.txt + insert_line: + type: integer + description: Line number where text should be inserted + minimum: 1 + example: 2 + insert_text: + type: string + description: Text to insert at the specified line + example: | + - Review memory tool documentation + BetaMemoryTool_20250818_DeleteCommand: + type: object + required: + - command + - path + properties: + command: + type: string + enum: + - delete + const: delete + default: delete + description: Command type identifier + path: + type: string + description: Path to the file or directory to delete + example: /memories/old_file.txt + BetaMemoryTool_20250818_RenameCommand: + type: object + required: + - command + - old_path + - new_path + properties: + command: + type: string + enum: + - rename + const: rename + default: rename + description: Command type identifier + old_path: + type: string + description: Current path of the file or directory + example: /memories/draft.txt + new_path: + type: string + description: New path for the file or directory + example: /memories/final.txt + BetaMemoryTool_20250818_Command: + oneOf: + - $ref: '#/components/schemas/BetaMemoryTool_20250818_ViewCommand' + - $ref: '#/components/schemas/BetaMemoryTool_20250818_CreateCommand' + - $ref: '#/components/schemas/BetaMemoryTool_20250818_StrReplaceCommand' + - $ref: '#/components/schemas/BetaMemoryTool_20250818_InsertCommand' + - $ref: '#/components/schemas/BetaMemoryTool_20250818_DeleteCommand' + - $ref: '#/components/schemas/BetaMemoryTool_20250818_RenameCommand' + discriminator: + propertyName: command + mapping: + view: '#/components/schemas/BetaMemoryTool_20250818_ViewCommand' + create: '#/components/schemas/BetaMemoryTool_20250818_CreateCommand' + str_replace: '#/components/schemas/BetaMemoryTool_20250818_StrReplaceCommand' + insert: '#/components/schemas/BetaMemoryTool_20250818_InsertCommand' + delete: '#/components/schemas/BetaMemoryTool_20250818_DeleteCommand' + rename: '#/components/schemas/BetaMemoryTool_20250818_RenameCommand' +servers: + - url: https://api.anthropic.com