x402

x402 is a skill for Claude Code, Codex from Demerzels-lab/elsamultiskillagent. It costs 57 tokens per session (1,228 once invoked), scanned B, original, MIT.

A tool for paying for web APIs and other online resources with cryptocurrency through the x402 protocol, which uses an HTTP 402 payment response.

In plain words
What is it for?
Use it to pay for a request, respond to a payment-required reply, and retry the request with a signed payment.
Why use it?
It handles APIs that require payment before returning their data or service.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit Use it to pay for a request, respond to a payment-required reply, and retry the request with a signed payment.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/demerzels-lab/elsamultiskillagent/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 Demerzels-lab/elsamultiskillagent --skill x402
Clone the repo
git clone --depth 1 https://github.com/Demerzels-lab/elsamultiskillagent

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 x402

README.md
[![agentmods](https://agentmods.dev/badge/skills/demerzels-lab/elsamultiskillagent/x402/github.svg)](https://agentmods.dev/skills/demerzels-lab/elsamultiskillagent/x402)
Your own site
<a href="https://agentmods.dev/skills/demerzels-lab/elsamultiskillagent/x402"><img src="https://agentmods.dev/badge/skills/demerzels-lab/elsamultiskillagent/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 x402

Your own site · 80×15
<a href="https://agentmods.dev/skills/demerzels-lab/elsamultiskillagent/x402"><img src="https://agentmods.dev/badge/skills/demerzels-lab/elsamultiskillagent/x402.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 57 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,228 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 2 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00057 $0.01228
Opus 5 $0.00028 $0.00614
Sonnet 5 $0.00011 $0.00246
Haiku 4.5 $0.00006 $0.00123

Measured 9d ago against content hash 57b72da74f06, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade B, and why

x402 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 9d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/check-balance.sh, scripts/x402-fetch.ts), 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.

Sends data to an external URLmediumData exfiltration

A POST to an outside endpoint may be telemetry or may be exfiltration; either way the mod talks to somewhere, and you should know where.

const completion = await client.fetch('https://llm.example.com/v1/chat', { method: 'POST',

Makes network callslowCapability

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

## Manual Flow (curl)
public/skills/0xterrybit/x402/SKILL.md · 182 lines

How it starts

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

x402 Payment Protocol

x402 enables instant stablecoin payments directly over HTTP using the 402 Payment Required status code. Perfect for AI agents paying for APIs, data, or compute on-demand.

Quick Start

Install SDK

npm install x402
# or
pnpm add x402

Environment Setup

# Store wallet private key securely
export WALLET_PRIVATE_KEY="0x..."

# Optional: specify network RPC
export BASE_RPC_URL="https://mainnet.base.org"

How x402 Works

  1. Request → Client calls a paid API
  2. 402 Response → Server returns payment details in PAYMENT-REQUIRED header
  3. Pay & Retry → Client signs payment, retries with PAYMENT-SIGNATURE header
  4. Access → Server verifies, settles, returns resource

Using x402 Client

TypeScript/Node.js

import { x402Client } from 'x402';

const client = x402Client({
  privateKey: process.env.WALLET_PRIVATE_KEY,
  network: 'base', // or 'ethereum', 'arbitrum', etc.
});

// Automatic 402 handling
const response = await client.fetch('https://api.example.com/paid-endpoint');
const data = await response.json();

With fetch wrapper

import { wrapFetch } from 'x402';

const fetch402 = wrapFetch(fetch, {
  privateKey: process.env.WALLET_PRIVATE_KEY,
});

// Use like normal fetch - 402s handled automatically
const res = await fetch402('https://paid-api.com/data');

Manual Flow (curl)

Step 1: Discover payment requirements

curl -i https://api.example.com/paid-resource
# Returns 402 with PAYMENT-REQUIRED header (base64 JSON)

Step 2: Decode payment details

# The PAYMENT-REQUIRED header contains base64-encoded JSON:
# {
#   "amount": "1000000",      # 1 USDC (6 decimals)
#   "currency": "USDC",
#   "network": "base",
#   "recipient": "0x...",
#   "scheme": "exact"
# }

Step 3: Sign and pay

# Use x402 CLI or SDK to create payment signature
npx x402 pay \
  --amount 1000000 \
  --recipient 0x... \
  --network base

Read the full file on GitHub · 182 lines

Files

What ships with it

4 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. 9d ago First seen · 182 lines · 57 tokens per session scan B 57b72da74f06

Subscribe to this mod's changes

x402 is a skill published in the GitHub repository Demerzels-lab/elsamultiskillagent (10 stars, last pushed 4mo ago), licensed MIT. It adds 57 tokens to every session and 1,228 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it B with 2 findings (sends data to an external url, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.