Skip to main content

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

Add llmfit-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:
See Hardware API for details.

models

Provides access to the embedded model database:
See Models API for details.

fit

Analyzes how well models fit on specific hardware:
See Fit API for details.

providers

Integrates with runtime providers (Ollama, llama.cpp, MLX):
See Providers API for details.

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 use Result<T, String> for error reporting. Hardware detection never panics - it returns sensible defaults if detection fails.

Thread Safety

All types are Send + Sync unless otherwise noted. Hardware detection can be called from any thread.

Next Steps