Overview
Vision models can analyze images alongside text. LiteLLM provides a unified interface for vision capabilities across multiple providers including OpenAI, Anthropic, Google, and more.Quick Start
Image Input Methods
- URL
- Base64
- Local File
Reference images via URL.
Multiple Images
Process multiple images in a single request.Provider Support
- OpenAI
- Anthropic
- Google Gemini
- Ollama
GPT-4o and GPT-4 Turbo with vision.
Image Detail Level
Control how the model processes images (OpenAI models).- low: Faster, lower cost, less detail (512x512)
- high: Slower, higher cost, more detail (2048x2048)
- auto: Model decides based on image size
Common Use Cases
- Image Description
- OCR / Text Extraction
- Object Detection
- Image Comparison
- Chart Analysis
Streaming with Vision
Multi-turn Vision Conversations
JSON Mode with Vision
Get structured output from image analysis.Error Handling
Supported Image Formats
- JPEG -
.jpg,.jpeg - PNG -
.png - WebP -
.webp - GIF -
.gif(non-animated)
Format support varies by provider. OpenAI and Anthropic support all common formats.
Image Size Limits
Best Practices
Image Quality
Image Quality
- Use high-quality images for better results
- Ensure images are clear and well-lit
- Crop images to focus on relevant content
- Use appropriate resolution (not too low or unnecessarily high)
Cost Optimization
Cost Optimization
- Use
detail="low"for simple image tasks - Resize large images before sending
- Use URLs instead of base64 when possible
- Consider using cheaper models for simple vision tasks
Prompt Design
Prompt Design
- Be specific about what you want to extract
- Ask direct questions about the image
- Use examples when requesting specific formats
- Break complex tasks into multiple queries
Performance
Performance
- Cache images when used multiple times
- Use streaming for long descriptions
- Process multiple images in parallel when independent
- Consider batch processing for many images