llmfit recommend Filtering Options: A Complete CLI Reference
The llmfit recommend command provides eight distinct CLI flags to filter AI model recommendations by fit level, use case, inference runtime, capabilities, and license, with additional controls for output format and result limits.
The llmfit recommend command in the AlexsJones/llmfit repository analyzes every model in the embedded database against your detected hardware, then applies a sophisticated filtering pipeline to narrow the result set. All filtering logic is implemented in the run_recommend function inside llmfit-tui/src/main.rs, allowing you to compose multiple constraints to find the optimal model for your specific environment.
Available Filtering Flags for llmfit recommend
Limit Results with --limit (or -n)
Control the maximum number of recommendations returned. The default value is 5, but you can request anywhere from one to the full database size.
The flag is defined at lines 38-41 in llmfit-tui/src/main.rs and is applied as the final truncation step after all other filters.
Filter by Use Case with --use-case
Retain only models whose declared use case matches one of the supported categories: general, coding, reasoning, chat, multimodal, or embedding.
The string-to-enum mapping lives in llmfit-core/src/models.rs (lines 1335-1350), while the filtering logic executes at lines 334-342 in llmfit-tui/src/main.rs.
Minimum Fit Level with --min-fit
Discard models whose hardware compatibility falls below the specified threshold. Accepted values are:
- perfect — Hardware fully satisfies all model requirements
- good — Hardware meets primary requirements with minor trade-offs
- marginal — Hardware can run the model but with significant constraints (default)
The comparison uses the FitLevel enum defined in llmfit-core/src/fit.rs (lines 1-30). The filter is applied at lines 398-405 in llmfit-tui/src/main.rs before ranking occurs.
Runtime Selection with --runtime
Keep only models compatible with a specific inference backend. Valid options are mlx, llamacpp, or vllm.
This filter inspects the ModelFit.runtime field (type InferenceRuntime) and executes at lines 424-430 in llmfit-tui/src/main.rs.
Force Runtime Override with --force-runtime
Override the automatic runtime selection logic and treat every model as if it were compatible with the specified runtime. This is particularly useful on Apple Silicon hardware, where MLX is the default preferred runtime, but you want to evaluate llama.cpp compatibility instead.
The flag is parsed into an InferenceRuntime enum at lines 362-368 in llmfit-tui/src/main.rs before the model-fit building step (build_model_fits).
Capability Filtering with --capability
Filter by specific model capabilities using comma-separated values such as vision, tool_use, audio, or tts. A model must possess all requested capabilities to pass this filter.
The Capability enum is defined in llmfit-core/src/models.rs (lines 1190-1220), with the filtering logic implemented at lines 450-459 in llmfit-tui/src/main.rs.
License Filtering with --license
Restrict results to models matching specific SPDX license identifiers (e.g., apache-2.0,mit). The comparison uses the matches_license_filter helper function in llmfit-core/src/models.rs (lines 1260-1270) and is applied at lines 466-472 in llmfit-tui/src/main.rs.
Output Format Control
Choose between --json (default) for machine-readable output or --csv for spreadsheet-friendly tables. This option is processed at lines 366-371 in llmfit-tui/src/main.rs by the rendering subsystem in llmfit-core/src/display.rs.
Include llama.cpp Commands with --output-llamacpp
When enabled, the JSON output includes a ready-to-run llamacpp command line for each model that supports the llamacpp runtime. This flag is handled at lines 470-474 in llmfit-tui/src/main.rs.
The Filtering Pipeline Execution Order
The run_recommend function applies filters in a strict sequence to ensure consistent results:
- Build the full fit list with optional forced runtime (
build_model_fits) - Apply the minimum-fit filter (
min_levellogic) - Drop MLX-only models on non-Apple-Silicon hardware
- Apply runtime, use-case, capability, and license filters in succession
- Rank remaining models by compatibility (
rank_models_by_fit) - Truncate to the requested
--limit - Render in the chosen output format (JSON or CSV)
This pipeline ensures that expensive ranking operations only occur on models that meet your minimum hardware and licensing requirements.
Practical Usage Examples
Return the top 3 coding-oriented models that at least "good" fit your hardware:
llmfit recommend -n 3 --use-case coding --min-fit good
Show only vision-capable models that run on llama.cpp:
llmfit recommend --runtime llamacpp --capability vision
Force llama.cpp evaluation on Apple Silicon (overriding the default MLX preference):
llmfit recommend --force-runtime llamacpp
Filter by open-source licenses and export as CSV:
llmfit recommend --license apache-2.0,mit --csv > recommendations.csv
Include executable command snippets in JSON output for automation:
llmfit recommend --output-llamacpp > recommendations.json
Key Source Files and Implementation Details
| File | Role |
|---|---|
llmfit-tui/src/main.rs |
Contains the run_recommend function that orchestrates CLI parsing and applies all filtering logic. |
llmfit-core/src/models.rs |
Defines UseCase and Capability enums, plus the matches_license_filter helper used by the license filter. |
llmfit-core/src/fit.rs |
Houses FitLevel and InferenceRuntime enums, along with ranking utilities. |
llmfit-core/src/display.rs |
Handles JSON, CSV serialization and the optional llamacpp command inclusion. |
llmfit-core/src/analysis.rs |
Constructs ModelFit objects carrying runtime, capability, and hardware fit metadata. |
Summary
- The
--limit(or-n) flag controls result set size, defaulting to 5 recommendations. - Hardware fit is filtered via
--min-fitusing theFitLevelenum (perfect,good,marginal). - Functional filters include
--use-casefor task categories and--capabilityfor specific features like vision or tool use. - Runtime filters differentiate between
--runtime(filter by compatibility) and--force-runtime(override automatic selection). - License compliance is enforced via
--licenseusing SPDX identifier matching. - Output is configurable via
--json,--csv, and--output-llamacppfor different consumption workflows.
Frequently Asked Questions
How do I filter llmfit recommend results by specific model capabilities?
Use the --capability flag followed by comma-separated capability names such as vision, tool_use, audio, or tts. The filter requires models to possess all specified capabilities simultaneously. For example, --capability vision,tool_use returns only models supporting both vision processing and tool calling.
What is the difference between --runtime and --force-runtime in llmfit?
The --runtime flag filters the results to show only models that natively support the specified backend (mlx, llamacpp, or vllm). In contrast, --force-runtime overrides the automatic runtime detection and treats every model as compatible with your specified runtime, useful for evaluating llama.cpp performance on Apple Silicon where MLX would normally be preferred.
Can I export llmfit recommend results to CSV format for spreadsheet analysis?
Yes. Append the --csv flag to your command to generate a spreadsheet-friendly table instead of the default JSON output. You can redirect this to a file using standard shell operators: llmfit recommend --csv > models.csv. This format is particularly useful when sharing hardware compatibility reports with team members.
How does the --min-fit filter determine which models to exclude?
The filter compares each model's computed FitLevel against your specified threshold (perfect, good, or marginal). Models with a fit level worse than your minimum are discarded before ranking occurs. The underlying enum is defined in llmfit-core/src/fit.rs, where perfect represents full hardware satisfaction and marginal indicates runnable but constrained performance.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →