@openpets/llm-models
v1.0.1
Published
LLM model discovery and comparison plugin - search and compare models from models.dev across multiple providers
Downloads
22
Maintainers
Readme
LLM Models Discovery Plugin
A comprehensive OpenCode plugin for discovering, searching, and comparing LLM models across multiple providers using the models.dev API. Find the perfect model for your use case with advanced filtering, cost analysis, and capability comparison.
Table of Contents
- Features
- Quick Start
- Available Tools
- Usage Examples
- Configuration
- API Reference
- Advanced Filtering
- Cost Analysis
- Model Comparison
Features
🔍 Model Discovery: Search across 17+ LLM providers 💰 Cost Analysis: Find free models or filter by cost 🎯 Capability Filtering: Search by reasoning, tool calling, multimodal support 📊 Model Comparison: Compare up to 5 models side-by-side 🌐 Provider Information: Get detailed provider and model documentation ⚡ Performance: 1-hour API response caching for fast queries 🔒 No API Keys Required: Uses public models.dev API
Quick Start
1. Installation
# Navigate to the openpets directory
cd /Users/andrewmaguire/LOCAL/Github/raggle-code/raggle-repo/core/openpets
# The plugin is already set up in pets/llm-models
cd pets/llm-models
# Install dependencies (if needed)
npm install2. Basic Usage
# List all LLM providers
opencode run "list all LLM providers"
# Find free models
opencode run "get all free models"
# Search for reasoning models
opencode run "search for models with reasoning capability"
# Get details about a specific model
opencode run "get details for openai gpt-4"Available Tools
1. list-llm-providers
List all available LLM model providers from models.dev.
Parameters:
includeDoc(optional, default: true): Include documentation URLs
Example:
opencode run "list all LLM providers"
opencode run "list providers without documentation"2. search-llm-models
Search for models with advanced filtering options.
Parameters:
provider(optional): Filter by provider IDfree(optional): Only show free modelsopenWeights(optional): Only show open-weight modelsreasoning(optional): Only show models with reasoning capabilitytoolCall(optional): Only show models with tool/function callingstructuredOutput(optional): Only show models with structured output supportmodality(optional): Filter by modality (text, image, audio, video, pdf)minContext(optional): Minimum context window sizemaxCostInput(optional): Maximum input cost per tokenmaxCostOutput(optional): Maximum output cost per tokenlimit(optional, default: 20): Maximum number of results
Examples:
# Search for free models
opencode run "search for free models"
# Search for models with tool calling
opencode run "search for models with tool calling"
# Search for multimodal models
opencode run "search for models with image modality"
# Search for models with large context windows
opencode run "search for models with minimum context 100000"
# Search for cheap models
opencode run "search for models with max input cost 0.5"3. get-free-llm-models
Get all free LLM models, optionally filtered by provider.
Parameters:
provider(optional): Filter by provider IDlimit(optional, default: 50): Maximum number of results
Examples:
# Get all free models
opencode run "get all free models"
# Get free models from Groq
opencode run "get free models from groq"
# Get free models from GitHub Copilot
opencode run "get free models from github-copilot"4. get-reasoning-models
Get all models with reasoning capabilities.
Parameters:
provider(optional): Filter by provider IDlimit(optional, default: 20): Maximum number of results
Examples:
# Get all reasoning models
opencode run "get reasoning models"
# Get reasoning models from OpenAI
opencode run "get reasoning models from openai"5. get-multimodal-models
Get all multimodal models (supporting 2+ modalities).
Parameters:
provider(optional): Filter by provider IDlimit(optional, default: 20): Maximum number of results
Examples:
# Get all multimodal models
opencode run "get multimodal models"
# Get multimodal models from specific provider
opencode run "get multimodal models from google"6. get-model-details
Get detailed information about a specific model.
Parameters:
providerId(required): Provider ID (e.g., 'openai', 'anthropic')modelId(required): Model ID (e.g., 'gpt-4', 'claude-3-opus')
Examples:
# Get details for GPT-4
opencode run "get details for openai gpt-4"
# Get details for Claude
opencode run "get details for anthropic claude-3-opus"
# Get details for Llama
opencode run "get details for groq llama-3-70b"7. compare-models
Compare multiple models side-by-side.
Parameters:
models(required): Array of 2-5 models to compare- Each model needs:
providerIdandmodelId
- Each model needs:
Examples:
# Compare GPT-4 and Claude
opencode run "compare models: openai gpt-4 and anthropic claude-3-opus"
# Compare multiple models
opencode run "compare gpt-4, claude-3-opus, and gemini-pro"
# Compare free models
opencode run "compare groq llama-3-70b and mistral mistral-large"Usage Examples
Scenario 1: Finding Free Models
# List all free models
opencode run "get all free models"
# Filter free models by provider
opencode run "get free models from groq"
opencode run "get free models from github-copilot"
# Find free models with specific capabilities
opencode run "search for free models with tool calling"
opencode run "search for free models with reasoning"Scenario 2: Cost Analysis
# Find the cheapest models
opencode run "search for models with max input cost 0.1"
# Find models under a specific price point
opencode run "search for models with max output cost 1.0"
# Compare costs across providers
opencode run "compare pricing for openai gpt-4 and anthropic claude-3-opus"Scenario 3: Capability Discovery
# Find models with reasoning
opencode run "get reasoning models"
# Find models with tool calling
opencode run "search for models with tool calling"
# Find models with structured output
opencode run "search for models with structured output"
# Find multimodal models
opencode run "get multimodal models"Scenario 4: Context Window Search
# Find models with large context windows
opencode run "search for models with minimum context 100000"
# Find models with specific context size
opencode run "search for models with minimum context 200000"Scenario 5: Provider-Specific Search
# Get all models from a provider
opencode run "search for openai models"
opencode run "search for anthropic models"
opencode run "search for groq models"
# Get free models from provider
opencode run "get free models from groq"
# Get reasoning models from provider
opencode run "get reasoning models from openai"Configuration
Environment Variables
This plugin requires no API keys as it uses the public models.dev API.
Optional configuration in .env:
# Logging level: debug, info, warn, error
LOG_LEVEL=info
# Cache duration for API responses in milliseconds (default: 3600000 = 1 hour)
CACHE_DURATION=3600000
# Custom models.dev API URL (if using a mirror or local instance)
MODELS_DEV_API_URL=https://models.dev/api.jsonAPI Reference
Provider List Format
{
"id": "openai",
"name": "OpenAI",
"modelCount": 25,
"doc": "https://platform.openai.com/docs"
}Model Format
{
"id": "gpt-4",
"name": "GPT-4",
"provider": "OpenAI",
"providerId": "openai",
"context": 128000,
"max_output": 4096,
"knowledge": "2023-12",
"modalities": ["text", "image"],
"reasoning": false,
"tool_call": true,
"structured_output": true,
"open_weights": false,
"cost": {
"input": 3.0,
"output": 6.0
}
}Cost Format
Costs are in fractional cents per token:
0.1= $0.001 per token1.0= $0.01 per token10.0= $0.10 per token
Advanced Filtering
Combining Filters
# Free models with reasoning
opencode run "search for free models with reasoning"
# Open-weight models with large context
opencode run "search for open weight models with minimum context 32000"
# Multimodal models with tool calling
opencode run "search for models with image modality and tool calling"
# Low-cost reasoning models
opencode run "search for reasoning models with max input cost 1.0"Provider-Specific Filtering
# Free models from specific provider
opencode run "get free models from groq"
# Reasoning models from specific provider
opencode run "get reasoning models from openai"
# Models with capabilities from provider
opencode run "search for anthropic models with tool calling"Cost Analysis
Understanding Pricing
The plugin shows costs in dollars per token:
Input: $0.000030/token = 3¢ per 1M tokens
Output: $0.000060/token = 6¢ per 1M tokensCost Comparison Examples
# Compare costs across providers
opencode run "compare models: openai gpt-4, anthropic claude-3-opus, google gemini-pro"
# Find cheapest models with specific capability
opencode run "search for reasoning models with max input cost 0.5"
# Find free alternatives
opencode run "get all free models"Cost Calculation
For a 10K token input and 2K token output:
Cost = (10,000 × input_cost) + (2,000 × output_cost)Example with GPT-4:
Cost = (10,000 × $0.000030) + (2,000 × $0.000060)
= $0.30 + $0.12
= $0.42Model Comparison
Comparison Table Format
When comparing models, you'll see:
| Feature | Model 1 | Model 2 | Model 3 | |---------|---------|---------|---------| | Provider | OpenAI | Anthropic | Google | | Context | 128,000 | 200,000 | 128,000 | | Max Output | 4,096 | 4,096 | 8,192 | | Input Cost | $0.000030 | $0.000015 | $0.000007 | | Output Cost | $0.000060 | $0.000075 | $0.000021 | | Reasoning | No | Yes | No | | Tool Calling | Yes | Yes | Yes | | Modalities | text, image | text | text, image | | Open Weights | No | No | No |
Comparison Examples
# Compare flagship models
opencode run "compare models: openai gpt-4, anthropic claude-3-opus, google gemini-pro"
# Compare free models
opencode run "compare models: groq llama-3-70b, github-copilot gpt-4"
# Compare reasoning models
opencode run "compare models: openai o1, anthropic claude-3-opus"
# Compare multimodal models
opencode run "compare models: openai gpt-4-vision, google gemini-pro-vision"Use Cases
1. Cost Optimization
Find the cheapest models that meet your requirements:
# Find free alternatives
opencode run "get all free models"
# Find low-cost models with tool calling
opencode run "search for models with tool calling and max input cost 0.5"
# Compare costs across providers
opencode run "compare pricing for similar models"2. Capability Discovery
Find models with specific capabilities:
# Models with reasoning
opencode run "get reasoning models"
# Models with vision
opencode run "search for models with image modality"
# Models with function calling
opencode run "search for models with tool calling"3. Open Source Projects
Find open-weight models for self-hosting:
# All open-weight models
opencode run "search for open weight models"
# Open-weight models with large context
opencode run "search for open weight models with minimum context 32000"4. Provider Evaluation
Compare offerings across providers:
# List all providers
opencode run "list all LLM providers"
# Get provider-specific models
opencode run "search for anthropic models"
opencode run "search for openai models"
# Compare flagship models
opencode run "compare models from different providers"Integration Examples
Using from Other Projects
Add the plugin to your opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"plugin": [
"/absolute/path/to/openpets/pets/llm-models/index.ts"
]
}Programmatic Usage
import { ModelsDevAPI } from 'openpets/models-dev'
const api = new ModelsDevAPI()
// Search for models
const freeModels = await api.getFreeModels()
const reasoningModels = await api.getReasoningModels()
// Get specific model
const model = await api.getModel('openai', 'gpt-4')
// Advanced search
const models = await api.searchModels({
free: true,
reasoning: true,
minContext: 100000
})Supported Providers
Current providers in models.dev:
- OpenAI
- Anthropic
- Google (Gemini)
- Mistral
- Groq
- GitHub Copilot
- xAI
- Alibaba
- Nvidia
- Upstage
- Vercel AI Gateway
- Nebius
- Vultr
- And more...
Data Source
This plugin uses the models.dev API, which provides:
- Real-time data: Updated model information
- Comprehensive coverage: 17+ providers, 100+ models
- Detailed specs: Pricing, capabilities, context windows
- Public access: No API key required
Performance
- Response caching: 1-hour cache for API responses
- Fast queries: Cached searches return instantly
- Efficient filtering: Client-side filtering for speed
- Minimal overhead: Single API call per cache cycle
Troubleshooting
Common Issues
Issue: No results found Solution: Check your filter parameters, they might be too restrictive
Issue: Outdated model information Solution: Wait for the cache to expire (1 hour) or restart OpenCode
Issue: Provider not found
Solution: Check the provider ID spelling (use list-llm-providers to see valid IDs)
Contributing
Found an issue or want to contribute?
- Check the models.dev GitHub for data issues
- Submit PRs to the OpenPets repository for plugin improvements
License
MIT - Free to use and modify
Links
- models.dev API: https://models.dev/api.json
- models.dev GitHub: https://github.com/sst/models.dev
- OpenPets Repository: https://github.com/raggle-ai/pets
Happy model hunting! 🚀
