Skip to content

Generated files

generated_files

Generated files resource group (assistant tool-use outputs).

Wraps the /v1/compliance/apps/chats/generated-files/{claude_gen_file_id} endpoints for metadata and download of files the assistant produced via tool use (PDFs, spreadsheets, etc.). These live in the per-conversation Filestore — a distinct backend from user-uploaded files — and have no DELETE endpoint. The server rejects any deletion attempt.

GeneratedFile dataclass

Metadata for one assistant-generated file.

The owning chat is included on the metadata because the generated-file id is opaque; locate the specific message that produced the file by fetching messages on claude_chat_id and matching against the message's generated_files references.

Attributes:

Name Type Description
id str

Opaque generated-file id (claude_gen_file_...).

filename str

Display name.

claude_chat_id str

Owning chat's tagged ID.

mime_type str | None

MIME type as recorded by Filestore, when known.

size_bytes int | None

Size in bytes as recorded by Filestore, when known.

created_at str | None

RFC 3339 creation timestamp from Filestore, or None when not recorded.

extra dict[str, Any]

Any additional fields the API adds in a later revision.

from_dict classmethod

from_dict(body: Mapping[str, Any]) -> 'GeneratedFile'

Build a GeneratedFile from one decoded record.

GeneratedFiles

Synchronous client for assistant-generated compliance files.

get

get(claude_gen_file_id: str) -> GeneratedFile

Fetch metadata without downloading the bytes.

download

download(claude_gen_file_id: str) -> bytes

Eager download bounded by max_download_bytes.

download_to_file

download_to_file(
    claude_gen_file_id: str, dest: PathLike
) -> None

Stream the file to dest (unbounded).

download_stream

download_stream(claude_gen_file_id: str) -> Iterator[bytes]

Yield response chunks to the caller.

AsyncGeneratedFiles

Asynchronous client for assistant-generated compliance files.

get async

get(claude_gen_file_id: str) -> GeneratedFile

Async analogue of get.

download async

download(claude_gen_file_id: str) -> bytes

Async analogue of download.

download_to_file async

download_to_file(
    claude_gen_file_id: str, dest: PathLike
) -> None

Async analogue of download_to_file.

download_stream

download_stream(
    claude_gen_file_id: str,
) -> AsyncIterator[bytes]

Async analogue of download_stream.