Image Analysis
Analyze images using vision models through the Perplexity Agent API, then enrich the analysis with web search to provide real-world context. This example combines image understanding with live information retrieval in a two-step pipeline: identify what is in the image, then research the identified subjects.Features
- Upload images via base64 encoding or public HTTPS URL
- Analyze images with vision-capable models like
openai/gpt-5.4through the Agent API - Combine image analysis with web search for context enrichment
- Two-step pipeline: identify, then research
- Support for PNG, JPEG, WEBP, and GIF formats
Installation
Usage
Full Code
Example Output
Vision input is supported on the Agent API via the
input_image content type. Use a vision-capable model like openai/gpt-5.4. Check the Agent API Image Attachments docs for supported formats and size limits.Limitations
- Image analysis requires a vision-capable model (e.g.,
openai/gpt-5.4). Not all models supportinput_image. - Web search quality in Step 2 depends on identification accuracy in Step 1.
- Only publicly accessible HTTPS URLs work for URL-based input. Private URLs will fail.
- Animated GIFs are supported but only the first frame is analyzed.