Kaname: self-hosted model manager for Hugging Face

**Kaname** (要, "the pivot") is a self-hosted web app for downloading and managing local LLMs from Hugging Face. Look up a repo, pick the quant you want, and Kaname downloads exactly those files with the official `hf` CLI, pinned to a specific commit so every download is reproducible. - **Pick files, not whole repos:** one-click quant selection for GGUF repos, or include/exclude globs. - **Pinned and reproducible:** every model is pinned to the exact commit SHA you reviewed. - **Downloads in the background:** live progress, speed and ETA per file; keeps going when you close the browser; cancel any time. - **Find things again:** search and filter by author, model family (e.g. Qwen, Gemma), quant, status and your own tags like `roleplay` or `security`. - **Homelab-friendly:** two containers, SQLite, OIDC single sign-on (e.g. Pocket ID), models on any folder or NAS share. ## Install You need Docker with Compose and an OIDC provider (e.g. [Pocket ID](https://pocket-id.org)). **1. Get the compose file and the config template** ```bash mkdir kaname && cd kaname curl -fsSLo compose.yaml https://git.linxweiler.xyz/pascallinxweiler/Kaname/raw/branch/main/deploy/compose.yaml curl -fsSLo .env https://git.linxweiler.xyz/pascallinxweiler/Kaname/raw/branch/main/.env.example ``` **2. Create an OIDC client** in your identity provider with the redirect URI `/api/auth/callback/pocket-id`, e.g. `http://192.168.1.10:3000/api/auth/callback/pocket-id`. Request the `groups` scope if you want to restrict access by group. **3. Fill in `.env`.** At minimum: `AUTH_URL` (the address you open in the browser), `AUTH_SECRET` (`openssl rand -base64 33`), `OIDC_ISSUER`, `OIDC_CLIENT_ID`, `OIDC_CLIENT_SECRET`, and ideally a read-only `HF_TOKEN`. **4. Create the folders and start** ```bash mkdir -p data models && sudo chown 1000:1000 data models docker compose up -d ``` Open your `AUTH_URL`, sign in, click **Add model**. That's it. **Updating:** `docker compose pull && docker compose up -d`. To stay on a version, set e.g. `KANAME_VERSION=0.4.0` in `.env`. The running version is shown next to the app name. ## Configuration All settings live in `.env`. The four steps above cover the required ones; the **[configuration reference in the wiki](https://git.linxweiler.xyz/pascallinxweiler/Kaname/wiki/Configuration)** lists every option with defaults and examples (folders, ports, download tuning, OIDC groups, which Hugging Face token to use). Models end up in `///`, e.g. `models/unsloth/Qwen3-8B-GGUF/`. More guides are in the [wiki](https://git.linxweiler.xyz/pascallinxweiler/Kaname/wiki). ## Using it

Adding a model: quant quick-select

- **Add model:** enter a repo ID like `unsloth/Qwen3-8B-GGUF` (or paste the URL), click a quant, and **Add & download**. Files that belong with the quant (chat template, MTP head, vision projector) are selected along with it; choose which kinds in Settings → Downloads. You can add tags right there. - **Search:** type anything: `unsloth qwen`, `q4_k_m`, `gemma`, `roleplay`. Every word has to match somewhere (repo, author, base model family, architecture, quant, tags). - **Filter:** combine Author, Family, Quant, Tag and Status filters. The URL keeps the filters, so you can bookmark a view. - **Tags:** add or remove your own tags on a model's page; click a tag in the list to filter by it. Create, rename and color them in Settings. - **Import:** models you already have in the models folder (as `/`) show up under "Found in the models folder"; **Import** matches them with the Hub repo and verifies the files instead of downloading them again. See the [wiki](https://git.linxweiler.xyz/pascallinxweiler/Kaname/wiki/Importing-existing-models). - **Verify / repair:** Verify checks every file's presence and size, Deep verify hashes them against the Hub; Repair downloads only what's missing or broken. - **Updates:** Kaname checks the Hub regularly and shows which of your files a newer commit changes; updating is always your click. If a repo (or its pinned commit) disappears from Hugging Face, the model is flagged and your local copy is kept. - **Delete:** removes the model and, if you want, its files from disk. - **Runtimes:** register llama.cpp, vLLM or your own fork images and pull them from Settings → Runtimes (groundwork for testing model configs). See the [wiki](https://git.linxweiler.xyz/pascallinxweiler/Kaname/wiki/Runtimes). - **Jobs:** each download has a page with per-file progress and the full `hf` log. - **API for agents:** create a token in Settings → API tokens and let a program or AI agent look up repos, list models and request downloads at `/api/v1`, and deploy and benchmark models to tune their launch options, within guardrails you set (approval, sizes and limits, one GPU job at a time, allowed runtimes and arguments, protected deployments). See [docs/api.md](docs/api.md) (also how to let `/api/v1/` past a forward-auth proxy) and the agent skills [docs/agent/SKILL.md](docs/agent/SKILL.md) and [docs/agent/SKILL-tuning.md](docs/agent/SKILL-tuning.md). ## How it works Two containers from the same image share one SQLite database: - **web:** Next.js UI and API, OIDC login (Auth.js); live updates via Server-Sent Events. - **worker:** runs the download queue, spawns `hf download --revision --include `, and measures progress from bytes on disk. Only one worker runs at a time. Notes on the `hf` CLI (huggingface_hub 2.1.1, pinned in the image): - Interrupted files are **not resumed**: a re-run skips finished files and restarts unfinished ones. Kaname cleans up the leftover partial files. - With Xet transfers the partial file only grows in large bursts, so Kaname disables Xet by default to show accurate progress. Files over 50 GB can only be downloaded with Xet, so a download that includes one uses Xet anyway; its progress then comes from `hf`'s own byte counter (the file on disk can sit still for minutes while Xet holds the data in memory). - `hf` exits successfully even if nothing matched, so Kaname checks every file's size and hash metadata after each download. - Files that already exist in the target folder without hf's metadata (copied in by hand) are hashed and kept if they match, and downloaded again if not. Imports rely on this. ## Development ```bash npm install cp .env.example .env # plus DATABASE_URL=file:./data/app.db and MODELS_DIR=./data/models npm run dev # web on http://localhost:3000 + worker ``` The worker needs `hf` on `PATH` (`pip install "huggingface_hub[hf_xet]==2.1.1"`). Without it, everything but downloading works. `docker compose up --build` (root `compose.yaml`) builds and runs the image locally. | Script | What it does | | --- | --- | | `npm run dev:web` / `npm run dev:worker` | run one side only | | `npm test` | unit tests | | `npm run typecheck`, `npm run lint` | checks | | `npm run db:generate` | new migration after changing `src/lib/db/schema.ts` | | `npm run build:worker` | bundle worker + migrate script into `dist/` (used by the image) | **Releases:** bump `version` in `package.json`, add a `## [X.Y.Z]` section to [`CHANGELOG.md`](CHANGELOG.md), commit and push a `vX.Y.Z` tag. Gitea Actions ([`.gitea/workflows/release.yaml`](.gitea/workflows/release.yaml)) runs the checks, pushes `git.linxweiler.xyz/pascallinxweiler/kaname:X.Y.Z` (+ `X.Y`, `latest`) and creates the release. It needs an `act_runner` with Docker access and a `REGISTRY_TOKEN` repo secret (package read/write).