# Add your own model

This guide adds a model to Mirli that is not in the shipped catalogue, such
as your own quantisation or finetune, and turns on a catalogued model that is
hidden by default.

## Before you begin

- The model must be a family audio.cpp knows. To list them, run
  `audiocpp_cli --list-loaders`.
- Have its weights on disk, or know the Hugging Face repository and file
  pattern to download them from.

## Add a model with custom.json

1. Create `<DATA_DIR>/models/custom.json`, where `<DATA_DIR>` is the data
   folder. It takes the same shape as the shipped catalogue:

   ```json title="<DATA_DIR>/models/custom.json"
   {
     "models": [
       {
         "id": "my-ace-step-finetune",
         "name": "ACE-Step (my finetune)",
         "vendor": "me",
         "description": "Q8 quantisation of my own finetune.",
         "family": "ace_step",
         "category": "music",
         "weights_path": "/models/ace-step-mine-q8_0.gguf",
         "max_duration_s": 240,
         "sample_rate": 44100,
         "channels": 2,
         "vram_estimate_mb": 8000,
         "defaults": {
           "duration_s": 30,
           "steps": 27,
           "cfg": 4.0
         },
         "supports": {
           "seed": true,
           "steps": true,
           "cfg": true,
           "lyrics": true
         },
         "license": {
           "name": "Apache-2.0",
           "commercial": "yes",
           "url": "https://example.com/licence"
         }
       }
     ]
   }
   ```

2. Set where the weights come from, in one of two ways:

   - For weights already on disk, set `weights_path` to their **absolute**
     path: a file, or a folder for `"weights_layout": "directory"`. Nothing is
     downloaded, and Mirli never deletes the file.
   - To download them, set `hf_repo` and `weights_glob` instead. They download
     like a shipped entry, into `<MODELS_DIR>/audiocpp/<YOUR_ID>/`.

3. Set `license`. If you leave it out, Mirli gives the model the licence
   name `Unspecified` with `commercial` set to `no`, since it can't know the
   terms.

4. Save the file. Mirli re-reads it on change, so a running server picks it
   up without a restart.

5. Check that the model appears:

   ```bash
   soundbox list
   ```

   Custom entries are tagged `[custom - from your custom.json]`. If the entry
   is missing, read the server's console: a malformed file, or an entry
   missing `id`, `name` or `family`, or naming neither `weights_path` nor
   `hf_repo`, is skipped with a warning.

Every other field means the same as for a shipped entry; see the
[model catalogue reference](https://mirli.app/docs/audiocpp-catalog/index.md).

## Replace a shipped model

To point an existing model at your own quantisation, give your entry the
shipped model's `id`. It replaces the shipped entry.

## Turn on a hidden model

Some catalogued models are **extras**, hidden from the model pickers until
you opt in.

1. On the **Models** page, click **Add** on the model's row.

   The model appears in the pickers immediately, with no restart.

To do the same over the HTTP API, list the ids in `enabled_audiocpp_models`:

```http
PATCH /api/settings
Content-Type: application/json

{
  "enabled_audiocpp_models": ["<MODEL_ID>"]
}
```

## What's next

- [Model catalogue reference](https://mirli.app/docs/audiocpp-catalog/index.md)
- [Download models from the command line](https://mirli.app/docs/install-models/index.md)
- [About audio.cpp](https://mirli.app/docs/audiocpp/index.md)
