buy

A setup guide for using the x402 payment protocol to call APIs that require payment, with payment made in USDC on the Solana blockchain.

In plain words
What is it for?
Use it to connect an agent or script to paid x402 APIs, configure a wallet, and integrate the buyer client with tools such as Claude Code or Cursor.
Why use it?
It lets an AI agent or HTTP client respond to a payment-required response, pay for the request, and retry it with payment proof.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/aethercore-dev/ag402/buy
Any agent
npx skills add AetherCore-Dev/ag402 --skill buy
Clone the repo
git clone --depth 1 https://github.com/AetherCore-Dev/ag402

Made for: Claude Code, Codex.

Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,175 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 2 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00055 $0.02175
Opus 5 $0.00028 $0.01087
Sonnet 5 $0.00011 $0.00435
Haiku 4.5 $0.00006 $0.00217

Measured 2d ago against content hash 3ceb69a795b7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

buy scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads MCP configurationmediumAgent snooping

mcp.json carries server URLs and auth tokens; reading it lets a mod discover and abuse other integrations.

1. Restart the AI tool (or reload MCP config)

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

This injects `ag402_core.enable()` via `sitecustomize.py`, so all `urllib`/`httpx`/`requests` calls that receive 402 will be auto-paid. Works for any Python script.
.claude/skills/buy/SKILL.md · 270 lines

How it starts

The opening of the file, as written. The whole thing — 270 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Buy — Connect an AI Agent to Paid x402 APIs

Overview

This skill sets up the buyer side of the x402 payment protocol. It configures an AI agent (or any HTTP client) to automatically detect 402 Payment Required responses, pay on-chain in USDC on Solana, and retry the request with proof of payment — all transparently.

Result: The user's AI agent or script can call any x402-gated API and auto-pay.

When to Use

  • User says "buy", "pay for API", "auto-pay", "connect to paid API", or "use x402"
  • User wants to integrate ag402 into Claude Code, Cursor, or another AI tool
  • User wants their agent to autonomously pay for API calls
  • User wants to call an ag402 serve gateway from the buyer side

Step 1: Install (Silent)

Check that ag402 is installed. Only speak if something is missing.

ag402 --version

If this fails:

pip install ag402-core

For AI tool integration (MCP), also install:

pip install ag402-client-mcp

Step 2: Wallet Setup

If the user is present and can interact with the terminal, ask them to choose:

  • A) Quick start — test mode (recommended) → no wallet needed, 100 USDC test funds deposited automatically
  • B) I have a Solana wallet and want production mode → will need private key + ag402 upgrade

For option A (vast majority of users), run:

ag402 setup

ag402 setup is an interactive wizard with prompts (password input, confirmations). Let the user run it directly — do not try to automate or pipe input to it.

If you are operating autonomously (no human in the loop), use ag402 init instead:

ag402 init

ag402 init is non-interactive — it creates a test wallet and deposits $100 USDC with zero prompts. This is the correct command for AI agents acting autonomously.

After either command, verify:

ag402 balance

Expected: shows $100.00 test balance.

For option B, start with option A first (test mode), verify everything works, then upgrade:

Read the full file on GitHub · 270 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 270 lines · 55 tokens per session scan B 3ceb69a795b7

Subscribe to this mod's changes

buy is a skill published in the GitHub repository AetherCore-Dev/ag402 (9 stars, last pushed 1mo ago), licensed MIT. It adds 55 tokens to every session and 2,175 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it B with 2 findings (reads mcp configuration, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

squash-merge

Squash-merge a PR into zeroclaw-labs/zeroclaw master with fully preserved commit history in the squash message body. Use this skill when the user explicitly mentions squash-merging, merging a specific PR number, landing a PR, or 合入 — e.g. "squash-merge #123", "merge PR 456", "land #789", "合入 #123", "/squash-merge…

zeroclaw-labs/zeroclaw · 0 tokens

zeroclaw

Help users operate and interact with their ZeroClaw agent instance — through both the CLI (zeroclaw commands) and the REST/WebSocket gateway API. Use this skill whenever the user wants to: send messages to ZeroClaw, manage memory or cron jobs, check system status, configure channels or providers, hit the gateway API…

zeroclaw-labs/zeroclaw · 167 tokens

github-pr

Open or update a GitHub Pull Request for ZeroClaw. Handles creating new PRs with a fully filled-out template body, and updating existing PRs (title, body sections, labels, comments). Use this skill whenever the user wants to open a PR, create a pull request, update a PR, edit PR description, add labels to a PR, or…

zeroclaw-labs/zeroclaw · 0 tokens

feature-matrix-parity

Update the OpenClaw and Hermes comparison columns of the ZeroClaw feature-and-support matrix. Use this skill when the user wants to refresh, fill, or verify parity data in docs/book/feature-matrix-parity.toml, add a new comparison row or section to the feature matrix, or re-walk the competitor repos for support…

zeroclaw-labs/zeroclaw · 127 tokens

github-issue-triage

Issue triage and lifecycle management agent for ZeroClaw. Use this skill whenever the user wants to: triage open issues, close stale/duplicate/fixed issues, apply labels, run a backlog sweep, enforce the current issue stale policy, or handle a specific issue. Trigger on: 'triage issues', 'issue triage', 'sweep…

zeroclaw-labs/zeroclaw · 140 tokens

wit-breaking-change-check

Classify WIT interface changes as breaking or non-breaking against frozen version markers. Use this skill when the user wants to check WIT breaking changes, review a WIT diff, verify whether a WIT change is breaking, or run a WIT compat check. Trigger on: 'check WIT breaking changes', 'review WIT diff', 'is this WIT…

zeroclaw-labs/zeroclaw · 88 tokens