# Cloudflare

OpenAPI spec: [https://api.payweave.app/app/app_m5w8xj6cxe8xknj8s01qvchg/openapi.json](https://api.payweave.app/app/app_m5w8xj6cxe8xknj8s01qvchg/openapi.json)

## Networks

| Name | Mode | CAIP-2 | Chain ID / Cluster | Protocols |
|---|---|---|---|---|
| Tempo Mainnet | live | `eip155:4217` | 4217 | mpp |
| Solana Mainnet | live | `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` | mainnet-beta | mpp, x402 |
| Base | live | `eip155:8453` | 8453 | x402 |

## Accepted Currencies

| Symbol | Name | Decimals | Network | Address | Protocols |
|---|---|---|---|---|---|
| USDC.e | Bridged USDC (Stargate) | 6 | `eip155:4217` | `0x20c000000000000000000000b9537d11c60e8b50` | mpp |
| USDC | USD Coin (Solana) | 6 | `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` | `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` | mpp, x402 |
| USDC | USD Coin | 6 | `eip155:8453` | `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` | x402 |

## Endpoints (14)

### Browser Render: HTML Content

Fetch rendered HTML content from a URL via Cloudflare Browser Run

- Method: POST
- Path: `/content`
- Price: $0.01000000

**Input Schema**

```json
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "format": "uri"
    },
    "html": {
      "type": "string"
    },
    "actionTimeout": {
      "type": "integer",
      "minimum": 0
    },
    "addScriptTag": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      }
    },
    "addStyleTag": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      }
    },
    "allowRequestPattern": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "allowResourceTypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "document",
          "stylesheet",
          "image",
          "media",
          "font",
          "script",
          "texttrack",
          "xhr",
          "fetch",
          "prefetch",
          "eventsource",
          "websocket",
          "manifest",
          "signedexchange",
          "ping",
          "cspviolationreport",
          "preflight",
          "other"
        ]
      }
    },
    "authenticate": {
      "type": "object",
      "properties": {
        "username": {
          "type": "string"
        },
        "password": {
          "type": "string"
        }
      },
      "required": [
        "username",
        "password"
      ],
      "additionalProperties": false
    },
    "bestAttempt": {
      "type": "boolean"
    },
    "cookies": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "expires": {
            "type": "number"
          },
          "httpOnly": {
            "type": "boolean"
          },
          "partitionKey": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "priority": {
            "type": "string",
            "enum": [
              "Low",
              "Medium",
              "High"
            ]
          },
          "sameParty": {
            "type": "boolean"
          },
          "sameSite": {
            "type": "string",
            "enum": [
              "Strict",
              "Lax",
              "None"
            ]
          },
          "secure": {
            "type": "boolean"
          },
          "sourcePort": {
            "type": "integer"
          },
          "sourceScheme": {
            "type": "string",
            "enum": [
              "Unset",
              "NonSecure",
              "Secure"
            ]
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "value"
        ],
        "additionalProperties": false
      }
    },
    "emulateMediaType": {
      "type": "string"
    },
    "gotoOptions": {
      "type": "object",
      "properties": {
        "referer": {
          "type": "string"
        },
        "referrerPolicy": {
          "type": "string"
        },
        "timeout": {
          "type": "integer",
          "minimum": 0
        },
        "waitUntil": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "load",
                "domcontentloaded",
                "networkidle0",
                "networkidle2"
              ]
            },
            {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "load",
                  "domcontentloaded",
                  "networkidle0",
                  "networkidle2"
                ]
              }
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "rejectRequestPattern": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "rejectResourceTypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "document",
          "stylesheet",
          "image",
          "media",
          "font",
          "script",
          "texttrack",
          "xhr",
          "fetch",
          "prefetch",
          "eventsource",
          "websocket",
          "manifest",
          "signedexchange",
          "ping",
          "cspviolationreport",
          "preflight",
          "other"
        ]
      }
    },
    "setExtraHTTPHeaders": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "setJavaScriptEnabled": {
      "type": "boolean"
    },
    "userAgent": {
      "type": "string"
    },
    "viewport": {
      "type": "object",
      "properties": {
        "width": {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "height": {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "deviceScaleFactor": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "hasTouch": {
          "type": "boolean"
        },
        "isLandscape": {
          "type": "boolean"
        },
        "isMobile": {
          "type": "boolean"
        }
      },
      "required": [
        "width",
        "height"
      ],
      "additionalProperties": false
    },
    "waitForSelector": {
      "type": "object",
      "properties": {
        "selector": {
          "type": "string",
          "minLength": 1
        },
        "hidden": {
          "type": "boolean",
          "const": true
        },
        "visible": {
          "type": "boolean",
          "const": true
        },
        "timeout": {
          "type": "integer",
          "minimum": 0
        }
      },
      "required": [
        "selector"
      ],
      "additionalProperties": false
    },
    "waitForTimeout": {
      "type": "integer",
      "minimum": 0
    },
    "cacheTTL": {
      "type": "integer",
      "minimum": 0
    }
  },
  "required": [
    "url"
  ],
  "additionalProperties": false
}
```

**Output Schema**

```json
{
  "type": "string",
  "description": "Rendered HTML as a plain string"
}
```

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://cloudflare.payweave.services/content', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "html": "",
    "actionTimeout": 0
  }),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://cloudflare.payweave.services/content', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "html": "",
    "actionTimeout": 0
  }),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://cloudflare.payweave.services/content" -X POST -H 'Content-Type: application/json' -d '{"url":"https://example.com","html":"","actionTimeout":0}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://cloudflare.payweave.services/content" -X POST --json '{"url":"https://example.com","html":"","actionTimeout":0}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://cloudflare.payweave.services/content" -X POST -H 'Content-Type: application/json' -d '{"url":"https://example.com","html":"","actionTimeout":0}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://cloudflare.payweave.services/content" -m POST -b '{"url":"https://example.com","html":"","actionTimeout":0}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://cloudflare.payweave.services/content', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "html": "",
    "actionTimeout": 0
  }),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://cloudflare.payweave.services/content" -m POST -b '{"url":"https://example.com","html":"","actionTimeout":0}' -p x402
```

### Cloudflare Images: Info

Return metadata (format, width, height, file size) for an image at a URL without transforming it. Useful to inspect an image before deciding on operations.

- Method: POST
- Path: `/images/info`
- Price: $0.00100000

**Input Schema**

```json
{
  "type": "object",
  "properties": {
    "source_url": {
      "type": "string",
      "format": "uri",
      "description": "Public URL of the image to inspect (max 15 MB)."
    }
  },
  "required": [
    "source_url"
  ],
  "additionalProperties": false
}
```

**Output Schema**

```json
{
  "type": "object",
  "properties": {
    "format": {
      "type": "string",
      "description": "Detected image MIME type"
    },
    "width": {
      "type": "integer",
      "description": "Width in pixels (absent for SVG)"
    },
    "height": {
      "type": "integer",
      "description": "Height in pixels (absent for SVG)"
    },
    "file_size": {
      "type": "integer",
      "description": "Source file size in bytes (absent for SVG)"
    }
  },
  "required": [
    "format"
  ],
  "additionalProperties": false,
  "description": "Image metadata"
}
```

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://cloudflare.payweave.services/images/info', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "source_url": "https://example.com"
  }),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://cloudflare.payweave.services/images/info', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "source_url": "https://example.com"
  }),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://cloudflare.payweave.services/images/info" -X POST -H 'Content-Type: application/json' -d '{"source_url":"https://example.com"}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://cloudflare.payweave.services/images/info" -X POST --json '{"source_url":"https://example.com"}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://cloudflare.payweave.services/images/info" -X POST -H 'Content-Type: application/json' -d '{"source_url":"https://example.com"}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://cloudflare.payweave.services/images/info" -m POST -b '{"source_url":"https://example.com"}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://cloudflare.payweave.services/images/info', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "source_url": "https://example.com"
  }),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://cloudflare.payweave.services/images/info" -m POST -b '{"source_url":"https://example.com"}' -p x402
```

### Cloudflare Images: Transform

Resize, crop, rotate, flip, blur, sharpen, recolor, compress, or format-convert an image from a URL using the Cloudflare Images binding. Returns the transformed image bytes (default WebP). Provide source_url plus any operations; with none it just re-encodes to the output format.

- Method: POST
- Path: `/images/transform`
- Price: $0.00300000

**Input Schema**

```json
{
  "type": "object",
  "properties": {
    "source_url": {
      "type": "string",
      "format": "uri",
      "description": "Public URL of the source image to transform (max 15 MB)."
    },
    "width": {
      "type": "integer",
      "minimum": 1,
      "maximum": 4096,
      "description": "Target width in pixels."
    },
    "height": {
      "type": "integer",
      "minimum": 1,
      "maximum": 4096,
      "description": "Target height in pixels."
    },
    "fit": {
      "type": "string",
      "enum": [
        "scale-down",
        "contain",
        "pad",
        "squeeze",
        "cover",
        "crop"
      ],
      "description": "How the image fits within width/height when both are set."
    },
    "gravity": {
      "type": "string",
      "enum": [
        "face",
        "left",
        "right",
        "top",
        "bottom",
        "center",
        "auto",
        "entropy"
      ],
      "description": "Focal point used when cropping."
    },
    "rotate": {
      "type": "number",
      "enum": [
        0,
        90,
        180,
        270
      ],
      "description": "Rotation in degrees."
    },
    "flip": {
      "type": "string",
      "enum": [
        "h",
        "v",
        "hv"
      ],
      "description": "Flip horizontally, vertically, or both."
    },
    "blur": {
      "type": "number",
      "minimum": 0,
      "maximum": 250,
      "description": "Gaussian blur radius (0-250)."
    },
    "sharpen": {
      "type": "number",
      "minimum": 0,
      "maximum": 10,
      "description": "Sharpen strength (0-10)."
    },
    "brightness": {
      "type": "number",
      "minimum": 0,
      "description": "Brightness multiplier (1 = unchanged)."
    },
    "contrast": {
      "type": "number",
      "minimum": 0,
      "description": "Contrast multiplier (1 = unchanged)."
    },
    "background": {
      "type": "string",
      "description": "Background color (e.g. \"#ffffff\") for pad/transparent areas."
    },
    "format": {
      "type": "string",
      "enum": [
        "webp",
        "avif",
        "jpeg",
        "png",
        "gif"
      ],
      "description": "Output format: webp (default), avif, jpeg, png, or gif."
    },
    "quality": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100,
      "description": "Output quality for lossy formats (1-100)."
    }
  },
  "required": [
    "source_url"
  ],
  "additionalProperties": false
}
```

**Output Schema**

```json
{
  "type": "string",
  "format": "binary"
}
```

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://cloudflare.payweave.services/images/transform', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "source_url": "https://example.com",
    "width": 1,
    "height": 1
  }),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://cloudflare.payweave.services/images/transform', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "source_url": "https://example.com",
    "width": 1,
    "height": 1
  }),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://cloudflare.payweave.services/images/transform" -X POST -H 'Content-Type: application/json' -d '{"source_url":"https://example.com","width":1,"height":1}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://cloudflare.payweave.services/images/transform" -X POST --json '{"source_url":"https://example.com","width":1,"height":1}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://cloudflare.payweave.services/images/transform" -X POST -H 'Content-Type: application/json' -d '{"source_url":"https://example.com","width":1,"height":1}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://cloudflare.payweave.services/images/transform" -m POST -b '{"source_url":"https://example.com","width":1,"height":1}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://cloudflare.payweave.services/images/transform', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "source_url": "https://example.com",
    "width": 1,
    "height": 1
  }),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://cloudflare.payweave.services/images/transform" -m POST -b '{"source_url":"https://example.com","width":1,"height":1}' -p x402
```

### Browser Render: AI Structured Extraction

AI-powered structured data extraction from a URL via Cloudflare Browser Run (default model: @cf/meta/llama-3.3-70b-instruct-fp8-fast)

- Method: POST
- Path: `/json`
- Price: $0.02000000

**Input Schema**

```json
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "format": "uri"
    },
    "html": {
      "type": "string"
    },
    "actionTimeout": {
      "type": "integer",
      "minimum": 0
    },
    "addScriptTag": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      }
    },
    "addStyleTag": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      }
    },
    "allowRequestPattern": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "allowResourceTypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "document",
          "stylesheet",
          "image",
          "media",
          "font",
          "script",
          "texttrack",
          "xhr",
          "fetch",
          "prefetch",
          "eventsource",
          "websocket",
          "manifest",
          "signedexchange",
          "ping",
          "cspviolationreport",
          "preflight",
          "other"
        ]
      }
    },
    "authenticate": {
      "type": "object",
      "properties": {
        "username": {
          "type": "string"
        },
        "password": {
          "type": "string"
        }
      },
      "required": [
        "username",
        "password"
      ],
      "additionalProperties": false
    },
    "bestAttempt": {
      "type": "boolean"
    },
    "cookies": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "expires": {
            "type": "number"
          },
          "httpOnly": {
            "type": "boolean"
          },
          "partitionKey": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "priority": {
            "type": "string",
            "enum": [
              "Low",
              "Medium",
              "High"
            ]
          },
          "sameParty": {
            "type": "boolean"
          },
          "sameSite": {
            "type": "string",
            "enum": [
              "Strict",
              "Lax",
              "None"
            ]
          },
          "secure": {
            "type": "boolean"
          },
          "sourcePort": {
            "type": "integer"
          },
          "sourceScheme": {
            "type": "string",
            "enum": [
              "Unset",
              "NonSecure",
              "Secure"
            ]
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "value"
        ],
        "additionalProperties": false
      }
    },
    "emulateMediaType": {
      "type": "string"
    },
    "gotoOptions": {
      "type": "object",
      "properties": {
        "referer": {
          "type": "string"
        },
        "referrerPolicy": {
          "type": "string"
        },
        "timeout": {
          "type": "integer",
          "minimum": 0
        },
        "waitUntil": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "load",
                "domcontentloaded",
                "networkidle0",
                "networkidle2"
              ]
            },
            {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "load",
                  "domcontentloaded",
                  "networkidle0",
                  "networkidle2"
                ]
              }
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "rejectRequestPattern": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "rejectResourceTypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "document",
          "stylesheet",
          "image",
          "media",
          "font",
          "script",
          "texttrack",
          "xhr",
          "fetch",
          "prefetch",
          "eventsource",
          "websocket",
          "manifest",
          "signedexchange",
          "ping",
          "cspviolationreport",
          "preflight",
          "other"
        ]
      }
    },
    "setExtraHTTPHeaders": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "setJavaScriptEnabled": {
      "type": "boolean"
    },
    "userAgent": {
      "type": "string"
    },
    "viewport": {
      "type": "object",
      "properties": {
        "width": {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "height": {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "deviceScaleFactor": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "hasTouch": {
          "type": "boolean"
        },
        "isLandscape": {
          "type": "boolean"
        },
        "isMobile": {
          "type": "boolean"
        }
      },
      "required": [
        "width",
        "height"
      ],
      "additionalProperties": false
    },
    "waitForSelector": {
      "type": "object",
      "properties": {
        "selector": {
          "type": "string",
          "minLength": 1
        },
        "hidden": {
          "type": "boolean",
          "const": true
        },
        "visible": {
          "type": "boolean",
          "const": true
        },
        "timeout": {
          "type": "integer",
          "minimum": 0
        }
      },
      "required": [
        "selector"
      ],
      "additionalProperties": false
    },
    "waitForTimeout": {
      "type": "integer",
      "minimum": 0
    },
    "cacheTTL": {
      "type": "integer",
      "minimum": 0
    },
    "prompt": {
      "type": "string",
      "minLength": 1
    },
    "response_format": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "const": "json_schema"
        },
        "schema": {
          "type": "object",
          "additionalProperties": {}
        }
      },
      "required": [
        "type",
        "schema"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "url",
    "prompt"
  ],
  "additionalProperties": false
}
```

**Output Schema**

```json
{
  "type": "object",
  "properties": {},
  "additionalProperties": true,
  "description": "AI-extracted JSON. Exact shape is determined by the `response_format` schema you provide in the request (or the LLM if only `prompt` is given)."
}
```

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://cloudflare.payweave.services/json', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "prompt": "",
    "html": ""
  }),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://cloudflare.payweave.services/json', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "prompt": "",
    "html": ""
  }),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://cloudflare.payweave.services/json" -X POST -H 'Content-Type: application/json' -d '{"url":"https://example.com","prompt":"","html":""}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://cloudflare.payweave.services/json" -X POST --json '{"url":"https://example.com","prompt":"","html":""}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://cloudflare.payweave.services/json" -X POST -H 'Content-Type: application/json' -d '{"url":"https://example.com","prompt":"","html":""}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://cloudflare.payweave.services/json" -m POST -b '{"url":"https://example.com","prompt":"","html":""}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://cloudflare.payweave.services/json', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "prompt": "",
    "html": ""
  }),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://cloudflare.payweave.services/json" -m POST -b '{"url":"https://example.com","prompt":"","html":""}' -p x402
```

### Browser Render: Extract Links

Extract all links from a URL via Cloudflare Browser Run

- Method: POST
- Path: `/links`
- Price: $0.01000000

**Input Schema**

```json
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "format": "uri"
    },
    "html": {
      "type": "string"
    },
    "actionTimeout": {
      "type": "integer",
      "minimum": 0
    },
    "addScriptTag": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      }
    },
    "addStyleTag": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      }
    },
    "allowRequestPattern": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "allowResourceTypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "document",
          "stylesheet",
          "image",
          "media",
          "font",
          "script",
          "texttrack",
          "xhr",
          "fetch",
          "prefetch",
          "eventsource",
          "websocket",
          "manifest",
          "signedexchange",
          "ping",
          "cspviolationreport",
          "preflight",
          "other"
        ]
      }
    },
    "authenticate": {
      "type": "object",
      "properties": {
        "username": {
          "type": "string"
        },
        "password": {
          "type": "string"
        }
      },
      "required": [
        "username",
        "password"
      ],
      "additionalProperties": false
    },
    "bestAttempt": {
      "type": "boolean"
    },
    "cookies": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "expires": {
            "type": "number"
          },
          "httpOnly": {
            "type": "boolean"
          },
          "partitionKey": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "priority": {
            "type": "string",
            "enum": [
              "Low",
              "Medium",
              "High"
            ]
          },
          "sameParty": {
            "type": "boolean"
          },
          "sameSite": {
            "type": "string",
            "enum": [
              "Strict",
              "Lax",
              "None"
            ]
          },
          "secure": {
            "type": "boolean"
          },
          "sourcePort": {
            "type": "integer"
          },
          "sourceScheme": {
            "type": "string",
            "enum": [
              "Unset",
              "NonSecure",
              "Secure"
            ]
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "value"
        ],
        "additionalProperties": false
      }
    },
    "emulateMediaType": {
      "type": "string"
    },
    "gotoOptions": {
      "type": "object",
      "properties": {
        "referer": {
          "type": "string"
        },
        "referrerPolicy": {
          "type": "string"
        },
        "timeout": {
          "type": "integer",
          "minimum": 0
        },
        "waitUntil": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "load",
                "domcontentloaded",
                "networkidle0",
                "networkidle2"
              ]
            },
            {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "load",
                  "domcontentloaded",
                  "networkidle0",
                  "networkidle2"
                ]
              }
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "rejectRequestPattern": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "rejectResourceTypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "document",
          "stylesheet",
          "image",
          "media",
          "font",
          "script",
          "texttrack",
          "xhr",
          "fetch",
          "prefetch",
          "eventsource",
          "websocket",
          "manifest",
          "signedexchange",
          "ping",
          "cspviolationreport",
          "preflight",
          "other"
        ]
      }
    },
    "setExtraHTTPHeaders": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "setJavaScriptEnabled": {
      "type": "boolean"
    },
    "userAgent": {
      "type": "string"
    },
    "viewport": {
      "type": "object",
      "properties": {
        "width": {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "height": {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "deviceScaleFactor": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "hasTouch": {
          "type": "boolean"
        },
        "isLandscape": {
          "type": "boolean"
        },
        "isMobile": {
          "type": "boolean"
        }
      },
      "required": [
        "width",
        "height"
      ],
      "additionalProperties": false
    },
    "waitForSelector": {
      "type": "object",
      "properties": {
        "selector": {
          "type": "string",
          "minLength": 1
        },
        "hidden": {
          "type": "boolean",
          "const": true
        },
        "visible": {
          "type": "boolean",
          "const": true
        },
        "timeout": {
          "type": "integer",
          "minimum": 0
        }
      },
      "required": [
        "selector"
      ],
      "additionalProperties": false
    },
    "waitForTimeout": {
      "type": "integer",
      "minimum": 0
    },
    "cacheTTL": {
      "type": "integer",
      "minimum": 0
    },
    "visibleLinksOnly": {
      "type": "boolean"
    }
  },
  "required": [
    "url"
  ],
  "additionalProperties": false
}
```

**Output Schema**

```json
{
  "type": "array",
  "items": {
    "type": "string",
    "format": "uri"
  },
  "description": "All links found on the page"
}
```

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://cloudflare.payweave.services/links', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "html": "",
    "actionTimeout": 0
  }),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://cloudflare.payweave.services/links', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "html": "",
    "actionTimeout": 0
  }),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://cloudflare.payweave.services/links" -X POST -H 'Content-Type: application/json' -d '{"url":"https://example.com","html":"","actionTimeout":0}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://cloudflare.payweave.services/links" -X POST --json '{"url":"https://example.com","html":"","actionTimeout":0}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://cloudflare.payweave.services/links" -X POST -H 'Content-Type: application/json' -d '{"url":"https://example.com","html":"","actionTimeout":0}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://cloudflare.payweave.services/links" -m POST -b '{"url":"https://example.com","html":"","actionTimeout":0}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://cloudflare.payweave.services/links', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "html": "",
    "actionTimeout": 0
  }),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://cloudflare.payweave.services/links" -m POST -b '{"url":"https://example.com","html":"","actionTimeout":0}' -p x402
```

### Browser Render: Page to Markdown

Render a URL as clean LLM-friendly markdown via Cloudflare Browser Run

- Method: POST
- Path: `/markdown`
- Price: $0.01000000

**Input Schema**

```json
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "format": "uri"
    },
    "html": {
      "type": "string"
    },
    "actionTimeout": {
      "type": "integer",
      "minimum": 0
    },
    "addScriptTag": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      }
    },
    "addStyleTag": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      }
    },
    "allowRequestPattern": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "allowResourceTypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "document",
          "stylesheet",
          "image",
          "media",
          "font",
          "script",
          "texttrack",
          "xhr",
          "fetch",
          "prefetch",
          "eventsource",
          "websocket",
          "manifest",
          "signedexchange",
          "ping",
          "cspviolationreport",
          "preflight",
          "other"
        ]
      }
    },
    "authenticate": {
      "type": "object",
      "properties": {
        "username": {
          "type": "string"
        },
        "password": {
          "type": "string"
        }
      },
      "required": [
        "username",
        "password"
      ],
      "additionalProperties": false
    },
    "bestAttempt": {
      "type": "boolean"
    },
    "cookies": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "expires": {
            "type": "number"
          },
          "httpOnly": {
            "type": "boolean"
          },
          "partitionKey": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "priority": {
            "type": "string",
            "enum": [
              "Low",
              "Medium",
              "High"
            ]
          },
          "sameParty": {
            "type": "boolean"
          },
          "sameSite": {
            "type": "string",
            "enum": [
              "Strict",
              "Lax",
              "None"
            ]
          },
          "secure": {
            "type": "boolean"
          },
          "sourcePort": {
            "type": "integer"
          },
          "sourceScheme": {
            "type": "string",
            "enum": [
              "Unset",
              "NonSecure",
              "Secure"
            ]
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "value"
        ],
        "additionalProperties": false
      }
    },
    "emulateMediaType": {
      "type": "string"
    },
    "gotoOptions": {
      "type": "object",
      "properties": {
        "referer": {
          "type": "string"
        },
        "referrerPolicy": {
          "type": "string"
        },
        "timeout": {
          "type": "integer",
          "minimum": 0
        },
        "waitUntil": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "load",
                "domcontentloaded",
                "networkidle0",
                "networkidle2"
              ]
            },
            {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "load",
                  "domcontentloaded",
                  "networkidle0",
                  "networkidle2"
                ]
              }
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "rejectRequestPattern": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "rejectResourceTypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "document",
          "stylesheet",
          "image",
          "media",
          "font",
          "script",
          "texttrack",
          "xhr",
          "fetch",
          "prefetch",
          "eventsource",
          "websocket",
          "manifest",
          "signedexchange",
          "ping",
          "cspviolationreport",
          "preflight",
          "other"
        ]
      }
    },
    "setExtraHTTPHeaders": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "setJavaScriptEnabled": {
      "type": "boolean"
    },
    "userAgent": {
      "type": "string"
    },
    "viewport": {
      "type": "object",
      "properties": {
        "width": {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "height": {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "deviceScaleFactor": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "hasTouch": {
          "type": "boolean"
        },
        "isLandscape": {
          "type": "boolean"
        },
        "isMobile": {
          "type": "boolean"
        }
      },
      "required": [
        "width",
        "height"
      ],
      "additionalProperties": false
    },
    "waitForSelector": {
      "type": "object",
      "properties": {
        "selector": {
          "type": "string",
          "minLength": 1
        },
        "hidden": {
          "type": "boolean",
          "const": true
        },
        "visible": {
          "type": "boolean",
          "const": true
        },
        "timeout": {
          "type": "integer",
          "minimum": 0
        }
      },
      "required": [
        "selector"
      ],
      "additionalProperties": false
    },
    "waitForTimeout": {
      "type": "integer",
      "minimum": 0
    },
    "cacheTTL": {
      "type": "integer",
      "minimum": 0
    },
    "rejectResourceTypesForMarkdown": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "document",
          "stylesheet",
          "image",
          "media",
          "font",
          "script",
          "texttrack",
          "xhr",
          "fetch",
          "prefetch",
          "eventsource",
          "websocket",
          "manifest",
          "signedexchange",
          "ping",
          "cspviolationreport",
          "preflight",
          "other"
        ]
      }
    }
  },
  "required": [
    "url"
  ],
  "additionalProperties": false
}
```

**Output Schema**

```json
{
  "type": "string",
  "description": "Rendered page converted to LLM-friendly markdown"
}
```

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://cloudflare.payweave.services/markdown', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "html": "",
    "actionTimeout": 0
  }),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://cloudflare.payweave.services/markdown', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "html": "",
    "actionTimeout": 0
  }),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://cloudflare.payweave.services/markdown" -X POST -H 'Content-Type: application/json' -d '{"url":"https://example.com","html":"","actionTimeout":0}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://cloudflare.payweave.services/markdown" -X POST --json '{"url":"https://example.com","html":"","actionTimeout":0}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://cloudflare.payweave.services/markdown" -X POST -H 'Content-Type: application/json' -d '{"url":"https://example.com","html":"","actionTimeout":0}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://cloudflare.payweave.services/markdown" -m POST -b '{"url":"https://example.com","html":"","actionTimeout":0}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://cloudflare.payweave.services/markdown', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "html": "",
    "actionTimeout": 0
  }),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://cloudflare.payweave.services/markdown" -m POST -b '{"url":"https://example.com","html":"","actionTimeout":0}' -p x402
```

### Browser Render: Page to PDF

Render a URL to PDF via Cloudflare Browser Run

- Method: POST
- Path: `/pdf`
- Price: $0.01000000

**Input Schema**

```json
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "format": "uri"
    },
    "html": {
      "type": "string"
    },
    "actionTimeout": {
      "type": "integer",
      "minimum": 0
    },
    "addScriptTag": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      }
    },
    "addStyleTag": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      }
    },
    "allowRequestPattern": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "allowResourceTypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "document",
          "stylesheet",
          "image",
          "media",
          "font",
          "script",
          "texttrack",
          "xhr",
          "fetch",
          "prefetch",
          "eventsource",
          "websocket",
          "manifest",
          "signedexchange",
          "ping",
          "cspviolationreport",
          "preflight",
          "other"
        ]
      }
    },
    "authenticate": {
      "type": "object",
      "properties": {
        "username": {
          "type": "string"
        },
        "password": {
          "type": "string"
        }
      },
      "required": [
        "username",
        "password"
      ],
      "additionalProperties": false
    },
    "bestAttempt": {
      "type": "boolean"
    },
    "cookies": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "expires": {
            "type": "number"
          },
          "httpOnly": {
            "type": "boolean"
          },
          "partitionKey": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "priority": {
            "type": "string",
            "enum": [
              "Low",
              "Medium",
              "High"
            ]
          },
          "sameParty": {
            "type": "boolean"
          },
          "sameSite": {
            "type": "string",
            "enum": [
              "Strict",
              "Lax",
              "None"
            ]
          },
          "secure": {
            "type": "boolean"
          },
          "sourcePort": {
            "type": "integer"
          },
          "sourceScheme": {
            "type": "string",
            "enum": [
              "Unset",
              "NonSecure",
              "Secure"
            ]
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "value"
        ],
        "additionalProperties": false
      }
    },
    "emulateMediaType": {
      "type": "string"
    },
    "gotoOptions": {
      "type": "object",
      "properties": {
        "referer": {
          "type": "string"
        },
        "referrerPolicy": {
          "type": "string"
        },
        "timeout": {
          "type": "integer",
          "minimum": 0
        },
        "waitUntil": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "load",
                "domcontentloaded",
                "networkidle0",
                "networkidle2"
              ]
            },
            {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "load",
                  "domcontentloaded",
                  "networkidle0",
                  "networkidle2"
                ]
              }
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "rejectRequestPattern": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "rejectResourceTypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "document",
          "stylesheet",
          "image",
          "media",
          "font",
          "script",
          "texttrack",
          "xhr",
          "fetch",
          "prefetch",
          "eventsource",
          "websocket",
          "manifest",
          "signedexchange",
          "ping",
          "cspviolationreport",
          "preflight",
          "other"
        ]
      }
    },
    "setExtraHTTPHeaders": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "setJavaScriptEnabled": {
      "type": "boolean"
    },
    "userAgent": {
      "type": "string"
    },
    "viewport": {
      "type": "object",
      "properties": {
        "width": {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "height": {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "deviceScaleFactor": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "hasTouch": {
          "type": "boolean"
        },
        "isLandscape": {
          "type": "boolean"
        },
        "isMobile": {
          "type": "boolean"
        }
      },
      "required": [
        "width",
        "height"
      ],
      "additionalProperties": false
    },
    "waitForSelector": {
      "type": "object",
      "properties": {
        "selector": {
          "type": "string",
          "minLength": 1
        },
        "hidden": {
          "type": "boolean",
          "const": true
        },
        "visible": {
          "type": "boolean",
          "const": true
        },
        "timeout": {
          "type": "integer",
          "minimum": 0
        }
      },
      "required": [
        "selector"
      ],
      "additionalProperties": false
    },
    "waitForTimeout": {
      "type": "integer",
      "minimum": 0
    },
    "cacheTTL": {
      "type": "integer",
      "minimum": 0
    },
    "pdfOptions": {
      "type": "object",
      "properties": {
        "format": {
          "type": "string",
          "enum": [
            "letter",
            "legal",
            "tabloid",
            "ledger",
            "a0",
            "a1",
            "a2",
            "a3",
            "a4",
            "a5",
            "a6"
          ]
        },
        "landscape": {
          "type": "boolean"
        },
        "printBackground": {
          "type": "boolean"
        },
        "scale": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "displayHeaderFooter": {
          "type": "boolean"
        },
        "headerTemplate": {
          "type": "string"
        },
        "footerTemplate": {
          "type": "string"
        },
        "margin": {
          "type": "object",
          "properties": {
            "top": {
              "type": [
                "string",
                "number"
              ]
            },
            "right": {
              "type": [
                "string",
                "number"
              ]
            },
            "bottom": {
              "type": [
                "string",
                "number"
              ]
            },
            "left": {
              "type": [
                "string",
                "number"
              ]
            }
          },
          "additionalProperties": false
        },
        "pageRanges": {
          "type": "string"
        },
        "preferCSSPageSize": {
          "type": "boolean"
        },
        "width": {
          "type": [
            "string",
            "number"
          ]
        },
        "height": {
          "type": [
            "string",
            "number"
          ]
        }
      },
      "additionalProperties": false
    }
  },
  "required": [
    "url"
  ],
  "additionalProperties": false
}
```

**Output Schema**

```json
{
  "type": "string",
  "format": "binary"
}
```

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://cloudflare.payweave.services/pdf', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "html": "",
    "actionTimeout": 0
  }),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://cloudflare.payweave.services/pdf', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "html": "",
    "actionTimeout": 0
  }),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://cloudflare.payweave.services/pdf" -X POST -H 'Content-Type: application/json' -d '{"url":"https://example.com","html":"","actionTimeout":0}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://cloudflare.payweave.services/pdf" -X POST --json '{"url":"https://example.com","html":"","actionTimeout":0}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://cloudflare.payweave.services/pdf" -X POST -H 'Content-Type: application/json' -d '{"url":"https://example.com","html":"","actionTimeout":0}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://cloudflare.payweave.services/pdf" -m POST -b '{"url":"https://example.com","html":"","actionTimeout":0}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://cloudflare.payweave.services/pdf', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "html": "",
    "actionTimeout": 0
  }),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://cloudflare.payweave.services/pdf" -m POST -b '{"url":"https://example.com","html":"","actionTimeout":0}' -p x402
```

### Browser Render: CSS Selector Scrape

Extract HTML elements by CSS selector via Cloudflare Browser Run

- Method: POST
- Path: `/scrape`
- Price: $0.01000000

**Input Schema**

```json
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "format": "uri"
    },
    "html": {
      "type": "string"
    },
    "actionTimeout": {
      "type": "integer",
      "minimum": 0
    },
    "addScriptTag": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      }
    },
    "addStyleTag": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      }
    },
    "allowRequestPattern": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "allowResourceTypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "document",
          "stylesheet",
          "image",
          "media",
          "font",
          "script",
          "texttrack",
          "xhr",
          "fetch",
          "prefetch",
          "eventsource",
          "websocket",
          "manifest",
          "signedexchange",
          "ping",
          "cspviolationreport",
          "preflight",
          "other"
        ]
      }
    },
    "authenticate": {
      "type": "object",
      "properties": {
        "username": {
          "type": "string"
        },
        "password": {
          "type": "string"
        }
      },
      "required": [
        "username",
        "password"
      ],
      "additionalProperties": false
    },
    "bestAttempt": {
      "type": "boolean"
    },
    "cookies": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "expires": {
            "type": "number"
          },
          "httpOnly": {
            "type": "boolean"
          },
          "partitionKey": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "priority": {
            "type": "string",
            "enum": [
              "Low",
              "Medium",
              "High"
            ]
          },
          "sameParty": {
            "type": "boolean"
          },
          "sameSite": {
            "type": "string",
            "enum": [
              "Strict",
              "Lax",
              "None"
            ]
          },
          "secure": {
            "type": "boolean"
          },
          "sourcePort": {
            "type": "integer"
          },
          "sourceScheme": {
            "type": "string",
            "enum": [
              "Unset",
              "NonSecure",
              "Secure"
            ]
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "value"
        ],
        "additionalProperties": false
      }
    },
    "emulateMediaType": {
      "type": "string"
    },
    "gotoOptions": {
      "type": "object",
      "properties": {
        "referer": {
          "type": "string"
        },
        "referrerPolicy": {
          "type": "string"
        },
        "timeout": {
          "type": "integer",
          "minimum": 0
        },
        "waitUntil": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "load",
                "domcontentloaded",
                "networkidle0",
                "networkidle2"
              ]
            },
            {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "load",
                  "domcontentloaded",
                  "networkidle0",
                  "networkidle2"
                ]
              }
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "rejectRequestPattern": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "rejectResourceTypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "document",
          "stylesheet",
          "image",
          "media",
          "font",
          "script",
          "texttrack",
          "xhr",
          "fetch",
          "prefetch",
          "eventsource",
          "websocket",
          "manifest",
          "signedexchange",
          "ping",
          "cspviolationreport",
          "preflight",
          "other"
        ]
      }
    },
    "setExtraHTTPHeaders": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "setJavaScriptEnabled": {
      "type": "boolean"
    },
    "userAgent": {
      "type": "string"
    },
    "viewport": {
      "type": "object",
      "properties": {
        "width": {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "height": {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "deviceScaleFactor": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "hasTouch": {
          "type": "boolean"
        },
        "isLandscape": {
          "type": "boolean"
        },
        "isMobile": {
          "type": "boolean"
        }
      },
      "required": [
        "width",
        "height"
      ],
      "additionalProperties": false
    },
    "waitForSelector": {
      "type": "object",
      "properties": {
        "selector": {
          "type": "string",
          "minLength": 1
        },
        "hidden": {
          "type": "boolean",
          "const": true
        },
        "visible": {
          "type": "boolean",
          "const": true
        },
        "timeout": {
          "type": "integer",
          "minimum": 0
        }
      },
      "required": [
        "selector"
      ],
      "additionalProperties": false
    },
    "waitForTimeout": {
      "type": "integer",
      "minimum": 0
    },
    "cacheTTL": {
      "type": "integer",
      "minimum": 0
    },
    "elements": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "selector": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "selector"
        ],
        "additionalProperties": false
      },
      "minItems": 1
    }
  },
  "required": [
    "url",
    "elements"
  ],
  "additionalProperties": false
}
```

**Output Schema**

```json
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "selector": {
        "type": "string",
        "description": "CSS selector from the request"
      },
      "results": {
        "type": "object",
        "properties": {
          "attributes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              },
              "required": [
                "name",
                "value"
              ],
              "additionalProperties": false
            },
            "description": "HTML attributes on the element"
          },
          "height": {
            "type": "number",
            "description": "Element height in pixels"
          },
          "width": {
            "type": "number",
            "description": "Element width in pixels"
          },
          "top": {
            "type": "number",
            "description": "Offset from top of page"
          },
          "left": {
            "type": "number",
            "description": "Offset from left of page"
          },
          "html": {
            "type": "string",
            "description": "Inner HTML"
          },
          "text": {
            "type": "string",
            "description": "Visible text content"
          }
        },
        "required": [
          "attributes",
          "height",
          "width",
          "top",
          "left",
          "html",
          "text"
        ],
        "additionalProperties": false
      }
    },
    "required": [
      "selector",
      "results"
    ],
    "additionalProperties": false
  },
  "description": "One entry per requested selector"
}
```

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://cloudflare.payweave.services/scrape', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "elements": [
      {
        "selector": ""
      }
    ],
    "html": ""
  }),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://cloudflare.payweave.services/scrape', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "elements": [
      {
        "selector": ""
      }
    ],
    "html": ""
  }),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://cloudflare.payweave.services/scrape" -X POST -H 'Content-Type: application/json' -d '{"url":"https://example.com","elements":[{"selector":""}],"html":""}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://cloudflare.payweave.services/scrape" -X POST --json '{"url":"https://example.com","elements":[{"selector":""}],"html":""}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://cloudflare.payweave.services/scrape" -X POST -H 'Content-Type: application/json' -d '{"url":"https://example.com","elements":[{"selector":""}],"html":""}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://cloudflare.payweave.services/scrape" -m POST -b '{"url":"https://example.com","elements":[{"selector":""}],"html":""}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://cloudflare.payweave.services/scrape', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "elements": [
      {
        "selector": ""
      }
    ],
    "html": ""
  }),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://cloudflare.payweave.services/scrape" -m POST -b '{"url":"https://example.com","elements":[{"selector":""}],"html":""}' -p x402
```

### Browser Render: Screenshot

Capture a full-page or element screenshot via Cloudflare Browser Run

- Method: POST
- Path: `/screenshot`
- Price: $0.01000000

**Input Schema**

```json
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "format": "uri"
    },
    "html": {
      "type": "string"
    },
    "actionTimeout": {
      "type": "integer",
      "minimum": 0
    },
    "addScriptTag": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      }
    },
    "addStyleTag": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      }
    },
    "allowRequestPattern": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "allowResourceTypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "document",
          "stylesheet",
          "image",
          "media",
          "font",
          "script",
          "texttrack",
          "xhr",
          "fetch",
          "prefetch",
          "eventsource",
          "websocket",
          "manifest",
          "signedexchange",
          "ping",
          "cspviolationreport",
          "preflight",
          "other"
        ]
      }
    },
    "authenticate": {
      "type": "object",
      "properties": {
        "username": {
          "type": "string"
        },
        "password": {
          "type": "string"
        }
      },
      "required": [
        "username",
        "password"
      ],
      "additionalProperties": false
    },
    "bestAttempt": {
      "type": "boolean"
    },
    "cookies": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "expires": {
            "type": "number"
          },
          "httpOnly": {
            "type": "boolean"
          },
          "partitionKey": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "priority": {
            "type": "string",
            "enum": [
              "Low",
              "Medium",
              "High"
            ]
          },
          "sameParty": {
            "type": "boolean"
          },
          "sameSite": {
            "type": "string",
            "enum": [
              "Strict",
              "Lax",
              "None"
            ]
          },
          "secure": {
            "type": "boolean"
          },
          "sourcePort": {
            "type": "integer"
          },
          "sourceScheme": {
            "type": "string",
            "enum": [
              "Unset",
              "NonSecure",
              "Secure"
            ]
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "value"
        ],
        "additionalProperties": false
      }
    },
    "emulateMediaType": {
      "type": "string"
    },
    "gotoOptions": {
      "type": "object",
      "properties": {
        "referer": {
          "type": "string"
        },
        "referrerPolicy": {
          "type": "string"
        },
        "timeout": {
          "type": "integer",
          "minimum": 0
        },
        "waitUntil": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "load",
                "domcontentloaded",
                "networkidle0",
                "networkidle2"
              ]
            },
            {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "load",
                  "domcontentloaded",
                  "networkidle0",
                  "networkidle2"
                ]
              }
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "rejectRequestPattern": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "rejectResourceTypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "document",
          "stylesheet",
          "image",
          "media",
          "font",
          "script",
          "texttrack",
          "xhr",
          "fetch",
          "prefetch",
          "eventsource",
          "websocket",
          "manifest",
          "signedexchange",
          "ping",
          "cspviolationreport",
          "preflight",
          "other"
        ]
      }
    },
    "setExtraHTTPHeaders": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "setJavaScriptEnabled": {
      "type": "boolean"
    },
    "userAgent": {
      "type": "string"
    },
    "viewport": {
      "type": "object",
      "properties": {
        "width": {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "height": {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "deviceScaleFactor": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "hasTouch": {
          "type": "boolean"
        },
        "isLandscape": {
          "type": "boolean"
        },
        "isMobile": {
          "type": "boolean"
        }
      },
      "required": [
        "width",
        "height"
      ],
      "additionalProperties": false
    },
    "waitForSelector": {
      "type": "object",
      "properties": {
        "selector": {
          "type": "string",
          "minLength": 1
        },
        "hidden": {
          "type": "boolean",
          "const": true
        },
        "visible": {
          "type": "boolean",
          "const": true
        },
        "timeout": {
          "type": "integer",
          "minimum": 0
        }
      },
      "required": [
        "selector"
      ],
      "additionalProperties": false
    },
    "waitForTimeout": {
      "type": "integer",
      "minimum": 0
    },
    "cacheTTL": {
      "type": "integer",
      "minimum": 0
    },
    "screenshotOptions": {
      "type": "object",
      "properties": {
        "captureBeyondViewport": {
          "type": "boolean"
        },
        "clip": {
          "type": "object",
          "properties": {
            "x": {
              "type": "number"
            },
            "y": {
              "type": "number"
            },
            "width": {
              "type": "number",
              "exclusiveMinimum": 0
            },
            "height": {
              "type": "number",
              "exclusiveMinimum": 0
            },
            "scale": {
              "type": "number",
              "exclusiveMinimum": 0
            }
          },
          "required": [
            "x",
            "y",
            "width",
            "height"
          ],
          "additionalProperties": false
        },
        "encoding": {
          "type": "string",
          "enum": [
            "binary",
            "base64"
          ]
        },
        "fromSurface": {
          "type": "boolean"
        },
        "fullPage": {
          "type": "boolean"
        },
        "omitBackground": {
          "type": "boolean"
        },
        "optimizeForSpeed": {
          "type": "boolean"
        },
        "quality": {
          "type": "number",
          "minimum": 0,
          "maximum": 100
        },
        "type": {
          "type": "string",
          "enum": [
            "png",
            "jpeg",
            "webp"
          ]
        }
      },
      "additionalProperties": false
    },
    "scrollPage": {
      "type": "boolean"
    },
    "selector": {
      "type": "string"
    }
  },
  "required": [
    "url"
  ],
  "additionalProperties": false
}
```

**Output Schema**

```json
{
  "type": "string",
  "format": "binary"
}
```

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://cloudflare.payweave.services/screenshot', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "html": "",
    "actionTimeout": 0
  }),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://cloudflare.payweave.services/screenshot', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "html": "",
    "actionTimeout": 0
  }),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://cloudflare.payweave.services/screenshot" -X POST -H 'Content-Type: application/json' -d '{"url":"https://example.com","html":"","actionTimeout":0}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://cloudflare.payweave.services/screenshot" -X POST --json '{"url":"https://example.com","html":"","actionTimeout":0}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://cloudflare.payweave.services/screenshot" -X POST -H 'Content-Type: application/json' -d '{"url":"https://example.com","html":"","actionTimeout":0}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://cloudflare.payweave.services/screenshot" -m POST -b '{"url":"https://example.com","html":"","actionTimeout":0}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://cloudflare.payweave.services/screenshot', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "html": "",
    "actionTimeout": 0
  }),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://cloudflare.payweave.services/screenshot" -m POST -b '{"url":"https://example.com","html":"","actionTimeout":0}' -p x402
```

### Browser Render: HTML + Screenshot Snapshot

Capture HTML content and base64 screenshot of a URL in one call

- Method: POST
- Path: `/snapshot`
- Price: $0.01000000

**Input Schema**

```json
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "format": "uri"
    },
    "html": {
      "type": "string"
    },
    "actionTimeout": {
      "type": "integer",
      "minimum": 0
    },
    "addScriptTag": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      }
    },
    "addStyleTag": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "additionalProperties": false
      }
    },
    "allowRequestPattern": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "allowResourceTypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "document",
          "stylesheet",
          "image",
          "media",
          "font",
          "script",
          "texttrack",
          "xhr",
          "fetch",
          "prefetch",
          "eventsource",
          "websocket",
          "manifest",
          "signedexchange",
          "ping",
          "cspviolationreport",
          "preflight",
          "other"
        ]
      }
    },
    "authenticate": {
      "type": "object",
      "properties": {
        "username": {
          "type": "string"
        },
        "password": {
          "type": "string"
        }
      },
      "required": [
        "username",
        "password"
      ],
      "additionalProperties": false
    },
    "bestAttempt": {
      "type": "boolean"
    },
    "cookies": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "expires": {
            "type": "number"
          },
          "httpOnly": {
            "type": "boolean"
          },
          "partitionKey": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "priority": {
            "type": "string",
            "enum": [
              "Low",
              "Medium",
              "High"
            ]
          },
          "sameParty": {
            "type": "boolean"
          },
          "sameSite": {
            "type": "string",
            "enum": [
              "Strict",
              "Lax",
              "None"
            ]
          },
          "secure": {
            "type": "boolean"
          },
          "sourcePort": {
            "type": "integer"
          },
          "sourceScheme": {
            "type": "string",
            "enum": [
              "Unset",
              "NonSecure",
              "Secure"
            ]
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "value"
        ],
        "additionalProperties": false
      }
    },
    "emulateMediaType": {
      "type": "string"
    },
    "gotoOptions": {
      "type": "object",
      "properties": {
        "referer": {
          "type": "string"
        },
        "referrerPolicy": {
          "type": "string"
        },
        "timeout": {
          "type": "integer",
          "minimum": 0
        },
        "waitUntil": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "load",
                "domcontentloaded",
                "networkidle0",
                "networkidle2"
              ]
            },
            {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "load",
                  "domcontentloaded",
                  "networkidle0",
                  "networkidle2"
                ]
              }
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "rejectRequestPattern": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "rejectResourceTypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "document",
          "stylesheet",
          "image",
          "media",
          "font",
          "script",
          "texttrack",
          "xhr",
          "fetch",
          "prefetch",
          "eventsource",
          "websocket",
          "manifest",
          "signedexchange",
          "ping",
          "cspviolationreport",
          "preflight",
          "other"
        ]
      }
    },
    "setExtraHTTPHeaders": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "setJavaScriptEnabled": {
      "type": "boolean"
    },
    "userAgent": {
      "type": "string"
    },
    "viewport": {
      "type": "object",
      "properties": {
        "width": {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "height": {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "deviceScaleFactor": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "hasTouch": {
          "type": "boolean"
        },
        "isLandscape": {
          "type": "boolean"
        },
        "isMobile": {
          "type": "boolean"
        }
      },
      "required": [
        "width",
        "height"
      ],
      "additionalProperties": false
    },
    "waitForSelector": {
      "type": "object",
      "properties": {
        "selector": {
          "type": "string",
          "minLength": 1
        },
        "hidden": {
          "type": "boolean",
          "const": true
        },
        "visible": {
          "type": "boolean",
          "const": true
        },
        "timeout": {
          "type": "integer",
          "minimum": 0
        }
      },
      "required": [
        "selector"
      ],
      "additionalProperties": false
    },
    "waitForTimeout": {
      "type": "integer",
      "minimum": 0
    },
    "cacheTTL": {
      "type": "integer",
      "minimum": 0
    },
    "screenshotOptions": {
      "type": "object",
      "properties": {
        "captureBeyondViewport": {
          "type": "boolean"
        },
        "clip": {
          "type": "object",
          "properties": {
            "x": {
              "type": "number"
            },
            "y": {
              "type": "number"
            },
            "width": {
              "type": "number",
              "exclusiveMinimum": 0
            },
            "height": {
              "type": "number",
              "exclusiveMinimum": 0
            },
            "scale": {
              "type": "number",
              "exclusiveMinimum": 0
            }
          },
          "required": [
            "x",
            "y",
            "width",
            "height"
          ],
          "additionalProperties": false
        },
        "encoding": {
          "type": "string",
          "enum": [
            "binary",
            "base64"
          ]
        },
        "fromSurface": {
          "type": "boolean"
        },
        "fullPage": {
          "type": "boolean"
        },
        "omitBackground": {
          "type": "boolean"
        },
        "optimizeForSpeed": {
          "type": "boolean"
        },
        "quality": {
          "type": "number",
          "minimum": 0,
          "maximum": 100
        },
        "type": {
          "type": "string",
          "enum": [
            "png",
            "jpeg",
            "webp"
          ]
        }
      },
      "additionalProperties": false
    }
  },
  "required": [
    "url"
  ],
  "additionalProperties": false
}
```

**Output Schema**

```json
{
  "type": "object",
  "properties": {
    "content": {
      "type": "string",
      "description": "Rendered HTML content"
    },
    "screenshot": {
      "type": "string",
      "description": "Base64-encoded screenshot of the page"
    }
  },
  "required": [
    "content",
    "screenshot"
  ],
  "additionalProperties": false,
  "description": "HTML content and screenshot captured in one call"
}
```

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://cloudflare.payweave.services/snapshot', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "html": "",
    "actionTimeout": 0
  }),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://cloudflare.payweave.services/snapshot', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "html": "",
    "actionTimeout": 0
  }),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://cloudflare.payweave.services/snapshot" -X POST -H 'Content-Type: application/json' -d '{"url":"https://example.com","html":"","actionTimeout":0}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://cloudflare.payweave.services/snapshot" -X POST --json '{"url":"https://example.com","html":"","actionTimeout":0}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://cloudflare.payweave.services/snapshot" -X POST -H 'Content-Type: application/json' -d '{"url":"https://example.com","html":"","actionTimeout":0}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://cloudflare.payweave.services/snapshot" -m POST -b '{"url":"https://example.com","html":"","actionTimeout":0}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://cloudflare.payweave.services/snapshot', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "url": "https://example.com",
    "html": "",
    "actionTimeout": 0
  }),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://cloudflare.payweave.services/snapshot" -m POST -b '{"url":"https://example.com","html":"","actionTimeout":0}' -p x402
```

### Whisper: Audio Transcription

Transcribe an audio file (max 10 MB) to text using Cloudflare Workers AI Whisper (model `@cf/openai/whisper`). Returns the full transcription plus optional WebVTT subtitles and per-word timing when supported by the audio.

- Method: POST
- Path: `/transcribe`
- Price: $0.02000000

**Input Schema**

```json
{
  "type": "object",
  "properties": {
    "audio_url": {
      "type": "string",
      "format": "uri",
      "description": "Public URL of the audio file to transcribe (max 10 MB)"
    },
    "model": {
      "type": "string",
      "enum": [
        "whisper"
      ],
      "description": "Whisper variant. Currently only `whisper` (@cf/openai/whisper) is supported. Defaults to `whisper`."
    }
  },
  "required": [
    "audio_url"
  ],
  "additionalProperties": false
}
```

**Output Schema**

```json
{
  "type": "object",
  "properties": {
    "text": {
      "type": "string",
      "description": "Full transcription"
    },
    "vtt": {
      "type": "string",
      "description": "WebVTT subtitle string with timestamps (when available)"
    },
    "word_count": {
      "type": "integer",
      "minimum": 0
    },
    "words": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "word": {
            "type": "string"
          },
          "start": {
            "type": "number",
            "description": "Start time in seconds"
          },
          "end": {
            "type": "number",
            "description": "End time in seconds"
          }
        },
        "additionalProperties": false
      },
      "description": "Per-word timing (when supported by the model)"
    }
  },
  "required": [
    "text"
  ],
  "additionalProperties": false,
  "description": "Whisper transcription with optional word-level timing"
}
```

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://cloudflare.payweave.services/transcribe', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "audio_url": "https://example.com",
    "model": "whisper"
  }),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://cloudflare.payweave.services/transcribe', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "audio_url": "https://example.com",
    "model": "whisper"
  }),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://cloudflare.payweave.services/transcribe" -X POST -H 'Content-Type: application/json' -d '{"audio_url":"https://example.com","model":"whisper"}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://cloudflare.payweave.services/transcribe" -X POST --json '{"audio_url":"https://example.com","model":"whisper"}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://cloudflare.payweave.services/transcribe" -X POST -H 'Content-Type: application/json' -d '{"audio_url":"https://example.com","model":"whisper"}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://cloudflare.payweave.services/transcribe" -m POST -b '{"audio_url":"https://example.com","model":"whisper"}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://cloudflare.payweave.services/transcribe', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "audio_url": "https://example.com",
    "model": "whisper"
  }),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://cloudflare.payweave.services/transcribe" -m POST -b '{"audio_url":"https://example.com","model":"whisper"}' -p x402
```

### Cloudflare TTS: Speak

Synthesize natural speech from text using OpenAI TTS (gpt-4o-mini-tts by default) through Cloudflare AI Gateway. Pass text plus an optional voice and model. Returns MP3 audio. Priced per 1k input characters.

- Method: POST
- Path: `/tts/speak`
- Price: $0.03000000

**Input Schema**

```json
{
  "type": "object",
  "properties": {
    "text": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2000,
      "description": "Text to synthesize. 1-2000 characters. Priced per 1k chars."
    },
    "voice": {
      "type": "string",
      "enum": [
        "alloy",
        "ash",
        "coral",
        "echo",
        "fable",
        "onyx",
        "nova",
        "sage",
        "shimmer"
      ],
      "description": "Voice: alloy (default), ash, coral, echo, fable, onyx, nova, sage, shimmer."
    },
    "model": {
      "type": "string",
      "enum": [
        "gpt-4o-mini-tts",
        "tts-1",
        "tts-1-hd"
      ],
      "description": "Model: gpt-4o-mini-tts (default), tts-1, or tts-1-hd."
    }
  },
  "required": [
    "text"
  ],
  "additionalProperties": false
}
```

**Output Schema**

```json
{
  "type": "string",
  "format": "binary"
}
```

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://cloudflare.payweave.services/tts/speak', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "text": "",
    "voice": "alloy",
    "model": "gpt-4o-mini-tts"
  }),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://cloudflare.payweave.services/tts/speak', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "text": "",
    "voice": "alloy",
    "model": "gpt-4o-mini-tts"
  }),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://cloudflare.payweave.services/tts/speak" -X POST -H 'Content-Type: application/json' -d '{"text":"","voice":"alloy","model":"gpt-4o-mini-tts"}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://cloudflare.payweave.services/tts/speak" -X POST --json '{"text":"","voice":"alloy","model":"gpt-4o-mini-tts"}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://cloudflare.payweave.services/tts/speak" -X POST -H 'Content-Type: application/json' -d '{"text":"","voice":"alloy","model":"gpt-4o-mini-tts"}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://cloudflare.payweave.services/tts/speak" -m POST -b '{"text":"","voice":"alloy","model":"gpt-4o-mini-tts"}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://cloudflare.payweave.services/tts/speak', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "text": "",
    "voice": "alloy",
    "model": "gpt-4o-mini-tts"
  }),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://cloudflare.payweave.services/tts/speak" -m POST -b '{"text":"","voice":"alloy","model":"gpt-4o-mini-tts"}' -p x402
```

### Cloudflare Vision: Describe

Caption an image or answer a question about it using Cloudflare Workers AI (@cf/meta/llama-3.2-11b-vision-instruct). Pass source_url plus an optional prompt (e.g. "Read the text" or "What is in this image?"). The source is downscaled before inference.

- Method: POST
- Path: `/vision/describe`
- Price: $0.00300000

**Input Schema**

```json
{
  "type": "object",
  "properties": {
    "source_url": {
      "type": "string",
      "format": "uri",
      "description": "Public URL of the image to describe (max 10 MB)."
    },
    "prompt": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1000,
      "description": "Question or instruction about the image. Defaults to a general description ask."
    },
    "max_tokens": {
      "type": "integer",
      "minimum": 1,
      "maximum": 512,
      "description": "Maximum tokens to generate (1-512). Defaults to 256."
    }
  },
  "required": [
    "source_url"
  ],
  "additionalProperties": false
}
```

**Output Schema**

```json
{
  "type": "object",
  "properties": {
    "model": {
      "type": "string",
      "description": "Workers AI model id used"
    },
    "description": {
      "type": "string",
      "description": "The generated description or answer"
    }
  },
  "required": [
    "model",
    "description"
  ],
  "additionalProperties": false,
  "description": "Image-to-text result"
}
```

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://cloudflare.payweave.services/vision/describe', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "source_url": "https://example.com",
    "prompt": "",
    "max_tokens": 1
  }),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://cloudflare.payweave.services/vision/describe', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "source_url": "https://example.com",
    "prompt": "",
    "max_tokens": 1
  }),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://cloudflare.payweave.services/vision/describe" -X POST -H 'Content-Type: application/json' -d '{"source_url":"https://example.com","prompt":"","max_tokens":1}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://cloudflare.payweave.services/vision/describe" -X POST --json '{"source_url":"https://example.com","prompt":"","max_tokens":1}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://cloudflare.payweave.services/vision/describe" -X POST -H 'Content-Type: application/json' -d '{"source_url":"https://example.com","prompt":"","max_tokens":1}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://cloudflare.payweave.services/vision/describe" -m POST -b '{"source_url":"https://example.com","prompt":"","max_tokens":1}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://cloudflare.payweave.services/vision/describe', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "source_url": "https://example.com",
    "prompt": "",
    "max_tokens": 1
  }),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://cloudflare.payweave.services/vision/describe" -m POST -b '{"source_url":"https://example.com","prompt":"","max_tokens":1}' -p x402
```

### Cloudflare Vision: Detect Objects

Detect objects in an image with bounding boxes using Cloudflare Workers AI (@cf/facebook/detr-resnet-50). Returns labels, confidence scores, and pixel boxes, highest confidence first. Optionally filter by min_score.

- Method: POST
- Path: `/vision/detect`
- Price: $0.00200000

**Input Schema**

```json
{
  "type": "object",
  "properties": {
    "source_url": {
      "type": "string",
      "format": "uri",
      "description": "Public URL of the image to analyze (max 10 MB)."
    },
    "min_score": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "description": "Only return detections with at least this confidence (0-1). Defaults to 0."
    }
  },
  "required": [
    "source_url"
  ],
  "additionalProperties": false
}
```

**Output Schema**

```json
{
  "type": "object",
  "properties": {
    "objects": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "description": "Detected object class"
          },
          "score": {
            "type": "number",
            "description": "Confidence score (0-1)"
          },
          "box": {
            "type": "object",
            "properties": {
              "xmin": {
                "type": "number"
              },
              "ymin": {
                "type": "number"
              },
              "xmax": {
                "type": "number"
              },
              "ymax": {
                "type": "number"
              }
            },
            "required": [
              "xmin",
              "ymin",
              "xmax",
              "ymax"
            ],
            "additionalProperties": false,
            "description": "Bounding box in pixels"
          }
        },
        "required": [
          "label",
          "score"
        ],
        "additionalProperties": false
      },
      "description": "Detected objects, highest confidence first"
    }
  },
  "required": [
    "objects"
  ],
  "additionalProperties": false,
  "description": "Object detection result"
}
```

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://cloudflare.payweave.services/vision/detect', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "source_url": "https://example.com",
    "min_score": 0
  }),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://cloudflare.payweave.services/vision/detect', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "source_url": "https://example.com",
    "min_score": 0
  }),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://cloudflare.payweave.services/vision/detect" -X POST -H 'Content-Type: application/json' -d '{"source_url":"https://example.com","min_score":0}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://cloudflare.payweave.services/vision/detect" -X POST --json '{"source_url":"https://example.com","min_score":0}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://cloudflare.payweave.services/vision/detect" -X POST -H 'Content-Type: application/json' -d '{"source_url":"https://example.com","min_score":0}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://cloudflare.payweave.services/vision/detect" -m POST -b '{"source_url":"https://example.com","min_score":0}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://cloudflare.payweave.services/vision/detect', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "source_url": "https://example.com",
    "min_score": 0
  }),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://cloudflare.payweave.services/vision/detect" -m POST -b '{"source_url":"https://example.com","min_score":0}' -p x402
```
