x402

x402 is a skill for Claude Code from Tyler-R-Kendrick/agent-skills. It costs 94 tokens per session (1,202 once invoked), scanned A, original, MIT.

An HTTP-based way for clients to pay small amounts of stablecoin cryptocurrency for access to an API or online service. A server can request payment, the client can sign it, and a facilitator can verify and settle it.

In plain words
What is it for?
Use it to add micropayments to API endpoints, implement server payment middleware, build client payment flows, connect a payment facilitator, and accept stablecoin payments.
Why use it?
It lets an API charge programmatically without requiring user accounts, sessions, or a traditional payment processor. This is useful when software or AI agents need to pay automatically for individual requests.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: positional $N argument.

Part of the agent-skills plugin — 57 skills shipped together

Good fit Use it to add micropayments to API endpoints, implement server payment middleware, build client payment flows, connect a payment facilitator, and accept stablecoin payments.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tyler-r-kendrick/agent-skills/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 Tyler-R-Kendrick/agent-skills --skill x402
Clone the repo
git clone --depth 1 https://github.com/Tyler-R-Kendrick/agent-skills

Made for: Claude Code.

Or install agent-skills, the plugin that ships this one along with the rest of its 57 skills.

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/tyler-r-kendrick/agent-skills/x402/github.svg)](https://agentmods.dev/skills/tyler-r-kendrick/agent-skills/x402)
Your own site
<a href="https://agentmods.dev/skills/tyler-r-kendrick/agent-skills/x402"><img src="https://agentmods.dev/badge/skills/tyler-r-kendrick/agent-skills/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/tyler-r-kendrick/agent-skills/x402"><img src="https://agentmods.dev/badge/skills/tyler-r-kendrick/agent-skills/x402.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 94 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,202 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.
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.00094 $0.01202
Opus 5 $0.00047 $0.00601
Sonnet 5 $0.00019 $0.00240
Haiku 4.5 $0.00009 $0.00120

Measured 11d ago against content hash 09018b6a30fd, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

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 11d 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.

Makes network callslowCapability

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

let response = await fetch(url);
skills/ai/x402/SKILL.md · 140 lines

How it starts

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

x402 — HTTP Payment Protocol

Overview

x402 is an open payment protocol from Coinbase that revives the HTTP 402 (Payment Required) status code for instant, automatic stablecoin micropayments. It enables APIs and services to be monetized natively over HTTP — no accounts, sessions, or traditional payment processors required. Both human clients and AI agents can pay programmatically.

How It Works

Client                          Server                      Facilitator
  │                               │                             │
  │── GET /weather ──────────────►│                             │
  │◄── 402 Payment Required ─────│                             │
  │    (price, payTo, network)    │                             │
  │                               │                             │
  │── sign payment ──────────────►│                             │
  │   (PAYMENT-SIGNATURE header)  │── verify + settle ────────►│
  │                               │◄── confirmation ────────────│
  │◄── 200 OK (content) ─────────│                             │

Server Middleware

Express (TypeScript)

import { paymentMiddleware, x402ResourceServer } from "@x402/express";
import { ExactEvmScheme } from "@x402/evm/exact/server";
import { HTTPFacilitatorClient } from "@x402/core/server";

const resourceServer = new x402ResourceServer(
  new HTTPFacilitatorClient({ url: "https://x402.org/facilitator" })
);
resourceServer.register("eip155:84532", new ExactEvmScheme());

app.use(paymentMiddleware(
  {
    "GET /weather": {
      accepts: {
        scheme: "exact",
        price: "$0.001",
        network: "eip155:84532",
        payTo: "0xYourAddress",
      },
    },
  },
  resourceServer,
));

Flask (Python)

from flask import Flask
from x402.flask.middleware import PaymentMiddleware

app = Flask(__name__)
payment_middleware = PaymentMiddleware(app)

payment_middleware.add(
    path="/weather",
    price="$0.001",
    pay_to_address="0xYourAddress",
    network="base-sepolia",
)

@app.route("/weather")
def get_weather():
    return {"report": {"weather": "sunny", "temperature": 70}}

Read the full file on GitHub · 140 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. 11d ago First seen · 140 lines · 94 tokens per session scan A 09018b6a30fd

Subscribe to this mod's changes

x402 is a skill published in the GitHub repository Tyler-R-Kendrick/agent-skills (11 stars, last pushed 3mo ago), licensed MIT. It adds 94 tokens to every session and 1,202 once invoked, about $0.0005 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-31.