Skip to content

Quickstart

mistral.rs is a single binary: mistralrs run chats with a model in your terminal, mistralrs serve exposes the same model over OpenAI-compatible and Anthropic-compatible HTTP APIs. This page covers both, plus in-process inference from Python and Rust.

The install script detects your platform and downloads a matching prebuilt binary, falling back to a source build only if none matches your hardware.

Install locations, per-platform binaries, and environment variables

Prebuilt binaries are self-contained (no CUDA toolkit or Rust needed) and install to ~/.mistralrs, with mistralrs symlinked into ~/.local/bin (%USERPROFILE%\.local\bin on Windows). If that directory is not on your PATH, the installer prints the line to add. A source build instead installs to ~/.cargo/bin/mistralrs, which is on PATH after a new shell or source "$HOME/.cargo/env".

What you get per platform:

PlatformBinaryAcceleration
Apple Silicon (macOS)prebuiltMetal
Linux x86_64 + NVIDIA GPUprebuilt, matched to your GPU’s compute capabilityCUDA, flash-attn, and cuTile where the GPU supports them
Linux aarch64 + NVIDIA GPU (Grace: GH200/GB200/GB10)prebuilt, sm90/100/121CUDA, flash-attn, cuTile
Linux x86_64 / aarch64, no GPUprebuiltCPU
Windows x86_64prebuiltCPU
anything else (Intel Mac, an unlisted GPU)source builddetected at build time

Prebuilt CUDA binaries are published per compute capability for Ampere and newer; an older or unlisted GPU builds from source. See hardware support for the full matrix.

Install-time environment variables:

  • MISTRALRS_INSTALL_TAG=v0.8.4 installs a specific release instead of the latest (downloads that release’s prebuilt, or builds that git tag from source).
  • MISTRALRS_INSTALL_FROM_SOURCE=1 skips the prebuilt download and builds the latest master (bleeding edge) from source. The prebuilt path tracks the latest stable release.
  • MISTRALRS_INSTALL_NO_NCCL=1 (source builds) skips the nccl feature.

At runtime, HF_HOME controls where models are cached (see environment variables).

Terminal window
curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/EricLBuehler/mistral.rs/master/install.sh | sh

Need a source build instead - to track bleeding-edge master, pin a commit, or use a feature set the prebuilts omit? See Build from source.

Terminal window
mistralrs --version
mistralrs doctor

doctor reports detected hardware, compiled accelerator features, and Hugging Face cache and connectivity checks:

[INFO] CUDA: nvcc 12.4, driver 12.4
[INFO] Build features: cuda, cudnn, flash-attn

If your accelerator is missing from build features, rebuild with the right --features. For other failures, see Troubleshooting.

Terminal window
mistralrs run --quant 4 -m Qwen/Qwen3-4B

The first run downloads the weights from Hugging Face into the local cache, then loads the model onto the detected accelerator. mistralrs infers the architecture, chat template, and target device from the repository; every inferred choice can be overridden with a flag.

--quant 4 prefers a prebuilt UQFF (Universal Quantized File Format) quantization from mistralrs-community when one is published, otherwise quantizes the weights as they load (in-situ). Omit it to load native precision (BF16 for Qwen3-4B, about 8 GB). See Quantization for the decision guide.

The model is ready when an empty prompt appears. Type a message and press Enter; the response streams a token at a time.

> What does Rust's ownership system actually buy you?
Rust's ownership model gives you memory safety without a garbage collector...

Commands available at the prompt:

  • /help: list commands
  • /exit: quit (Ctrl+D also works)
  • /system <message>: add a system message without running the model
  • /clear: clear the chat history
  • /temperature <float>, /topk <int>, /topp <float>: adjust sampling

With multimodal models, include image, audio, or video paths or URLs directly in the prompt. For one-shot use, pass -i "your prompt" (optionally with --image, --video, or --audio) to send a single request and exit. The full flag set is in the CLI reference.

Terminal window
mistralrs serve --quant 4 -m Qwen/Qwen3-4B

When loading completes:

2026-06-13T12:00:00.000000Z INFO mistralrs_cli::commands::serve: Server listening on http://0.0.0.0:1234

The server binds 0.0.0.0 by default, reachable from any host on the network; pass --host 127.0.0.1 to restrict it and --port to change the port.

Leave it running and send a Chat Completions request from a second terminal. The same request, on three surfaces:

Terminal window
curl http://localhost:1234/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "default",
"messages": [
{"role": "user", "content": "In one sentence, what is mistral.rs?"}
]
}'

The model name default is special-cased server-side: it always routes to the server’s default model, so clients work without knowing the real model id. GET /v1/models lists the real id. Full example: server chat.

Three more things the same process gives you:

  • A web UI at http://localhost:1234/ui (pass --no-ui to disable). See Web UI.
  • Anthropic-compatible Messages endpoints at base http://localhost:1234. See Anthropic Messages API.
  • Interactive API docs at http://localhost:1234/docs.

The OpenAI-compatible API guide covers streaming, multiple models, and configuration.

Some models (Gemma, Llama, and others) require accepting a license before download. One-time setup per account, using google/gemma-4-E4B-it as the example:

  1. Open the model page on Hugging Face, sign in, and accept the license at the top.
  2. Create a read-only access token at huggingface.co/settings/tokens.
  3. Pass the token to mistral.rs:
Terminal window
mistralrs login

login prompts for the token (or accepts --token hf_... non-interactively) and saves it to the Hugging Face token file ($HF_HOME/token, default ~/.cache/huggingface/token). If you have already logged in via huggingface-cli, skip this step: both tools read the same file. Then run or serve the gated model as usual:

Terminal window
mistralrs serve --quant 4 -m google/gemma-4-E4B-it

Run inference in-process, without a server, using the mistralrs crate. Add mistralrs and tokio to Cargo.toml (build with the same accelerator features as the CLI, e.g. --features metal or --features cuda):

use mistralrs::{IsqBits, ModelBuilder, TextMessageRole, TextMessages};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let model = ModelBuilder::new("Qwen/Qwen3-4B")
.with_auto_isq(IsqBits::Four)
.build()
.await?;
let messages =
TextMessages::new().add_message(TextMessageRole::User, "Write me a haiku about Rust.");
let response = model.send_chat_request(messages).await?;
println!("{}", response.choices[0].message.content.as_ref().unwrap());
Ok(())
}

with_auto_isq(IsqBits::Four) is the in-process equivalent of --quant 4. See the Rust SDK guide for streaming, multimodal input, and sampling options.