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

@singularity-layer/grid

v0.5.0

Published

TypeScript SDK for the SGL Network confidential compute grid (end-to-end encrypted + streaming)

Downloads

340

Readme

@singularity-layer/grid

TypeScript SDK for the SGL Network — a decentralized confidential compute grid with TEE-verified hardware.

Install

npm install @singularity-layer/grid

Quick Start

OpenAI-compatible chat

import { GridClient } from "@singularity-layer/grid";

const grid = new GridClient();

const response = await grid.chatCompletions({
  model: "gemma2:2b",
  messages: [{ role: "user", content: "What is 2+2?" }],
});

console.log(response.choices[0].message.content);

With the OpenAI SDK

import OpenAI from "openai";

const client = new OpenAI({
  baseURL:
    "https://grid.x402compute.cc/v1",
  apiKey: "sgl-anonymous",
});

const completion = await client.chat.completions.create({
  model: "gemma2:2b",
  messages: [{ role: "user", content: "Hello from the grid!" }],
});

Grid discovery

import { GridClient } from "@singularity-layer/grid";

const grid = new GridClient();

// Check available capacity
const capacity = await grid.capacity();
console.log(`${capacity.active_nodes} nodes online`);

// List available models
const models = await grid.models();
models.forEach((m) => console.log(`${m.id} — ${m.sgl_node_count} nodes`));

// Get pricing
const pricing = await grid.pricing();
pricing.forEach((p) =>
  console.log(`${p.model}: $${p.price_per_1k_input_tokens_usd}/1k tokens`),
);

Submit a job

import { GridClient } from "@singularity-layer/grid";

const grid = new GridClient({ apiKey: "scg_..." });

const job = await grid.submitJob("gemma2:2b", {
  messages: [{ role: "user", content: "Summarize quantum computing" }],
});

console.log(`Job ${job.job_id}: ${job.status}`);

// Poll for result
const result = await grid.getJob(job.job_id);
if (result.status === "completed") {
  console.log(result.result);
}

// Verify TEE attestation
const attestation = await grid.getAttestation(job.job_id);
console.log(`Verified: ${attestation.verified}, TEE: ${attestation.tee_type}`);

Configuration

const grid = new GridClient({
  apiKey: "scg_...", // Optional — required for job submission
  baseUrl: "https://custom-orchestrator.example.com", // Override orchestrator URL
  timeout: 30_000, // Request timeout in ms (default: 60000)
});

Error Handling

import {
  GridClient,
  SGLAPIError,
  SGLAuthError,
  SGLConnectionError,
  SGLNotFoundError,
} from "@singularity-layer/grid";

try {
  const result = await grid.getJob("nonexistent");
} catch (err) {
  if (err instanceof SGLNotFoundError) {
    console.log("Job not found");
  } else if (err instanceof SGLAuthError) {
    console.log("Invalid API key");
  } else if (err instanceof SGLConnectionError) {
    console.log("Orchestrator unreachable");
  } else if (err instanceof SGLAPIError) {
    console.log(`API error ${err.statusCode}: ${err.message}`);
  }
}

Requirements

  • Node.js >= 18 (uses native fetch)
  • Zero dependencies

License

MIT