Skip to navigation

Documents

Send PDFs to document-understanding models

Send a PDF with your prompt to have a model summarize, answer questions about, or extract from it. Pass it as base64 or a URL in a document block; Gateway converts it to the served vendor’s format.

curl https://api-gateway.merge.dev/v1/responses \
-H "Authorization: Bearer $MERGE_GATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/gemini-3.6-flash",
"input": [{
"type": "message",
"role": "user",
"content": [
{"type": "text", "text": "What are the key findings?"},
{"type": "document", "source_type": "url", "media_type": "application/pdf", "data": "https://example.com/report.pdf"}
]
}]
}'

AI SDK file parts need merge-gateway-ai-sdk-provider 0.3.0 or later; earlier versions drop them silently.

Reference

FieldNotes
source_typebase64 (default) or url
media_typeRequired, such as application/pdf
dataBase64 string, or the URL when source_type is url

Inline documents are capped at 20 MB decoded per request, all documents combined; URLs don’t count. Over the cap returns 413 payload_too_large, and a route without document input returns 400 unsupported_params. Filter by document input in the model catalog.

Next steps