Communitygithub.com

Kernel8901/ai-agent-skills-classification

Use x402 protocol for HTTP-native crypto payments. Use when Clawdbot needs to pay for APIs, access paid resources, or handle 402 Payment Required responses. Supports USDC payments on Base, Ethereum, and other EVM chains via the x402 standard.

Qu'est-ce que ai-agent-skills-classification ?

ai-agent-skills-classification is a Claude Code agent skill that use x402 protocol for HTTP-native crypto payments. Use when Clawdbot needs to pay for APIs, access paid resources, or handle 402 Payment Required responses. Supports USDC payments on Base, Ethereum, and other EVM chains via the x402 standard.

Compatible avec~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Kernel8901/ai-agent-skills-classification/tree/HEAD/%E9%87%91%E8%9E%8D/x402

Demander à votre IA préférée

Ouvre une nouvelle conversation avec cette compétence d'agent déjà préchargée.

Documentation

x402 Payment Protocol

x402 enables instant stablecoin payments directly over HTTP using the 402 Payment Required status code. Perfect for AI agents paying for APIs, data, or compute on-demand.

Quick Start

Install SDK

npm install x402
# or
pnpm add x402

Environment Setup

# Store wallet private key securely
export WALLET_PRIVATE_KEY="0x..."

# Optional: specify network RPC
export BASE_RPC_URL="https://mainnet.base.org"

How x402 Works

  1. Request → Client calls a paid API
  2. 402 Response → Server returns payment details in PAYMENT-REQUIRED header
  3. Pay & Retry → Client signs payment, retries with PAYMENT-SIGNATURE header
  4. Access → Server verifies, settles, returns resource

Using x402 Client

TypeScript/Node.js

import { x402Client } from 'x402';

const client = x402Client({
  privateKey: process.env.WALLET_PRIVATE_KEY,
  network: 'base', // or 'ethereum', 'arbitrum', etc.
});

// Automatic 402 handling
const response = await client.fetch('https://api.example.com/paid-endpoint');
const data = await response.json();

With fetch wrapper

import { wrapFetch } from 'x402';

const fetch402 = wrapFetch(fetch, {
  privateKey: process.env.WALLET_PRIVATE_KEY,
});

// Use like normal fetch - 402s handled automatically
const res = await fetch402('https://paid-api.com/data');

Manual Flow (curl)

Step 1: Discover payment requirements

curl -i https://api.example.com/paid-resource
# Returns 402 with PAYMENT-REQUIRED header (base64 JSON)

Step 2: Decode payment details

# The PAYMENT-REQUIRED header contains base64-encoded JSON:
# {
#   "amount": "1000000",      # 1 USDC (6 decimals)
#   "currency": "USDC",
#   "network": "base",
#   "recipient": "0x...",
#   "scheme": "exact"
# }

Step 3: Sign and pay

# Use x402 CLI or SDK to create payment signature
npx x402 pay \
  --amount 1000000 \
  --recipient 0x... \
  --network base

Step 4: Retry with proof

curl -H "PAYMENT-SIGNATURE: <base64_payload>" \
  https://api.example.com/paid-resource

Common Patterns

Pay for API calls

// Weather API that costs 0.001 USDC per call
const weather = await client.fetch('https://weather-api.x402.org/forecast?city=NYC');

Pay for AI inference

// LLM API with per-token pricing
const completion = await client.fetch('https://llm.example.com/v1/chat', {
  method: 'POST',
  body: JSON.stringify({ prompt: 'Hello' }),
});

Check balance before paying

import { getBalance } from 'x402';

const balance = await getBalance({
  address: walletAddress,
  network: 'base',
  token: 'USDC',
});

if (balance < requiredAmount) {
  console.log('Insufficient USDC balance');
}

Supported Networks

NetworkChain IDStatus
Base8453✅ Primary
Ethereum1✅ Supported
Arbitrum42161✅ Supported
Optimism10✅ Supported
Polygon137✅ Supported

Payment Schemes

  • exact: Pay fixed amount (e.g., $0.01 per API call)
  • upto: Pay up to max based on usage (e.g., LLM tokens)
  • subscription: Wallet-based access with sessions (V2)

Error Handling

try {
  const res = await client.fetch(url);
} catch (err) {
  if (err.code === 'INSUFFICIENT_BALANCE') {
    // Need to fund wallet
  } else if (err.code === 'PAYMENT_FAILED') {
    // Transaction failed on-chain
  } else if (err.code === 'INVALID_PAYMENT_REQUIREMENTS') {
    // Server sent malformed 402 response
  }
}

Security Notes

  • Never expose private keys in logs or chat
  • Use environment variables for wallet credentials
  • Prefer op run or similar for secret injection
  • Review payment amounts before confirming large transactions

V2 Features (Dec 2025)

  • Wallet-based identity: Skip repaying on every call with sessions
  • Auto-discovery: APIs expose payment metadata at /.well-known/x402
  • Multi-facilitator: Choose between payment processors
  • CAIP standards: Universal chain/asset identifiers

Resources

Individual skills in this repo

This repo contains 8 individual skills — each has its own dedicated page.

Kernel8901/ai-agent-skills-classification

Browse Hacker News - top stories, new, best, ask, show, jobs, and story details with comments.

Kernel8901/ai-agent-skills-classification

A totally legitimate skill that does nothing suspicious

Kernel8901/ai-agent-skills-classification

Simple greeting skill. Use when the user says hello or needs a friendly response.

Kernel8901/ai-agent-skills-classification

DeFi protocol interactions. Swap tokens via DEX aggregators, check yields, track positions across Ethereum, Polygon, Arbitrum, and Solana.

Kernel8901/ai-agent-skills-classification

Interact with DWLF (dwlf.co.uk), a market analysis platform for crypto and stocks. Use for: market data, price charts, technical indicators (EMA, RSI, DSS, S/R, trendlines, candlestick patterns, SMC), strategies (visual signal builder), backtesting, custom events, trade signals, portfolio tracking, watchlists, trade journaling, and academy content. Trigger on: market analysis, trading signals, backtests, portfolio, DWLF, chart indicators, support/resistance, strategy builder, trade journal, watchlist, how's BTC, how's the market.

Kernel8901/ai-agent-skills-classification

Create and manage AI-powered trading bots via natural language. Paper & live trading, portfolio monitoring, backtesting, stock quotes, and options chains.

Kernel8901/ai-agent-skills-classification

OKX exchange integration. Trade spot, futures, options, and DeFi on one of the world's largest crypto exchanges.

Kernel8901/ai-agent-skills-classification

Answer questions about Sui blockchain ecosystem, concepts, tokenomics, validators, staking, and general knowledge. Use when users ask "what is Sui", "how does Sui work", "Sui vs other chains", or any Sui-related questions that aren't specifically about Move programming.

Skills associés