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

multi-ai-wrapper

v1.0.1

Published

The ultimate Node.js wrapper for OpenAI, Anthropic (Claude), and Google Gemini. Features unified API, automatic provider fallback, real-time cost tracking, and streaming support. The best multi-LLM SDK for reliable AI apps.

Readme

🤖 Multi-AI Wrapper

npm version License: MIT OpenAI Anthropic Google Gemini

The Universal API for Generative AI.

Use OpenAI (GPT-4), Anthropic (Claude 3.5), and Google Gemini through a single, unified interface. Never worry about API downtime again with built-in automatic fallbacks. Monitor every penny with real-time cost tracking.

Build reliable, cost-effective AI applications in minutes, not days.

🌟 GitHub Repository: https://github.com/Mehulbirare/multi-ai-wrapper


⚡ Why Use Multi-AI Wrapper?

Developers choose multi-ai-wrapper over LangChain or official SDKs because it solves the biggest problems in AI integration:

| Feature | multi-ai-wrapper | Official SDKs | LangChain | | :--- | :---: | :---: | :---: | | Unified API | ✅ Yes | ❌ No | ✅ Yes | | Automatic Fallback | ✅ Built-in | ❌ Manual | ⚠️ Complex | | Cost Tracking | ✅ Real-time (USD) | ❌ No | ❌ Difficult | | Lightweight | ✅ Extremely | ✅ Yes | ❌ Heavy | | Streaming | ✅ Unified Stream | ⚠️ Varies | ✅ Yes |

Key Benefits

  1. Zero Downtime (High Availability): If OpenAI is down, your app automatically switches to Anthropic or Gemini. Your users never see an error.
  2. Cost Optimization: Track spending per provider and model. Switch to cheaper models instantly with aliases like "cheap" or "smart".
  3. No Vendor Lock-in: Write your code once. Switch providers by changing one line of configuration.
  4. Developer Experience: Simple, intuitive API that just works. No complex abstractions or boilerplate.

📦 Installation

npm install multi-ai-wrapper

🚀 Quick Start

1. Initialize

Create a single instance for your entire app.

const AI = require('multi-ai-wrapper');

const ai = new AI({
  providers: [
    { name: 'openai', apiKey: process.env.OPENAI_API_KEY, priority: 1 },    // Primary
    { name: 'anthropic', apiKey: process.env.ANTHROPIC_API_KEY, priority: 2 } // Backup
  ]
});

2. Chat (Unified API)

const response = await ai.chat({
  message: "Explain quantum computing to a 5-year-old",
  model: "smart", // Automatically uses GPT-4o or Claude 3.5 Sonnet
  temperature: 0.7
});

console.log(response.text);
console.log(`Provider used: ${response.provider}`); // e.g., "openai"
console.log(`Cost: $${response.cost}`); // e.g., "$0.0024"

3. Stream (Real-time)

const stream = await ai.chatStream({
  message: "Write a futuristic story...",
  model: "fast" // Automatically uses GPT-4o-mini or Gemini Flash
});

for await (const chunk of stream) {
  process.stdout.write(chunk.text);
}

🔧 Advanced Features

Smart Model Aliases

Don't memorize model names. Use aliases that map to the best option for each provider:

  • "smart": Best capability (GPT-4o, Claude 3.5 Sonnet, Gemini 1.5 Pro)
  • "fast": Low latency (GPT-4o-mini, Claude Haiku, Gemini Flash)
  • "cheap": Lowest cost (GPT-4o-mini, Gemini Flash)

Detailed Cost Analytics

const stats = ai.getCostStats();
console.log(stats);
/*
{
  totalCost: 0.145,
  requestCount: 52,
  byProvider: {
    openai: { cost: 0.120, requests: 40 },
    anthropic: { cost: 0.025, requests: 12 }
  }
}
*/

📚 Documentation

For a deep dive into architecture and advanced configuration, see the Detailed Explanation & Guide.

🤝 Contributing

We welcome contributions! Whether it's adding a new provider (Mistral, Cohere, etc.) or fixing a bug, please check out our repository.

📄 License

MIT © Mehulbirare