setup-x402-client

setup-x402-client is a command for Claude Code from Dexter-DAO/opendexter-ide. It costs 23 tokens per session (615 once invoked), scanned A, original, MIT.

A setup command that adds x402 payment handling to a Node.js project. x402 is a way for software to pay automatically when calling paid web APIs.

In plain words
What is it for?
Installing the x402 SDK and creating a payment helper that pays for API requests using a Solana wallet.
Why use it?
It removes the need to build payment handling from scratch when an application must access paid APIs.

Command for Claude Code

Written for Claude Code: a Claude Code command (commands/*.md). Also seen: positional $N argument.

Good fit Installing the x402 SDK and creating a payment helper that pays for API requests using a Solana wallet.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/dexter-dao/opendexter-ide/setup-x402-client
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.

Clone the repo
git clone --depth 1 https://github.com/Dexter-DAO/opendexter-ide

Made for: Claude Code.

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 setup-x402-client

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

Your own site · 80×15
<a href="https://agentmods.dev/commands/dexter-dao/opendexter-ide/setup-x402-client"><img src="https://agentmods.dev/badge/commands/dexter-dao/opendexter-ide/setup-x402-client.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 23 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 615 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.00023 $0.00615
Opus 5 $0.00012 $0.00308
Sonnet 5 $0.00005 $0.00123
Haiku 4.5 $0.00002 $0.00061

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

Security

Grade A, and why

setup-x402-client 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 8d 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/commands/setup-x402-client.md · 88 lines

How it starts

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

Add x402 Client to Your Project

Set up automatic x402 payment handling so your application can call paid APIs.

This command builds an independent @dexterai/x402 SDK client. It is not the OpenDexter MCP runtime, does not inherit an OpenDexter OAuth bearer or grant, and must never be used as a fallback for a disconnected or unavailable OpenDexter account-bound tool.

Steps

  1. Install the SDK:
npm install @dexterai/[email protected] @dexterai/[email protected]
  1. Create an application-owned payment helper. Add this file to your project:
// lib/x402.ts
import { createKeypairWallet, payAndFetch } from '@dexterai/x402/client';

const solana = await createKeypairWallet(process.env.SOLANA_PRIVATE_KEY!);

export async function x402Fetch(url: string, init: RequestInit = {}) {
  const result = await payAndFetch(url, init, { solana }, {
    maxAmountAtomic: '1000000', // Safety limit: max $1.00 per request
    solanaRpcUrl: process.env.SOLANA_RPC_URL,
  });
  if (!result.ok) {
    throw new Error(`${result.reason}: ${result.detail ?? ''}`);
  }
  if (!result.response) {
    throw new Error('Payment settled, but the merchant returned no response');
  }
  return result.response;
}
  1. Add your private key to .env:
SOLANA_PRIVATE_KEY=your-base58-private-key-here
  1. Use it anywhere in your application:
import { x402Fetch } from './lib/x402';

const response = await x402Fetch('https://x402-api.example.com/data');
const data = await response.json();
  1. For dual-chain support (Solana + EVM), add viem and an EVM wallet:
npm install viem
import { createEvmKeypairWallet } from '@dexterai/x402/client';

const wallets = {
  solana,
  evm: await createEvmKeypairWallet(process.env.EVM_PRIVATE_KEY!),
};

V6 has no wrapFetch or createX402Client export. Use payAndFetch, and do not automatically retry payment_unconfirmed: the first payment may already have settled.

Verify

Test with the Dexter test endpoint:

Read the full file on GitHub · 88 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. 8d ago First seen · 88 lines · 23 tokens per session scan A cb885e7cf368

Subscribe to this mod's changes

setup-x402-client is a command published in the GitHub repository Dexter-DAO/opendexter-ide (2 stars, last pushed 4d ago), licensed MIT. It adds 23 tokens to every session and 615 once invoked, about $0.0001 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.