Documentation Index
Fetch the complete documentation index at: https://docs.tinfoil.sh/llms.txt
Use this file to discover all available pages before exploring further.
Document Processing API
Tinfoil’s document processing service extracts structured Markdown from uploaded documents — including PDFs, DOCX, PPTX, XLSX, HTML, CSV, and images. The entire service runs inside a secure enclave, and the VLM used for OCR and visual extraction also runs in its own secure enclave — so your documents are never exposed to any operator. Born-digital PDFs are parsed using MuPDF inside a sandboxed subprocess with no network access, environment variables, or filesystem; scanned pages and images are sent to the VLM for OCR. You can use document processing in two ways:- Call
/v1/convert/filedirectly when you want extracted Markdown (or page images) back from the document service. - Send a base64-encoded file through the OpenAI-compatible
/v1/responsesor/v1/chat/completionsAPIs. Tinfoil privately converts the attachment and forwards either Markdown (for text-only models) or per-page Markdown plus page images (for vision-capable models) to the model. You can override the default with the optionaltinfoil_modefield.
Current scope: OpenAI-compatible file input support currently accepts base64
file_data only. file_id and the /v1/files upload flow are not supported.1. Convert A Document Directly
The document processing endpoint acceptsmultipart/form-data requests at /v1/convert/file. Upload one or more files with field name files.
You can control extraction behavior with the mode query parameter:
| Mode | Description |
|---|---|
text (default) | Markdown from the text layer. VLM OCR only for scanned pages. |
vision | Text plus VLM OCR for scanned pages and VLM visual descriptions (tables, charts, diagrams, formulas) for born-digital pages. |
images | Per-page text plus page images as base64 PNG. No VLM. |
raw | Text layer only. No VLM, no image rendering. |
vlm | Full-page VLM OCR on every page. |
document; for multiple files, results are in a documents array:
images mode, each page includes its extracted text, a base64-encoded PNG, and a scanned/born-digital flag:
text mirrors the per-page slice of md_content; pure scans come back with an empty text field.
When uploading multiple files, the response uses documents (an array) instead of document:
Pairing images Mode With A Vision Model
For a vision-capable model (e.g. kimi-k2-6, gemma4-31b), interleave each page’s text and image and wrap the raw image base64 as a data URI:
file_data on /v1/responses or /v1/chat/completions with a vision-capable model, Tinfoil performs this same per-page interleave automatically.
2. Use File Inputs With The Responses API
If you want OpenAI-compatible file attachments, send a base64-encoded file in aninput_file content part on /v1/responses.
| Routed model | Default PDF / image behavior |
|---|---|
| Vision-capable | Per-page interleaved Markdown and page images. |
| Text-only | Markdown only, for speed. |
multimodal field on GET /v1/models. DOCX, PPTX, XLSX, HTML, CSV, and plain text attachments are always forwarded as extracted Markdown regardless of the routed model. You can override the default per attachment with tinfoil_mode.
3. Use File Inputs With Chat Completions
The OpenAI-compatible Chat Completions shape usestype: "file" with a nested file object.
4. Override The PDF Processing Mode
Set the optional Tinfoil-specifictinfoil_mode field directly on the file content part to override the auto-default — for example to force VLM full-page OCR on a low-quality scan:
| Value | Behavior |
|---|---|
auto (default) | images for vision-capable models, text for text-only models. |
text | Markdown from the text layer; VLM OCR only on scanned pages. |
vision | Markdown plus VLM visual descriptions for figures, charts, and tables. |
images | Per-page interleaved Markdown and images. Requires a vision-capable model; returns 400 otherwise. |
raw | Text layer only. No VLM, no image rendering. |
vlm | Full-page VLM OCR on every page. Highest quality, slowest. |
tinfoil_mode only affects PDF and image attachments; for DOCX, PPTX, XLSX, HTML, CSV, and plain text the field has no effect.
tinfoil_mode is a Tinfoil-specific extension and is not understood by OpenAI’s API. If your code needs to target both Tinfoil and OpenAI from the same request body, omit the field.file object alongside filename and file_data:
Supported Formats
| Format | Extraction |
|---|---|
| PDF (born-digital) | MuPDF text layer to Markdown |
| PDF (scanned) | VLM OCR |
| DOCX, PPTX, HTML, XLSX, CSV | Server-side parsers |
| Images | VLM OCR |
| Markdown, text, JSON, XML | Passthrough |
Errors And Limits
Per request: up to 10 files, 50 MB each,multipart/form-data only.
All non-2xx responses are {"error": "<message>"}.
/health reflects the state of the different pipeline elements:
Attestation
The document upload API uses the same attestation mechanism as other Tinfoil services. UseSecureClient (as shown above) to verify attestation automatically.
Try Private Chat
Experience document upload in our private chat interface with real-time privacy verification.
Configuration Repo
View the open-source configuration for Tinfoil’s confidential document processing service.

