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

unlimit-keys

v0.2.2

Published

An API key rotation system using Redis

Readme

🔑 unlimit-keys

Never get blocked by rate limits again!

Tired of hitting "Rate Limit Exceeded" errors? Use this tool to automatically rotate between your API keys. It picks the best key every time you make a request - so you can use AI services (Google Gemini, Groq, OpenAI, and more) without worrying about limits!

What you get:

  • 🚀 Use APIs 3x more (with 3 keys), 10x more (with 10 keys), etc.
  • 🔄 Automatic key rotation - no manual switching
  • ✅ Works with ANY API (AI, weather, payment, search, etc.)
  • ⚡ Super fast - handles thousands of requests per second
  • 🔒 Works perfectly with serverless apps and high-traffic services

Quick Start 🚀

Installation

Using npm:

npm install unlimit-keys

Using pnpm:

pnpm add unlimit-keys

Setup

1. Get Redis (Free!) 🗄️

We use Upstash Redis - it's free and perfect for this. Follow their setup guide to get your Redis URL and token.

Create a .env.local file with your keys:

# Upstash Redis (get from https://upstash.com - it's free!)
REDIS_URL=https://your-redis-url.upstash.io
REDIS_TOKEN=your-token

# Your API keys (comma or newline separated)
API_KEYS="key1,key2,key3"

2. Save Your Keys 📝

Run this once to save all your keys to Redis:

Using npm:

npx unlimit-keys sync

Using pnpm:

pnpm dlx unlimit-keys sync

How to Use It

Option 1: In Your Code 💻

import { getLeastUsedKey } from 'unlimit-keys';

// Get the best key to use right now
const apiKey = await getLeastUsedKey();
console.log("Using API Key:", apiKey);

// Use it with your AI service
const response = await fetch('https://api.example.com/chat', {
  headers: { 'Authorization': \`Bearer \${apiKey}\` }
});

Option 2: Command Line 📱

npx unlimit-keys get-key

Real Examples 📚

Using with Google Gemini 🤖

import { getLeastUsedKey } from 'unlimit-keys';

async function askGemini(question: string) {
  const apiKey = await getLeastUsedKey();
  
  const response = await fetch('https://generativelanguage.googleapis.com/v1beta/models/gemini-flash-latest:generateContent', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-goog-api-key': apiKey
    },
    body: JSON.stringify({
      contents: [{ parts: [{ text: question }] }]
    })
  });
  
  return response.json();
}

// Use many times without rate limits!
await askGemini('What is AI?');
await askGemini('How do I code?');

Using with Groq ⚡

import { getLeastUsedKey } from 'unlimit-keys';
import Groq from 'groq-sdk';

async function askGroq(question: string) {
  const apiKey = await getLeastUsedKey();
  
  const client = new Groq({ apiKey });
  const message = await client.messages.create({
    model: 'mixtral-8x7b-32768',
    max_tokens: 1024,
    messages: [{ role: 'user', content: question }]
  });
  
  return message;
}

await askGroq('Tell me a joke');

Using with Google AI SDK 🎯

import { getLeastUsedKey } from 'unlimit-keys';
import { GoogleGenerativeAI } from '@google/generative-ai';

async function askWithSDK(question: string) {
  const apiKey = await getLeastUsedKey();
  const genAI = new GoogleGenerativeAI(apiKey);
  
  const model = genAI.getGenerativeModel({ model: 'gemini-flash-latest' });
  const result = await model.generateContent(question);
  
  return result.response.text();
}

await askWithSDK('What is machine learning?');

Using with Regular APIs 🌍

Not just for AI! Works with any API that uses keys. Here's an example with a weather API:

import { getLeastUsedKey } from 'unlimit-keys';

async function getWeather(city: string) {
  const apiKey = await getLeastUsedKey();
  
  const response = await fetch(`https://api.openweathermap.org/data/2.5/weather?q=${city}&units=metric&appid=${apiKey}`, {
    method: 'GET'
  });
  
  return response.json();
}

// Make lots of weather requests without hitting rate limits!
await getWeather('London');
await getWeather('New York');
await getWeather('Tokyo');

Supported Services 🌐

AI & ML Services:

Other APIs:

  • Weather APIs
  • Payment APIs
  • Search APIs
  • Translation APIs
  • And literally any API that uses keys!

Works with anything that has API rate limits!

How It Works Behind the Scenes 🔧

  1. You have multiple keys - Like 3 API keys
  2. We pick the best one - We use the key that's been used the least recently
  3. We use it - You make your API call
  4. We update the score - We mark that key as just-used so we don't pick it again
  5. Repeat! - Next time you call us, we pick a different key

This spreads out your requests so you hit rate limits slower!

License

MIT