DominguesM/llama-crab

The Rust-native runtime for on-device AI.

Rust

1

105 commits

updated Jun 22, 2026

See the code
llama-cpp
llm
rust
tauri

README

llama-crab logo

Safe, ergonomic and complete Rust bindings for llama.cpp.

Crates.io Documentation CI Coverage License: MIT


Installation

# Rust crate
cargo add llama-crab

# HTTP server (optional)
cargo install llama-crab-server --features mtmd --force

For backend selection (Metal, CUDA, Vulkan, ROCm, OpenCL, ...), see the installation guide.

Quickstart

use llama_crab::{Llama, LlamaParams};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut llama = Llama::load(
        LlamaParams::new("models/model.gguf")
            .with_n_ctx(2048)
            .with_n_gpu_layers(99),
    )?;

    let response = llama.create_completion("The capital of France is", 32)?;
    println!("{}", response.text);

    Ok(())
}

Runnable end-to-end examples live in the separate llama-crab-examples repo.

What is in the box

  • Safe high-level API for text completion, chat completion, infill and embeddings.
  • Low-level FFI bindings to llama.cpp, ggml, gguf and mtmd.
  • Sampling chains, grammar-constrained decoding and JSON-Schema to GBNF conversion.
  • Tool-call parsing for ChatML, Mistral, Llama 3, Functionary and plain JSON.
  • Multimodal support (vision and audio) through mtmd.
  • Hardware backends for CPU, Metal, CUDA, Vulkan, ROCm, OpenCL and KleidiAI.
  • HTTP server (llama-crab-server) and Tauri plugin (tauri-plugin-llama-crab).
  • TypeScript contracts and client (@llama-crab/core, @llama-crab/tauri).

Crates and Packages

NameDescription
llama-crabSafe high-level API and Rust abstractions. Start here.
llama-crab-sysLow-level FFI bindings to llama.cpp.
llama-crab-serverOpenAI-compatible HTTP server binary.
tauri-plugin-llama-crabTauri plugin for in-app local inference.
@llama-crab/coreOpenAI-like TypeScript contracts and helpers.
@llama-crab/tauriTypeScript client for the Tauri plugin.

Documentation

The documentation site is published at https://llama-crab.nlp.rocks/.

Contributing

Contributions are welcome. Read CONTRIBUTING.md before opening a pull request and follow the Code of Conduct. Bug reports and security issues are tracked through GitHub Issues and SECURITY.md.

Clone with submodules:

git clone --recursive https://github.com/DominguesM/llama-crab.git
cd llama-crab

License

Licensed under the MIT License.

llama-crab builds on llama.cpp.

Contributors

DominguesM

105 commits

DominguesM/llama-crab

The Rust-native runtime for on-device AI.

Rust

1

105 commits

updated Jun 22, 2026

See the code
llama-cpp
llm
rust
tauri

README

llama-crab logo

Safe, ergonomic and complete Rust bindings for llama.cpp.

Crates.io Documentation CI Coverage License: MIT


Installation

# Rust crate
cargo add llama-crab

# HTTP server (optional)
cargo install llama-crab-server --features mtmd --force

For backend selection (Metal, CUDA, Vulkan, ROCm, OpenCL, ...), see the installation guide.

Quickstart

use llama_crab::{Llama, LlamaParams};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut llama = Llama::load(
        LlamaParams::new("models/model.gguf")
            .with_n_ctx(2048)
            .with_n_gpu_layers(99),
    )?;

    let response = llama.create_completion("The capital of France is", 32)?;
    println!("{}", response.text);

    Ok(())
}

Runnable end-to-end examples live in the separate llama-crab-examples repo.

What is in the box

  • Safe high-level API for text completion, chat completion, infill and embeddings.
  • Low-level FFI bindings to llama.cpp, ggml, gguf and mtmd.
  • Sampling chains, grammar-constrained decoding and JSON-Schema to GBNF conversion.
  • Tool-call parsing for ChatML, Mistral, Llama 3, Functionary and plain JSON.
  • Multimodal support (vision and audio) through mtmd.
  • Hardware backends for CPU, Metal, CUDA, Vulkan, ROCm, OpenCL and KleidiAI.
  • HTTP server (llama-crab-server) and Tauri plugin (tauri-plugin-llama-crab).
  • TypeScript contracts and client (@llama-crab/core, @llama-crab/tauri).

Crates and Packages

NameDescription
llama-crabSafe high-level API and Rust abstractions. Start here.
llama-crab-sysLow-level FFI bindings to llama.cpp.
llama-crab-serverOpenAI-compatible HTTP server binary.
tauri-plugin-llama-crabTauri plugin for in-app local inference.
@llama-crab/coreOpenAI-like TypeScript contracts and helpers.
@llama-crab/tauriTypeScript client for the Tauri plugin.

Documentation

The documentation site is published at https://llama-crab.nlp.rocks/.

Contributing

Contributions are welcome. Read CONTRIBUTING.md before opening a pull request and follow the Code of Conduct. Bug reports and security issues are tracked through GitHub Issues and SECURITY.md.

Clone with submodules:

git clone --recursive https://github.com/DominguesM/llama-crab.git
cd llama-crab

License

Licensed under the MIT License.

llama-crab builds on llama.cpp.

Contributors

DominguesM

105 commits

Languages

Rust

91.3%

TypeScript

5.5%

Shell

2.4%