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 🙏

© 2025 – Pkg Stats / Ryan Hefner

autorouter-ai

v0.1.0

Published

Auto-select the best AI model for your task

Readme

Autorouter

Auto-select the best AI model for your task based on natural language queries.

Installation

npm install autorouter

Quick Start

import { AutoRouter } from 'autorouter';

const router = new AutoRouter({ apiKey: 'ar_live_your_api_key_here' });

const models = await router.selectModel('build a chatbot');

console.log(models);
// [
//   {
//     id: 'meta-llama/Llama-2-7b-chat-hf',
//     name: 'Llama-2-7b-chat-hf',
//     description: 'A conversational AI model...',
//     task: 'text-generation',
//     provider: 'huggingface',
//     license: 'llama2',
//     downloads: 5000000,
//     score: 0.95
//   },
//   ...
// ]

API Reference

new AutoRouter(config)

Creates a new AutoRouter instance.

Parameters:

  • config.apiKey (required): Your Autorouter API key
  • config.baseUrl (optional): Custom API base URL (default: https://api.autorouter.ai)

selectModel(query, options?)

Searches for the best models matching your query.

Parameters:

  • query (string): Natural language description of your task
  • options.limit (number, optional): Number of results to return (1-20, default: 5)
  • options.filter (object, optional): Filter results by metadata

Returns: Promise<ModelResult[]>

Example:

// Basic query
const models = await router.selectModel('generate images');

// With options
const models = await router.selectModel('summarize text', {
  limit: 10,
  filter: { license: 'apache-2.0' }
});

Model Result

interface ModelResult {
  id: string;           // Model identifier
  name: string;         // Model name
  description: string;  // Model description
  task: string;         // Task type (e.g., 'text-generation')
  provider: string;     // Provider (e.g., 'huggingface')
  license: string;      // License type
  downloads?: number;   // Download count
  score: number;        // Similarity score (0-1)
  endpoint?: string;    // Inference endpoint URL
}

Pricing

  • Free Tier: 50 queries/month included
  • Paid: $10 for 1,000 additional queries
  • Pro: Custom pricing for high-volume usage

Get your API key at autorouter.ai

Error Handling

import { AutoRouter, AuthenticationError, InsufficientCreditsError } from 'autorouter';

try {
  const models = await router.selectModel('transcribe audio');
} catch (error) {
  if (error instanceof AuthenticationError) {
    console.error('Invalid API key');
  } else if (error instanceof InsufficientCreditsError) {
    console.error('Out of credits');
  } else {
    console.error('Request failed:', error.message);
  }
}

Use Cases

  • Chatbot development: "build a conversational chatbot"
  • Image generation: "create realistic product photos"
  • Text summarization: "summarize long documents"
  • Video generation: "generate social media videos"
  • Code generation: "generate Python scripts"

License

MIT