Skip to content

Automatically discover, filter, and test free AI models available on OpenRouter. This Node.js tool fetches the full model catalog, detects truly free models, runs real API tests, and generates a clean list of working free LLMs

Notifications You must be signed in to change notification settings

danseb93/filter-free-models-for-open-router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenRouter Free Model Tester

[English] | Español

A simple but powerful Node.js tool to automatically discover, filter, and test free AI models available on OpenRouter.

This project was created to answer a very practical question:

Which free models on OpenRouter actually work right now and respond correctly through the API?

OpenRouter publishes a list of models and pricing, but in practice:

  • Some “free” models fail
  • Some are temporarily unavailable
  • Some return errors or empty responses

This app automates the full process end‑to‑end:

  1. Download all models from OpenRouter
  2. Filter only the 100% free ones
  3. Test each free model with a real API call
  4. Save a clean list of models that actually work

✨ Features

  • Fetches the full public OpenRouter model catalog

  • Filters only models with zero cost in all pricing categories

  • Tests each free model with a real prompt

  • Generates clean JSON outputs:

    • All models
    • Free models only
    • Working free models only

🧠 How the app works (Pipeline)

When you run npm start, the app executes four scripts in sequence:

1️⃣ get-all-models.js

  • Calls the OpenRouter public endpoint: /api/frontend/models
  • Downloads the full list of available models
  • Saves the result to:
output/all-models.json

2️⃣ filterFreeModels.js

  • Reads all-models.json

  • Filters only models where all pricing fields are equal to "0":

    • prompt
    • completion
    • image
    • image_output
    • internal_reasoning
  • Extracts and cleans useful fields:

    • name
    • model_variant_slug
    • description
    • context length
    • modalities
  • Saves the result to:

output/free-models.json

3️⃣ test-models.js

  • Reads free-models.json

  • For each free model:

    • Sends a test prompt to /api/v1/chat/completions
    • Uses your OpenRouter API key
    • Checks if the model returns a valid answer

Test prompt used:

"Hello, how are you? Answer in less than 10 words."

  • Successful models are marked as working

  • Failed models are logged with error details

  • Saves only the working models to:

output/models-working.json

4️⃣ start-check-models.js

This is the orchestrator script.

It runs, in order:

  1. get-all-models.js
  2. filterFreeModels.js
  3. test-models.js

And prints a final summary when finished.


📦 Installation

Clone the repository and install dependencies:

npm install

🔑 Environment configuration

You must provide your OpenRouter API key using a .env file.

Create a file named .env in the root of the project:

OPENROUTER_API_KEY=sk-or-v1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

⚠️ Important:

  • Do NOT use quotes
  • Do NOT add semicolons

Correct:

OPENROUTER_API_KEY=sk-or-v1-abc123

Incorrect:

OPENROUTER_API_KEY="sk-or-v1-abc123";

▶️ How to run

Simply execute:

npm start

This runs:

node start-check-models.js

The full pipeline will execute automatically.


📁 Output files

After running, you will find:

output/
 ├─ all-models.json        # Full OpenRouter catalog
 ├─ free-models.json       # Only 100% free models
 └─ models-working.json   # Free models that actually work

models-working.json is the final and most useful result.


🛠️ Requirements

  • Node.js 18+ (or any version with native fetch support)
  • An OpenRouter account and API key

⚡ Notes

  • Requests are executed in parallel. If OpenRouter rate‑limits you, consider adding concurrency control.
  • Some models may temporarily fail depending on availability.
  • This tool uses only public and official OpenRouter endpoints.

🎯 Motivation

This project was created to:

  • Discover which free models are truly usable
  • Avoid wasting time manually testing models
  • Build an automated benchmark of free AI availability
  • Help developers quickly choose working free models

📜 License

MIT License


🙌 Author

Created by Daniel Rincon — Founder Nahoral Labs

Website

About

Automatically discover, filter, and test free AI models available on OpenRouter. This Node.js tool fetches the full model catalog, detects truly free models, runs real API tests, and generates a clean list of working free LLMs

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published