/chat/completions API. PDFs can be sent as direct URLs or base64-encoded data URLs in the messages array, using the
file content type. This works on all models, even if the model doesn’t natively support PDFs.
URLs are preferred for large files since they avoid payload bloat.Use base64 encoding when working with local or private files.
Using PDF URLs
For publicly accessible PDFs, send the file URL directly:Using Base64-Encoded PDFs
For local or private PDFs, encode to base64 and send as a data URL:Was this page helpful?