Skip to main content

fast-llms-txt

PyPI version Python License codecov

Generate an llms.txt markdown manifest from your FastAPI OpenAPI schema for AI agents. This results in a ~40-50% size reduction vs the output of a OpenAPI spec JSON.

Inspired by the llms.txt specification for LLM-friendly documentation.

Why?

OpenAPI and FastAPI's support for it are excellent, but the specification is designed for deterministic machine interpretation. It must be complete and precise. Every schema, every $ref, every possible response. This results in a very large document.

AI agents have different needs:

  • Context windows are limited. A 50KB OpenAPI spec consumes tokens that could be used for reasoning.
  • Agents can infer. A Task mentioned in one endpoint is probably the same Task concept elsewhere. They don't need every relationship spelled out.
  • Agents recover from errors. If an API responds that foo needs to be an integer, the agent adapts. It doesn't need perfect type information upfront.

This project applies the llms.txt philosophy, Concise, readable documentation for LLMs—to APIs.

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.txt
  • prefix="/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 instance
  • path: 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:

  1. Update version in pyproject.toml and fast_llms_txt/__init__.py
  2. Show diff and prompt for confirmation
  3. Commit the version bump
  4. Prompt for release notes (or auto-generate from commits)
  5. 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: release environment in GitHub repo settings restricts publishing to v* tags

Metadata

Release files for fast-llms-txt 0.5.5

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

Source distribution (sdist)

Source distribution for fast-llms-txt 0.5.5
File Size Uploaded Provenance
fast_llms_txt-0.5.5.tar.gz 6.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fast-llms-txt 0.5.5
File Interpreter ABI Platform
fast_llms_txt-0.5.5-py3-none-any.whl Python 3 none any Details

Total release size: 13.9 kB

Release files / fast_llms_txt-0.5.5.tar.gz

Download URL fast_llms_txt-0.5.5.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6decdef566c0509b2bd83c15dc6dd5209eec118e5e16a064b06e85f730fbe104
BLAKE2b-256 checksum
How to use checksums
8c050f58e3d1807168569131bd07ea27e9fe89b5569ab3921d92c77eacf94a6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Jan 6, 2026.

Transparency log

Release files / fast_llms_txt-0.5.5-py3-none-any.whl

Download URL fast_llms_txt-0.5.5-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4ffc84420c64a9be7dcc1392381a46840b26efd0ce9daad7348d31828cff03e
BLAKE2b-256 checksum
How to use checksums
cdfbc6e63bd35e433de7732708204f689adcd26d0b30ecd8bae8de8d1018e583
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Jan 6, 2026.

Transparency log

Security for fast-llms-txt 0.5.5

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for fast_llms_txt-0.5.5.tar.gz

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 Jan 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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