Skip to main content

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

Reference images via URL.

Multiple Images

Process multiple images in a single request.

Provider Support

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

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

  • 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)
  • 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
  • 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
  • Cache images when used multiple times
  • Use streaming for long descriptions
  • Process multiple images in parallel when independent
  • Consider batch processing for many images

Limitations

  • Vision models may hallucinate details not present in images
  • Text recognition accuracy varies
  • Some models have restrictions on certain image types
  • Privacy: Be cautious with sensitive images