Skip to main content
Requesty supports sending PDF documents to AI models for analysis, summarization, and question answering. This feature works with both the Chat Completions and Messages API endpoints.
Browse supported models in the Requesty Console.

Supported Models

OpenAI Models

For OpenAI models to support PDF documents, you must use the openai-responses/ prefix instead of the standard openai/ prefix.
  • Supports PDFs: openai-responses/gpt-4.1, openai-responses/gpt-4o, etc.
  • Does NOT support PDFs: openai/gpt-4.1, openai/gpt-4o, etc.
The openai-responses/ prefix enables extended content type support, including PDFs, by using OpenAI’s responses API which handles additional file formats.

Other Providers

Most other model providers (like Anthropic, Google, etc.) support PDFs using their standard prefix format.

How It Works

PDF documents are sent as part of the message content using either base64 encoding or a URL. The AI model can then analyze the document and respond to questions about its contents.

Chat Completions API

Send PDFs using the input_file content type. You can provide the PDF as either base64-encoded data or a URL.

Using Base64-Encoded PDF

Using PDF URL

Parameters

  • type: Must be "input_file"
  • filename: The name of the PDF file (e.g., "document.pdf")
  • mime_type: The MIME type of the file (e.g., "application/pdf"). Required for some providers like Vertex AI
  • file_data: base64-encoded PDF content
  • file_url: Public URL for the requested PDF
Vertex AI: When using file URLs with Vertex AI, you must specify the mime_type field in the request. See Image Understanding for similar requirements with image MIME types.
See the Chat Completions API documentation for more details.

Messages API

Send PDFs using the document 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
See the Messages API documentation for more details.

Working with PDFs

Python Example (Chat Completions)

Python Example (Messages API)

JavaScript/TypeScript Example (Chat Completions)

Last modified on May 26, 2026