Professional, unified, and enhanced index for LLM models based on OpenRouter with ArtificialAnalysis intelligence.
Project description
📊 OpenRouter Insights
OpenRouter Insights is a professional, production-ready Python library that provides a unified, high-fidelity index of Large Language Models.
🚀 Quick Start
Installation
pip install openrouter-insights
Usage
from openrouter_insights import LLMIndexSync
# Initialize (Uses local registry by default)
index = LLMIndexSync()
# 1. Find the best model for a specific task
best_coder = index.get_best_models(tag="coding", limit=1)[0]
print(f"Recommended for code: {best_coder.name} (${best_coder.pricing.input}/1M tokens)")
# 2. Advanced Filtering
frontier_models = index.filter_models(
tier="frontier",
min_intelligence=80,
modalities=["image"]
)
🛠️ Data Freshness (Git-Ops)
This library uses a Git-Ops automation workflow. Every 24 hours, a GitHub Action:
- Fetches the latest data from OpenRouter and ArtificialAnalysis.
- Performs fuzzy matching and data unification.
- Updates the local SQLite and JSON registries.
- Idempotent Sync: Only commits changes if the model intelligence or pricing has actually evolved.
📈 Key Advantages
| Feature | OpenRouter Insights | Standard API List |
|---|---|---|
| Intelligence Scores | ✅ Included (from ArtificialAnalysis) | ❌ Missing |
| Performance Tiers | ✅ Categorized (Frontier/Pro/Lite) | ❌ Raw list |
| Efficiency Metrics | ✅ Bang-for-buck calculation | ❌ Manual calc |
| Fuzzy Discovery | ✅ Advanced Search & Ranking | ❌ Exact match only |
🧪 Testing & Reliability
The library is backed by a comprehensive test suite (Unit, Integration, and Facade tests) to ensure data integrity and interface stability.
# Run tests
pytest
📄 License
Distributed under the MIT License. See LICENSE for more information.
🤝 Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Luis Eduardo Farfan Melgar - lucho.farfan9@gmail.com
Project Link: https://github.com/luisfarfan/openrouter-insights
Ideal for modern asynchronous applications.
import asyncio
from openrouter_insights import LLMIndex
async def main():
# Uses local JSON registry (no DB setup required)
client = LLMIndex(mode="json")
# Smart Discovery: Get the smartest model for coding
models = await client.get_best_for_coding(limit=1)
if models:
print(f"Best model: {models[0].name} (Tier: {models[0].performance_tier})")
# Full Fuzzy Search
results = await client.search("gpt4-o reasoning")
for r in results:
print(f"Matched: {r.id}")
asyncio.run(main())
🕒 Sync Facade (For Scripts / Notebooks)
No async/await boilerplate. Pure simplicity.
from openrouter_insights import LLMIndexSync
client = LLMIndexSync(mode="json")
# Get the absolute cheapest frontier model
cheap_pro = client.get_cheapest(tier="frontier", limit=3)
for m in cheap_pro:
print(f"{m.name}: ${m.pricing.input}/1M tokens")
🕒 Data Freshness & Automation (Git-Ops)
OpenRouter Insights is not a static file. We run an automated 24-hour synchronization job via GitHub Actions (CRON) that:
- Fetches the latest models and pricing from OpenRouter.
- Unifies benchmark data from ArtificialAnalysis.
- Processes the results via our Matching Engine.
- Commits the fresh
openrouter_insights.sqliteand.jsonback to the repository.
This ensures you always have access to the latest frontier models as they are released.
🧠 Smart Query Methods
OpenRouter Insights comes with pre-built logic to discover models based on real-world capabilities:
.get_smartest(): Highest intelligence scores first..get_cheapest(): Lowest cost-to-output first..get_best_for_coding(): Top-tier coding performers..get_top_frontier(): Only the best models in the world..get_fastest(): Highest Tokens Per Second (TPS).
✅ Verified Reliability
We take production stability seriously. Every release is validated against a comprehensive test suite:
- Unit Tests: Logic for classification, tiers, and matching engine.
- Integration Tests: Mocked gateway verification for OpenRouter and ArtificialAnalysis.
- Persistence Tests: Integrity checks for both SQLite and JSON engines.
- Facade Tests: Sync/Async interface consistency.
Current Status: 19 tests passed (100% success rate).
📖 Documentation
Detailed architectural and domain documentation can be found in the docs/ folder:
Developed with ❤️ for the AI Engineering community.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openrouter_insights-0.5.0.tar.gz.
File metadata
- Download URL: openrouter_insights-0.5.0.tar.gz
- Upload date:
- Size: 18.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.3 CPython/3.12.3 Linux/6.17.0-1008-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c898bbd3b54955ecc8e4eee5bf8f812a1c18db88f517e7ae525f85884d66f94
|
|
| MD5 |
aef240f4be47d3323d0aa85fc35d05ad
|
|
| BLAKE2b-256 |
3f5e15c43193a116c3679f798ddf7985df4cbf60c6c4886156e94f441e7a324a
|
File details
Details for the file openrouter_insights-0.5.0-py3-none-any.whl.
File metadata
- Download URL: openrouter_insights-0.5.0-py3-none-any.whl
- Upload date:
- Size: 23.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.3 CPython/3.12.3 Linux/6.17.0-1008-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dedc1a627c958e8b7ecd06db716f9597509c2da1ef1e5afd804c550a1cc03011
|
|
| MD5 |
6dc319529c0222aea46cebe8e767f56b
|
|
| BLAKE2b-256 |
de0c5718e74b13db322b92438fcfa57484e61431d563b26b6de59f7c8e27d9c2
|