Images and files
Send images and PDF files to models that accept them, and stay within the request size limit.
Models that accept more than text list it in architecture.input_modalities of GET /api/v1/models; the catalog can filter by input. Send content parts in a user message, in the OpenAI format.
Images
{
"model": "google/gemma-3-4b-it",
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "What is in this picture?" },
{ "type": "image_url", "image_url": { "url": "https://example.com/photo.jpg" } }
]
}
]
}url may also be a data URL: data:image/png;base64,….
Files
{ "type": "file", "file": { "filename": "invoice.pdf", "file_data": "data:application/pdf;base64,…" } }Size and cost
- A request body may be at most 4 MiB. Base64 makes a file a third larger: prefer a public URL for large images.
- Images and files are billed as input tokens at the model's prices.
- Before the request, funds are reserved by the size of the whole body, so a large base64 file needs a larger available balance even when its final cost is small.
The router does not check that a model accepts images: a model without the input answers with an error or ignores the part. Check input_modalities first.