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

secondopinion-x402

v0.4.1

Published

Adversarial verification for AI agents: pay an independent skeptic per verdict in USDC via x402 (Base, Algorand, Solana). Structured verdicts with signed, offline-verifiable receipts. Vercel AI SDK + LangChain adapters, npx MCP server, free trial — no wal

Readme

Second Opinion for JS/TS agents

Give your agent a paid, independent skeptic: before acting on a claim, it buys an adversarial verification ($0.02–$0.75 in USDC via x402 — no account, no API key) and gets a structured verdict with calibrated confidence, citations, and a signed offline-verifiable receipt.

npm install secondopinion-x402

Node ≥ 20, ESM.

Try it with no wallet

The free trial needs zero setup (rate-limited per caller per day, unsigned verdicts):

import { SecondOpinion } from "secondopinion-x402";

const so = new SecondOpinion();
const v = await so.freeTry("The Model Context Protocol uses JSON-RPC 2.0");
console.log(v.verdict, v.confidence, v.summary);

Paid verdicts (pick one chain)

Fund a throwaway wallet with a few dollars of USDC and set the matching env var. Keys sign payments locally and never leave your process. Network fees are covered by the facilitator — you only spend the verdict price.

| Chain | Wallet needs | Env var | | --- | --- | --- | | Base | USDC on Base (no ETH needed) | SECOND_OPINION_PRIVATE_KEY=0x… | | Polygon | USDC on Polygon (no gas needed) | same key, plus rail: "polygon" in the constructor | | Algorand | USDC (opted in) + ~0.2 ALGO min balance | SECOND_OPINION_ALGO_MNEMONIC="word1 … word25" | | Solana | USDC + a little SOL for rent | SECOND_OPINION_SOL_SEED_B64=… (32-byte seed, base64) |

const so = new SecondOpinion();          // rail inferred from whichever key is set
const v = await so.verify("Library X v3 supports streaming natively", {
  context: "About to build a day's work on this",
});
if (v.verdict === "refuted") {
  // stop and re-plan; v.findings says why, v.citations has sources
}

Tiers: quick $0.02 reasoning-only (~20s) · verify $0.20 live web research (~60s) · panel $0.75 three skeptics, majority vote. Pass { tier: "verify" } per call or defaultTier in the constructor. You are never charged for failed requests; failed async jobs retry free.

By default calls go through the async endpoints and poll (works on every chain — Solana requires it). { mode: "sync" } holds the connection for one round trip on Base and Algorand.

Drop it into your agent framework

Vercel AI SDK — a ready-made tool object:

import { generateText } from "ai";
import { secondOpinionTool } from "secondopinion-x402/ai";

await generateText({
  model,
  prompt,
  tools: { second_opinion: secondOpinionTool() },   // pays from env key
});

LangChain.js (npm install @langchain/core):

import { secondOpinionTool } from "secondopinion-x402/langchain";
const tools = [await secondOpinionTool()];

OpenAI Agents SDK (npm install @openai/agents):

import { Agent } from "@openai/agents";
import { secondOpinionTool } from "secondopinion-x402/openai";
const agent = new Agent({ name: "researcher", tools: [await secondOpinionTool()] });

Both adapters accept { tier: "verify" } to pin a tier, and both have a wallet-free variant — secondOpinionTryTool() — that uses the free trial.

Claude Desktop / Cursor (MCP) in one line

{
  "mcpServers": {
    "second-opinion": {
      "command": "npx",
      "args": ["-y", "secondopinion-x402", "mcp"],
      "env": { "SECOND_OPINION_PRIVATE_KEY": "0x…" }
    }
  }
}

Payments sign locally — the key never leaves your machine. The env block is optional: with no key configured, the free-trial tool still works and the paid tools explain exactly how to enable themselves. MAX_PRICE_USD caps what a call may cost (default 1.00).

One call, minimum sufficient spend: tier: "auto"

const v = await so.verify("Library X v3 supports streaming natively", { tier: "auto" });

Runs the quick check first and escalates to the web-researched tier only when quick is honest about wobbling (inconclusive, or confidence below 0.8 — tune with escalateBelow). Cap total spend with maxUsd; prices are read live from the service's own free 402 quotes. The returned verdict is byte-identical to a directly bought one, so its signed receipt still verifies offline. Auto never selects the panel tier — that stays a deliberate choice.

so.lastAuto is the run's hop receipt (since 0.4.1): the escalation rule and threshold in force, the maxUsd cap, the refusal reason when a cap blocked a wanted escalation, the superseded quickVerdict, totalUsd actually spent, and one hops[] entry per paid call carrying the 402-quoted price (quotedUsd), the decoded on-chain settlement (network + transaction id from the PAYMENT-RESPONSE header) and the hop's verdictId. Log it next to the verdict and every cent your agent spent is attributable, on purpose:

const v = await so.verify(claim, { tier: "auto", maxUsd: 0.25 });
audit.log({ verdict: v, hopReceipt: so.lastAuto });

Verify the receipt

Every paid verdict carries an Ed25519-signed receipt — proof it came from Second Opinion and wasn't altered, checkable offline:

await so.verifyReceipt(v);               // fetches + caches the public key
// or fully offline against a pinned key:
import { verifyReceipt } from "secondopinion-x402";
verifyReceipt(v, pinnedPublicKeyB64);    // true | false, no network

Public key: https://secondopinionx402.com/.well-known/second-opinion-pubkey.json — or paste any receipt into https://secondopinionx402.com/verify-receipt

What comes back

refuted | supported | inconclusive + confidence (scores the verdict, not the claim) + findings + citations + the signed receipt. Treat verdicts as strong evidence, not ground truth — check citations on anything load-bearing. Measured accuracy, failures included: https://secondopinionx402.com/benchmark

Full API surface (endpoints, schemas, MCP connector): https://secondopinionx402.com/llms.txt

Status: payment-tested against production on all three chains (30 Jul 2026) — one settled verdict per chain bought through this exact package: Algorand IFK5T2L5GKMYWDO2XKGBOZIUPDZOEHJRHKKLF7JYZ5766POST3FA, Base 0x27699a05409502d3638f5915a6adebdaf65f9acd56a8478aec14711d3ee41556, Solana 4THCnBSWZBhBACXMuvcvrrAxS9jJLfps8yF29j1XvxWfeVU5ypVdvkdTzJEHSpSgEDXyT7nUX2T4MCND8xA9zBFh. The 0.2.0 adapters and MCP server wrap that same client and were themselves smoke-tested the same day: a settled Algorand verdict bought through the AI-SDK adapter's execute() (id so_bb9069b8, signed receipt verified offline) and a live free-trial verdict through npx secondopinion-x402 mcp with zero configuration.