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

@chirag127/oz-ai

v0.3.3

Published

Single client-side AI client for the fleet — wraps g4f (@gpt4free/g4f.dev) with multi-provider failover (default auto-router → DeepInfra → Puter). Framework-agnostic TS. chat/complete/vision/image/listModels, streaming, AbortSignal. Change the provider st

Readme

@chirag127/oz-ai

npm

Single client-side AI client for the whole fleet. Framework-agnostic TS. Primary backend: @chirag127/keyless-ai (kilo → ovh → pollinations, no API key, Node + browser). Secondary: direct Pollinations fetch + g4f (@gpt4free/g4f.dev) CDN clients as an extended failover tail.

Built-in: ordered failover chain, max 2 retries/provider, streaming via async-iterable, AbortSignal, graceful throw after ALL providers fail so callers can degrade.

Install

npm i @chirag127/oz-ai

Use

import { chat, complete, vision, image, listModels, OzAiError } from '@chirag127/oz-ai'

// one-shot
const answer = await complete('Summarize photosynthesis', { system: 'Be terse.' })

// multi-turn
const reply = await chat([
  { role: 'system', content: 'You are helpful.' },
  { role: 'user', content: 'Hello' },
])

// streaming
const stream = await chat([{ role: 'user', content: 'write a haiku' }], { stream: true })
for await (const chunk of stream) process.stdout.write(chunk)

// vision (data URL or http url)
const desc = await vision('What is in this image?', dataUrl)

// image generation → url
const url = await image('a white siamese cat', { model: 'flux' })

// every model across all providers
const models = await listModels() // string[], [] on total failure

// degrade gracefully
try {
  await complete('...')
} catch (e) {
  if (e instanceof OzAiError) render('AI unavailable')
}

API

| Fn | Signature | |---|---| | chat | (messages, { model?, signal?, temperature? }) => Promise<string> / (messages, { stream: true, ... }) => Promise<AsyncIterable<string>> | | complete | (prompt, { system?, model?, signal?, temperature? }) => Promise<string> | | vision | (prompt, imageDataUrl, { model?, signal? }) => Promise<string> | | image | (prompt, { model?, signal? }) => Promise<string> (url) | | listModels | (signal?) => Promise<string[]> | | setProviders | (Provider[] \| null) => void — override/reset the failover chain |

Also exports pure helpers buildPayload, buildVisionMessages, extractContent, extractDelta, extractImageUrl, modelId, plus types Message, ContentPart, ChatOptions, RequestPayload, Provider, and OzAiError.

Failover

Chain lives in one place (src/index.ts). Order: keyless-ai (kilo→ovh→pollinations) → pollinations-direct (raw fetch) → g4f.dev CDN clients. Change the order or set of providers HERE and every site inherits. Each provider gets up to 2 attempts before moving to the next; OzAiError throws only when all are exhausted.

License

MIT