Anthropic Image Inputs Need a Size and Dimension Gate
Anthropic image requests have platform, count, byte, and pixel constraints. The first-party Claude API currently permits images up to 8,000 by 8,000 pixels and 10 MB base64-encoded, while requests above 20 image or document blocks need a stricter dimension rule. A gateway should inspect the final request, resolve destination-specific limits, and choose deliberate downsize or error behavior.

Anthropic evaluates image inputs against several limits at once. On the first-party Claude API, current documentation sets an 8,000 by 8,000 pixel maximum and a 10 MB base64-encoded maximum for each image. Requests containing more than 20 image or document blocks enter a stricter dimension regime.
I want a gateway to resolve those constraints before upload or Messages dispatch. Waiting for a provider error wastes bandwidth and leaves resize behavior to whichever client happened to serialize the request.
TL;DR
- Count every image block in the final request, including prior turns and images nested inside tool results.
- Enforce platform-specific encoded-byte limits and inspect decoded format and pixel dimensions.
- Keep requests above 20 relevant blocks at or below 3,000 pixels on each dimension for cross-platform compatibility.
- Choose
oversized_image: errorwhen silent server downsizing would break coordinate, evidence, or quality requirements.
Four measurements decide admission
Anthropic's vision documentation gives separate constraints for image count, dimensions, encoded size, and total request size. A first-party Claude API request can carry up to 100 images on models with a 200k-token context window and up to 600 on other models. The 128 MB aggregate request limit can stop a payload earlier.
The gateway should inspect the final serialized request rather than an upload form. Images can appear in earlier conversation turns that the application resends. They can also sit inside tool_result content, such as a computer-use screenshot. Count all of them under the destination's documented rules.
For each block, capture encoded byte count, decoded byte count, detected format, width, height, source variant, and location in the content array. Bind those measurements to the authenticated route and resolved model. The wider Anthropic API gateway pattern supplies identity and provider dispatch context.
Many-image requests need a stricter branch
Anthropic says a request with more than 20 images receives a stricter per-image dimension limit. The current provider error reports the applicable pixel maximum. To stay under the rule across documented platforms, Anthropic recommends keeping neither dimension above 3,000 pixels or keeping the request to 20 or fewer image and document blocks.
Turn that guidance into deterministic preflight policy. Count relevant blocks after conversation assembly. If the count exceeds 20, reject an image above the route's many-image cap or resize it under an explicit transformation contract. Do not let a retry loop discover the limit through repeated provider failures.
The count can change even when the new user message contains one image. A client that resends 20 earlier screenshots makes the latest image number 21. Record total count and the current block's ordinal so an operator can reproduce the decision.
A thumbnail grid with 21 small receipts looks harmless to a human reviewer. The wire request still crosses the branch, and one 4,000-pixel scan can sink the entire call.
Encoded size and decoded content need separate checks
The first-party Claude API currently allows 10 MB per base64-encoded image. Amazon Bedrock documents 5 MB. Base64 overhead means an application's raw-file limit and provider encoded limit are different numbers. Measure both instead of estimating one from a browser upload label.
Validate JPEG, PNG, GIF, or WebP signatures against the declared media type. Anthropic processes only the first GIF frame and does not support animation. A route that needs frame-by-frame analysis should reject animated input or extract approved frames in application code before dispatch.
Also cap aggregate serialized size below the destination request limit with room for text, tools, prior messages, and JSON encoding. A file can satisfy the per-image maximum while the request fails as a whole. Per-route AI policies let a receipt route choose a smaller operational ceiling than a document-analysis route.
Downsize and error are different contracts
The Messages API reference documents transformations.oversized_image. The default, downsize, lets the server scale an image that exceeds the model's native image limits. Setting error returns a 400 response with the image dimensions and the largest dimensions that fit.
Use error for coordinate workflows, pixel-level evidence, OCR acceptance tests, or any route where the application must know exactly what Claude observed. Use deliberate application-side resizing where lower resolution is acceptable, then record the original dimensions, output dimensions, algorithm, and digest.
My blunt opinion is that silent downsizing belongs nowhere near a bounding-box workflow. A model can return coordinates relative to the processed image while the application overlays them on the original, creating a polished but wrong rectangle.
Anthropic currently lists native long-edge limits of 1,568 pixels for standard-tier models and 2,576 pixels for Claude 4.7 and later high-resolution models, subject to visual-token limits. Keep those processing limits separate from the 8,000 by 8,000 hard request maximum.
The audit event records the observed image contract
Before dispatch, record principal, route, model, platform, image count, block position, source type, declared and detected media type, encoded bytes, decoded bytes, dimensions, transformation rule, policy version, and outcome. Use payload digests rather than image bytes in normal logs.
If the application resizes, add original and output dimensions plus the transformation implementation version. If Anthropic downsizes under its default, provider-side final dimensions may require response or coordinate-workflow evidence. Avoid claiming a pixel-exact observation when the request contract allowed silent scaling.
The AI audit log schema can hold common request and policy fields. A protected image store needs its own access and expiry rules.
Boundary fixtures should include the twenty-first image
Test dimensions at 7,999, 8,000, and 8,001 pixels on each edge with tiny synthetic files. Test encoded sizes just below, at, and above the route's platform cap. Include mismatched media types, corrupt headers, an animated GIF, and an image below 200 pixels where Anthropic warns interpretation can be unreliable.
Create requests with 20 and 21 relevant blocks. Put earlier images in prior turns and one screenshot inside a tool result so the counter exercises the actual parser. For the 21-block case, include one image above 3,000 pixels and confirm local rejection under the compatibility rule.
Run both downsize and error. The error route should stop or return the expected provider validation response without an automatic retry that strips the setting. A coordinate fixture should prove that application overlays use the same processed dimensions recorded for Claude.
DeepInspect
DeepInspect can inspect image blocks on authenticated user or agent HTTP requests deliberately routed through its proxy to Anthropic. It can enforce route-specific count, byte, format, dimension, and transformation rules before provider dispatch, then write the measured values and outcome into a per-decision record.
The application owns image acquisition, safe decoding, any resize implementation, and coordinate mapping. Anthropic owns model-side processing after receipt. Files uploaded or calls sent outside the proxy remain outside this evidence boundary.
Book a technical deep dive at deepinspect.ai.
Frequently asked questions
- What is Anthropic's maximum image dimension?
The current vision guide lists 8,000 by 8,000 pixels for each image. Requests with more than 20 relevant blocks use a stricter dimension rule. Anthropic recommends a 3,000-pixel cap on each dimension for cross-platform compatibility in that case.
- Is the per-image byte limit the same on every platform?
No. The first-party Claude API currently documents 10 MB base64-encoded per image, while Amazon Bedrock documents 5 MB. Total request limits also vary by platform.
- Does Claude always reject an image above native model resolution?
The default
oversized_imagebehavior is downsize for ordinary image blocks. Set it toerrorwhen the application requires a rejection and explicit dimensions instead of silent scaling.- Should the gateway inspect images from earlier turns?
Yes. Resent prior images and images nested inside tool results count toward request limits. Inspect the final HTTP body that will reach the provider.