Image Understanding
Send images to AI models for analysis and understanding via the chat completions endpoint.
How It Works
Vision-capable models use the same /v1/chat/completions endpoint as text models, but they accept images inside the message content. You can include an image as a data URL or a file URL, or reference a remote image by URL.
Request Format
OneRoute supports two ways to send images:
Method 1: Data URL (Base64)
curl https://gw.1route.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ONEROUTE_API_KEY" \
-d '{
"model": "openai/gpt-4o",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What is in this image?"
},
{
"type": "image_url",
"image_url": {
"url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."
}
}
]
}
]
}'
Method 2: File URL
curl https://gw.1route.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ONEROUTE_API_KEY" \
-d '{
"model": "anthropic/claude-sonnet-4-5",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Describe this image in detail"
},
{
"type": "image_url",
"image_url": {
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/Atlantic_near_Faroe_Islands.jpg/1200px-Atlantic_near_Faroe_Islands.jpg"
}
}
]
}
]
}'
Vertex AI Gemini models: when using a file URL with Vertex AI Gemini, you must specify the MIME type:
{
"type": "image_url",
"image_url": {
"mime_type": "image/jpg",
"url": "https://example.com/image.jpg"
}
}
Response Format
{
"model": "openai/gpt-4o",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The image shows a beautiful sunset over mountain ranges..."
}
}
]
}
Supported Models
Common vision-capable models include:
- OpenAI: GPT models, o3, o3-pro, and all o4 reasoning models
- Anthropic: Claude 4 and 4.5 models
- Google: Gemini 2.5 models
- xAI: Grok 4 models
Provider Notes
- Most providers support both data URLs and file URLs.
- Google AI Studio (Gemini) supports data URLs only (base64-encoded images).
- Vertex AI Gemini requires a MIME type in the request.
Limitations
- Image size limits vary by provider and model.
- File URLs must be publicly accessible.
- Base64 data URLs increase the request payload size.
- Image analysis responses may take longer than pure-text requests.