pdf-support changedbuild-with-claude/pdf-support
Nearest release: v2.1.309, published 3 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+227added
Lines−200removed
From line
11
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits16to this page, all time
The whole hunk
from line 11, old and new numbered
/
The two sides of this change are more than 400 edits apart, too far apart to line up, so this is the differ's own diff of it and the words inside a line are not marked.
from line 11
1111 Claude API: ga
1212 Claude Platform on AWS: ga
1313 Amazon Bedrock: ga
14 Google Cloud: ga
14 Claude Models on Google Cloud (Google managed): ga
1515 Microsoft Foundry: ga
1616---
1717
from line 262
262262
263263 // Create document block with URL
264264 DocumentBlockParam documentParam = DocumentBlockParam.builder()
265 .source(
266 UrlPdfSource.builder()
267 .url(
268 "https://assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf"
269 )
270 .build()
271 )
272 .build();
265 .source(
266 UrlPdfSource.builder()
267 .url(
268 "https://assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf"
269 )
270 .build()
271 )
272 .build();
273273
274274 // Create a message with document and text content blocks
275275 MessageCreateParams params = MessageCreateParams.builder()
276 .model(Model.CLAUDE_OPUS_5_5)
277 .maxTokens(1024)
278 .addUserMessageOfContentBlockParams(
279 List.of(
280 ContentBlockParam.ofDocument(documentParam),
281 ContentBlockParam.ofText(
282 TextBlockParam.builder()
283 .text("What are the key findings in this document?")
284 .build()
285 )
276 .model(Model.CLAUDE_OPUS_5_5)
277 .maxTokens(1024)
278 .addUserMessageOfContentBlockParams(
279 List.of(
280 ContentBlockParam.ofDocument(documentParam),
281 ContentBlockParam.ofText(
282 TextBlockParam.builder()
283 .text("What are the key findings in this document?")
284 .build()
285 )
286 )
286287 )
287 )
288 .build();
288 .build();
289289
290290 Message message = client.messages().create(params);
291291 System.out.println(message.content());
from line 383
383383
384384 # Create a JSON request file using the pdf_base64.txt content
385385 jq -n --rawfile PDF_BASE64 pdf_base64.txt '{
386 "model": "claude-opus-5-5",
387 "max_tokens": 1024,
388 "messages": [{
389 "role": "user",
390 "content": [{
391 "type": "document",
392 "source": {
393 "type": "base64",
394 "media_type": "application/pdf",
395 "data": $PDF_BASE64
396 }
397 },
398 {
399 "type": "text",
400 "text": "What are the key findings in this document?"
401 }]
386 "model": "claude-opus-5-5",
387 "max_tokens": 1024,
388 "messages": [{
389 "role": "user",
390 "content": [{
391 "type": "document",
392 "source": {
393 "type": "base64",
394 "media_type": "application/pdf",
395 "data": $PDF_BASE64
396 }
397 },
398 {
399 "type": "text",
400 "text": "What are the key findings in this document?"
402401 }]
402 }]
403403 }' > request.json
404404
405405 # Send the API request using the JSON file
from line 588
588588
589589 // Method 1: Download and encode a remote PDF
590590 String pdfUrl =
591 "https://assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf";
592 HttpClient httpClient = HttpClient.newBuilder().followRedirects(HttpClient.Redirect.NORMAL).build();
593 HttpRequest request = HttpRequest.newBuilder().uri(URI.create(pdfUrl)).GET().build();
591 "https://assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf";
592 HttpClient httpClient = HttpClient.newBuilder()
593 .followRedirects(HttpClient.Redirect.NORMAL)
594 .build();
595 HttpRequest request = HttpRequest.newBuilder()
596 .uri(URI.create(pdfUrl))
597 .GET()
598 .build();
594599
595600 HttpResponse<byte[]> response = httpClient.send(
596 request,
597 HttpResponse.BodyHandlers.ofByteArray()
601 request,
602 HttpResponse.BodyHandlers.ofByteArray()
598603 );
599604 String pdfBase64 = Base64.getEncoder().encodeToString(response.body());
600605
from line 609
604609
605610 // Create document block with base64 data
606611 DocumentBlockParam documentParam = DocumentBlockParam.builder()
607 .source(Base64PdfSource.builder().data(pdfBase64).build())
608 .build();
612 .source(Base64PdfSource.builder()
613 .data(pdfBase64)
614 .build())
615 .build();
609616
610617 // Create a message with document and text content blocks
611618 MessageCreateParams params = MessageCreateParams.builder()
612 .model(Model.CLAUDE_OPUS_5_5)
613 .maxTokens(1024)
614 .addUserMessageOfContentBlockParams(
615 List.of(
616 ContentBlockParam.ofDocument(documentParam),
617 ContentBlockParam.ofText(
618 TextBlockParam.builder()
619 .text("What are the key findings in this document?")
620 .build()
621 )
619 .model(Model.CLAUDE_OPUS_5_5)
620 .maxTokens(1024)
621 .addUserMessageOfContentBlockParams(
622 List.of(
623 ContentBlockParam.ofDocument(documentParam),
624 ContentBlockParam.ofText(
625 TextBlockParam.builder()
626 .text("What are the key findings in this document?")
627 .build()
628 )
629 )
622630 )
623 )
624 .build();
631 .build();
625632
626633 Message message = client.messages().create(params);
627634 System.out.println(message.content());
from line 678
671678 # First, load and encode the PDF
672679 pdf_url = "https://assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf"
673680 pdf_bytes = URI.open(pdf_url, "rb") { |f| f.read }
674 pdf_data = [pdf_bytes].pack("m0") # Base64-encode without newlines
681 pdf_data = [pdf_bytes].pack("m0") # Encode as base64 without newlines
675682
676683 # Alternative: Load from a local file
677684 # pdf_data = [File.binread("document.pdf")].pack("m0")
from line 915
908915
909916 // Upload the PDF file
910917 FileMetadata file = client
911 .files()
912 .upload(FileUploadParams.builder().file(Path.of("/path/to/document.pdf")).build());
918 .files()
919 .upload(FileUploadParams.builder()
920 .file(Path.of("/path/to/document.pdf"))
921 .build());
913922
914923 // Use the uploaded file in a message
915924 MessageCreateParams params = MessageCreateParams.builder()
916 .model(Model.CLAUDE_OPUS_5_5)
917 .maxTokens(1024)
918 .addUserMessageOfContentBlockParams(
919 List.of(
920 ContentBlockParam.ofDocument(
921 DocumentBlockParam.builder().fileSource(file.id()).build()
922 ),
923 ContentBlockParam.ofText(
924 TextBlockParam.builder()
925 .text("What are the key findings in this document?")
926 .build()
927 )
925 .model(Model.CLAUDE_OPUS_5_5)
926 .maxTokens(1024)
927 .addUserMessageOfContentBlockParams(
928 List.of(
929 ContentBlockParam.ofDocument(
930 DocumentBlockParam.builder()
931 .fileSource(file.id())
932 .build()
933 ),
934 ContentBlockParam.ofText(
935 TextBlockParam.builder()
936 .text("What are the key findings in this document?")
937 .build()
938 )
939 )
928940 )
929 )
930 .build();
941 .build();
931942
932943 Message message = client.messages().create(params);
933944 System.out.println(message.content());
from line 1270
12591270
12601271 // Download and encode the PDF
12611272 String pdfUrl =
1262 "https://assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf";
1263 HttpClient httpClient = HttpClient.newBuilder().followRedirects(HttpClient.Redirect.NORMAL).build();
1264 HttpRequest request = HttpRequest.newBuilder().uri(URI.create(pdfUrl)).GET().build();
1273 "https://assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf";
1274 HttpClient httpClient = HttpClient.newBuilder()
1275 .followRedirects(HttpClient.Redirect.NORMAL)
1276 .build();
1277 HttpRequest request = HttpRequest.newBuilder()
1278 .uri(URI.create(pdfUrl))
1279 .GET()
1280 .build();
12651281
12661282 HttpResponse<byte[]> response = httpClient.send(
1267 request,
1268 HttpResponse.BodyHandlers.ofByteArray()
1283 request,
1284 HttpResponse.BodyHandlers.ofByteArray()
12691285 );
12701286 String pdfBase64 = Base64.getEncoder().encodeToString(response.body());
12711287
12721288 MessageCreateParams params = MessageCreateParams.builder()
1273 .model(Model.CLAUDE_OPUS_5_5)
1274 .maxTokens(1024)
1275 .addUserMessageOfContentBlockParams(
1276 List.of(
1277 ContentBlockParam.ofDocument(
1278 DocumentBlockParam.builder()
1279 .source(Base64PdfSource.builder().data(pdfBase64).build())
1280 .cacheControl(CacheControlEphemeral.builder().build())
1281 .build()
1282 ),
1283 ContentBlockParam.ofText(
1284 TextBlockParam.builder()
1285 .text(
1286 "Which model has the highest human preference win rates across each use-case?"
1287 )
1288 .build()
1289 )
1289 .model(Model.CLAUDE_OPUS_5_5)
1290 .maxTokens(1024)
1291 .addUserMessageOfContentBlockParams(
1292 List.of(
1293 ContentBlockParam.ofDocument(
1294 DocumentBlockParam.builder()
1295 .source(Base64PdfSource.builder()
1296 .data(pdfBase64)
1297 .build())
1298 .cacheControl(CacheControlEphemeral.builder().build())
1299 .build()
1300 ),
1301 ContentBlockParam.ofText(
1302 TextBlockParam.builder()
1303 .text(
1304 "Which model has the highest human preference win rates across each use-case?"
1305 )
1306 .build()
1307 )
1308 )
12901309 )
1291 )
1292 .build();
1310 .build();
12931311
12941312 Message message = client.messages().create(params);
12951313 System.out.println(message);
from line 1354
13361354 # Load and encode the PDF
13371355 pdf_url = "https://assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf"
13381356 pdf_bytes = URI.open(pdf_url, "rb") { |f| f.read }
1339 pdf_data = [pdf_bytes].pack("m0") # Base64-encode without newlines
1357 pdf_data = [pdf_bytes].pack("m0") # Encode as base64 without newlines
13401358
13411359 anthropic = Anthropic::Client.new
13421360
from line 1396
13781396 curl -sL "https://assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf" | base64 | tr -d '\n' > pdf_base64.txt
13791397 # Create a JSON request file using the pdf_base64.txt content
13801398 jq -n --rawfile PDF_BASE64 pdf_base64.txt '{
1381 "requests": [
1382 {
1383 "custom_id": "my-first-request",
1384 "params": {
1385 "model": "claude-opus-5-5",
1386 "max_tokens": 1024,
1387 "messages": [{
1388 "role": "user",
1389 "content": [{
1390 "type": "document",
1391 "source": {
1392 "type": "base64",
1393 "media_type": "application/pdf",
1394 "data": $PDF_BASE64
1395 }
1396 },
1397 {
1398 "type": "text",
1399 "text": "Which model has the highest human preference win rates across each use-case?"
1400 }]
1401 }]
1402 }
1403 },
1404 {
1405 "custom_id": "my-second-request",
1406 "params": {
1407 "model": "claude-opus-5-5",
1408 "max_tokens": 1024,
1409 "messages": [{
1410 "role": "user",
1411 "content": [{
1412 "type": "document",
1413 "source": {
1414 "type": "base64",
1415 "media_type": "application/pdf",
1416 "data": $PDF_BASE64
1417 }
1418 },
1419 {
1420 "type": "text",
1421 "text": "Extract 5 key insights from this document."
1422 }]
1423 }]
1424 }
1425 }]
1399 "requests": [
1400 {
1401 "custom_id": "my-first-request",
1402 "params": {
1403 "model": "claude-opus-5-5",
1404 "max_tokens": 1024,
1405 "messages": [{
1406 "role": "user",
1407 "content": [{
1408 "type": "document",
1409 "source": {
1410 "type": "base64",
1411 "media_type": "application/pdf",
1412 "data": $PDF_BASE64
1413 }
1414 },
1415 {
1416 "type": "text",
1417 "text": "Which model has the highest human preference win rates across each use-case?"
1418 }]
1419 }]
1420 }
1421 },
1422 {
1423 "custom_id": "my-second-request",
1424 "params": {
1425 "model": "claude-opus-5-5",
1426 "max_tokens": 1024,
1427 "messages": [{
1428 "role": "user",
1429 "content": [{
1430 "type": "document",
1431 "source": {
1432 "type": "base64",
1433 "media_type": "application/pdf",
1434 "data": $PDF_BASE64
1435 }
1436 },
1437 {
1438 "type": "text",
1439 "text": "Extract 5 key insights from this document."
1440 }]
1441 }]
1442 }
1443 }]
14261444 }' > request.json
14271445
14281446 # Then make the API call using the JSON file
from line 1755
17371755
17381756 // Download and encode the PDF
17391757 String pdfUrl =
1740 "https://assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf";
1741 HttpClient httpClient = HttpClient.newBuilder().followRedirects(HttpClient.Redirect.NORMAL).build();
1742 HttpRequest request = HttpRequest.newBuilder().uri(URI.create(pdfUrl)).GET().build();
1758 "https://assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf";
1759 HttpClient httpClient = HttpClient.newBuilder()
1760 .followRedirects(HttpClient.Redirect.NORMAL)
1761 .build();
1762 HttpRequest request = HttpRequest.newBuilder()
1763 .uri(URI.create(pdfUrl))
1764 .GET()
1765 .build();
17431766
17441767 HttpResponse<byte[]> response = httpClient.send(
1745 request,
1746 HttpResponse.BodyHandlers.ofByteArray()
1768 request,
1769 HttpResponse.BodyHandlers.ofByteArray()
17471770 );
17481771 String pdfBase64 = Base64.getEncoder().encodeToString(response.body());
17491772
17501773 BatchCreateParams params = BatchCreateParams.builder()
1751 .addRequest(
1752 BatchCreateParams.Request.builder()
1753 .customId("my-first-request")
1754 .params(
1755 BatchCreateParams.Request.Params.builder()
1756 .model(Model.CLAUDE_OPUS_5_5)
1757 .maxTokens(1024)
1758 .addUserMessageOfContentBlockParams(
1759 List.of(
1760 ContentBlockParam.ofDocument(
1761 DocumentBlockParam.builder()
1762 .source(Base64PdfSource.builder().data(pdfBase64).build())
1763 .build()
1764 ),
1765 ContentBlockParam.ofText(
1766 TextBlockParam.builder()
1767 .text(
1768 "Which model has the highest human preference win rates across each use-case?"
1769 )
1770 .build()
1771 )
1774 .addRequest(
1775 BatchCreateParams.Request.builder()
1776 .customId("my-first-request")
1777 .params(
1778 BatchCreateParams.Request.Params.builder()
1779 .model(Model.CLAUDE_OPUS_5_5)
1780 .maxTokens(1024)
1781 .addUserMessageOfContentBlockParams(
1782 List.of(
1783 ContentBlockParam.ofDocument(
1784 DocumentBlockParam.builder()
1785 .source(Base64PdfSource.builder()
1786 .data(pdfBase64)
1787 .build())
1788 .build()
1789 ),
1790 ContentBlockParam.ofText(
1791 TextBlockParam.builder()
1792 .text(
1793 "Which model has the highest human preference win rates across each use-case?"
1794 )
1795 .build()
1796 )
1797 )
1798 )
1799 .build()
17721800 )
1773 )
1774 .build()
1775 )
1776 .build()
1777 )
1778 .addRequest(
1779 BatchCreateParams.Request.builder()
1780 .customId("my-second-request")
1781 .params(
1782 BatchCreateParams.Request.Params.builder()
1783 .model(Model.CLAUDE_OPUS_5_5)
1784 .maxTokens(1024)
1785 .addUserMessageOfContentBlockParams(
1786 List.of(
1787 ContentBlockParam.ofDocument(
1788 DocumentBlockParam.builder()
1789 .source(Base64PdfSource.builder().data(pdfBase64).build())
1790 .build()
1791 ),
1792 ContentBlockParam.ofText(
1793 TextBlockParam.builder()
1794 .text("Extract 5 key insights from this document.")
1795 .build()
1796 )
1801 .build()
1802 )
1803 .addRequest(
1804 BatchCreateParams.Request.builder()
1805 .customId("my-second-request")
1806 .params(
1807 BatchCreateParams.Request.Params.builder()
1808 .model(Model.CLAUDE_OPUS_5_5)
1809 .maxTokens(1024)
1810 .addUserMessageOfContentBlockParams(
1811 List.of(
1812 ContentBlockParam.ofDocument(
1813 DocumentBlockParam.builder()
1814 .source(Base64PdfSource.builder()
1815 .data(pdfBase64)
1816 .build())
1817 .build()
1818 ),
1819 ContentBlockParam.ofText(
1820 TextBlockParam.builder()
1821 .text("Extract 5 key insights from this document.")
1822 .build()
1823 )
1824 )
1825 )
1826 .build()
17971827 )
1798 )
1799 .build()
1800 )
1801 .build()
1802 )
1803 .build();
1828 .build()
1829 )
1830 .build();
18041831
18051832 MessageBatch batch = client.messages().batches().create(params);
18061833 System.out.println(batch);
from line 1906
18791906 # Load and encode the PDF
18801907 pdf_url = "https://assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf"
18811908 pdf_bytes = URI.open(pdf_url, "rb") { |f| f.read }
1882 pdf_data = [pdf_bytes].pack("m0") # Base64-encode without newlines
1909 pdf_data = [pdf_bytes].pack("m0") # Encode as base64 without newlines
18831910
18841911 anthropic = Anthropic::Client.new
18851912
18861913
No line in this hunk matches that.