Documents
Send PDFs and documents to document-understanding models
Gateway supports sending PDF documents to models with document input capability. Pass documents as base64-encoded data or a URL, and Gateway handles the provider-specific format translation.
Send a document (base64)
AI SDK file parts require merge-gateway-ai-sdk-provider 0.3.0 or later. Earlier
versions dropped every file part — documents and images alike — without an error.
data may be bytes, a base64 string, a data: URI, or a URL.
Send a document (URL)
Supported models
Document input is supported by models with "document" in their capabilities.input array. Check model capabilities via GET /v1/models, or filter by input type in the model catalog.
Documents are estimated at ~1,500 tokens per page for compression calculations. A 10-page PDF counts as roughly 15,000 tokens toward the context window.