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

# Document inputs

> Send document inputs to the Responses API.

## Document input

Send documents for the model to read and reason over.
PDF and scanned documents are automatically processed with OCR — no extra configuration needed.

### Document via URL

<CodeGroup>
  ```ts TypeScript SDK theme={null}
  import { SDK } from '@meetkai/mka1';
  import { readFileSync } from 'fs';

  const sdk = new SDK({ bearerAuth: 'Bearer <mka1-api-key>' });

  const result = await sdk.llm.responses.create({
    responsesCreateRequest: {
      model: 'auto',
      input: [
        {
          type: 'message',
          role: 'user',
          content: [
            { type: 'input_text', text: 'Summarize this document in three bullet points.' },
            {
              type: 'input_file',
              fileUrl: 'https://example.com/report.pdf',
              filename: 'report.pdf',
            },
          ],
        },
      ],
    },
  });
  ```

  ```ts OpenAI SDK theme={null}
  import OpenAI from 'openai';
  import { readFileSync } from 'fs';

  const openai = new OpenAI({
    apiKey: '<mka1-api-key>',
    baseURL: 'https://apigw.mka1.com/api/v1/llm/',
    defaultHeaders: { 'X-On-Behalf-Of': '<end-user-id>' },
  });

  const response = await openai.responses.create({
    model: 'auto',
    input: [
      {
        type: 'message',
        role: 'user',
        content: [
          { type: 'input_text', text: 'Summarize this document in three bullet points.' },
          {
            type: 'input_file',
            file_url: 'https://example.com/report.pdf',
            filename: 'report.pdf',
          },
        ],
      },
    ],
    stream: false,
  });
  ```

  ```python Python SDK theme={null}
  import base64
  from meetkai_mka1 import SDK

  sdk = SDK(bearer_auth="Bearer <mka1-api-key>")

  result = sdk.llm.responses.create(
      model="auto",
      input=[{
          "type": "message",
          "role": "user",
          "content": [
              {"type": "input_text", "text": "Summarize this document in three bullet points."},
              {
                  "type": "input_file",
                  "file_url": "https://example.com/report.pdf",
                  "filename": "report.pdf",
              },
          ],
      }],
  )
  ```

  ```csharp C# SDK theme={null}
  using MeetKai.MKA1;
  using MeetKai.MKA1.Types.Components;
  using MeetKai.MKA1.Types.Requests;

  var sdk = new SDK(bearerAuth: "Bearer <mka1-api-key>");

  var res = await sdk.Llm.Responses.CreateAsync(new ResponsesCreateRequest()
  {
      Model = "auto",
      Input = ResponsesCreateRequestInput.CreateArrayOfItem(new List<Item>
      {
          Item.CreateInputMessage(new InputMessage()
          {
              Role = InputMessageRole.User,
              Content = InputMessageContent1.CreateArrayOfInputMessageContent(
                  new List<InputMessageContent>
                  {
                      InputMessageContent.CreateInputText(new InputText()
                      {
                          Text = "Summarize this document in three bullet points.",
                      }),
                      InputMessageContent.CreateInputFile(new InputFile()
                      {
                          FileUrl = "https://example.com/report.pdf",
                          Filename = "report.pdf",
                      }),
                  }),
          }),
      }),
  });
  ```

  ```bash CLI theme={null}
  mka1 llm responses create \
    --body '{
      "model": "auto",
      "input": [
        {
          "type": "message",
          "role": "user",
          "content": [
            { "type": "input_text", "text": "Summarize this document in three bullet points." },
            {
              "type": "input_file",
              "file_url": "https://example.com/report.pdf",
              "filename": "report.pdf"
            }
          ]
        }
      ]
    }'
  ```

  ```bash Bash theme={null}
  curl https://apigw.mka1.com/api/v1/llm/responses \
    --request POST \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer <mka1-api-key>' \
    --header 'X-On-Behalf-Of: <end-user-id>' \
    --data '{
      "model": "auto",
      "input": [
        {
          "type": "message",
          "role": "user",
          "content": [
            { "type": "input_text", "text": "Summarize this document in three bullet points." },
            {
              "type": "input_file",
              "file_url": "https://example.com/report.pdf",
              "filename": "report.pdf"
            }
          ]
        }
      ]
    }'
  ```
</CodeGroup>

### Document via base64

Encode the file as a data URI. Include the MIME type so the API can route it to the correct processor.

<CodeGroup>
  ```ts TypeScript SDK theme={null}
  const pdfBase64 = readFileSync('contract.pdf').toString('base64');

  const result = await sdk.llm.responses.create({
    responsesCreateRequest: {
      model: 'auto',
      input: [
        {
          type: 'message',
          role: 'user',
          content: [
            { type: 'input_text', text: 'What are the key terms in this contract?' },
            {
              type: 'input_file',
              fileData: `data:application/pdf;base64,${pdfBase64}`,
              filename: 'contract.pdf',
            },
          ],
        },
      ],
    },
  });
  ```

  ```ts OpenAI SDK theme={null}
  const pdfBase64 = readFileSync('contract.pdf').toString('base64');

  const response = await openai.responses.create({
    model: 'auto',
    input: [
      {
        type: 'message',
        role: 'user',
        content: [
          { type: 'input_text', text: 'What are the key terms in this contract?' },
          {
            type: 'input_file',
            file_data: `data:application/pdf;base64,${pdfBase64}`,
            filename: 'contract.pdf',
          },
        ],
      },
    ],
    stream: false,
  });
  ```

  ```python Python SDK theme={null}
  with open("contract.pdf", "rb") as f:
      pdf_base64 = base64.b64encode(f.read()).decode()

  result = sdk.llm.responses.create(
      model="auto",
      input=[{
          "type": "message",
          "role": "user",
          "content": [
              {"type": "input_text", "text": "What are the key terms in this contract?"},
              {
                  "type": "input_file",
                  "file_data": f"data:application/pdf;base64,{pdf_base64}",
                  "filename": "contract.pdf",
              },
          ],
      }],
  )
  ```

  ```csharp C# SDK theme={null}
  var pdfBytes = System.IO.File.ReadAllBytes("contract.pdf");
  var pdfBase64 = Convert.ToBase64String(pdfBytes);

  var res = await sdk.Llm.Responses.CreateAsync(new ResponsesCreateRequest()
  {
      Model = "auto",
      Input = ResponsesCreateRequestInput.CreateArrayOfItem(new List<Item>
      {
          Item.CreateInputMessage(new InputMessage()
          {
              Role = InputMessageRole.User,
              Content = InputMessageContent1.CreateArrayOfInputMessageContent(
                  new List<InputMessageContent>
                  {
                      InputMessageContent.CreateInputText(new InputText()
                      {
                          Text = "What are the key terms in this contract?",
                      }),
                      InputMessageContent.CreateInputFile(new InputFile()
                      {
                          FileData = $"data:application/pdf;base64,{pdfBase64}",
                          Filename = "contract.pdf",
                      }),
                  }),
          }),
      }),
  });
  ```

  ```bash CLI theme={null}
  PDF_B64=$(base64 -i contract.pdf)

  mka1 llm responses create \
    --body "{
      \"model\": \"auto\",
      \"input\": [
        {
          \"type\": \"message\",
          \"role\": \"user\",
          \"content\": [
            { \"type\": \"input_text\", \"text\": \"What are the key terms in this contract?\" },
            {
              \"type\": \"input_file\",
              \"file_data\": \"data:application/pdf;base64,${PDF_B64}\",
              \"filename\": \"contract.pdf\"
            }
          ]
        }
      ]
    }"
  ```

  ```bash Bash theme={null}
  PDF_B64=$(base64 -i contract.pdf)

  curl https://apigw.mka1.com/api/v1/llm/responses \
    --request POST \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer <mka1-api-key>' \
    --data "{
      \"model\": \"auto\",
      \"input\": [
        {
          \"type\": \"message\",
          \"role\": \"user\",
          \"content\": [
            { \"type\": \"input_text\", \"text\": \"What are the key terms in this contract?\" },
            {
              \"type\": \"input_file\",
              \"file_data\": \"data:application/pdf;base64,${PDF_B64}\",
              \"filename\": \"contract.pdf\"
            }
          ]
        }
      ]
    }"
  ```
</CodeGroup>

### Scanned documents and OCR

Scanned PDFs and images of documents are processed automatically. The API uses OCR to extract text from:

* Scanned PDF pages (converted to images at 150 DPI, then OCR'd)
* Photos of documents (JPEG, PNG, TIFF)
* Office files (DOCX, XLSX, PPTX — converted to PDF first, then OCR'd)

Multi-page documents are processed in parallel. The extracted text is returned as Markdown and passed to the model for reasoning.

No special parameters are needed — just send the file as `input_file` and the pipeline handles detection, conversion, and OCR.

### Supported document formats

| Format                         | MIME type                                                                                                    | Processing               |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------ |
| PDF                            | `application/pdf`                                                                                            | OCR per page at 150 DPI  |
| JPEG / PNG / TIFF / WebP / GIF | `image/*`                                                                                                    | Direct OCR               |
| Word (.doc, .docx)             | `application/msword`, `application/vnd.openxmlformats-officedocument.wordprocessingml.document`              | Convert to PDF, then OCR |
| Excel (.xls, .xlsx)            | `application/vnd.ms-excel`, `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`              | Convert to PDF, then OCR |
| PowerPoint (.ppt, .pptx)       | `application/vnd.ms-powerpoint`, `application/vnd.openxmlformats-officedocument.presentationml.presentation` | Convert to PDF, then OCR |
| RTF                            | `application/rtf`                                                                                            | Convert to PDF, then OCR |
| Plain text / CSV               | `text/plain`, `text/csv`                                                                                     | Read directly            |

**Size limit:** 30 MB per file.

## Combine input types

See [Multimodal input](/docs/multimodal-input#mixed-input) for a request containing several input types.
