x402-server

x402-server is a skill for Claude Code, Codex from Dexter-DAO/opendexter-ide. It costs 66 tokens per session (3,066 once invoked), scanned A, original, MIT.

A server library for adding x402 payment checks to API endpoints. It can require a payment before an endpoint's handler runs and supports crypto or Stripe settlement options.

In plain words
What is it for?
Use it to protect Express routes, set prices, choose recipient addresses or payment providers, accept supported blockchain networks, and configure sponsored or access-pass requests.
Why use it?
It removes the need to build payment verification and settlement logic around each paid API route.

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 protect Express routes, set prices, choose recipient addresses or payment providers, accept supported blockchain networks, and configure sponsored or access-pass requests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/dexter-dao/opendexter-ide/x402-server
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 Dexter-DAO/opendexter-ide --skill x402-server
Clone the repo
git clone --depth 1 https://github.com/Dexter-DAO/opendexter-ide

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/dexter-dao/opendexter-ide/x402-server"><img src="https://agentmods.dev/badge/skills/dexter-dao/opendexter-ide/x402-server.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 66 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,066 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.00066 $0.03066
Opus 5 $0.00033 $0.01533
Sonnet 5 $0.00013 $0.00613
Haiku 4.5 $0.00007 $0.00307

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

Security

Grade A, and why

x402-server 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 10d 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.

packages/mcp/skills/x402-server/SKILL.md · 333 lines

How it starts

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

@dexterai/x402 Server SDK

Protect any API endpoint with x402 payments. One-liner Express middleware or manual verify/settle control.

npm install @dexterai/x402

One line to paywall any endpoint:

import express from 'express';
import { x402Middleware } from '@dexterai/x402/server';

const app = express();

app.get('/api/data',
  x402Middleware({
    payTo: 'YourSolanaAddress...',
    amount: '0.01', // $0.01 USD per request
  }),
  (req, res) => {
    // Only runs after successful payment
    res.json({ data: 'premium content', payer: req.x402?.payer });
  }
);

Multi-chain accept

Accept payments on multiple chains simultaneously:

app.get('/api/data',
  x402Middleware({
    payTo: {
      'solana:*': 'SolanaAddress...',
      'eip155:*': '0xEvmAddress...',
    },
    amount: '0.05',
    network: ['eip155:8453', 'eip155:137', 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp'],
  }),
  handler
);

Full X402MiddlewareConfig

Option Type Default Description
payTo string / PayToProvider / Record required Recipient address, Stripe provider, or per-network map
amount string required USD amount (e.g., "0.01" for 1 cent)
network string / string[] Solana mainnet CAIP-2 network(s) to accept payments on
asset { address, decimals } USDC Token to accept
facilitatorUrl string https://x402.dexter.cash Facilitator for verify/settle
description string Human-readable resource description
resourceUrl string request URL Override resource URL
mimeType string Response MIME type
timeoutSeconds number 120 Payment timeout
verbose boolean false Debug logging
getAmount (req) => string Dynamic amount per request
getDescription (req) => string Dynamic description per request
getResourceUrl (req) => string Dynamic resource URL per request
sponsoredAccess boolean / object false Enable ad injection into response body
onSettlement (info) => void Called after successful settlement
onVerifyFailed (info) => void Called when verification fails

Read the full file on GitHub · 333 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. 10d ago First seen · 333 lines · 66 tokens per session scan A 27704fdd2549

Subscribe to this mod's changes

x402-server is a skill published in the GitHub repository Dexter-DAO/opendexter-ide (2 stars, last pushed 5d ago), licensed MIT. It adds 66 tokens to every session and 3,066 once invoked, about $0.0003 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

architecture-patterns

Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use this skill when designing clean architecture for a new microservice, when refactoring a monolith to use bounded contexts, when implementing hexagonal or onion architecture patterns, or…

wshobson/agents · 65 tokens

defi-protocol-templates

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

wshobson/agents · 38 tokens

nft-standards

Implement NFT standards (ERC-721, ERC-1155) with proper metadata handling, minting strategies, and marketplace integration. Use when creating NFT contracts, building NFT marketplaces, or implementing digital asset systems.

wshobson/agents · 48 tokens

web3-testing

Test smart contracts comprehensively using Hardhat and Foundry with unit tests, integration tests, and mainnet forking. Use when testing Solidity contracts, setting up blockchain test suites, or validating DeFi protocols.

wshobson/agents · 46 tokens

saga-orchestration

Implement saga patterns for distributed transactions and cross-aggregate workflows. Use this skill when implementing distributed transactions across microservices where 2PC is unavailable, designing compensating actions for failed order workflows that span inventory, payment, and shipping services, building…

wshobson/agents · 91 tokens

event-store-design

Design and implement event stores for event-sourced systems. Use when building event sourcing infrastructure, choosing event store technologies, or implementing event persistence patterns.

wshobson/agents · 33 tokens