x402-payments

x402-payments is a skill for Claude Code from Aznatkoiny/zAI-Skills. It costs 185 tokens per session (1,941 once invoked), scanned A, original, MIT.

Guidance for x402, a web-payment protocol that uses HTTP status code 402 to request stablecoin payment before returning an API resource.

In plain words
What is it for?
Use it to build APIs that charge per request in USDC or to build clients and AI agents that pay for protected resources.
Why use it?
It explains how clients and servers exchange payment requirements, signed authorizations, verification, and settlement during an API request.

Skill for Claude Code

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

Part of the ai-toolkit plugin — 6 skills, 4 commands, 2 agents shipped together

Good fit Use it to build APIs that charge per request in USDC or to build clients and AI agents that pay for protected resources.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/aznatkoiny/zai-skills/x402-payments
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 Aznatkoiny/zAI-Skills --skill x402-payments
Clone the repo
git clone --depth 1 https://github.com/Aznatkoiny/zAI-Skills

Made for: Claude Code.

Or install ai-toolkit, the plugin that ships this one along with the rest of its 6 skills, 4 commands, 2 agents.

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-payments

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/aznatkoiny/zai-skills/x402-payments"><img src="https://agentmods.dev/badge/skills/aznatkoiny/zai-skills/x402-payments.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 185 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,941 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 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.00185 $0.01941
Opus 5 $0.00093 $0.00971
Sonnet 5 $0.00037 $0.00388
Haiku 4.5 $0.00018 $0.00194

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

Security

Grade A, and why

x402-payments scanned grade A with 0 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 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AI-Toolkit/skills/x402-payments/SKILL.md · 151 lines

How it starts

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

x402 Protocol Skill

Facts current as of July 2026 — verify pricing and model IDs against https://docs.claude.com, and protocol/package details against the x402 docs.

Protocol Overview

x402 embeds stablecoin payments into HTTP by using the 402 "Payment Required" status code. A server responds with payment requirements; the client signs a payment authorization, resubmits the request, and gets the resource after verification and settlement.

Payment flow:

  1. Client sends HTTP request → Server returns 402 + PAYMENT-REQUIRED header (base64 JSON)
  2. Client reads requirements, creates signed payment payload
  3. Client resubmits request with PAYMENT-SIGNATURE header (base64 JSON)
  4. Server verifies payment via facilitator POST /verify
  5. Server performs work, settles via facilitator POST /settle
  6. Server returns 200 + resource + PAYMENT-RESPONSE header (contains txHash)

Key concepts:

  • Facilitators verify and settle payments without holding funds. Use https://x402.org/facilitator for testnet, CDP facilitator for mainnet.
  • Schemes: exact (fixed price per request) is the production scheme. upto and deferred are proposed.
  • Networks: Identified by CAIP-2 format — eip155:84532 (Base Sepolia), eip155:8453 (Base Mainnet), solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1 (Solana Devnet).
  • EVM uses EIP-3009 gasless TransferWithAuthorization. Solana uses SPL token transfers.

Quick-Start: Protect an API Endpoint (Seller)

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

const app = express();
const payTo = process.env.PAY_TO!;

const facilitatorClient = new HTTPFacilitatorClient({
  url: "https://x402.org/facilitator",
});
const server = new x402ResourceServer(facilitatorClient);
registerExactEvmScheme(server);

app.use(
  paymentMiddleware(
    {
      "GET /weather": {
        accepts: [
          { scheme: "exact", price: "$0.001", network: "eip155:84532", payTo },
        ],
        description: "Get current weather data",
        mimeType: "application/json",
      },
    },
    server,
  ),
);

app.get("/weather", (req, res) => {
  res.json({ weather: "sunny", temperature: 70 });
});

app.listen(4021, () => console.log("Server on :4021"));

Read the full file on GitHub · 151 lines

Files

What ships with it

5 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. 11d ago First seen · 151 lines · 185 tokens per session scan A bbf8cd65d1d4

Subscribe to this mod's changes

x402-payments is a skill published in the GitHub repository Aznatkoiny/zAI-Skills (9 stars, last pushed 1mo ago), licensed MIT. It adds 185 tokens to every session and 1,941 once invoked, about $0.0009 per session on Opus 5. A static security scan graded it A with 0 findings. 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

monitor

Autonomous monitoring loop. Checks open trades against SL/TP levels, closes trades that hit targets, evaluates expired predictions, and generates periodic summaries. Run via cron for full autonomy. Usage: /monitor.

hugoguerrap/crypto-claude-desk · 42 tokens

quick

Quick single-agent market check. Usage: /quick BTC or /quick ETH.

hugoguerrap/crypto-claude-desk · 17 tokens

defi-protocol-templates

Implement DeFi protocols with production-ready templates for staking, AMMs, governance, and lending systems. Use when building decentralized finance applications or smart contract protocols.

HermeticOrmus/LibreUIUX-Claude-Code · 38 tokens

crypto-sage

Activates CryptoSage for crypto, DeFi, and Web3 intelligence. Use when you need on-chain analytics (MVRV, SOPR, NVT, exchange flows), DeFi TVL trend analysis, tokenomics review (vesting schedules, inflation rate, unlock impact), narrative momentum tracking, or rug pull / audit risk assessment.

vignesh2027/Claude-Agentic-Skills2.0-version · 73 tokens

stripe

Integrate and manage Stripe payment processing — accept payments, manage subscriptions, generate invoices, handle refunds, and configure webhooks. Covers Stripe Checkout, Payment Intents, Subscriptions, Invoicing, and Connect. Context: User wants to set up Stripe user: "integrate Stripe payments into my app" Context…

lukaskellerstein/claude-my-marketplace · 191 tokens

robtex-crypto

Bitcoin and Lightning Network analysis — address balances, transaction tracing, block inspection, Lightning node/channel data, peer recommendations.

robtex/skills · 27 tokens