CCDV-F Domain 4: Vision & Multi-Modal Integration
Passing images to the Messages API, base64 payload structure, supported media formats, token cost estimation, and document extraction best practices.
1. Vision Content Block Schema
Claude 3 and 3.5 models natively accept images within the content array of a message object:
{
"role": "user",
"content": [
{
"type": "image",
"source": {
"type": "base64",
"media_type": "image/jpeg",
"data": "/9j/4AAQSkZJRgABAQEASABIAAD..."
}
},
{
"type": "text",
"text": "Transcribe the financial table from this receipt image into CSV format."
}
]
}
2. Supported Image Formats & Size Limits
- Supported Media Types:
image/jpeg,image/png,image/gif, andimage/webp. - Size Limits: Up to 5 MB per image for base64 encoded strings (or up to 100 images per request in batch arrays).
- Resolution: Optimal resolution is between 1500px and 2000px on the longest edge. Downscale massive multi-megapixel images before base64 encoding to conserve tokens and reduce upload latency.
3. Vision Token Calculation
Token Estimation Formula
Claude calculates image token consumption based on pixel dimensions:
Tokens ≈ (Width × Height) / 750
For a typical 1000×1500 px image, expect approximately 2,000 input tokens.