turbospark-cli
Command-line binaries for turbospark, a native Rust LLM and diffusion inference engine for Apple Silicon.
turbospark-model: Finds, inspects, and installs models.turbospark-check: Generates text and runs interactive chat.turbospark-image: Generates native diffusion images via Z-Image-Turbo.turbospark: Unified front end over all subcommands, the HTTP server, and external coding agents.
Generation is macOS-only and requires a Metal-capable Apple Silicon device. On other platforms, the binaries parse arguments and validate configuration.
Installation
# Install from crates.io
# Or install via Homebrew cask (includes CLI tools, server, and GUI app)
Quickstart
# 1. Pull a tested model into ~/.turbospark/models
# 2. Start an interactive terminal chat session
--model accepts either a curated catalog alias (e.g. tinyllama, gemma4) or a direct path to a .gturbo directory.
The Binaries
1. turbospark-model
Catalog discovery, remote Hugging Face inspection, and streaming install:
2. turbospark-check
Inference runner with streaming output and full sampling controls:
# Raw prompt (no chat template applied)
# Formatted conversation using the model's native chat template
# Interactive REPL trimming history to fit the context window
# Directional steering edit (ablate, add, clamp, renorm)
3. turbospark-image
Native diffusion image generation:
4. turbospark (Unified Front End)
Front end routing commands to peer binaries:
The start <agent> subcommand connects external coding agents (claude, codex, opencode, hermes, openclaw, dsh) directly to the local server via ANTHROPIC_BASE_URL or OPENAI_BASE_URL.
Memory vs Throughput: --expert-cache-slots
MoE expert weights stream from NVMe storage on demand. Setting the cache slot count trades RAM for decode throughput:
| slots | peak RAM | decode |
|---|---|---|
| 16 | ~2.1 GB | ~44 tok/s |
| 32 | ~3.7 GB | ~51 tok/s |
- Default is
auto: Automatically computes the largest slot count fitting a quarter of remaining system memory after base weights and a 4 GiB reserve. - Pinning for Benchmarks: Specify
--expert-cache-slots 16to pin reproducible memory ceilings.
Key Modules
main.rs: Entry point forturbospark-check.generate/: Non-interactive text generation and streaming detokenization loop.chat.rs: Interactive terminal REPL integratingturbospark-window-fit.agent.rs: External coding agent environment setup and configuration overlays.daemon.rs: Server background daemon process management.bin/turbospark.rs: Unified front-end command dispatcher.bin/model.rs&bin/model_cmd/: Subcommands forturbospark-model.bin/image.rs: Entry point forturbospark-image.
Development & Test Commands
# Run CLI test suite
# Run real-model generation test (macOS, release mode)
Tests
tests/model_cli.rs: Teststurbospark-modelsubcommands, alias resolution, and probing.tests/real_generation.rs: End-to-end inference tests verifying greedy and sampled generation.tests/image_cli.rs: CLI tests forturbospark-imageargument validation and output paths.tests/turbospark_cli.rs: Tests unified front-end command routing.tests/mference_check.rs: Backward-compatibility tests for legacy CLI flags.
Crate Gotchas
- Greedy vs Sampled Verification: Greedy
argmaxselection is invariant under any monotone transformation of the logit distribution. A mathematical bug that ruins sampling distributions can still appear correct under greedy generation. Always verify both greedy and sampled outputs when testing numerics. - Raw Prompt Babbling: Invoking
--promptdirectly bypasses the checkpoint's Jinja chat template, which causes instruction-tuned models to hallucinate or babble. Use--messages-fileor--chatfor instruction models. - Auto Expert Slots: Because
--expert-cache-slotsdefaults toauto, machines with different RAM sizes will report different slot counts and throughputs. Pin the slot count when comparing benchmarks.