Model or dataset
MarkPDFdown/markpdfdown avatar
MarkPDFdown/markpdfdown

MarkPDFDown sends each page to a vision model through LiteLLM and keeps the output as Markdown

A high-quality PDF-to-Markdown tool based on large language model visual recognition.

2,326 stars188 forksPythonApache-2.0

At a glance

What is it?
MarkPDFDown is a Python command line tool that hands PDFs and images to a multimodal LLM and writes Markdown back. What you get depends on the model you name in MODEL_NAME, and the README publishes no accuracy figures.
Who is it for?
MarkPDFDown suits a developer who already holds an API key for OpenAI, OpenRouter or Requesty and wants a scriptable PDF to Markdown step that runs in a shell loop or a Docker pipe. It does not suit anyone who needs offline conversion, because every page goes to a hosted model, or anyone who needs measured accuracy on tables and formulas, since the README gives none.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 62 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 23, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • MarkPDFdown/markpdfdown2,326 ★ · +31
Star history
Repository2026-10-082026-11-23
MarkPDFdown/markpdfdown2.3k2.3k

31 Stars in the last 46 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Pages go to a multimodal model, so the model name is the quality setting

MarkPDFDown does not parse PDF text itself in the way a layout library does. Per the README, it uses multimodal large language models through LiteLLM to transcribe PDF files into Markdown, with the stated aim of extracting text, preserving formatting and handling tables, formulas and diagrams. The same tool also takes an image as input.

The choice of model therefore sits in one environment variable, `MODEL_NAME`, whose default in the sample file is `gpt-4o`. A cheaper model such as `gpt-4o-mini` and a stronger one are both a one-line change, and the README lists `gpt-4-vision-preview` among the OpenAI examples.

The cost of this design is plain. Every page leaves your machine for a hosted provider, you pay per call, and the README makes no claim about how accurate any given model is on complicated tables. It also does not say how the tool splits a PDF into pages before sending them, or whether one request carries a single page or several. If the document is confidential, the provider you choose becomes part of your data path, and only you can judge whether its terms fit. A scanned contract and a slide deck full of diagrams are different jobs for the same command, so try both kinds before you commit to one model.

Three providers behind one variable, with keys that LiteLLM finds on its own

The Features list names OpenAI, OpenRouter and Requesty. You set `MODEL_NAME` and the matching key, and LiteLLM detects the key from the environment. OpenRouter models carry a prefix, for example `openrouter/anthropic/claude-3.5-sonnet`, `openrouter/google/gemini-pro-vision` and `openrouter/meta-llama/llama-3.2-90b-vision`. Requesty models use `requesty/openai/gpt-4o` and `requesty/anthropic/claude-sonnet-4-5`.

The sample file `.env.sample` adds a fourth route in its comments: OpenAI-compatible models written as `openai/hunyuan-turbo-vision` or `openai/doubao-1-5-vision-pro-32k-250115`. It also shows optional `OPENAI_API_BASE`, `OPENROUTER_API_BASE` and `REQUESTY_API_BASE` values, so a compatible endpoint can replace the default URL.

One inconsistency is worth knowing. The Requirements section mentions access to OpenAI or OpenRouter only, while the Features list and configuration section also cover Requesty.

Configuration is a .env file copied from .env.sample

Setup is a copy:

bash
cp .env.sample .env

You then edit `.env`. The README's example sets `MODEL_NAME=gpt-4o`, one of `OPENAI_API_KEY`, `OPENROUTER_API_KEY` or `REQUESTY_API_KEY`, and three optional parameters: `TEMPERATURE=0.3`, `MAX_TOKENS=8192` and `RETRY_TIMES=3`.

`MAX_TOKENS` matters for long pages. If a page holds more text than the budget allows, the README does not say whether the output is truncated, split or rejected, so test a dense page before trusting a batch. `RETRY_TIMES` is the only failure control the README names, and it does not describe what happens after the last retry.

The tool reads configuration from environment variables, so exporting the variables in your shell works as well as a `.env` file, and the Docker examples rely on that.

Install with uv or conda, and the version number in pyproject.toml lags the release

The README recommends uv. The steps are to install uv with `curl -LsSf https://astral.sh/uv/install.sh | sh`, clone `https://github.com/MarkPDFdown/markpdfdown.git`, then run `uv sync` and `uv pip install -e .`. The conda alternative creates an environment with `conda create -n markpdfdown python=3.9`, activates it, and runs `pip install -e .`.

Both routes install from a cloned checkout in editable mode. The README gives no `pip install markpdfdown` line, so do not assume the package is published on PyPI.

Python 3.9 or later is required, and `pyproject.toml` lists classifiers for 3.9 through 3.12. Dependencies include `litellm>=1.0.0`, `pymupdf>=1.25.3`, `pypdf2>=3.0.1`, `python-dotenv>=1.1.0` and `pydantic>=2.0.0`. The file declares `version = "1.1.2"` while the latest release is 1.2.0 from January 2026, so the declared version in the snapshot of the file trails the newest tag.

File mode takes page ranges, and pipe mode is built for Docker

File mode is the recommended one. A basic run looks like this:

bash
markpdfdown --input document.pdf --output output.md

The `--start` and `--end` flags select a page range, for example `--start 1 --end 10`. The same `--input` flag takes an image such as `image.png`. `python -m markpdfdown` runs the same entry point as the `markpdfdown` script, which `pyproject.toml` maps to `markpdfdown.cli:main`.

Pipe mode reads standard input and writes standard output:

bash
markpdfdown < document.pdf > output.md

The README labels this Docker-friendly. For many files the README offers a shell loop, `for file in *.pdf; do`, that calls the tool once per file and swaps the `.pdf` suffix for `.md`.

There is no built-in batch flag or parallelism option. The loop runs the files one after another, and a failed file does not stop the next one unless you add your own error handling. The loop also writes each result next to the source file, named after it, so rerunning the loop overwrites earlier output of the same name. With paid API calls behind every page, a quick check that the `.md` files you already have are good enough saves a second bill for the same document.

The Docker image installs Rust and builds in two stages

The README builds the image with `docker build -t markpdfdown .` and runs it with `docker run -i`, passing `-e MODEL_NAME=gpt-4o` and `-e OPENAI_API_KEY=your-api-key`, and redirecting `< input.pdf > output.md`. Equivalent runs are shown for OpenRouter and Requesty with their own key variables.

The Dockerfile starts from `python:3.9-slim` in a builder stage, installs `curl`, `build-essential` and `pkg-config`, then installs Rust through rustup and uv through its install script. It runs `uv sync --frozen`, copies the virtual environment into a second `python:3.9-slim` stage, and sets `ENTRYPOINT ["python", "-m", "markpdfdown"]`.

Because the builder compiles with Rust present, the first build downloads a toolchain and is slower than a plain pip image. The final image drops the build tools. The container does not mount a volume in the README examples, so input and output travel through stdin and stdout only.

Tests, ruff and pre-commit are wired in, and the README is cut off at the end

The code layout under `src/markpdfdown/` separates `cli.py`, `main.py` and `config.py` from a `core/` package with `llm_client.py` for LiteLLM, `file_worker.py` and `utils.py`. A `tests/` directory and a `Makefile` with `install`, `format`, `lint`, `fix`, `test` and `check` targets back this. `make test` runs `uv run pytest`.

Contributors format with `ruff format`, lint with `ruff check`, and install hooks with `pre-commit install`. Development dependencies come from `uv sync --group dev` or `pip install -e ".[dev]"`. The classifier in `pyproject.toml` reads Development Status :: 4 - Beta, which tells you the author's own rating.

The repository also has an `AGENTS.md`, a `CHANGELOG.md` and translated READMEs in Chinese, Japanese, Russian, Persian and Arabic. A separate desktop app is run with `npx -y markpdfdown`, and it lives in the markpdfdown-desktop repository, not this one. The last push to this repository was on 23 September 2026.

Editorial conclusion

MarkPDFDown suits a developer who already holds an API key for OpenAI, OpenRouter or Requesty and wants a scriptable PDF to Markdown step that runs in a shell loop or a Docker pipe. It does not suit anyone who needs offline conversion, because every page goes to a hosted model, or anyone who needs measured accuracy on tables and formulas, since the README gives none. Convert one representative document of your own with the model you plan to pay for, and read the Markdown before building a batch job around it.

Frequently asked questions

Which AI providers does MarkPDFDown work with?

The README names OpenAI, OpenRouter and Requesty through LiteLLM. The sample environment file also shows OpenAI-compatible models.

Can MarkPDFDown convert only some pages of a PDF?

Yes. The --start and --end flags select a page range, for example --start 1 --end 10 in the README.

Does MarkPDFDown run in Docker?

Yes. The README builds an image with docker build -t markpdfdown . and runs it in pipe mode with docker run -i, passing the model name and API key as environment variables.

Does MarkPDFDown also convert images to Markdown?

Yes. The Features list includes image to Markdown conversion, and the usage example passes image.png to --input.

Official sources

  1. Issues
  2. License: Apache-2.0
  3. MarkPDFdown/markpdfdown on GitHub
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/markpdfdown-markpdfdown.svg)](https://hysenlabs.com/projects/markpdfdown-markpdfdown)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/markpdfdown-markpdfdown.svg)](https://hysenlabs.com/projects/markpdfdown-markpdfdown)

Was this useful?