Claude API Image Input: Multimodal Support Guide
Does the Claude API support image input?
Yes. Claude's API supports multimodal input, meaning you can send images alongside text in the same request and get back a text response that reasons about what's in the image. This works through the standard /v1/messages endpoint — there's no separate "vision endpoint." You just add an image content block to your message array next to your text block, and Claude's current models (the ones with vision capability) will process both together.
This is useful for a wide range of real products: reading screenshots for bug reports, extracting data from scanned invoices or receipts, describing product photos for e-commerce listings, analyzing charts and diagrams, transcribing handwritten notes, or building accessibility tools that describe images for visually impaired users. The rest of this article covers exactly how the request format works, what limits apply, and common mistakes to avoid.
How image input works in the Claude API
Instead of sending a plain string as the content of a user message, you send an array of content blocks. One block has type: "text", another has type: "image". Claude reads them together as a single turn.
An image block needs a source object with three fields:
type: usually"base64"(you can also reference images by URL in some integrations, but base64 is the universal method)media_type: the image's MIME type, e.g.image/png,image/jpeg,image/webp,image/gifdata: the base64-encoded image bytes (no data URI prefix, just the raw base64 string)
Here's a minimal example using the direct Claude API format:
{
"model": "claude-sonnet-4",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": [
{
"type": "image",
"source": {
"type": "base64",
"media_type": "image/jpeg",
"data": "/9j/4AAQSkZJRgABAQEA..."
}
},
{
"type": "text",
"text": "What's wrong with this chart? Be specific."
}
]
}
]
}
A few practical rules:
- Order matters for clarity, not correctness. Putting the image before the text usually reads more naturally to the model when you're asking it to describe or analyze the image, but Claude handles either order.
- You can send multiple images in one message. This is useful for comparisons ("what changed between these two screenshots?") or multi-page documents.
- Each image counts toward your token usage. Larger images and higher resolution cost more tokens, roughly proportional to pixel count after internal resizing.
Sending images with curl
A common pattern is reading a local file, base64-encoding it, and inlining it into the JSON payload:
IMAGE_B64=$(base64 -i screenshot.png | tr -d '\n')
curl https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-sonnet-4",
"max_tokens": 1024,
"messages": [{
"role": "user",
"content": [
{"type": "image", "source": {"type": "base64", "media_type": "image/png", "data": "'"$IMAGE_B64"'"}},
{"type": "text", "text": "Extract the total and date from this receipt."}
]
}]
}'
If you're routing requests through SubToAPI instead of calling Anthropic directly, the message format is identical — SubToAPI passes through the same /v1/messages structure, so your image content blocks work without modification:
curl https://api.subtoapi.app/v1/messages \
-H "Authorization: Bearer $SUBTOAPI_KEY" \
-H "content-type: application/json" \
-d '{
"model": "claude-sonnet-4",
"max_tokens": 1024,
"messages": [{
"role": "user",
"content": [
{"type": "image", "source": {"type": "base64", "media_type": "image/png", "data": "'"$IMAGE_B64"'"}},
{"type": "text", "text": "Extract the total and date from this receipt."}
]
}]
}'
This matters if your team already has API keys managed through a dashboard and wants usage metadata per request without re-architecting the integration — see /docs/messages for the full request reference.
Limits and practical constraints
Keep these in mind before building image features:
- File size: individual images are capped (typically a few megabytes after base64 encoding). Compress or resize large photos before sending.
- Resolution: Claude internally downsamples very large images. Sending a 4000px-wide screenshot doesn't improve accuracy over a reasonably sized one and just burns tokens.
- Supported formats: JPEG, PNG, GIF (non-animated), and WebP are supported. PDFs are handled differently — some integrations support PDF input directly, but if yours doesn't, convert pages to images first.
- No image generation: this is image input only. Claude describes, analyzes, and reasons about images — it doesn't generate or edit them.
- Multiple images per conversation: there's a cap on total images per request (commonly around 20, but check current model documentation), which is plenty for document comparison or multi-page analysis.
Building a practical image-analysis feature
A typical pattern for a web app:
- User uploads an image client-side.
- Your backend converts it to base64 (or receives it already base64-encoded from the browser's
FileReader). - Your backend sends the request to Claude with a task-specific prompt — "describe this," "extract these five fields," "flag anything that looks like a safety issue."
- You parse the text response, optionally asking Claude to return structured JSON for easier downstream handling.
async function analyzeImage(base64Data, mimeType, question) {
const response = await fetch("https://api.subtoapi.app/v1/messages", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.SUBTOAPI_KEY}`,
"content-type": "application/json",
},
body: JSON.stringify({
model: "claude-sonnet-4",
max_tokens: 1024,
messages: [{
role: "user",
content: [
{ type: "image", source: { type: "base64", media_type: mimeType, data: base64Data } },
{ type: "text", text: question },
],
}],
}),
});
return response.json();
}
If you need this analysis to trigger follow-up actions — like filing a ticket when a screenshot shows an error, or looking up a product SKU from a photo — pair image input with tool use. Claude can look at an image and decide to call a function based on what it sees; see /docs/tools for how that combination works, and /docs/quickstart if you're setting up API access for the first time.
For teams evaluating whether to route image-analysis traffic through a managed gateway, SubToAPI's plans (Solo, Team, Scale — see /pricing) include the same streaming and usage metadata for multimodal requests as text-only ones, so switching doesn't require separate billing logic for vision features. You can test the full flow during the free trial at /signup.
questions
Can I send an image by URL instead of base64? The core Claude API expects base64-encoded image data in the source.data field. If you only have a URL, fetch the image server-side, base64-encode it, and include it in the request — don't send the raw URL as the data value.
Does image input cost more than text-only requests? Images consume tokens based on their resolution after internal resizing, so a request with an image typically uses more input tokens than text alone. Resize large images before sending to control cost.
Can Claude read text inside an image, like a screenshot or scanned document? Yes, Claude can read and transcribe text visible in images, including UI screenshots, handwritten notes, and scanned documents, as part of its vision capability — just ask for the specific text or fields you need extracted.