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

# Parse a document to Markdown via VLM

> Upload a file for synchronous OCR processing. This endpoint is intended for lightweight, low-volume document parsing and returns results inline in the response.

For large documents, high-throughput workloads, or asynchronous processing, use the `/files` endpoints, which are optimized for those use cases.

**Supported file types:** `.pdf`, `.png`, `.jpg`, `.jpeg`, `.pptx`, `.ppt`, `.odp`, `.docx`, `.odt`, `.doc`, `.html`

A maximum of **16 pages** are processed per request. For documents exceeding this limit, split the content across multiple sequential calls using the `pages` parameter (e.g., `pages="1-16"` for the first call, `pages="17-32"` for the second).



## OpenAPI

````yaml /api-reference/openapi-v3.yaml post /api/v3/ocr
openapi: 3.0.3
info:
  title: Paradigm API
  version: xenial-xerus (v3)
  description: >-
    A versatile and adaptable tool designed to integrate Generative AI into your
    applications
servers:
  - url: https://paradigm.lighton.ai
security: []
tags:
  - name: Agents
    description: Operations about agents
  - name: Threads
    description: Operations about agents conversation threads
  - name: Tools
    description: Operations about native tools
  - name: Models
    description: Operations about AI models
  - name: MCP
    description: Operations about MCP servers
  - name: Sources
    description: Operations about sources used by agents conversation threads
  - name: Artifacts
    description: Operations about artifacts generated by agents conversation threads
  - name: Agent
    description: >-
      Operations about agents (deprecated). Please use the 'Agents' API
      component instead.
  - name: Files
    description: Operations about files
  - name: Files Processing
    description: Operations about files processing
  - name: Tags
    description: Operations about tags
  - name: Workspaces
    description: Operations about workspaces
  - name: Users
    description: Operations about users
  - name: User Groups
    description: Operations about user groups
  - name: Companies
    description: Operations about companies
  - name: SCIM
    description: Operations about SCIM
paths:
  /api/v3/ocr:
    post:
      tags:
        - Models
      summary: Parse a document to Markdown via VLM
      description: >-
        Upload a file for synchronous OCR processing. This endpoint is intended
        for lightweight, low-volume document parsing and returns results inline
        in the response.


        For large documents, high-throughput workloads, or asynchronous
        processing, use the `/files` endpoints, which are optimized for those
        use cases.


        **Supported file types:** `.pdf`, `.png`, `.jpg`, `.jpeg`, `.pptx`,
        `.ppt`, `.odp`, `.docx`, `.odt`, `.doc`, `.html`


        A maximum of **16 pages** are processed per request. For documents
        exceeding this limit, split the content across multiple sequential calls
        using the `pages` parameter (e.g., `pages="1-16"` for the first call,
        `pages="17-32"` for the second).
      operationId: api_v3_ocr_create
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/OcrRequest'
            examples:
              ParseAPDFWithAPageRange:
                value:
                  file: (binary)
                  pages: 1-16
                summary: Parse a PDF with a page range
                description: Upload a PDF and parse the first 16 pages.
              ParseSpecificPagesWithCustomModel:
                value:
                  file: (binary)
                  model: LightOnOCR
                  pages: 1-10,15,20
                  enable_antilooping: true
                  temperature: 0.2
                  max_tokens: 5888
                summary: Parse specific pages with custom model
                description: >-
                  Upload a file with a specific model and custom sampling
                  parameters.
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/OcrRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OcrResponse'
              examples:
                SuccessfulOCRResponse:
                  value:
                    model: LightOnOCR
                    total_pages: 3
                    pages_parsed:
                      - 1
                      - 2
                      - 3
                    processing_time_ms: 4520
                    enable_antilooping: true
                    sampling_params:
                      temperature: 0.2
                      max_tokens: 5888
                      repetition_penalty: null
                    pages:
                      - page_number: 1
                        markdown: |-
                          # Invoice

                          | Item | Qty | Price |
                          |---|---|---|
                          | Widget A | 10 | $5.00 |
                      - page_number: 2
                        markdown: |-
                          ## Terms and Conditions

                          Payment is due within 30 days...
                      - page_number: 3
                        markdown: |-
                          ## Appendix

                          ![Figure 1: Sales chart summary]
                  summary: Successful OCR response
          description: Document parsed successfully.
        '400':
          description: >-
            Bad request — unsupported format, invalid page range, invalid model,
            or max pages exceeded.
        '401':
          description: Authentication credentials were not provided or are invalid.
        '429':
          description: Rate limit exceeded (1 request per minute per user).
        '503':
          description: VLM backend is overloaded. Retry later.
      security:
        - bearerAuth: []
components:
  schemas:
    OcrRequest:
      type: object
      properties:
        file:
          type: string
          format: uri
          description: The document to parse.
        model:
          type: string
          nullable: true
          description: >-
            technical_name of an enabled parser model. Falls back to platform
            default.
        pages:
          type: string
          default: all
          description: >-
            Page range to parse. Formats: "all", "1-5", "1,3,7", "2-4,8".
            Maximum 16 pages per request. For larger documents, make multiple
            calls with different page ranges.
        enable_antilooping:
          type: boolean
          default: true
          description: >-
            When enabled, detects repetitive generation loops and gradually
            increases the sampling temperature to break out of them.
        temperature:
          type: number
          format: double
          maximum: 2
          minimum: 0
          nullable: true
          default: 0.2
          description: >-
            Controls the randomness of the model output. Lower values (e.g. 0.1)
            produce more deterministic results, higher values (e.g. 1.0)
            increase variety. Range: 0.0–2.0.
        max_tokens:
          type: integer
          maximum: 16384
          minimum: 1
          nullable: true
          default: 5000
          description: >-
            Maximum number of tokens the model can generate per page. Higher
            values allow longer outputs but increase processing time. Range:
            1–16384.
        repetition_penalty:
          type: number
          format: double
          maximum: 2
          minimum: 1
          nullable: true
          default: 1
          description: >-
            Penalizes repeated tokens to reduce redundant output. A value of 1.0
            applies no penalty; higher values (e.g. 1.2) discourage repetition
            more strongly. Range: 1.0–2.0.
      required:
        - file
    OcrResponse:
      type: object
      properties:
        model:
          type: string
        total_pages:
          type: integer
        pages_parsed:
          type: array
          items:
            type: integer
        processing_time_ms:
          type: integer
        enable_antilooping:
          type: boolean
        sampling_params:
          $ref: '#/components/schemas/SamplingParams'
        pages:
          type: array
          items:
            $ref: '#/components/schemas/OcrPage'
      required:
        - enable_antilooping
        - model
        - pages
        - pages_parsed
        - processing_time_ms
        - sampling_params
        - total_pages
    SamplingParams:
      type: object
      properties:
        temperature:
          type: number
          format: double
        max_tokens:
          type: integer
        repetition_penalty:
          type: number
          format: double
          nullable: true
      required:
        - max_tokens
        - repetition_penalty
        - temperature
    OcrPage:
      type: object
      properties:
        page_number:
          type: integer
        markdown:
          type: string
      required:
        - markdown
        - page_number
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is your auth token.

````