Study FAQ
How do I send and validate images in a Claude Messages request?
Also asked as 2
- Which image sources can I use with Claude vision, and what should I check before sending?
- How should I order image and text blocks in a Claude API request and handle invalid images?
Answer
Put approved images in image content blocks with the accompanying text in the intended order. On the first-party Claude API, documented source types are base64 inline data, an image URL, and a Files API file_id. For Amazon Bedrock and Claude Models on Google Cloud (Google managed), the vision docs require base64. Check exact support and policy for your model, provider, and request mode before sending.
- Confirm the task needs visual information. Use data your application already has in structured form when it meets the need.
- Check that the caller may submit the image and that the content, destination, and retention are allowed. Validate JPEG, PNG, GIF, or WebP with the matching media type where the source requires it. Animated images use the first frame.
- Check per-image bytes and dimensions, total image count including resent history, and total request size against the provider and model limits. A request with many images can have a stricter dimension limit. Resize or crop carefully to keep required text and visual context legible.
- Keep related images and text ordered. Images before the question are a useful starting point. Label multiple images if the answer needs to identify each one.
- Handle inaccessible URLs, unsupported sources, unreadable images, and unreliable interpretations explicitly. Validate the result and ask for a clearer source when needed.
Image input can be used with eligible complete, streaming, or batch requests. Image input changes what you send. The delivery mode determines when and how you receive the answer.
Official references
Full explanation
Choosing Claude API Workload Modes for Vision, Thinking, and Batch Processing
Study guide · CCDV-F
Read the full explanation