Follow Discord
Sweep 22 Oct 2026 · 04:32Z Build v2.1.308 527 read Stable v2.1.308 Latest v2.1.308 Next v2.1.308 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

vision changedbuild-with-claude/vision

Nearest release: v2.1.239, published 2 hours before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Recorded here
Lines+8added
Lines−9removed
From line 792 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits13to this page, all time

The whole hunk

from line 792, old and new numbered
/
lines
from line 792
792792 ```
793793 
794794 ```php PHP
795 // The PHP SDK exposes the Files API under the beta namespace; field names can differ from other SDKs.
796 // The PHP SDK supports file_id document and image sources only through $client->beta->messages with the files beta.
795 use Anthropic\Core\FileParam;
796 
797797 $client = new Client();
798798 
799799 // Upload the image file
800 $fileUpload = $client->beta->files->upload(
801 FileParam::fromResource(fopen('vision-example.jpg', 'rb'), contentType: 'image/jpeg'),
800 $fileUpload = $client->files->upload(
801 file: FileParam::fromResource(fopen('vision-example.jpg', 'rb'), contentType: 'image/jpeg'),
802802 );
803803 
804804 // Use the uploaded file in a message
805 $message = $client->beta->messages->create(
805 $message = $client->messages->create(
806806 maxTokens: 1024,
807807 messages: [
808808 [
from line 810
810810 'content' => [
811811 [
812812 'type' => 'image',
813 'source' => ['type' => 'file', 'file_id' => $fileUpload->id],
813 'source' => ['type' => 'file', 'fileID' => $fileUpload->id],
814814 ],
815815 ['type' => 'text', 'text' => 'Describe this image.'],
816816 ],
from line 817
817817 ],
818818 ],
819819 model: 'claude-opus-5',
820 betas: ['files-api-2025-04-14'],
821820 );
822821 
823822 echo json_encode($message, JSON_PRETTY_PRINT), PHP_EOL;
from line 1257
12581257 
12591258Claude views images in patches instead of pixels. Each patch is a 28×28-pixel block of the image, referred to as a visual token. An image, therefore, costs `⌈width / 28⌉ × ⌈height / 28⌉` visual tokens.
12601259 
1261Each model has a maximum native image resolution, expressed as a long-edge limit and a visual-token limit. Images larger than either limit are downscaled before processing; see [How Claude resizes and pads images](https://platform.claude.com/docs/en/build-with-claude/vision-coordinates#how-claude-resizes-and-pads-images) for the exact rule. The exception is screenshots and zoom images that you return to the [computer use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool#handle-coordinate-scaling-for-higher-resolutions) and [browser use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/browser-use-tool#targets-and-coordinates) toolsets: the API rejects a `tool_result` image that exceeds the model's limits with a validation error instead of downscaling it, so resize those images in your application before returning them.
1260Each model has a maximum native image resolution, expressed as a long-edge limit and a visual-token limit. Images larger than either limit are downscaled before processing; see [How Claude resizes and pads images](https://platform.claude.com/docs/en/build-with-claude/vision-coordinates#how-claude-resizes-and-pads-images) for the exact rule. The exception is screenshots and zoom images that you return to the [computer use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool#handle-coordinate-scaling-for-higher-resolutions) and [browser use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/browser-use-tool#targets-and-coordinates) toolsets: the API rejects a `tool_result` image that exceeds the model's limits with a validation error instead of downscaling it, so resize those images in your application before returning them. To have any other oversized image rejected with an error instead of downscaled, set the image block's [`transformations` field](https://platform.claude.com/docs/en/build-with-claude/vision-coordinates#oversized-image-error).
12621261 
12631262| Resolution tier | Models | Max long edge | Max visual tokens |
12641263| --------------- | --------------------------- | ------------- | ----------------- |
from line 1289
12901289 
12911290* **Image clarity:** Ensure images are clear and not too blurry or pixelated.
12921291* **Text:** If the image contains important text, make sure it's legible and not too small. Avoid cropping out key visual context solely to enlarge the text.
1293* **Resizing:** Take into account that your image might be resized if it is too large (see [Resolution and token cost](https://platform.claude.com/docs/en/build-with-claude/vision#evaluate-image-size)); this might, for example, make text less legible. Consider pre-resizing your images, cropping them, or both.
1292* **Resizing:** Take into account that your image might be resized if it is too large (see [Resolution and token cost](https://platform.claude.com/docs/en/build-with-claude/vision#evaluate-image-size)); this might, for example, make text less legible. Consider pre-resizing your images, cropping them, or both. To have an oversized image rejected with an error instead of resized (important for [coordinate workflows](https://platform.claude.com/docs/en/build-with-claude/vision-coordinates)), mark the image block with [`"oversized_image": "error"`](https://platform.claude.com/docs/en/build-with-claude/vision-coordinates#oversized-image-error).
12941293* **Image compression:** Compressing images before sending them, using a lossy format such as JPEG or WebP (lossy mode), can reduce latency by reducing the size of requests. However, this can introduce artifacts that are detrimental to model performance, especially when multiple compression passes are applied. For example, heavy JPEG compression can make text difficult to read. Confirm your compression settings are appropriate for the task by inspecting the actual images sent to the API.
12951294 
12961295***
Feedback