I've spent the last while building MCQplex, an exam-prep
platform for Nepal's NEB curriculum. Along the way I built a few pieces of
infrastructure that had nothing to do with exams specifically, so I pulled
them out into their own packages:
llm-free-cascade
Free-tier LLM APIs (Gemini, Groq, Cerebras, and others) are individually
rate-limited, but between them they add up to a lot of free inference if you
just fail over from one to the next. This cascades a chat completion across
however many you've got keys for, with automatic multi-key rotation (if
you've made more than one free account on a provider) and cooldown for a
provider that's structurally broken. Zero dependencies.
const { LLMCascade } = require('llm-free-cascade');
const cascade = LLMCascade.fromEnv();
const { text, provider } = await cascade.generate({ system, user });
pdf-render-pool
Launching a fresh headless Chromium per PDF (the naive way to use Puppeteer)
costs 1-2 seconds and ~200MB of RAM every time. This keeps one browser warm
and gives each render its own page, with a concurrency cap so a burst of PDF
requests queues instead of taking the server down.
mongo-job-lock
If you run node-cron jobs on more than one instance (PM2 cluster, several
servers), every instance fires the job unless you do something about it.
This is a tiny MongoDB-backed advisory lock — steal-on-expiry, so a crashed
holder can't deadlock the job forever — for whatever Mongo connection you
already have.
All three: zero or optional-peer dependencies, MIT licensed, tested, on npm.
Feedback / PRs welcome, especially on llm-free-cascade since free-tier
model names drift constantly and providers.json is set up so a one-file PR
fixes a stale one.
Top comments (0)