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

naija-nllb-translate

v1.0.0

Published

Translate between English and major Nigerian languages (Hausa, Igbo, Yoruba, Nigerian Fulfulde, Kanuri) using Meta's NLLB-200 model, run locally via ONNX Runtime (transformers.js) — no Hugging Face Space or Gradio dependency at runtime.

Readme

naija-nllb-translate

Translate between English and major Nigerian languages using Meta's open-source NLLB-200 model, run locally in Node.js via ONNX Runtime (@huggingface/transformers).

No Hugging Face Space, no Gradio, no per-request network call. The model weights are downloaded once (from the Hugging Face Hub) and cached on disk; every translation after that runs fully in-process, offline.

Supported languages

| Key | Display name | | -------------- | ------------------------------------ | | english | English | | hausa | Hausa | | igbo | Igbo | | yoruba | Yoruba | | fulfulde | Nigerian Fulfulde | | kanuriArabic | Central Kanuri (Arabic script) | | kanuriLatin | Central Kanuri (Latin script) |

Not currently supported by NLLB-200 (and therefore not in this package): Efik, Ibibio, Tiv, Edo/Bini, Nigerian Pidgin, and most other Nigerian languages beyond the list above. These are absent from FLORES-200, the benchmark NLLB-200 is trained/evaluated on — there is currently no general-purpose MT model covering them. (MAFAND-MT has some Pidgin data if you need that specifically; Efik/Ibibio/Tiv are research-stage only, e.g. the IBOM dataset.)

Install

npm install naija-nllb-translate

Requires Node.js >= 18. On first install, onnxruntime-node downloads a native binary — make sure api.nuget.org (or your platform's equivalent) is reachable in your environment, or the postinstall step will fail.

Usage

import { translate, translateFromEnglish } from "naija-nllb-translate";

const yoruba = await translate("Good morning, how are you?", "english", "yoruba");

const hausa = await translateFromEnglish("Thank you very much", "hausa");

The first call downloads and caches the model (~600MB for the default q8 quantized weights) — expect that first call to take a while. Every call after that, in the same process, is fast.

Warming up ahead of time (recommended for servers)

In a long-running server (Node backend, Next.js API route on a persistent runtime, etc.), call warmUp() once at startup so the model is already loaded before your first real request arrives:

import { warmUp } from "naija-nllb-translate";

await warmUp(); // do this once, at process start

Fully offline (no network at runtime, ever)

Pre-download the model folder yourself (e.g. via git lfs clone https://huggingface.co/Xenova/nllb-200-distilled-600M or the huggingface_hub CLI) onto the machine that will run this package, then:

await translate(text, "english", "hausa", {
  localModelPath: "/path/to/models",
  allowRemoteModels: false,
});

Smaller/faster, at a quality cost

await translate(text, "english", "hausa", { dtype: "q4" });

Hosting notes

This runs a ~600MB model in-process, so where you deploy it matters:

  • Vercel / Netlify serverless functions: not recommended. Free-tier function bundle size limits (Vercel's default is 250MB unzipped) and execution timeouts (10s on free tiers) don't fit a 600MB model plus cold inference well, and serverless functions don't keep the model warm in memory between invocations — you'd reload it on every cold start.
  • A persistent Node process is the right shape — a Next.js API route is fine as the interface, but deploy it somewhere that keeps a long-running container: a small VPS, Render.com (free web service tier), or Fly.io. Call warmUp() once at boot so the model loads a single time and stays in memory for the life of the process.
  • Fully local/offline — run it as a local Node service with no hosting at all, which fits well alongside on-device/offline-first tooling.
  • Browser-only@huggingface/transformers also runs client-side via WASM/WebGPU, so a static site could translate entirely in the visitor's browser with no backend, at the cost of a large first-load download and slower inference on typical client hardware.

Limitations to know about

  • Translation quality: NLLB-200 is a general-purpose model, not Nigeria-specific. Translations may miss cultural nuance or idiom — don't rely on it for legal, medical, or official documents without review.
  • Model size / RAM: the default q8 600M model needs roughly 1-2GB of RAM to run comfortably. Use dtype: "q4" if you're memory-constrained.
  • Not affiliated with Meta or Hugging Face — this is an unofficial convenience wrapper around a publicly available model.

License

MIT