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
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',
},
],
},
],
},
});
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,
});
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",
},
],
}],
)
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",
}),
}),
}),
}),
});
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"
}
]
}
]
}'
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"
}
]
}
]
}'
Document via base64
Encode the file as a data URI. Include the MIME type so the API can route it to the correct processor.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',
},
],
},
],
},
});
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,
});
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",
},
],
}],
)
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",
}),
}),
}),
}),
});
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\"
}
]
}
]
}"
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\"
}
]
}
]
}"
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)
input_file and the pipeline handles detection, conversion, and OCR.
Supported document formats
| Format | MIME type | Processing |
|---|---|---|
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 |