All articles
agent.ts
// your agent needs to read a page
const { data } = await skim.post("/v1/read", {
  url: "https://example.com/article",
});

// 402 Payment Required  ->  pays $0.002 from its wallet
// clean markdown back in about 1.5 seconds
console.log(data.markdown);

How to Give Your AI Agent Clean Web Reads

A working setup in about five minutes.

Reading the web is the most common thing a modern agent does. To research, to decide, to act, an agent has to pull in a page and make sense of it. The trouble is the way most of us do it first: fetch the raw HTML, hand the whole mess to a flagship language model, and ask it to clean up. That works, but it is the slow, expensive way — six to ten seconds per page, and a bill that runs into the tens of dollars per thousand reads, for what is really clerical work.

There is a faster way, and you can have it running in about five minutes. No signup. No API key. No credit card on file. Your agent pays Skim a fraction of a cent per page, straight from its own wallet, and gets back clean markdown ready to use. Here is the whole thing, start to finish.

Not writing the code yourself? You don't have to. If you're building with an AI agent — vibe coding, as it's often called — you can point your agent at the docs and ask it to set up clean web reads with Skim for you. The docs are written to be read by agents, so yours can do the wiring while you watch. You can even ask it to create and fund a wallet for itself to use. The walkthrough below is here for anyone who wants to see exactly what's happening — but you can absolutely let your agent drive. Keep reading either way; you'll still pick up useful context, including tips for setting up your agent's wallet.

What you'll need

  • Node.js or Python — whichever your agent already runs on.
  • A wallet for your agent, funded with a few dollars of USDC on Base. At $0.002 a read, even $5 buys you 2,500 pages.
  • That's it. There is nothing to sign up for on Skim's side — the wallet is the only credential.

Step 1 — Give your agent a wallet

A wallet is just a key pair your agent holds itself. You can make one in two lines, then fund it with a small amount of USDC on Base from any exchange or wallet app. Keep this a hot wallet — top it up with a little at a time, not your savings — so the most it can ever lose is what's in it.

import { generatePrivateKey, privateKeyToAccount } from "viem/accounts";

const privateKey = generatePrivateKey();
const account = privateKeyToAccount(privateKey);

console.log("Address:", account.address); // fund this with USDC on Base
console.log("Private key:", privateKey);   // save this somewhere safe

If you want the longer version of why one wallet (not one per service) is the right call, see How to Set Up Your Agent's Wallet.

Step 2 — Point an x402 client at Skim

Skim speaks x402, the open protocol that lets any HTTP service ask for payment with a standard 402 Payment Required response. You don't have to handle that handshake yourself — an x402 client wraps your normal HTTP calls and pays automatically when a service asks, signing with your agent's wallet. Here it is with x402-axios in JavaScript:

import { withPaymentInterceptor } from "x402-axios";
import { privateKeyToAccount } from "viem/accounts";
import axios from "axios";

// Your agent's wallet — funded with USDC on Base.
const wallet = privateKeyToAccount(process.env.AGENT_PRIVATE_KEY);

// Axios client that automatically pays 402 responses up to your max.
const skim = withPaymentInterceptor(
  axios.create({ baseURL: "https://skim402.com/api" }),
  wallet,
);

Step 3 — Read a page

Now the part you came for. Ask Skim to read a URL, and the client takes care of the rest: the first request comes back 402, the client signs a $0.002 payment from the wallet, retries, and hands you the result.

const { data } = await skim.post("/v1/read", {
  url: "https://example.com/article",
});

console.log(data.markdown);

What comes back is clean, structured, and ready to use:

{
  "url": "https://example.com/article",
  "finalUrl": "https://example.com/article",
  "mode": "basic",
  "markdown": "# How agents read the web\n\nThe modern web is a mess...",
  "text": "How agents read the web. The modern web is a mess...",
  "metadata": {
    "title": "How agents read the web",
    "byline": "Jane Doe",
    "siteName": "Example",
    "publishedAt": "2025-08-15T00:00:00Z",
    "excerpt": "Why clean reader APIs matter for autonomous agents.",
    "lang": "en",
    "length": 4821
  },
  "fetchedAt": "2026-05-16T18:42:11Z"
}

That round trip takes about a second and a half, and it cost two tenths of a cent. The same read handed to a flagship model takes six to ten seconds and costs roughly thirty times as much — for an answer that's often messier, because the model is guessing at page structure instead of parsing it.

What just happened

No account. No key in a config file. No dashboard. Your agent showed up at the door, the door said "that'll be $0.002," your agent paid from its own wallet, and the door opened. The wallet is the identity, and the receipt is the transaction — there is nothing to reconcile later. That is the whole idea: a credential and a payment method built for a machine, not borrowed from a human.

The same thing in Python or curl

Python, using the x402 SDK:

from x402 import x402ClientSync
from x402.client import max_amount
from x402.http.clients.requests import wrapRequestsWithPayment
from x402.mechanisms.evm.exact.register import register_exact_evm_client
from x402.mechanisms.evm.signers import EthAccountSigner
from eth_account import Account
import os, requests

account = Account.from_key(os.environ["AGENT_PRIVATE_KEY"])
client = x402ClientSync()
register_exact_evm_client(client, EthAccountSigner(account), policies=[max_amount(10_000)])
skim = wrapRequestsWithPayment(requests.Session(), client)

res = skim.post(
    "https://skim402.com/api/v1/read",
    json={"url": "https://example.com/article"},
)
print(res.json()["markdown"])

Or raw curl, if you just want to see the handshake with your own eyes:

# 1. First call — server replies 402 Payment Required with x402 instructions
curl -i -X POST https://skim402.com/api/v1/read \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://example.com/article" }'

# 2. Sign and submit payment with any x402 client, then retry the same
#    request with the X-PAYMENT header set.
curl -X POST https://skim402.com/api/v1/read \
  -H "Content-Type: application/json" \
  -H "X-PAYMENT: <base64-payment-payload>" \
  -d '{ "url": "https://example.com/article" }'

Skim works with any x402-compliant client — x402-axios, x402-fetch, the Python x402 SDK, Coinbase's AgentKit, Anthropic's MCP x402 connector, and the Vercel AI SDK x402 middleware among them.

Where to go from here

That basic read covers the large majority of pages. When you need more, the same wallet and the same pattern carry over:

  • JavaScript-heavy pages that render client-side — use POST /v1/read/js, which loads the page in a real headless browser first.
  • Many URLs at oncePOST /v1/read/batch reads up to ten in a single paid call.
  • Typed JSON instead of markdownPOST /v1/extract returns data shaped to a schema you provide.

The full reference, with every field and error code, lives in the docs.

And that's the whole thing. In about five minutes you gave your agent the ability to read the web — cleanly, in a second and a half, for a fifth of a cent — without opening a single signup form.