buy-x402

buy-x402 is a skill for Claude Code, Codex from ObolNetwork/obol-stack. It costs 132 tokens per session (8,028 once invoked), scanned A, original, Apache-2.0.

A command-line buyer for services protected by x402, a payment flow that uses an HTTP 402 response to request payment. It examines the endpoint and chooses whether to pay for one HTTP request, one streamed agent call, or a longer inference session.

In plain words
What is it for?
Use it to pay for a remote HTTP service, a single streamed agent or chat request, or a pre-authorized pool of paid inference requests.
Why use it?
It removes the need to identify the payment flow and construct each request manually. For one-off purchases, it does not keep payment state between calls.

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/obolnetwork/obol-stack/buy-x402
Any agent
npx skills add ObolNetwork/obol-stack --skill buy-x402
Clone the repo
git clone --depth 1 https://github.com/ObolNetwork/obol-stack

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for buy-x402

README.md
[![agentmods](https://agentmods.dev/badge/skills/obolnetwork/obol-stack/buy-x402.svg)](https://agentmods.dev/skills/obolnetwork/obol-stack/buy-x402)
Your own site
<a href="https://agentmods.dev/skills/obolnetwork/obol-stack/buy-x402"><img src="https://agentmods.dev/badge/skills/obolnetwork/obol-stack/buy-x402.svg" alt="Measured on agentmods" height="20"></a>
Per session 132 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 8,028 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00132 $0.08028
Opus 5 $0.00066 $0.04014
Sonnet 5 $0.00026 $0.01606
Haiku 4.5 $0.00013 $0.00803

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

Security

Grade A, and why

buy-x402 scanned grade A with 1 finding 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 5d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/buy.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

Makes network callslowCapability

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

curl -X POST http://litellm.llm.svc.cluster.local:4000/v1/chat/completions \
internal/embed/skills/buy-x402/SKILL.md · 553 lines

How it starts

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

Buy x402

Purchase access to remote x402-gated services.

Not sure which command? Use go. It probes the URL, reads the 402 to detect what's being sold, and dispatches with the right path, method, streaming mode, and timeout:

# Agent or chat-inference offer — one paid round of work, streamed:
python3 ${OBOL_SKILLS_DIR:-/data/.openclaw/skills}/buy-x402/scripts/buy.py go <url> --message 'your task'

# Plain HTTP offer — one paid request:
python3 ${OBOL_SKILLS_DIR:-/data/.openclaw/skills}/buy-x402/scripts/buy.py go <url>

go never creates persistent state; for a pre-authorized inference pool it points you at buy. The expert flows underneath, picked by usage shape:

  • pay <url> — single-shot. Probe the URL, sign one payment authorization, attach X-PAYMENT, send the request, return the response. Stateless. Use for type:http services and any one-off purchase. Max loss = price of one request. Settlement normally lands only after the request succeeds — but a facilitator can submit the settle tx on-chain and then fail the request. When that happens the failure report prints ⚠️ SETTLEMENT MAY HAVE COMPLETED ON-CHAIN with the tx hash: verify with balance --chain <X> before retrying (mechanism: docs/observability.md, "Verify settlement against the chain"). Applies to pay-agent too.
  • pay-agent <url> — single-shot paid streaming agent call. Same payment shape as pay (one auth, X-PAYMENT, max-loss = price), but POSTs to <url>/v1/chat/completions with stream: true and forwards every SSE event verbatim to stdout as it arrives. No --model: a type:agent offer runs its own model (the request model field is ignored), so you only send a prompt. Use this for type:agent ServiceOffers when the calling agent wants to consume the response itself (memory, tool-call traces, partial results) instead of routing it through LiteLLM as a paid alias. Default HTTP read timeout is 1 hour — agent calls can legitimately run for many minutes; override with --timeout <seconds>.
  • buy <name> — pre-authorize a budget. Sign N authorizations up front (the buyer pays nothing yet), declare them in a PurchaseRequest CR, let the x402-buyer sidecar redeem them transparently as the agent calls the model through LiteLLM at paid/<remote-model>. Use for long-running paid inference. Max loss = N × price (only as vouchers are spent); runtime path holds zero signer access.
  • buy <name> --model <id> --set-default — same as buy above, then adopt paid/<remote-model> as the agent's own primary model, in-pod, by itself: an atomic hermes config set model.default that Hermes re-reads per request (effective next chat turn, no restart, no host-side obol model prefer/obol model sync). Refuses if the model isn't selectable in LiteLLM. Pair with --auto-refill so the primary model doesn't brick when the pre-authorized budget runs out.

Both flows auto-detect the token + transfer method from the seller's 402 response. Currently supported: USDC via EIP-3009 (Base Sepolia, Base Mainnet, Ethereum Mainnet) and OBOL via Permit2 (Ethereum Mainnet).

Multi-currency offers (pick what you pay with). A seller can advertise several payment options (e.g. 1 USDC on Base OR 10 OBOL on Ethereum) in the 402 accepts[] array. probe lists them all. For go, pay, pay-agent, and buy, choose one with --token <SYMBOL> (e.g. --token OBOL), --network <chain>, and/or --payment-option <N> (the 1-based index from probe). With a single option the choice is automatic. With several and no selector: a TTY prompts; non-interactive runs auto-select the first option the wallet can afford (announced loudly, with the full option list, before any signing). --token/--network also act as a guard — if the filter matches no advertised option, it aborts rather than paying the wrong asset.

Money amounts (--budget, --cost-cap). Both accept atomic units (1500000), token units (1.5), or token units with a symbol ('1.5 USDC', '$1.50'). Anything with a decimal point, symbol, or $ is treated as token units and scaled by the asset's decimals; the parsed interpretation is echoed before signing. A symbol that contradicts the asset being paid with aborts.

Read the full file on GitHub · 553 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 5d ago First seen · 553 lines · 132 tokens per session scan A 801fc6e94a8a

Subscribe to this mod's changes

buy-x402 is a skill published in the GitHub repository ObolNetwork/obol-stack (11 stars, last pushed yesterday), licensed Apache-2.0. It adds 132 tokens to every session and 8,028 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

kurtosis-ethereum

Run Ethereum multi-client devnets using Kurtosis and the ethpandaops/ethereum-package. Use for spinning up local devnets, syncing public testnets, validating cross-client interop, testing fork transitions, shadowforks, running assertoor checks, debugging CL/EL client interactions, or verifying new feature…

ethpandaops/ethereum-package · 78 tokens

defi

Interact with DeFi protocols on MAINNET via the ChainGPT plugin. Aave V3 (supply/borrow/repay/withdraw + health-factor monitoring across 7 chains), Lido stETH staking, EigenLayer restaking. Yield discovery: Pendle yield-trading markets (PT/YT), Morpho Blue lending markets + MetaMorpho vaults. Custody-free — plugin…

ChainGPT-org/chaingpt-claude-skill · 186 tokens

scheduled-autonomy

Run trading/DeFi strategies on a schedule — DCA every morning, grid rebalances, recurring health checks — using saved plans + the execution journal (duesteps/markstep) + Claude Code scheduled agents, with the agent wallet executing inside hard policy caps. Triggers - run this daily, schedule a DCA, recurring buy, set…

ChainGPT-org/chaingpt-claude-skill · 92 tokens

trade

Execute live DEX trades on MAINNET via the ChainGPT plugin. EVM swaps via OpenOcean (default, no key, 10 mainnets), 1inch v6 (key-gated, better blue-chip routing), or CoW Protocol (MEV-protected intent-based for large trades). Solana swaps via Jupiter. Custody-free — the plugin builds unsigned tx / EIP-712 intent, the…

ChainGPT-org/chaingpt-claude-skill · 171 tokens

drift

Read live Drift Protocol mainnet data — Solana's largest non-custodial perps DEX. Use for market scanning, funding analysis, orderbook depth, and user position auditing. The Solana-native alternative to Hyperliquid: same custody-free model (on-chain collateral, user-held keys), different blockchain. Read-only in this…

ChainGPT-org/chaingpt-claude-skill · 133 tokens

tron

Tron (TVM) support via the ChainGPT plugin — at parity with the EVM + Solana surfaces. Read balances/resources/tx, research (DexScreener), risk (GoPlus), build UNSIGNED native TRX + TRC-20 transfers (custody-free), SunSwap quotes, JustLend lending, and autonomous agent-wallet signing behind a deterministic policy…

ChainGPT-org/chaingpt-claude-skill · 138 tokens