ModelRegistry
Central registry for LLM model metadata.
This provides a singleton lookup service for model capabilities, pricing, and constraints. It loads data from the embedded litellm metadata file and supports runtime updates from external sources.
Example usage:
val metadata = ModelRegistry.lookup("gpt-4o")
metadata.foreach { m =>
println(s"Context window: $${m.contextWindow}")
println(s"Supports vision: $${m.supports("vision")}")
}
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ModelRegistry.type
Members list
Value members
Concrete methods
Find models that support a specific capability.
Find models that support a specific capability.
Value parameters
- capability
-
The capability name (e.g., "vision", "function_calling")
Attributes
- Returns
-
List of models supporting that capability
Initialize the registry by loading embedded metadata. This is called automatically on first access, but can be called explicitly.
Initialize the registry by loading embedded metadata. This is called automatically on first access, but can be called explicitly.
Value parameters
- customMetadataPath
-
Optional path to a custom metadata JSON file to load after the embedded metadata.
Attributes
- Returns
-
Result indicating success or failure
Get all models of a specific mode (chat, embedding, etc.).
Get all models of a specific mode (chat, embedding, etc.).
Value parameters
- mode
-
The model mode
Attributes
- Returns
-
List of models for that mode
Get all models for a specific provider.
Get all models for a specific provider.
Value parameters
- provider
-
The provider name
Attributes
- Returns
-
List of models for that provider
Get all available providers.
Get all available providers.
Attributes
- Returns
-
List of unique provider names
Load custom model metadata from a file. Custom metadata takes precedence over embedded metadata.
Load custom model metadata from a file. Custom metadata takes precedence over embedded metadata.
Value parameters
- filePath
-
Path to the custom metadata JSON file
Attributes
- Returns
-
Result indicating success or failure
Load custom metadata from a JSON string.
Load custom metadata from a JSON string.
Value parameters
- jsonContent
-
JSON string containing model metadata
Attributes
- Returns
-
Result indicating success or failure
Lookup model metadata by model identifier.
Lookup model metadata by model identifier.
The lookup supports several formats:
- Exact match: "gpt-4o", "claude-3-7-sonnet-latest"
- Provider/model: "openai/gpt-4o", "anthropic/claude-3-7-sonnet-latest"
- Fuzzy match: partial model names
Value parameters
- modelId
-
The model identifier to lookup
Attributes
- Returns
-
Model metadata if found
Lookup model metadata by provider and model name.
Lookup model metadata by provider and model name.
Value parameters
- modelName
-
The model name (e.g., "gpt-4o")
- provider
-
The provider name (e.g., "openai", "anthropic")
Attributes
- Returns
-
Model metadata if found
Register custom model metadata. This allows adding or overriding individual models.
Register custom model metadata. This allows adding or overriding individual models.
Value parameters
- metadata
-
The model metadata to register
Attributes
Register multiple custom models.
Register multiple custom models.
Value parameters
- models
-
List of model metadata to register
Attributes
Clear all metadata and reset the registry. Mainly useful for testing.
Clear all metadata and reset the registry. Mainly useful for testing.
Attributes
Get statistics about the loaded metadata.
Get statistics about the loaded metadata.
Attributes
- Returns
-
Map of statistics
Update the registry with fresh metadata from an external source.
Update the registry with fresh metadata from an external source.
Value parameters
- url
-
URL to fetch metadata from (defaults to litellm GitHub)
Attributes
- Returns
-
Result indicating success or failure