# AI use cases for Berth (T-Crypt/berth)

Repo: [T-Crypt/berth](https://github.com/T-Crypt/berth) | Use cases: 4 | Page: https://dedupedai.com/use-cases/t-crypt-berth/

Berth is a single Go binary that lets local AI engines, games and GPU apps take turns on one NVIDIA GPU instead of loading at once and crashing with out-of-memory errors.

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

- Stop local AI engines from crashing each other on one GPU: https://dedupedai.com/use-cases/t-crypt-berth/stop-local-engines-crashing-on-one-gpu/
- Let games take the GPU while you play and resume AI after: https://dedupedai.com/use-cases/t-crypt-berth/let-games-take-the-gpu-while-you-play/
- Share the GPU between llama-swap and ComfyUI without ping-pong: https://dedupedai.com/use-cases/t-crypt-berth/share-gpu-between-llama-swap-and-comfyui/
- Give coding agents a queue for the GPU instead of killing processes: https://dedupedai.com/use-cases/t-crypt-berth/give-coding-agents-a-gpu-queue/

## How to stop local AI engines from crashing each other on one GPU with Berth

Repo: [T-Crypt/berth](https://github.com/T-Crypt/berth) | Difficulty: Intermediate | Time: 45 minutes | Basis: From the README

Queue llama.cpp, ComfyUI and other engines on one card so none load into an out-of-memory crash.

**Who it is for:** A developer or power user running chat, image and voice models on one NVIDIA workstation who gets out-of-memory errors when a second model starts.

**The problem:** Two engines load into the same card at once, one fails with an out-of-memory error, and it is unclear which process holds the memory.

**The outcome:** Each engine waits its turn through berthd, the holder finishes its reply or job, and `berth status` shows who holds the card and who is waiting.

### Steps

1. `go install github.com/T-Crypt/berth/cmd/berth@latest`, or download a release binary (see Install).
2. `berth service install --harbor` to run the daemon and the harbor as user services.
3. `berth run --as llama --priority foreground -- llama-server -m model.gguf --port 8080` to start an engine under a lease.
4. Start a second engine the same way with `berth run` and a lower priority such as `--priority batch`. (inferred, check the README)
5. `berth status` to see the holder, the waiting engine and the reason it waits.

### Prompt to paste into your agent

```text
In the Berth repo at <path to berth>, install the berth binary and run `berth service install --harbor`, then start <engine command> with `berth run --as <name> -- <engine command>`. Expected output: `berth status` lists the engine as the card holder. Verify that a second engine started through `berth run` shows as waiting with a reason, not as a crash.
```

### Caveat

Berth only governs engines started through `berth run`, the gateway, ComfyUI's API or a game claim, and it is alpha software at v0.3.2.

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/t-crypt-berth/stop-local-engines-crashing-on-one-gpu/

## How to let games take the GPU while you play and resume AI after with Berth

Repo: [T-Crypt/berth](https://github.com/T-Crypt/berth) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Berth drains AI engines when a supported game launches and returns the card when you quit.

**Who it is for:** A gamer who also runs local AI models on the same NVIDIA card and wants the game to get the memory.

**The problem:** AI engines hold VRAM while a game starts, so the game stutters or fails to load.

**The outcome:** AI engines drain while the game runs and the card is returned when the game exits, with the state visible in `berth status`.

### Steps

1. Install Berth and run `berth service install --harbor`.
2. Confirm the daemon is running with `berth status`.
3. Launch a supported game from Steam, Lutris or gamescope on Linux, or Steam, Epic, GOG, EA, Ubisoft, Xbox or Battle.net on Windows.
4. Run `berth status` during play to see the game holding the card.
5. Quit the game and run `berth status` again to see the card returned to the AI engines.

### Prompt to paste into your agent

```text
On the machine with the Berth repo, run `berth service install --harbor` and then `berth status`. Expected output: the card and any leases are listed. Verify by launching a supported game and confirming `berth status` shows the game as the holder while AI engines are drained.
```

### Caveat

Game detection is limited to the launchers the README lists, and if your game is not on that list, add a `[[claim]]` rule in `berth.toml` or use `berth hold`.

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/t-crypt-berth/let-games-take-the-gpu-while-you-play/

## How to share the GPU between llama-swap and ComfyUI without ping-pong with Berth

Repo: [T-Crypt/berth](https://github.com/T-Crypt/berth) | Difficulty: Intermediate | Time: 45 minutes | Basis: From the README

Put llama-swap's models and ComfyUI under one lease so a model swap waits for the image job.

**Who it is for:** A local AI user running llama-swap for chat models and ComfyUI for images on one card, who sees loads fail while the other tool holds memory.

**The problem:** llama-swap swaps models in its own config but cannot see ComfyUI or other processes holding VRAM, so a load fails.

**The outcome:** Each llama-swap model runs under a Berth lease, ComfyUI waits at a job boundary, and a crashed process's PID and memory appear in `berth status`.

### Steps

1. Install Berth and run `berth service install --harbor`.
2. Back up your llama-swap config file before changing it.
3. Run `berth wire llama-swap` to add the lease to every model in your config.
4. Restart llama-swap so the wrapped model commands take effect.
5. Run `berth status` and start an image job in ComfyUI to see the handoff.

### Prompt to paste into your agent

```text
In the Berth repo at <path to berth>, run `berth wire llama-swap` against the llama-swap config at <config path>. Expected output: each model entry is wrapped in `berth run`. Verify with `berth status` that a ComfyUI job and a llama-swap model are queued in turn rather than loading together.
```

### Caveat

The README says an upstream llama-swap integration is planned, and until then `berth wire llama-swap` is the wrapper step you have to keep.

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/t-crypt-berth/share-gpu-between-llama-swap-and-comfyui/

## How to give coding agents a queue for the GPU instead of killing processes with Berth

Repo: [T-Crypt/berth](https://github.com/T-Crypt/berth) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Install the Berth skill so Claude Code or Codex asks for the card rather than killing GPU jobs.

**Who it is for:** A developer who uses Claude Code or Codex on a machine with a local model or image pipeline, and whose agent kills GPU processes to free memory.

**The problem:** An agent frees VRAM by killing processes, which can interrupt someone else's model or render.

**The outcome:** The agent asks Berth for the card, waits in line when another engine holds it, and reports the holder in `berth status`.

### Steps

1. Install Berth and run `berth service install --harbor`.
2. Run `berth skill install` to teach your agent to ask Berth for the card.
3. Ask the agent to start a GPU task through `berth run` instead of killing processes.
4. Run `berth status` to confirm the agent's engine holds the lease.
5. Use `berth stop ENGINE` if you need to drain an engine on purpose.

### Prompt to paste into your agent

```text
On the machine with the Berth repo, run `berth skill install` and then `berth status`. Expected output: the skill is installed for the agent and the card's holder is listed. Verify that a GPU task started by the agent runs through `berth run` and does not kill other GPU processes.
```

### Caveat

The skill teaches agents to ask Berth, but Berth only governs work that runs through it, so processes started outside Berth still show only as stowaways.

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/t-crypt-berth/give-coding-agents-a-gpu-queue/
