API Reference

API Reference

AZNP v2.1 API endpoint, query parameters, response headers, and the optional Base (EVM) EIP-191·EIP-712 wallet signature (identity, not billing).

Conversion Endpoint

GET https://aznp-proxy.kerberos79.workers.dev/?url={target_url}

🔑 Base (EVM) Wallet Signature (Optional Identity)

Signing is optional — it confirms request identity and lifts the rate limit. Base (EVM) uses EIP-191 personal_sign over 'x402:base:{timestamp}' or EIP-712 typed data (X402Auth):

x-wallet-addressBase (EVM) address (0x + 40 hex) — optional identity
x-timestampUnix Timestamp (Seconds, within 5 mins) — optional identity (chain-agnostic)
x-signatureEIP-191 personal_sign of 'x402:base:{timestamp}' or EIP-712 typed data (0x + 130 hex) — optional identity
x-chain'base' — declares the chain for address & signature verification
x-sig-type'eip191' | 'eip712'. When omitted, EIP-191 is verified first, then EIP-712

💳 Credit Top-up API (POST /v1/topup)

Submit your Base (EVM) wallet address and deposit transaction hash (tx_hash) after transferring $20 USDC or more (chain: base):
# Request
curl -X POST "https://aznp-proxy.kerberos79.workers.dev/v1/topup" \ -H "Content-Type: application/json" \ -d '{"wallet": "0x...BaseEVMAddress", "tx_hash": "0x...BaseTxHash", "chain": "base"}'
# Response (200 OK)
{ "success": true, "chain": "base", "wallet": "0x...BaseEVMAddress", "deposited_usdc": 20.0, "added_credits": 12000, "total_allowed_requests": 12000 }

Query Parameters

ParameterRequiredType / ScopeDescription
urlRequiredRequiredTarget web page URL (Required)
modeOptionalFree / Proauto (default) / summary (summary mode, Pro)
max_tokensOptionalFreeTruncate the output to N tokens (free)
renderOptionalProtrue → force dynamic JS rendering (Tier 3, Pro)
formatOptionalFreemarkdown (default) | json | toml | yaml | json-ld — all free
freshOptionalFree1 → bypass cache & force refresh
imagesOptionalFree0 → drop images from the output

Response Headers

X-AZNP-PlanExecution plan (free | pro | enterprise)
X-AZNP-SourceConversion source (cloudflare-native | aznp-self | browser-rendering | openapi-compressed | cache | kv)
X-AZNP-CacheCache status (HIT | MISS | BYPASS)
X-AZNP-BypassSet to 'true' on 307 Redirect for files or Free plan OpenAPI requests
X-Token-ReductionEstimated token reduction % (e.g. 88%)
X-Markdown-TokensOutput token count (estimated)
X-RateLimit-RemainingRemaining credit request count
PAYMENT-REQUIREDTop-up spec JSON returned on HTTP 402

AI Agent Code Example — Base (EVM) (Node.js · viem)

// Base (EVM) EIP-191 / EIP-712 Signature & Call Example (Node.js — viem) import { createWalletClient, http } from 'viem'; import { base } from 'viem/chains'; import { privateKeyToAccount } from 'viem/accounts'; // Agent EVM private key (0x + 32 bytes hex) — store securely in .env const account = privateKeyToAccount('0xYOUR_BASE_PRIVATE_KEY'); // derives 0x + 40 hex address const client = createWalletClient({ account, chain: base, // Base L2 (chainId 8453) transport: http('https://mainnet.base.org'), }); async function callAZNPProxy(targetUrl) { const timestamp = Math.floor(Date.now() / 1000).toString(); // EIP-191 (personal_sign) over "x402:base:{timestamp}" — chain-bound message const signatureEip191 = await client.signMessage({ account, message: `x402:base:${timestamp}`, }); // EIP-712 (typed data) — X402Auth(string message, uint256 timestamp) const signatureEip712 = await client.signTypedData({ account, domain: { name: 'AZNP', version: '1', chainId: 8453 }, types: { X402Auth: [ { name: 'message', type: 'string' }, { name: 'timestamp', type: 'uint256' }, ], }, primaryType: 'X402Auth', message: { message: 'x402', timestamp: BigInt(timestamp) }, }); const endpointUrl = `https://aznp-proxy.kerberos79.workers.dev/?url=${encodeURIComponent(targetUrl)}&render=true`; const response = await fetch(endpointUrl, { method: 'GET', headers: { 'x-wallet-address': account.address, // 0x + 40 hex (lowercase) 'x-timestamp': timestamp, 'x-signature': signatureEip191, // use signatureEip712 when 'x-sig-type: eip712' 'x-chain': 'base', 'x-sig-type': 'eip191', // or 'eip712' }, }); if (response.status === 402) { const errorData = await response.json(); console.error("402 Payment Required: Insufficient credits. Please top up.", errorData); return null; } const markdown = await response.text(); console.log("Token reduction:", response.headers.get("X-Token-Reduction")); console.log("Clean Markdown output:", markdown.slice(0, 200)); return markdown; }

🤖 Programmatic Wallet & Auto-Topup Script (Node.js — viem)

// 1. Base (EVM) Wallet Generation (Node.js — viem) import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'; // Create a new private key programmatically for an AI Agent const agentPrivateKey = generatePrivateKey(); // 0x + 32 bytes hex const agentAddress = privateKeyToAccount(agentPrivateKey); // 0x + 40 hex console.log("Agent Address:", agentAddress); console.log("Agent Private Key (Store securely in .env):", agentPrivateKey); // 2. HTTP 402 Auto-Payment Handler Pattern async function fetchWithAutoTopup(targetUrl) { let res = await callAZNPProxy(targetUrl); // Detect 402 Payment Required (Insufficient credits) if (res && res.status === 402) { const paymentInfo = await res.json(); console.warn("HTTP 402 Payment Required received. Executing automated USDC topup..."); // Step 2a: Send $20 USDC via Base SDK to receiver wallet const txHash = await executeUsdcTransfer({ from: agentAddress, toAddress: paymentInfo.receiver_wallet || "0x22E2076148c529981495c3C02A23DfB1D4f8Db9C", amountUsdc: 20.0 }); // Step 2b: Submit transaction hash to AZNP credit topup endpoint const topupRes = await fetch("https://aznp-proxy.kerberos79.workers.dev/v1/topup", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ wallet: agentAddress, tx_hash: txHash, chain: "base" }) }); if (topupRes.ok) { console.log("Auto-topup successful! Resuming original request..."); return await callAZNPProxy(targetUrl); // Retry request } } return res; }

Error Codes

Errors are returned as TOML with an [error] table (code + action_recommendation) by default, and as JSON when format=json is used.

Statuscodeaction_recommendation
400missing_url / invalid_url / unsupported_format / max_tokens_too_large / chain_mismatchfix the parameter
404not_founduse GET /?url=... or the endpoints above
429rate_limitedwait Retry-After seconds
502fetch_failedcheck URL reachability and retry
500internal_errorretry a limited number of times
HTTP 402 is only returned by the credit system (POST /v1/topup) when credits are exhausted. Its body and PAYMENT-REQUIRED header remain JSON.