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

@cryptyx/x402-client

v0.1.0

Published

Typed x402 client for CRYPTYX — the conviction engine for autonomous crypto trading agents. 60 pay-per-call endpoints spanning signals, factor scores, regime detection, backtests, walk-forward validation, and institutional-grade trigger evidence. Wraps @x

Readme

@cryptyx/x402-client

Typed x402 client for CRYPTYX — institutional crypto intelligence for autonomous trading agents. 60 pay-per-call endpoints. USDC on Base. No API keys, no accounts, no rate cards.

npm install @cryptyx/x402-client viem
import { Cryptyx } from '@cryptyx/x402-client';

const cx = new Cryptyx({
  wallet: process.env.WALLET_PRIVATE_KEY!,   // any viem WalletClient or 0x private key
  network: 'base',
  maxSpend: 5.00,                            // USDC hard ceiling
  onPay: (r) => console.log(`$${r.priceUsd} → ${r.route} (${r.txHash})`),
});

// Institutional trigger evaluation — one call, full evidence packet
const trigger = await cx.api.triggers.preset({
  preset_id: 'treasury_manager_classic',
  asset: 'BTC',
});

if (
  trigger.trigger.fires_now &&
  (trigger.backtest_evidence.sharpe_ratio ?? 0) > 0.3 &&
  (trigger.backtest_evidence.profit_factor ?? 0) > 1.5
) {
  // Execute on your chosen venue: OKX, Coinbase, Kraken, Hyperliquid, Binance
}

What it does

Wraps the entire CRYPTYX x402 API surface — 60 endpoints across:

  • Institutional triggers — z-score / z-differential / composite / custom predicates with 5-year backtest evidence (Sortino, MDD, profit factor, walk-forward IS/OOS, regime-conditional performance)
  • Signals — 143 atomic + 9 composite, health-graded, walk-forward validated
  • Assets — Claude-narrated thesis, cross-class positioning, top setups, top predictors, peer clusters
  • Market pulse — factor breadth, conviction leaderboard, factor cross-section, divergences
  • Raw data — OHLCV, funding rates, taker flow, IV surface, order-book depth
  • AI grounding — natural-language query, trade-idea starter packs, one-shot context bundles

Every response follows the same envelope: { ok, ..., _next?, _cache? }. The _next.hints block on every response guides agents to the natural follow-up endpoint — no external documentation needed.

Why this exists

Building an autonomous agent that trades crypto? You need three things:

  1. Execution rails — an exchange or DEX (OKX, Coinbase, Kraken, Hyperliquid, Binance, dYdX)
  2. A wallet — Coinbase AgentKit, Fireblocks, MPC, or plain private key
  3. Conviction — this SDK

CRYPTYX is the intelligence layer. Ask "should I trade BTC right now?" and get a walk-forward-validated evidence packet with hit rate, Sortino, max drawdown, and regime context — not a chatbot's opinion. Pay-per-call in USDC on Base. Framework-agnostic (works with any wallet, any exchange).

Quickstart

With a raw private key

import { Cryptyx } from '@cryptyx/x402-client';

const cx = new Cryptyx({
  wallet: '0x...',
  network: 'base',
});

const brief = await cx.api.ai.marketBrief();
console.log(brief.brief); // LLM-ready market summary

With Coinbase AgentKit

import { CdpWalletProvider } from '@coinbase/agentkit';
import { Cryptyx } from '@cryptyx/x402-client';

const walletProvider = await CdpWalletProvider.configureWithWallet({ ... });
const cx = new Cryptyx({
  wallet: walletProvider.getViemWalletClient(),
  network: 'base',
});

With viem directly

import { createWalletClient, http } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { base } from 'viem/chains';
import { Cryptyx } from '@cryptyx/x402-client';

const account = privateKeyToAccount('0x...');
const wallet = createWalletClient({ account, chain: base, transport: http() });
const cx = new Cryptyx({ wallet, network: 'base' });

The endpoint graph

Every CRYPTYX response includes a _next.hints block pointing at natural follow-ups. Chain them programmatically:

const catalog = await cx.api.signals.catalog();

const chain = cx.chain(catalog, '/api/signals/catalog');
await chain.follow('/api/signals/top');
await chain.follow('/api/signals/backtest', undefined, {
  signal_id: 'TR_MOMO_CONT_14D',
  from: '2026-01-01',
  to: '2026-07-01',
  dryrun: true,
});

const all = chain.collect();  // { path → response } for every step

Institutional trigger evaluation

Four trigger endpoint families:

// Curated preset (5-year backtest cache, fastest)
await cx.api.triggers.preset({ preset_id: 'treasury_manager_classic', asset: 'BTC' });

// Single-metric z-score threshold — pass any metric_id
await cx.api.triggers.zScore({
  asset: 'BTC',
  metric_id: 'TR_ROC_7D',
  operator: 'abs_gt',
  threshold: 1.5,
});

// Cross-window differential — the generalised crossover primitive
await cx.api.triggers.zDifferential({
  asset: 'BTC',
  metric_a_id: 'VOL_RV_7D',
  metric_b_id: 'VOL_RV_30D',
  operator: 'abs_gt',
  threshold: 1.0,
});

// Arbitrary predicate — anything expressible in Metric Slicer
await cx.api.triggers.custom({
  asset: 'BTC',
  horizon: '14d',
  definition: {
    type: 'composite',
    logic: 'AND',
    conditions: [
      { metric_id: 'TR_ROC_7D', operator: 'abs_gt', threshold: 1.5 },
      { metric_id: 'VOL_RV_7D', operator: 'lt', threshold: 1.0 },
    ],
  },
});

Every response returns the same institutional evidence envelope:

{
  trigger: { asset, horizon, asof_day, fires_now, confidence, expression },
  backtest_evidence: {
    sample_size, date_start, date_end,
    hit_rate, mean_return,
    sharpe_ratio, sortino_ratio,
    max_drawdown, profit_factor,
  },
  regime_context: { current_regime, regime_streak_days, conditional_hit_rate },
  recent_performance: { last_10_triggers, rolling_30d_hit_rate, rolling_90d_hit_rate },
}

Budget safety

Set a hard USDC ceiling; any call that would exceed it throws before the payment is signed:

const cx = new Cryptyx({ wallet, maxSpend: 1.00 });
// ... spends $0.99 across several calls ...
await cx.api.intelligence.query('...');  // $0.25 — throws, current $0.99 + $0.25 > $1.00

Reset the counter when you want to continue:

cx.resetSpend();
console.log(cx.spent);      // 0
console.log(cx.remaining);  // maxSpend
console.log(cx.history);    // full receipt list

Endpoint reference

All 60 endpoints are grouped on cx.api.*:

  • cx.api.signals — catalog, top, active, recent, leaderboard, explain, backtest, simulate, fork, eval, composite (attribution / backtest / breadth / heatmap / momentum / custom)
  • cx.api.asset — thesis, thesisJournal, activeSignals, signalEvents, topSetups, topPredictors, asymmetry, peerCluster, regimeContext, regime, metricHealth
  • cx.api.marketPulse — snapshot, regime, divergences, heroTimeline, compositeBreakdown, conviction, factorCrossSection, temporalLayers, regimeCellContext, regimeDivergence
  • cx.api.metrics — slicer, slicerComposite, slicerScan, preview
  • cx.api.triggers — preset, zScore, zDifferential, custom
  • cx.api.ai — context, marketBrief, tradeIdeas, signals, metrics
  • cx.api.data — assets, marketHistory, assetRegimes, assetFactors, assetLiquidity, fundingRate, takerFlow, ivSurface
  • cx.intelligenceQuery(...) — natural-language entry point
  • cx.health() — service probe

Full endpoint documentation: https://cryptyx.ai/docs/x402

Requirements

  • Node.js ≥ 18
  • A funded EVM wallet on Base with USDC
  • ~$1 USDC covers ~100 Standard-tier calls or the full 5-step agent workflow ~5 times

License

MIT. Ship anything you want on top.

Support