xclaw02
Make x402 payments. Pay for APIs, sell your services, handle 402 Payment Required responses with USDC on Base and other EVM chains.
Why use this skill?
Integrate xClaw02 to enable your AI agent to pay for APIs and services automatically using the x402 protocol and USDC on Base. Secure and easy setup.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/primer-dev/xclaw02What This Skill Does
xClaw02 acts as the core bridge between your AI agent and the 402 Payment Required protocol, enabling seamless, automated stablecoin micro-payments over HTTP. Designed for the agentic web, this skill allows your agent to interact with paid APIs, subscription-based resources, and monetized services without human intervention. By utilizing the 402 status code standard, xClaw02 handles the complexities of payment headers, signature generation, and on-chain settlement using USDC, primarily on the Base network. It effectively turns your agent into an autonomous economic entity capable of managing its own budget and accessing premium data feeds or compute resources.
Installation
To integrate xClaw02, first ensure you have the OpenClaw CLI installed. For Node.js environments, use: npx xclaw02 openclaw init. For Python environments, execute: pip install xclaw02 followed by xclaw02 openclaw init. The initialization process will configure your local environment, generate a new wallet for your agent (or import an existing one), and create the necessary directory at ~/.openclaw/skills/xclaw02/. Ensure you securely store the private key provided during initialization, as this key authorizes your agent's payments. After initialization, you should fund the generated wallet address with USDC on the Base network to begin making requests.
Use Cases
- Autonomous API Consumption: Access paid data APIs that return 402 errors by automatically facilitating payments.
- Agent Monetization: Serve your own paid services by implementing the suggested Express.js or FastAPI middleware to request payment.
- Expense Management: Programmatically check wallet balances to ensure the agent has enough funds before initiating high-value transactions.
- Cross-Chain Transactions: Leverage support for Ethereum, Arbitrum, Optimism, and Polygon to pay for resources across the EVM ecosystem.
Example Prompts
- "I encountered a 402 Payment Required error when trying to access this API. Can you probe the URL and tell me how much it costs to pay for it?"
- "Check my current wallet balance to see if I have enough USDC on Base to cover a 0.50 USDC request."
- "I want to start charging for my own agent services. Can you show me the middleware code I need to implement to accept x402 payments?"
Tips & Limitations
Always use the --max-amount flag when performing payments to prevent unexpected spending. While the payment process is gasless for the payer, you must ensure the wallet is sufficiently funded with USDC. Avoid hardcoding private keys in your scripts; always use environment variables or local secure storage mechanisms. If an API returns a 402, prioritize xclaw02 probe to understand the pricing structure before committing funds. Note that while Base is the recommended network for low-cost transactions, verify the specific network requirements of the service provider before interacting.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-primer-dev-xclaw02": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: external-api, code-execution