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

opacus-sdk

v1.1.14

Published

API control plane for agent infrastructure: identity (DID), low-latency routing (Nitro), geo-policy (H3), storage (0G), and settlement (Pay/Escrow).

Readme

@opacus/sdk

Opacus hosts agent infrastructure via APIs — you run your agent anywhere.

API control plane for agent identity (DID), low-latency routing (Nitro), geo-policy (H3), storage (0G), and settlement (Pay / Escrow).

npm version License: MIT

  • REST-first — every SDK call maps 1:1 to a documented endpoint
  • Bootstrap + scoped token lifecycle handled automatically
  • Safe defaults: retries, timeouts, request IDs, budget-safe errors

Install

npm i opacus-sdk

Quickstart (5 minutes)

1. Create a Project + API Key in Agentboard

2. Set your key:

export OPACUS_API_KEY="op_live_..."

3. Call the API:

import { Opacus } from "opacus-sdk";

const opacus = new Opacus({ apiKey: process.env.OPACUS_API_KEY! });

// Bootstrap: performs /challenge + /register, issues DID + scoped tokens
await opacus.bootstrap();

// Nitro routing — find the fastest execution path
const route = await opacus.routing.optimize({
  intent: "swap",
  chain: "base",
  mode: "fast",
});
console.log("route", route);

// H3 geo-policy — resolve your agent's hex cell
const loc = await opacus.h3.locate({ resolution: 8 });
console.log("h3", loc);

// 0G storage — store data on decentralized DA layer
const stored = await opacus.ogStorage.store({ key: "value" });
console.log("cid", stored.rootHash);

Scoped Tokens

bootstrap() issues 3 scoped tokens, refreshed automatically:

| Token | TTL | Scopes | |-------|-----|--------| | AGENT | 24 h | nitro.execute, h3.routing | | DATA | 24 h | 0g.upload, 0g.download | | PAY | 1 h | pay.gas_subsidy, pay.escrow |

Payment Rails

Use a single compute balance across all supported rails.

const rails = await opacus.getPaymentRails();

console.log(rails.computeBalance); // { balance, currency }
console.log(rails.paymentRails.rails.map(r => ({
  id: r.id,
  enabled: r.enabled,
  providers: r.providers,
})));

Response shape:

{
  "ok": true,
  "computeBalance": { "balance": 20, "currency": "USDC" },
  "paymentRails": {
    "provider": "0g_pay",
    "model": "three_rails_one_compute_balance",
    "rails": [
      { "id": "fiat", "enabled": true, "providers": ["stripe"] },
      { "id": "multichain_crypto", "enabled": true, "providers": ["khalani"] },
      { "id": "native_0g", "enabled": true, "providers": ["opacus"] }
    ]
  }
}

If your flow is MCP-first, use:

const railsViaMcp = await opacus.getPaymentRailsViaMcp();

Product Analytics

Query adoption and module usage analytics (DID, H3, OpacusPay, Data Bridge, etc.):

const analytics = await opacus.getProductAnalytics({
  includeUsers: true,
  limit: 30,
  period: '30d',
  // adminToken: process.env.OPACUS_ADMIN_TOKEN, // optional for full user view
});

console.log(analytics.summary);
console.log(analytics.moduleStats);

Optional SDK Telemetry (Opt-In)

Send anonymous usage events from SDK calls to your Opacus analytics endpoint:

const opacus = new Opacus({
  apiKey: process.env.OPACUS_API_KEY!,
  telemetry: {
    enabled: true,
    anonymousId: 'client-123',
    appId: 'agentboard-prod',
    sdkVersion: '1.1.13',
    sampleRate: 1,
  },
});

Telemetry is disabled by default.

Configuration

const opacus = new Opacus({
  apiKey: process.env.OPACUS_API_KEY!,
  baseUrl: "https://opacus.xyz",   // default
  chain: "base",                    // default chain for operations
});

Subpath Imports

Each module is tree-shakeable and independently importable:

import { Opacus } from "opacus-sdk";          // Golden Path (recommended)
import { NitroClient } from "opacus-sdk/nitro";
import { H3RoutingClient } from "opacus-sdk/h3";
import { latLngToH3Cell } from "opacus-sdk/h3-utils"; // zero deps
import { BridgeClient } from "opacus-sdk/bridge";
import { EscrowClient } from "opacus-sdk/escrow";

Error Handling

| Status | Code | Action | |--------|------|--------| | 402 | BUDGET_EXHAUSTED | Add funds / increase lock | | 429 | RATE_LIMITED | Back off and retry | | 5xx | — | Retry with jitter |

import { OpacusError } from "opacus-sdk";

try {
  await opacus.routing.optimize({ intent: "swap", chain: "base" });
} catch (e) {
  if (e instanceof OpacusError && e.status === 402) {
    console.error("Top up your lock in Agentboard");
  }
}

REST-Only Usage

Prefer curl? Every SDK method maps directly to a REST endpoint:

curl -X POST https://opacus.xyz/v1/router/execute \
  -H "Authorization: Bearer $OPACUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"intent":"swap","chain":"base","mode":"fast"}'

Full reference: API Docs

Examples

See examples/ for runnable scripts:

Links

| | | |-|-| | Docs | opacus.xyz/docs | | API Reference | opacus.xyz/docs/api-reference.html | | Agentboard | opacus.xyz/agentboard.html | | Changelog | CHANGELOG.md | | Issues | GitHub Issues |

License

MIT