llm-markdownify


Namellm-markdownify JSON
Version 0.2.1 PyPI version JSON
download
home_pageNone
SummaryConvert PDFs, images to high-quality Markdown using Vision LLMs.
upload_time2025-08-09 14:58:17
maintainerNone
docs_urlNone
authorSethu Pavan Venkata Reddy Pastula
requires_python>=3.10
licenseApache-2.0
keywords docx image jpeg jpg litellm llm markdown ocr pdf png vision
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## Markdownify

Mardownify is a super easy-to-use PDF/image to high-quality Markdown converter using Vision LLMs. It supports text, images, signatures, tables, charts, flowcharts and preserves document structure (Headings, numbered lists etc).

Tables become Markdown tables, charts become Mermaid diagrams, and images get concise summaries. Use as a CLI or Python library. Works with 100+ LLMs. Recommended to use with `gpt-5-mini` or `gpt-4.1-mini` or even better models for better performance. 

If you don't believe it there's a whole gallery of examples with really wide range of OCR tasks you can explore here -> [Gallery](https://github.com/sethupavan12/Markdownify/blob/main/examples/gallery.md) 

<img width="2000" height="600" alt="image" src="https://github.com/user-attachments/assets/9a8b5176-03d8-4063-a8f3-4b1e52bdbe72" />

### Install
```bash
uv pip install llm-markdownify
# or
pip install llm-markdownify
```

### Quickstart (CLI)
```bash
# PDF input
markdownify input.pdf -o output.md --model gpt-5-mini

# Or single image input (PNG/JPG/JPEG)
markdownify input.png -o output.md --model gpt-5-mini
```

### Features
- High-quality complex markdown generation powered by LLMs. 
- Supports Text, Images, Tables, Charts.
- Built-in prompts tuned for clean Markdown, Mermaid, and structured headings along with ability to customise.
- Supports multi-page tables, charts and images.
- High-fidelity page rendering from PDF.
- Optional DOCX→PDF conversion using MS word installation.
- Works seamlessly with 100+ LLMs with LiteLLM Intergration.

### Python API (one-liner)
```py
from llm_markdownify import convert

convert(
    "input.pdf",  # or an image path like "input.png"
    "output.md",
    model="gpt-5-mini",   # optional; can rely on env/provider defaults
    dpi=72,
    profile="contracts",    # or path to JSON profile
)
```

Optional DOCX support (macOS/Windows via Word):
```bash
pip install llm-markdownify[docx]
```

### Configure your provider (via LiteLLM)
Pick one of the following. See the full providers list and details in the LiteLLM docs: [Supported Providers](https://docs.litellm.ai/docs/providers).

- **OpenAI**
  - Set your API key:
    ```bash
    export OPENAI_API_KEY="sk-..."
    ```
  - Example usage:
    ```bash
    markdownify input.pdf -o output.md --model gpt-5-mini
    markdownify input.pdf -o output.md --model gpt-5-mini
    ```

- **Google Gemini**
  - Set your API key (Google AI Studio key):
    ```bash
    export GOOGLE_API_KEY="..."
    ```
  - Example usage (pick a Gemini vision-capable model):
    ```bash
    markdownify input.pdf -o output.md --model gemini/gemini-2.5-flash
    markdownify input.pdf -o output.md --model gemini/gemini-2.5-flash
    ```

- **Azure OpenAI**
  - Set these environment variables (values from your Azure OpenAI resource):
    ```bash
    export AZURE_API_KEY="..."
    export AZURE_API_BASE="https://<your-resource>.openai.azure.com"
    export AZURE_API_VERSION=""
    ```
  - Use your deployment name via the `azure/<deployment_name>` model syntax:
    ```bash
    markdownify input.pdf -o output.md --model azure/<deployment_name>
    markdownify input.pdf -o output.md --model azure/<deployment_name>
    ```
  - See: [LiteLLM Azure OpenAI](https://docs.litellm.ai/docs/providers/azure_openai)

- **OpenAI-compatible APIs**
  - Many providers expose an OpenAI-compatible REST API. Set your API key and base URL:
    ```bash
    export OPENAI_API_KEY="..."
    export OPENAI_API_BASE="https://your-openai-compatible-endpoint.com/v1"
    ```
  - Use the model name supported by that endpoint:
    ```bash
    markdownify input.pdf -o output.md --model <model-name>
    markdownify input.pdf -o output.md --model <model-name>
    ```
  - Reference: [LiteLLM Providers](https://docs.litellm.ai/docs/providers)

For additional providers and advanced configuration (fallbacks, cost tracking, streaming), see the LiteLLM docs: [Getting Started](https://docs.litellm.ai/).

### Configuration flags
- `--model`: LiteLLM model (e.g., `gpt-5-mini`, `azure/<deployment>`, `gemini/gemini-2.5-flash`)
- `--dpi`: Render DPI (default 72). Ignored for direct image inputs.
- `--max-group-pages`: Max pages to merge for continued content (default 3)
- `--no-grouping`: Disable LLM-based grouping
- `--temperature`, `--max-tokens`: LLM generation params

### Attribution & License
This project uses the Apache 2.0 License, which includes an attribution/NOTICE requirement. If you distribute or use this project, please keep the `LICENSE` and `NOTICE` files intact, crediting the original author, Sethu Pavan Venkata Reddy Pastula.

- Project repository: https://github.com/sethupavan12/Markdownify

### Development
- Requires Python 3.10+
- Use `uv` for fast installs: `uv sync`
- Run tests: `pytest`
- Lint: `ruff check src tests`

Check [CONTRIBUTING.md](CONTRIBUTING.md) for more details

### Releasing
GitHub Actions are configured to:
- Run tests on PRs/pushes
- Build & publish to PyPI on tagged releases

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "llm-markdownify",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "docx, image, jpeg, jpg, litellm, llm, markdown, ocr, pdf, png, vision",
    "author": "Sethu Pavan Venkata Reddy Pastula",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/b7/bc/1935f29ed061d36e4874be009debfb38a5ee49e6c2cc6dc4359a9d8d45ba/llm_markdownify-0.2.1.tar.gz",
    "platform": null,
    "description": "## Markdownify\n\nMardownify is a super easy-to-use PDF/image to high-quality Markdown converter using Vision LLMs. It supports text, images, signatures, tables, charts, flowcharts and preserves document structure (Headings, numbered lists etc).\n\nTables become Markdown tables, charts become Mermaid diagrams, and images get concise summaries. Use as a CLI or Python library. Works with 100+ LLMs. Recommended to use with `gpt-5-mini` or `gpt-4.1-mini` or even better models for better performance. \n\nIf you don't believe it there's a whole gallery of examples with really wide range of OCR tasks you can explore here -> [Gallery](https://github.com/sethupavan12/Markdownify/blob/main/examples/gallery.md) \n\n<img width=\"2000\" height=\"600\" alt=\"image\" src=\"https://github.com/user-attachments/assets/9a8b5176-03d8-4063-a8f3-4b1e52bdbe72\" />\n\n### Install\n```bash\nuv pip install llm-markdownify\n# or\npip install llm-markdownify\n```\n\n### Quickstart (CLI)\n```bash\n# PDF input\nmarkdownify input.pdf -o output.md --model gpt-5-mini\n\n# Or single image input (PNG/JPG/JPEG)\nmarkdownify input.png -o output.md --model gpt-5-mini\n```\n\n### Features\n- High-quality complex markdown generation powered by LLMs. \n- Supports Text, Images, Tables, Charts.\n- Built-in prompts tuned for clean Markdown, Mermaid, and structured headings along with ability to customise.\n- Supports multi-page tables, charts and images.\n- High-fidelity page rendering from PDF.\n- Optional DOCX\u2192PDF conversion using MS word installation.\n- Works seamlessly with 100+ LLMs with LiteLLM Intergration.\n\n### Python API (one-liner)\n```py\nfrom llm_markdownify import convert\n\nconvert(\n    \"input.pdf\",  # or an image path like \"input.png\"\n    \"output.md\",\n    model=\"gpt-5-mini\",   # optional; can rely on env/provider defaults\n    dpi=72,\n    profile=\"contracts\",    # or path to JSON profile\n)\n```\n\nOptional DOCX support (macOS/Windows via Word):\n```bash\npip install llm-markdownify[docx]\n```\n\n### Configure your provider (via LiteLLM)\nPick one of the following. See the full providers list and details in the LiteLLM docs: [Supported Providers](https://docs.litellm.ai/docs/providers).\n\n- **OpenAI**\n  - Set your API key:\n    ```bash\n    export OPENAI_API_KEY=\"sk-...\"\n    ```\n  - Example usage:\n    ```bash\n    markdownify input.pdf -o output.md --model gpt-5-mini\n    markdownify input.pdf -o output.md --model gpt-5-mini\n    ```\n\n- **Google Gemini**\n  - Set your API key (Google AI Studio key):\n    ```bash\n    export GOOGLE_API_KEY=\"...\"\n    ```\n  - Example usage (pick a Gemini vision-capable model):\n    ```bash\n    markdownify input.pdf -o output.md --model gemini/gemini-2.5-flash\n    markdownify input.pdf -o output.md --model gemini/gemini-2.5-flash\n    ```\n\n- **Azure OpenAI**\n  - Set these environment variables (values from your Azure OpenAI resource):\n    ```bash\n    export AZURE_API_KEY=\"...\"\n    export AZURE_API_BASE=\"https://<your-resource>.openai.azure.com\"\n    export AZURE_API_VERSION=\"\"\n    ```\n  - Use your deployment name via the `azure/<deployment_name>` model syntax:\n    ```bash\n    markdownify input.pdf -o output.md --model azure/<deployment_name>\n    markdownify input.pdf -o output.md --model azure/<deployment_name>\n    ```\n  - See: [LiteLLM Azure OpenAI](https://docs.litellm.ai/docs/providers/azure_openai)\n\n- **OpenAI-compatible APIs**\n  - Many providers expose an OpenAI-compatible REST API. Set your API key and base URL:\n    ```bash\n    export OPENAI_API_KEY=\"...\"\n    export OPENAI_API_BASE=\"https://your-openai-compatible-endpoint.com/v1\"\n    ```\n  - Use the model name supported by that endpoint:\n    ```bash\n    markdownify input.pdf -o output.md --model <model-name>\n    markdownify input.pdf -o output.md --model <model-name>\n    ```\n  - Reference: [LiteLLM Providers](https://docs.litellm.ai/docs/providers)\n\nFor additional providers and advanced configuration (fallbacks, cost tracking, streaming), see the LiteLLM docs: [Getting Started](https://docs.litellm.ai/).\n\n### Configuration flags\n- `--model`: LiteLLM model (e.g., `gpt-5-mini`, `azure/<deployment>`, `gemini/gemini-2.5-flash`)\n- `--dpi`: Render DPI (default 72). Ignored for direct image inputs.\n- `--max-group-pages`: Max pages to merge for continued content (default 3)\n- `--no-grouping`: Disable LLM-based grouping\n- `--temperature`, `--max-tokens`: LLM generation params\n\n### Attribution & License\nThis project uses the Apache 2.0 License, which includes an attribution/NOTICE requirement. If you distribute or use this project, please keep the `LICENSE` and `NOTICE` files intact, crediting the original author, Sethu Pavan Venkata Reddy Pastula.\n\n- Project repository: https://github.com/sethupavan12/Markdownify\n\n### Development\n- Requires Python 3.10+\n- Use `uv` for fast installs: `uv sync`\n- Run tests: `pytest`\n- Lint: `ruff check src tests`\n\nCheck [CONTRIBUTING.md](CONTRIBUTING.md) for more details\n\n### Releasing\nGitHub Actions are configured to:\n- Run tests on PRs/pushes\n- Build & publish to PyPI on tagged releases\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Convert PDFs, images to high-quality Markdown using Vision LLMs.",
    "version": "0.2.1",
    "project_urls": {
        "Homepage": "https://github.com/sethupavan12/Markdownify",
        "Issues": "https://github.com/sethupavan12/Markdownify/issues",
        "Repository": "https://github.com/sethupavan12/Markdownify"
    },
    "split_keywords": [
        "docx",
        " image",
        " jpeg",
        " jpg",
        " litellm",
        " llm",
        " markdown",
        " ocr",
        " pdf",
        " png",
        " vision"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "40341474650a407e9de763fe1cfa9b76278ed3779747fc17fde84f3a5ef4481c",
                "md5": "d50cd8b637eb618d60a2e315a7401ce3",
                "sha256": "94a445387f2d40590ad638301dc005d4fdd91c1df2e6196d39a2a9e4f697f9d0"
            },
            "downloads": -1,
            "filename": "llm_markdownify-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d50cd8b637eb618d60a2e315a7401ce3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 21689,
            "upload_time": "2025-08-09T14:58:16",
            "upload_time_iso_8601": "2025-08-09T14:58:16.602532Z",
            "url": "https://files.pythonhosted.org/packages/40/34/1474650a407e9de763fe1cfa9b76278ed3779747fc17fde84f3a5ef4481c/llm_markdownify-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b7bc1935f29ed061d36e4874be009debfb38a5ee49e6c2cc6dc4359a9d8d45ba",
                "md5": "687bb7f593fd188bb406f4104dd0c37b",
                "sha256": "ca58636d7db94a6b08ff71bc846384ca106b5053e3aa34850673cde66d50d22f"
            },
            "downloads": -1,
            "filename": "llm_markdownify-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "687bb7f593fd188bb406f4104dd0c37b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 15499,
            "upload_time": "2025-08-09T14:58:17",
            "upload_time_iso_8601": "2025-08-09T14:58:17.766201Z",
            "url": "https://files.pythonhosted.org/packages/b7/bc/1935f29ed061d36e4874be009debfb38a5ee49e6c2cc6dc4359a9d8d45ba/llm_markdownify-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-09 14:58:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sethupavan12",
    "github_project": "Markdownify",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "llm-markdownify"
}
        
Elapsed time: 1.23945s