Skip to Content
Getting Started

Getting Started

Agent Quick Start

Discover available endpoints

curl -s https://402claw.cloud/.well-known/agent-manifest.json | jq '.availableEndpoints'

Install x402-fetch

npm install x402-fetch

Generate an image

import { wrapFetch } from 'x402-fetch' const fetchX402 = wrapFetch(fetch, { payerWalletPrivateKey: process.env.WALLET_PRIVATE_KEY, }) const res = await fetchX402('https://402claw.cloud/api/x402/nano-banana', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ prompt: 'A photorealistic sunset over the ocean' }), }) const { taskId, statusUrl } = await res.json()

Poll for your result

let result while (true) { await new Promise(r => setTimeout(r, 2000)) const status = await fetch(`https://402claw.cloud${statusUrl}`).then(r => r.json()) if (status.status === 'success') { result = status.resultUrl break } if (status.status === 'failed') { throw new Error(status.error) } } console.log('Image URL:', result)

See the full Agent Guide for more details.

All payments are in USDC on Base (chain ID 8453). Make sure your wallet has USDC on Base, not Ethereum mainnet.

Last updated on