vision changedbuild-with-claude/vision
Nearest release: v2.1.328, published 7 hours after 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+62added
Lines−53removed
From line
1
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits27to this page, all time
The whole hunk
from line 1, old and new numbered
/
from line 1
11---
22title: Vision
33url: https://platform.claude.com/docs/en/build-with-claude/vision
4description: Claude's vision capabilities allow it to process and analyze images, opening up exciting possibilities for multimodal interaction.
4description: Send images to Claude through the API and learn which limits and costs apply.
55featureMetadata:
66 status: stable
77 supportedModels:
from line 70
7070
7171<CodeGroup>
7272 ```bash cURL
73 curl -sSo vision-example.jpg https://platform.claude.com/docs/images/vision-example.jpg
74
75 BASE64_IMAGE_DATA=$(base64 vision-example.jpg | tr -d '\n')
76
7377 curl https://api.anthropic.com/v1/messages \
7478 -H "x-api-key: $ANTHROPIC_API_KEY" \
7579 -H "anthropic-version: 2026-10-21" \
from line 156
152156 ```typescript TypeScript
153157 const anthropic = new Anthropic();
154158
159 const imageData =
160 "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR4nGP4z8AAAAMBAQDJ/pLvAAAAAElFTkSuQmCC";
161
155162 const message = await anthropic.messages.create({
156163 model: "claude-opus-5-5",
157164 max_tokens: 1024,
from line 170
163170 type: "image",
164171 source: {
165172 type: "base64",
166 media_type: "image/jpeg",
173 media_type: "image/png",
167174 data: imageData // base64-encoded image data as string
168175 }
169176 },
from line 187
180187 ```
181188
182189 ```csharp C#
183 using System.Collections.Generic;
184 using Anthropic;
185 using Anthropic.Models.Messages;
186
187190 AnthropicClient client = new();
188191
189192 string imageData = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR4nGP4z8AAAAMBAQDJ/pLvAAAAAElFTkSuQmCC";
from line 287
284287 'type' => 'image',
285288 'source' => [
286289 'type' => 'base64',
287 'media_type' => 'image/png',
290 'mediaType' => 'image/png',
288291 'data' => $imageData,
289292 ],
290293 ],
from line 433
430433 ```
431434
432435 ```csharp C#
433 using System.Collections.Generic;
434 using Anthropic;
435 using Anthropic.Models.Messages;
436
437436 AnthropicClient client = new();
438437
439438 var message = await client.Messages.Create(new MessageCreateParams
from line 508
509508 .addUserMessageOfContentBlockParams(contentBlockParams)
510509 .build()
511510 );
512 System.out.println(message);
511 IO.println(message);
513512 ```
514513
515514 ```php PHP
from line 572
573572 In multi-turn conversations and agentic workflows, each request resends the full conversation history. If images are base64-encoded, the full image bytes are included in the payload on every turn, which can significantly increase request size and latency as the conversation grows. Uploading images to the Files API and referencing them by `file_id` keeps request payloads small regardless of how many images accumulate in the conversation history.
574573</Tip>
575574
575To follow the examples with the image that they use, first download the [sample image](https://platform.claude.com/docs/images/vision-example.jpg) to your working directory. Each example uploads that file, `vision-example.jpg`, and then references it by the `file_id` that the upload returns:
576
576577<CodeGroup>
577578 ```bash cURL
578579 # First, upload your image to the Files API
from line 703
702703 ```
703704
704705 ```csharp C#
705 using System.Collections.Generic;
706 using Anthropic;
707706 using Anthropic.Core;
708707 using Anthropic.Models.Files;
709708 using Anthropic.Models.Messages;
from line 786
787786 import com.anthropic.core.MultipartField;
788787 import com.anthropic.models.files.FileMetadata;
789788 import com.anthropic.models.files.FileUploadParams;
790 // ...
791 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
789 import com.anthropic.models.messages.*;
790 import java.io.IOException;
791 import java.io.InputStream;
792 import java.nio.file.Files;
793 import java.nio.file.Path;
794 import java.util.List;
792795
793 // Upload the image file
794 FileMetadata file = client.files().upload(
795 FileUploadParams.builder()
796 .file(
797 MultipartField.<InputStream>builder()
798 .value(Files.newInputStream(Path.of("vision-example.jpg")))
799 .filename("vision-example.jpg")
800 .contentType("image/jpeg")
801 .build()
802 )
803 .build()
804 );
796 void main() throws IOException {
797 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
805798
806 // Use the uploaded file in a message
807 ImageBlockParam imageParam = ImageBlockParam.builder()
808 .fileSource(file.id())
809 .build();
799 // Upload the image file
800 FileMetadata file = client.files().upload(
801 FileUploadParams.builder()
802 .file(
803 MultipartField.<InputStream>builder()
804 .value(Files.newInputStream(Path.of("vision-example.jpg")))
805 .filename("vision-example.jpg")
806 .contentType("image/jpeg")
807 .build()
808 )
809 .build()
810 );
810811
811 MessageCreateParams params = MessageCreateParams.builder()
812 .model(Model.CLAUDE_OPUS_5_5)
813 .maxTokens(1024)
814 .addUserMessageOfContentBlockParams(
815 List.of(
816 ContentBlockParam.ofImage(imageParam),
817 ContentBlockParam.ofText(
818 TextBlockParam.builder()
819 .text("Describe this image.")
820 .build()
821 )
812 // Use the uploaded file in a message
813 ImageBlockParam imageParam = ImageBlockParam.builder()
814 .fileSource(file.id())
815 .build();
816
817 MessageCreateParams params = MessageCreateParams.builder()
818 .model(Model.CLAUDE_OPUS_5_5)
819 .maxTokens(1024)
820 .addUserMessageOfContentBlockParams(
821 List.of(
822 ContentBlockParam.ofImage(imageParam),
823 ContentBlockParam.ofText(
824 TextBlockParam.builder()
825 .text("Describe this image.")
826 .build()
822827 )
823828 )
824 .build();
829 )
830 .build();
825831
826 Message message = client.messages().create(params);
827 System.out.println(message.content());
832 Message message = client.messages().create(params);
833 IO.println(message.content());
834 }
828835 ```
829836
830837 ```php PHP
831838 use Anthropic\Core\FileParam;
832 use Anthropic\Messages\Model;
833839
834840 $client = new Client();
835841
836842 // Upload the image file
843 $image = fopen('vision-example.jpg', 'rb')
844 ?: throw new \RuntimeException('Could not open vision-example.jpg.');
845
837846 $fileUpload = $client->files->upload(
838 file: FileParam::fromResource(fopen('vision-example.jpg', 'rb'), contentType: 'image/jpeg'),
847 file: FileParam::fromResource($image, contentType: 'image/jpeg'),
839848 );
840849
841850 // Use the uploaded file in a message
from line 1206
11971206 'type' => 'image',
11981207 'source' => [
11991208 'type' => 'base64',
1200 'media_type' => 'image/png',
1209 'mediaType' => 'image/png',
12011210 'data' => $image1Data,
12021211 ],
12031212 ],
from line 1215
12061215 'type' => 'image',
12071216 'source' => [
12081217 'type' => 'base64',
1209 'media_type' => 'image/png',
1218 'mediaType' => 'image/png',
12101219 'data' => $image2Data,
12111220 ],
12121221 ],
No line in this hunk matches that.