buy-x402

buy-x402 is a skill for Claude Code, Codex from ObolNetwork/obol-stack. It costs 132 tokens per session (8,265 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

Which agent this was written for is unclear — built for openclaw. Also seen: mentions subagents; positional $N argument; built for openclaw.

Good fit 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.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/obolnetwork/obol-stack/buy-x402
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.

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/github.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/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for buy-x402

Your own site · 80×15
<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="Reviewed on agentmods" width="80" 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,265 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Data Exfiltration · line 523
    Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
    Fix: Verify the destination URL is trusted and necessary. Remove or replace with documented APIs. Ensure no secrets, tokens, or PII are transmitted.
How audits are shown
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.1 $0.00132 $0.08265
Opus 5.5 $0.00053 $0.03306
Sonnet 5.5 $0.00026 $0.01653
Haiku 4.5 $0.00013 $0.00826

Measured 6d ago against content hash 4fb7896d1f5a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 6d 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 · 547 lines

How it starts

The opening of the file, as written. The whole thing — 547 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/.hermes/obol-skills}/buy-x402/scripts/buy.py go <url> --message 'your task'

# Plain HTTP offer — one paid request:
python3 ${OBOL_SKILLS_DIR:-/data/.hermes/obol-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. go <url> --token OBOL --max-price 10 — the 10 OBOL quote is above the default 1-token per-call ceiling, see below), --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.

Read the full file on GitHub · 547 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. 6d ago Changed · +3 lines 4fb7896d1f5a
  2. 7d ago Changed · -9 lines 01d2a2f70e9a
  3. 14d ago Changed 188911fb91e7
  4. 1mo 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 today), licensed Apache-2.0. It adds 132 tokens to every session and 8,265 once invoked, about $0.0005 per session on Opus 5.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.