LLM provider registry with model metadata and capabilities
npm install @tashiscool/providersLLM provider registry with comprehensive model metadata and capabilities. Easily discover and manage models across 14+ providers.
``bash`
pnpm add @llm-utils/providersor
npm install @llm-utils/providers
- 14+ Provider Support - OpenAI, Anthropic, Google, Mistral, Groq, DeepSeek, xAI, and more
- Model Metadata - Context windows, capabilities, pricing, and release dates
- Capability Filtering - Find models with vision, tool calling, streaming, etc.
- Credential Management - Auto-detection from environment variables
- Type-Safe - Full TypeScript support with comprehensive types
`typescript
import {
getModelById,
getModelsWithCapability,
ProviderRegistry
} from '@llm-utils/providers';
// Get a specific model
const gpt4o = getModelById('gpt-4o');
console.log(gpt4o?.contextWindow); // 128000
console.log(gpt4o?.capabilities.vision); // true
// Find all models with vision capability
const visionModels = getModelsWithCapability('vision');
console.log(visionModels.length); // Multiple models
// Create a registry from environment
const registry = new ProviderRegistry();
registry.registerFromEnv();
// Find models across registered providers
const streamingModels = registry.findModelsWithCapability('streaming');
`
`typescript
import { ProviderRegistry, createProviderInstance } from '@llm-utils/providers';
// Create a registry
const registry = new ProviderRegistry();
// Register with explicit credentials
registry.register('openai', { apiKey: 'sk-...' });
registry.register('anthropic', { apiKey: 'sk-ant-...' });
// Or register all from environment
registry.registerFromEnv();
// Get a provider instance
const openai = registry.get('openai');
if (openai?.isConfigured()) {
const models = openai.listModels();
const visionModels = openai.listModelsWithCapability('vision');
}
`
`typescript
import {
allModels,
getModelsByProvider,
getModelsWithCapability
} from '@llm-utils/providers';
// Get all models
console.log(allModels.length);
// Get models by provider
const anthropicModels = getModelsByProvider('anthropic');
const openaiModels = getModelsByProvider('openai');
// Filter by capability
const toolCallingModels = getModelsWithCapability('toolCalling');
const jsonModeModels = getModelsWithCapability('jsonMode');
const embeddingModels = getModelsWithCapability('embeddings');
`
`typescript
import { getProvider, getAllProviders, isProviderConfigured } from '@llm-utils/providers';
// Get provider config
const openai = getProvider('openai');
console.log(openai.baseUrl); // https://api.openai.com/v1
console.log(openai.requiredEnvVars); // ['OPENAI_API_KEY']
// List all providers
const providers = getAllProviders();
providers.forEach(p => console.log(${p.name}: ${p.description}));
// Check if configured from environment
if (isProviderConfigured('anthropic')) {
console.log('Anthropic is ready to use');
}
`
| Provider | ID | Models |
|----------|-----|--------|
| OpenAI | openai | GPT-4o, GPT-4, o1, DALL-E, Embeddings |anthropic
| Anthropic | | Claude 3.5 Sonnet, Claude 3 Opus, Haiku |google
| Google | | Gemini 2.0, Gemini 1.5 Pro/Flash |mistral
| Mistral | | Mistral Large, Small, Codestral |groq
| Groq | | Llama 3.3, Mixtral, Gemma |deepseek
| DeepSeek | | DeepSeek V3, R1 |xai
| xAI | | Grok 2, Grok Vision |azure-openai
| Azure OpenAI | | OpenAI models on Azure |aws-bedrock
| AWS Bedrock | | Claude, Mistral on AWS |ollama
| Ollama | | Local models |together-ai
| Together AI | | Open models |replicate
| Replicate | | Various models |huggingface
| Hugging Face | | Inference API |cohere
| Cohere | | Command, Embed |
Each model includes capability flags:
`typescript`
interface ModelCapabilities {
chat: boolean; // Text generation
vision: boolean; // Image input
toolCalling: boolean; // Function calling
jsonMode: boolean; // JSON output mode
structuredOutput: boolean; // Schema-based output
streaming: boolean; // Stream responses
embeddings: boolean; // Vector embeddings
imageGeneration: boolean; // Image creation
audio: boolean; // Audio I/O
}
- ProviderId - Provider identifier union typeModelMetadata
- - Model information including capabilities and pricingProviderConfig
- - Provider configuration including base URL and env varsProviderCredentials
- - API keys and connection optionsProviderInstance
- - Configured provider with methods
- getModelById(id) - Get model by IDgetModelsByProvider(provider)
- - Get all models for a providergetModelsWithCapability(cap)
- - Filter models by capabilitygetProvider(id)
- - Get provider configurationgetAllProviders()
- - List all provider configsisProviderConfigured(id)
- - Check env var configurationcreateProviderInstance(id, creds?)
- - Create provider instance
- ProviderRegistry` - Manage multiple provider instances
MIT