← Blog

Claude API Image Input: Vision Support Explained

2026-10-14 · 5 min read · SubToAPI Team

Does the Claude API support image input?

Yes. Claude's vision-capable models accept images alongside text in the same message, and you can send them as base64-encoded data or as a URL reference depending on which models and which gateway you're using. This lets you build apps that read screenshots, analyze charts, extract text from scanned documents, describe photos, or compare multiple images in a single request — all through the same /messages-style endpoint you already use for text.

Vision support in Claude is not a separate API. You add an image content block to the same content array you'd use for text, and the model treats the image as part of the conversation context. There's no separate "vision endpoint," no special billing tier beyond normal token usage, and no fine-tuning step required. This article covers the practical details: supported formats, size limits, how to structure multi-image requests, and common gotchas.

Supported image formats and limits

Claude's vision models currently support:

Practical limits to keep in mind:

Sending an image with curl (base64)

The most common pattern is base64-encoding the image and embedding it directly in the request body:

IMAGE_B64=$(base64 -w 0 chart.png)

curl https://api.subtoapi.app/v1/messages \
  -H "Authorization: Bearer $SUBTOAPI_KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"model\": \"claude-sonnet-4\",
    \"max_tokens\": 500,
    \"messages\": [
      {
        \"role\": \"user\",
        \"content\": [
          {
            \"type\": \"image\",
            \"source\": {
              \"type\": \"base64\",
              \"media_type\": \"image/png\",
              \"data\": \"$IMAGE_B64\"
            }
          },
          {
            \"type\": \"text\",
            \"text\": \"What trend does this chart show, and what's the peak value?\"
          }
        ]
      }
    ]
  }"

Note the order: image blocks typically go before the text block that references them, though Claude handles either order reasonably well. The key structural point is that content is an array mixing block types, not a single string.

Sending an image in JavaScript

const fs = require("fs");

const imageBase64 = fs.readFileSync("screenshot.jpg", { encoding: "base64" });

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: 400,
    messages: [
      {
        role: "user",
        content: [
          {
            type: "image",
            source: {
              type: "base64",
              media_type: "image/jpeg",
              data: imageBase64,
            },
          },
          { type: "text", text: "Extract all visible text from this screenshot as plain text." },
        ],
      },
    ],
  }),
});

const data = await response.json();
console.log(data.content[0].text);

This same pattern works for OCR, UI bug triage from screenshots, receipt parsing, or diagram explanation — the prompt text is what changes, not the request shape.

Comparing multiple images in one request

Vision gets more interesting when you send several images and ask Claude to reason across them:

content: [
  { type: "image", source: { type: "base64", media_type: "image/png", data: beforeImg } },
  { type: "image", source: { type: "base64", media_type: "image/png", data: afterImg } },
  { type: "text", text: "Compare these two UI screenshots and list every visual difference." }
]

This works well for before/after design reviews, diffing two versions of a dashboard, or checking whether a generated chart matches a spec. Keep image count reasonable — stacking a dozen large images into one message inflates both latency and token cost fast.

Combining vision with tool use

Image input composes naturally with Claude's tool use. A common pattern: Claude reads a photo of a whiteboard or invoice, extracts structured data, then calls a function to save it. If you're building that kind of pipeline, pair this with Claude's tool calling support so the model can both interpret the image and act on what it extracts — for example emitting a JSON object matching a schema, then triggering a webhook or database write in your app logic.

Why gate image input behind an API gateway

If you're shipping vision features to end users rather than just prototyping locally, routing image requests through a gateway like SubToAPI gives you a few practical advantages over calling the model directly:

Check the quickstart for the minimal setup, and the Messages API reference for the full content block schema. Plans start with a free trial at signup; see pricing for Solo, Team, and Scale tiers if you're moving past prototyping into production image workloads.

Common mistakes to avoid

Questions

Can Claude read text inside an image, like a screenshot or scanned document? Yes — this is one of the most common vision use cases. Claude performs reasonably accurate OCR-style text extraction directly from image input, no separate OCR service needed.

Does sending an image cost more than a text-only request? Images consume tokens based on resolution, so a large or high-res image can cost noticeably more than a short text prompt. Resizing images before upload is the main lever for controlling this.

Can I send an image by URL instead of base64? Support for URL-based image sources varies by provider and gateway configuration — base64 encoding is the most universally supported method and is recommended if you want predictable, portable requests.

Turn your Claude access into an HTTPS API

SubToAPI gives you application API keys, streaming, tool use and usage insights on top of your existing Claude access — set up in minutes.

Start free  Read the quickstart →