# AI use cases for Uzu (trymirai/uzu)

Repo: [trymirai/uzu](https://github.com/trymirai/uzu) | Use cases: 3 | Page: https://dedupedai.com/use-cases/trymirai-uzu/

uzu is a high-performance inference engine for running AI models directly inside your app, with zero latency, full data privacy and no inference costs. It has a simple high-level API in Rust, Python, Swift and TypeScript, downloads models such as Qwen 3.5 0.8B automatically, uses unified memory on Apple devices and supports streaming chat replies.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Run a local LLM inside a Python script with Uzu: https://dedupedai.com/use-cases/trymirai-uzu/run-a-local-llm-in-a-python-app-with-uzu/
- Add on-device AI chat to a Swift app with Uzu: https://dedupedai.com/use-cases/trymirai-uzu/add-on-device-chat-to-a-swift-app-with-uzu/
- Stream local LLM replies in a Node or Rust app: https://dedupedai.com/use-cases/trymirai-uzu/stream-local-llm-replies-in-node-or-rust-with-uzu/

## How to run a local LLM inside a Python script with Uzu

Repo: [trymirai/uzu](https://github.com/trymirai/uzu) | Difficulty: Beginner | Time: 20 minutes | Basis: From the README

Add Uzu with uv, download a small Qwen model and get a chat reply on your own machine.

**Who it is for:** A Python developer who wants an offline assistant feature without API keys or per-token bills.

**The problem:** Cloud LLM APIs add latency, cost and send user data off the device.

**The outcome:** A Python script that downloads a model once and generates replies locally.

### Steps

1. Run `uv add uzu==0.6.13`
2. Create the engine with EngineConfig.create() and Engine.create as in the README Python example
3. Load the model `alibaba:qwen3.5:0.8b:mirai:mirai-m:4` and iterate the download to show progress
4. Open a chat session and send a system and a user ChatMessage
5. Print the reply's reasoning and text

### Prompt to paste into your agent

```text
Add trymirai/uzu to this Python project with `uv add uzu==0.6.13` and write a script that downloads alibaba:qwen3.5:0.8b:mirai:mirai-m:4 and answers <question> locally, following the README Python quick start.
```

### Caveat

This card is written from the trymirai/uzu README, not from a test run by Deduped. Before you start, make sure you have Rust, Python, Swift or TypeScript. Check the repo for newer instructions before you rely on these steps.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/trymirai-uzu/run-a-local-llm-in-a-python-app-with-uzu/

## How to add on-device AI chat to a Swift app with Uzu

Repo: [trymirai/uzu](https://github.com/trymirai/uzu) | Difficulty: Intermediate | Time: 1 hour | Basis: From the README

Add the Uzu Swift package and run chat locally on Apple devices using unified memory.

**Who it is for:** An iOS or macOS developer who wants a private assistant feature that works offline.

**The problem:** Shipping an AI feature usually means a server bill and a privacy policy for user prompts.

**The outcome:** A Swift app that downloads a model and replies on device.

### Steps

1. Add `.package(url: "https://github.com/trymirai/uzu.git", from: "0.6.13")` to your Package.swift dependencies
2. Create the engine with EngineConfig.create() and Engine.create(config:)
3. Load a model by identifier and iterate engine.download(model:) to show progress
4. Start engine.chat and call session.reply with your messages
5. Show message.text() in your UI

### Prompt to paste into your agent

```text
Add trymirai/uzu to my Swift app <app> and build a chat screen that downloads the Qwen 3.5 0.8B mirai model on first launch and replies on device, following the README Swift example.
```

### Caveat

This card is written from the trymirai/uzu README, not from a test run by Deduped. Before you start, make sure you have Rust, Python, Swift or TypeScript. Check the repo for newer instructions before you rely on these steps.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/trymirai-uzu/add-on-device-chat-to-a-swift-app-with-uzu/

## How to stream local LLM replies in a Node or Rust app with Uzu

Repo: [trymirai/uzu](https://github.com/trymirai/uzu) | Difficulty: Intermediate | Time: 45 minutes | Basis: From the README

Use Uzu's TypeScript or Rust API to stream chat replies and count generated tokens.

**Who it is for:** A backend or desktop developer who wants streamed local responses in a Node or Rust tool.

**The problem:** Waiting for a full reply feels slow; streaming locally needs an engine with a stream API.

**The outcome:** A Node or Rust program that streams replies from a local model and reports token counts.

### Steps

1. For Node, run `pnpm add @trymirai/uzu@0.6.13`; for Rust, add the Uzu git dependency to Cargo.toml
2. Create the engine and download the model as in the quick start
3. In Rust, call reply_with_stream and handle the Replies and Error chunks
4. Print the generated token count from the reply stats
5. Run the bundled examples with `cargo tools example` to compare

### Prompt to paste into your agent

```text
Using trymirai/uzu, write a <Rust or TypeScript> CLI that streams a local reply to <prompt> and prints generated tokens, based on the README chat example.
```

### Caveat

This card is written from the trymirai/uzu README, not from a test run by Deduped. Before you start, make sure you have Rust, Python, Swift or TypeScript. Check the repo for newer instructions before you rely on these steps.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/trymirai-uzu/stream-local-llm-replies-in-node-or-rust-with-uzu/
