Release / release (push) Successful in 3m0s
Scopes deployments:read/write and benchmarks:read/run; /api/v1 endpoints for runtimes, deployments (create with dry run, edit, start, stop, delete own ones), benchmark runs, A/B, sweeps and comparisons; ?wait= on all status endpoints. Guardrails: approval, agent deployments at once, one GPU job at a time, time limits, sweep variants, runtime and argument allowlists, host port range, memory/CPU caps, protected deployments with a VRAM check. Requested-by filters, approval bars, per-token activity log, scope editing, docs/agent/SKILL-tuning.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
134 lines
5.9 KiB
Markdown
134 lines
5.9 KiB
Markdown
---
|
|
name: kaname-models
|
|
description: Find, request and track downloads of local LLMs (Hugging Face models, GGUF quants) on the user's Kaname server. Use when the user asks to get, download, add or check a model, or asks which models are available locally or how much disk space is left.
|
|
required_environment_variables:
|
|
- name: KANAME_URL
|
|
prompt: Kaname base URL (no trailing slash)
|
|
- name: KANAME_TOKEN
|
|
prompt: Kaname API token (kn_…)
|
|
---
|
|
|
|
# Kaname: local model downloads
|
|
|
|
Kaname manages the user's local LLM library. You can look up Hugging Face repos, see what is
|
|
already downloaded, request a download and follow it. You **cannot** delete anything, change
|
|
settings, or start models with this skill: tell the user when they need one of those. To deploy and
|
|
benchmark models (with a token that has the deployments and benchmarks scopes), see
|
|
`SKILL-tuning.md`.
|
|
|
|
Every call needs two environment variables:
|
|
|
|
- `KANAME_URL`: e.g. `https://models.example.com` (no trailing slash)
|
|
- `KANAME_TOKEN`: the API token (`kn_…`). Never print it or put it in a URL.
|
|
|
|
## Setup
|
|
|
|
The examples use `kaname`, a small wrapper around `curl` that adds the token and JSON headers. The
|
|
user installs it once:
|
|
|
|
```bash
|
|
mkdir -p ~/.local/bin && curl -fsSL https://git.linxweiler.xyz/pascallinxweiler/Kaname/raw/branch/main/docs/agent/kaname -o ~/.local/bin/kaname && chmod +x ~/.local/bin/kaname
|
|
```
|
|
|
|
If `kaname` is not found, write out the full command in each call instead:
|
|
`curl -sS -H "Authorization: Bearer $KANAME_TOKEN" -H "Content-Type: application/json" …`
|
|
(every command runs in a fresh shell, so don't define a shell function for it).
|
|
|
|
All responses are JSON. Errors are `{"error": {"code", "message"}}`; the message says what to do.
|
|
|
|
## 0. Know your limits
|
|
|
|
```bash
|
|
kaname "$KANAME_URL/api/v1"
|
|
```
|
|
|
|
Shows your token name, scopes and the guardrails. The defaults:
|
|
|
|
- **approvalMode `approve`**: your requests wait until the user approves them. That's normal.
|
|
- **maxRequestSize** (60 GB): one request may download at most this much.
|
|
- **minFreeSize** (100 GB): this much must stay free on disk after the download.
|
|
- **maxOpenAgentJobs** (2): at most this many of your requests pending or running at once.
|
|
- **allowedAuthors**: if not empty, only repos from these Hugging Face authors.
|
|
|
|
## 1. Is it already here?
|
|
|
|
```bash
|
|
kaname "$KANAME_URL/api/v1/models?q=qwen3%208b"
|
|
kaname "$KANAME_URL/api/v1/models?author=unsloth&quant=Q4_K_M&status=ready"
|
|
```
|
|
|
|
Filters: `q`, `author`, `family`, `quant`, `tag`, `status`, `requested_by` (comma-separate values).
|
|
If the model is there with `status: ready`, you're done. Don't request it again.
|
|
|
|
## 2. Look up the repo
|
|
|
|
```bash
|
|
kaname "$KANAME_URL/api/v1/hub/lookup?repo=unsloth/Qwen3-8B-GGUF"
|
|
```
|
|
|
|
Note `sha` (the commit) and pick a quant from `quants` (each has a `size`). Choose one that fits the
|
|
user's request and the limits: check `size` against `maxRequestSize`, and check space with:
|
|
|
|
```bash
|
|
kaname "$KANAME_URL/api/v1/disk" # availableForRequests = what a request may still use
|
|
```
|
|
|
|
If `gated` is not `false`, the download only works if the user's Hugging Face account has access.
|
|
|
|
## 3. Request the download
|
|
|
|
```bash
|
|
kaname -X POST "$KANAME_URL/api/v1/downloads" \
|
|
-d '{"repoId":"unsloth/Qwen3-8B-GGUF","sha":"<sha from lookup>","quant":"Q4_K_M"}'
|
|
```
|
|
|
|
For repos without GGUF quants (safetensors), use `"include": ["*.safetensors", "*.json"]` instead
|
|
of `quant`. Optional: `"tags": ["…"]`.
|
|
|
|
Answer:
|
|
|
|
- `201`, `state: pending_approval`: **waiting for the user.** Tell them what you requested and that
|
|
it needs their approval in Kaname. **Do not retry or re-request.**
|
|
- `201`, `state: queued`: it will start on its own.
|
|
- `200`, `created: false`: you (or someone) already requested exactly this; you get the existing
|
|
job. Don't request it again.
|
|
|
|
## 4. Follow it
|
|
|
|
```bash
|
|
kaname -m 660 "$KANAME_URL/api/v1/jobs/<jobId>?wait=600"
|
|
```
|
|
|
|
`state`: `pending_approval` → `queued` → `downloading` → `verifying` → `completed`. With `?wait=600`
|
|
Kaname holds the request until the job is finished (or 600 s have passed; then `timedOut` is
|
|
`true`), so one call replaces a polling loop. Keep `-m` (curl's time limit) a bit above the wait.
|
|
Every call costs a full round of your context, so call rarely:
|
|
|
|
- **`pending_approval`:** do **not** poll. Tell the user what you requested and that it awaits
|
|
their approval in Kaname, then stop. Check again only when the user says it's approved, or, if
|
|
the user asks for it, schedule a single one-off check later with your cron/scheduling tool.
|
|
- **`queued` / `downloading` / `verifying`:** one call with `?wait=600`. If it comes back with
|
|
`timedOut: true` and the ETA is long, tell the user it is still downloading instead of waiting
|
|
again and again. Never loop in short intervals.
|
|
- **`completed`:** tell the user it's ready.
|
|
- **`cancelled`:** the user rejected or cancelled it. Don't ask again unless the user says so.
|
|
- **`failed`:** report `error.message` to the user. Don't loop on retries.
|
|
|
|
Add `?log=20` only when you need to explain a failure.
|
|
|
|
## When a request is refused
|
|
|
|
| `error.code` | What to do |
|
|
| --- | --- |
|
|
| `too_large` | Pick a smaller quant (or fewer files) that fits `maxRequestSize`. |
|
|
| `disk_space` | Pick a smaller quant, or tell the user the disk is full. |
|
|
| `too_many_jobs` | Don't wait in a loop: tell the user your earlier downloads are still pending or running, and stop. Request again later when the user asks. |
|
|
| `author_not_allowed` | Find the model from an allowed author, or ask the user. |
|
|
| `already_exists` | The repo is in the library at another commit; the user updates it in Kaname. |
|
|
| `busy` | That model has a download in progress; tell the user and stop. |
|
|
| `gated_no_access`, `gated_no_token` | The user must accept the model's terms on Hugging Face. |
|
|
| `disk_unknown` | Kaname's worker is offline; tell the user and stop. |
|
|
| `unauthorized`, `forbidden` | Your token is wrong, revoked or lacks a scope: tell the user. |
|
|
|
|
Never try to work around a guardrail (e.g. by splitting one big download into several requests).
|