Direct USDC Generate
POST /api/proxy-generateGenerate AI content by submitting proof of a direct USDC transfer on Base. Use this when you can’t use the X402 protocol (e.g., from Python or environments without x402-fetch).
Flow
- Transfer USDC to the gateway wallet on Base
- Submit the transaction hash with your generation request
- The server verifies the on-chain payment
- Generation starts and you get a task ID to poll
Request Body
{
"slug": "nano-banana",
"prompt": "A photorealistic sunset over the ocean",
"txHash": "0xabc123def456...",
"aspect_ratio": "16:9",
"output_format": "webp"
}| Field | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | Endpoint identifier |
prompt | string | Conditional | Generation prompt (1–10,000 chars). Required unless fileBase64 is provided. |
txHash | string | Yes | Transaction hash (0x + 64 hex characters) |
fileBase64 | string | No | Base64-encoded file for document parsing (max ~7.5 MB) |
fileName | string | No | Original filename (required if fileBase64 is provided) |
aspect_ratio | string | No | Image ratio: 1:1, 4:3, 3:4, 16:9, 9:16 |
output_format | string | No | Output format: png, jpg, webp |
resolution | string | No | Output resolution (provider-dependent) |
Response — 200 Success
{
"success": true,
"taskId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"statusUrl": "/api/task/a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"paidAmount": 0.05,
"message": "Generation started. Poll statusUrl for results."
}Error Responses
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid request body (missing fields, bad format) |
| 400 | TX_NOT_FOUND | Transaction hash not found on Base network |
| 400 | TX_FAILED | Transaction failed on-chain |
| 400 | INVALID_PAYMENT | No USDC transfer to gateway wallet in the transaction |
| 400 | INSUFFICIENT_PAYMENT | Amount transferred is less than endpoint price |
| 400 | TX_ALREADY_USED | This transaction hash has already been submitted |
| 404 | NOT_FOUND | Endpoint slug does not exist |
| 429 | — | Rate limited (5 req/min) |
| 500 | INTERNAL_ERROR | Failed to create task record |
| 500 | EXECUTION_ERROR | Generation failed server-side |
Payment Verification
The server verifies your transaction on-chain:
- Fetches the transaction receipt from Base
- Looks for a USDC
Transferevent where the recipient matches the gateway wallet - Checks the transferred amount is at least the endpoint price
- Ensures the transaction hash hasn’t been used before (replay protection)
USDC Contract on Base: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 (6 decimals)
Example
# After transferring 0.05 USDC to the gateway wallet on Base:
curl -X POST https://402claw.cloud/api/proxy-generate \
-H "Content-Type: application/json" \
-d '{
"slug": "nano-banana",
"prompt": "A beautiful mountain landscape at golden hour",
"txHash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
}'File Upload Example
# Base64-encode a PDF and submit for parsing:
FILE_B64=$(base64 -i document.pdf)
curl -X POST https://402claw.cloud/api/proxy-generate \
-H "Content-Type: application/json" \
-d "{
\"slug\": \"llamaparse\",
\"fileBase64\": \"$FILE_B64\",
\"fileName\": \"document.pdf\",
\"txHash\": \"0x...\"
}"Last updated on