x402
Monetize any user project/service with the x402 payment protocol on platform networks (Base + Monad + Robinhood + X Layer + Solana; Starchild platform…
от Starchild-ai-agent★ 34 звезды на GitHub
Установить x402 в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
💸 x402 Monetization Skill
Turn any local HTTP service into a paid service on platform networks (Base +
Monad + Robinhood + X Layer; x402 V2 protocol, exact scheme, USDC/USDG via EIP-3009 —
buyer pays zero gas), and act as a buyer paying other agents' x402 services
with the user's Privy wallet.
Architecture: reverse-proxy sidecar. The gateway (gateway/app.py) sits in
front of the user's untouched service. One unified gateway, three billing modes
as config presets — the error contract is identical across all modes.
buyer agent ──402/PAYMENT-SIGNATURE──> gateway :840x ──plain HTTP──> user service :port
│
facilitator (verify + settle on Base/Monad/Robinhood/X Layer/Solana) ──USDC/USDG──> user's Privy wallet
Reference files (MUST read before the matching task)
Detailed material lives in skills/x402/references/ — it is part of this
skill. Do NOT guess or improvise what these files cover:
| Before you… | MUST first read_file |
|---|---|
| deploy ANY selling mode beyond basic pay_per_use (full commands, prepaid & multi-plan contracts, admin tokens, templates, gateway lifecycle, always-on/update-mode) | skills/x402/references/selling.md |
| enable / debug / explain limited-time free promotion (amount=0, no settle, P1–P5 ACL, buyer free flow, resource isolation, verify matrix) | skills/x402/references/selling.md → Limited-time free promotion |
| free-promo errors (still charged, upstream 401, amount not 0, wrong service unlocked) | skills/x402/references/troubleshooting.md → Limited-time free promotion |
| debug ANY other error (facilitator verify errors, error contract, security model, port ownership, proxy) | skills/x402/references/troubleshooting.md |
| use the session EOA signer, fund a buyer wallet, or pay on a non-Base-USDC chain/token | skills/x402/references/buying-advanced.md |
Limited-time free promotion (seller quick rules)
For a listed paid marketplace service the owner can open a free window
(max 90 days). Full playbook: references/selling.md → Limited-time free promotion.
Agent MUST:
- Not blind-PUT free-promo from a UI prompt — run P1–P5 self-check first.
- Remember free = wallet identity + amount 0 verify + no settle/debit, not anonymous and not a free lifetime subscription after the window.
- On platform gateway: amount-0 challenge and skip settle/debit are built-in.
- On custom upstream keys (P3/P4) or self-built x402: you MUST patch ACL /
force
amount="0"/ skip settle — see selling.md Step C. - Use x402
resource(path) for access isolation — never inventservice_idon the wire. - After enable: verify free-status, 402 amount=0, free call without settlement, then confirm paid path returns after cancel/expiry.
Buyer tip: if unpaid 402 shows accepts[].amount == "0", sign 0 (no USDC needed);
do not force list-price signing during free.
Sell — monetize a service (quick start)
FAC=https://starchild-x402-facilitator.fly.dev
# pay_per_use: verify -> settle on EVERY request (simplest mode)
# --networks defaults to "all" (Base + Monad + Robinhood + X Layer + Solana mainnet); the 402 challenge
# returns a multi-accepts list — the buyer picks one chain per payment.
python3 skills/x402/scripts/monetize.py --name my-api --upstream-port 5173 \
--mode pay_per_use --price 0.01 --facilitator $FAC
# lock to a single chain (custom)
python3 skills/x402/scripts/monetize.py --name my-api --upstream-port 5173 \
--mode pay_per_use --price 0.01 --networks eip155:8453 --facilitator $FAC
Platform modes follow the community-gateway billing contract: 402 JSON body
with accepts as a list (multi-accepts, one entry per network — the buyer
picks one chain per payment), accepts[].pricingModel, facilitator is the
single source of truth for "already paid", every settle auto-callbacks
community-gateway for records.
Billing mode decision table
| Mode | Tier | Buyer UX | When |
|---|---|---|---|
pay_per_use |
platform | X-PAYMENT each request, settled every call | simple data endpoints, agent-to-agent one-shots |
lifetime |
platform | pay once, permanent access (facilitator-verified) | one-time unlock, buyout pricing |
monthly |
platform | pay once per natural month | SaaS-style subscriptions |
weekly / quarterly / yearly |
platform | fixed-length pass: 7 / 90 / 365 days from newest payment | short trials, annual discounts |
prepaid |
platform | one on-chain deposit → off-chain debit per call | high-frequency / sub-cent / usage-metered APIs |
payperuse |
legacy | SDK V2 headers, pay per request | pre-2.0 deployments |
subscription |
extended | x402 top-up → API key + N credits, 1 credit/call | prepaid credits, avoids per-call payment latency |
metered |
extended | like subscription, route-weighted units | mixed cheap/expensive endpoints (LLM calls etc.) |
timepass |
e |
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- bazaar.py
- client.py
- gateway/app.py
- gateway/ledger.py
- gateway/platform_modes.py
- logo.png
- references/buying-advanced.md
- references/selling.md
- references/troubleshooting.md
- scripts/buy.py
- scripts/discover.py
- scripts/ensure_env.sh
- scripts/keepalive.sh
- scripts/make_public.py
- scripts/monetize.py
- scripts/preflight.py
- scripts/verify_setup.py
- setup.sh
- templates/lifetime.json
- templates/metered.json
- templates/monthly.json
- templates/multi_plan.json
- templates/pay_per_use.json
- templates/payperuse.json
- templates/prepaid.json
- templates/quarterly.json
- templates/subscription.json
- templates/timepass.json
- templates/weekly.json
- templates/yearly.json
FAQ
Что делает скилл x402?
Monetize any user project/service with the x402 payment protocol on platform networks (Base + Monad + Robinhood + X Layer + Solana; Starchild platform billing: pay_per_use / lifetime / weekly / monthly / quarterly / yearly / prepaid, plus multi-plan services), limited-time free promotions (amount-0 verify, no settle/debit), and pay other agents' x402 services. Use when the user wants to charge for an API/service, run a free promo on a paid listing, accept USDC from other agents, or call a paid x402 endpoint.
Как установить скилл x402?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл x402 запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…