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

loserai

v1.2.4

Published

A developer-friendly SDK to send prompts to multiple LLM providers and save responses to files.

Readme

loserai

The Elite AI Engineering SDK — A project-aware, streaming-first CLI and SDK that makes LLM integration unstoppable.

npm version License: MIT Node.js >=18


Advanced Features

  • Smart Context (Project Awareness): Automatically scans your directory, reads your README.md, and understands your file structure.
  • Semantic Code Graph (RAG): Deep-dives into your project to find the exact code snippets relevant to your prompt.
  • Autonomous Self-Healing: Validates code via shell commands (e.g., npm test) and automatically fixes errors until it passes.
  • Multi-File Orchestration: Proposes and applies changes across multiple files in a single atomic operation.
  • Multi-Provider Backbone: Supports groq, nim, gemini, grok, and ollama with a resilient fallback chain. If one API limit is hit, it auto-fails over to the next.
  • Actionable Agentic Tools: Allow the AI to request system actions like installing dependencies or running shell commands.
  • Live Streaming UI: Watch the AI "type" in real-time directly in your terminal with beautiful formatting.
  • Unstoppable Fallback: Local-first mindset. Falls back to your local Ollama instance if cloud APIs fail.
  • Resilient Fallback Chain: Automatically cycles through GroqNVIDIA NIMGeminiGrokOllama.

Installation

npm install loserai
# or use it instantly via npx
npx loserai "Explain quantum physics" physics.txt

Quick Start

CLI (The "Instant" Way)

loserai is built to be used directly from your terminal.

# Watch it stream a project-aware summary
npx loserai "Summarize this project" summary.txt --context

# Write code with local Ollama fallback
npx loserai "Write a thread-safe Queue in C++" queue.cpp --fallback

# Use the Elite Features
npx loserai "Refactor my SDK" src/index.ts --semantic --multi --validate "npm test"
npx loserai "Setup a new project" init.txt --tools

SDK (The "Programmatic" Way)

import { generate } from "loserai";

const result = await generate({
  prompt: "Build a responsive React navigation bar",
  output: "src/components/Nav.tsx",
  context: true,        // Enable Project Awareness
  stream: true,         // Enable real-time console streaming
  fallback: true,       // Enable auto-resilience
  onChunk: (chunk) => {
    // Optional: Do something with each token as it arrives
  }
});

console.log(`Success! Result saved to: ${result.outputPath}`);

Core Capabilities

Smart Context (--context)

When enabled, loserai doesn't just look at your prompt. It scans your cwd (current working directory) to inject:

  1. Project Structure: A tree view of your files (up to depth 3).
  2. Project Identity: The contents of your README.md and package.json.
  3. Style Matching: The AI learns your naming conventions and library choices.

Live Streaming

Streaming is enabled by default in the CLI. The SDK supports an onChunk callback for building your own streaming UIs.

  • CLI: Instant feedback, no spinners, real-time typing.
  • SDK: AsyncIterable support for high-concurrency streaming.

Local Model Support (Ollama)

loserai is built for privacy and reliability. If you have Ollama running locally, it will act as a failsafe "Safety Net."

  • No Internet? No problem.
  • API Limits? It switches to local automatically.
  • Privacy? Use provider: "ollama" for 100% local processing.

Dynamic Token Scaling

loserai analyzes your prompt's intent:

  • Simple (Math/Short questions): Limits response to ~150 tokens. Instructs AI to be "Extremely Concise."
  • Complex (Coding/Architecture): Unlocks ~4096 tokens. Instructs AI to provide "Production-Ready Implementations."

Configuration

1. Configure your API keys:

Create a .env file in your project root, or set environment variables:

GROQ_API_KEY=your_groq_key
NIM_API_KEY=your_nim_key
GEMINI_API_KEY=your_gemini_key
GROK_API_KEY=your_grok_key
# OLLAMA_URL is optional (defaults to http://localhost:11434)
OLLAMA_URL=http://localhost:11434/api/chat
OLLAMA_MODEL=llama3

Comparison

| Feature | loserai | Other SDKs | |---|---|---| | Autonomous Self-Healing | Yes (Auto-Retries on Error) | No | | Semantic Context (RAG) | Yes (Local Keyword Graph) | Manual | | Multi-File Output | Yes (Atomic Orchestration) | Single File Only | | Actionable Tools | Yes (Agentic Execution) | No | | Project Awareness | Yes (Smart Context) | No | | Live Streaming | Yes (Default) | Manual | | Local Fallback | Yes (Ollama Support) | No | | Resilience | Auto-Fallback Chain | Static | | Cost Saving | Smart Intent Scaling | Fixed Limits |


License

MIT © pritpatel2412 & Contributors