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

@p402/cli

v1.0.0

Published

Official CLI for the P402 AI Payment Router

Readme

@p402/cli

npm License: MIT

Official CLI for the P402 AI Payment Router.

Installation

# Use without installing (recommended for quick start)
npx p402 --help

# Or install globally
npm install -g @p402/cli

Quick Start

# 1. Authenticate (saves key to ~/.p402/config.json)
npx p402 login

# 2. Chat via the cheapest provider
npx p402 chat "Explain EIP-3009 in one sentence" --mode cost

# 3. Check facilitator status
npx p402 health

Commands

p402 login

p402 login [--key <apiKey>] [--url <routerUrl>]

Stores your API key in ~/.p402/config.json. Get your key at p402.io/dashboard/settings.

p402 config

p402 config [--json]

Show current CLI configuration (API key masked).

p402 chat <message>

p402 chat <message> [--mode cost|quality|speed|balanced] [--model <id>]
                    [--session <id>] [--stream] [--json]

Send a chat message through the P402 router.

| Flag | Default | Description | |---|---|---| | --mode | balanced | Routing mode | | --model | (auto) | Override model (e.g. gpt-4o, claude-3-5-sonnet) | | --session | — | Attach to an existing session ID | | --stream | false | Stream tokens as they arrive | | --json | false | Print full API response as JSON |

p402 health

p402 health [--json]

Check P402 facilitator health (status, network, gas price, block number).

p402 models list

p402 models list [--json]

List all available models across providers.

p402 providers list

p402 providers list [--json]

List all AI providers with status and latency.

p402 providers compare

p402 providers compare [--prompt <text>] [--json]

Compare providers for a given prompt.

p402 session list

p402 session list [--json]

List active sessions and their budgets.

p402 session get <id>

p402 session get <id> [--json]

Get session details including budget breakdown.

p402 session create

p402 session create --budget <usd> [--agent <id>] [--wallet <address>]
                    [--expires <hours>] [--json]

Create a new budget-capped session.

| Flag | Default | Description | |---|---|---| | --budget | required | Budget in USD (e.g. 5.00) | | --agent | — | Agent ID to associate | | --wallet | — | Wallet address | | --expires | 24 | Expire after N hours |

p402 session fund <id> <amount>

p402 session fund <id> <amount> [--tx <hash>] [--json]

Add budget to an existing session. Provide --tx if topping up via on-chain transfer.

p402 mandate list

p402 mandate list [--status active|exhausted|expired|revoked] [--json]

List AP2 spending mandates.

p402 mandate create

p402 mandate create --user <did> --agent <did> --max <usd>
                    [--categories <list>] [--until <iso>] [--type <type>] [--json]

Create a new AP2 spending mandate.

| Flag | Default | Description | |---|---|---| | --user | required | User DID (e.g. did:pkh:eip155:8453:0x...) | | --agent | required | Agent DID | | --max | required | Maximum spend in USD | | --categories | — | Comma-separated allowed categories | | --until | never | Expiry in ISO 8601 (e.g. 2026-12-31T00:00:00Z) | | --type | payment | intent | cart | payment |

p402 analytics spend

p402 analytics spend [--period 1d|7d|30d] [--json]

View spend analytics (total, per-request average, top providers).

Configuration

The CLI reads config from (in priority order):

  1. Environment variables: P402_API_KEY, P402_ROUTER_URL
  2. Config file: ~/.p402/config.json
{
  "apiKey": "p402_live_...",
  "routerUrl": "https://p402.io"
}

Links