👉 Try the demo: https://github.com/LM-Kit/lm-kit-net-samples/tree/main/console_net/local-inference/model-catalog/host_aware_model_picker
Programmatic Model Catalog for C# .NET Applications
🎯 Purpose of the Demo
ModelCard.GetPredefinedModelCards() exposes the full set of models LM-Kit knows how to download and load. This demo turns that into an interactive picker that filters by capability (chat, vision, OCR, embeddings, speech-to-text, reasoning), sorts by file size, and then loads the chosen model with LM.LoadFromModelID().
👥 Who Should Use This Demo
- A developer who wants to ship an app that adapts to the user's hardware ("smallest model that supports vision on this host").
- A platform team building an admin page that shows which models are currently available.
- Anyone shipping a multi-tenant product where users pick the model from a UI.
🚀 What Problem It Solves
Hard-coded model IDs do not scale. A new model is released every few weeks, VRAM budgets vary across customers, and your app needs a single source of truth for "which models can I load right now". The catalog is that source.
💻 Demo Application Overview
A console app that:
- Asks for a capability filter.
- Lists every catalog entry that matches, sorted by file size.
- Prints
ModelID, name, size, context length, quantization, capability flags. - Loads the selected model and prints architecture, parameter count, embedding size, and the cached file path.
✨ Key Features
ModelCard.GetPredefinedModelCards()for runtime catalog access.ModelCard.Capabilitiesflags:Chat,Vision,OCR,TextEmbeddings,ImageEmbeddings,SpeechToText,Reasoning,ToolsCall,TextReranking,Translation.LM.LoadFromModelID(modelID, downloadingProgress, loadingProgress)for one-line download + load.- Reports
LM.Architecture,LM.ParameterCount,LM.EmbeddingSize,LM.ContextLength,LM.LayerCount,LM.GpuLayerCount,LM.HasVision,LM.HasToolCalls,LM.HasSpeechToText,LM.HasReasoning,LM.IsEmbeddingModel,LM.ModelPath.
Example Output
=== LM-Kit Model Catalog Browser ===
Pick a capability to list models for:
1 - Chat / text generation
2 - Vision
...
> 1
Found 24 model(s) matching the filter.
# | Model ID | Name | Size | Context | Quant | Capabilities
------------------------------------------------------------------------------------------------
1 | gemma3:270m | Google Gemma 3 270M | 245.3 MB | 32,768 | 4.0 | chat
2 | gemma3:1b | Google Gemma 3 1B | 789.5 MB | 32,768 | 4.0 | chat tools
...
🏗️ Architecture
User -> capability filter
|
v
ModelCard.GetPredefinedModelCards() --filter by Capabilities--> sorted list
|
v
LM.LoadFromModelID(selected.ModelID) -- download + cache + open --
|
v
LM (ready for inference)
⚙️ Getting Started
Prerequisites: .NET 8 SDK. The first selected model downloads on first run.
Run:
git clone https://github.com/LM-Kit/lm-kit-net-samples.git
cd lm-kit-net-samples/console_net/local-inference/model-catalog/host_aware_model_picker
dotnet run
🔧 Troubleshooting
- "No models match" -> your capability filter is too narrow. Pick option 7 to see everything.
- Download fails -> the model is hosted on Hugging Face. Verify the host has outbound HTTPS to
huggingface.co.
🚀 Extend the Demo
- Add a VRAM filter that uses
GpuDeviceInfo.Devices[0].FreeMemorySizeto hide models that will not fit. - Pin the user's choice to a config file so the next launch skips the picker.
- Add an "update" command that calls
LM.LoadFromModelID()on every cached model to refresh.