Skip to main content

Vision & Image Input

Vision-capable chat models accept images alongside text. This is distinct from the dedicated image analysis / OCR services, which are purpose-built endpoints for document and image understanding.

Passing an image to a chat model​

Use the provider-native content-block shape; Primex forwards it unchanged.

Chat Completions (/v1/chat/completions):

{
"model": "YOUR_VISION_MODEL",
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "What's in this image?"},
{"type": "image_url", "image_url": {"url": "https://example.com/photo.jpg"}}
]
}]
}

Responses (/v1/responses) uses input with input_text and input_image blocks instead:

{
"model": "YOUR_LIVE_RESPONSES_VISION_MODEL",
"input": [{
"role": "user",
"content": [
{"type": "input_text", "text": "What's in this image?"},
{"type": "input_image", "image_url": "https://example.com/photo.jpg"}
]
}]
}

See the OpenAI image-input guide for the protocol shapes.

Anthropic-compatible (/v1/messages) uses image content blocks (base64 or URL source). Only models advertising the vision capability accept image input. Check the model's catalogue entry.

Using a Files API file_id​

Instead of a public URL or inline base64, you can upload the image once through the Files API and reference it. Primex resolves the file_id to a short-lived read URL server-side before forwarding, so your image never needs to be publicly hosted. Use purpose VISION_INPUT and place file_id on the image block: {"type": "image_url", "file_id": "YOUR_FILE_ID"} for Chat Completions or {"type": "input_image", "file_id": "YOUR_FILE_ID"} for Responses.

Multiple images​

Vision chat models accept several image blocks in one message. For image generation models that take reference images, attaching multiple images composes them; models that take one reference use the first and note any extras in the reply. See Images.

Billing​

Image input is metered by the provider's reported image/input tokens for that model, at the model's catalogue rate. See Billing & Credits.