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

# infly/infinity-parser2-flash

> Markdown document OCR built on a compact Qwen3.5 2B backbone.

Markdown document OCR (Qwen3.5, 2B). Accepts one `image_url` or a `document_url`
PDF; no text-only input. `markdown` is the only method, and it emits a Markdown
string for an image and for each page of a PDF.

## Output by method

| Method     | Payload kind | Image `content.object` | Payload                                 |
| ---------- | ------------ | ---------------------- | --------------------------------------- |
| `markdown` | markdown     | none                   | Reading-order Markdown string (default) |

Text mode emits the string alone for one image, and one `<document>` / `<page>`
block per PDF, each page carrying `format="markdown"`. In JSON mode an image
`content` is the string, and a document page `content` is
`document.page.blocks`. The model wraps each page's Markdown in a fenced
` ```markdown ` code block. See
[Methods & Response Format](/gateway/methods).

## Request

<CodeGroup>
  ```bash CLI theme={"theme":{"light":"github-light","dark":"dark-plus"}}
  vlmrun gw chat https://storage.googleapis.com/vlm-data-public-prod/hub/examples/finance.sec-filings/tsla-8k.pdf \
    -m infly/infinity-parser2-flash --method markdown
  ```

  ```python Python [expandable] theme={"theme":{"light":"github-light","dark":"dark-plus"}}
  from openai import OpenAI

  client = OpenAI(
      base_url="https://gateway.vlm.run/v1/openai",
      api_key="<VLMRUN_API_KEY>",
  )

  response = client.chat.completions.create(
      model="infly/infinity-parser2-flash",
      messages=[
          {
              "role": "user",
              "content": [
                  {
                      "type": "document_url",
                      "document_url": {
                          "url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/finance.sec-filings/tsla-8k.pdf"
                      },
                  },
              ],
          }
      ],
      extra_body={"method": "markdown"},
  )

  print(response.choices[0].message.content)
  ```

  ```bash cURL [expandable] theme={"theme":{"light":"github-light","dark":"dark-plus"}}
  curl https://gateway.vlm.run/v1/openai/chat/completions \
    -X POST \
    -H "Authorization: Bearer $VLMRUN_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "infly/infinity-parser2-flash",
      "method": "markdown",
      "messages": [
        {
          "role": "user",
          "content": [
            {
              "type": "document_url",
              "document_url": {
                "url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/finance.sec-filings/tsla-8k.pdf"
              }
            }
          ]
        }
      ]
    }'
  ```
</CodeGroup>

## Response

<Tabs>
  <Tab title="Text mode">
    A PDF returns one `<document>` block per file and one `<page>` block per
    page, each carrying `format="markdown"`:

    ```text theme={"theme":{"light":"github-light","dark":"dark-plus"}}
    <document file_name="tsla-8k.pdf" mimetype="application/pdf" num_pages="5" dpi="96">
    <page page_index="0" format="markdown" page_width="816" page_height="1056">
    # UNITED STATES SECURITIES AND EXCHANGE COMMISSION
    WASHINGTON, DC 20549

    ## FORM 8-K

    ### CURRENT REPORT
    Pursuant to Section 13 or 15(d) of the Securities Exchange Act of 1934
    </page>
    ...
    </document>
    ```

    A single image returns the Markdown string alone, with no wrapper.
  </Tab>

  <Tab title="JSON mode">
    One entry per input medium. For an image, `content` is the Markdown string;
    for a PDF, each page's `content` is one `document.page.blocks` container:

    ```json theme={"theme":{"light":"github-light","dark":"dark-plus"}}
    {
      "model": "infly/infinity-parser2-flash",
      "method": "markdown",
      "data": [
        {
          "object": "document",
          "file_name": "tsla-8k.pdf",
          "mimetype": "application/pdf",
          "num_pages": 5,
          "dpi": 96,
          "pages": [
            {
              "object": "document.page",
              "page_index": 0,
              "page_width": 816,
              "page_height": 1056,
              "content": {
                "object": "document.page.blocks",
                "items": [
                  {"index": 0, "text": "# UNITED STATES SECURITIES AND EXCHANGE COMMISSION\n..."}
                ]
              }
            }
          ]
        }
      ]
    }
    ```
  </Tab>
</Tabs>
