agent-payment-x402
Allows AI agents to make payments with per-task budgets and spending controls. It uses non-custodial wallets and supports various blockchain networks for payments.
What it does
This tool allows an AI agent to pay for services or APIs. It controls how much the agent can spend on each task or session, using a digital wallet that the agent controls itself.
When to use it
- ✓When an agent needs to pay for an API.
- ✓When an agent needs to purchase a service.
- ✓When spending limits need to be set for each agent task.
Example of what to ask your AI
“Pay for the analysis of this image using the computer vision API.”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
When the agent needs to pay, it uses a special protocol (x402) that negotiates the price and checks if there are sufficient funds. Then, it makes the payment using a secure digital wallet that it manages itself, without anyone needing to hold the money for it.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add affaan-m/ECC --skill agent-payment-x402Or download just the file:
curl -L https://raw.githubusercontent.com/affaan-m/ECC/main/skills/agent-payment-x402/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
Agent Payment Execution (x402)
Enable AI agents to make policy-gated payments with built-in spending controls. Uses the x402 HTTP payment protocol and MCP tools so agents can pay for external services, APIs, or other agents without custodial risk.
When to Use
Use when: your agent needs to pay for an API call, purchase a service, settle with another agent, enforce per-task spending limits, or manage a non-custodial wallet. Pairs naturally with cost-aware-llm-pipeline and security-review skills.
Decision Tree
Choose the integration path based on whether your agent is buying access to a paid API or charging others for one:
| Need | Recommended path |
|---|---|
| Agent pays a 402-gated API on Base or another agentwallet-supported chain | Use agentwallet-sdk as an MCP payment server with strict spending policy |
| Agent pays a 402-gated API on X Layer | Use OKX Agent Payments Protocol from okx/onchainos-skills; okx-x402-payment is a deprecated legacy alias |
| Agent pays a 402-gated API on Solana or another x402 v2 network | Wrap the agent's HTTP client with the upstream @x402/fetch or @x402/axios package and register the EVM/SVM schemes; the resource server's facilitator verifies and settles |
| API charges agents on Solana or multiple networks (TypeScript, Python, or Go) | Use the upstream x402 middleware from x402-foundation/x402 — @x402/express, @x402/hono, @x402/next, or @x402/fastify for TypeScript, x402 for Python, github.com/x402-foundation/x402/go/v2 for Go |
| TypeScript API charges agents | Use OKX Payments TypeScript seller SDK docs for Express, Hono, Fastify, or Next.js |
| Go API charges agents | Use OKX Payments Go seller SDK docs for Gin, Echo, or net/http |
| Rust API charges agents | Use OKX Payments Rust seller SDK docs for Axum |
| Java API charges agents | Use OKX Payments Java seller SDK docs for Spring Boot 2/3, Java EE, or Jakarta |
| Python API charges agents | Check the current OKX Payments repository before implementation; a Python seller guide may not be available |
Supported Networks
agentwallet-sdk: use the package docs to confirm current network coverage before production. Base Sepolia is the safest development default; Base mainnet is the production path called out by the original skill.- OKX Payments / X Layer: current seller docs target X Layer (
eip155:196) and USDT0 settlement. Fetch current SDK docs before generating production code because payment packages and facilitator behavior can change quickly. - Upstream x402 packages: multi-network by design — one route can advertise Base and Solana simultaneously and let the buyer pick. The packages default to the
x402.orgfacilitator, which is testnet-only (Base Sepoliaeip155:84532, Solana devnetsolana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1, plus Stellar, Aptos, Hedera, and XRPL testnets) and is not intended for mainnet routes. For mainnet (solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpfor Solana), either self-facilitate, run your own facilitator, or pick a hosted one from the upstream facilitator list — see the facilitator comparison under Option C. Confirm live coverage at the facilitator's/supportedendpoint before production rather than hardcoding it here.
How It Works
x402 Protocol
x402 extends HTTP 402 (Payment Required) into a machine-negotiable flow. When a server returns 402, the agent's payment tool negotiates price, checks budget, signs a transaction, and retries only inside the policy and confirmation boundary set by the orchestrator.
Spending Controls
Every payment tool call enforces a SpendingPolicy:
- Per-task budget — max spend for a single agent action
- Per-session budget — cumulative limit across an entire session
- Allowlisted recipients — restrict which addresses/services the agent can pay
- Rate limits — max transactions per minute/hour
Non-Custodial Wallets
Agents hold their own keys via ERC-4337 smart accounts. The orchestrator sets policy before delegation; the agent can only spend within bounds. No pooled funds, no custodial risk.
MCP Integration
The payment layer exposes standard MCP tools that slot into any Claude Code or agent harness setup.
Security note: Always pin the package version. This tool manages private keys — unpinned
npxinstalls introduce supply-chain risk.
Option A: agentwallet-sdk (Base / multi-chain)
{
"mcpServers": {
"agentpay": {
"command": "npx",
…
FAQ
What does 'non-custodial' mean?
It means the agent (or you) has full control of the wallet keys and funds, without relying on a third party to hold the money.
What is an 'orchestrator'?
It is the system or person that sets the rules and spending limits for the agent before it starts working.
What payment networks are supported?
It supports networks like Base, X Layer, and Solana, as well as other EVM-compatible networks, depending on the specific configuration.
Details
Original description by the author
Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk, X Layer through OKX Payments / OKX Agent Payments Protocol, and Solana plus multi-network EVM through the upstream x402 packages with facilitator-based settlement. Use when an agent must pay for something itself and needs per-task budgets, spending con
repo: affaan-m/ECC
Popularity
- GitHub stars
- 280k
- Ranking position
- #133
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
accessibility
Helps your agent create interfaces that everyone can use. Ensures websites and apps work well for people with disabilities, like those who are blind or have reduced mobility.
affaan-m/ECC
agent-architecture-audit
Makes your agent check if everything is working correctly. It finds and fixes problems in AI systems, ensuring they perform as expected.
affaan-m/ECC
agent-eval
Helps your agent compare different AI coding tools. It measures which one is faster, cheaper, and more reliable for specific tasks.
affaan-m/ECC
agent-harness-construction
Makes your agent better understand how to perform tasks. It optimizes the tools and instructions the agent uses to increase its chances of success.
affaan-m/ECC
Similar skills
mcp-builder
Helps your agent create servers that connect LLMs to external services. Essential for integrating APIs and services using Python or Node/TypeScript.
anthropics/skills
prepare-mcp-integration
Prepares vendor (MCP) integrations through research and human approval. It follows a guided process for new integrations.
paperclipai/paperclip
first-task
Guides the agent on the user's first task. It interprets the initial answer, clarifies the goal, and proposes a plan or single task for approval.
paperclipai/paperclip