Guides · Vision
Vision: send images to open models, processed in the EU
Vision models read images as well as text. You can ask them to describe a photo, read a receipt, compare two screenshots, check a form or answer questions about a chart. Images are sent in the same chat request as text, in the OpenAI or Anthropic format, and are processed in European data centres, which matters when they show documents, people or customer data.
- 01API format: OpenAI and Anthropic
- 02EU data centres
- 03Covered by one DPA
import base64, os
from openai import OpenAI
client = OpenAI(base_url="https://api.inference.eu/v1", api_key=os.environ["INFERENCE_EU_API_KEY"])
with open("receipt.jpg", "rb") as f:
image = base64.b64encode(f.read()).decode()
reply = client.chat.completions.create(
model="mistral-small-3.2-24b-instruct",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "List the items, the VAT rate and the total on this receipt."},
{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{image}"}},
],
}],
max_tokens=500,
)
print(reply.choices[0].message.content)How to send an image
Choose a vision-capable model, such as mistral-small-3.2-24b-instruct, and make the user message content a list of parts instead of a string. A text part carries your question; an image_url part carries the image, either as a public HTTPS URL or as a data URL with base64 content, as in the example. You can mix several images and text parts in one message.
The answer comes back as normal text in choices[0].message.content. With the Anthropic Messages format, use an image content block with a base64 or url source instead. With the Responses API, use an input_image item.
Image size, detail and tokens
Images are converted to tokens before the model reads them, and larger images produce more tokens. That affects cost, speed and how much of the context window remains for text. Resize images to what the task needs: a photo for a general description can be small, while a dense invoice or a screenshot of a table needs enough resolution for the text to stay legible.
Use JPEG for photos and PNG for screenshots and documents with sharp text. Crop to the relevant area where you can. The detail field on image_url is accepted for compatibility; how it changes processing depends on the model.
Practical patterns
Receipts and invoices: send the image with a JSON schema in response_format to get supplier, date, items and totals as structured data. Screenshots: ask a model to describe a UI bug, read an error dialog or compare a design with the built page. Quality checks: show a product photo and ask whether a label is present and readable.
For multi-page PDFs, it is often better to convert the document to Markdown first with the document conversion tool and send text, using vision only for pages with charts or handwriting. Text is cheaper per page and easier to search, cite and store.
Errors and edge cases
Sending an image to a text-only model returns a 400 error saying the model does not accept images; check the model page or GET /v1/models. Image URLs must be publicly reachable over HTTPS; private links, expiring links and pages that need a login fail, so send base64 instead. Very large files can exceed the request size limit, so compress them first.
Vision models can misread small print, handwriting and numbers, and they may describe what they expect rather than what is there. For anything that matters, such as amounts on an invoice, validate the values and keep a person in the loop. Do not use vision models to identify people.
Vision: common questions
The questions buyers, developers and legal teams ask us most. Something missing? Ask us directly.
Related
- Chat completionsSend chat messages to open-weight models with the OpenAI chat completions format. Requests are processed in EU data centres and never used for training.Endpoints
- Document conversionConvert PDF, Word, PowerPoint and Excel files to clean Markdown for RAG and LLM prompts. Tables, headings and scanned pages, processed in the EU.Tools
- Structured outputsGet valid JSON that matches your schema from open models with OpenAI-compatible structured outputs. JSON mode, json_schema, strict mode and pitfalls.Guides
- Image generationGenerate images from text prompts with an OpenAI-compatible images API. Open image models such as FLUX.1 schnell, processed in EU data centres.Endpoints
Move your AI workloads to EU infrastructure
Tell us which models you use and roughly how much traffic you have. We reply within one working day with pricing and next steps.
- Reply within one working day
- Pricing for your volume
- DPA ready to sign