Vision — the ability to include images alongside text in a request — is part of Claude's core Messages API, and Microsoft lists image support among the capabilities documented for both Foundry hosting versions ("Hosted on Azure" and "Hosted on Anthropic infrastructure"). Since Foundry exposes the standard Claude API at https://<resource>.services.ai.azure.com/anthropic/v1/messages, image requests look exactly like they do on the first-party API: an image content block inside a user message, sitting next to your text.
The encoding pattern
The most portable pattern is base64: read the image bytes, encode them, and embed them in the content block with the correct media type. Base64 is a way of representing binary data as plain text so it can travel inside a JSON request body.
import base64
from anthropic import AnthropicFoundry
client = AnthropicFoundry(api_key="...", resource="example-resource")
with open("invoice.png", "rb") as f:
data = base64.standard_b64encode(f.read()).decode()
msg = client.messages.create(
model="claude-sonnet-5", # your deployment name
max_tokens=1024,
messages=[{"role": "user", "content": [
{"type": "image", "source": {"type": "base64",
"media_type": "image/png", "data": data}},
{"type": "text", "text": "Extract vendor, date, and total."},
]}],
)
print(msg.content[0].text)
Set media_type to match the actual file format; check the official Claude documentation for the current list of accepted image formats. A common failure mode is mislabeling the media type (for example, a JPEG declared as PNG), which produces a request error rather than a silent fix.
Limits worth knowing
- Images per request: a single request can include up to 600 images or PDF pages on 1M-context models, and up to 100 on 200K-context models (such as Haiku 4.5). On Foundry, the 1M-context models include Claude Fable 5, Opus 4.8, Sonnet 5, and Sonnet 4.6.
- Resolution: recent models (Opus 4.7 and later, Sonnet 5) support high-resolution images up to 2576 pixels on the long edge — up from 1568 previously — at up to roughly 3x more image tokens per image. Sharper input costs more tokens.
- Images are input tokens. Every image counts toward the context window and toward Foundry's uncached-input-tokens-per-minute (ITPM) rate limit. Image-heavy workloads hit ITPM ceilings far sooner than text-only ones — relevant when pay-as-you-go defaults start at 40,000 ITPM for Opus-family and Sonnet 5 deployments.
- Request size: hundreds of base64 images make very large HTTP bodies. Downscale images to the smallest size that preserves the detail you need before encoding; you pay tokens for pixels the task does not require.
Foundry-specific considerations
Two things differ from the first-party API. First, the model parameter is your deployment name (which defaults to the bare model ID like claude-sonnet-5 but may have been customized at deployment time). Second, data handling depends on your hosting choice: for "Hosted on Azure" deployments, Microsoft states that prompts and outputs — including your images — are processed on Azure infrastructure, with data at rest staying in the selected Azure geography; "Hosted on Anthropic infrastructure" deployments may process data outside Azure. For workloads involving sensitive documents, this hosting-version distinction is often the deciding factor, and you should confirm specifics against your provider's current documentation.
Also note that Claude vision reads and reasons about images; it does not return images. For document pipelines, the usual pattern is image in, structured JSON out — combine this article with schema-shaped output techniques.
Cost and throughput planning for image workloads
Budget image pipelines the same way you budget text: everything is input tokens at the model's standard rate, billed on Foundry in Claude Consumption Units through Azure Marketplace. Two planning levers matter most. First, model choice — an extraction task that Haiku 4.5 handles at $1 per million input tokens does not need Opus 4.8 at $5; run a sample set through both and compare accuracy before defaulting to the bigger model. Second, prompt caching — the images themselves change per request, but a long, stable system prompt describing your extraction rules is exactly the kind of prefix worth caching, and cache reads do not count against your ITPM rate limit.
Where to go next
Pair vision with structured JSON output on Foundry for extraction pipelines, and see vision for documents for platform-neutral patterns. If you are just getting set up, start at your first API call on Foundry.