Skip to content

Anthropic Messages API

The Messages API provides an Anthropic-compatible interface for secure LLM interactions using the Messages format.

MessagesResource

MessagesResource(transport: ControlSyncTransport)

Anthropic Messages API — client.control.messages.

Methods:

  • create

    Send an Anthropic Messages API request through Sequrity.

create

create(
    messages: list[MessageParam | dict],
    model: str,
    max_tokens: int,
    *,
    system: str | list[TextBlockParam] | list[dict] | None = None,
    temperature: float | None = None,
    top_p: float | None = None,
    top_k: int | None = None,
    tools: list[ToolParam | dict] | None = None,
    tool_choice: ToolChoiceParam | dict | None = None,
    thinking: ThinkingConfigParam | dict | None = None,
    reasoning_effort: ReasoningEffort | None = None,
    stop_sequences: list[str] | None = None,
    stream: Literal[True],
    output_config: OutputConfigParam | dict | None = None,
    metadata: MetadataParam | dict | None = None,
    service_tier: Literal["auto", "standard_only"] | None = None,
    timeout: float | None = None,
    provider: LlmServiceProvider | LlmServiceProviderStr | None | _NotGiven = NOT_GIVEN,
    llm_api_key: str | None | _NotGiven = NOT_GIVEN,
    features: FeaturesHeader | None | _NotGiven = NOT_GIVEN,
    security_policy: SecurityPolicyHeader | None | _NotGiven = NOT_GIVEN,
    fine_grained_config: FineGrainedConfigHeader | None | _NotGiven = NOT_GIVEN,
    endpoint_type: str | _NotGiven = NOT_GIVEN,
    session_id: str | None | _NotGiven = NOT_GIVEN,
    feature_overrides: dict[str, Any] | None = None,
    policy_overrides: dict[str, Any] | None = None,
    config_overrides: dict[str, Any] | None = None,
    custom_headers: dict[str, str] | None = None,
) -> SyncStream[AnthropicStreamEvent]
create(
    messages: list[MessageParam | dict],
    model: str,
    max_tokens: int,
    *,
    system: str | list[TextBlockParam] | list[dict] | None = None,
    temperature: float | None = None,
    top_p: float | None = None,
    top_k: int | None = None,
    tools: list[ToolParam | dict] | None = None,
    tool_choice: ToolChoiceParam | dict | None = None,
    thinking: ThinkingConfigParam | dict | None = None,
    reasoning_effort: ReasoningEffort | None = None,
    stop_sequences: list[str] | None = None,
    stream: Literal[False] | None = None,
    output_config: OutputConfigParam | dict | None = None,
    metadata: MetadataParam | dict | None = None,
    service_tier: Literal["auto", "standard_only"] | None = None,
    timeout: float | None = None,
    provider: LlmServiceProvider | LlmServiceProviderStr | None | _NotGiven = NOT_GIVEN,
    llm_api_key: str | None | _NotGiven = NOT_GIVEN,
    features: FeaturesHeader | None | _NotGiven = NOT_GIVEN,
    security_policy: SecurityPolicyHeader | None | _NotGiven = NOT_GIVEN,
    fine_grained_config: FineGrainedConfigHeader | None | _NotGiven = NOT_GIVEN,
    endpoint_type: str | _NotGiven = NOT_GIVEN,
    session_id: str | None | _NotGiven = NOT_GIVEN,
    feature_overrides: dict[str, Any] | None = None,
    policy_overrides: dict[str, Any] | None = None,
    config_overrides: dict[str, Any] | None = None,
    custom_headers: dict[str, str] | None = None,
) -> AnthropicMessageResponse
create(
    messages: list[MessageParam | dict],
    model: str,
    max_tokens: int,
    *,
    system: str | list[TextBlockParam] | list[dict] | None = None,
    temperature: float | None = None,
    top_p: float | None = None,
    top_k: int | None = None,
    tools: list[ToolParam | dict] | None = None,
    tool_choice: ToolChoiceParam | dict | None = None,
    thinking: ThinkingConfigParam | dict | None = None,
    reasoning_effort: ReasoningEffort | None = None,
    stop_sequences: list[str] | None = None,
    stream: bool | None = None,
    output_config: OutputConfigParam | dict | None = None,
    metadata: MetadataParam | dict | None = None,
    service_tier: Literal["auto", "standard_only"] | None = None,
    timeout: float | None = None,
    provider: LlmServiceProvider | LlmServiceProviderStr | None | _NotGiven = NOT_GIVEN,
    llm_api_key: str | None | _NotGiven = NOT_GIVEN,
    features: FeaturesHeader | None | _NotGiven = NOT_GIVEN,
    security_policy: SecurityPolicyHeader | None | _NotGiven = NOT_GIVEN,
    fine_grained_config: FineGrainedConfigHeader | None | _NotGiven = NOT_GIVEN,
    endpoint_type: str | _NotGiven = NOT_GIVEN,
    session_id: str | None | _NotGiven = NOT_GIVEN,
    feature_overrides: dict[str, Any] | None = None,
    policy_overrides: dict[str, Any] | None = None,
    config_overrides: dict[str, Any] | None = None,
    custom_headers: dict[str, str] | None = None,
) -> AnthropicMessageResponse | SyncStream[AnthropicStreamEvent]

Send an Anthropic Messages API request through Sequrity.

Parameters:

  • messages

    (list[MessageParam | dict]) –

    List of messages with alternating user and assistant turns.

  • model

    (str) –

    The model identifier (e.g., "claude-4-sonnet").

  • max_tokens

    (int) –

    Maximum number of tokens to generate before stopping.

  • system

    (str | list[TextBlockParam] | list[dict] | None, default: None ) –

    System prompt as a string or list of text blocks.

  • temperature

    (float | None, default: None ) –

    Sampling temperature (0.0 to 1.0).

  • top_p

    (float | None, default: None ) –

    Nucleus sampling probability threshold.

  • top_k

    (int | None, default: None ) –

    Only sample from the top K options for each token.

  • tools

    (list[ToolParam | dict] | None, default: None ) –

    List of tool definitions available to the model.

  • tool_choice

    (ToolChoiceParam | dict | None, default: None ) –

    How the model should use the provided tools.

  • thinking

    (ThinkingConfigParam | dict | None, default: None ) –

    Configuration for extended thinking.

  • reasoning_effort

    (ReasoningEffort | None, default: None ) –

    Reasoning effort level for supported models.

  • stop_sequences

    (list[str] | None, default: None ) –

    Custom text sequences that cause the model to stop.

  • stream

    (bool | None, default: None ) –

    Whether to stream the response. When True, returns a :class:SyncStream of :class:AnthropicStreamEvent objects.

  • output_config

    (OutputConfigParam | dict | None, default: None ) –

    Output format configuration.

  • metadata

    (MetadataParam | dict | None, default: None ) –

    Request metadata.

  • service_tier

    (Literal['auto', 'standard_only'] | None, default: None ) –

    Priority or standard capacity selection.

  • timeout

    (float | None, default: None ) –

    Maximum request duration in seconds.

  • provider

    (LlmServiceProvider | LlmServiceProviderStr | None | _NotGiven, default: NOT_GIVEN ) –

    LLM service provider override.

  • llm_api_key

    (str | None | _NotGiven, default: NOT_GIVEN ) –

    LLM provider API key override.

  • features

    (FeaturesHeader | None | _NotGiven, default: NOT_GIVEN ) –

    Security features override.

  • security_policy

    (SecurityPolicyHeader | None | _NotGiven, default: NOT_GIVEN ) –

    Security policy override.

  • fine_grained_config

    (FineGrainedConfigHeader | None | _NotGiven, default: NOT_GIVEN ) –

    Fine-grained config override.

  • endpoint_type

    (str | _NotGiven, default: NOT_GIVEN ) –

    Endpoint type override.

  • session_id

    (str | None | _NotGiven, default: NOT_GIVEN ) –

    Explicit session ID override.

  • feature_overrides

    (dict[str, Any] | None, default: None ) –

    Dict to deep-merge into the serialized X-Features header JSON. Allows adding or overriding fields without loosening Pydantic validation on :class:FeaturesHeader.

  • policy_overrides

    (dict[str, Any] | None, default: None ) –

    Dict to deep-merge into the serialized X-Policy header JSON.

  • config_overrides

    (dict[str, Any] | None, default: None ) –

    Dict to deep-merge into the serialized X-Config header JSON.

Returns:


Request Types

AnthropicMessageRequest pydantic-model

Anthropic Messages API request.

This is a Pydantic model representation of the Anthropic Messages API request, used for sending messages through Sequrity's Control API with the Messages format.

Show JSON schema:
{
  "$defs": {
    "Base64DocumentSourceParam": {
      "description": "Base64-encoded document source.",
      "properties": {
        "type": {
          "const": "base64",
          "default": "base64",
          "description": "The type of document source.",
          "title": "Type",
          "type": "string"
        },
        "media_type": {
          "const": "application/pdf",
          "description": "The media type of the document.",
          "title": "Media Type",
          "type": "string"
        },
        "data": {
          "description": "The base64-encoded document data.",
          "title": "Data",
          "type": "string"
        }
      },
      "required": [
        "media_type",
        "data"
      ],
      "title": "Base64DocumentSourceParam",
      "type": "object"
    },
    "Base64ImageSourceParam": {
      "description": "Base64-encoded image source.",
      "properties": {
        "type": {
          "const": "base64",
          "default": "base64",
          "description": "The type of image source.",
          "title": "Type",
          "type": "string"
        },
        "media_type": {
          "description": "The media type of the image.",
          "enum": [
            "image/jpeg",
            "image/png",
            "image/gif",
            "image/webp"
          ],
          "title": "Media Type",
          "type": "string"
        },
        "data": {
          "description": "The base64-encoded image data.",
          "title": "Data",
          "type": "string"
        }
      },
      "required": [
        "media_type",
        "data"
      ],
      "title": "Base64ImageSourceParam",
      "type": "object"
    },
    "DocumentBlockParam": {
      "description": "Document content block (PDF).",
      "properties": {
        "source": {
          "$ref": "#/$defs/Base64DocumentSourceParam",
          "description": "The source of the document."
        },
        "type": {
          "const": "document",
          "default": "document",
          "description": "The type of the content part.",
          "title": "Type",
          "type": "string"
        },
        "cache_control": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Create a cache control breakpoint at this content block.",
          "title": "Cache Control"
        }
      },
      "required": [
        "source"
      ],
      "title": "DocumentBlockParam",
      "type": "object"
    },
    "ImageBlockParam": {
      "description": "Image content block.",
      "properties": {
        "source": {
          "description": "The source of the image.",
          "discriminator": {
            "mapping": {
              "base64": "#/$defs/Base64ImageSourceParam",
              "url": "#/$defs/URLImageSourceParam"
            },
            "propertyName": "type"
          },
          "oneOf": [
            {
              "$ref": "#/$defs/Base64ImageSourceParam"
            },
            {
              "$ref": "#/$defs/URLImageSourceParam"
            }
          ],
          "title": "Source"
        },
        "type": {
          "const": "image",
          "default": "image",
          "description": "The type of the content part.",
          "title": "Type",
          "type": "string"
        },
        "cache_control": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Create a cache control breakpoint at this content block.",
          "title": "Cache Control"
        }
      },
      "required": [
        "source"
      ],
      "title": "ImageBlockParam",
      "type": "object"
    },
    "JSONOutputFormatParam": {
      "additionalProperties": false,
      "description": "JSON output format with schema.",
      "properties": {
        "type": {
          "const": "json_schema",
          "default": "json_schema",
          "description": "The type of the output format.",
          "title": "Type",
          "type": "string"
        },
        "schema": {
          "additionalProperties": true,
          "description": "The JSON schema of the format.",
          "title": "Schema",
          "type": "object"
        }
      },
      "required": [
        "schema"
      ],
      "title": "JSONOutputFormatParam",
      "type": "object"
    },
    "MessageParam": {
      "description": "A message in the conversation.",
      "properties": {
        "role": {
          "description": "The role of the message author: 'user' or 'assistant'.",
          "enum": [
            "user",
            "assistant"
          ],
          "title": "Role",
          "type": "string"
        },
        "content": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "discriminator": {
                  "mapping": {
                    "document": "#/$defs/DocumentBlockParam",
                    "image": "#/$defs/ImageBlockParam",
                    "text": "#/$defs/TextBlockParam",
                    "thinking": "#/$defs/ThinkingBlockParam",
                    "tool_result": "#/$defs/ToolResultBlockParam",
                    "tool_use": "#/$defs/ToolUseBlockParam"
                  },
                  "propertyName": "type"
                },
                "oneOf": [
                  {
                    "$ref": "#/$defs/TextBlockParam"
                  },
                  {
                    "$ref": "#/$defs/ImageBlockParam"
                  },
                  {
                    "$ref": "#/$defs/DocumentBlockParam"
                  },
                  {
                    "$ref": "#/$defs/ToolUseBlockParam"
                  },
                  {
                    "$ref": "#/$defs/ToolResultBlockParam"
                  },
                  {
                    "$ref": "#/$defs/ThinkingBlockParam"
                  }
                ]
              },
              "type": "array"
            }
          ],
          "description": "The contents of the message. Can be a string or an array of content blocks.",
          "title": "Content"
        }
      },
      "required": [
        "role",
        "content"
      ],
      "title": "MessageParam",
      "type": "object"
    },
    "MetadataParam": {
      "description": "Request metadata.",
      "properties": {
        "user_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "An external identifier for the user associated with the request. Should be a uuid, hash, or other opaque identifier.",
          "title": "User Id"
        }
      },
      "title": "MetadataParam",
      "type": "object"
    },
    "OutputConfigParam": {
      "description": "Output configuration for structured responses.",
      "properties": {
        "format": {
          "anyOf": [
            {
              "$ref": "#/$defs/JSONOutputFormatParam"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A schema to specify Claude's output format in responses."
        }
      },
      "title": "OutputConfigParam",
      "type": "object"
    },
    "TextBlockParam": {
      "description": "Text content block.",
      "properties": {
        "text": {
          "description": "The text content.",
          "title": "Text",
          "type": "string"
        },
        "type": {
          "const": "text",
          "default": "text",
          "description": "The type of the content part.",
          "title": "Type",
          "type": "string"
        },
        "cache_control": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Create a cache control breakpoint at this content block.",
          "title": "Cache Control"
        },
        "citations": {
          "anyOf": [
            {
              "items": {
                "additionalProperties": true,
                "type": "object"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Citations supporting the text block.",
          "title": "Citations"
        }
      },
      "required": [
        "text"
      ],
      "title": "TextBlockParam",
      "type": "object"
    },
    "ThinkingBlockParam": {
      "description": "Thinking content block for extended thinking.",
      "properties": {
        "text": {
          "description": "The thinking content.",
          "title": "Text",
          "type": "string"
        },
        "type": {
          "const": "thinking",
          "default": "thinking",
          "description": "The type of the content part.",
          "title": "Type",
          "type": "string"
        },
        "cache_control": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Create a cache control breakpoint at this content block.",
          "title": "Cache Control"
        }
      },
      "required": [
        "text"
      ],
      "title": "ThinkingBlockParam",
      "type": "object"
    },
    "ThinkingConfigAdaptiveParam": {
      "description": "Adaptive thinking configuration.\n\nClaude automatically decides whether to use extended thinking based on\nthe complexity of the request.\nSee https://docs.anthropic.com/en/api/messages",
      "properties": {
        "type": {
          "const": "adaptive",
          "default": "adaptive",
          "description": "Thinking is adaptive.",
          "title": "Type",
          "type": "string"
        }
      },
      "title": "ThinkingConfigAdaptiveParam",
      "type": "object"
    },
    "ThinkingConfigDisabledParam": {
      "description": "Extended thinking disabled configuration.",
      "properties": {
        "type": {
          "const": "disabled",
          "default": "disabled",
          "description": "Thinking is disabled.",
          "title": "Type",
          "type": "string"
        }
      },
      "title": "ThinkingConfigDisabledParam",
      "type": "object"
    },
    "ThinkingConfigEnabledParam": {
      "description": "Extended thinking enabled configuration.",
      "properties": {
        "type": {
          "const": "enabled",
          "default": "enabled",
          "description": "Thinking is enabled.",
          "title": "Type",
          "type": "string"
        },
        "budget_tokens": {
          "description": "The maximum number of tokens to use for thinking. Minimum is 1024.",
          "title": "Budget Tokens",
          "type": "integer"
        }
      },
      "required": [
        "budget_tokens"
      ],
      "title": "ThinkingConfigEnabledParam",
      "type": "object"
    },
    "ToolChoiceAnyParam": {
      "description": "Any tool choice \u2014 model must use at least one tool.",
      "properties": {
        "type": {
          "const": "any",
          "default": "any",
          "description": "The model will use any available tools.",
          "title": "Type",
          "type": "string"
        },
        "disable_parallel_tool_use": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Whether to disable parallel tool use. If true, the model will output exactly one tool use.",
          "title": "Disable Parallel Tool Use"
        }
      },
      "title": "ToolChoiceAnyParam",
      "type": "object"
    },
    "ToolChoiceAutoParam": {
      "description": "Auto tool choice \u2014 model decides whether to use tools.",
      "properties": {
        "type": {
          "const": "auto",
          "default": "auto",
          "description": "The model will automatically decide whether to use tools.",
          "title": "Type",
          "type": "string"
        },
        "disable_parallel_tool_use": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Whether to disable parallel tool use. If true, the model will output at most one tool use.",
          "title": "Disable Parallel Tool Use"
        }
      },
      "title": "ToolChoiceAutoParam",
      "type": "object"
    },
    "ToolChoiceNoneParam": {
      "description": "None tool choice \u2014 model will not use tools.",
      "properties": {
        "type": {
          "const": "none",
          "default": "none",
          "description": "The model will not use any tools.",
          "title": "Type",
          "type": "string"
        }
      },
      "title": "ToolChoiceNoneParam",
      "type": "object"
    },
    "ToolChoiceToolParam": {
      "description": "Specific tool choice \u2014 model must use the named tool.",
      "properties": {
        "type": {
          "const": "tool",
          "default": "tool",
          "description": "The model will use the specified tool.",
          "title": "Type",
          "type": "string"
        },
        "name": {
          "description": "The name of the tool to use.",
          "title": "Name",
          "type": "string"
        },
        "disable_parallel_tool_use": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Whether to disable parallel tool use. If true, the model will output exactly one tool use.",
          "title": "Disable Parallel Tool Use"
        }
      },
      "required": [
        "name"
      ],
      "title": "ToolChoiceToolParam",
      "type": "object"
    },
    "ToolInputSchema": {
      "additionalProperties": true,
      "description": "JSON Schema for tool input parameters.",
      "properties": {
        "type": {
          "const": "object",
          "default": "object",
          "description": "The type of the input schema. Always 'object'.",
          "title": "Type",
          "type": "string"
        },
        "properties": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The properties of the input schema as a JSON Schema object.",
          "title": "Properties"
        },
        "required": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The required properties of the input schema.",
          "title": "Required"
        }
      },
      "title": "ToolInputSchema",
      "type": "object"
    },
    "ToolParam": {
      "description": "Tool definition for the Anthropic Messages API.",
      "properties": {
        "name": {
          "description": "Name of the tool. This is how the tool will be called by the model.",
          "title": "Name",
          "type": "string"
        },
        "input_schema": {
          "anyOf": [
            {
              "$ref": "#/$defs/ToolInputSchema"
            },
            {
              "additionalProperties": true,
              "type": "object"
            }
          ],
          "description": "JSON schema for this tool's input. Defines the shape of the input that the model will produce.",
          "title": "Input Schema"
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Description of what this tool does. Tool descriptions should be as detailed as possible.",
          "title": "Description"
        },
        "cache_control": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Create a cache control breakpoint at this content block.",
          "title": "Cache Control"
        },
        "strict": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "When true, guarantees schema validation on tool names and inputs.",
          "title": "Strict"
        },
        "type": {
          "anyOf": [
            {
              "const": "custom",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The type of the tool.",
          "title": "Type"
        }
      },
      "required": [
        "name",
        "input_schema"
      ],
      "title": "ToolParam",
      "type": "object"
    },
    "ToolResultBlockParam": {
      "description": "Tool result content block in user messages.",
      "properties": {
        "tool_use_id": {
          "description": "The id of the tool use request this is a result for. Must match an id from a previous tool_use block.",
          "title": "Tool Use Id",
          "type": "string"
        },
        "type": {
          "const": "tool_result",
          "default": "tool_result",
          "description": "The type of the content part.",
          "title": "Type",
          "type": "string"
        },
        "content": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "anyOf": [
                  {
                    "$ref": "#/$defs/TextBlockParam"
                  },
                  {
                    "$ref": "#/$defs/ImageBlockParam"
                  },
                  {
                    "$ref": "#/$defs/DocumentBlockParam"
                  }
                ]
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The result of the tool call.",
          "title": "Content"
        },
        "is_error": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Set to true if the tool execution resulted in an error.",
          "title": "Is Error"
        },
        "cache_control": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Create a cache control breakpoint at this content block.",
          "title": "Cache Control"
        }
      },
      "required": [
        "tool_use_id"
      ],
      "title": "ToolResultBlockParam",
      "type": "object"
    },
    "ToolUseBlockParam": {
      "description": "Tool use content block in assistant messages.",
      "properties": {
        "id": {
          "description": "A unique identifier for this particular tool use block.",
          "title": "Id",
          "type": "string"
        },
        "input": {
          "additionalProperties": true,
          "description": "An object containing the input being passed to the tool.",
          "title": "Input",
          "type": "object"
        },
        "name": {
          "description": "The name of the tool being used.",
          "title": "Name",
          "type": "string"
        },
        "type": {
          "const": "tool_use",
          "default": "tool_use",
          "description": "The type of the content part.",
          "title": "Type",
          "type": "string"
        },
        "cache_control": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Create a cache control breakpoint at this content block.",
          "title": "Cache Control"
        }
      },
      "required": [
        "id",
        "input",
        "name"
      ],
      "title": "ToolUseBlockParam",
      "type": "object"
    },
    "URLImageSourceParam": {
      "description": "URL image source.",
      "properties": {
        "type": {
          "const": "url",
          "default": "url",
          "description": "The type of image source.",
          "title": "Type",
          "type": "string"
        },
        "url": {
          "description": "The URL of the image.",
          "title": "Url",
          "type": "string"
        }
      },
      "required": [
        "url"
      ],
      "title": "URLImageSourceParam",
      "type": "object"
    }
  },
  "description": "Anthropic Messages API request.\n\nThis is a Pydantic model representation of the Anthropic Messages API request,\nused for sending messages through Sequrity's Control API with the Messages format.",
  "properties": {
    "max_tokens": {
      "description": "The maximum number of tokens to generate before stopping.",
      "title": "Max Tokens",
      "type": "integer"
    },
    "messages": {
      "description": "Input messages with alternating user and assistant conversational turns.",
      "items": {
        "$ref": "#/$defs/MessageParam"
      },
      "title": "Messages",
      "type": "array"
    },
    "model": {
      "description": "The model that will complete your prompt (e.g., 'claude-3-opus', 'claude-4-sonnet').",
      "title": "Model",
      "type": "string"
    },
    "metadata": {
      "anyOf": [
        {
          "$ref": "#/$defs/MetadataParam"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "An object describing metadata about the request."
    },
    "reasoning_effort": {
      "anyOf": [
        {
          "enum": [
            "none",
            "minimal",
            "low",
            "medium",
            "high",
            "xhigh"
          ],
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Constrains effort on reasoning for reasoning models. Supported values are 'none', 'minimal', 'low', 'medium', 'high', and 'xhigh'.",
      "title": "Reasoning Effort"
    },
    "output_config": {
      "anyOf": [
        {
          "$ref": "#/$defs/OutputConfigParam"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Configuration options for the model's output, such as the output format."
    },
    "service_tier": {
      "anyOf": [
        {
          "enum": [
            "auto",
            "standard_only"
          ],
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Determines whether to use priority capacity or standard capacity for this request.",
      "title": "Service Tier"
    },
    "stop_sequences": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Custom text sequences that will cause the model to stop generating.",
      "title": "Stop Sequences"
    },
    "stream": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Whether to incrementally stream the response using server-sent events.",
      "title": "Stream"
    },
    "system": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "items": {
            "$ref": "#/$defs/TextBlockParam"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "System prompt providing context and instructions to the model.",
      "title": "System"
    },
    "temperature": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Amount of randomness injected into the response. Ranges from 0.0 to 1.0.",
      "title": "Temperature"
    },
    "thinking": {
      "anyOf": [
        {
          "discriminator": {
            "mapping": {
              "adaptive": "#/$defs/ThinkingConfigAdaptiveParam",
              "disabled": "#/$defs/ThinkingConfigDisabledParam",
              "enabled": "#/$defs/ThinkingConfigEnabledParam"
            },
            "propertyName": "type"
          },
          "oneOf": [
            {
              "$ref": "#/$defs/ThinkingConfigEnabledParam"
            },
            {
              "$ref": "#/$defs/ThinkingConfigDisabledParam"
            },
            {
              "$ref": "#/$defs/ThinkingConfigAdaptiveParam"
            }
          ]
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Configuration for enabling extended thinking. When enabled, responses include thinking content blocks.",
      "title": "Thinking"
    },
    "tool_choice": {
      "anyOf": [
        {
          "discriminator": {
            "mapping": {
              "any": "#/$defs/ToolChoiceAnyParam",
              "auto": "#/$defs/ToolChoiceAutoParam",
              "none": "#/$defs/ToolChoiceNoneParam",
              "tool": "#/$defs/ToolChoiceToolParam"
            },
            "propertyName": "type"
          },
          "oneOf": [
            {
              "$ref": "#/$defs/ToolChoiceAutoParam"
            },
            {
              "$ref": "#/$defs/ToolChoiceAnyParam"
            },
            {
              "$ref": "#/$defs/ToolChoiceToolParam"
            },
            {
              "$ref": "#/$defs/ToolChoiceNoneParam"
            }
          ]
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "How the model should use the provided tools.",
      "title": "Tool Choice"
    },
    "tools": {
      "anyOf": [
        {
          "items": {
            "anyOf": [
              {
                "$ref": "#/$defs/ToolParam"
              },
              {
                "additionalProperties": true,
                "type": "object"
              }
            ]
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Definitions of tools that the model may use.",
      "title": "Tools"
    },
    "top_k": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Only sample from the top K options for each subsequent token.",
      "title": "Top K"
    },
    "top_p": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Use nucleus sampling with the specified probability threshold.",
      "title": "Top P"
    },
    "timeout": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The maximum amount of time, in seconds, that the request should take.",
      "title": "Timeout"
    }
  },
  "required": [
    "max_tokens",
    "messages",
    "model"
  ],
  "title": "AnthropicMessageRequest",
  "type": "object"
}

Fields:

max_tokens pydantic-field

max_tokens: int

The maximum number of tokens to generate before stopping.

messages pydantic-field

messages: list[MessageParam]

Input messages with alternating user and assistant conversational turns.

model pydantic-field

model: str

The model that will complete your prompt (e.g., 'claude-3-opus', 'claude-4-sonnet').

metadata pydantic-field

metadata: MetadataParam | None = None

An object describing metadata about the request.

reasoning_effort pydantic-field

reasoning_effort: ReasoningEffort | None = None

Constrains effort on reasoning for reasoning models. Supported values are 'none', 'minimal', 'low', 'medium', 'high', and 'xhigh'.

output_config pydantic-field

output_config: OutputConfigParam | None = None

Configuration options for the model's output, such as the output format.

service_tier pydantic-field

service_tier: Literal['auto', 'standard_only'] | None = None

Determines whether to use priority capacity or standard capacity for this request.

stop_sequences pydantic-field

stop_sequences: list[str] | None = None

Custom text sequences that will cause the model to stop generating.

stream pydantic-field

stream: bool | None = None

Whether to incrementally stream the response using server-sent events.

system pydantic-field

system: str | list[TextBlockParam] | None = None

System prompt providing context and instructions to the model.

temperature pydantic-field

temperature: float | None = None

Amount of randomness injected into the response. Ranges from 0.0 to 1.0.

thinking pydantic-field

thinking: ThinkingConfigParam | None = None

Configuration for enabling extended thinking. When enabled, responses include thinking content blocks.

tool_choice pydantic-field

tool_choice: ToolChoiceParam | None = None

How the model should use the provided tools.

tools pydantic-field

tools: list[ToolUnionParam] | None = None

Definitions of tools that the model may use.

top_k pydantic-field

top_k: int | None = None

Only sample from the top K options for each subsequent token.

top_p pydantic-field

top_p: float | None = None

Use nucleus sampling with the specified probability threshold.

timeout pydantic-field

timeout: float | None = None

The maximum amount of time, in seconds, that the request should take.

MessageParam pydantic-model

A message in the conversation.

Show JSON schema:
{
  "$defs": {
    "Base64DocumentSourceParam": {
      "description": "Base64-encoded document source.",
      "properties": {
        "type": {
          "const": "base64",
          "default": "base64",
          "description": "The type of document source.",
          "title": "Type",
          "type": "string"
        },
        "media_type": {
          "const": "application/pdf",
          "description": "The media type of the document.",
          "title": "Media Type",
          "type": "string"
        },
        "data": {
          "description": "The base64-encoded document data.",
          "title": "Data",
          "type": "string"
        }
      },
      "required": [
        "media_type",
        "data"
      ],
      "title": "Base64DocumentSourceParam",
      "type": "object"
    },
    "Base64ImageSourceParam": {
      "description": "Base64-encoded image source.",
      "properties": {
        "type": {
          "const": "base64",
          "default": "base64",
          "description": "The type of image source.",
          "title": "Type",
          "type": "string"
        },
        "media_type": {
          "description": "The media type of the image.",
          "enum": [
            "image/jpeg",
            "image/png",
            "image/gif",
            "image/webp"
          ],
          "title": "Media Type",
          "type": "string"
        },
        "data": {
          "description": "The base64-encoded image data.",
          "title": "Data",
          "type": "string"
        }
      },
      "required": [
        "media_type",
        "data"
      ],
      "title": "Base64ImageSourceParam",
      "type": "object"
    },
    "DocumentBlockParam": {
      "description": "Document content block (PDF).",
      "properties": {
        "source": {
          "$ref": "#/$defs/Base64DocumentSourceParam",
          "description": "The source of the document."
        },
        "type": {
          "const": "document",
          "default": "document",
          "description": "The type of the content part.",
          "title": "Type",
          "type": "string"
        },
        "cache_control": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Create a cache control breakpoint at this content block.",
          "title": "Cache Control"
        }
      },
      "required": [
        "source"
      ],
      "title": "DocumentBlockParam",
      "type": "object"
    },
    "ImageBlockParam": {
      "description": "Image content block.",
      "properties": {
        "source": {
          "description": "The source of the image.",
          "discriminator": {
            "mapping": {
              "base64": "#/$defs/Base64ImageSourceParam",
              "url": "#/$defs/URLImageSourceParam"
            },
            "propertyName": "type"
          },
          "oneOf": [
            {
              "$ref": "#/$defs/Base64ImageSourceParam"
            },
            {
              "$ref": "#/$defs/URLImageSourceParam"
            }
          ],
          "title": "Source"
        },
        "type": {
          "const": "image",
          "default": "image",
          "description": "The type of the content part.",
          "title": "Type",
          "type": "string"
        },
        "cache_control": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Create a cache control breakpoint at this content block.",
          "title": "Cache Control"
        }
      },
      "required": [
        "source"
      ],
      "title": "ImageBlockParam",
      "type": "object"
    },
    "TextBlockParam": {
      "description": "Text content block.",
      "properties": {
        "text": {
          "description": "The text content.",
          "title": "Text",
          "type": "string"
        },
        "type": {
          "const": "text",
          "default": "text",
          "description": "The type of the content part.",
          "title": "Type",
          "type": "string"
        },
        "cache_control": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Create a cache control breakpoint at this content block.",
          "title": "Cache Control"
        },
        "citations": {
          "anyOf": [
            {
              "items": {
                "additionalProperties": true,
                "type": "object"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Citations supporting the text block.",
          "title": "Citations"
        }
      },
      "required": [
        "text"
      ],
      "title": "TextBlockParam",
      "type": "object"
    },
    "ThinkingBlockParam": {
      "description": "Thinking content block for extended thinking.",
      "properties": {
        "text": {
          "description": "The thinking content.",
          "title": "Text",
          "type": "string"
        },
        "type": {
          "const": "thinking",
          "default": "thinking",
          "description": "The type of the content part.",
          "title": "Type",
          "type": "string"
        },
        "cache_control": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Create a cache control breakpoint at this content block.",
          "title": "Cache Control"
        }
      },
      "required": [
        "text"
      ],
      "title": "ThinkingBlockParam",
      "type": "object"
    },
    "ToolResultBlockParam": {
      "description": "Tool result content block in user messages.",
      "properties": {
        "tool_use_id": {
          "description": "The id of the tool use request this is a result for. Must match an id from a previous tool_use block.",
          "title": "Tool Use Id",
          "type": "string"
        },
        "type": {
          "const": "tool_result",
          "default": "tool_result",
          "description": "The type of the content part.",
          "title": "Type",
          "type": "string"
        },
        "content": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "anyOf": [
                  {
                    "$ref": "#/$defs/TextBlockParam"
                  },
                  {
                    "$ref": "#/$defs/ImageBlockParam"
                  },
                  {
                    "$ref": "#/$defs/DocumentBlockParam"
                  }
                ]
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The result of the tool call.",
          "title": "Content"
        },
        "is_error": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Set to true if the tool execution resulted in an error.",
          "title": "Is Error"
        },
        "cache_control": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Create a cache control breakpoint at this content block.",
          "title": "Cache Control"
        }
      },
      "required": [
        "tool_use_id"
      ],
      "title": "ToolResultBlockParam",
      "type": "object"
    },
    "ToolUseBlockParam": {
      "description": "Tool use content block in assistant messages.",
      "properties": {
        "id": {
          "description": "A unique identifier for this particular tool use block.",
          "title": "Id",
          "type": "string"
        },
        "input": {
          "additionalProperties": true,
          "description": "An object containing the input being passed to the tool.",
          "title": "Input",
          "type": "object"
        },
        "name": {
          "description": "The name of the tool being used.",
          "title": "Name",
          "type": "string"
        },
        "type": {
          "const": "tool_use",
          "default": "tool_use",
          "description": "The type of the content part.",
          "title": "Type",
          "type": "string"
        },
        "cache_control": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Create a cache control breakpoint at this content block.",
          "title": "Cache Control"
        }
      },
      "required": [
        "id",
        "input",
        "name"
      ],
      "title": "ToolUseBlockParam",
      "type": "object"
    },
    "URLImageSourceParam": {
      "description": "URL image source.",
      "properties": {
        "type": {
          "const": "url",
          "default": "url",
          "description": "The type of image source.",
          "title": "Type",
          "type": "string"
        },
        "url": {
          "description": "The URL of the image.",
          "title": "Url",
          "type": "string"
        }
      },
      "required": [
        "url"
      ],
      "title": "URLImageSourceParam",
      "type": "object"
    }
  },
  "description": "A message in the conversation.",
  "properties": {
    "role": {
      "description": "The role of the message author: 'user' or 'assistant'.",
      "enum": [
        "user",
        "assistant"
      ],
      "title": "Role",
      "type": "string"
    },
    "content": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "items": {
            "discriminator": {
              "mapping": {
                "document": "#/$defs/DocumentBlockParam",
                "image": "#/$defs/ImageBlockParam",
                "text": "#/$defs/TextBlockParam",
                "thinking": "#/$defs/ThinkingBlockParam",
                "tool_result": "#/$defs/ToolResultBlockParam",
                "tool_use": "#/$defs/ToolUseBlockParam"
              },
              "propertyName": "type"
            },
            "oneOf": [
              {
                "$ref": "#/$defs/TextBlockParam"
              },
              {
                "$ref": "#/$defs/ImageBlockParam"
              },
              {
                "$ref": "#/$defs/DocumentBlockParam"
              },
              {
                "$ref": "#/$defs/ToolUseBlockParam"
              },
              {
                "$ref": "#/$defs/ToolResultBlockParam"
              },
              {
                "$ref": "#/$defs/ThinkingBlockParam"
              }
            ]
          },
          "type": "array"
        }
      ],
      "description": "The contents of the message. Can be a string or an array of content blocks.",
      "title": "Content"
    }
  },
  "required": [
    "role",
    "content"
  ],
  "title": "MessageParam",
  "type": "object"
}

Config:

  • extra: ignore

Fields:

role pydantic-field

role: Literal['user', 'assistant']

The role of the message author: 'user' or 'assistant'.

content pydantic-field

content: str | list[MessageContentBlockParam]

The contents of the message. Can be a string or an array of content blocks.

Content Blocks

TextBlockParam pydantic-model

Text content block.

Show JSON schema:
{
  "description": "Text content block.",
  "properties": {
    "text": {
      "description": "The text content.",
      "title": "Text",
      "type": "string"
    },
    "type": {
      "const": "text",
      "default": "text",
      "description": "The type of the content part.",
      "title": "Type",
      "type": "string"
    },
    "cache_control": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Create a cache control breakpoint at this content block.",
      "title": "Cache Control"
    },
    "citations": {
      "anyOf": [
        {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Citations supporting the text block.",
      "title": "Citations"
    }
  },
  "required": [
    "text"
  ],
  "title": "TextBlockParam",
  "type": "object"
}

Config:

  • extra: ignore

Fields:

text pydantic-field

text: str

The text content.

type pydantic-field

type: Literal['text'] = 'text'

The type of the content part.

cache_control pydantic-field

cache_control: dict[str, Any] | None = None

Create a cache control breakpoint at this content block.

citations pydantic-field

citations: list[dict[str, Any]] | None = None

Citations supporting the text block.

ImageBlockParam pydantic-model

Image content block.

Show JSON schema:
{
  "$defs": {
    "Base64ImageSourceParam": {
      "description": "Base64-encoded image source.",
      "properties": {
        "type": {
          "const": "base64",
          "default": "base64",
          "description": "The type of image source.",
          "title": "Type",
          "type": "string"
        },
        "media_type": {
          "description": "The media type of the image.",
          "enum": [
            "image/jpeg",
            "image/png",
            "image/gif",
            "image/webp"
          ],
          "title": "Media Type",
          "type": "string"
        },
        "data": {
          "description": "The base64-encoded image data.",
          "title": "Data",
          "type": "string"
        }
      },
      "required": [
        "media_type",
        "data"
      ],
      "title": "Base64ImageSourceParam",
      "type": "object"
    },
    "URLImageSourceParam": {
      "description": "URL image source.",
      "properties": {
        "type": {
          "const": "url",
          "default": "url",
          "description": "The type of image source.",
          "title": "Type",
          "type": "string"
        },
        "url": {
          "description": "The URL of the image.",
          "title": "Url",
          "type": "string"
        }
      },
      "required": [
        "url"
      ],
      "title": "URLImageSourceParam",
      "type": "object"
    }
  },
  "description": "Image content block.",
  "properties": {
    "source": {
      "description": "The source of the image.",
      "discriminator": {
        "mapping": {
          "base64": "#/$defs/Base64ImageSourceParam",
          "url": "#/$defs/URLImageSourceParam"
        },
        "propertyName": "type"
      },
      "oneOf": [
        {
          "$ref": "#/$defs/Base64ImageSourceParam"
        },
        {
          "$ref": "#/$defs/URLImageSourceParam"
        }
      ],
      "title": "Source"
    },
    "type": {
      "const": "image",
      "default": "image",
      "description": "The type of the content part.",
      "title": "Type",
      "type": "string"
    },
    "cache_control": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Create a cache control breakpoint at this content block.",
      "title": "Cache Control"
    }
  },
  "required": [
    "source"
  ],
  "title": "ImageBlockParam",
  "type": "object"
}

Config:

  • extra: ignore

Fields:

source pydantic-field

source: ImageSource

The source of the image.

type pydantic-field

type: Literal['image'] = 'image'

The type of the content part.

cache_control pydantic-field

cache_control: dict[str, Any] | None = None

Create a cache control breakpoint at this content block.

DocumentBlockParam pydantic-model

Document content block (PDF).

Show JSON schema:
{
  "$defs": {
    "Base64DocumentSourceParam": {
      "description": "Base64-encoded document source.",
      "properties": {
        "type": {
          "const": "base64",
          "default": "base64",
          "description": "The type of document source.",
          "title": "Type",
          "type": "string"
        },
        "media_type": {
          "const": "application/pdf",
          "description": "The media type of the document.",
          "title": "Media Type",
          "type": "string"
        },
        "data": {
          "description": "The base64-encoded document data.",
          "title": "Data",
          "type": "string"
        }
      },
      "required": [
        "media_type",
        "data"
      ],
      "title": "Base64DocumentSourceParam",
      "type": "object"
    }
  },
  "description": "Document content block (PDF).",
  "properties": {
    "source": {
      "$ref": "#/$defs/Base64DocumentSourceParam",
      "description": "The source of the document."
    },
    "type": {
      "const": "document",
      "default": "document",
      "description": "The type of the content part.",
      "title": "Type",
      "type": "string"
    },
    "cache_control": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Create a cache control breakpoint at this content block.",
      "title": "Cache Control"
    }
  },
  "required": [
    "source"
  ],
  "title": "DocumentBlockParam",
  "type": "object"
}

Config:

  • extra: ignore

Fields:

source pydantic-field

source: Base64DocumentSourceParam

The source of the document.

type pydantic-field

type: Literal['document'] = 'document'

The type of the content part.

cache_control pydantic-field

cache_control: dict[str, Any] | None = None

Create a cache control breakpoint at this content block.

ToolUseBlockParam pydantic-model

Tool use content block in assistant messages.

Show JSON schema:
{
  "description": "Tool use content block in assistant messages.",
  "properties": {
    "id": {
      "description": "A unique identifier for this particular tool use block.",
      "title": "Id",
      "type": "string"
    },
    "input": {
      "additionalProperties": true,
      "description": "An object containing the input being passed to the tool.",
      "title": "Input",
      "type": "object"
    },
    "name": {
      "description": "The name of the tool being used.",
      "title": "Name",
      "type": "string"
    },
    "type": {
      "const": "tool_use",
      "default": "tool_use",
      "description": "The type of the content part.",
      "title": "Type",
      "type": "string"
    },
    "cache_control": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Create a cache control breakpoint at this content block.",
      "title": "Cache Control"
    }
  },
  "required": [
    "id",
    "input",
    "name"
  ],
  "title": "ToolUseBlockParam",
  "type": "object"
}

Config:

  • extra: ignore

Fields:

id pydantic-field

id: str

A unique identifier for this particular tool use block.

input pydantic-field

input: dict[str, Any]

An object containing the input being passed to the tool.

name pydantic-field

name: str

The name of the tool being used.

type pydantic-field

type: Literal['tool_use'] = 'tool_use'

The type of the content part.

cache_control pydantic-field

cache_control: dict[str, Any] | None = None

Create a cache control breakpoint at this content block.

ToolResultBlockParam pydantic-model

Tool result content block in user messages.

Show JSON schema:
{
  "$defs": {
    "Base64DocumentSourceParam": {
      "description": "Base64-encoded document source.",
      "properties": {
        "type": {
          "const": "base64",
          "default": "base64",
          "description": "The type of document source.",
          "title": "Type",
          "type": "string"
        },
        "media_type": {
          "const": "application/pdf",
          "description": "The media type of the document.",
          "title": "Media Type",
          "type": "string"
        },
        "data": {
          "description": "The base64-encoded document data.",
          "title": "Data",
          "type": "string"
        }
      },
      "required": [
        "media_type",
        "data"
      ],
      "title": "Base64DocumentSourceParam",
      "type": "object"
    },
    "Base64ImageSourceParam": {
      "description": "Base64-encoded image source.",
      "properties": {
        "type": {
          "const": "base64",
          "default": "base64",
          "description": "The type of image source.",
          "title": "Type",
          "type": "string"
        },
        "media_type": {
          "description": "The media type of the image.",
          "enum": [
            "image/jpeg",
            "image/png",
            "image/gif",
            "image/webp"
          ],
          "title": "Media Type",
          "type": "string"
        },
        "data": {
          "description": "The base64-encoded image data.",
          "title": "Data",
          "type": "string"
        }
      },
      "required": [
        "media_type",
        "data"
      ],
      "title": "Base64ImageSourceParam",
      "type": "object"
    },
    "DocumentBlockParam": {
      "description": "Document content block (PDF).",
      "properties": {
        "source": {
          "$ref": "#/$defs/Base64DocumentSourceParam",
          "description": "The source of the document."
        },
        "type": {
          "const": "document",
          "default": "document",
          "description": "The type of the content part.",
          "title": "Type",
          "type": "string"
        },
        "cache_control": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Create a cache control breakpoint at this content block.",
          "title": "Cache Control"
        }
      },
      "required": [
        "source"
      ],
      "title": "DocumentBlockParam",
      "type": "object"
    },
    "ImageBlockParam": {
      "description": "Image content block.",
      "properties": {
        "source": {
          "description": "The source of the image.",
          "discriminator": {
            "mapping": {
              "base64": "#/$defs/Base64ImageSourceParam",
              "url": "#/$defs/URLImageSourceParam"
            },
            "propertyName": "type"
          },
          "oneOf": [
            {
              "$ref": "#/$defs/Base64ImageSourceParam"
            },
            {
              "$ref": "#/$defs/URLImageSourceParam"
            }
          ],
          "title": "Source"
        },
        "type": {
          "const": "image",
          "default": "image",
          "description": "The type of the content part.",
          "title": "Type",
          "type": "string"
        },
        "cache_control": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Create a cache control breakpoint at this content block.",
          "title": "Cache Control"
        }
      },
      "required": [
        "source"
      ],
      "title": "ImageBlockParam",
      "type": "object"
    },
    "TextBlockParam": {
      "description": "Text content block.",
      "properties": {
        "text": {
          "description": "The text content.",
          "title": "Text",
          "type": "string"
        },
        "type": {
          "const": "text",
          "default": "text",
          "description": "The type of the content part.",
          "title": "Type",
          "type": "string"
        },
        "cache_control": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Create a cache control breakpoint at this content block.",
          "title": "Cache Control"
        },
        "citations": {
          "anyOf": [
            {
              "items": {
                "additionalProperties": true,
                "type": "object"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Citations supporting the text block.",
          "title": "Citations"
        }
      },
      "required": [
        "text"
      ],
      "title": "TextBlockParam",
      "type": "object"
    },
    "URLImageSourceParam": {
      "description": "URL image source.",
      "properties": {
        "type": {
          "const": "url",
          "default": "url",
          "description": "The type of image source.",
          "title": "Type",
          "type": "string"
        },
        "url": {
          "description": "The URL of the image.",
          "title": "Url",
          "type": "string"
        }
      },
      "required": [
        "url"
      ],
      "title": "URLImageSourceParam",
      "type": "object"
    }
  },
  "description": "Tool result content block in user messages.",
  "properties": {
    "tool_use_id": {
      "description": "The id of the tool use request this is a result for. Must match an id from a previous tool_use block.",
      "title": "Tool Use Id",
      "type": "string"
    },
    "type": {
      "const": "tool_result",
      "default": "tool_result",
      "description": "The type of the content part.",
      "title": "Type",
      "type": "string"
    },
    "content": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "items": {
            "anyOf": [
              {
                "$ref": "#/$defs/TextBlockParam"
              },
              {
                "$ref": "#/$defs/ImageBlockParam"
              },
              {
                "$ref": "#/$defs/DocumentBlockParam"
              }
            ]
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The result of the tool call.",
      "title": "Content"
    },
    "is_error": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Set to true if the tool execution resulted in an error.",
      "title": "Is Error"
    },
    "cache_control": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Create a cache control breakpoint at this content block.",
      "title": "Cache Control"
    }
  },
  "required": [
    "tool_use_id"
  ],
  "title": "ToolResultBlockParam",
  "type": "object"
}

Config:

  • extra: ignore

Fields:

tool_use_id pydantic-field

tool_use_id: str

The id of the tool use request this is a result for. Must match an id from a previous tool_use block.

type pydantic-field

type: Literal['tool_result'] = 'tool_result'

The type of the content part.

content pydantic-field

The result of the tool call.

is_error pydantic-field

is_error: bool | None = None

Set to true if the tool execution resulted in an error.

cache_control pydantic-field

cache_control: dict[str, Any] | None = None

Create a cache control breakpoint at this content block.

ThinkingBlockParam pydantic-model

Thinking content block for extended thinking.

Show JSON schema:
{
  "description": "Thinking content block for extended thinking.",
  "properties": {
    "text": {
      "description": "The thinking content.",
      "title": "Text",
      "type": "string"
    },
    "type": {
      "const": "thinking",
      "default": "thinking",
      "description": "The type of the content part.",
      "title": "Type",
      "type": "string"
    },
    "cache_control": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Create a cache control breakpoint at this content block.",
      "title": "Cache Control"
    }
  },
  "required": [
    "text"
  ],
  "title": "ThinkingBlockParam",
  "type": "object"
}

Config:

  • extra: ignore

Fields:

text pydantic-field

text: str

The thinking content.

type pydantic-field

type: Literal['thinking'] = 'thinking'

The type of the content part.

cache_control pydantic-field

cache_control: dict[str, Any] | None = None

Create a cache control breakpoint at this content block.

Tool Types

ToolParam pydantic-model

Tool definition for the Anthropic Messages API.

Show JSON schema:
{
  "$defs": {
    "ToolInputSchema": {
      "additionalProperties": true,
      "description": "JSON Schema for tool input parameters.",
      "properties": {
        "type": {
          "const": "object",
          "default": "object",
          "description": "The type of the input schema. Always 'object'.",
          "title": "Type",
          "type": "string"
        },
        "properties": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The properties of the input schema as a JSON Schema object.",
          "title": "Properties"
        },
        "required": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The required properties of the input schema.",
          "title": "Required"
        }
      },
      "title": "ToolInputSchema",
      "type": "object"
    }
  },
  "description": "Tool definition for the Anthropic Messages API.",
  "properties": {
    "name": {
      "description": "Name of the tool. This is how the tool will be called by the model.",
      "title": "Name",
      "type": "string"
    },
    "input_schema": {
      "anyOf": [
        {
          "$ref": "#/$defs/ToolInputSchema"
        },
        {
          "additionalProperties": true,
          "type": "object"
        }
      ],
      "description": "JSON schema for this tool's input. Defines the shape of the input that the model will produce.",
      "title": "Input Schema"
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Description of what this tool does. Tool descriptions should be as detailed as possible.",
      "title": "Description"
    },
    "cache_control": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Create a cache control breakpoint at this content block.",
      "title": "Cache Control"
    },
    "strict": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "When true, guarantees schema validation on tool names and inputs.",
      "title": "Strict"
    },
    "type": {
      "anyOf": [
        {
          "const": "custom",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The type of the tool.",
      "title": "Type"
    }
  },
  "required": [
    "name",
    "input_schema"
  ],
  "title": "ToolParam",
  "type": "object"
}

Config:

  • extra: ignore

Fields:

name pydantic-field

name: str

Name of the tool. This is how the tool will be called by the model.

input_schema pydantic-field

input_schema: ToolInputSchema | dict[str, Any]

JSON schema for this tool's input. Defines the shape of the input that the model will produce.

description pydantic-field

description: str | None = None

Description of what this tool does. Tool descriptions should be as detailed as possible.

cache_control pydantic-field

cache_control: dict[str, Any] | None = None

Create a cache control breakpoint at this content block.

strict pydantic-field

strict: bool | None = None

When true, guarantees schema validation on tool names and inputs.

type pydantic-field

type: Literal['custom'] | None = None

The type of the tool.

ToolInputSchema pydantic-model

JSON Schema for tool input parameters.

Show JSON schema:
{
  "additionalProperties": true,
  "description": "JSON Schema for tool input parameters.",
  "properties": {
    "type": {
      "const": "object",
      "default": "object",
      "description": "The type of the input schema. Always 'object'.",
      "title": "Type",
      "type": "string"
    },
    "properties": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The properties of the input schema as a JSON Schema object.",
      "title": "Properties"
    },
    "required": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The required properties of the input schema.",
      "title": "Required"
    }
  },
  "title": "ToolInputSchema",
  "type": "object"
}

Config:

  • extra: allow

Fields:

type pydantic-field

type: Literal['object'] = 'object'

The type of the input schema. Always 'object'.

properties pydantic-field

properties: dict[str, Any] | None = None

The properties of the input schema as a JSON Schema object.

required pydantic-field

required: list[str] | None = None

The required properties of the input schema.

ToolChoiceAutoParam pydantic-model

Auto tool choice — model decides whether to use tools.

Show JSON schema:
{
  "description": "Auto tool choice \u2014 model decides whether to use tools.",
  "properties": {
    "type": {
      "const": "auto",
      "default": "auto",
      "description": "The model will automatically decide whether to use tools.",
      "title": "Type",
      "type": "string"
    },
    "disable_parallel_tool_use": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Whether to disable parallel tool use. If true, the model will output at most one tool use.",
      "title": "Disable Parallel Tool Use"
    }
  },
  "title": "ToolChoiceAutoParam",
  "type": "object"
}

Config:

  • extra: ignore

Fields:

type pydantic-field

type: Literal['auto'] = 'auto'

The model will automatically decide whether to use tools.

disable_parallel_tool_use pydantic-field

disable_parallel_tool_use: bool | None = None

Whether to disable parallel tool use. If true, the model will output at most one tool use.

ToolChoiceAnyParam pydantic-model

Any tool choice — model must use at least one tool.

Show JSON schema:
{
  "description": "Any tool choice \u2014 model must use at least one tool.",
  "properties": {
    "type": {
      "const": "any",
      "default": "any",
      "description": "The model will use any available tools.",
      "title": "Type",
      "type": "string"
    },
    "disable_parallel_tool_use": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Whether to disable parallel tool use. If true, the model will output exactly one tool use.",
      "title": "Disable Parallel Tool Use"
    }
  },
  "title": "ToolChoiceAnyParam",
  "type": "object"
}

Config:

  • extra: ignore

Fields:

type pydantic-field

type: Literal['any'] = 'any'

The model will use any available tools.

disable_parallel_tool_use pydantic-field

disable_parallel_tool_use: bool | None = None

Whether to disable parallel tool use. If true, the model will output exactly one tool use.

ToolChoiceToolParam pydantic-model

Specific tool choice — model must use the named tool.

Show JSON schema:
{
  "description": "Specific tool choice \u2014 model must use the named tool.",
  "properties": {
    "type": {
      "const": "tool",
      "default": "tool",
      "description": "The model will use the specified tool.",
      "title": "Type",
      "type": "string"
    },
    "name": {
      "description": "The name of the tool to use.",
      "title": "Name",
      "type": "string"
    },
    "disable_parallel_tool_use": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Whether to disable parallel tool use. If true, the model will output exactly one tool use.",
      "title": "Disable Parallel Tool Use"
    }
  },
  "required": [
    "name"
  ],
  "title": "ToolChoiceToolParam",
  "type": "object"
}

Config:

  • extra: ignore

Fields:

type pydantic-field

type: Literal['tool'] = 'tool'

The model will use the specified tool.

name pydantic-field

name: str

The name of the tool to use.

disable_parallel_tool_use pydantic-field

disable_parallel_tool_use: bool | None = None

Whether to disable parallel tool use. If true, the model will output exactly one tool use.

ToolChoiceNoneParam pydantic-model

None tool choice — model will not use tools.

Show JSON schema:
{
  "description": "None tool choice \u2014 model will not use tools.",
  "properties": {
    "type": {
      "const": "none",
      "default": "none",
      "description": "The model will not use any tools.",
      "title": "Type",
      "type": "string"
    }
  },
  "title": "ToolChoiceNoneParam",
  "type": "object"
}

Config:

  • extra: ignore

Fields:

type pydantic-field

type: Literal['none'] = 'none'

The model will not use any tools.

Thinking Configuration

ThinkingConfigEnabledParam pydantic-model

Extended thinking enabled configuration.

Show JSON schema:
{
  "description": "Extended thinking enabled configuration.",
  "properties": {
    "type": {
      "const": "enabled",
      "default": "enabled",
      "description": "Thinking is enabled.",
      "title": "Type",
      "type": "string"
    },
    "budget_tokens": {
      "description": "The maximum number of tokens to use for thinking. Minimum is 1024.",
      "title": "Budget Tokens",
      "type": "integer"
    }
  },
  "required": [
    "budget_tokens"
  ],
  "title": "ThinkingConfigEnabledParam",
  "type": "object"
}

Config:

  • extra: ignore

Fields:

type pydantic-field

type: Literal['enabled'] = 'enabled'

Thinking is enabled.

budget_tokens pydantic-field

budget_tokens: int

The maximum number of tokens to use for thinking. Minimum is 1024.

ThinkingConfigDisabledParam pydantic-model

Extended thinking disabled configuration.

Show JSON schema:
{
  "description": "Extended thinking disabled configuration.",
  "properties": {
    "type": {
      "const": "disabled",
      "default": "disabled",
      "description": "Thinking is disabled.",
      "title": "Type",
      "type": "string"
    }
  },
  "title": "ThinkingConfigDisabledParam",
  "type": "object"
}

Config:

  • extra: ignore

Fields:

type pydantic-field

type: Literal['disabled'] = 'disabled'

Thinking is disabled.

Output Configuration

OutputConfigParam pydantic-model

Output configuration for structured responses.

Show JSON schema:
{
  "$defs": {
    "JSONOutputFormatParam": {
      "additionalProperties": false,
      "description": "JSON output format with schema.",
      "properties": {
        "type": {
          "const": "json_schema",
          "default": "json_schema",
          "description": "The type of the output format.",
          "title": "Type",
          "type": "string"
        },
        "schema": {
          "additionalProperties": true,
          "description": "The JSON schema of the format.",
          "title": "Schema",
          "type": "object"
        }
      },
      "required": [
        "schema"
      ],
      "title": "JSONOutputFormatParam",
      "type": "object"
    }
  },
  "description": "Output configuration for structured responses.",
  "properties": {
    "format": {
      "anyOf": [
        {
          "$ref": "#/$defs/JSONOutputFormatParam"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "A schema to specify Claude's output format in responses."
    }
  },
  "title": "OutputConfigParam",
  "type": "object"
}

Config:

  • extra: ignore

Fields:

format pydantic-field

format: JSONOutputFormatParam | None = None

A schema to specify Claude's output format in responses.

JSONOutputFormatParam pydantic-model

JSON output format with schema.

Show JSON schema:
{
  "additionalProperties": false,
  "description": "JSON output format with schema.",
  "properties": {
    "type": {
      "const": "json_schema",
      "default": "json_schema",
      "description": "The type of the output format.",
      "title": "Type",
      "type": "string"
    },
    "schema": {
      "additionalProperties": true,
      "description": "The JSON schema of the format.",
      "title": "Schema",
      "type": "object"
    }
  },
  "required": [
    "schema"
  ],
  "title": "JSONOutputFormatParam",
  "type": "object"
}

Config:

  • extra: forbid
  • populate_by_name: True

Fields:

type pydantic-field

type: Literal['json_schema'] = 'json_schema'

The type of the output format.

schema_ pydantic-field

schema_: dict[str, Any]

The JSON schema of the format.


Response Types

AnthropicMessageResponse pydantic-model

Anthropic Messages API response.

This is a Pydantic model representation of the Anthropic Messages API response, returned by Sequrity's Control API when using the Messages format.

Show JSON schema:
{
  "$defs": {
    "CacheCreation": {
      "additionalProperties": true,
      "description": "Breakdown of cached tokens by TTL.",
      "properties": {},
      "title": "CacheCreation",
      "type": "object"
    },
    "RedactedThinkingBlock": {
      "additionalProperties": true,
      "description": "Redacted thinking content block.",
      "properties": {
        "type": {
          "const": "redacted_thinking",
          "description": "The type of the content block.",
          "title": "Type",
          "type": "string"
        }
      },
      "required": [
        "type"
      ],
      "title": "RedactedThinkingBlock",
      "type": "object"
    },
    "ServerToolUsage": {
      "additionalProperties": true,
      "description": "The number of server tool requests.",
      "properties": {},
      "title": "ServerToolUsage",
      "type": "object"
    },
    "ServerToolUseBlock": {
      "additionalProperties": true,
      "description": "Server tool use content block (e.g., bash, web search).",
      "properties": {
        "type": {
          "const": "server_tool_use",
          "description": "The type of the content block.",
          "title": "Type",
          "type": "string"
        },
        "id": {
          "description": "A unique identifier for this server tool use block.",
          "title": "Id",
          "type": "string"
        },
        "name": {
          "description": "The name of the server tool being used.",
          "title": "Name",
          "type": "string"
        }
      },
      "required": [
        "type",
        "id",
        "name"
      ],
      "title": "ServerToolUseBlock",
      "type": "object"
    },
    "TextBlock": {
      "description": "Text content block in the response.",
      "properties": {
        "type": {
          "const": "text",
          "description": "The type of the content block.",
          "title": "Type",
          "type": "string"
        },
        "text": {
          "description": "The text content.",
          "title": "Text",
          "type": "string"
        },
        "citations": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/TextCitation"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Citations supporting the text block.",
          "title": "Citations"
        }
      },
      "required": [
        "type",
        "text"
      ],
      "title": "TextBlock",
      "type": "object"
    },
    "TextCitation": {
      "additionalProperties": true,
      "description": "Citation supporting a text block.",
      "properties": {
        "type": {
          "description": "The type of citation (e.g., page_location, char_location).",
          "title": "Type",
          "type": "string"
        }
      },
      "required": [
        "type"
      ],
      "title": "TextCitation",
      "type": "object"
    },
    "ThinkingBlock": {
      "description": "Thinking content block showing the model's reasoning process.",
      "properties": {
        "type": {
          "const": "thinking",
          "description": "The type of the content block.",
          "title": "Type",
          "type": "string"
        },
        "text": {
          "description": "The thinking content.",
          "title": "Text",
          "type": "string"
        }
      },
      "required": [
        "type",
        "text"
      ],
      "title": "ThinkingBlock",
      "type": "object"
    },
    "ToolUseBlock": {
      "description": "Tool use content block \u2014 the model wants to call a tool.",
      "properties": {
        "type": {
          "const": "tool_use",
          "description": "The type of the content block.",
          "title": "Type",
          "type": "string"
        },
        "id": {
          "description": "A unique identifier for this particular tool use block.",
          "title": "Id",
          "type": "string"
        },
        "name": {
          "description": "The name of the tool being used.",
          "title": "Name",
          "type": "string"
        },
        "input": {
          "additionalProperties": true,
          "description": "An object containing the input being passed to the tool.",
          "title": "Input",
          "type": "object"
        }
      },
      "required": [
        "type",
        "id",
        "name",
        "input"
      ],
      "title": "ToolUseBlock",
      "type": "object"
    },
    "Usage": {
      "description": "Token usage statistics for the request.",
      "properties": {
        "input_tokens": {
          "description": "The number of input tokens which were used.",
          "title": "Input Tokens",
          "type": "integer"
        },
        "output_tokens": {
          "description": "The number of output tokens which were used.",
          "title": "Output Tokens",
          "type": "integer"
        },
        "cache_creation_input_tokens": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The number of input tokens used to create the cache entry.",
          "title": "Cache Creation Input Tokens"
        },
        "cache_read_input_tokens": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The number of input tokens read from the cache.",
          "title": "Cache Read Input Tokens"
        },
        "cache_creation": {
          "anyOf": [
            {
              "$ref": "#/$defs/CacheCreation"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Breakdown of cached tokens by TTL."
        },
        "server_tool_use": {
          "anyOf": [
            {
              "$ref": "#/$defs/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": [
        "input_tokens",
        "output_tokens"
      ],
      "title": "Usage",
      "type": "object"
    },
    "WebSearchToolResultBlock": {
      "additionalProperties": true,
      "description": "Web search tool result content block.",
      "properties": {
        "type": {
          "const": "web_search_tool_result",
          "description": "The type of the content block.",
          "title": "Type",
          "type": "string"
        }
      },
      "required": [
        "type"
      ],
      "title": "WebSearchToolResultBlock",
      "type": "object"
    }
  },
  "description": "Anthropic Messages API response.\n\nThis is a Pydantic model representation of the Anthropic Messages API response,\nreturned by Sequrity's Control API when using the Messages format.",
  "properties": {
    "id": {
      "description": "Unique object identifier.",
      "title": "Id",
      "type": "string"
    },
    "type": {
      "const": "message",
      "description": "Object type. Always 'message'.",
      "title": "Type",
      "type": "string"
    },
    "role": {
      "const": "assistant",
      "description": "Conversational role of the generated message. Always 'assistant'.",
      "title": "Role",
      "type": "string"
    },
    "content": {
      "description": "Content generated by the model as an array of content blocks.",
      "items": {
        "discriminator": {
          "mapping": {
            "redacted_thinking": "#/$defs/RedactedThinkingBlock",
            "server_tool_use": "#/$defs/ServerToolUseBlock",
            "text": "#/$defs/TextBlock",
            "thinking": "#/$defs/ThinkingBlock",
            "tool_use": "#/$defs/ToolUseBlock",
            "web_search_tool_result": "#/$defs/WebSearchToolResultBlock"
          },
          "propertyName": "type"
        },
        "oneOf": [
          {
            "$ref": "#/$defs/TextBlock"
          },
          {
            "$ref": "#/$defs/ThinkingBlock"
          },
          {
            "$ref": "#/$defs/RedactedThinkingBlock"
          },
          {
            "$ref": "#/$defs/ToolUseBlock"
          },
          {
            "$ref": "#/$defs/ServerToolUseBlock"
          },
          {
            "$ref": "#/$defs/WebSearchToolResultBlock"
          }
        ]
      },
      "title": "Content",
      "type": "array"
    },
    "model": {
      "description": "The model that handled the request.",
      "title": "Model",
      "type": "string"
    },
    "stop_reason": {
      "anyOf": [
        {
          "enum": [
            "end_turn",
            "max_tokens",
            "stop_sequence",
            "tool_use",
            "pause_turn",
            "refusal"
          ],
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The reason the model stopped generating.",
      "title": "Stop Reason"
    },
    "stop_sequence": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Which custom stop sequence was generated, if any.",
      "title": "Stop Sequence"
    },
    "usage": {
      "$ref": "#/$defs/Usage",
      "description": "Billing and rate-limit usage statistics."
    },
    "session_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The Sequrity session ID associated with this response.",
      "title": "Session Id"
    }
  },
  "required": [
    "id",
    "type",
    "role",
    "content",
    "model",
    "usage"
  ],
  "title": "AnthropicMessageResponse",
  "type": "object"
}

Config:

  • extra: ignore

Fields:

id pydantic-field

id: str

Unique object identifier.

type pydantic-field

type: Literal['message']

Object type. Always 'message'.

role pydantic-field

role: Literal['assistant']

Conversational role of the generated message. Always 'assistant'.

content pydantic-field

content: list[ContentBlock]

Content generated by the model as an array of content blocks.

model pydantic-field

model: str

The model that handled the request.

stop_reason pydantic-field

stop_reason: (
    Literal[
        "end_turn", "max_tokens", "stop_sequence", "tool_use", "pause_turn", "refusal"
    ]
    | None
) = None

The reason the model stopped generating.

stop_sequence pydantic-field

stop_sequence: str | None = None

Which custom stop sequence was generated, if any.

usage pydantic-field

usage: Usage

Billing and rate-limit usage statistics.

session_id pydantic-field

session_id: str | None = None

The Sequrity session ID associated with this response.

TextBlock pydantic-model

Text content block in the response.

Show JSON schema:
{
  "$defs": {
    "TextCitation": {
      "additionalProperties": true,
      "description": "Citation supporting a text block.",
      "properties": {
        "type": {
          "description": "The type of citation (e.g., page_location, char_location).",
          "title": "Type",
          "type": "string"
        }
      },
      "required": [
        "type"
      ],
      "title": "TextCitation",
      "type": "object"
    }
  },
  "description": "Text content block in the response.",
  "properties": {
    "type": {
      "const": "text",
      "description": "The type of the content block.",
      "title": "Type",
      "type": "string"
    },
    "text": {
      "description": "The text content.",
      "title": "Text",
      "type": "string"
    },
    "citations": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/TextCitation"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Citations supporting the text block.",
      "title": "Citations"
    }
  },
  "required": [
    "type",
    "text"
  ],
  "title": "TextBlock",
  "type": "object"
}

Config:

  • extra: ignore

Fields:

type pydantic-field

type: Literal['text']

The type of the content block.

text pydantic-field

text: str

The text content.

citations pydantic-field

citations: list[TextCitation] | None = None

Citations supporting the text block.

ThinkingBlock pydantic-model

Thinking content block showing the model's reasoning process.

Show JSON schema:
{
  "description": "Thinking content block showing the model's reasoning process.",
  "properties": {
    "type": {
      "const": "thinking",
      "description": "The type of the content block.",
      "title": "Type",
      "type": "string"
    },
    "text": {
      "description": "The thinking content.",
      "title": "Text",
      "type": "string"
    }
  },
  "required": [
    "type",
    "text"
  ],
  "title": "ThinkingBlock",
  "type": "object"
}

Config:

  • extra: ignore

Fields:

type pydantic-field

type: Literal['thinking']

The type of the content block.

text pydantic-field

text: str

The thinking content.

ToolUseBlock pydantic-model

Tool use content block — the model wants to call a tool.

Show JSON schema:
{
  "description": "Tool use content block \u2014 the model wants to call a tool.",
  "properties": {
    "type": {
      "const": "tool_use",
      "description": "The type of the content block.",
      "title": "Type",
      "type": "string"
    },
    "id": {
      "description": "A unique identifier for this particular tool use block.",
      "title": "Id",
      "type": "string"
    },
    "name": {
      "description": "The name of the tool being used.",
      "title": "Name",
      "type": "string"
    },
    "input": {
      "additionalProperties": true,
      "description": "An object containing the input being passed to the tool.",
      "title": "Input",
      "type": "object"
    }
  },
  "required": [
    "type",
    "id",
    "name",
    "input"
  ],
  "title": "ToolUseBlock",
  "type": "object"
}

Config:

  • extra: ignore

Fields:

type pydantic-field

type: Literal['tool_use']

The type of the content block.

id pydantic-field

id: str

A unique identifier for this particular tool use block.

name pydantic-field

name: str

The name of the tool being used.

input pydantic-field

input: dict[str, Any]

An object containing the input being passed to the tool.

Usage pydantic-model

Token usage statistics for the request.

Show JSON schema:
{
  "$defs": {
    "CacheCreation": {
      "additionalProperties": true,
      "description": "Breakdown of cached tokens by TTL.",
      "properties": {},
      "title": "CacheCreation",
      "type": "object"
    },
    "ServerToolUsage": {
      "additionalProperties": true,
      "description": "The number of server tool requests.",
      "properties": {},
      "title": "ServerToolUsage",
      "type": "object"
    }
  },
  "description": "Token usage statistics for the request.",
  "properties": {
    "input_tokens": {
      "description": "The number of input tokens which were used.",
      "title": "Input Tokens",
      "type": "integer"
    },
    "output_tokens": {
      "description": "The number of output tokens which were used.",
      "title": "Output Tokens",
      "type": "integer"
    },
    "cache_creation_input_tokens": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The number of input tokens used to create the cache entry.",
      "title": "Cache Creation Input Tokens"
    },
    "cache_read_input_tokens": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The number of input tokens read from the cache.",
      "title": "Cache Read Input Tokens"
    },
    "cache_creation": {
      "anyOf": [
        {
          "$ref": "#/$defs/CacheCreation"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Breakdown of cached tokens by TTL."
    },
    "server_tool_use": {
      "anyOf": [
        {
          "$ref": "#/$defs/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": [
    "input_tokens",
    "output_tokens"
  ],
  "title": "Usage",
  "type": "object"
}

Config:

  • extra: ignore

Fields:

input_tokens pydantic-field

input_tokens: int

The number of input tokens which were used.

output_tokens pydantic-field

output_tokens: int

The number of output tokens which were used.

cache_creation_input_tokens pydantic-field

cache_creation_input_tokens: int | None = None

The number of input tokens used to create the cache entry.

cache_read_input_tokens pydantic-field

cache_read_input_tokens: int | None = None

The number of input tokens read from the cache.

cache_creation pydantic-field

cache_creation: CacheCreation | None = None

Breakdown of cached tokens by TTL.

server_tool_use pydantic-field

server_tool_use: ServerToolUsage | None = None

The number of server tool requests.

service_tier pydantic-field

service_tier: Literal['standard', 'priority', 'batch'] | None = None

If the request used the priority, standard, or batch tier.