Skip to main content

llms-generator

PyPI CI Docs Python Versions License

Crawl any website and generate llms.txt - the AI-ready site map standard.
Respects robots.txt, groups pages by section, and outputs spec-compliant files.

Homepage: https://abdulaouwal.com/project/llms-generator/
Documentation: https://llms-generator.readthedocs.io/
Author: Abdul Aouwal - Technical SEO Consultant


Why llms.txt?

ChatGPT, Claude, and Gemini have small context windows. They cannot read your entire website. llms.txt gives them your essential pages in one request.

The llms.txt specification was proposed by Jeremy Howard in September 2024. It works alongside robots.txt and sitemap.xml. Each serves a different purpose.


Installation

pip install llms-generator

For JavaScript-heavy sites:

pip install llms-generator[js]
playwright install chromium

Requires: Python 3.10+. Core dependencies are requests and beautifulsoup4; Playwright is optional (extra js).


Usage

llms-gen https://example.com

This creates llms.txt in your current folder. Add --full to also generate the full content version.

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
--no-js false Skip Playwright JS fallback
--delay 1.0 Base seconds between requests (adapts to response time)
--timeout 30 Per-request timeout in seconds
--max-pages 0 Stop after this many pages (0 = unlimited)
--prefer-markdown false Link to each page's markdown alternate when advertised
--optional-paths none Extra path names to move into ## Optional
--check false Validate the output against the spec
-v, --verbose false Enable debug logging
--version Show the version and exit

Examples

llms-gen https://example.com
llms-gen https://example.com --depth 3 --output site-llms.txt
llms-gen https://example.com --full
llms-gen https://example.com --no-js --delay 0.5
llms-gen https://example.com --max-pages 100 --timeout 15 --check
llms-gen https://example.com --prefer-markdown --optional-paths changelog,careers

How it works

Robot checks

Every page passes three checks:

  1. robots.txt - skips disallowed paths
  2. X-Robots-Tag - respects noindex and nofollow from HTTP headers
  3. <meta name="robots"> - respects page-level directives

Pages marked noindex are excluded. Pages marked nofollow are analyzed but their links are not crawled.

Crawl steps

  1. Parse robots.txt. Handles missing or restricted files, honors crawl-delay, and matches a fixed llms-generator user-agent token.
  2. BFS from the start URL up to --depth levels. Tracking parameters (utm_*, fbclid, gclid, ref, …) are stripped so they do not cause duplicate crawls.
  3. For each page:
    • Fetch with requests, retrying transient 429/5xx/timeouts with Retry-After backoff
    • Skip 4xx/5xx responses, non-HTML content, and off-domain redirects
    • Fall back to Playwright if content is empty (JS-rendered sites)
    • Extract title, h1, meta description, og:site_name, and main content text
  4. Group pages by top-level directory path
  5. Write llms.txt

Section grouping

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

Pages without a directory path use their <h1> as the section name. Secondary pages (privacy, terms, cookies, legal, tags, authors, archives, …) are placed in a trailing ## Optional section, as recommended by the spec. Use --optional-paths to add your own.


Output

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

# Example Site
> A great example site with documentation and blog content.

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

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

With --full, the tool also writes llms-full.txt with every page's full text under section headings.


About the author

Abdul Aouwal is a Technical SEO Consultant for indexing, crawl, and AI visibility. He builds tools like llms-generator so websites are easier for search engines and AI systems to read.


Contributing

  1. Fork the repo and clone it
  2. Create a branch: git checkout -b my-change
  3. Install for development: pip install -e .
  4. Run tests: python -m pytest tests/
  5. Push and open a pull request

Keep PRs focused. One change per PR. Write a clear description of what you changed and why.


Changelog

See CHANGELOG.md for the full release history.

Metadata

Release files for llms-generator 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llms-generator 0.3.2
File Size Uploaded
llms_generator-0.3.2.tar.gz 18.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llms-generator 0.3.2
File Interpreter ABI Platform
llms_generator-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 34.6 kB

Release files / llms_generator-0.3.2.tar.gz

Download URL llms_generator-0.3.2.tar.gz
Size 18.8 kB
Tags Source
SHA-256 checksum
How to use checksums
48dddc516de80190d6da4a11fe5bc6435ac2e4f0f14ad43edc28435740ee7ce8
BLAKE2b-256 checksum
How to use checksums
5607ac546e7bb2b986b1f9305576a4c5cdd5319c3432e3e4d8fa1fef00025561
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release files / llms_generator-0.3.2-py3-none-any.whl

Download URL llms_generator-0.3.2-py3-none-any.whl
Size 15.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
db32e333e6f9704c96752b5e1c3855dfe6d115a9dce31d72463c46cfcc284032
BLAKE2b-256 checksum
How to use checksums
dc7430708c66f7bc292e94401c3b6767ace7154c843404dfee4c5656c7f8ab7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.11

2 release files

0.1.9

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page