Generate llms.txt markdown from FastAPI OpenAPI schema for AI agents
Project description
fast-llms-txt
Generate an llms.txt markdown manifest from your FastAPI OpenAPI schema for AI agents. This results in a ~75% size reduction vs the output of a OpenAPI spec JSON.
Inspired by the llms.txt specification for LLM-friendly documentation.
Installation
uv add fast-llms-txt
Usage
from fastapi import FastAPI
from fast_llms_txt import create_llms_txt_router
app = FastAPI(title="My API", description="A sample API")
@app.get("/users")
def list_users(limit: int = 10):
"""List all users."""
return []
# Mount the llms.txt endpoint
app.include_router(create_llms_txt_router(app), prefix="/docs")
The prefix determines the final URL path. For example:
prefix="/docs"→GET /docs/llms.txtprefix="/api/v1/docs"→GET /api/v1/docs/llms.txt
Now GET /docs/llms.txt returns:
# My API
> A sample API
## Endpoints
### `GET /users` - List all users.
- **Request Parameters**:
- `limit` (integer, optional)
- **Returns** (200): Successful Response
API
create_llms_txt_router(app, path="/llms.txt")
Creates a FastAPI router that serves the llms.txt endpoint.
app: Your FastAPI application instancepath: The endpoint path (default:/llms.txt)
generate_llms_txt(openapi_schema)
Directly convert an OpenAPI schema dict to llms.txt markdown string.
Appendix: Release Procedure
Versioning
This project uses semantic versioning:
- PATCH (0.1.x): Bug fixes, no API changes
- MINOR (0.x.0): New features, backward compatible
- MAJOR (x.0.0): Breaking API changes
Prerequisites
- GitHub CLI installed and authenticated (
gh auth login)
Release Steps
Run the release script:
./scripts/release.sh 0.2.0
This will:
- Update version in
pyproject.tomlandfast_llms_txt/__init__.py - Show diff and prompt for confirmation
- Commit the version bump
- Prompt for release notes (or auto-generate from commits)
- Push and create GitHub release (triggers PyPI publish via GitHub Actions)
Infrastructure
- PyPI: pypi.org/project/fast-llms-txt
- Trusted Publishing: No tokens required; GitHub Actions authenticates via OIDC
- Environment:
releaseenvironment in GitHub repo settings restricts publishing tov*tags
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fast_llms_txt-0.5.0.tar.gz.
File metadata
- Download URL: fast_llms_txt-0.5.0.tar.gz
- Upload date:
- Size: 58.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7ef082aaeb706e3f7a9f3cf4bdf03767c53035f139080db30c415c74d9d1529
|
|
| MD5 |
f27f1b12493aef091c6859f9c067791c
|
|
| BLAKE2b-256 |
4ab8aa41ce8e57c1be82a12a4b9a8db411bc0847285d859da0fdae4a0b523caf
|
Provenance
The following attestation bundles were made for fast_llms_txt-0.5.0.tar.gz:
Publisher:
publish.yml on AlteredCraft/fast-llms-txt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_llms_txt-0.5.0.tar.gz -
Subject digest:
c7ef082aaeb706e3f7a9f3cf4bdf03767c53035f139080db30c415c74d9d1529 - Sigstore transparency entry: 788893085
- Sigstore integration time:
-
Permalink:
AlteredCraft/fast-llms-txt@f7cea261004174e875cd607eb14556f821bfc7ba -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/AlteredCraft
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f7cea261004174e875cd607eb14556f821bfc7ba -
Trigger Event:
push
-
Statement type:
File details
Details for the file fast_llms_txt-0.5.0-py3-none-any.whl.
File metadata
- Download URL: fast_llms_txt-0.5.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7e1704002dd590c0ddab8ba926d669f02fbb4b867527d8ef6fa809e86f88bcf
|
|
| MD5 |
6818dcc9f36054774fa778afd4d994bc
|
|
| BLAKE2b-256 |
0bc97c1461d42ed68946962450d7250804792b02c3dded5dd170c46307fea8c1
|
Provenance
The following attestation bundles were made for fast_llms_txt-0.5.0-py3-none-any.whl:
Publisher:
publish.yml on AlteredCraft/fast-llms-txt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_llms_txt-0.5.0-py3-none-any.whl -
Subject digest:
d7e1704002dd590c0ddab8ba926d669f02fbb4b867527d8ef6fa809e86f88bcf - Sigstore transparency entry: 788893087
- Sigstore integration time:
-
Permalink:
AlteredCraft/fast-llms-txt@f7cea261004174e875cd607eb14556f821bfc7ba -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/AlteredCraft
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f7cea261004174e875cd607eb14556f821bfc7ba -
Trigger Event:
push
-
Statement type: