NeuralPay - AI Agent Payment Skill. Discover products, purchase with x402, transfer funds to other agents, and manage identity using Turnkey-backed wallets. Supports Polkadot, Base, Ethereum, and more.
Autonomous Payments for AI Agents / AI代理自主支付
Enable AI agents to discover products, make x402 payments, transfer funds to other agents, and manage identity automatically using Turnkey HSM-backed wallets. No manual signing required - just provide your API key and let the agent handle everything.
让AI代理发现产品、进行x402支付、向其他代理转账并自动管理身份,使用Turnkey HSM支持的钱包。无需手动签名 - 只需提供API密钥,让代理自动处理一切。
✅ USE this skill when: / 使用此技能:
❌ DON'T use this skill when: / 不要使用:
| Feature / 功能 | Description / 描述 | Command / 命令 |
|---|---|---|
| 🔍 Discovery | Discover products, plans & payment info / 发现产品、计划和支付信息 | discover |
| 📦 Products | Browse available products / 浏览可用产品 | products |
| 📋 Plans | Browse subscription plans / 浏览订阅计划 | plans |
| 💳 Purchase | Buy products (auto-checks existing access) / 购买产品(自动检查现有访问) | purchase <slug> |
| 📝 Subscribe | Subscribe to plans / 订阅计划 | subscribe <id> |
| 🔐 Access Check | Verify access without payment / 验证访问无需支付 | check-access |
| 📜 History | View transaction history / 查看交易历史 | history |
| 👛 Wallet Info | Get agent wallet details / 获取代理钱包信息 | wallet |
| 💰 Balance | Check token balance / 检查代币余额 | balance |
| 📋 Mandate | Verify spending limits / 验证消费限额 | mandate |
| Feature / 功能 | Description / 描述 | Command / 命令 |
|---|---|---|
| 💸 Transfer | Send funds to agent or wallet / 向代理或钱包发送资金 | transfer <to> <amount> |
| 📤 Transfers | View transfer history / 查看转账历史 | transfers |
| 🔍 Resolve | Resolve recipient before transfer / 转账前解析收款人 | resolve-recipient <id> |
| Feature / 功能 | Description / 描述 | Command / 命令 |
|---|---|---|
| 🔎 Whois | Look up agent by @handle, DID, or wallet / 通过@handle、DID或钱包查找代理 | whois <identifier> |
| 🤖 Agents | Discover public agents / 发现公开代理 | agents |
| 👤 Profile | View agent's full profile / 查看代理完整资料 | profile <handle> |
| 📄 DID | Get agent's DID document / 获取代理的DID文档 | did <identifier> |
| Network / 网络 | Chain ID | Status / 状态 |
|---|---|---|
| Polkadot Testnet | eip155:420420417 | ✅ Active |
| Base | eip155:8453 | ✅ Active |
| Ethereum | eip155:1 | ✅ Active |
| Polygon | eip155:137 | ✅ Active |
| Base Sepolia | eip155:84532 | ✅ Testnet |
| Model / 模型 | Description / 描述 | Access Behavior / 访问行为 |
|---|---|---|
one_time | One-time purchase / 一次性购买 | Permanent access / 永久访问 |
per_call | Pay per API call / 按API调用付费 | Deducts on each use / 每次使用扣除 |
per_request | Pay per request / 按请求付费 | Deducts on each use / 每次使用扣除 |
per_token | Pay per token / 按Token付费 | Deducts based on usage / 根据使用量扣除 |
weekly | Weekly subscription / 每周订阅 | Access until expiry / 访问直到过期 |
monthly | Monthly subscription / 每月订阅 | Access until expiry / 访问直到过期 |
annual | Annual subscription / 年度订阅 | Access until expiry / 访问直到过期 |
AI agents MUST run these commands directly in the terminal. Do NOT just display the commands - actually execute them!
Execution Pattern:
Example - Run this directly:
export NEURALPAY_API_KEY="npak_your_api_key_here" && ./neuralpay.sh discover
Or chain multiple commands:
export NEURALPAY_API_KEY="npak_your_api_key_here" && ./neuralpay.sh products --format json
Key Rules for AI Agents:
&& before the command--format json when you need to parse the output programmaticallyFirst, set your NeuralPay API key:
export NEURALPAY_API_KEY="npak_your_api_key_here"
export NEURALPAY_API_URL="http://localhost:8181/v1" # Optional
# Discover everything - products, plans, payment info
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh discover
# List all available products
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh products
# Filter products by category
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh products --category api
# Filter products by pricing model
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh products --pricing-model per_call
# Filter products by max price (in USD)
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh products --max-price 10
# List all subscription plans
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh plans
# Filter plans by interval
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh plans --interval month
# Purchase a product (checks existing access first!)
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh purchase my-api-access
# Subscribe to a plan
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh subscribe pro-plan-abc123
# Check access to a specific product
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh check-access --product my-api-access
# Check access to a specific plan
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh check-access --plan pro-plan-abc123
# Check all active access for your wallet
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh check-access
# View transaction history
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh history
# View history with pagination
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh history --limit 10 --offset 0
# Get wallet info
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh wallet
# Check USDC balance
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh balance
# Check balance on specific network
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh balance --network eip155:8453
# Check mandate/spending limits
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh mandate
# Check if specific payment is allowed
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh mandate --amount 5000000 --recipient 0x1234...
# Transfer to another agent by handle
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh transfer @data-bot 1000000
# Transfer to agent by DID
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh transfer did:npay:abc123xyz 500000
# Transfer to wallet address
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh transfer 0x1234...abcd 2000000
# Transfer with memo
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh transfer @shopping-bot 1000000 --memo "Payment for API usage"
# View transfer history
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh transfers
# View transfers with pagination
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh transfers --limit 10 --offset 0
# Resolve recipient before transferring
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh resolve-recipient @data-bot
# Look up agent by handle
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh whois @shopping-bot
# Look up agent by DID
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh whois did:npay:abc123xyz
# Look up agent by wallet address
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh whois 0x1234...abcd
# Discover all public agents
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh agents
# Discover agents by category
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh agents --category trading
# Discover agents by capabilities
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh agents --capabilities payments,trading
# Discover agents with minimum trust score
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh agents --min-trust-score 70
# Search agents by keyword
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh agents --query "shopping"
# View agent's full profile
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh profile @shopping-bot
# Get agent's DID document
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh did @shopping-bot
# Any command can output JSON for programmatic use
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh discover --format json
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh products --format json
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh check-access --product my-api --format json
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh transfer @bot 1000000 --format json
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh agents --format json
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh whois @shopping-bot --format json
| Variable / 变量 | Description / 描述 | Required / 必需 |
|---|---|---|
NEURALPAY_API_KEY | Your agent API key (npak_...) / 代理API密钥 | ✅ Yes |
NEURALPAY_API_URL | API base URL (default: http://localhost:8181/v1) / API基础URL | ❌ No |
NEURALPAY_NETWORK | Default network (default: eip155:420420417) / 默认网络 | ❌ No |
neuralpay discoverDiscover all available products, plans, and payment protocol info.
$ neuralpay discover
🔍 NeuralPay Discovery
├─ API: NeuralPay API
├─ Version: 1.0
├─ Products: 5
├─ Plans: 3
└─ Protocol: x402 v1.0
📦 Available Products:
├─ 🤖 GPT-4 API Access - $5.00 USDC (per_call)
├─ 🔍 Neural Search Pro - $10.00 USDC (per_request)
└─ 📊 Analytics API - $25.00 USDC (monthly)
📋 Available Plans:
├─ Starter Plan - $9.99 USDC/month
├─ Pro Plan - $29.99 USDC/month
└─ Enterprise - $99.99 USDC/annual
neuralpay productsList available products with optional filtering.
$ neuralpay products --pricing-model per_call
📦 Discoverable Products (2)
├─ 🤖 GPT-4 API Access
│ ├─ Slug: gpt4-api-access
│ ├─ Price: $5.00 USDC
│ ├─ Model: Per Call
│ ├─ Requests: 1000
│ ├─ Category: ai
│ └─ Tags: llm, gpt, ai
└─ 🔊 Speech-to-Text API
├─ Slug: speech-to-text-api
├─ Price: $2.00 USDC
├─ Model: Per Call
└─ Category: ai
neuralpay transfer <to> <amount>Transfer funds to another agent or wallet address.
$ neuralpay transfer @data-bot 1000000
✅ Transfer Successful
────────────────────────────────────────
│ From: 0x742d35...f8dB21
│ To: 0x1234ab...cd5678
│ Recipient: @data-bot
│ Amount: 1.00 USDC
│ Network: eip155:420420417
│ Token: USDC
────────────────────────────────────────
│ TX Hash: 0xabc123...def456
Recipient formats supported:
@handle - Agent handle (e.g., @shopping-bot)did:npay:xxx - Agent DID (e.g., did:npay:abc123xyz)0x... - Wallet address (e.g., 0x1234...abcd)neuralpay whois <identifier>Look up an agent's identity by handle, DID, wallet, or ID.
$ neuralpay whois @shopping-bot
🤖 Agent Identity
├─ Resolved by: handle
──────────────────────────────────────────────────
│ Handle: @shopping-bot
│ DID: did:npay:7g3kp9xm2vh8cqrtnwy4jf6b
│ Name: Shopping Assistant v2
│ Wallet: 0x742d35...f8dB21
──────────────────────────────────────────────────
│ Category: shopping
│ Capabilities: payments, trading
│ Trust Score: █████████░ 85/100
│ Verification: ✅ Verified
│ Status: ✅ Active
──────────────────────────────────────────────────
│ Transactions: 150
│ Volume: $2500.00
│ Success Rate: 98%
neuralpay agentsDiscover public agents with optional filters.
$ neuralpay agents --category trading --min-trust-score 70
🔍 Agent Discovery
├─ Found: 3 agent(s)
├─ Page: 1
────────────────────────────────────────────────────────────
├─ @trading-bot-pro ✓
│ ├─ Trading Bot Pro
│ ├─ trading | Trust: 🟢 92
│ ├─ Capabilities: payments, trading, analytics
│ └─ Wallet: 0x1234...abcd
├─ @alpha-trader
│ ├─ Alpha Trader AI
│ ├─ trading | Trust: 🟢 85
│ ├─ Capabilities: payments, trading
│ └─ Wallet: 0x5678...efgh
└─ @dex-aggregator ★
├─ DEX Aggregator Agent
├─ trading | Trust: 🟢 95
├─ Capabilities: payments, trading, data-analysis
└─ Wallet: 0x9abc...ijkl
neuralpay profile <handle>View an agent's full public profile.
$ neuralpay profile @shopping-bot
🤖 Agent Profile
══════════════════════════════════════════════════
│ @shopping-bot ✓
│ Shopping Assistant v2
──────────────────────────────────────────────────
│ Bio: AI-powered shopping assistant that finds the best deals
──────────────────────────────────────────────────
│ DID: did:npay:7g3kp9xm2vh8cqrtnwy4jf6b
│ Wallet: 0x742d35Cc6634C0532925a3b844Bc9e7595f8dB21
│ Networks: eip155:420420417, eip155:8453
──────────────────────────────────────────────────
│ Category: shopping
│ Capabilities: payments, trading, web-scraping
│ Tags: shopping, deals, ecommerce
──────────────────────────────────────────────────
│ Trust Score: █████████░ 85/100
│ Verification: ✅ Verified
│ Transactions: 150
│ Volume: $2500.00 USD
│ Success Rate: 98%
──────────────────────────────────────────────────
│ Member Since: 1/15/2025
│ Website: https://shopping-bot.ai
══════════════════════════════════════════════════
neuralpay did <identifier>Get an agent's W3C-compatible DID document.
$ neuralpay did @shopping-bot --format json
{
"@context": ["https://www.w3.org/ns/did/v1"],
"id": "did:npay:7g3kp9xm2vh8cqrtnwy4jf6b",
"controller": "did:npay:7g3kp9xm2vh8cqrtnwy4jf6b",
"verificationMethod": [{
"id": "did:npay:7g3kp9xm2vh8cqrtnwy4jf6b#wallet",
"type": "EcdsaSecp256k1RecoveryMethod2020",
"blockchainAccountId": "eip155:1:0x742d35Cc..."
}],
"service": [{
"id": "did:npay:7g3kp9xm2vh8cqrtnwy4jf6b#payments",
"type": "PaymentService",
"serviceEndpoint": "https://api.neuralpay.com/agents/shopping-bot/pay"
}]
}
├─ Model: Per Call
├─ Requests: 500
├─ Category: ai
└─ Tags: audio, transcription
neuralpay purchase <slug>Purchase a product or access an existing purchase. Will NOT charge you twice!
# First purchase - payment required
$ neuralpay purchase gpt4-api-access
💳 Purchase Successful!
├─ Product: GPT-4 API Access
├─ Amount: $5.00 USDC
├─ TX Hash: 0x1234...abcd
├─ Network: eip155:420420417
├─ Access Type: Per Call
├─ Remaining Requests: 1000
└─ Status: ✅ Active
# Second call - no payment, access granted!
$ neuralpay purchase gpt4-api-access
✅ Access Granted!
├─ Product: GPT-4 API Access
├─ Message: Access granted (request deducted)
├─ Remaining Requests: 999
└─ Status: ✅ Active
neuralpay check-accessCheck access without triggering payment.
$ neuralpay check-access --product gpt4-api-access
🔐 Access Check
├─ Wallet: 0xF3Eb9e...2987
├─ Product: GPT-4 API Access (gpt4-api-access)
├─ Access: ✅ Granted
├─ Reason: 999 requests remaining
├─ Remaining Requests: 999
└─ Checked: 2025-01-15T10:30:00Z
$ neuralpay check-access --plan pro-plan-abc123
🔐 Access Check
├─ Wallet: 0xF3Eb9e...2987
├─ Plan: Pro Plan (pro-plan-abc123)
├─ Access: ✅ Granted
├─ Reason: Subscription active until 2025-02-15
├─ Expires: 2025-02-15
└─ Checked: 2025-01-15T10:30:00Z
neuralpay historyView transaction history for your wallet.
$ neuralpay history
📜 Transaction History (3)
├─ Wallet: 0xF3Eb9e...2987
├─ ✅ product_purchase
│ ├─ Amount: $5.00 USDC
│ ├─ TX: 0x1234...abcd
│ └─ Date: 2025-01-15T10:00:00Z
├─ ✅ plan_purchase
│ ├─ Amount: $29.99 USDC
│ ├─ TX: 0x5678...efgh
│ └─ Date: 2025-01-14T15:30:00Z
└─ ✅ product_purchase
├─ Amount: $2.00 USDC
├─ TX: 0x9abc...ijkl
└─ Date: 2025-01-13T09:15:00Z
Agent NeuralPay Backend
│ │ │
│── purchase <slug> ──────►│ │
│ │── Check wallet ──────►│
│ │◄── Wallet: 0xABC... ──│
│ │ │
│ │── Check access ──────►│
│ │ (Transaction DB) │
│ │ │
│ ┌─────────────────────────────────────────────┐
│ │ IF: Access exists (per_call with remaining) │
│ └─────────────────────────────────────────────┘
│ │◄── Has 50 requests ───│
│ │── Decrement usage ───►│
│◄── ✅ Access Granted ────│◄── 49 remaining ──────│
│ (no payment!) │ │
│ │ │
│ ┌─────────────────────────────────────────────┐
│ │ IF: No access or expired │
│ └─────────────────────────────────────────────┘
│ │◄── No access ─────────│
│ │ │
│ │── Auto-sign payment ─►│
│ │ (Turnkey HSM) │
│ │◄── Payment settled ───│
│ │ │
│ │── Record transaction ►│
│◄── 💳 Purchase Success ──│◄── Recorded ──────────│
│ (with TX hash) │ │
accessExpiresAt| Model | Control Mechanism |
|---|---|
per_call / per_request | requestsUsed vs requestsIncluded |
per_token | tokensUsed vs tokensIncluded |
weekly / monthly / annual | accessExpiresAt vs current time |
one_time | Permanent after first purchase |
Agents operate within defined spending limits:
❌ Error: Agent authentication required
Solution / 解决方案:
NEURALPAY_API_KEY environment variable / 设置环境变量npak_ / 验证API密钥以npak_开头💰 Payment Required
├─ Product: GPT-4 API Access
├─ Price: $5.00 USDC
└─ Status: ⏳ Awaiting Payment
This means / 这意味着:
🔐 Access Check
├─ Access: ❌ Denied
└─ Reason: All purchased requests have been used
Solution / 解决方案:
neuralpay purchase <slug> / 购买更多请求neuralpay check-access / 检查剩余额度❌ Error: Mandate rejected: Exceeds per-transaction limit
Solution / 解决方案:
neuralpay mandate / 检查授权限额⚠️ AI Agents: Execute these commands directly in terminal!
# 1. Discover what's available
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh discover
# 2. Find a suitable product
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh products --category ai --max-price 10
# 3. Check if we already have access
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh check-access --product gpt4-api-access
# 4. Purchase if needed (won't double-charge!)
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh purchase gpt4-api-access
# 5. Use the API (access is automatic)
# ... make API calls ...
# 6. Check remaining requests
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh check-access --product gpt4-api-access
# Check available plans
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh plans
# Subscribe to pro plan
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh subscribe pro-plan-abc123
# Verify subscription is active
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh check-access --plan pro-plan-abc123
# View all transactions
export NEURALPAY_API_KEY="$NEURALPAY_API_KEY" && ./neuralpay.sh history
const { NeuralPaySkill } = require('neuralpay-skill');
const skill = new NeuralPaySkill(process.env.NEURALPAY_API_KEY);
// Discover products
const discovery = await skill.discover({ format: 'json' });
console.log(JSON.parse(discovery));
// Check access before using
const access = await skill.checkAccess({
productSlug: 'gpt4-api-access',
format: 'json'
});
const accessData = JSON.parse(access);
if (!accessData.access.hasAccess) {
// Purchase if no access
await skill.purchase('gpt4-api-access');
}
// Now use the product...
This skill is maintained by the NeuralPay team.
Contributions welcome! / 欢迎贡献!
MIT License