---
title: PDF 지원
url: https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/pdf-support
description: "Claude로 PDF를 처리하세요: 문서에서 텍스트를 추출하고, 차트를 분석하고, 시각적 콘텐츠를 이해합니다."
featureMetadata:
  status: stable
  zdr:
    eligibility: eligible
    note: Excludes [Covered Models](https://code.saschaberens.de/_h/platform.claude.com/docs/en/manage-claude/api-and-data-retention#model-specific-data-retention-requirements).
  supportedModels:
    - claude-fable-5-2
    - claude-mythos-5-2
    - claude-fable-5-1
    - claude-mythos-5-1
    - claude-fable-5
    - claude-mythos-5
    - claude-mythos-preview
    - claude-opus-5-5
    - claude-opus-5
    - claude-sonnet-5-5
    - claude-sonnet-5
    - claude-haiku-5-5
    - claude-haiku-4-5-20251001
    - claude-opus-4-8
    - claude-opus-4-7
    - claude-opus-4-6
    - claude-sonnet-4-6
    - claude-opus-4-5-20251101
    - claude-sonnet-4-5-20250929
  supportedPlatforms:
    Claude API: stable
    Amazon Bedrock:
      availability: stable
      note: Base64 소스만 지원합니다.
    Amazon Bedrock (bedrock-runtime):
      availability: stable
      note: Base64 소스만 지원합니다.
    Claude Platform on AWS: stable
    Claude Models on Google Cloud (Anthropic managed): stable
    Claude Models on Google Cloud (Google managed):
      availability: stable
      note: Base64 소스만 지원합니다.
    Microsoft Foundry:
      availability: stable
      note: "`file_id` 소스에는 Anthropic에서 호스팅되는 배포가 필요합니다."
---

제공한 PDF에 포함된 모든 텍스트, 그림, 차트, 표에 대해 Claude에게 질문할 수 있습니다. 몇 가지 사용 사례 예시는 다음과 같습니다:

* 재무 보고서 분석 및 차트/표 이해
* 법률 문서에서 핵심 정보 추출
* 문서 번역 지원
* 문서 정보를 구조화된 형식으로 변환

## 시작하기 전에

### PDF 요구 사항 확인

Claude는 모든 표준 PDF와 함께 작동합니다. 요청 크기가 다음 요구 사항을 충족하는지 확인하세요:

| 요구 사항 | 제한 |
| ----- | ----- |
| 최대 요청 크기 | 퍼스트 파티 Claude API에서 128 MB (플랫폼에 따라 다름, [요청 크기 제한](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/api/overview#request-size-limits) 참조) |
| 요청당 최대 페이지 수 | 600 (요청의 컨텍스트 윈도우가 1M 토큰 미만인 경우 100) |
| 형식 | 표준 PDF (비밀번호/암호화 없음) |

두 제한 모두 PDF와 함께 전송되는 다른 모든 콘텐츠를 포함한 전체 요청 페이로드에 적용됩니다. 대용량 PDF의 경우, 요청 페이로드를 작게 유지하기 위해 [Files API](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/files)로 업로드하고 `file_id`로 참조하는 것을 고려하세요.

<Tip>
  밀도가 높은 PDF(작은 글꼴의 페이지가 많거나, 복잡한 표, 또는 그래픽이 많은 경우)는 페이지 제한에 도달하기 전에 “context window”(컨텍스트 윈도우)를 가득 채울 수 있습니다. 대용량 PDF가 포함된 요청은 Files API를 사용하는 경우에도 페이지 제한에 도달하기 전에 실패할 수 있습니다. 문서를 여러 섹션으로 분할해 보세요. 대용량 파일의 경우 각 페이지가 이미지로 처리되므로, 포함된 이미지를 다운샘플링하는 것도 도움이 될 수 있습니다.
</Tip>

PDF 지원은 Claude의 비전 기능에 의존하므로, 다른 비전 작업과 동일한 [제한 사항 및 고려 사항](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/vision#limitations)이 적용됩니다.

### 지원되는 플랫폼 및 모델

모든 [활성 모델](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/models/overview)은 PDF 처리를 지원합니다.

<Note>
  .txt, .csv 또는 .md와 같은 일반 텍스트 파일은 문서 블록에서 직접 사용할 수 있습니다. MIME 유형 `text/plain`으로 Files API에 업로드하고 `file_id`로 참조하세요. .xlsx 또는 .docx와 같은 바이너리 형식은 문서 블록에서 지원되지 않으므로 먼저 텍스트나 PDF로 변환하세요. [다른 파일 형식 사용하기](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/files#working-with-other-file-formats)를 참조하세요.
</Note>

## Claude로 PDF 처리하기

### 첫 번째 PDF 요청 보내기

Messages API를 사용하는 예제로 시작하세요. Claude에 PDF를 제공하려면 세 가지 종류의 소스 중 하나를 사용하여 [`document` 콘텐츠 블록](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/api/messages#document_block_param)에 담아 보내세요. 사용할 수 있는 종류는 플랫폼에 따라 결정됩니다([가용성](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/pdf-support#feature-availability) 참조). 그중에서 PDF가 있는 위치, 크기, 사용 빈도에 따라 선택하세요:

1. **온라인에 호스팅된 PDF:** URL로 참조하세요([옵션 1: URL 기반 PDF 문서](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/pdf-support#option-1-url-based-pdf-document)).
2. **로컬 시스템에 있거나 URL이 없는 PDF:** base64로 인코딩된 데이터로 보내세요([옵션 2: Base64로 인코딩된 PDF 문서](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/pdf-support#option-2-base64-encoded-pdf-document)).
3. **대용량 PDF 또는 반복적으로 사용할 PDF:** [Files API](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/files)로 업로드하고 `file_id`로 참조하세요([옵션 3: Files API](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/pdf-support#option-3-files-api)).

#### 옵션 1: URL 기반 PDF 문서

URL로 PDF를 참조하세요:

<CodeGroup>
  ```bash cURL
  curl https://code.saschaberens.de/_h/api.anthropic.com/v1/messages \
    -H "content-type: application/json" \
    -H "x-api-key: $ANTHROPIC_API_KEY" \
    -H "anthropic-version: 2026-10-21" \
    -d '{
      "model": "claude-opus-5-5",
      "max_tokens": 1024,
      "messages": [{
        "role": "user",
        "content": [{
          "type": "document",
          "source": {
            "type": "url",
            "url": "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf"
          }
        },
        {
          "type": "text",
          "text": "What are the key findings in this document?"
        }]
      }]
    }'
  ```

  ```bash CLI
  ant messages create <<'YAML'
  model: claude-opus-5-5
  max_tokens: 1024
  messages:
    - role: user
      content:
        - type: document
          source:
            type: url
            url: https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf
        - type: text
          text: What are the key findings in this document?
  YAML
  ```

  ```python Python
  client = anthropic.Anthropic()
  message = client.messages.create(
      model="claude-opus-5-5",
      max_tokens=1024,
      messages=[
          {
              "role": "user",
              "content": [
                  {
                      "type": "document",
                      "source": {
                          "type": "url",
                          "url": "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf",
                      },
                  },
                  {"type": "text", "text": "What are the key findings in this document?"},
              ],
          }
      ],
  )

  print(message.content)
  ```

  ```typescript TypeScript
  const anthropic = new Anthropic();

  const response = await anthropic.messages.create({
    model: "claude-opus-5-5",
    max_tokens: 1024,
    messages: [
      {
        role: "user",
        content: [
          {
            type: "document",
            source: {
              type: "url",
              url: "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf"
            }
          },
          {
            type: "text",
            text: "What are the key findings in this document?"
          }
        ]
      }
    ]
  });

  console.log(response);
  ```

  ```csharp C#
  var client = new AnthropicClient();

  // URL로 문서 블록을 생성합니다
  var documentParam = new DocumentBlockParam
  {
      Source = new UrlPdfSource
      {
          Url = "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf",
      },
  };

  // 문서 및 텍스트 콘텐츠 블록으로 메시지를 생성합니다
  var message = await client.Messages.Create(new MessageCreateParams
  {
      Model = Model.ClaudeOpus5_5,
      MaxTokens = 1024,
      Messages =
      [
          new UserMessageParam
          {
              Content = new List<ContentBlockParam>
              {
                  documentParam,
                  new TextBlockParam("What are the key findings in this document?"),
              },
          },
      ],
  });

  Console.WriteLine(string.Join("\n", message.Content));
  ```

  ```go Go
  client := anthropic.NewClient()

  message, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
  	Model:     anthropic.ModelClaudeOpus5_5,
  	MaxTokens: 1024,
  	Messages: []anthropic.MessageParam{
  		anthropic.NewUserMessage(
  			anthropic.NewDocumentBlock(anthropic.URLPDFSourceParam{
  				URL: "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf",
  			}),
  			anthropic.NewTextBlock("What are the key findings in this document?"),
  		),
  	},
  })
  if err != nil {
  	panic(err)
  }

  fmt.Printf("%+v\n", message.Content)
  ```

  ```java Java
  AnthropicClient client = AnthropicOkHttpClient.fromEnv();

  // URL로 문서 블록 생성
  DocumentBlockParam documentParam = DocumentBlockParam.builder()
      .source(
          UrlPdfSource.builder()
              .url(
                  "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf"
              )
              .build()
      )
      .build();

  // 문서 및 텍스트 콘텐츠 블록으로 메시지 생성
  MessageCreateParams params = MessageCreateParams.builder()
      .model(Model.CLAUDE_OPUS_5_5)
      .maxTokens(1024)
      .addUserMessageOfContentBlockParams(
          List.of(
              ContentBlockParam.ofDocument(documentParam),
              ContentBlockParam.ofText(
                  TextBlockParam.builder()
                      .text("What are the key findings in this document?")
                      .build()
              )
          )
      )
      .build();

  Message message = client.messages().create(params);
  IO.println(message.content());
  ```

  ```php PHP
  $client = new Client();

  $message = $client->messages->create(
      maxTokens: 1024,
      messages: [
          [
              'role' => 'user',
              'content' => [
                  [
                      'type' => 'document',
                      'source' => [
                          'type' => 'url',
                          'url' => 'https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf',
                      ],
                  ],
                  [
                      'type' => 'text',
                      'text' => 'What are the key findings in this document?',
                  ],
              ],
          ],
      ],
      model: Model::CLAUDE_OPUS_5_5,
  );

  echo $message;
  ```

  ```ruby Ruby
  anthropic = Anthropic::Client.new

  message = anthropic.messages.create(
    model: Anthropic::Model::CLAUDE_OPUS_5_5,
    max_tokens: 1024,
    messages: [
      {
        role: "user",
        content: [
          {
            type: "document",
            source: {
              type: "url",
              url: "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf"
            }
          },
          {type: "text", text: "What are the key findings in this document?"}
        ]
      }
    ]
  )

  puts(message.content)
  ```
</CodeGroup>

응답은 Claude의 분석을 `content`의 텍스트 블록으로 반환하며, 토큰 사용량은 `usage`에 포함됩니다:

```json Output
{
  "id": "msg_01Hfp8YuFjQ55VgWbpdHDehB",
  "type": "message",
  "role": "assistant",
  "model": "claude-opus-5-5",
  "content": [
    {
      "type": "text",
      "text": "This document is an addendum to the Claude 3 model card, reporting updated evaluation results. The key findings include..."
    }
  ],
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 45000,
    "output_tokens": 300
  }
}
```

#### 옵션 2: Base64로 인코딩된 PDF 문서

요청 자체에 PDF를 base64로 인코딩된 데이터로 담아 보내세요. 다음 예제 대부분은 샘플 PDF를 다운로드하여 인코딩하므로 로컬 파일이 필요하지 않습니다. 해당 예제에서 로컬 파일을 보내려면 PDF를 다운로드하고 인코딩하는 줄을 주석 처리된 줄로 바꾸세요:

<CodeGroup>
  ```bash cURL
  # 방법 1: 원격 PDF를 가져와 인코딩합니다
  curl -sL "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf" | base64 | tr -d '\n' > pdf_base64.txt

  # 방법 2: 로컬 PDF 파일을 인코딩합니다
  # base64 document.pdf | tr -d '\n' > pdf_base64.txt

  # pdf_base64.txt 내용을 사용하여 JSON 요청 파일을 생성합니다
  jq -n --rawfile PDF_BASE64 pdf_base64.txt '{
    "model": "claude-opus-5-5",
    "max_tokens": 1024,
    "messages": [{
      "role": "user",
      "content": [{
        "type": "document",
        "source": {
          "type": "base64",
          "media_type": "application/pdf",
          "data": $PDF_BASE64
        }
      },
      {
        "type": "text",
        "text": "What are the key findings in this document?"
      }]
    }]
  }' > request.json

  # JSON 파일을 사용하여 API 요청을 보냅니다
  curl https://code.saschaberens.de/_h/api.anthropic.com/v1/messages \
    -H "content-type: application/json" \
    -H "x-api-key: $ANTHROPIC_API_KEY" \
    -H "anthropic-version: 2026-10-21" \
    -d @request.json
  ```

  ```bash CLI
  ant messages create --model claude-opus-5-5 --max-tokens 1024 <<'YAML'
  messages:
    - role: user
      content:
        - type: document
          source:
            type: base64
            media_type: application/pdf
            data: "@./document.pdf"
        - type: text
          text: What are the key findings in this document?
  YAML
  ```

  ```python Python
  import base64
  import httpx2

  # 먼저 PDF를 로드하고 인코딩합니다
  pdf_url = "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf"
  pdf_data = base64.standard_b64encode(
      httpx2.get(pdf_url, follow_redirects=True).content
  ).decode("utf-8")

  # 대안: 로컬 파일에서 로드합니다
  # with open("document.pdf", "rb") as f:
  #     pdf_data = base64.standard_b64encode(f.read()).decode("utf-8")

  # base64 인코딩을 사용하여 Claude에 전송합니다
  client = anthropic.Anthropic()
  message = client.messages.create(
      model="claude-opus-5-5",
      max_tokens=1024,
      messages=[
          {
              "role": "user",
              "content": [
                  {
                      "type": "document",
                      "source": {
                          "type": "base64",
                          "media_type": "application/pdf",
                          "data": pdf_data,
                      },
                  },
                  {"type": "text", "text": "What are the key findings in this document?"},
              ],
          }
      ],
  )

  print(message.content)
  ```

  ```typescript TypeScript
  // 방법 1: 원격 PDF를 가져와 인코딩합니다
  const pdfURL =
    "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf";
  const pdfResponse = await fetch(pdfURL);
  const arrayBuffer = await pdfResponse.arrayBuffer();
  const pdfBase64 = Buffer.from(arrayBuffer).toString("base64");

  // 방법 2: 로컬 파일에서 로드합니다
  // import { readFile } from "node:fs/promises";
  // const pdfBase64 = (await readFile("document.pdf")).toString("base64");

  // base64로 인코딩된 PDF와 함께 API 요청을 보냅니다
  const anthropic = new Anthropic();
  const response = await anthropic.messages.create({
    model: "claude-opus-5-5",
    max_tokens: 1024,
    messages: [
      {
        role: "user",
        content: [
          {
            type: "document",
            source: {
              type: "base64",
              media_type: "application/pdf",
              data: pdfBase64
            }
          },
          {
            type: "text",
            text: "What are the key findings in this document?"
          }
        ]
      }
    ]
  });

  console.log(response);
  ```

  ```csharp C#
  var client = new AnthropicClient();

  // 방법 1: 원격 PDF를 다운로드하고 인코딩합니다
  var pdfUrl = "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf";
  using var httpClient = new HttpClient();
  var pdfBase64 = Convert.ToBase64String(await httpClient.GetByteArrayAsync(pdfUrl));

  // 방법 2: 로컬 파일에서 로드합니다
  // var pdfBase64 = Convert.ToBase64String(await File.ReadAllBytesAsync("document.pdf"));

  // base64 데이터로 문서 블록을 생성합니다
  var documentParam = new DocumentBlockParam
  {
      Source = new Base64PdfSource { Data = pdfBase64 },
  };

  // 문서 및 텍스트 콘텐츠 블록으로 메시지를 생성합니다
  var message = await client.Messages.Create(new MessageCreateParams
  {
      Model = Model.ClaudeOpus5_5,
      MaxTokens = 1024,
      Messages =
      [
          new UserMessageParam
          {
              Content = new List<ContentBlockParam>
              {
                  documentParam,
                  new TextBlockParam("What are the key findings in this document?"),
              },
          },
      ],
  });

  Console.WriteLine(string.Join("\n", message.Content));
  ```

  ```go Go
  // 먼저 PDF를 로드하고 인코딩합니다
  pdfURL := "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf"
  resp, err := http.Get(pdfURL)
  if err != nil {
  	panic(err)
  }
  defer resp.Body.Close()
  pdfBytes, err := io.ReadAll(resp.Body)
  if err != nil {
  	panic(err)
  }
  pdfBase64 := base64.StdEncoding.EncodeToString(pdfBytes)

  // 대안: 로컬 파일에서 로드합니다(imports에서 "io"와 "net/http"를 "os"로 바꾸세요)
  // pdfBytes, err := os.ReadFile("document.pdf")
  // pdfBase64 := base64.StdEncoding.EncodeToString(pdfBytes)

  // base64 인코딩을 사용하여 Claude에 전송합니다
  client := anthropic.NewClient()
  message, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
  	Model:     anthropic.ModelClaudeOpus5_5,
  	MaxTokens: 1024,
  	Messages: []anthropic.MessageParam{
  		anthropic.NewUserMessage(
  			anthropic.NewDocumentBlock(anthropic.Base64PDFSourceParam{
  				Data: pdfBase64,
  			}),
  			anthropic.NewTextBlock("What are the key findings in this document?"),
  		),
  	},
  })
  if err != nil {
  	panic(err)
  }

  fmt.Printf("%+v\n", message.Content)
  ```

  ```java Java
  AnthropicClient client = AnthropicOkHttpClient.fromEnv();

  // 방법 1: 원격 PDF 다운로드 및 인코딩
  String pdfUrl =
      "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf";
  HttpClient httpClient = HttpClient.newBuilder()
      .followRedirects(HttpClient.Redirect.NORMAL)
      .build();
  HttpRequest request = HttpRequest.newBuilder()
      .uri(URI.create(pdfUrl))
      .GET()
      .build();

  HttpResponse<byte[]> response = httpClient.send(
      request,
      HttpResponse.BodyHandlers.ofByteArray()
  );
  String pdfBase64 = Base64.getEncoder().encodeToString(response.body());

  // 방법 2: 로컬 파일에서 로드
  // byte[] fileBytes = Files.readAllBytes(Path.of("document.pdf"));
  // String pdfBase64 = Base64.getEncoder().encodeToString(fileBytes);

  // base64 데이터로 document 블록 생성
  DocumentBlockParam documentParam = DocumentBlockParam.builder()
      .source(Base64PdfSource.builder()
          .data(pdfBase64)
          .build())
      .build();

  // document 및 text 콘텐츠 블록으로 메시지 생성
  MessageCreateParams params = MessageCreateParams.builder()
      .model(Model.CLAUDE_OPUS_5_5)
      .maxTokens(1024)
      .addUserMessageOfContentBlockParams(
          List.of(
              ContentBlockParam.ofDocument(documentParam),
              ContentBlockParam.ofText(
                  TextBlockParam.builder()
                      .text("What are the key findings in this document?")
                      .build()
              )
          )
      )
      .build();

  Message message = client.messages().create(params);
  IO.println(message.content());
  ```

  ```php PHP
  $client = new Client();

  // 먼저 PDF를 로드하고 인코딩합니다
  $pdf_url = 'https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf';
  $pdf_bytes = file_get_contents($pdf_url)
      ?: throw new \RuntimeException('Could not fetch the PDF.');
  $pdf_data = base64_encode($pdf_bytes);

  // 대안: 로컬 파일에서 로드합니다
  // $pdf_bytes = file_get_contents('document.pdf')
  //     ?: throw new \RuntimeException('Could not read document.pdf.');
  // $pdf_data = base64_encode($pdf_bytes);

  // base64 인코딩을 사용하여 Claude에 전송합니다
  $message = $client->messages->create(
      maxTokens: 1024,
      messages: [
          [
              'role' => 'user',
              'content' => [
                  [
                      'type' => 'document',
                      'source' => [
                          'type' => 'base64',
                          'mediaType' => 'application/pdf',
                          'data' => $pdf_data,
                      ],
                  ],
                  [
                      'type' => 'text',
                      'text' => 'What are the key findings in this document?',
                  ],
              ],
          ],
      ],
      model: Model::CLAUDE_OPUS_5_5,
  );

  echo $message;
  ```

  ```ruby Ruby
  require "open-uri"

  # 먼저 PDF를 로드하고 인코딩합니다
  pdf_url = "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf"
  pdf_bytes = URI.open(pdf_url, "rb", &:read)
  pdf_data = [pdf_bytes].pack("m0") # Encode as base64 without newlines

  # 대안: 로컬 파일에서 로드합니다
  # pdf_data = [File.binread("document.pdf")].pack("m0")

  # base64 인코딩을 사용하여 Claude에 전송합니다
  anthropic = Anthropic::Client.new
  message = anthropic.messages.create(
    model: Anthropic::Model::CLAUDE_OPUS_5_5,
    max_tokens: 1024,
    messages: [
      {
        role: "user",
        content: [
          {
            type: "document",
            source: {
              type: "base64",
              media_type: "application/pdf",
              data: pdf_data
            }
          },
          {type: "text", text: "What are the key findings in this document?"}
        ]
      }
    ]
  )

  puts(message.content)
  ```
</CodeGroup>

#### 옵션 3: Files API

반복적으로 사용할 PDF이거나 인코딩 오버헤드를 피하고 싶은 경우, [Files API](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/files)를 사용하세요:

<CodeGroup>
  ```bash cURL
  # 먼저 PDF를 Files API에 업로드하세요
  curl -sS -X POST https://code.saschaberens.de/_h/api.anthropic.com/v1/files \
    -H "x-api-key: $ANTHROPIC_API_KEY" \
    -H "anthropic-version: 2026-10-21" \
    -F "file=@document.pdf"

  # 그런 다음 업로드 응답의 file_id를 메시지에 사용하세요
  curl https://code.saschaberens.de/_h/api.anthropic.com/v1/messages \
    -H "content-type: application/json" \
    -H "x-api-key: $ANTHROPIC_API_KEY" \
    -H "anthropic-version: 2026-10-21" \
    -d '{
      "model": "claude-opus-5-5",
      "max_tokens": 1024,
      "messages": [{
        "role": "user",
        "content": [{
          "type": "document",
          "source": {
            "type": "file",
            "file_id": "'"$FILE_ID"'"
          }
        },
        {
          "type": "text",
          "text": "What are the key findings in this document?"
        }]
      }]
    }'
  ```

  ```bash CLI
  # 먼저 PDF를 Files API에 업로드하세요
  ant files upload --file ./document.pdf

  # 그런 다음 업로드 응답의 file_id를 메시지에 사용하세요
  ant messages create <<YAML
  model: claude-opus-5-5
  max_tokens: 1024
  messages:
    - role: user
      content:
        - type: document
          source:
            type: file
            file_id: $FILE_ID
        - type: text
          text: What are the key findings in this document?
  YAML
  ```

  ```python Python
  client = anthropic.Anthropic()

  # PDF 파일을 업로드합니다
  with open("/path/to/document.pdf", "rb") as f:
      file_upload = client.files.upload(file=("document.pdf", f, "application/pdf"))

  # 업로드한 파일을 메시지에서 사용합니다
  message = client.messages.create(
      model="claude-opus-5-5",
      max_tokens=1024,
      messages=[
          {
              "role": "user",
              "content": [
                  {
                      "type": "document",
                      "source": {"type": "file", "file_id": file_upload.id},
                  },
                  {"type": "text", "text": "What are the key findings in this document?"},
              ],
          }
      ],
  )

  print(message.content)
  ```

  ```typescript TypeScript
  import Anthropic, { toFile } from "@anthropic-ai/sdk";
  import fs from "node:fs";

  const anthropic = new Anthropic();

  // PDF 파일을 업로드합니다
  const fileUpload = await anthropic.files.upload({
    file: await toFile(fs.createReadStream("/path/to/document.pdf"), undefined, {
      type: "application/pdf"
    })
  });

  // 업로드한 파일을 메시지에서 사용합니다
  const response = await anthropic.messages.create({
    model: "claude-opus-5-5",
    max_tokens: 1024,
    messages: [
      {
        role: "user",
        content: [
          {
            type: "document",
            source: {
              type: "file",
              file_id: fileUpload.id
            }
          },
          {
            type: "text",
            text: "What are the key findings in this document?"
          }
        ]
      }
    ]
  });

  console.log(response);
  ```

  ```csharp C#
  var client = new AnthropicClient();

  // PDF 파일을 업로드합니다
  var fileUpload = await client.Files.Upload(new FileUploadParams
  {
      File = new BinaryContent
      {
          Stream = File.OpenRead("/path/to/document.pdf"),
          FileName = "document.pdf",
          ContentType = new("application/pdf"),
      },
  });

  // 업로드한 파일을 메시지에서 사용합니다
  var message = await client.Messages.Create(new MessageCreateParams
  {
      Model = Model.ClaudeOpus5_5,
      MaxTokens = 1024,
      Messages =
      [
          new UserMessageParam
          {
              Content = new List<ContentBlockParam>
              {
                  new DocumentBlockParam
                  {
                      Source = new FileDocumentSource { FileID = fileUpload.ID },
                  },
                  new TextBlockParam("What are the key findings in this document?"),
              },
          },
      ],
  });

  Console.WriteLine(string.Join("\n", message.Content));
  ```

  ```go Go
  client := anthropic.NewClient()

  // PDF 파일을 업로드합니다
  pdfFile, err := os.Open("/path/to/document.pdf")
  if err != nil {
  	panic(err)
  }
  defer pdfFile.Close()

  fileUpload, err := client.Files.Upload(context.TODO(), anthropic.FileUploadParams{
  	File: anthropic.File(pdfFile, "document.pdf", "application/pdf"),
  })
  if err != nil {
  	panic(err)
  }

  // 업로드한 파일을 메시지에서 사용합니다
  message, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
  	Model:     anthropic.ModelClaudeOpus5_5,
  	MaxTokens: 1024,
  	Messages: []anthropic.MessageParam{
  		anthropic.NewUserMessage(
  			anthropic.NewDocumentBlock(anthropic.FileDocumentSourceParam{
  				FileID: fileUpload.ID,
  			}),
  			anthropic.NewTextBlock("What are the key findings in this document?"),
  		),
  	},
  })
  if err != nil {
  	panic(err)
  }

  fmt.Printf("%+v\n", message.Content)
  ```

  ```java Java
  AnthropicClient client = AnthropicOkHttpClient.fromEnv();

  // PDF 파일 업로드
  FileMetadata file = client
      .files()
      .upload(FileUploadParams.builder()
          .file(Path.of("/path/to/document.pdf"))
          .build());

  // 업로드한 파일을 메시지에서 사용
  MessageCreateParams params = MessageCreateParams.builder()
      .model(Model.CLAUDE_OPUS_5_5)
      .maxTokens(1024)
      .addUserMessageOfContentBlockParams(
          List.of(
              ContentBlockParam.ofDocument(
                  DocumentBlockParam.builder()
                      .fileSource(file.id())
                      .build()
              ),
              ContentBlockParam.ofText(
                  TextBlockParam.builder()
                      .text("What are the key findings in this document?")
                      .build()
              )
          )
      )
      .build();

  Message message = client.messages().create(params);
  IO.println(message.content());
  ```

  ```php PHP
  use Anthropic\Core\FileParam;

  $client = new Client();

  // PDF 파일을 업로드합니다
  $document = fopen('/path/to/document.pdf', 'rb')
      ?: throw new \RuntimeException('Could not open /path/to/document.pdf.');

  $file_upload = $client->files->upload(
      file: FileParam::fromResource($document, contentType: 'application/pdf'),
  );

  // 업로드한 파일을 메시지에서 사용합니다
  $message = $client->messages->create(
      maxTokens: 1024,
      messages: [
          [
              'role' => 'user',
              'content' => [
                  [
                      'type' => 'document',
                      'source' => [
                          'type' => 'file',
                          'fileID' => $file_upload->id,
                      ],
                  ],
                  [
                      'type' => 'text',
                      'text' => 'What are the key findings in this document?',
                  ],
              ],
          ],
      ],
      model: Model::CLAUDE_OPUS_5_5,
  );

  echo $message;
  ```

  ```ruby Ruby
  anthropic = Anthropic::Client.new

  # PDF 파일을 업로드합니다
  file_upload = File.open("/path/to/document.pdf", "rb") do |pdf_file|
    anthropic.files.upload(
      file: Anthropic::FilePart.new(pdf_file, filename: "document.pdf", content_type: "application/pdf")
    )
  end

  # 업로드한 파일을 메시지에서 사용합니다
  message = anthropic.messages.create(
    model: Anthropic::Model::CLAUDE_OPUS_5_5,
    max_tokens: 1024,
    messages: [
      {
        role: "user",
        content: [
          {
            type: "document",
            source: {type: "file", file_id: file_upload.id}
          },
          {type: "text", text: "What are the key findings in this document?"}
        ]
      }
    ]
  )

  puts(message.content)
  ```
</CodeGroup>

### PDF 지원 작동 방식

Claude에 PDF를 보내면 다음 단계가 수행됩니다:

<Steps>
  <Step title="시스템이 문서의 내용을 추출합니다.">
    * 시스템이 문서의 각 페이지를 이미지로 변환합니다.
    * 시스템이 각 페이지의 텍스트를 추출하여 해당 페이지의 이미지와 함께 제공합니다.
  </Step>

  <Step title="Claude가 텍스트와 이미지를 모두 분석합니다.">
    * Claude는 각 문서를 텍스트와 이미지의 조합으로 받습니다.
    * Claude가 각 페이지의 이미지를 받으므로, 차트, 다이어그램 및 기타 비텍스트 콘텐츠와 같은 PDF의 시각적 요소에 대한 인사이트를 요청할 수 있습니다.
  </Step>

  <Step title="Claude가 관련이 있는 경우 PDF의 내용을 응답에 활용합니다.">
    Claude는 응답에서 텍스트 콘텐츠와 시각적 콘텐츠를 모두 활용할 수 있습니다.
  </Step>
</Steps>

### 비용 추정

PDF 파일의 토큰 수는 문서에서 추출된 전체 텍스트와 페이지 수에 따라 달라집니다:

* 텍스트 토큰 비용: 각 페이지는 콘텐츠 밀도에 따라 일반적으로 1,500–3,000개의 토큰을 사용합니다. 추가 PDF 요금 없이 표준 API 요금이 적용됩니다.
* 이미지 토큰 비용: API가 페이지 이미지를 표준 해상도 등급의 제한 내에 맞추므로, 각 페이지의 이미지는 모든 모델에서 최대 1,568개의 시각 토큰을 사용합니다. 이미지의 시각 토큰을 계산하는 방법은 [해상도 및 토큰 비용](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/vision#evaluate-image-size)을 참조하세요.

[토큰 카운팅](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/token-counting)을 사용하여 특정 PDF의 비용을 추정할 수 있습니다.

## PDF 처리 최적화

PDF 지원을 다른 기능과 결합할 수 있습니다:

* [프롬프트 캐싱 사용](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/pdf-support#use-prompt-caching)으로 반복 분석의 성능을 향상시킵니다.
* [문서 배치 처리](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/pdf-support#process-document-batches)로 대량의 문서를 처리합니다.
* [도구를 사용](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/agents-and-tools/tool-use/overview)하여 Claude가 도구 입력으로 사용할 특정 정보를 문서에서 추출하도록 합니다.

### 성능 향상

최적의 결과를 위해 다음 모범 사례를 따르세요:

* 요청에서 PDF를 텍스트 앞에 배치하세요
* 표준 글꼴을 사용하세요
* 텍스트가 명확하고 읽기 쉬운지 확인하세요
* 페이지를 올바른 정방향으로 회전하세요
* 프롬프트에서 논리적 페이지 번호(PDF 뷰어 기준)를 사용하세요
* 필요한 경우 대용량 PDF를 청크로 분할하세요
* 반복 분석을 위해 프롬프트 캐싱을 활성화하세요

### 구현 확장

대량 처리의 경우 다음 접근 방식을 고려하세요:

#### 프롬프트 캐싱 사용

반복 쿼리의 성능을 향상시키려면 [프롬프트 캐싱](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/prompt-caching)으로 PDF를 캐시하세요:

<CodeGroup>
  ```bash cURL
  curl -sL "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf" |
    base64 | tr -d '\n' |
    jq -Rs '{
      model: "claude-opus-5-5",
      max_tokens: 1024,
      messages: [{
        role: "user",
        content: [
          {
            type: "document",
            source: {type: "base64", media_type: "application/pdf", data: .},
            cache_control: {type: "ephemeral"}
          },
          {type: "text", text: "Which model has the highest human preference win rates across each use-case?"}
        ]
      }]
    }' |
    curl https://code.saschaberens.de/_h/api.anthropic.com/v1/messages \
      -H "content-type: application/json" \
      -H "x-api-key: $ANTHROPIC_API_KEY" \
      -H "anthropic-version: 2026-10-21" \
      -d @-
  ```

  ```bash CLI
  ant messages create <<'YAML'
  model: claude-opus-5-5
  max_tokens: 1024
  messages:
    - role: user
      content:
        - type: document
          source:
            type: base64
            media_type: application/pdf
            data: "@./document.pdf"
          cache_control:
            type: ephemeral
        - type: text
          text: Which model has the highest human preference win rates across each use-case?
  YAML
  ```

  ```python Python
  import base64
  import httpx2

  # 먼저 PDF를 로드하고 인코딩합니다
  pdf_url = "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf"
  pdf_data = base64.standard_b64encode(
      httpx2.get(pdf_url, follow_redirects=True).content
  ).decode("utf-8")

  # 캐시된 문서로 메시지를 생성합니다
  client = anthropic.Anthropic()
  message = client.messages.create(
      model="claude-opus-5-5",
      max_tokens=1024,
      messages=[
          {
              "role": "user",
              "content": [
                  {
                      "type": "document",
                      "source": {
                          "type": "base64",
                          "media_type": "application/pdf",
                          "data": pdf_data,
                      },
                      "cache_control": {"type": "ephemeral"},
                  },
                  {
                      "type": "text",
                      "text": "Which model has the highest human preference win rates across each use-case?",
                  },
              ],
          }
      ],
  )

  print(message.content)
  ```

  ```typescript TypeScript
  // 먼저 PDF를 로드하고 인코딩합니다
  const pdfURL =
    "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf";
  const pdfResponse = await fetch(pdfURL);
  const arrayBuffer = await pdfResponse.arrayBuffer();
  const pdfBase64 = Buffer.from(arrayBuffer).toString("base64");

  // 캐시된 문서로 메시지를 생성합니다
  const anthropic = new Anthropic();
  const response = await anthropic.messages.create({
    model: "claude-opus-5-5",
    max_tokens: 1024,
    messages: [
      {
        role: "user",
        content: [
          {
            type: "document",
            source: {
              type: "base64",
              media_type: "application/pdf",
              data: pdfBase64
            },
            cache_control: { type: "ephemeral" }
          },
          {
            type: "text",
            text: "Which model has the highest human preference win rates across each use-case?"
          }
        ]
      }
    ]
  });

  console.log(response);
  ```

  ```csharp C#
  var client = new AnthropicClient();

  // PDF를 다운로드하고 인코딩합니다
  var pdfUrl = "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf";
  using var httpClient = new HttpClient();
  var pdfBase64 = Convert.ToBase64String(await httpClient.GetByteArrayAsync(pdfUrl));

  var message = await client.Messages.Create(new MessageCreateParams
  {
      Model = Model.ClaudeOpus5_5,
      MaxTokens = 1024,
      Messages =
      [
          new UserMessageParam
          {
              Content = new List<ContentBlockParam>
              {
                  new DocumentBlockParam
                  {
                      Source = new Base64PdfSource { Data = pdfBase64 },
                      CacheControl = new CacheControlEphemeral(),
                  },
                  new TextBlockParam("Which model has the highest human preference win rates across each use-case?"),
              },
          },
      ],
  });

  Console.WriteLine(message);
  ```

  ```go Go
  // 먼저 PDF를 로드하고 인코딩합니다
  pdfURL := "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf"
  resp, err := http.Get(pdfURL)
  if err != nil {
  	panic(err)
  }
  defer resp.Body.Close()
  pdfBytes, err := io.ReadAll(resp.Body)
  if err != nil {
  	panic(err)
  }
  pdfBase64 := base64.StdEncoding.EncodeToString(pdfBytes)

  // 캐시 제어가 포함된 문서 블록을 생성합니다
  client := anthropic.NewClient()
  message, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
  	Model:     anthropic.ModelClaudeOpus5_5,
  	MaxTokens: 1024,
  	Messages: []anthropic.MessageParam{
  		anthropic.NewUserMessage(
  			anthropic.ContentBlockParamUnion{
  				OfDocument: &anthropic.DocumentBlockParam{
  					Source: anthropic.DocumentBlockParamSourceUnion{
  						OfBase64: &anthropic.Base64PDFSourceParam{
  							Data: pdfBase64,
  						},
  					},
  					CacheControl: anthropic.NewCacheControlEphemeralParam(),
  				},
  			},
  			anthropic.NewTextBlock("Which model has the highest human preference win rates across each use-case?"),
  		),
  	},
  })
  if err != nil {
  	panic(err)
  }

  fmt.Printf("%+v\n", message.Content)
  ```

  ```java Java
  AnthropicClient client = AnthropicOkHttpClient.fromEnv();

  // PDF를 다운로드하고 인코딩합니다
  String pdfUrl =
      "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf";
  HttpClient httpClient = HttpClient.newBuilder()
      .followRedirects(HttpClient.Redirect.NORMAL)
      .build();
  HttpRequest request = HttpRequest.newBuilder()
      .uri(URI.create(pdfUrl))
      .GET()
      .build();

  HttpResponse<byte[]> response = httpClient.send(
      request,
      HttpResponse.BodyHandlers.ofByteArray()
  );
  String pdfBase64 = Base64.getEncoder().encodeToString(response.body());

  MessageCreateParams params = MessageCreateParams.builder()
      .model(Model.CLAUDE_OPUS_5_5)
      .maxTokens(1024)
      .addUserMessageOfContentBlockParams(
          List.of(
              ContentBlockParam.ofDocument(
                  DocumentBlockParam.builder()
                      .source(Base64PdfSource.builder()
                          .data(pdfBase64)
                          .build())
                      .cacheControl(CacheControlEphemeral.builder().build())
                      .build()
              ),
              ContentBlockParam.ofText(
                  TextBlockParam.builder()
                      .text(
                          "Which model has the highest human preference win rates across each use-case?"
                      )
                      .build()
              )
          )
      )
      .build();

  Message message = client.messages().create(params);
  IO.println(message);
  ```

  ```php PHP
  $client = new Client();

  // PDF를 로드하고 인코딩합니다
  $pdf_url = 'https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf';
  $pdf_bytes = file_get_contents($pdf_url)
      ?: throw new \RuntimeException('Could not fetch the PDF.');
  $pdf_data = base64_encode($pdf_bytes);

  $message = $client->messages->create(
      maxTokens: 1024,
      messages: [
          [
              'role' => 'user',
              'content' => [
                  [
                      'type' => 'document',
                      'source' => [
                          'type' => 'base64',
                          'mediaType' => 'application/pdf',
                          'data' => $pdf_data,
                      ],
                      'cacheControl' => ['type' => 'ephemeral'],
                  ],
                  [
                      'type' => 'text',
                      'text' => 'Which model has the highest human preference win rates across each use-case?',
                  ],
              ],
          ],
      ],
      model: Model::CLAUDE_OPUS_5_5,
  );

  echo $message;
  ```

  ```ruby Ruby
  require "open-uri"

  # PDF를 로드하고 인코딩합니다
  pdf_url = "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf"
  pdf_bytes = URI.open(pdf_url, "rb", &:read)
  pdf_data = [pdf_bytes].pack("m0") # Encode as base64 without newlines

  anthropic = Anthropic::Client.new

  message = anthropic.messages.create(
    model: Anthropic::Model::CLAUDE_OPUS_5_5,
    max_tokens: 1024,
    messages: [
      {
        role: "user",
        content: [
          {
            type: "document",
            source: {
              type: "base64",
              media_type: "application/pdf",
              data: pdf_data
            },
            cache_control: {type: "ephemeral"}
          },
          {
            type: "text",
            text: "Which model has the highest human preference win rates across each use-case?"
          }
        ]
      }
    ]
  )

  puts(message.content)
  ```
</CodeGroup>

#### 문서 배치 처리

[Message Batches API](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/batch-processing)를 사용하여 하나의 요청으로 여러 PDF를 처리하세요:

<CodeGroup>
  ```bash cURL
  curl -sL "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf" | base64 | tr -d '\n' > pdf_base64.txt
  # pdf_base64.txt 내용을 사용하여 JSON 요청 파일을 생성합니다
  jq -n --rawfile PDF_BASE64 pdf_base64.txt '{
    "requests": [
    {
      "custom_id": "my-first-request",
      "params": {
        "model": "claude-opus-5-5",
        "max_tokens": 1024,
        "messages": [{
          "role": "user",
          "content": [{
            "type": "document",
            "source": {
              "type": "base64",
              "media_type": "application/pdf",
              "data": $PDF_BASE64
            }
          },
          {
            "type": "text",
            "text": "Which model has the highest human preference win rates across each use-case?"
          }]
        }]
      }
    },
    {
      "custom_id": "my-second-request",
      "params": {
        "model": "claude-opus-5-5",
        "max_tokens": 1024,
        "messages": [{
          "role": "user",
          "content": [{
            "type": "document",
            "source": {
              "type": "base64",
              "media_type": "application/pdf",
              "data": $PDF_BASE64
            }
          },
          {
            "type": "text",
            "text": "Extract 5 key insights from this document."
          }]
        }]
      }
    }]
  }' > request.json

  # 그런 다음 JSON 파일을 사용하여 API 호출을 수행합니다
  curl https://code.saschaberens.de/_h/api.anthropic.com/v1/messages/batches \
    -H "content-type: application/json" \
    -H "x-api-key: $ANTHROPIC_API_KEY" \
    -H "anthropic-version: 2026-10-21" \
    -d @request.json
  ```

  ```bash CLI
  ant messages:batches create <<'YAML'
  requests:
    - custom_id: my-first-request
      params:
        model: claude-opus-5-5
        max_tokens: 1024
        messages:
          - role: user
            content:
              - type: document
                source:
                  type: base64
                  media_type: application/pdf
                  data: "@./document.pdf"
              - type: text
                text: >-
                  Which model has the highest human preference win rates
                  across each use-case?
    - custom_id: my-second-request
      params:
        model: claude-opus-5-5
        max_tokens: 1024
        messages:
          - role: user
            content:
              - type: document
                source:
                  type: base64
                  media_type: application/pdf
                  data: "@./document.pdf"
              - type: text
                text: Extract 5 key insights from this document.
  YAML
  ```

  ```python Python
  import base64
  import httpx2

  # 먼저 PDF를 로드하고 인코딩합니다
  pdf_url = "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf"
  pdf_data = base64.standard_b64encode(
      httpx2.get(pdf_url, follow_redirects=True).content
  ).decode("utf-8")

  # 문서를 사용하는 요청 배치를 생성합니다
  client = anthropic.Anthropic()
  message_batch = client.messages.batches.create(
      requests=[
          {
              "custom_id": "my-first-request",
              "params": {
                  "model": "claude-opus-5-5",
                  "max_tokens": 1024,
                  "messages": [
                      {
                          "role": "user",
                          "content": [
                              {
                                  "type": "document",
                                  "source": {
                                      "type": "base64",
                                      "media_type": "application/pdf",
                                      "data": pdf_data,
                                  },
                              },
                              {
                                  "type": "text",
                                  "text": "Which model has the highest human preference win rates across each use-case?",
                              },
                          ],
                      }
                  ],
              },
          },
          {
              "custom_id": "my-second-request",
              "params": {
                  "model": "claude-opus-5-5",
                  "max_tokens": 1024,
                  "messages": [
                      {
                          "role": "user",
                          "content": [
                              {
                                  "type": "document",
                                  "source": {
                                      "type": "base64",
                                      "media_type": "application/pdf",
                                      "data": pdf_data,
                                  },
                              },
                              {
                                  "type": "text",
                                  "text": "Extract 5 key insights from this document.",
                              },
                          ],
                      }
                  ],
              },
          },
      ]
  )

  print(message_batch)
  ```

  ```typescript TypeScript
  // 먼저 PDF를 로드하고 인코딩합니다
  const pdfURL =
    "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf";
  const pdfResponse = await fetch(pdfURL);
  const arrayBuffer = await pdfResponse.arrayBuffer();
  const pdfBase64 = Buffer.from(arrayBuffer).toString("base64");

  // 문서를 사용하는 요청 배치를 생성합니다
  const anthropic = new Anthropic();
  const response = await anthropic.messages.batches.create({
    requests: [
      {
        custom_id: "my-first-request",
        params: {
          model: "claude-opus-5-5",
          max_tokens: 1024,
          messages: [
            {
              role: "user",
              content: [
                {
                  type: "document",
                  source: {
                    type: "base64",
                    media_type: "application/pdf",
                    data: pdfBase64
                  }
                },
                {
                  type: "text",
                  text: "Which model has the highest human preference win rates across each use-case?"
                }
              ]
            }
          ]
        }
      },
      {
        custom_id: "my-second-request",
        params: {
          model: "claude-opus-5-5",
          max_tokens: 1024,
          messages: [
            {
              role: "user",
              content: [
                {
                  type: "document",
                  source: {
                    type: "base64",
                    media_type: "application/pdf",
                    data: pdfBase64
                  }
                },
                {
                  type: "text",
                  text: "Extract 5 key insights from this document."
                }
              ]
            }
          ]
        }
      }
    ]
  });

  console.log(response);
  ```

  ```csharp C#
  var client = new AnthropicClient();

  // PDF를 다운로드하고 인코딩합니다
  var pdfUrl = "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf";
  using var httpClient = new HttpClient();
  var pdfBase64 = Convert.ToBase64String(await httpClient.GetByteArrayAsync(pdfUrl));

  var batch = await client.Messages.Batches.Create(new BatchCreateParams
  {
      Requests =
      [
          new()
          {
              CustomID = "my-first-request",
              Params = new()
              {
                  Model = Model.ClaudeOpus5_5,
                  MaxTokens = 1024,
                  Messages =
                  [
                      new UserMessageParam
                      {
                          Content = new List<ContentBlockParam>
                          {
                              new DocumentBlockParam
                              {
                                  Source = new Base64PdfSource { Data = pdfBase64 },
                              },
                              new TextBlockParam("Which model has the highest human preference win rates across each use-case?"),
                          },
                      },
                  ],
              },
          },
          new()
          {
              CustomID = "my-second-request",
              Params = new()
              {
                  Model = Model.ClaudeOpus5_5,
                  MaxTokens = 1024,
                  Messages =
                  [
                      new UserMessageParam
                      {
                          Content = new List<ContentBlockParam>
                          {
                              new DocumentBlockParam
                              {
                                  Source = new Base64PdfSource { Data = pdfBase64 },
                              },
                              new TextBlockParam("Extract 5 key insights from this document."),
                          },
                      },
                  ],
              },
          },
      ],
  });

  Console.WriteLine(batch);
  ```

  ```go Go
  // 먼저 PDF를 로드하고 인코딩합니다
  pdfURL := "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf"
  resp, err := http.Get(pdfURL)
  if err != nil {
  	panic(err)
  }
  defer resp.Body.Close()
  pdfBytes, err := io.ReadAll(resp.Body)
  if err != nil {
  	panic(err)
  }
  pdfBase64 := base64.StdEncoding.EncodeToString(pdfBytes)

  // 문서를 사용하는 요청 배치를 생성합니다
  client := anthropic.NewClient()
  batch, err := client.Messages.Batches.New(context.TODO(), anthropic.MessageBatchNewParams{
  	Requests: []anthropic.MessageBatchNewParamsRequest{
  		{
  			CustomID: "my-first-request",
  			Params: anthropic.MessageBatchNewParamsRequestParams{
  				Model:     anthropic.ModelClaudeOpus5_5,
  				MaxTokens: 1024,
  				Messages: []anthropic.MessageParam{
  					anthropic.NewUserMessage(
  						anthropic.NewDocumentBlock(anthropic.Base64PDFSourceParam{
  							Data: pdfBase64,
  						}),
  						anthropic.NewTextBlock("Which model has the highest human preference win rates across each use-case?"),
  					),
  				},
  			},
  		},
  		{
  			CustomID: "my-second-request",
  			Params: anthropic.MessageBatchNewParamsRequestParams{
  				Model:     anthropic.ModelClaudeOpus5_5,
  				MaxTokens: 1024,
  				Messages: []anthropic.MessageParam{
  					anthropic.NewUserMessage(
  						anthropic.NewDocumentBlock(anthropic.Base64PDFSourceParam{
  							Data: pdfBase64,
  						}),
  						anthropic.NewTextBlock("Extract 5 key insights from this document."),
  					),
  				},
  			},
  		},
  	},
  })
  if err != nil {
  	panic(err)
  }

  fmt.Printf("%+v\n", batch)
  ```

  ```java Java
  AnthropicClient client = AnthropicOkHttpClient.fromEnv();

  // PDF를 다운로드하고 인코딩합니다
  String pdfUrl =
      "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf";
  HttpClient httpClient = HttpClient.newBuilder()
      .followRedirects(HttpClient.Redirect.NORMAL)
      .build();
  HttpRequest request = HttpRequest.newBuilder()
      .uri(URI.create(pdfUrl))
      .GET()
      .build();

  HttpResponse<byte[]> response = httpClient.send(
      request,
      HttpResponse.BodyHandlers.ofByteArray()
  );
  String pdfBase64 = Base64.getEncoder().encodeToString(response.body());

  BatchCreateParams params = BatchCreateParams.builder()
      .addRequest(
          BatchCreateParams.Request.builder()
              .customId("my-first-request")
              .params(
                  BatchCreateParams.Request.Params.builder()
                      .model(Model.CLAUDE_OPUS_5_5)
                      .maxTokens(1024)
                      .addUserMessageOfContentBlockParams(
                          List.of(
                              ContentBlockParam.ofDocument(
                                  DocumentBlockParam.builder()
                                      .source(Base64PdfSource.builder()
                                          .data(pdfBase64)
                                          .build())
                                      .build()
                              ),
                              ContentBlockParam.ofText(
                                  TextBlockParam.builder()
                                      .text(
                                          "Which model has the highest human preference win rates across each use-case?"
                                      )
                                      .build()
                              )
                          )
                      )
                      .build()
              )
              .build()
      )
      .addRequest(
          BatchCreateParams.Request.builder()
              .customId("my-second-request")
              .params(
                  BatchCreateParams.Request.Params.builder()
                      .model(Model.CLAUDE_OPUS_5_5)
                      .maxTokens(1024)
                      .addUserMessageOfContentBlockParams(
                          List.of(
                              ContentBlockParam.ofDocument(
                                  DocumentBlockParam.builder()
                                      .source(Base64PdfSource.builder()
                                          .data(pdfBase64)
                                          .build())
                                      .build()
                              ),
                              ContentBlockParam.ofText(
                                  TextBlockParam.builder()
                                      .text("Extract 5 key insights from this document.")
                                      .build()
                              )
                          )
                      )
                      .build()
              )
              .build()
      )
      .build();

  MessageBatch batch = client.messages().batches().create(params);
  IO.println(batch);
  ```

  ```php PHP
  $client = new Client();

  // PDF를 로드하고 인코딩합니다
  $pdf_url = 'https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf';
  $pdf_bytes = file_get_contents($pdf_url)
      ?: throw new \RuntimeException('Could not fetch the PDF.');
  $pdf_data = base64_encode($pdf_bytes);

  $batch = $client->messages->batches->create(
      requests: [
          [
              'customID' => 'my-first-request',
              'params' => [
                  'model' => Model::CLAUDE_OPUS_5_5,
                  'maxTokens' => 1024,
                  'messages' => [
                      [
                          'role' => 'user',
                          'content' => [
                              [
                                  'type' => 'document',
                                  'source' => [
                                      'type' => 'base64',
                                      'mediaType' => 'application/pdf',
                                      'data' => $pdf_data,
                                  ],
                              ],
                              [
                                  'type' => 'text',
                                  'text' => 'Which model has the highest human preference win rates across each use-case?',
                              ],
                          ],
                      ],
                  ],
              ],
          ],
          [
              'customID' => 'my-second-request',
              'params' => [
                  'model' => Model::CLAUDE_OPUS_5_5,
                  'maxTokens' => 1024,
                  'messages' => [
                      [
                          'role' => 'user',
                          'content' => [
                              [
                                  'type' => 'document',
                                  'source' => [
                                      'type' => 'base64',
                                      'mediaType' => 'application/pdf',
                                      'data' => $pdf_data,
                                  ],
                              ],
                              [
                                  'type' => 'text',
                                  'text' => 'Extract 5 key insights from this document.',
                              ],
                          ],
                      ],
                  ],
              ],
          ],
      ],
  );

  echo $batch;
  ```

  ```ruby Ruby
  require "open-uri"

  # PDF를 로드하고 인코딩합니다
  pdf_url = "https://code.saschaberens.de/_h/assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf"
  pdf_bytes = URI.open(pdf_url, "rb", &:read)
  pdf_data = [pdf_bytes].pack("m0") # Encode as base64 without newlines

  anthropic = Anthropic::Client.new

  message_batch = anthropic.messages.batches.create(
    requests: [
      {
        custom_id: "my-first-request",
        params: {
          model: Anthropic::Model::CLAUDE_OPUS_5_5,
          max_tokens: 1024,
          messages: [
            {
              role: "user",
              content: [
                {
                  type: "document",
                  source: {
                    type: "base64",
                    media_type: "application/pdf",
                    data: pdf_data
                  }
                },
                {
                  type: "text",
                  text: "Which model has the highest human preference win rates across each use-case?"
                }
              ]
            }
          ]
        }
      },
      {
        custom_id: "my-second-request",
        params: {
          model: Anthropic::Model::CLAUDE_OPUS_5_5,
          max_tokens: 1024,
          messages: [
            {
              role: "user",
              content: [
                {
                  type: "document",
                  source: {
                    type: "base64",
                    media_type: "application/pdf",
                    data: pdf_data
                  }
                },
                {
                  type: "text",
                  text: "Extract 5 key insights from this document."
                }
              ]
            }
          ]
        }
      }
    ]
  )

  puts(message_batch)
  ```
</CodeGroup>

배치는 비동기적으로 처리됩니다. 진행 상황을 확인하고 처리가 끝난 후 결과를 가져오려면 [배치 처리](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/batch-processing)를 참조하세요.

## 다음 단계

<CardGroup cols={2}>
  <Card title="비전" icon="image" href="https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/vision">
    이미지의 시각 토큰을 계산하는 방법과 PDF가 다른 비전 작업과 공유하는 제한 사항을 알아보세요.
  </Card>

  <Card title="PDF 예제 사용해 보기" icon="file" href="https://code.saschaberens.de/_h/platform.claude.com/cookbook/multimodal-getting-started-with-vision">
    Claude Cookbook 레시피에서 PDF 처리의 실용적인 예제를 살펴보세요.
  </Card>

  <Card title="API 레퍼런스 보기" icon="code" href="https://code.saschaberens.de/_h/platform.claude.com/docs/ko/api/messages/create">
    PDF 지원에 대한 전체 API 문서를 확인하세요.
  </Card>
</CardGroup>

## 제공 여부

PDF 지원은(는) 모든 모델에서 사용 가능 상태이며 제로 데이터 보존 및 HIPAA 대비에 적격합니다.

### API 지원

#### [Messages API](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/working-with-messages)

* 제공 여부: 항상 활성화

| 상태 | 클라우드 플랫폼 |
| ----- | ----- |
| 사용 가능 | Claude API, [Claude Platform on AWS](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/claude-platform-on-aws), [Claude Models on Google Cloud (Anthropic managed)](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/claude-models-on-google-cloud/anthropic-managed) |
| 사용 가능<sup>1</sup> | [Microsoft Foundry](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/claude-in-microsoft-foundry) |
| 사용 가능<sup>2</sup> | [Amazon Bedrock (bedrock-runtime)](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/claude-on-amazon-bedrock-legacy) |
| 사용 가능<sup>2</sup> | [Amazon Bedrock](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/claude-in-amazon-bedrock), [Claude Models on Google Cloud (Google managed)](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/build-with-claude/claude-models-on-google-cloud/google-managed) |

1. `file_id` 소스에는 Anthropic에서 호스팅되는 배포가 필요합니다.
2. Base64 소스만 지원합니다.

#### [Managed Agents](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/managed-agents/overview)

* 제공 여부: 항상 활성화

| 상태 | 클라우드 플랫폼 |
| ----- | ----- |
| 사용 가능 | 지원되는 모든 플랫폼 |

### 데이터 처리

[데이터 처리 개요](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/manage-claude/api-and-data-retention#feature-eligibility)

| 항목 | 제로 데이터 보존 | HIPAA |
| ----- | ----- | ----- |
| 상태 | 적격([적용 모델](https://code.saschaberens.de/_h/platform.claude.com/docs/ko/manage-claude/api-and-data-retention#model-specific-data-retention-requirements) 제외) | 적격 |
| 세부 정보 | — | HIPAA 적격성은 Files API가 아닌 Messages API를 통해 인라인으로 전송된 PDF에 적용됩니다. |

적용 엔드포인트:

* `/v1/messages`
