LM-Kit OneDocs2026.10.6lm-kit.comEULA
Intelligent Document Processing

Document Parsing

POST /lmkit/v1/document-parsing reads a PDF, a scan or an image with the AI document parser, the most faithful reading LM-Kit One offers. Every page comes back as elements in reading order, each with its role (title, text, table, formula, figure, caption, header, footer), its bounding box, its confidence and its typed content: tables as HTML with their merged cells, formulas as LaTeX, and charts as the data table they plot. Low, Medium and High read every page with vision models; Minimal loads no model and reads the text each page carries, with OCR for scans, at the cost of text extraction. Search tenants index through the same levels (Parsing Effort for RAG); for Markdown alone across office and email formats, document-to-markdown stays the workhorse.


1One request#

curl -X POST https://localhost:7221/lmkit/v1/document-parsing \
  -H "Authorization: Bearer $LMKIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "input": "'"$(base64 -w0 report.pdf)"'", "effort": "Medium" }'
Field Default Meaning
input, input_format The document, base64 or a file id from POST /lmkit/v1/files/upload
effort Medium Minimal (no model), Low (fastest with the model), Medium (balanced), High (most faithful). The parser selects and verifies its own models for each level
pages every page A 1-based range such as 1-3, 1,3,5 or 2-
output_format Json Json, Markdown, Html or DocLang
include_figure_images false Embed the picture of every figure and chart
include_markdown false With Json: also return the Markdown of the same parse, for the document, each page and each element

A range that selects no page answers 400 before anything runs. A long document returns 202 Accepted with a job_id; poll GET /lmkit/v1/jobs/{job_id}, which reports the pages parsed so far.

2The formats#

output_format Carried in Use it for
Json document Pipelines and storage: the lossless parse, following the published parsed-document schema
Markdown content LLM prompts and RAG chunks
Html content Display and review: semantic HTML where every element carries data-category and data-bbox
DocLang content Exchange with tools that read DocLang, the LF AI and Data open document markup

Every response also states effort, total_pages, processed_pages, element_count and elapsed_seconds. A JSON parse reads back in the SDK with ParsedDocument.FromJson and renders the other three formats identically, so one call can serve every consumer. A client that cannot run the SDK sets include_markdown with Json: the response then adds markdown (the document), page_markdown (one string per page) and element_markdown (one list per page, aligned with that page's elements), all from the same parse as document.

3Models and capacity#

The parser's models come from the model catalog and are downloaded on first use, visibly in the admin panel like any download. They load through the server's model cache and stay resident between requests, so only the first parse pays the load. A parse waits for a completion slot like every request that runs a model (MaxConcurrentCompletions).

4From the command line and from agents#

lmkit run document-parsing --in ./reports --out ./parsed --effort high --output-format markdown

parses local files with no server running; each result takes the extension its format names (.json, .md, .html, .dclg). MCP clients reach the same parser through the document_parse tool, which returns the Markdown to read and the full JSON parse as a resource.

5In the playground#

Playground > Parse runs the same parser on a document you drop in, or on one of four samples that each show a hard case (a two-column paper with charts and a formula, a skewed scanned invoice, a financial statement with spanning period headers, a phone photo of a page). Pages appear as they are read. Every element is outlined on its page in the document viewer and linked to the output beside it: hover a box to find its text, click a row to find its box. The type bar keeps only what you need (titles, text, tables, charts, pictures, formulas, captions, footnotes, headers and footers, or a preset such as Tables and charts), and the copy and every export follow it. Compare parses the document at a second effort level and lists what changed, element by element, with both pages side by side. Get code gives the SDK and REST call for the parse on screen. Each Playground level reads exactly as a search tenant set to it does, so this is where a tenant's parsing effort is chosen (how the Playground maps to a tenant).