npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

x402tool

v0.2.3

Published

A command-line interface for interacting with x402 APIs on Solana

Readme

x402tool

npm version npm downloads License: MIT

Pay for APIs with x402-protected on Solana, from the command line.

x402tool is like curl for x402 APIs. Hit any x402-protected endpoint, and the CLI handles the payment and retries automatically.

# See what it costs
x402tool GET https://jupiter.api.corbits.dev/tokens/v2/recent --dry-run

# Pay and get the response
x402tool GET https://jupiter.api.corbits.dev/tokens/v2/recent --keypair auth.json

Install

npm install -g x402tool

Node.js v18+.

Quick Start

1. Preview what you'll pay — always start here:

x402tool GET https://api.example.com/data --dry-run

2. Make the request — add your Solana keypair:

x402tool GET https://api.example.com/data --keypair ~/.config/solana/auth.json

That's it. The CLI detects the 402 response, submits a Solana payment, and retries with proof.

Usage

POST with a body

x402tool POST https://triton.api.corbits.dev \
  --keypair auth.json \
  --body '{"jsonrpc":"2.0","id":1,"method":"getBalance","params":["corzHctjX9Wtcrkfxz3Se8zdXqJYCaamWcQA7vwKF7Q"]}'

Query parameters

x402tool GET "https://jupiter.api.corbits.dev/ultra/v1/order" \
  --query inputMint=So11111111111111111111111111111111111111112 \
  --query outputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v \
  --query amount=20000000 \
  --query taker=YOUR_WALLET_ADDRESS

Custom headers

Use repeatable headers with either Key: Value or key=value:

x402tool GET https://api.example.com/data \
  --header "x-api-key: abc123" \
  --header x-client-id=my-agent

Save to file

x402tool GET https://api.example.com/data -o response.json

Path must be under the current directory.

Agent / script mode

--json gives machine-readable output. --quiet suppresses wallet and timing logs.

x402tool GET https://api.example.com/data --dry-run --json --quiet
x402tool POST https://api.example.com/action --keypair auth.json --quiet -o result.json

Timeout

Default is 30s. Override in milliseconds:

x402tool GET https://api.example.com/slow --timeout 60000

Real-World Examples

These use Corbits x402-protected APIs.

Jupiter — preview costs

x402tool GET "https://jupiter.api.corbits.dev/ultra/v1/order" \
  --dry-run \
  --query inputMint=So11111111111111111111111111111111111111112 \
  --query outputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v \
  --query amount=20000000 \
  --query taker=YOUR_WALLET_ADDRESS

Jupiter — paid request

x402tool GET https://jupiter.api.corbits.dev/tokens/v2/recent \
  --keypair ~/.config/solana/auth.json

Triton RPC — dry-run

x402tool POST https://triton.api.corbits.dev \
  --dry-run \
  --body '{"jsonrpc":"2.0","id":1,"method":"getBalance","params":["corzHctjX9Wtcrkfxz3Se8zdXqJYCaamWcQA7vwKF7Q"]}'

Triton RPC — with payment

x402tool POST https://triton.api.corbits.dev \
  --keypair ~/.config/solana/auth.json \
  --body '{"jsonrpc":"2.0","id":1,"method":"getBalance","params":["corzHctjX9Wtcrkfxz3Se8zdXqJYCaamWcQA7vwKF7Q"]}'

MetEngine — trending prediction markets

x402tool GET https://agent.metengine.xyz/api/v1/markets/trending \
  --keypair ~/.config/solana/auth.json \
  -o result.json

CoinGecko — simple price (multiple query params)

x402tool GET "https://pro-api.coingecko.com/api/v3/x402/simple/price" \
  --keypair ~/.config/solana/auth.json \
  --query vs_currencies=usd --query symbols=btc,eth,sol --query include_market_cap=true

Keypair

Standard Solana keypair format — a JSON array of numbers. Must be under cwd or home.

solana-keygen new -o my-keypair.json

How It Works

  1. You make a request (GET or POST).
  2. If the API returns 402, the CLI parses payment requirements via @x402/core.
  3. It signs and submits a Solana transaction with @x402/svm.
  4. It retries the original request with the payment proof attached.

With --dry-run, it stops at step 2 and shows you the requirements.

The network (mainnet/devnet) is determined by the API's payment response, not by a CLI flag.

Options

| Flag | What it does | | --------------------- | ------------------------------------ | | --keypair <path> | Solana keypair for payment | | --dry-run | Preview costs, don't pay | | --body <json> | JSON body (POST only) | | --query <k=v> | Query param (repeatable) | | --header <header> | HTTP header (repeatable) | | --rpc-url <url> | Solana RPC (or SOLANA_RPC_URL env) | | --json | Machine-readable output | | --quiet | Suppress extra logs | | --timeout <ms> | Request timeout (default: 30000) | | -o, --output <path> | Write response to file |

Features

  • Automatic Solana payment on 402 responses
  • Dry-run mode to preview costs
  • GET and POST with optional JSON body
  • Agent-friendly JSON and quiet modes
  • Configurable timeout, query params, output path
  • URL scheme and keypair path validation

Development

git clone https://github.com/pratikbuilds/x402-cli.git
cd x402-cli
npm install
npm run build
node dist/index.js GET <url>

Contributing

Fork, branch, commit, push, open a PR.

License

MIT — see LICENSE.