| GitHub | Zen AI | HuggingFace |
Zen Engine is a high-performance, Rust-native inference engine powering the entire Zen model family:
# Clone the repository
git clone https://github.com/zenlm/zen-engine.git
cd zen-engine
# Build the engine
cargo build --release
# Or install via cargo
cargo install --git https://github.com/zenlm/zen-engine
# Start zen-nano (0.6B)
zen-engine serve --model zenlm/zen-nano-0.6b --port 3690
# Start zen-eco instruct (4B)
zen-engine serve --model zenlm/zen-eco-4b-instruct --port 3690
# Start zen-agent with tools (4B)
zen-engine serve --model zenlm/zen-agent-4b --enable-mcp --port 3690
# Start zen-musician (7B) for music generation
zen-engine serve --model zenlm/zen-musician-7b --port 3690
# With MLX on Apple Silicon
zen-engine serve --model zenlm/zen-nano-0.6b --backend mlx
# With GGUF quantization
zen-engine serve --model zenlm/zen-eco-4b-instruct-Q4_K_M.gguf
# Chat with zen-eco
curl -X POST http://localhost:3690/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "zen-eco-4b-instruct",
"messages": [
{"role": "user", "content": "Explain quantum computing"}
],
"temperature": 0.7,
"max_tokens": 500
}'
# Generate embeddings with Zen Embedding
curl -X POST http://localhost:3690/v1/embeddings \
-H "Content-Type: application/json" \
-d '{
"model": "zen-embedding-8b",
"input": "Zen models are fast and efficient"
}'
# Pull from HuggingFace
zen-engine pull zenlm/zen-nano-0.6b --source huggingface
# Pull GGUF format
zen-engine pull zenlm/zen-eco-4b-instruct-Q4_K_M.gguf
# Pull MLX format (Apple Silicon)
zen-engine pull zenlm/zen-nano-0.6b --source mlx
# List downloaded models
zen-engine list
# Delete a model
zen-engine delete zen-nano-0.6b
/v1/chat/completions - Chat with zen models/v1/embeddings - Generate embeddings/v1/models - List available modelsFor backward compatibility with Ollama clients:
zen-engine serve --ollama-compat --port 11434
from zen_engine import ZenEngine
# Initialize engine
engine = ZenEngine(
model="zenlm/zen-eco-4b-instruct",
device="cuda",
quantization="Q4_K_M"
)
# Generate text
response = engine.generate(
"Explain the theory of relativity",
max_tokens=500,
temperature=0.7
)
print(response)
# Generate embeddings
embeddings = engine.embed([
"First sentence",
"Second sentence"
])
use zen_engine::{ZenEngine, ModelConfig};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Load model
let engine = ZenEngine::new(ModelConfig {
model: "zenlm/zen-nano-0.6b".to_string(),
device: "cuda:0".to_string(),
quantization: Some("Q4_K_M".to_string()),
..Default::default()
}).await?;
// Generate
let response = engine.generate(
"Write a haiku about AI",
None
).await?;
println!("{}", response);
Ok(())
}
from openai import OpenAI
# Point to zen-engine
client = OpenAI(
base_url="http://localhost:3690/v1",
api_key="not-needed"
)
# Use any zen model
response = client.chat.completions.create(
model="zen-eco-4b-instruct",
messages=[
{"role": "user", "content": "Hello!"}
]
)
print(response.choices[0].message.content)
| Model | Format | Device | Speed |
|---|---|---|---|
| zen-nano-0.6b | MLX | M3 Max | 44,000 |
| zen-nano-0.6b | GGUF Q4 | M3 Max | 32,000 |
| zen-nano-0.6b | GGUF Q4 | RTX 4090 | 28,000 |
| zen-eco-4b | MLX | M3 Max | 18,000 |
| zen-eco-4b | GGUF Q4 | RTX 4090 | 12,000 |
| zen-eco-4b | GGUF Q4 | RTX 3060 | 5,500 |
| Model | Format | VRAM/RAM |
|---|---|---|
| zen-nano-0.6b | F16 | 1.2GB |
| zen-nano-0.6b | Q4_K_M | 0.4GB |
| zen-eco-4b | F16 | 8GB |
| zen-eco-4b | Q4_K_M | 2.3GB |
| zen-eco-4b | Q2_K | 1.6GB |
# Clone repository
git clone https://github.com/zenlm/zen-engine.git
cd zen-engine
# Basic build
cargo build --release
# With CUDA support (Linux)
cargo build --release --features "cuda flash-attn cudnn"
# With Metal support (macOS)
cargo build --release --features metal
# With all features
cargo build --release --features "cuda metal flash-attn"
# Run all tests
cargo test --workspace
# Run specific package tests
cargo test -p zen-engine-core
cargo test -p zen-engine-quant
# Run benchmarks
cargo bench
# Format code
cargo fmt --all
# Run clippy
cargo clippy --workspace --tests -- -D warnings
# Check formatting
cargo fmt --all -- --check
zen-engine-core/ - Core inference engine, Zen model implementationszen-engine-server/ - CLI binary and HTTP serverzen-engine-python/ - Python bindings (PyO3)zen-engine-vision/ - Vision model support (zen-director)zen-engine-audio/ - Audio processing (zen-musician)zen-engine-quant/ - Quantization (GGUF, AWQ, GPTQ, BitDelta)zen-engine-paged-attn/ - PagedAttention implementationzen-engine-mcp/ - Model Context Protocol (zen-agent)# Server configuration
export ZEN_ENGINE_PORT=3690
export ZEN_ENGINE_HOST="0.0.0.0"
# Model paths
export ZEN_MODELS_PATH="/path/to/models"
export ZEN_CACHE_DIR="/path/to/cache"
# Device configuration
export ZEN_DEVICE="cuda:0"
export ZEN_DEVICE_MAP="auto"
# Performance
export ZEN_BATCH_SIZE=32
export ZEN_MAX_CONCURRENT=10
[server]
port = 3690
host = "0.0.0.0"
max_concurrent = 10
[models]
cache_dir = "/path/to/cache"
default_quantization = "Q4_K_M"
[cuda]
devices = [0, 1]
flash_attn = true
[mlx]
enabled = true
# Build image
docker build -t zen-engine .
# Run container
docker run -p 3690:3690 \
-v ./models:/models \
zen-engine serve --model zenlm/zen-eco-4b-instruct
apiVersion: apps/v1
kind: Deployment
metadata:
name: zen-engine
spec:
replicas: 3
template:
spec:
containers:
- name: zen-engine
image: zenlm/zen-engine:latest
ports:
- containerPort: 3690
env:
- name: ZEN_DEVICE
value: "cuda:0"
resources:
limits:
nvidia.com/gpu: 1
Out of Memory
# Use smaller quantization
zen-engine serve --model zen-eco-4b-Q2_K.gguf
# Enable CPU offload
zen-engine serve --model zen-eco-4b --cpu-offload
Slow Inference
# Enable FlashAttention
zen-engine serve --model zen-eco-4b --flash-attn
# Use MLX on Apple Silicon
zen-engine serve --model zen-eco-4b --backend mlx
CUDA Errors
# Check CUDA version
nvidia-smi
# Rebuild with correct CUDA
cargo clean
cargo build --release --features "cuda flash-attn"
We welcome contributions! See CONTRIBUTING.md for guidelines.
Zen Engine is built on mistral.rs by Eric Buehler. We thank the mistral.rs team for their excellent work on Rust-native LLM inference.
Apache 2.0 License - see LICENSE for details.
@misc{zenengine2025,
title={Zen Engine: High-Performance Inference for Zen Models},
author={Zen AI Team},
year={2025},
howpublished={\url{https://github.com/zenlm/zen-engine}}
}
Zen Engine - Blazingly fast inference for all Zen models
Part of the Zen AI ecosystem.
(top 30 of 62)
Rust
86.9%
Cuda
5.5%
Metal
5.4%
| GitHub | Zen AI | HuggingFace |
Zen Engine is a high-performance, Rust-native inference engine powering the entire Zen model family:
# Clone the repository
git clone https://github.com/zenlm/zen-engine.git
cd zen-engine
# Build the engine
cargo build --release
# Or install via cargo
cargo install --git https://github.com/zenlm/zen-engine
# Start zen-nano (0.6B)
zen-engine serve --model zenlm/zen-nano-0.6b --port 3690
# Start zen-eco instruct (4B)
zen-engine serve --model zenlm/zen-eco-4b-instruct --port 3690
# Start zen-agent with tools (4B)
zen-engine serve --model zenlm/zen-agent-4b --enable-mcp --port 3690
# Start zen-musician (7B) for music generation
zen-engine serve --model zenlm/zen-musician-7b --port 3690
# With MLX on Apple Silicon
zen-engine serve --model zenlm/zen-nano-0.6b --backend mlx
# With GGUF quantization
zen-engine serve --model zenlm/zen-eco-4b-instruct-Q4_K_M.gguf
# Chat with zen-eco
curl -X POST http://localhost:3690/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "zen-eco-4b-instruct",
"messages": [
{"role": "user", "content": "Explain quantum computing"}
],
"temperature": 0.7,
"max_tokens": 500
}'
# Generate embeddings with Zen Embedding
curl -X POST http://localhost:3690/v1/embeddings \
-H "Content-Type: application/json" \
-d '{
"model": "zen-embedding-8b",
"input": "Zen models are fast and efficient"
}'
# Pull from HuggingFace
zen-engine pull zenlm/zen-nano-0.6b --source huggingface
# Pull GGUF format
zen-engine pull zenlm/zen-eco-4b-instruct-Q4_K_M.gguf
# Pull MLX format (Apple Silicon)
zen-engine pull zenlm/zen-nano-0.6b --source mlx
# List downloaded models
zen-engine list
# Delete a model
zen-engine delete zen-nano-0.6b
/v1/chat/completions - Chat with zen models/v1/embeddings - Generate embeddings/v1/models - List available modelsFor backward compatibility with Ollama clients:
zen-engine serve --ollama-compat --port 11434
from zen_engine import ZenEngine
# Initialize engine
engine = ZenEngine(
model="zenlm/zen-eco-4b-instruct",
device="cuda",
quantization="Q4_K_M"
)
# Generate text
response = engine.generate(
"Explain the theory of relativity",
max_tokens=500,
temperature=0.7
)
print(response)
# Generate embeddings
embeddings = engine.embed([
"First sentence",
"Second sentence"
])
use zen_engine::{ZenEngine, ModelConfig};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Load model
let engine = ZenEngine::new(ModelConfig {
model: "zenlm/zen-nano-0.6b".to_string(),
device: "cuda:0".to_string(),
quantization: Some("Q4_K_M".to_string()),
..Default::default()
}).await?;
// Generate
let response = engine.generate(
"Write a haiku about AI",
None
).await?;
println!("{}", response);
Ok(())
}
from openai import OpenAI
# Point to zen-engine
client = OpenAI(
base_url="http://localhost:3690/v1",
api_key="not-needed"
)
# Use any zen model
response = client.chat.completions.create(
model="zen-eco-4b-instruct",
messages=[
{"role": "user", "content": "Hello!"}
]
)
print(response.choices[0].message.content)
| Model | Format | Device | Speed |
|---|---|---|---|
| zen-nano-0.6b | MLX | M3 Max | 44,000 |
| zen-nano-0.6b | GGUF Q4 | M3 Max | 32,000 |
| zen-nano-0.6b | GGUF Q4 | RTX 4090 | 28,000 |
| zen-eco-4b | MLX | M3 Max | 18,000 |
| zen-eco-4b | GGUF Q4 | RTX 4090 | 12,000 |
| zen-eco-4b | GGUF Q4 | RTX 3060 | 5,500 |
| Model | Format | VRAM/RAM |
|---|---|---|
| zen-nano-0.6b | F16 | 1.2GB |
| zen-nano-0.6b | Q4_K_M | 0.4GB |
| zen-eco-4b | F16 | 8GB |
| zen-eco-4b | Q4_K_M | 2.3GB |
| zen-eco-4b | Q2_K | 1.6GB |
# Clone repository
git clone https://github.com/zenlm/zen-engine.git
cd zen-engine
# Basic build
cargo build --release
# With CUDA support (Linux)
cargo build --release --features "cuda flash-attn cudnn"
# With Metal support (macOS)
cargo build --release --features metal
# With all features
cargo build --release --features "cuda metal flash-attn"
# Run all tests
cargo test --workspace
# Run specific package tests
cargo test -p zen-engine-core
cargo test -p zen-engine-quant
# Run benchmarks
cargo bench
# Format code
cargo fmt --all
# Run clippy
cargo clippy --workspace --tests -- -D warnings
# Check formatting
cargo fmt --all -- --check
zen-engine-core/ - Core inference engine, Zen model implementationszen-engine-server/ - CLI binary and HTTP serverzen-engine-python/ - Python bindings (PyO3)zen-engine-vision/ - Vision model support (zen-director)zen-engine-audio/ - Audio processing (zen-musician)zen-engine-quant/ - Quantization (GGUF, AWQ, GPTQ, BitDelta)zen-engine-paged-attn/ - PagedAttention implementationzen-engine-mcp/ - Model Context Protocol (zen-agent)# Server configuration
export ZEN_ENGINE_PORT=3690
export ZEN_ENGINE_HOST="0.0.0.0"
# Model paths
export ZEN_MODELS_PATH="/path/to/models"
export ZEN_CACHE_DIR="/path/to/cache"
# Device configuration
export ZEN_DEVICE="cuda:0"
export ZEN_DEVICE_MAP="auto"
# Performance
export ZEN_BATCH_SIZE=32
export ZEN_MAX_CONCURRENT=10
[server]
port = 3690
host = "0.0.0.0"
max_concurrent = 10
[models]
cache_dir = "/path/to/cache"
default_quantization = "Q4_K_M"
[cuda]
devices = [0, 1]
flash_attn = true
[mlx]
enabled = true
# Build image
docker build -t zen-engine .
# Run container
docker run -p 3690:3690 \
-v ./models:/models \
zen-engine serve --model zenlm/zen-eco-4b-instruct
apiVersion: apps/v1
kind: Deployment
metadata:
name: zen-engine
spec:
replicas: 3
template:
spec:
containers:
- name: zen-engine
image: zenlm/zen-engine:latest
ports:
- containerPort: 3690
env:
- name: ZEN_DEVICE
value: "cuda:0"
resources:
limits:
nvidia.com/gpu: 1
Out of Memory
# Use smaller quantization
zen-engine serve --model zen-eco-4b-Q2_K.gguf
# Enable CPU offload
zen-engine serve --model zen-eco-4b --cpu-offload
Slow Inference
# Enable FlashAttention
zen-engine serve --model zen-eco-4b --flash-attn
# Use MLX on Apple Silicon
zen-engine serve --model zen-eco-4b --backend mlx
CUDA Errors
# Check CUDA version
nvidia-smi
# Rebuild with correct CUDA
cargo clean
cargo build --release --features "cuda flash-attn"
We welcome contributions! See CONTRIBUTING.md for guidelines.
Zen Engine is built on mistral.rs by Eric Buehler. We thank the mistral.rs team for their excellent work on Rust-native LLM inference.
Apache 2.0 License - see LICENSE for details.
@misc{zenengine2025,
title={Zen Engine: High-Performance Inference for Zen Models},
author={Zen AI Team},
year={2025},
howpublished={\url{https://github.com/zenlm/zen-engine}}
}
Zen Engine - Blazingly fast inference for all Zen models
Part of the Zen AI ecosystem.
(top 30 of 62)
Rust
86.9%
Cuda
5.5%
Metal
5.4%