Skip to main content

langchain-skim

Give your LangChain agent the ability to read any URL — clean Markdown, ~4x smaller than raw HTML. No ads, no nav, no boilerplate.

PyPI version License: MIT

langchain-skim is the official LangChain tool for Skim — the clean reader API for AI agents. It exposes one tool, SkimReader, that your agent can call to fetch any web page as agent-ready Markdown plus structured metadata (title, byline, published date, language, excerpt). Output is ~4x smaller than raw HTML — your agent spends fewer tokens and processes pages faster.

Two ways to pay: card plan with API key (free tier: 1,000 reads/month — skim402.com/pricing) or x402 wallet pay-per-call ($0.002 USDC on Base, no account needed).

See it before you wire it: try Skim free in your browser — 10 free skims a day, no wallet, no signup. Paste a URL, see exactly what your agent gets back.


Install

pip install langchain-skim

Quickstart (60 seconds)

1. Get a free API key

Go to skim402.com/pricing, sign up for the free plan (1,000 reads/month), and copy your sk402_... key.

2. Set the env var

export SKIM_API_KEY=sk402_your_key_here

3. Use it

from langchain_skim import SkimReader

reader = SkimReader()  # reads SKIM_API_KEY from the environment

markdown = reader.invoke({"url": "https://en.wikipedia.org/wiki/HTTP_402"})
print(markdown)

The tool returns clean Markdown with a YAML frontmatter block of metadata. ~4x smaller than the raw HTML, so your model processes it faster and with fewer tokens.


Alternative: pay per call with a crypto wallet

If you prefer x402 wallet pay-per-call instead of a card plan:

export SKIM_WALLET_PRIVATE_KEY=0xYOUR_BASE_WALLET_PRIVATE_KEY

Fund a dedicated Base wallet with a small USDC balance. Each read costs $0.002 on Base. Full setup guide: https://skim402.com/wallet.

Use a fresh wallet, not your personal one. This wallet's private key signs payment authorizations on your machine — treat it like a hot wallet for paying $0.002 tolls, not a savings account.


Use it in an agent

SkimReader is a standard LangChain BaseTool, so it drops straight into any agent's tool list:

from langchain_skim import SkimReader
from langchain.agents import create_react_agent  # or any agent constructor
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(model="gpt-4o-mini")
tools = [SkimReader()]

agent = create_react_agent(llm, tools)
agent.invoke({"messages": [("user", "Read https://example.com/article and summarize it.")]})

The agent decides when to call skim_read, Skim returns clean Markdown, and the model gets ~4x less tokens to process.


Output shape

SkimReader returns Markdown with a YAML frontmatter block of the page metadata:

---
title: Example article
byline: Jane Doe
publishedAt: 2025-01-15
lang: en
excerpt: A short summary...
---

# Example article

The cleaned article body in Markdown...

Set include_metadata=False to get just the Markdown body.


Configuration

SkimReader takes the following parameters:

Parameter Default Notes
api_key $SKIM_API_KEY Card-plan API key (sk402_...). Get one free at skim402.com/pricing. Takes priority over private_key.
private_key $SKIM_WALLET_PRIVATE_KEY Wallet lane only. Hex private key for the Base wallet. Ignored when api_key is set.
base_url https://skim402.com Override the API base URL. For self-hosting or local development.
max_price_usd 0.01 Wallet lane only. Hard cap on per-call price in USD. Skim is $0.002/call.
include_metadata True Prepend a YAML frontmatter block of page metadata to the returned Markdown.
timeout 60 Per-request timeout in seconds.
# Card key (recommended)
reader = SkimReader(api_key="sk402_...")

# Or wallet
reader = SkimReader(
    private_key="0x...",
    max_price_usd=0.005,
    include_metadata=False,
)

Security

  • No outbound telemetry from this package. langchain-skim only talks to skim402.com (or whatever you set as base_url). No analytics, no error reporting, no phone-home.
  • Wallet lane: the private key only signs payment authorizations locally — it never leaves your machine.

Links


License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_skim-0.1.4.tar.gz (198.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_skim-0.1.4-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file langchain_skim-0.1.4.tar.gz.

File metadata

  • Download URL: langchain_skim-0.1.4.tar.gz
  • Upload date:
  • Size: 198.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for langchain_skim-0.1.4.tar.gz
Algorithm Hash digest
SHA256 1d9f1b9b012a3fce08f58c40cc84a3c75594a8e64546d8b6735d289aa031b04c
MD5 725d6e8fc60638dea8391ac81b4ebe52
BLAKE2b-256 5f619f65abe181c5dcc5f8a7b5f399ba8477ae9bdb6cf62f6b7030cf1b463a1a

See more details on using hashes here.

File details

Details for the file langchain_skim-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_skim-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9a4f65deea28360675a37d0694596c33ae88d7b0a4dcd54b8b38ba4d0b1ed894
MD5 5252705fb76f4c2e212ec9fccbcf51ab
BLAKE2b-256 83b79fb091ca848d6e09fed2ac33f9b7e8beba68b30084d6298d2fe6133aabd8

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.5

2 files

This release

0.1.4 This release

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page