x402-client

Client for interacting with the x402 payment service when receiving HTTP 402 responses.

16 stars

Best use case

x402-client is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Client for interacting with the x402 payment service when receiving HTTP 402 responses.

Teams using x402-client should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/x402-client/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/tools/x402-client/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/x402-client/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How x402-client Compares

Feature / Agentx402-clientStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Client for interacting with the x402 payment service when receiving HTTP 402 responses.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# X402 Client Skill

## Overview

The X402 Client Skill enables seamless interaction with the X402 payment service. When a user's HTTP request returns a 402 status code, this skill will be triggered to handle the authentication process and facilitate secure payment transactions.

## Workflow

- Verify that dependencies are installed
- Verify the private key to use
- Verify the target network
- Execute the corresponding JS script

### Dependencies

```bash
npm install https://github.com/second-state/x402-client.git
```

### Get Private Key

- Check if there is a .env file in this skill folder
- If a .env file is found, verify that it contains the PRIVATE_KEY variable
- If no .env file is found, ask the user for a PRIVATE_KEY and create a .env file with that variable

### Target Network

- The HTTP 402 response will contain an accepts array with the payment methods supported by the target URL
- Select the network to use (e.g., base or base-sepolia)
- If there are multiple options, ask the user which network to use

### Execute Script

After obtaining the `TARGET_URL` and `PRIVATE_KEY`, execute the following script:

```js
import { createX402Client } from "x402-client";

const PRIVATE_KEY = "0x<PRIVATE_KEY>";
const TARGET_URL = "<TARGET_URL>";
const NETWORK = "<NETWORK>";

if (!PRIVATE_KEY) throw new Error("Missing PRIVATE_KEY");

const client = await createX402Client({
  chain: NETWORK,
  privateKey: PRIVATE_KEY,
});

const response = await client.fetchWithPayment(TARGET_URL, { method: "GET" });
console.log("Response headers:", Object.fromEntries(response.headers));
console.log("Response body:", await response.text());

const paymentHeader = response.headers.get("x-payment-response");
if (paymentHeader) {
  console.log("Decoded payment response:", client.decodePaymentResponse(paymentHeader));
}
```

### Response

Return the result of the Execute Script to the user.

Related Skills

u08069-creative-ideation-facilitation-for-sales-and-client-success

16
from diegosouzapw/awesome-omni-skill

Operate the "Creative Ideation Facilitation for sales and client success" capability in production for sales and client success workflows. Use when mission execution explicitly requires this capability and outcomes must be reproducible, policy-gated, and handoff-ready.

client-management

16
from diegosouzapw/awesome-omni-skill

Manage client relationships using the local CRM — add contacts, track deals through the pipeline, schedule follow-ups, log interactions, and generate reports. All data stored locally in SQLite.

agent-client-protocol

16
from diegosouzapw/awesome-omni-skill

Agent Client Protocol (ACP) - Standardized communication between code editors and AI coding agents. Use for building ACP-compatible agents, integrating agents with editors (Zed, JetBrains, Neovim), implementing tool calls, file operations, and session management.

acc-create-psr18-http-client

16
from diegosouzapw/awesome-omni-skill

Generates PSR-18 HTTP Client implementation for PHP 8.5. Creates ClientInterface with request sending and exception handling. Includes unit tests.

data-client-setup

16
from diegosouzapw/awesome-omni-skill

Install and set up @data-client/react or @data-client/vue in a project. Detects project type (NextJS, Expo, React Native, Vue, plain React) and protocol (REST, GraphQL, custom), then hands off to protocol-specific setup skills.

bknd-client-setup

16
from diegosouzapw/awesome-omni-skill

Use when setting up Bknd SDK in a frontend application. Covers Api class initialization, token storage, auth state handling, React integration with BkndBrowserApp and useApp hook, framework-specific setup (Vite, Next.js, standalone), and TypeScript type registration.

Bankr x402 SDK - Job Management

16
from diegosouzapw/awesome-omni-skill

This skill should be used when the user asks about "job status", "check if request completed", "cancel request", "why is my request taking so long", "poll for result", "batch requests", "retry failed request", "request timeout", "async operations", "job lifecycle", "manual polling", or needs advanced control over SDK async operations, manual job polling, batch processing, retry logic, or job cancellation.

atcoder-client

16
from diegosouzapw/awesome-omni-skill

Interface with AtCoder for Japanese competitive programming contests

ai-generation-client

16
from diegosouzapw/awesome-omni-skill

External AI API integration with retry logic, rate limiting, content safety detection, and multi-turn conversation support for image generation.

apollo-client-patterns

16
from diegosouzapw/awesome-omni-skill

Use when implementing Apollo Client patterns for queries, mutations, cache management, and local state in React applications.

x402-payments

16
from diegosouzapw/awesome-omni-skill

Agent-to-agent payments via HTTP 402 + on-chain escrow. Let agents pay each other for API calls, services, and data.

api-client

16
from diegosouzapw/awesome-omni-skill

REST API client builder with authentication, error handling, retry logic, and request management. Supports OAuth, JWT, API keys. Use when building API integrations, creating API clients, or working with REST services.