Skip to main content

Crawl any website and generate llms.txt — the AI-ready site map standard.

Project description

llms-generator

PyPI Python License

Crawl any website and generate llms.txt — the AI-ready site map standard.

llms.txt is a markdown file placed at a website's root (/llms.txt) that helps AI assistants like ChatGPT, Claude, and Perplexity understand your site's content structure. Think of it as robots.txt for AI.

This tool crawls your site, extracts page metadata, groups pages into logical sections, and outputs a spec-compliant llms.txt file.


Why llms.txt?

AI systems struggle to navigate large, noisy websites. An llms.txt file gives them a curated map of your most important content — leading to:

  • Accurate citations in AI-generated responses
  • Better brand representation in ChatGPT, Perplexity, Google AI Overviews
  • Less server load from AI crawlers wandering your site
  • Control over how AI systems reference your content

The llms.txt specification was proposed by Jeremy Howard in 2024 and is actively supported by Perplexity, Anthropic, and other AI platforms.


Installation

pip install llms-generator

For JavaScript-heavy sites (optional):

pip install llms-generator[js]
playwright install chromium

Usage

llms-gen https://example.com

That's it. The tool crawls your site and creates llms.txt in the current directory.

Options

Flag Default Description
URL required Target website URL
--depth 2 Maximum crawl depth
--output llms.txt Output file path
--full False Also generate llms-full.txt with full page content
--no-js False Skip Playwright JavaScript rendering fallback
--delay 1.0 Seconds between requests (be polite)

Examples

# Basic crawl (2 levels deep)
llms-gen https://example.com

# Crawl deeper, output to custom path
llms-gen https://docs.example.com --depth 3 --output site-llms.txt

# Generate both standard and full versions
llms-gen https://example.com --full

# Fast crawl without JS rendering
llms-gen https://example.com --no-js --delay 0.5

How it works

Per-page robot check

Every page is checked against three layers before being included or followed:

robots.txt ──┬── disallowed? → skip
             └── allowed? ──→ check HTTP X-Robots-Tag header
                                     │
                           noindex? ──→ skip
                           nofollow? ──→ still analyze, don't follow links
                                     │
                           absent ──→ check <meta name="robots">
                                     │
                           noindex? ──→ skip
                           nofollow? ──→ still analyze, don't follow links
                                     │
                           absent/index,follow ──→ analyze + follow links

Pages with noindex are excluded from llms.txt. Pages with nofollow are still analyzed for their content but their child links are not crawled.

Crawl strategy

  1. Parse robots.txt — respect Disallow and Crawl-Delay
  2. BFS from the start URL up to --depth levels
  3. For each page:
    • Fetch with requests (handles most sites)
    • If content is empty (JS-rendered), fall back to Playwright headless browser
    • Extract: <title>, <h1>, <meta name="description">, first meaningful paragraph, directory path
  4. Group pages into sections (directory-based, with H1 fallback)
  5. Assemble llms.txt per the spec

Section grouping

Pages are grouped into ## sections by their top-level directory path:

/docs/getting-started   → ## Docs
/blog/hello-world       → ## Blog
/api/v1/users           → ## Api

Pages without a clear directory path use their <h1> as the section name.


Output format

The generated llms.txt follows the llmstxt.org specification:

# Example Site

> A great example site with documentation and blog content.

This file provides AI systems with a structured summary of this website.

## Docs

- [Getting Started](https://example.com/docs/getting-started): How to get started with our platform.
- [API Reference](https://example.com/docs/api): Complete API documentation.

## Blog

- [Hello World](https://example.com/blog/hello): Our first blog post.

llms-full.txt

With --full, an expanded version is also generated that includes the full text content of each page inline — useful for providing complete context to LLMs in a single file.


Development

git clone https://github.com/aouwalitshikkha/llms-generator.git
cd llms-generator
pip install -e .
pip install -e ".[js]"   # with Playwright support

Run tests:

pip install pytest
pytest

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llms_generator-0.1.0.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llms_generator-0.1.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file llms_generator-0.1.0.tar.gz.

File metadata

  • Download URL: llms_generator-0.1.0.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for llms_generator-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0905d82016a46c37d9df5b142494ec15f95bf5262b70e74a12dff21464ddff95
MD5 65b4b5c1ef496b2d41e75cb9cfa2f494
BLAKE2b-256 fb5835e2a5ef97fc39a9146d1c56a7341934df82d1fd6c5bdb44d1d399088e01

See more details on using hashes here.

File details

Details for the file llms_generator-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: llms_generator-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for llms_generator-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dc95a77d8a88afd58b9b68bdc8ca4a05ce92d9441db6a2894bb87541cbf8271c
MD5 0117c641b66617f1c4e629e12eebd2d8
BLAKE2b-256 e5eb180feb359cf1d2d9108b1631220217fa0998a66d7cdc2f19e271d3a26516

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page