{
  "markdown": "# WebLens\n\nPremium web intelligence API for AI agents, with x402 micropayments. No accounts, no API keys — pay per request in USDC on Base.\n\n🌐 **Live API:** https://api.weblens.dev\n📖 **Interactive docs:** https://api.weblens.dev/docs\n🤖 **Agent guide:** https://api.weblens.dev/llms.txt\n🔎 **Marketplace:** [listed on x402scan](https://www.x402scan.com/server/529d8bbf-63d0-481c-93b2-21a92e2060d8)\n\n## Try it free, right now\n\nNo wallet, no signup — these are rate limited to 10 requests/hour per IP:\n\n```bash\ncurl https://api.weblens.dev/r/https://example.com     # any page as markdown\ncurl https://api.weblens.dev/s/cloudflare+workers      # web search\n```\n\n## Preview before you pay (free)\n\nAn agent shouldn't have to buy a call to learn what it returns. `POST /preview` is free and\nanswers that up front — the live price, a one-line summary, and a real sample of the exact\nresponse shape:\n\n```bash\ncurl -X POST https://api.weblens.dev/preview \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"endpoint\": \"/answer\"}'\n```\n\n```jsonc\n{\n  \"endpoint\": \"/answer\",\n  \"price\": \"$0.05\",\n  \"currency\": \"USD\",\n  \"summary\": \"A direct answer with inline [n] citations to real sources.\",\n  \"sample\": { \"query\": \"...\", \"answer\": \"...\", \"citations\": [], \"confidence\": 0.92 },\n  \"sampleType\": \"recorded\",\n  \"livePreviewAvailable\": false,\n  \"livePreviewHint\": \"This endpoint calls a paid upstream provider, so free live previews are not offered — the recorded sample shows the exact response shape.\"\n}\n```\n\n**Live vs recorded.** A real, truncated live preview runs only for endpoints whose marginal cost\nis a plain fetch — currently `/fetch/basic`, `/contents` and `/map` — and only when you pass a\n`url`. Everything else is backed by a metered upstream (SerpAPI, Anthropic); running those free\nwould burn upstream credits, so they return the recorded sample, which still shows every field\nname and type. An endpoint that isn't sold returns `404`.\n\n```bash\n# live: the first 500 chars of the real result, for free\ncurl -X POST https://api.weblens.dev/preview \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"endpoint\": \"/fetch/basic\", \"url\": \"https://example.com\"}'\n```\n\nRate limited to 10 requests/hour per IP like the rest of the free tier.\n\n## ERC-8004: receipts and feedback\n\nERC-8004 (Trustless Agents) keeps compact signals on-chain and the detailed documents off-chain.\nWebLens hosts the **off-chain half** — the part a service operator can run without deploying a\ncontract. To be precise about what that is and isn't: **WebLens is not registered on-chain, holds\nno agent id, and writes nothing to any registry.**\n\n| Endpoint | What it gives you |\n|----------|-------------------|\n| `GET /.well-known/agent-registration.json` | The ERC-8004 registration document: name, description, image, services, `x402Support`, payment info, feedback endpoints. `registrations` is empty (no on-chain registration) and `supportedTrust` is `[\"feedback\"]`. |\n| `GET /receipts/{requestId}` | The receipt for a paid call — endpoint, status, outcome, price, payment method, network, pay-to. Every paid response returns `X-Receipt-Id` and `X-Receipt-Url` headers pointing here. Kept 30 days. |\n| `POST /feedback` | Host a feedback document *you* author; returns `{feedbackURI, feedbackHash}` (keccak-256), the pair `giveFeedback()` expects. Required fields: `agentRegistry`, `agentId`, `clientAddress`, `createdAt`, `value`, `valueDecimals` — a missing one returns `400` naming it. |\n| `GET /feedback/{id}` | Serves that document byte-for-byte, so its keccak-256 hash matches the `feedbackHash` you were given. This URL *is* the `feedbackURI`. |\n\nTwo more things worth stating plainly:\n\n- A receipt's `mac` is a **symmetric HMAC tag** (the same construction as proof-of-context). Only a\n  holder of the key can verify it — it is not a third-party-verifiable signature, and nothing here\n  is trustless.\n- The **buyer** authors the feedback document and posts `giveFeedback()` themselves. WebLens only\n  hosts the document verbatim and returns its hash; it never authors, edits, or submits feedback.\n\n## Endpoints\n\nAll paid endpoints are `POST` with a JSON body. Prices are per request in USDC.\n\n### Core\n\n| Endpoint | Description | Price |\n|----------|-------------|-------|\n| `/fetch/basic` | Fetch a webpage as clean markdown | $0.002 |\n| `/fetch/pro` | Fetch with full JavaScript rendering (SPAs) | $0.006 |\n| `/fetch/resilient` | Auto-fallback: native scraper → headless Chromium | $0.008 |\n| `/contents` | Bulk page text for 1–20 URLs | $0.0015/URL |\n| `/screenshot` | Capture a webpage screenshot (PNG) | $0.008 |\n| `/batch/fetch` | Fetch 2–20 URLs in parallel | $0.0015/URL |\n| `/map` | Discover a site's URLs (sitemaps + links, no page fetches) | $0.004 |\n| `/domain` | Registration + DNS + SaaS stack + risk signals for a domain | $0.005 |\n| `/tech` | Detect a site's framework, CMS, CDN, analytics and payments stack | $0.005 |\n| `/package` | npm/PyPI package health: deprecation, downloads, maintenance | $0.003 |\n| `/discussions` | Hacker News stories on a topic, with aggregates | $0.004 |\n| `/intel/project` | Off-chain project due diligence: domain age, team/whitepaper, contract cross-check, A–F grade | $0.05 |\n| `/crawl` | Bounded whole-site crawl → markdown per page | $0.0015/page |\n\n### Search\n\n| Endpoint | Description | Price |\n|----------|-------------|-------|\n| `/search` | Real-time web search (`includeContent` adds page markdown, +$0.0015/result) | $0.015 |\n| `/search/news` | Google News articles with source and date | $0.015 |\n| `/search/images` | Image results with dimensions and source pages | $0.015 |\n| `/search/places` | Local businesses: address, rating, phone, coordinates | $0.045 |\n| `/search/shopping` | Products with prices, sellers, ratings | $0.015 |\n| `/search/scholar` | Academic papers with citation counts | $0.015 |\n| `/search/autocomplete` | Query suggestions (keyword/intent research) | $0.015 |\n| `/search/trends` | Interest-over-time timeline | $0.015 |\n\n### Social\n\n| Endpoint | Description | Price |\n|----------|-------------|-------|\n| `/social/youtube/transcript` | Full video transcript with timestamps | $0.03 |\n\n### Extraction & research\n\n| Endpoint | Description | Price |\n|----------|-------------|-------|\n| `/extract` | Structured extraction against a JSON schema | $0.03 |\n| `/extract/smart` | Natural-language extraction (no schema needed) | $0.035 |\n| `/pdf` | Extract text and metadata from a PDF | $0.004 |\n| `/answer` | Grounded answer with inline `[n]` citations | $0.05 |\n| `/research` | Search + fetch + AI summary with sources | $0.08 |\n| `/research/deep` | Multi-step cited research: sub-questions → search each → answer with inline `[n]` citations | $0.20–$0.35 |\n| `/compare` | Compare 2–3 webpages with AI analysis | $0.05 |\n\n`/research/deep` is the only long-running endpoint: it plans sub-questions, runs a web search per\nsub-question, fetches and dedupes the sources, then synthesizes a cited answer — all in one\nsynchronous call. A `standard` run (3 sub-questions, 8 sources, $0.20) takes roughly **30–60\nseconds**; `deep` (5 sub-questions, 12 sources, $0.35) takes longer. Set a generous HTTP timeout\n(120s+) and don't retry on a client timeout, or you'll pay twice.\n\n### Intelligence\n\n| Endpoint | Description | Price |\n|----------|-------------|-------|\n| `/intel/site-audit` | SEO / performance / security audit | $0.75 |\n| `/intel/company` | Company deep dive | $1.00 |\n| `/intel/market` | Market research report | $5.00 |\n| `/intel/competitive` | Competitive analysis with SWOT | $8.00 |\n\n### Utility\n\n| Endpoint | Description | Price |\n|----------|-------------|-------|\n| `/memory/set` | Persistent key-value storage for agents | $0.001 |\n| `/monitor/create` | URL change monitor with webhooks | $0.01 + $0.001/check |\n| `/credits/buy` | Prepay credits (bonus 20–40% at $10/$50/$100) | $2–$1000 |\n\nFree and unauthenticated: `/`, `/health`, `/docs`, `/openapi.json`, `/llms.txt`, `/discovery`, `/.well-known/x402`, `/mcp`, `/r/{url}`, `/s/{query}`, `/free/fetch`, `/free/search`, `/preview`, `/.well-known/agent-registration.json`, `/receipts/{requestId}`, `/feedback`, `/feedback/{id}`.\n\nDynamically-priced endpoints (`/fetch/pro`, `/extract`) apply a complexity multiplier — up to 3× for bot-protected domains. Cached responses on the fetch family are **70% cheaper**. The exact price is always in the `402` challenge.\n\n## Use with AI agents (MCP)\n\n**Remote HTTP — nothing to install:**\n```json\n{ \"mcpServers\": { \"weblens\": { \"url\": \"https://api.weblens.dev/mcp\" } } }\n```\n\n**Local with automatic payment:**\n```json\n{\n  \"mcpServers\": {\n    \"weblens\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@weblens/mcp\"],\n      \"env\": { \"PRIVATE_KEY\": \"0xYourPrivateKeyHere\" }\n    }\n  }\n}\n```\n\nSee [mcp-server/README.md](./mcp-server/README.md) for the full tool list and setup.\n\n## API usage\n\n```bash\n# Fetch a page as markdown\ncurl -X POST https://api.weblens.dev/fetch/basic \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"url\": \"https://example.com\"}'\n\n# Search, with page content included\ncurl -X POST https://api.weblens.dev/search \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"query\": \"latest AI news\", \"limit\": 5, \"includeContent\": true}'\n\n# Structured extraction\ncurl -X POST https://api.weblens.dev/extract \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"url\": \"https://example.com/product\",\n       \"schema\": {\"title\": {\"type\": \"string\"}, \"price\": {\"type\": \"number\"}},\n       \"instructions\": \"Extract the product title and price\"}'\n\n# Crawl a site (pay for the page budget you request)\ncurl -X POST https://api.weblens.dev/crawl \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"url\": \"https://example.com\", \"limit\": 10, \"maxDepth\": 2}'\n\n# Deep research with inline citations (slow — 30-60s, so raise the client timeout)\ncurl --max-time 120 -X POST https://api.weblens.dev/research/deep \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"query\": \"How are AI agents using micropayments in 2026?\", \"depth\": \"standard\"}'\n```\n\nEach returns `402 Payment Required` with the price until you attach payment — see below.\n\n## How payments work\n\nWebLens implements [x402](https://x402.org) v2:\n\n1. `POST` any paid endpoint with no payment.\n2. Get `402 Payment Required` with a `PAYMENT-REQUIRED` header carrying the price, network, asset, and pay-to address.\n3. Sign a USDC transfer authorization with your wallet.\n4. Retry the same request with a `Payment-Signature` header.\n5. The payment is verified on-chain and you get your data.\n\nSettlement runs through the [PayAI facilitator](https://facilitator.payai.network) on Base mainnet. Any x402 v2 client works — `@x402/axios`, `@x402/fetch`, or the bundled MCP server, which handles the whole flow for you.\n\n**Prepaid credits** are an alternative to per-request payment: buy credits with `/credits/buy`, then send `X-CREDIT-WALLET` / `X-CREDIT-SIGNATURE` / `X-CREDIT-TIMESTAMP` headers. Failed requests are refunded automatically.\n\n## Development\n\n```bash\npnpm install\npnpm run dev          # local dev server on :8787\npnpm run build        # tsc --noEmit (type check)\npnpm run lint         # eslint\npnpm run test         # vitest (unit + property + workerd integration)\npnpm run deploy       # wrangler deploy (production)\n```\n\nSecrets are set with wrangler, never committed:\n\n```bash\nwrangler secret put SERP_API_KEY        # search + all verticals + transcripts\nwrangler secret put ANTHROPIC_API_KEY   # AI extraction, research, answers, intel\nwrangler secret put CDP_API_KEY_ID      # optional: CDP facilitator fallback\nwrangler secret put CDP_API_KEY_SECRET\n```\n\n| Variable | Purpose |\n|----------|---------|\n| `PAY_TO_ADDRESS` | Wallet that receives payments (`wrangler.toml` var) |\n| `NETWORK` | `base` (production) or `base-sepolia` (testnet) |\n| `SERP_API_KEY` | SerpAPI key — search, verticals, YouTube transcripts |\n| `ANTHROPIC_API_KEY` | Claude — extraction, research, answers, intel |\n| `SIGNING_PRIVATE_KEY` | Optional: HMAC key for proof-of-context tags |\n| `PAYAI_FACILITATOR_URL` | Optional: override the facilitator endpoint |\n\n### Testing against testnet\n\n```bash\nwrangler dev --env testnet          # Base Sepolia, fake USDC\nAPI_URL=http://localhost:8787 PRIVATE_KEY=0x... npx tsx scripts/test-payment-testnet.ts\n```\n\nGet free testnet USDC from the [Circle faucet](https://faucet.circle.com/) on Base Sepolia.\n\n### Discovery\n\n```bash\npnpm run verify-bazaar    # check the x402 discovery extension on every route\n```\n\n`/openapi.json` doubles as the discovery document for [x402scan](https://www.x402scan.com/discovery/spec) — it carries `info.x-guidance`, per-operation `x-payment-info`, and `security: []` on free operations. WebLens is listed on x402scan and indexed in the PayAI facilitator catalog.\n\n> **Note on the Coinbase CDP Bazaar:** it only indexes services whose payments the CDP facilitator itself settles. WebLens uses PayAI as its primary facilitator (CDP has an open Base-mainnet settlement bug, [x402#1065](https://github.com/x402-foundation/x402/issues/1065)), so it does not appear there.\n\n## Tech stack\n\n- **Cloudflare Workers** — edge runtime, Durable Objects, KV, Browser Rendering\n- **Hono** — web framework\n- **x402** — HTTP-native micropayments\n- **Zod** — request validation\n- **Vitest** + fast-check — unit, property, and real-workerd integration tests\n\n## Links\n\n- [API documentation](https://api.weblens.dev/docs)\n- [LLM-optimized guide](https://api.weblens.dev/llms.txt)\n- [Service discovery](https://api.weblens.dev/discovery)\n- [x402 protocol](https://x402.org)\n\n## License\n\nMIT\n",
  "bytes": 13547,
  "sha": "c4dd9319a44bd2a32401f23b71dc294f14714cc9b3bb44970a63bcdd9d0375aa",
  "repo_slug": "vasilistotskas/weblens",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_dev_weblens_weblens_78c59873/readme"
}