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

sopanam-ai

v1.0.0

Published

SopanamAI - Direct AI chat client with language model support. Built for WhatsApp bots and Node.js apps.

Readme

sopanam-ai

SopanamAI — Direct AI chat client with language model support. Built for WhatsApp bots (Baileys) and Node.js apps — no HTTP server, no API overhead.

Features

  • Direct function calls — No HTTP server or API layer
  • 5 language models — normal, malayalam, tamil, hindi, english
  • Multi-turn conversations — Built-in conversation history tracking
  • Auto-authentication — No manual login needed
  • Token rotation — Avoids rate limits automatically
  • Zero dependencies — Uses only native Node.js APIs
  • Node.js 18+ — Native fetch and crypto.randomUUID()

Installation

# From local path
npm install /path/to/sopanam-ai

# Or copy the folder into your project's node_modules

Usage

One-shot Chat

const { chat } = require('sopanam-ai');

// Normal mode (no language restriction)
const reply = await chat('What is 2+2?');

// Language-specific
const ml = await chat('Say hello', 'malayalam');
const ta = await chat('Say hello', 'tamil');
const hi = await chat('Say hello', 'hindi');
const en = await chat('Say hello', 'english');

Multi-turn Conversation

const { createConversation } = require('sopanam-ai');

const convo = createConversation('malayalam');
const r1 = await convo.ask('നിന്റെ പേരെന്ത?');
const r2 = await convo.ask('നന്ദി!'); // remembers context

// Get history
console.log(convo.getHistory());

// Clear history
convo.clearHistory();

In a Baileys WhatsApp Bot

const { chat } = require('sopanam-ai');

sock.ev.on('messages.upsert', async ({ messages }) => {
  const msg = messages[0];
  if (!msg.message) return;

  const text = msg.message.conversation || '';
  if (text.startsWith('!ai ')) {
    const prompt = text.slice(4);
    const reply = await chat(prompt, 'malayalam');
    await sock.sendMessage(msg.key.remoteJid, { text: reply });
  }
});

Configuration

const { configure } = require('sopanam-ai');

configure({
  enableRotation: true,   // Enable token rotation (default: true)
  rotationLimit: 10       // Requests before rotating (default: 10)
});

Models

| Model | Description | |---|---| | normal | No language restriction | | malayalam | Responds only in Malayalam (മലയാളം) | | tamil | Responds only in Tamil (தமிழ்) | | hindi | Responds only in Hindi (हिन्दी) | | english | Responds only in English |

API

chat(prompt, model?)

  • prompt (string) — The user's message
  • model (string, default: 'normal') — Language model
  • Returns: Promise<string> — The AI response

createConversation(model?, options?)

  • model (string, default: 'normal') — Language model
  • options (object)
    • maxTurns (number, default: 20) — Max conversation turns to keep in memory (to prevent overflow)
  • Returns: { ask(prompt), getHistory(), clearHistory() }

configure(options)

  • enableRotation (boolean) — Enable/disable token rotation
  • rotationLimit (number) — Requests before rotating session

Error Handling

The package exports custom error classes for better control:

const { chat, errors } = require('sopanam-ai');

try {
  await chat('Hello');
} catch (err) {
  if (err instanceof errors.NetworkError) {
    console.log('Network issue, maybe retry?');
  } else if (err instanceof errors.AuthError) {
    console.log('Session expired or invalid');
  } else {
    console.log('Unknown error:', err.message);
  }
}

MODELS

Object containing all model definitions.

License

MIT