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

niyoos

v0.1.0

Published

Beta — the API may change before 1.0. Run labelling for the Niyoos proxy: wraps your own OpenAI client so every call carries its run id, step and parent run.

Readme

niyoos — TypeScript / JavaScript SDK

Niyoos is the model gateway for your AI agents: every LLM call they make goes through the Niyoos proxy, where it is recorded, priced and governed. This SDK labels each call with the run it belongs to, so you can see what an agent did, step by step.

Beta — the API may change before 1.0.

Labels every LLM call your agent makes through the Niyoos proxy with the run it belongs to, its step, and the run that spawned it. Your agent keeps its own openai client. One package for TypeScript and JavaScript: ES modules, CommonJS, and type definitions. Node 18 or later.

Install

npm install niyoos openai

Quickstart — TypeScript (or JavaScript with import)

Create an agent in the Niyoos dashboard, copy its agent key, and wrap your own OpenAI client with it:

import * as niyoos from 'niyoos';
import OpenAI from 'openai';

const client = niyoos.wrap(new OpenAI({ apiKey: process.env.NIYOOS_AGENT_KEY })); // -> https://api.niyoos.com/proxy/v1

await niyoos.run(async () => {                 // a new run: a UUIDv7 id, steps counted 1, 2, 3 …
  await client.chat.completions.create({ model: 'gpt-4o', messages });
  await niyoos.run(async () => {               // a sub-agent: its own run, parent linked automatically
    await client.chat.completions.create({ model: 'gpt-4o', messages });
  });
  emitter.on('job', niyoos.bind(handleJob));   // callbacks fired from outside the run need bind()
});

Quickstart — plain JavaScript (require)

const niyoos = require('niyoos');
const { OpenAI } = require('openai');

const client = niyoos.wrap(new OpenAI({ apiKey: process.env.NIYOOS_AGENT_KEY }));

niyoos.run(async () => {
  await client.chat.completions.create({ model: 'gpt-4o', messages });
  await niyoos.run(async () => { /* sub-agent */ });
}).then(() => console.log('run finished'));

niyoos.run(fn, { runId, parentRunId }) continues a run, or links a sub-agent that runs in another process or worker thread: pass it niyoos.currentRunId() from the parent. run() returns whatever fn returns.

What goes on the wire

| Header | Value | |---|---| | x-niyoos-run-id | the run id, 8–64 of A-Z a-z 0-9 _ - | | x-niyoos-step | 1, 2, 3 … within the run; a retry repeats its step | | x-niyoos-parent-run-id | the parent run, for a nested run | | x-niyoos-client | sdk-typescript, on every request | | User-Agent | the openai library's own, with niyoos-typescript/0.1.0 appended |

Outside a run, none of the three run headers is sent. Run headers also work without this SDK: any HTTP client can send them; the SDK only mints the ids, counts steps and links parents for you.

Behaviour you should know

  • Labels are advisory. Every policy (kill switch, rate and cost limits) is enforced by the server whether or not a call is labelled. If the SDK ever fails to build a label, the call goes out unlabelled, with one NiyoosWarning process warning, and is not otherwise affected.
  • wrap() changes the client you pass and returns it (openai 4.x–7.x). It sets the Niyoos base URL only when the client still points at the OpenAI default; a baseURL you set yourself is left alone. Copies made later with client.withOptions() stay labelled.
  • The run follows await, Promise.all, timers and callbacks started inside it. An EventEmitter listener runs in the context of whoever calls emit(): if that happens outside the run, wrap the listener with niyoos.bind(fn).
  • worker_threads share nothing: post niyoos.currentRunId() to the worker and call niyoos.run(fn, { parentRunId }) inside it — the worker's calls become a child run.
  • A generator that makes calls belongs to whichever run is open when it is resumed.
  • Retries are recognised from the openai library's x-stainless-retry-count header and repeat the step of the attempt they retry, even inside Promise.all.
  • The request body is never modified.
  • Node only. The SDK needs node:async_hooks. Do not use it in a browser: an agent key must never be shipped to one. Server-side runtimes are the supported target.
  • For other libraries, pass niyoos.wrapFetch() (or the ready-made niyoos.fetch) as their fetch option, e.g. new Anthropic({ fetch: niyoos.wrapFetch(), baseURL: 'https://api.niyoos.com/proxy' }). There are no dedicated Anthropic or LangChain adapters in v0.1.

openai is an optional peer dependency: >=4 <8. Note that openai 7.x itself requires Node 22.

Licence

Apache-2.0. Questions: [email protected] · https://niyoos.com