llmfit-core API Overview
llmfit-core is the Rust library that powers the llmfit CLI tool. It provides programmatic access to hardware detection, model database queries, fit analysis, and model provider integration.
Installation
Addllmfit-core to your Cargo.toml:
Core Modules
The library is organized into five main modules:hardware
Detects system specifications including CPU, RAM, and GPU hardware:
models
Provides access to the embedded model database:
fit
Analyzes how well models fit on specific hardware:
providers
Integrates with runtime providers (Ollama, llama.cpp, MLX):
plan
Plan-based model selection and upgrade recommendations:
Basic Usage Example
Here’s a complete example that detects hardware, loads the model database, and finds the best fitting models:Public API Surface
All public types and functions are re-exported from the crate root:Feature Flags
No feature flags are currently defined. All functionality is enabled by default.Platform Support
- Linux: Full support (NVIDIA, AMD, Intel GPUs)
- macOS: Full support (Apple Silicon unified memory)
- Windows: Full support (NVIDIA, AMD GPUs via WMI)
- Cross-compilation: Supported via standard Rust toolchains
Error Handling
Most functions useResult<T, String> for error reporting. Hardware detection never panics - it returns sensible defaults if detection fails.
Thread Safety
All types areSend + Sync unless otherwise noted. Hardware detection can be called from any thread.
Next Steps
- Hardware API - System detection details
- Models API - Model database and queries
- Fit API - Model fit analysis and scoring
- Providers API - Runtime provider integration
