# Model catalogue reference

Every model Mirli runs through [audio.cpp](https://mirli.app/docs/audiocpp/index.md) is an entry in a
JSON catalogue. The shipped catalogue is
`server/src/models/audiocpp_models_catalog.json`; entries in
`<DATA_DIR>/models/custom.json` are loaded beside it in the same shape. To
add one, see [Add your own model](https://mirli.app/docs/audiocpp-models/index.md).

## Tiers

| Tier | Behaviour |
|---|---|
| Listed | Appears in the model pickers and is ready to download. |
| Extra | Catalogued but hidden from the pickers until enabled with **Add** on the **Models** page, or through `enabled_audiocpp_models` in `PATCH /api/settings`. Enabling one adds it to `GET /api/models` immediately. |
| Custom | From `custom.json`. Always enabled, and never marked verified, since "verified" means someone ran the model end to end through this adapter. |

`GET /api/models/audiocpp/catalog` returns the whole catalogue, every tier.
Every entry declares its licence, and the UI shows it before download.

## Weights fields

| Field | Description |
|---|---|
| `hf_repo` | The Hugging Face repository to download from. |
| `weights_glob` | The files to download. Accepts a list, which keeps a download bounded: one of these repositories is 58 GB and its entry pulls 8.45 GB. |
| `weights_path` | Custom entries only. An absolute path to weights on disk. Nothing is downloaded or deleted. |
| `weights_layout` | `"file"` (default) or `"directory"`. `"directory"` passes the whole weights folder to the loader, for package models. |
| `weights_required` | Every file that must be present. The model counts as downloaded only when all are, so a half-finished download reports "not downloaded" instead of failing inside ggml. |
| `weights_root` | For a bring-your-own package whose files sit in a subfolder: that subfolder, relative to the folder given, to pass as `--model`. Shipped entries don't need it, because Mirli strips the package's repo prefix on download as audio.cpp's own installer does (`audiocpp_strip_prefix`). |

Package models ship a folder of components instead of one file. MiniMax
Music 3 has five (condition encoder, language model, transformer, RVQ depth
decoder, vocoder) plus config and tokenizer JSON. Given only the largest file,
the loader would drop the rest without an error, so these entries use
`weights_layout: "directory"`.

## Request fields

From 0.9.x, audio.cpp refuses any request option a family's spec does not
list, with an error such as:

```text
unknown MiDashengLM-Gen request option: duration_seconds
```

Mirli sends a generation the generic options `duration_seconds`,
`num_inference_steps` and `guidance_scale`. Most `gen` families accept all
three.

| Field | Description |
|---|---|
| `supports.steps`, `supports.cfg` | `false` on a `gen` entry sends no step count or guidance scale at all, rather than a default the family rejects. |
| `duration_option` | Sends the target length as this option, such as `duration_sec`, instead of `duration_seconds`. |
| `supports.negative_prompt` with `request_options.negative_prompt` | Offers a negative prompt. audio.cpp has no negative-prompt flag, so a family that accepts one takes it as a request option. ControlFoley is the only one so far. |

A family's accepted options are in `model_specs/<FAMILY>.json` beside the
binary, or embedded in it.

## Component filenames

For a package model, the loader reads its component filenames from a package
spec compiled into the binary, and checks those files exist before it parses
any option. A session or load option cannot override a component path,
because that check has already failed. An entry therefore has to match the
package the installed binary ships.

The spec is embedded in the binary as plain JSON. This command prints the
part around one package name:

```bash
node -e "
const d = require('fs').readFileSync('audiocpp_cli.exe', 'latin1');
const i = d.indexOf('minimax_music3_q4_0');
console.log(d.slice(i - 3000, i + 1500));
"
```

- A package's name does not describe all of its contents: a "q4_0" package
  can ship a q8_0 component.
- The per-component option defaults in the same spec can disagree with the
  package's file list. The `files` array is the one to follow.

## Capabilities

Each family supports a different set of features. The entry declares them,
and the app offers only what is declared.

| Capability | Description |
|---|---|
| Generation | Duration, steps, guidance and seed, common across `gen` loaders. |
| Lyrics | Lyrics-conditioned vocal models (ACE-Step, MiniMax Music 3). The prompt sets genre and production; the lyrics are what is sung. Some models, including MiniMax Music 3, refuse to run without lyrics; for those, Mirli sends an explicit `[instrumental]` marker when none are given. |
| Separation | `htdemucs`, `bs_roformer` and `mel_band_roformer` split a mix into stems. htdemucs emits `vocals`, `drums`, `bass` and `other`. |
| `extend` | The source unchanged, followed by new material up to the target length. Runs as a repaint whose window starts past the end of the source, so the original is kept sample for sample. |
| `cover` | The clip re-rendered in the style of a new prompt, locked to the source's length, with a strength that sets how closely it follows the original. |
| `repaint` | A window inside the clip regenerated, with a strength and a mode. The sound editor's Repaint tool runs it on a highlighted range (`POST /api/repaint`, or `generate` with `edit: "repaint"`). |

For separation and the audio-to-audio routes, Mirli resamples the source to
the model's rate first.

Two separation constraints produce confusing errors when missed:

- The source goes in as the **audio input**, not the reference input. The
  reference input is for voice conversion and style transfer; using it for
  separation fails with an unrelated-sounding contract error.
- htdemucs requires exactly 44.1 kHz and fails on other rates with a
  sample-rate mismatch. Splitting a 48 kHz ACE-Step render is the common case,
  which is why Mirli resamples first.
