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

@sentinalapi/sdk

v1.0.0

Published

Official JavaScript/TypeScript SDK for the Sentinel pay-per-use AI API marketplace on Algorand

Readme

@sentinalapi/sdk

Official JavaScript/TypeScript SDK for the Sentinel pay-per-use AI API marketplace powered by Algorand.

npm version License: MIT


What is Sentinel?

Sentinel is a pay-per-use AI API marketplace where every call is backed by a real Algorand micro-payment. No subscriptions, no lock-in — you pay only for what you use, and the on-chain receipt proves it.

This SDK handles the entire invoke → pay → complete flow:

  1. Send a prompt → AI runs → receive a payment quote
  2. SDK signs and submits an Algorand payment transaction
  3. Payment verified on-chain → AI response unlocked

Install

npm install @sentinalapi/sdk algosdk

Quick Start (Node.js)

import { MnemonicSigner, SentinelClient } from "@sentinalapi/sdk";

const client = new SentinelClient({
  apiKey: process.env.SENTINEL_API_KEY!, // sk-sentinel-...
  baseUrl: "http://localhost:5000",
  network: "testnet",
});

// Server-side only — never use MnemonicSigner in browsers
const signer = new MnemonicSigner(process.env.SENTINEL_MNEMONIC!);

const response = await client.chat(
  [{ role: "user", content: "Explain Algorand in one sentence." }],
  signer
);

console.log(SentinelClient.getAssistantText(response));
// → "Algorand is a pure proof-of-stake blockchain..."

console.log(response.sentinelReceipt);
// → { paymentTxId: "ABCD...", chargeAlgo: 0.001, totalTokens: 38 }

Browser + Pera Wallet

import { PeraWalletConnect } from "@perawallet/connect";
import { BYOSigner, SentinelClient } from "@sentinalapi/sdk";

const pera = new PeraWalletConnect();
const [address] = await pera.connect();

const client = new SentinelClient({
  apiKey: "sk-sentinel-...",
  baseUrl: "https://your-sentinel-api.example",
  network: "testnet",
});

const signer = new BYOSigner(address, async (txn) => {
  const signed = await pera.signTransaction([[{ txn }]]);
  return signed[0]; // Uint8Array
});

const response = await client.chat(
  [{ role: "user", content: "Hello from the browser!" }],
  signer
);

console.log(SentinelClient.getAssistantText(response));

Two-Phase Flow (Manual)

Use invoke() and complete() directly when you need more control:

// Step 1: get quote
const quote = await client.invoke([{ role: "user", content: "Hello!" }]);
console.log(`Pay ${quote.chargeAlgo} ALGO to ${quote.developerWallet}`);

// Step 2: build, sign, submit payment manually
const txn = await buildPaymentTx({
  from: signer.address,
  to: quote.developerWallet,
  microAlgos: quote.expectedMicroAlgos,
  paymentRef: quote.paymentRef,   // ← must go in txn note field
  algodClient: client.algodClient,
});
const signed = await signer.sign(txn);
const txId = await submitSignedPayment({ signedTxn: signed, algodClient: client.algodClient });

// Step 3: claim AI response
const response = await client.complete(quote.paymentRef, txId);

Signers

| Class | Use case | |-------|---------| | MnemonicSigner | Server/scripts — signs with a 25-word mnemonic | | BYOSigner | Browser — plug in Pera Wallet, Defly, or any wallet | | PreSignedSigner | Advanced — provide pre-signed transaction bytes |


Error Handling

import {
  SentinelAuthError,
  SentinelSessionExpired,
  SentinelUpstreamError,
} from "@sentinalapi/sdk";

try {
  const response = await client.chat(messages, signer);
} catch (err) {
  if (err instanceof SentinelAuthError) {
    // Invalid API key — regenerate from marketplace
  } else if (err instanceof SentinelSessionExpired) {
    // paymentRef TTL expired (>60s) — retry the call
  } else if (err instanceof SentinelUpstreamError) {
    // AI provider temporarily unavailable
  }
}

| Error class | HTTP | Cause | |-------------|------|-------| | SentinelAuthError | 401 | Bad/missing API key | | SentinelPaymentError | 402 | Payment not verified | | SentinelSessionExpired | 410 | Quote expired (>60s) | | SentinelUpstreamError | 502 | AI provider failed | | SentinelNetworkError | — | Fetch/timeout failure |


TypeScript Support

Full TypeScript support with exported types:

import type {
  ChatMessage,
  ChatOptions,
  CompleteResponse,
  InvokeResponse,
  SentinelClientOptions,
  SentinelReceipt,
  ServicePublicInfo,
} from "@sentinalapi/sdk";

Environment Support

| Environment | Status | |-------------|--------| | Node.js ≥ 18 | ✅ | | Modern browsers (ESM) | ✅ | | Next.js (App Router) | ✅ Server components | | React Native | ⚠️ Requires polyfills |


Docs

| Document | Contents | |----------|---------| | Quickstart | Get your first call working in 5 minutes | | API Reference | Full SentinelClient API reference | | Examples | Node.js, React, Next.js, manual flow | | Error Handling | Typed errors with retry patterns | | Wallet Guides | Pera, Defly, MnemonicSigner, raw algosdk |


Streaming

Deferred to v1.1. opts.stream is accepted but ignored in v1.0.


Contributing

SDK source lives in sdk/ at the root of the Sentinel monorepo.

cd sdk
npm install
npm run build
npm test

License

MIT — Copyright © 2025 Sentinel AI Team