Developers · HTTP API

Artwork endpoints

Cover art, voice avatars, the image engine and image models.

Artwork is the cover art drawn for a sound and the avatar drawn for a voice, each a PNG file the sound's or voice's artwork field points at. These endpoints report and install the image engine and its models, draw and remove artwork, and serve the files. Artwork describes the modes and settings.

Each endpoint lists the errors it returns itself. Any endpoint can also return the common errors.

Get the artwork status

GET /api/image/status

Returns the artwork mode, whether artwork can be drawn now, and the engine, model and catalogue behind it. Each call also probes this machine for image servers already running. This endpoint takes no parameters.

This request reads the artwork status:

Terminal
curl "http://127.0.0.1:17494/api/image/status"

A successful response is 200 OK with the status. The example is abridged:

JSON
{
  "mode": "managed",
  "ready": true,
  "detail": null,
  "engine": {
    "installed": true,
    "version": "master-827-97d2990",
    "backend": "cuda"
  },
  "model": {
    "id": "sd-turbo",
    "name": "SD-Turbo (Q8)",
    "hf_repo": "Green-Sky/SD-Turbo-GGUF",
    "resolution": 512,
    "steps": 1,
    "cfg": 1,
    "recommended": true,
    "source": "builtin",
    "installed": true,
    "size_bytes": 2023745376
    // ...more fields
  },
  "external": {
    "kind": "openai",
    "base_url": "",
    "model": "",
    "api_key_set": false
  },
  "running": false,
  "auto_artwork": false,
  "detected": []
  // ...more fields, including catalog
}
Field Type Description
mode string off (the default), managed or external
ready boolean Artwork can be drawn now
detail string or null What is missing, in words, when ready is false
engine object The sd-server engine: installed, version and backend
model object or null The catalogue entry of the chosen model
catalog object[] Every image model: the built-in sd-turbo, sdxl-turbo and sd35-medium, then entries from the image_models key of <DATA_DIR>/models/custom.json
external object The external server's kind (openai or a1111), base_url, model, and api_key_set in place of the key
running boolean The managed engine is running
auto_artwork boolean A cover is drawn after each music render
detected object[] Image servers found on this machine: label, base_url, kind and models

A catalogue entry has id, name, vendor, license, hf_repo (empty for files already on disk), files (each a flag, path and size_bytes), description, resolution, steps, cfg, extra_args, recommended, source (builtin or custom), installed, and size_bytes, the download size (0 for files already on disk).

This endpoint returns only the common errors.

Install the artwork engine

POST /api/image/engine/install

Queues a job that downloads stable-diffusion.cpp's sd-server from GitHub and installs it under <DATA_DIR>/bin/sd/<VERSION>/. While an install is running, the endpoint returns that job instead of queuing another. The body is optional.

Name Type Required Description
version string No latest or a release tag, such as master-827-97d2990. Default latest
backend string No Accepted and validated, but not used

This request installs the latest release:

Terminal
curl -X POST -H 'X-Soundbox: 1' \
  "http://127.0.0.1:17494/api/image/engine/install"

A successful response is 202 Accepted with the job's id. Progress streams from the job's events:

JSON
{
  "job_id": "5a3e8c1d-7b2f-4e9a-8d6c-1f0b3a9e7c42"
}
Status Cause
403 The server's capabilities turn downloads off

Download an image model

POST /api/image/models/<MODEL_ID>/download

Queues a job that downloads an image model's files from Hugging Face, fetching only those not yet on disk. While a download of the model is running, the endpoint returns that job instead of queuing another.

Name Type Required Description
<MODEL_ID> string Yes The image model's id, such as sd-turbo

This request downloads SD-Turbo:

Terminal
curl -X POST -H 'X-Soundbox: 1' \
  "http://127.0.0.1:17494/api/image/models/sd-turbo/download"

A successful response is 202 Accepted with the job's id:

JSON
{
  "job_id": "e41b7d90-3c6a-4f25-9b8e-0d2a6c5f1e73"
}
Status Cause
400 No image model has this id. The body has detail and failure
403 The server's capabilities turn downloads off

Delete an image model

DELETE /api/image/models/<MODEL_ID>

Deletes an image model's downloaded files. When it is the chosen model, the engine is stopped first.

Name Type Required Description
<MODEL_ID> string Yes The image model's id

This request deletes SD-Turbo:

Terminal
curl -X DELETE -H 'X-Soundbox: 1' \
  "http://127.0.0.1:17494/api/image/models/sd-turbo"

A successful response is 204 No Content.

Status Cause
400 No image model has this id, or its files are all ones already on disk, which Mirli did not download. The body has detail and failure
403 The server's capabilities turn downloads off

Draw a sound's cover

POST /api/sounds/<SOUND_ID>/artwork

Draws cover art for a sound and waits for it, replacing any cover it had. The prompt comes from the sound's prompt (or its track name, or its name) plus its first four tags, and the render uses the sound's seed. The old file is deleted only once the new one exists.

Name Type Required Description
<SOUND_ID> string Yes The sound's id

This request draws one sound's cover:

Terminal
curl -X POST -H 'X-Soundbox: 1' \
  "http://127.0.0.1:17494/api/sounds/<SOUND_ID>/artwork"

A successful response is 200 OK with the updated sound object, its artwork set to /artwork/cover-<UUID>.png.

Status Cause
400 No sound has this id, or the image render failed: artwork is off, the engine or model is missing, or no external server is set. The body has detail and failure

Remove a sound's cover

DELETE /api/sounds/<SOUND_ID>/artwork

Deletes a sound's cover file and sets its artwork to null. An id with no sound also returns 204.

Name Type Required Description
<SOUND_ID> string Yes The sound's id

This request removes one sound's cover:

Terminal
curl -X DELETE -H 'X-Soundbox: 1' \
  "http://127.0.0.1:17494/api/sounds/<SOUND_ID>/artwork"

A successful response is 204 No Content.

This endpoint returns only the common errors.

Draw a voice's avatar

POST /api/voices/<VOICE_ID>/artwork

Draws an avatar for a voice and waits for it, replacing any avatar it had. The prompt comes from the voice's notes, or its name when there are none, and each draw is a new take. The old file is deleted only once the new one exists.

Name Type Required Description
<VOICE_ID> string Yes The voice's id

This request draws one voice's avatar:

Terminal
curl -X POST -H 'X-Soundbox: 1' \
  "http://127.0.0.1:17494/api/voices/<VOICE_ID>/artwork"

A successful response is 200 OK with the updated voice object, its artwork set to /artwork/avatar-<UUID>.png.

Status Cause
400 No voice has this id, or the image render failed. The body has detail and failure

Remove a voice's avatar

DELETE /api/voices/<VOICE_ID>/artwork

Deletes a voice's avatar file and sets its artwork to null. An id with no voice also returns 204.

Name Type Required Description
<VOICE_ID> string Yes The voice's id

This request removes one voice's avatar:

Terminal
curl -X DELETE -H 'X-Soundbox: 1' \
  "http://127.0.0.1:17494/api/voices/<VOICE_ID>/artwork"

A successful response is 204 No Content.

This endpoint returns only the common errors.

Get an artwork image

GET /artwork/<FILE>

Returns one cover or avatar as image/png, served inline. Each render gets a new file name, so the response is cached for a year as immutable.

Name Type Required Description
<FILE> string Yes The file name from an artwork field, such as cover-<UUID>.png

This request saves one cover:

Terminal
curl -o cover.png "http://127.0.0.1:17494/artwork/cover-<UUID>.png"

A successful response is 200 OK with the PNG and the header Cache-Control: public, max-age=31536000, immutable.

Status Cause
400 The file name contains a path
404 No such file