一键导入
ag402
AI Agent Payment Protocol — auto-pay x402 APIs with Solana USDC. Commands: setup, pay <url>, balance, history, doctor, serve. Use exec to run CLI commands.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
AI Agent Payment Protocol — auto-pay x402 APIs with Solana USDC. Commands: setup, pay <url>, balance, history, doctor, serve. Use exec to run CLI commands.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.
Use when you have a written implementation plan to execute in a separate session with review checkpoints
Use when starting any new feature, bug fix, or significant change. Drives the full lifecycle: orientation → requirement clarification → design → implementation → multi-role review → fix → production readiness check. Runs autonomously until done; only pauses for genuine architectural forks or hard blockers that have exhausted the structured debugging protocol.
Use when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation
Use when executing implementation plans with independent tasks in the current session
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes
| name | ag402 |
| description | AI Agent Payment Protocol — auto-pay x402 APIs with Solana USDC. Commands: setup, pay <url>, balance, history, doctor, serve. Use exec to run CLI commands. |
| metadata | {"openclaw":{"requires":{"bins":["ag402"]}}} |
Use exec to run ag402 CLI commands. This skill provides autonomous payment
capabilities for AI agents via the x402 protocol on Solana (USDC).
ag402 --version
If not installed:
pip install ag402-core
ag402 init
Creates a test wallet with $100 USDC. No prompts, no human input needed.
ag402 balance
Expected: $100.00 test balance.
ag402 pay <url>
Sends a request to <url>. If the server returns 402 Payment Required with
an x402 challenge, ag402 automatically pays and retries. Returns the API response.
Example:
ag402 pay https://api.example.com/premium/data
With options:
ag402 pay https://api.example.com/generate \
--method POST \
--data '{"prompt": "hello"}' \
--amount 2.50
ag402 balance
ag402 history
ag402 history --limit 20 --type payment
ag402 status
ag402 doctor
ag402 serve --target http://localhost:8000 --price 0.01 --port 4020 &
Kill the background process or use Ctrl+C in the terminal.
For real on-chain payments, set environment variables before running:
X402_MODE=production \
X402_NETWORK=mainnet \
SOLANA_RPC_URL=<your_rpc_url> \
AG402_UNLOCK_PASSWORD=<wallet_password> \
ag402 pay <url>
Or configure persistently:
ag402 env set X402_MODE production
ag402 env set X402_NETWORK mainnet
ag402 env set SOLANA_RPC_URL <your_rpc_url>
Then run ag402 pay <url> normally.
| Variable | Description | Default |
|---|---|---|
X402_MODE | test or production | Must be set explicitly |
X402_NETWORK | mainnet, devnet, localnet | devnet |
SOLANA_RPC_URL | Solana RPC endpoint | Public devnet |
AG402_UNLOCK_PASSWORD | Wallet unlock password | — |
X402_DAILY_LIMIT | Max spend per day (USD) | 10 |
X402_PER_MINUTE_LIMIT | Max spend per minute (USD) | 2 |
ag402 history| Error | Fix |
|---|---|
ag402: command not found | pip install ag402-core |
Insufficient balance | ag402 init (test) or deposit real USDC (production) |
Non-standard 402 response | Server is not x402-compatible |
On-chain payment failed | Check network: ag402 doctor |
Request timed out | Retry; check RPC connectivity |
Agent (exec) → ag402 CLI → x402 protocol → Solana USDC payment → API response
The agent uses exec to invoke ag402 pay <url>. The CLI handles the full
402 → negotiate → pay → retry → return flow transparently.