Skip to contents

Upload a file to Anthropic's storage for use across multiple conversations.

Usage

claude_file_upload(path, ...)

Arguments

path

Character. Path to the file to upload.

...

Additional arguments passed to ellmer::claude_file_upload().

Value

A file object with id, filename, mime_type, size_bytes.

Details

Requires beta header files-api-2025-04-14. Files persist until deleted.

Supported file types:

  • PDFs: application/pdf

  • Images: image/jpeg, image/png, image/gif, image/webp

  • Plain text: text/plain

Limits:

  • Maximum file size: 500 MB

  • Total storage: 100 GB per organization

API Reference: https://platform.claude.com/docs/en/build-with-claude/files

Examples

if (FALSE) { # \dontrun{
# Upload a PDF
file <- claude_file_upload("report.pdf")
file$id
file$filename
file$size_bytes

# Use in conversation
chat <- claude_new()
chat$chat(claude_file_content(file$id), "Summarize this document")
} # }