Skip to main content

lyrenth (Python)

Read the web as clean AIDocuments through Lyrenth, with first-class LangChain and LlamaIndex adapters.

Each URL resolves to a stable AIDocument: cleaned Markdown plus title, description, and structure, with navigation and boilerplate stripped. Reads go through Lyrenth's cross-caller cache, and for verified domains you get the publisher's canonical version.

Install

pip install lyrenth                 # core client, zero dependencies
pip install 'lyrenth[langchain]'    # + LangChain loader
pip install 'lyrenth[llamaindex]'   # + LlamaIndex reader

Get a free API key at https://lyrenth.com/signup (2,000 reads/month, no card) and set it as LYRENTH_API_KEY.

Client

from lyrenth import Lyrenth

client = Lyrenth()  # reads LYRENTH_API_KEY from the environment
doc = client.read("https://example.com/article")

print(doc.title)
print(doc.markdown)        # cleaned, agent-ready body
print(doc.word_count)
print(doc.raw)             # full v2 envelope if you need structure/economics

# just the text:
text = client.read_markdown("https://example.com/article")

# force a fresh fetch instead of the cached version:
fresh = client.read("https://example.com/article", fresh=True)

# cap the body to a context budget:
small = client.read("https://example.com/article", max_tokens=500)

# up to 20 URLs in one call (each result isolated):
for r in client.read_batch(["https://a.com", "https://b.com"]):
    print(r.document.title if r.ok else f"{r.url}: {r.error}")

LangChain

from lyrenth.langchain import LyrenthLoader

docs = LyrenthLoader(
    ["https://example.com/a", "https://example.com/b"]
).load()
# -> list[langchain_core.documents.Document]
#    page_content = cleaned Markdown
#    metadata     = {source, title, description, word_count}

Use it anywhere a LangChain loader fits (RAG ingestion, splitters, vector stores). lazy_load() streams documents one URL at a time.

LlamaIndex

from lyrenth.llamaindex import LyrenthReader

docs = LyrenthReader().load_data(["https://example.com/a"])
# -> list[llama_index.core.Document]  (text = cleaned Markdown)

Why read through Lyrenth

  • Cleaner, cheaper. One stable shape per URL, far fewer tokens than raw HTML.
  • Cached across callers. Repeat URLs collapse to a minimal number of origin fetches, so it is fast and origin-friendly.
  • Canonical when verified. When a site's owner has verified with Lyrenth, you get the version they authored, kept fresh by their change signal.

Config

Argument / env Default Notes
api_key / LYRENTH_API_KEY none Free key at https://lyrenth.com/signup
base_url https://api.lyrenth.com Override for staging / self-host

The AIDocument format is an open contract; see https://lyrenth.com/llms-full.txt. MIT licensed.

Release files for lyrenth 0.1.1

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

Source distribution (sdist)

Source distribution for lyrenth 0.1.1
File Size Uploaded
lyrenth-0.1.1.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lyrenth 0.1.1
File Interpreter ABI Platform
lyrenth-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.7 kB

Release files / lyrenth-0.1.1.tar.gz

Download URL lyrenth-0.1.1.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
551abeb718b785c51b9cc72e637b39b7fc727308f54005c11ddd5f114cee523b
BLAKE2b-256 checksum
How to use checksums
dd843bed84abad0f5f3dafd7dbb98f4a32c7d127d8c72c304927a3b6a395c2d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / lyrenth-0.1.1-py3-none-any.whl

Download URL lyrenth-0.1.1-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46b480e45a780447755bcfc130beddfa223c9232260d44a3e2b35660e896c871
BLAKE2b-256 checksum
How to use checksums
59ae68cb72a61376ff0df3c088b0a8cd389e7aa3c85477b3f98d400bf423226c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.1.1 This release

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