Skip to content

ClaudeApiMessage

Base classes

Name Children Inherits
BaseModel
pydantic.main
!!! abstract "Usage Documentation"

⋔ Inheritance diagram

graph TD
  4223474395["models.ClaudeApiMessage"]
  3879467795["main.BaseModel"]
  2751680898["builtins.object"]
  3879467795 --> 4223474395
  2751680898 --> 3879467795

🛈 DocStrings

Bases: BaseModel

Claude API assistant message structure.

Source code in src/clawd_code_sdk/storage/models.py
class ClaudeApiMessage(BaseModel):
    """Claude API assistant message structure."""

    model_config = ConfigDict(extra="allow")

    model: str
    id: str
    type: Literal["message"] = "message"
    role: Literal["assistant"]
    content: str | Sequence[AssistantContentBlock]
    stop_reason: StopReason | None = None
    stop_sequence: str | None = None
    usage: ClaudeUsage = Field(default_factory=ClaudeUsage)
    container: dict[str, Any] | None = None
    """Code execution container info, if the response used one."""
    stop_details: dict[str, Any] | None = None
    context_management: dict[str, Any] | None = None
    """Context edits the API applied (e.g. cleared tool results)."""
    diagnostics: dict[str, Any] | None = None
    """API diagnostics such as ``cache_miss_reason``."""
    input_transformations: list[dict[str, Any]] | None = None
    """Transformations the API applied to the request input."""

container class-attribute instance-attribute

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

Code execution container info, if the response used one.

context_management class-attribute instance-attribute

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

Context edits the API applied (e.g. cleared tool results).

diagnostics class-attribute instance-attribute

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

API diagnostics such as cache_miss_reason.

input_transformations class-attribute instance-attribute

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

Transformations the API applied to the request input.

:fa-brands-github: Show source on GitHub