llms-generator
Crawl any website and generate llms.txt. A Markdown file at your domain root that tells AI systems which pages to read.
Homepage: https://abdulaouwal.com/project/llms-generator/ Documentation: https://llms-generator.readthedocs.io/
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:
- robots.txt - skips disallowed paths
- X-Robots-Tag - respects
noindexandnofollowfrom HTTP headers <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
- Parse
robots.txt. Handles missing or restricted files, honorscrawl-delay, and matches a fixedllms-generatoruser-agent token. - BFS from the start URL up to
--depthlevels. Tracking parameters (utm_*,fbclid,gclid,ref, …) are stripped so they do not cause duplicate crawls. - For each page:
- Fetch with
requests, retrying transient 429/5xx/timeouts withRetry-Afterbackoff - 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
- Fetch with
- Group pages by top-level directory path
- 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.
Contributing
- Fork the repo and clone it
- Create a branch:
git checkout -b my-change - Install for development:
pip install -e . - Run tests:
python -m pytest tests/ - 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.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| llms_generator-0.3.0.tar.gz | 18.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llms_generator-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.1 kB
Release files / llms_generator-0.3.0.tar.gz
| Download URL | llms_generator-0.3.0.tar.gz |
|---|---|
| Size | 18.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a7cf8f6bf730d16f9db45647246ba421ff81692728d070bae7f55208fe8dc5e2
|
|
BLAKE2b-256 checksum How to use checksums |
7a5b1229feeea247f5244e61fe4070b3d7f7bd9bf6d47890c59adfcadecafcba
|
| 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 logRelease files / llms_generator-0.3.0-py3-none-any.whl
| Download URL | llms_generator-0.3.0-py3-none-any.whl |
|---|---|
| Size | 15.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
40b09ab31014e6bca216811bd798f89bf9d078b0cf5154483ae4332359539a39
|
|
BLAKE2b-256 checksum How to use checksums |
db6cc72aadc6419a414b478ac6171e98945a5b047ae58c4faa31f79b547c13ef
|
| 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