ai.screenshot

Render a URL as a screenshot. POST { url, width?, height?, fullPage?, format?, quality?, waitUntil?, timeoutMs?, deviceScaleFactor?, blockAds? }. Returns raw image bytes (no JSON envelope) with X-2s-Render-Ms and X-2s-Image-Bytes headers. Viewport clamped 320-3840 × 320-2160. Timeout clamped 1-15s. Defaults: 1280×720 PNG, networkidle2 wait, ad-blocking on. Use cases: visual verification, archival, change detection, OG-card generation, RSS thumbnails.

price
$0.0075 USDC per call
method
POST/api/ai/screenshot
payment
x402 v2 · EIP-3009 transferWithAuthorization · USDC on Base mainnet
auth
None. Sign the payment, retry with PAYMENT-SIGNATURE.
tier
Tier 2 — LLM/render upstream included

Parameters

NameTypeDescription
urlrequiredstringHTTPS URL to render.
max 2048 chars · uri
widthintegerViewport width (320-3840). Default 1280.
min 320 · max 3840
heightintegerViewport height (320-2160). Default 720.
min 320 · max 2160
fullPagebooleanCapture the full scrollable page instead of the viewport.
formatstringImage format. Default png.
one of: png | jpeg | webp
qualityintegerJPEG/WebP quality 1-100. Ignored for PNG.
min 1 · max 100
waitUntilstringWait condition before snap. Default networkidle2.
one of: load | domcontentloaded | networkidle0 | networkidle2
timeoutMsintegerRender timeout in milliseconds (1000-15000). Default 8000.
min 1000 · max 15000
deviceScaleFactorintegerPixel density multiplier 1-3. Default 1.
min 1 · max 3
blockAdsbooleanBlock ads + trackers. Default true.

Code samples

cURLbash
# 1. Probe the endpoint with no auth — receive 402 with PaymentRequirements
curl -sS -X POST 'https://2s.io/api/ai/screenshot' \
  -H 'Content-Type: application/json' \
  -d '{"url":"https://example.com","width":320,"height":320,"fullPage":false,"format":"png","quality":1,"waitUntil":"load","timeoutMs":1000,"deviceScaleFactor":1,"blockAds":false}'

# 2. Sign the EIP-3009 transferWithAuthorization for the advertised price +
#    payTo from the 402 envelope, then retry with PAYMENT-SIGNATURE:
curl -sS -X POST 'https://2s.io/api/ai/screenshot' \
  -H 'Content-Type: application/json' \
  -H 'PAYMENT-SIGNATURE: <base64-json-payload>' \
  -d '{"url":"https://example.com","width":320,"height":320,"fullPage":false,"format":"png","quality":1,"waitUntil":"load","timeoutMs":1000,"deviceScaleFactor":1,"blockAds":false}'

# Or just use the canonical runner — it handles the whole loop:
#   EVM_PRIVATE_KEY=0x... node --env-file=.env.local \
#     --experimental-strip-types scripts/x402-pay.ts \
#     'https://2s.io/api/ai/screenshot'
TypeScript / Node — @2sio/sdktypescript
import { TwoS } from '@2sio/sdk'

const client = new TwoS({
  privateKey: process.env.EVM_PRIVATE_KEY as `0x${string}`,
})

const result = await client.ai.screenshot({
  "url": "https://example.com",
  "width": 320,
  "height": 320,
  "fullPage": false,
  "format": "png",
  "quality": 1,
  "waitUntil": "load",
  "timeoutMs": 1000,
  "deviceScaleFactor": 1,
  "blockAds": false
})
// result.data is a Uint8Array (image/*).

console.log('endpoint:', result.endpoint)
console.log('cost:', result.costUsd, 'USDC')
console.log('tx:', result.settlement?.txHash)
console.log('data:', result.data)
Python — 2siopython
import os
from twosio import TwoS

client = TwoS(private_key=os.environ["EVM_PRIVATE_KEY"])

result = client.ai.screenshot(url="https://example.com", width=320, height=320, fullPage=False, format="png", quality=1, waitUntil="load", timeoutMs=1000, deviceScaleFactor=1, blockAds=False)
# result.data is bytes (image/*)

print("endpoint:", result.endpoint)
print("cost:", result.cost_usd, "USDC")
print("tx:", (result.settlement or {}).get("tx_hash"))
print("data:", result.data)
MCP — Claude Desktop / AgentKit / any MCP hostjson
// 1. Add @2sio/mcp to your MCP host config (Claude Desktop example below).
//    EVM_PRIVATE_KEY funds x402 payments per call.

// claude_desktop_config.json
{
  "mcpServers": {
    "2sio": {
      "command": "npx",
      "args": ["-y", "@2sio/mcp"],
      "env": { "EVM_PRIVATE_KEY": "0x..." }
    }
  }
}

// 2. Once the server is running, agents call this tool via standard MCP:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "ai.screenshot",
    "arguments": {
      "url": "https://example.com",
      "width": 320,
      "height": 320,
      "fullPage": false,
      "format": "png",
      "quality": 1,
      "waitUntil": "load",
      "timeoutMs": 1000,
      "deviceScaleFactor": 1,
      "blockAds": false
    }
  }
}

Response

Binary endpoint — body is image/* bytes. SDKs surface this as result.data (Uint8Array in TypeScript, bytes in Python).

Discovery

2s.io is x402-native. Every call is paid per-request from a USDC-funded EVM wallet on Base — no signup, no API keys, no monthly fees. Source code: github.com/2s-io/sdk.