How It Works
PDF documents are sent as part of the message content using base64 encoding. The AI model can then analyze the document and respond to questions about its contents.Chat Completions API
Send PDFs using thefile_input
content type:
Parameters
type
: Must be"file_input"
filename
: The name of the PDF file (e.g.,"document.pdf"
)file_data
: Base64-encoded PDF content
Messages API
Send PDFs using thedocument
content type:
Parameters
type
: Must be"document"
source.type
: Must be"base64"
source.media_type
: Must be"application/pdf"
source.data
: Base64-encoded PDF content