百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
U

uzu

> 数据库
开源

用于 AI 模型的高性能推理引擎

1.7K stars0 点赞2 次浏览
访问官网GitHub

工具介绍

用于 AI 模型的高性能推理引擎

uzu

A high-performance inference engine for AI models. It allows you to deploy AI directly in your app with zero latency, full data privacy, and no inference costs. Key features:

  • Simple, high-level API
  • Unified model configurations, making it easy to add support for new models
  • Traceable computations to ensure correctness against the source-of-truth implementation
  • Utilizes unified memory on Apple devices
  • Broad model support

Quick Start

Rust

Add the dependency:

toml
[dependencies]
uzu = { git = "https://github.com/trymirai/uzu", branch = "main", package = "uzu" }

Run the code below:

…
Python

Add the dependency:

bash
uv add uzu==0.5.27

Run the code below:

…
Swift

Add the dependency:

swift
dependencies: [
    .package(url: "https://github.com/trymirai/uzu.git", from: "0.5.27")
]

Run the code below:

…
TypeScript

Add the dependency:

bash
pnpm add @trymirai/[email protected]

Run the code below:

…

Everything from model downloading to inference configuration is handled automatically. Refer to the documentation for details on how to customize each step of the process.

Examples

You can run any example via cargo tools example <rust | python | swift | typescript> <chat | chat-cloud | chat-shared-instance | chat-structured-output | quick-start | tool-calls>:

Chat

In this example, we will download a model and get a reply to a specific list of messages:

Rust
…
Python
…
Swift
…
TypeScript
…


Once loaded, the same ChatSession can be reused for multiple requests until you drop it. Each model may consume a significant amount of RAM, so it's important to keep only one session loaded at a time. For iOS apps, we recommend adding the Increased Memory Capability entitlement to ensure your app can allocate the required memory.

Chat with the cloud model

In this example, we will get a reply to a specific list of messages from a cloud model:

Rust
…
Python
…
Swift
…
TypeScript
…

Chat with shared instance

This example shows how to reuse chat instance without reloading model into memory:

Rust
…
Python
…
Swift
…
TypeScript
…

Chat with structured output

Sometimes you want the generated output to be valid JSON with predefined fields. You can use Grammar to manually specify a JSON schema for the response you want to receive:

Rust
…
Python
…
Swift
…
TypeScript
…

Tool calls

This example shows how to use external tools:

Rust
…
Python
…
Swift
…
TypeScript
…

Development

uzu is a native Rust crate with bindings available for:

  • Swift via uniffi-rs
  • Python via pyo3
  • TypeScript via napi-rs

It supports:

  • Backends:
    • metal
    • cpu
  • Targets:
    • aarch64-apple-darwin
    • aarch64-apple-ios
    • aarch64-apple-ios-sim
    • aarch64-pc-windows-msvc (in progress)
    • aarch64-unknown-linux-gnu (in progress)
    • wasm32-wasip1-threads (in progress)
    • x86_64-apple-darwin
    • x86_64-pc-windows-msvc (in progress)
    • x86_64-unknown-linux-gnu (in progress)

For initial setup we recommend running cargo tools setup, which installs all necessary dependencies (rustup, uv, pnpm, Rust targets, Metal toolchain, ...) if not already present.
To unify cross-language development we introduce cargo tools:
  • Install language specific dependencies: cargo tools install typescript
  • Build: cargo tools build rust --targets apple
  • Test: cargo tools test python
  • Run example: cargo tools example swift chat

Model Format

uzu uses its own model format. You can export a model yourself with lalamo:

bash
git clone https://github.com/trymirai/lalamo.git
cd lalamo
uv run lalamo list-models
uv run lalamo convert meta-llama/Llama-3.2-1B-Instruct

CLI

You can run uzu in CLI mode:

bash
cargo run --release -p cli

This launches an interactive app where you can browse, download, and interact with models.

You can also preselect a model with --model, passing its identifier or repository id:

bash
cargo run --release -p cli -- --model trymirai/Qwen3.5-4B-M

If the model is not downloaded yet, the CLI starts downloading it automatically.

Benchmarks

To run benchmarks, pass a downloaded model path, a benchmark task file, and an output path:

bash
cargo run --release -p cli -- bench {MODEL_PATH} {TASK_PATH} {OUTPUT_PATH}

Server

You can also run uzu as an OpenAI-compatible HTTP server:

bash
cargo run --release -p cli -- server --model trymirai/Qwen3.5-4B-M

The model is loaded on startup (and downloaded first if needed). By default the server listens on 127.0.0.1:8000; override the address with --host and --port:

bash
cargo run --release -p cli -- server --model trymirai/Qwen3.5-4B-M --host 0.0.0.0 --port 8080

It exposes the following endpoints, available both at the root and under /v1:

  • POST /v1/chat/completions — chat completions, with streaming when "stream": true. Honors temperature, top_p, top_k, and max_tokens.
  • GET /v1/models — lists the loaded model.
bash
curl http://127.0.0.1:8000/v1/chat/completions \
    -H "Content-Type: application/json" \
    -d '{
        "model": "trymirai/Qwen3.5-4B-M",
        "messages": [{"role": "user", "content": "Hello!"}],
        "stream": true
    }'

Troubleshooting

If you experience any problems, please contact us via Discord or email.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustaihigh-performanceinferencellm

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类数据库
定价开源

> 相关工具

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库