> ## Documentation Index
> Fetch the complete documentation index at: https://docs.venice.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> The Venice API is OpenAI-compatible: use any OpenAI SDK with the base URL `https://api.venice.ai/api/v1` and a Venice API key, or pay per request from a USDC wallet through x402 with no account.
> Read model IDs from `GET /models` or `GET /models/traits` at runtime instead of hardcoding them from memory or from these pages. Models are added and retired often.
> Every model's price is in https://docs.venice.ai/pricing.md. Quote video and audio jobs with `POST /video/quote` or `POST /audio/quote` before you queue them.
> Search these docs from an MCP client at https://docs.venice.ai/mcp. The full agent guide is https://docs.venice.ai/agents.md.

# 파일 입력

> 요약, 질의응답, 변환을 위해 PDF, Office 문서, 텍스트, 데이터, 소스 코드 파일을 Venice chat completion 요청에 첨부하세요.

파일 입력을 통해 문서와 소스 파일을 `/chat/completions` 요청에 직접 첨부할 수 있습니다. Venice는 선택된 모델로 보내기 전에 파일을 텍스트로 추출하므로 직접 파서를 만들지 않고도 파일 콘텐츠에 대해 질문하거나, 요약하거나, 비교하거나, 변환할 수 있습니다.

프롬프트가 문서, 스프레드시트, markdown 파일, JSON 파일 또는 코드 파일의 콘텐츠에 의존할 때 파일 입력을 사용하세요. 이는 요청 범위 입력이며 영구 파일 저장소가 아니므로 필요한 각 요청에 파일을 포함해야 합니다.

> [!NOTE]
>
> 파일 입력은 OpenAI 호환 채팅 콘텐츠 배열을 사용합니다. `type: "file"`이 있는 콘텐츠 블록을 추가하고 `file.file_data`에 파일 콘텐츠를 제공하세요.

## 지원되는 파일 유형

채팅 API는 파일 입력을 base64 데이터 URL 또는 공개적으로 접근 가능한 URL로 허용합니다.

최대 파일 크기는 base64 데이터 URL 디코딩 후 또는 URL 가져오기 후 측정된 **파일당 25MB**입니다.

| 카테고리 | 형식 |
| - | - |
| 문서 | PDF, DOCX, PPTX |
| 스프레드시트 | XLSX, XLS, CSV |
| 텍스트와 데이터 | TXT, Markdown, JSON |
| 소스 코드 | `.py`, `.js`, `.ts`, `.c`, `.cpp`, `.java`, `.go`, `.rs`, `.ps1`, `.sh`, `.yaml`, `.sql`을 포함한 대부분의 일반적인 코드 파일 |

> [!NOTE]
>
> 파일은 추론 전에 텍스트로 추출됩니다. 추출된 텍스트는 모델의 입력 컨텍스트에 포함되므로 파일과 지침 및 예상 답변에 충분한 `availableContextTokens`이 있는 모델을 선택하세요.

## 기본 사용법

사용자 메시지 `content`가 텍스트와 파일 블록의 배열인 `messages` 배열을 보냅니다:

```python Python theme={"system"}
import base64
import os
from pathlib import Path

from openai import OpenAI

client = OpenAI(
    api_key=os.environ["VENICE_API_KEY"],
    base_url="https://api.venice.ai/api/v1",
)

path = Path("q3-report.pdf")
file_data = "data:application/pdf;base64," + base64.b64encode(path.read_bytes()).decode("utf-8")

response = client.chat.completions.create(
    model="openai-gpt-55",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "Summarize this report in five bullets and list the main risks.",
                },
                {
                    "type": "file",
                    "file": {
                        "file_data": file_data,
                        "filename": "q3-report.pdf",
                    },
                },
            ],
        }
    ],
)

print(response.choices[0].message.content)
```

```javascript Node.js theme={"system"}
import OpenAI from "openai";
import { readFile } from "node:fs/promises";

const client = new OpenAI({
  apiKey: process.env.VENICE_API_KEY,
  baseURL: "https://api.venice.ai/api/v1",
});

const pdf = await readFile("q3-report.pdf");
const fileData = `data:application/pdf;base64,${pdf.toString("base64")}`;

const response = await client.chat.completions.create({
  model: "openai-gpt-55",
  messages: [
    {
      role: "user",
      content: [
        {
          type: "text",
          text: "Summarize this report in five bullets and list the main risks.",
        },
        {
          type: "file",
          file: {
            file_data: fileData,
            filename: "q3-report.pdf",
          },
        },
      ],
    },
  ],
});

console.log(response.choices[0].message.content);
```

```bash cURL theme={"system"}
PDF_BASE64=$(base64 < q3-report.pdf | tr -d '\n')

curl https://api.venice.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $VENICE_API_KEY" \
  -H "Content-Type: application/json" \
  -d @- <<EOF
{
  "model": "openai-gpt-55",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "Summarize this report in five bullets and list the main risks."
        },
        {
          "type": "file",
          "file": {
            "file_data": "data:application/pdf;base64,$PDF_BASE64",
            "filename": "q3-report.pdf"
          }
        }
      ]
    }
  ]
}
EOF
```

## 파일 URL

파일이 이미 공개 HTTP 또는 HTTPS URL에서 호스팅되는 경우 base64 인코딩 대신 `file_data`에 URL을 전달하세요:

```json theme={"system"}
{
  "model": "openai-gpt-55",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "Identify the governing law, renewal terms, and termination rights in this agreement."
        },
        {
          "type": "file",
          "file": {
            "file_data": "https://example.com/contracts/vendor-agreement.pdf",
            "filename": "vendor-agreement.pdf"
          }
        }
      ]
    }
  ]
}
```

> [!WARNING]
>
> Venice가 인증 없이 가져올 수 있는 공개 URL만 사용하세요. 비공개 파일의 경우 base64 데이터 URL을 보내세요.

## 여러 파일

동일한 메시지에 둘 이상의 파일 블록을 포함할 수 있습니다. 모델이 사용 방법을 알 수 있도록 파일 앞에 짧은 텍스트 지침을 넣으세요.

```json theme={"system"}
{
  "model": "openai-gpt-55",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "Compare these two policy drafts. Return the material differences and recommend which version is clearer."
        },
        {
          "type": "file",
          "file": {
            "file_data": "data:application/pdf;base64,JVBERi0xLjQK...",
            "filename": "policy-v1.pdf"
          }
        },
        {
          "type": "file",
          "file": {
            "file_data": "data:application/pdf;base64,JVBERi0xLjQK...",
            "filename": "policy-v2.pdf"
          }
        }
      ]
    }
  ]
}
```

최상의 결과를 얻으려면 각 파일에 명확한 이름을 지정하고 프롬프트에서 해당 이름을 참조하세요.

## 데이터 URL

로컬 파일의 경우 파일 바이트를 base64로 인코딩하고 올바른 MIME 유형을 접두어로 붙입니다:

| 파일 유형 | 데이터 URL 접두사 |
| - | - |
| PDF | `data:application/pdf;base64,` |
| DOCX | `data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64,` |
| PPTX | `data:application/vnd.openxmlformats-officedocument.presentationml.presentation;base64,` |
| XLSX | `data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,` |
| CSV | `data:text/csv;base64,` |
| Markdown | `data:text/markdown;base64,` |
| 일반 텍스트 | `data:text/plain;base64,` |
| JSON | `data:application/json;base64,` |

정확한 MIME 유형을 모르는 경우 `application/octet-stream`을 사용하세요. 정확한 `filename`을 포함하면 Venice가 파일을 식별하고 표시하는 데 여전히 도움이 됩니다.

## 큰 파일 작업

파일이 프롬프트 텍스트가 되므로 큰 파일은 지연 시간, 토큰 사용량 및 비용을 증가시킬 수 있습니다. 모델의 컨텍스트 윈도우를 염두에 두세요.

원시 파일은 25MB 이하여야 합니다. Base64 인코딩은 요청 크기를 약 33% 증가시키므로 25MB 제한에 가까운 파일은 더 큰 JSON 요청 본문을 생성합니다.

큰 파일에 대한 좋은 패턴:

* 광범위한 "모든 것을 분석" 프롬프트 대신 특정 작업을 요청하세요.
* 현재 답변에 필요한 문서만 포함하세요.
* 긴 보고서나 코드베이스에 더 큰 `availableContextTokens`이 있는 모델을 사용하세요.
* [프롬프트 캐싱](https://docs.venice.ai/guides/features/prompt-caching.md)도 사용하는 경우 동적 사용자 질문 앞에 안정적이고 반복되는 문서를 두세요.
* 긴 응답이 예상되는 경우 `stream: true`를 사용하세요.

### 요청 한도

* **파일당:** 각 파일은 25MB 이하여야 합니다.
* **이미지:** 단일 메시지에는 최대 10개의 이미지를 포함할 수 있습니다. 이 한도는 요청 단위가 아니라 메시지 단위로 적용됩니다.

### 파일이 실패하는 경우

처리할 수 없는 파일(예: 파일당 크기 한도를 초과한 경우)이 있더라도 전체 요청이 실패하지는 않습니다. Venice는 해당 파일을 에러 메모로 대체하고, 모델은 여전히 응답하며, 요청은 평소대로 과금됩니다. 응답이 파일을 무시하는 것처럼 보인다면, 재시도하기 전에 파일이 위의 한도 내에 있는지 확인하세요.

## 파일 입력 vs. 텍스트 파서

모델이 파일에 대해 즉시 추론하길 원할 때 채팅 파일 입력을 사용하세요.

먼저 텍스트를 추출하고, 토큰 수를 검사하고, 추출된 텍스트를 자체 시스템에 저장하거나, 동일한 추출된 텍스트를 여러 요청에 보내려면 [Text Parser API](https://docs.venice.ai/api-reference/endpoint/augment/text-parser.md)를 사용하세요.

| 필요한 작업 | 사용 |
| - | - |
| 한 번의 요청으로 모델에 문서에 대해 질문 | 채팅 파일 입력 |
| 모델 추론 없이 텍스트 추출 | Text Parser API |
| 프롬프트 전에 추출된 토큰 수 확인 | Text Parser API |
| 여러 요청에서 추출된 텍스트 재사용 | Text Parser API, 그런 다음 프롬프트에 텍스트 포함 |

## 모범 사례

* 가능하면 항상 `filename`을 포함하세요. 특히 여러 파일을 보낼 때.
* 모델이 추출된 콘텐츠를 읽기 전에 작업을 알 수 있도록 파일 블록 앞에 지침을 넣으세요.
* 쿠키, 헤더 또는 서명된 세션 상태 없이 가져올 수 있는 파일에만 공개 URL을 사용하세요.
* 비공개 파일이나 애플리케이션 내에서 생성된 파일에는 base64 데이터 URL을 선호하세요.
* 집중된 질문을 하고 원하는 출력 형식을 지정하세요.
* 구조화된 추출의 경우 파일 입력을 [구조화된 응답](https://docs.venice.ai/guides/features/structured-responses.md)과 결합하세요.

## 문제 해결

> [accordion] 모델이 파일에 액세스할 수 없다고 말함
>
> 메시지 콘텐츠가 배열을 사용하고 `type: "file"` 블록을 포함하는지 확인하세요. URL을 사용한 경우 인증 없이 공개적으로 접근 가능한지 확인하세요.

> [accordion] 요청이 느리거나 비쌈
>
> 파일이 많은 양의 텍스트로 추출될 수 있습니다. 더 큰 컨텍스트 모델을 사용하거나, 작업 범위를 좁히거나, 파일을 적게 보내거나, Text Parser API로 텍스트를 미리 추출하고 다듬으세요.

> [accordion] 응답이 내 파일 중 하나를 무시함
>
> 각 파일에 설명적인 `filename`을 부여하고 프롬프트에서 파일명을 직접 참조하세요. 예를 들어, "`policy-v1.pdf`를 `policy-v2.pdf`와 비교"
>
> 파일 처리에 실패한 경우(예: 25MB를 초과한 경우), 모델은 그 자리에 에러 메모를 받고 해당 파일 없이 응답합니다. [파일이 실패하는 경우](#파일이-실패하는-경우)를 참고하세요.

> [accordion] 모델이 파일 콘텐츠를 거부함
>
> 파일 입력은 호환되는 채팅 모델에서 사용할 수 있습니다. 현재 모델 기능과 컨텍스트 제한은 [모델 페이지](https://docs.venice.ai/models/overview.md)를 확인하거나 현재의 큰 컨텍스트 텍스트 모델을 시도하세요.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.