이제 제공하는 PDF의 텍스트, 그림, 차트, 표에 대해 Claude에게 질문할 수 있습니다. 몇 가지 사용 사례는 다음과 같습니다:
Claude는 모든 표준 PDF에서 작동합니다. 그러나 PDF 지원을 사용할 때 요청 크기가 다음 요구 사항을 충족하는지 확인해야 합니다:
| 요구 사항 | 제한 |
|---|---|
| 최대 요청 크기 | 32MB |
| 요청당 최대 페이지 수 | 100 |
| 형식 | 표준 PDF (비밀번호/암호화 없음) |
두 제한 모두 PDF와 함께 전송되는 다른 콘텐츠를 포함한 전체 요청 페이로드에 적용된다는 점에 유의하세요.
PDF 지원은 Claude의 비전 기능에 의존하므로 다른 비전 작업과 동일한 제한 사항 및 고려 사항이 적용됩니다.
PDF 지원은 현재 직접 API 액세스 및 Google Vertex AI를 통해 지원됩니다. 모든 활성 모델이 PDF 처리를 지원합니다.
PDF 지원은 이제 다음 고려 사항과 함께 Amazon Bedrock에서 사용할 수 있습니다:
Amazon Bedrock의 Converse API를 통해 PDF 지원을 사용할 때 두 가지 별도의 문서 처리 모드가 있습니다:
중요: Converse API에서 Claude의 전체 시각적 PDF 이해 기능에 액세스하려면 인용을 활성화해야 합니다. 인용을 활성화하지 않으면 API는 기본 텍스트 추출만으로 대체됩니다. 인용 작업에 대해 자세히 알아보세요.
Converse Document Chat (기존 모드 - 텍스트 추출만)
Claude PDF Chat (새 모드 - 전체 시각적 이해)
고객이 Converse API를 사용할 때 Claude가 PDF의 이미지나 차트를 보지 못한다고 보고하는 경우, 인용 플래그를 활성화해야 할 가능성이 높습니다. 인용 없이는 Converse가 기본 텍스트 추출만으로 대체됩니다.
이것은 Converse API의 알려진 제약 사항으로, 해결을 위해 작업 중입니다. 인용 없이 시각적 PDF 분석이 필요한 애플리케이션의 경우 InvokeModel API 사용을 고려하세요.
.csv, .xlsx, .docx, .md 또는 .txt 파일과 같은 비PDF 파일의 경우 다른 파일 형식 작업을 참조하세요.
Messages API를 사용한 간단한 예제부터 시작하겠습니다. Claude에 PDF를 제공하는 세 가지 방법이 있습니다:
document 콘텐츠 블록에 base64로 인코딩된 PDFfile_id 사용가장 간단한 방법은 URL에서 직접 PDF를 참조하는 것입니다:
curl https://api.anthropic.com/v1/messages \
-H "content-type: application/json" \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "claude-opus-4-6",
"max_tokens": 1024,
"messages": [{
"role": "user",
"content": [{
"type": "document",
"source": {
"type": "url",
"url": "https://assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf"
}
},
{
"type": "text",
"text": "What are the key findings in this document?"
}]
}]
}'로컬 시스템에서 PDF를 보내거나 URL을 사용할 수 없는 경우:
# Method 1: Fetch and encode a remote PDF
curl -s "https://assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf" | base64 | tr -d '\n' > pdf_base64.txt
# Method 2: Encode a local PDF file
# base64 document.pdf | tr -d '\n' > pdf_base64.txt
# Create a JSON request file using the pdf_base64.txt content
jq -n --rawfile PDF_BASE64 pdf_base64.txt '{
"model": "claude-opus-4-6",
"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
# Send the API request using the JSON file
curl https://api.anthropic.com/v1/messages \
-H "content-type: application/json" \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-d @request.json반복적으로 사용할 PDF이거나 인코딩 오버헤드를 피하고 싶을 때 Files API를 사용하세요:
# First, upload your PDF to the Files API
curl -X POST https://api.anthropic.com/v1/files \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "anthropic-beta: files-api-2025-04-14" \
-F "[email protected]"
# Then use the returned file_id in your message
curl https://api.anthropic.com/v1/messages \
-H "content-type: application/json" \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "anthropic-beta: files-api-2025-04-14" \
-d '{
"model": "claude-opus-4-6",
"max_tokens": 1024,
"messages": [{
"role": "user",
"content": [{
"type": "document",
"source": {
"type": "file",
"file_id": "file_abc123"
}
},
{
"type": "text",
"text": "What are the key findings in this document?"
}]
}]
}'Claude에 PDF를 보내면 다음 단계가 수행됩니다:
시스템이 문서의 내용을 추출합니다.
Claude가 문서를 더 잘 이해하기 위해 텍스트와 이미지를 모두 분석합니다.
Claude가 관련이 있는 경우 PDF의 내용을 참조하여 응답합니다.
Claude는 응답할 때 텍스트 및 시각적 콘텐츠를 모두 참조할 수 있습니다. PDF 지원을 다음과 통합하여 성능을 더욱 향상시킬 수 있습니다:
PDF 파일의 토큰 수는 문서에서 추출된 총 텍스트와 페이지 수에 따라 달라집니다:
토큰 카운팅을 사용하여 특정 PDF의 비용을 추정할 수 있습니다.
최적의 결과를 위해 다음 모범 사례를 따르세요:
대량 처리를 위해 다음 접근 방식을 고려하세요:
반복 쿼리의 성능을 향상시키기 위해 PDF를 캐싱하세요:
# pdf_base64.txt 콘텐츠를 사용하여 JSON 요청 파일 생성
jq -n --rawfile PDF_BASE64 pdf_base64.txt '{
"model": "claude-opus-4-6",
"max_tokens": 1024,
"messages": [{
"role": "user",
"content": [{
"type": "document",
"source": {
"type": "base64",
"media_type": "application/pdf",
"data": $PDF_BASE64
},
"cache_control": {
"type": "ephemeral"
}
},
{
"type": "text",
"text": "Which model has the highest human preference win rates across each use-case?"
}]
}]
}' > request.json
# 그런 다음 JSON 파일을 사용하여 API 호출
curl https://api.anthropic.com/v1/messages \
-H "content-type: application/json" \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-d @request.json대량 워크플로우에는 Message Batches API를 사용하세요:
# pdf_base64.txt 콘텐츠를 사용하여 JSON 요청 파일 생성
jq -n --rawfile PDF_BASE64 pdf_base64.txt '
{
"requests": [
{
"custom_id": "my-first-request",
"params": {
"model": "claude-opus-4-6",
"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-4-6",
"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://api.anthropic.com/v1/messages/batches \
-H "content-type: application/json" \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-d @request.jsonWas this page helpful?