Skip to main content

skim-haystack

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

PyPI version License: MIT

skim-haystack is the official Haystack integration for Skim — the clean reader API for AI agents. It provides one component, SkimReader, that fetches any web page and returns it as a Haystack Document (clean Markdown in content, structured metadata in meta). Output is ~4x smaller than raw HTML — your pipeline processes more pages with fewer tokens.

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 skim-haystack

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 skim_haystack import SkimReader

reader = SkimReader()  # reads SKIM_API_KEY from the environment

result = reader.run(urls="https://en.wikipedia.org/wiki/HTTP_402")
print(result["documents"][0].content)

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.

Or configure explicitly with Haystack Secrets:

from haystack.utils import Secret
from skim_haystack import SkimReader

reader = SkimReader(
    private_key=Secret.from_token("0x..."),
    max_price_usd=0.005,
    include_metadata=True,
)

Use it in a pipeline

SkimReader is a standard Haystack component, so it drops straight into a Pipeline. Here it fetches a page and feeds the cleaned Markdown into a prompt:

from haystack import Pipeline
from haystack.components.builders import PromptBuilder
from haystack.components.generators import OpenAIGenerator
from skim_haystack import SkimReader

pipe = Pipeline()
pipe.add_component("reader", SkimReader())
pipe.add_component("prompt", PromptBuilder(
    template="Summarize this article in 5 bullets:\n\n{{ documents[0].content }}"
))
pipe.add_component("llm", OpenAIGenerator(model="gpt-4o-mini"))

pipe.connect("reader.documents", "prompt.documents")
pipe.connect("prompt.prompt", "llm.prompt")

result = pipe.run({"reader": {"urls": "https://en.wikipedia.org/wiki/HTTP_402"}})
print(result["llm"]["replies"][0])

Output shape

SkimReader.run(...) returns {"documents": [Document, ...]} — one Document per URL:

  • Document.content — the cleaned article body in Markdown.
  • Document.meta — always includes source (the URL), plus page metadata (title, byline, publishedAt, lang, excerpt, ...) unless include_metadata=False.

Configuration

SkimReader takes the following parameters:

Parameter Default Notes
api_key Secret.from_env_var("SKIM_API_KEY", strict=False) Card-plan API key. Get one free at skim402.com/pricing. Takes priority over private_key.
private_key Secret.from_env_var("SKIM_WALLET_PRIVATE_KEY", strict=False) Wallet lane only. Hex Base wallet private key. Ignored when api_key resolves.
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 Populate each Document's meta with page metadata.
timeout 60 Per-request timeout in seconds.

The component supports pipeline serialization (to_dict/from_dict). When the key comes from an environment variable (the default), it is stored as a reference to that variable name — never the raw value. An inline Secret.from_token("...") is runtime-only and will not serialize.


Security

  • No outbound telemetry from this package. skim-haystack 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

skim_haystack-0.1.2.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

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

skim_haystack-0.1.2-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file skim_haystack-0.1.2.tar.gz.

File metadata

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

File hashes

Hashes for skim_haystack-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e3d756d75710eeb6ac98244bf4543c7e29161ff1f0620bc81c566eb68381eecd
MD5 b87f71f4e5632f78bb191b0074bbded4
BLAKE2b-256 fe3c972d2249e859b3bd10a94fb5f4e88723a5535f890363b4a07495f59a7497

See more details on using hashes here.

File details

Details for the file skim_haystack-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for skim_haystack-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4766d412643d738643368ea260c6fe0d51f36810399b5505680bc2a6bb31fd9d
MD5 56de90e0a3932c41642cd6d647c9d9ad
BLAKE2b-256 6e45b42e82a837b0d81a8b6e497905f1aeffd98058136c2533141a00af09b7a0

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.4

2 files

0.1.3

2 files

This release

0.1.2 This release

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