API

This page documents the Python surface and the CLI's output contract. Capabilities documents the capability object and its queries; Getting started shows first runs.

MusicManager

from abstractmusic import MusicManager
from abstractmusic.backends import AceStepBackend, AceStepBackendConfig

music = MusicManager(backend=AceStepBackend(config=AceStepBackendConfig()))
asset = music.generate_audio(
    "cinematic orchestral intro",
    lyrics="[verse]\nThe gates are open\n[chorus]\nWe ride at dawn",
    duration_s=20.0,
    seed=123,
)

generate_audio(prompt, **request) returns a GeneratedAsset (data, mime_type, metadata) unless a store is configured, in which case it returns an artifact reference. t2m(...) returns the bytes. MusicManager(backend=..., store=None, model_id=None, registry=None, text_planner=None, text_planner_mode="auto").

What the manager does with a request, in order:

  1. The model. model_id, when given, must name the model the backend runs; another model is refused (MusicRequestError), never substituted.
  2. The task. No task named: the model's own (text_to_music when it lists it, otherwise its only task), recorded as task and task_source. A named task the model does not list is refused; lyrics_to_music is accepted where the model has native lyrics.
  3. The capability decision. decide_request checks the request against the model's capability block before anything is planned, loaded or sent: inputs (lyrics, negative prompt, reference audio, ...), the instrumental switch, the format, the sample rate, the duration, every control value. A refusal raises MusicRequestError with the model, the value and what is accepted; notes for loosely followed controls are emitted as warnings (MusicRequestWarning).
  4. Planning. planning=True, auto_lyrics=True or lyrics="auto" runs the text planner. Values the planner chose are sent only to a model that takes them, otherwise recorded under planner_values_not_sent.
  5. The format. No format named: the model's first format (WAV for the local models, MP3 for ElevenLabs), recorded as format_source (model_default, backend_default or request).
  6. Generation. The backend runs its own checks (text limits, device, precision, seed, extra keys) and returns audio of exactly the requested length on every local backend (trimmed when longer; a shorter result raises).

Switches (instrumental, planning, auto_lyrics, enhance_prompt, structure_prompt) take True/False, 1/0, or yes/no, true/false, on/off text; anything else is refused. instrumental=True reaches the backend as the model's instrumental switch; a model without one refuses it (Stable Audio Open, Stable Audio 3, generic Diffusers); MusicGen makes instrumentals only, so it accepts it without sending anything. Lyrics you pass explicitly are kept when the prompt merely mentions "instrumental"; only instrumental=True, missing lyrics or the exact marker [Instrumental] select instrumental output ([inst] is sung as lyrics). Other keyword arguments travel to the backend in request.extra (for example bpm, keyscale, allow_early_end); a key the backend does not read is refused.

Every result records the settings that ran and where each came from: the steps and guidance used and their source, the seed (seed_source: random when none was given), the device and precision, format_source, task_source, and capability_check (model capabilities when the registry lists the model, otherwise the backend's own capabilities).

Request Fields

AudioGenerationRequest fields: prompt, lyrics, vocal_language, negative_prompt, duration_s, num_inference_steps, guidance_scale, seed, format, sample_rate, composition_plan, extra. Request keys the capability decision reads, with the capability each maps to:

Request key Capability
lyrics inputs.lyrics
vocal_language inputs.vocal_language
negative_prompt inputs.negative_prompt
composition_plan inputs.composition_plan
reference_audio, source_audio, video inputs.reference_audio, inputs.source_audio, inputs.video
instrumental content.instrumental, controls.instrumental_switch
seed controls.seed
num_inference_steps controls.inference_steps
guidance_scale controls.guidance_scale
bpm controls.tempo
keyscale controls.key
timesignature controls.time_signature
positive_styles controls.style_tags
negative_styles controls.negative_styles (through planning only)
allow_early_end controls.early_end
fade_out_s controls.fade
format, sample_rate, duration_s, task output, tasks

Seeds are integers from 0 to 2^64 - 1 (ElevenLabs: 0 to 2147483647, and only in plan mode, that is with lyrics, a negative prompt or a composition plan; MiniMax-Music3: 0 to 4294967295). Text over a model's limit is refused, not cut: ACE-Step 256 prompt tokens and 2,048 lyric tokens after the pipeline's own formatting, Stable Audio Open Small 64 tokens, Stable Audio 3 256 tokens, MusicGen 512 tokens, generic Diffusers per the checkpoint's tokenizer, ElevenLabs 4,100 characters, MiniMax-Music3 5,000 tokens for the caption and the lyrics together.

Model Registry

from abstractmusic import MusicModelCapabilitiesRegistry

registry = MusicModelCapabilitiesRegistry()
spec = registry.get("ACE-Step/acestep-v15-xl-turbo-diffusers")   # MusicModelSpec
caps = registry.capabilities("ACE-Step/acestep-v15-xl-turbo-diffusers")   # MusicModelCapabilities
  • capabilities(model_id), generic_capabilities(backend_kind): the typed block (UnknownModelError for an id the registry does not list).
  • find_models(query=None, *, backend=None, runnable=None, include_unrunnable=False, **requirements): the runnable models that meet every requirement.
  • decide_request(model_id, request, *, planned=False, own_notes=()): a RequestDecision.
  • capability_matrix(fmt="markdown" | "text", models=None, include_unrunnable=False): the matrix.
  • list_models(task=None, recommended=None), get(model_id), backend_kinds().

See Capabilities for the block, the query keywords and examples. The registry is metadata only: it never changes the model a backend runs.

The flat licence fields of a MusicModelSpec remain: license, commercial_allowed (True only when the block's commercial_use is allowed), license_conditions, and license_url in spec.raw.

Text Planning

AbstractMusic exposes a small planner boundary so host applications can improve prompt rewriting without changing backend implementations:

def planner(request_dict):
    return {
        "prompt": "cinematic orchestral intro with a brass theme and clear build",
        "bpm": 96,
        "keyscale": "D minor",
        "planner_backend": "host-llm",
        "generated_fields": ["prompt", "bpm", "keyscale"],
    }

music = MusicManager(backend=backend, text_planner=planner, text_planner_mode="auto")
asset = music.generate_audio("heroic fantasy", duration_s=30, planning=True)

Modes: auto uses the configured planner, or the deterministic one when none is configured (recorded); a configured planner that fails raises. required raises when no planner is configured or it fails. deterministic uses the built-in planner. off preserves the raw text. An unknown mode is refused. The planner's tempo and key go only to a model with those controls; the example above on a model without a tempo control records bpm under planner_values_not_sent.

Styles and composition plans

positive_styles (instruments, vocal traits, production notes) reach a model through planning, which writes them into the prompt, or directly to a model with a style_tags control; without planning, a model without that control refuses them. negative_styles are an input of the planning step: they go only into a composition plan, so a model that takes no plan refuses them. A composition_plan goes only to a model that takes one (ElevenLabs); on ElevenLabs a plan beside a non-empty prompt is refused (put the prompt's content in the plan).

Planner providers can be callables accepting request_dict, objects with plan_music_text(request_dict), or objects with create_plan(MusicPlanningRequest). Planners keep the prompt's line breaks (runs of spaces within a line and repeated blank lines are collapsed).

For minimax-music3, without enhance_prompt=True a text planner never changes what the model receives, except to write lyrics you asked for with auto_lyrics=True (or lyrics="auto", which runs the planning step even when planning is off; the word is never sung). With enhance_prompt=True, the plan is rendered as the model's structured caption (Global Metadata, Vocal Details, Arrangement): your prompt is kept verbatim at the start and the planner's descriptive wording is added after it. When the backend recognises in that wording a tempo, key, time signature or language you did not give, or a contradiction with your lyrics or instrumental request, it discards the planner's whole wording and sends your own prompt, with a note; wording it does not recognise can still imply such things. The same rules apply when a plan made without naming the backend is compiled for minimax-music3 later, and planner fields that are not text are dropped with a note. The compiled metadata records caption_format: "minimax-music3-structured-caption" and caption_planner_enhanced, and the result metadata's caption holds the exact text sent (--print-plan prints it before generation): check it when exact control matters. See MiniMax-Music3.

AbstractCore Plugin

AbstractMusic registers itself through the abstractcore.capabilities_plugins entry point: seven backends (abstractmusic:acestep, abstractmusic:minimax-music3, abstractmusic:stable-audio-3, abstractmusic:stable-audio, abstractmusic:diffusers, abstractmusic:elevenlabs-music, abstractmusic:acemusic), and for each the models it runs (declared_models() in abstractmusic.integrations.abstractcore_plugin), stated at registration so that a host can route a request by its model without building a backend or using the network.

The same declaration states, for each model of a local backend, what an explicit download fetches (declared_model_downloads(): {backend id: {model id: None | {"download": {allow_patterns, size_bytes, requires}}}}, handed to CapabilityRegistry.declare_models as one mapping; the repository is the model id, allow_patterns None is the whole repository, requires lists other repositories the model loads):

Backend Models What a download fetches
minimax-music3 MiniMaxAI/MiniMax-Music3 the component folders the runtimes read (language_model/, rvq_depth_decoder/, condition_encoder/, transformer/, vocoder/, tokenizer/, config.json, LICENSE), 28.6 GB
minimax-music3 AbstractFramework/minimax-music3-8bit, -4bit the whole repository, 12.6 GB / 9.6 GB
acestep the three ACE-Step 1.5 XL Diffusers checkpoints the whole repository (Diffusers chooses the files it loads when it downloads), about 11 GB
stable-audio-3 small-music, small-sfx, medium model_config.json, model.safetensors, t5gemma-b-b-ul2/
stable-audio stabilityai/stable-audio-open-small model_config.json, model.safetensors, and the t5-base text encoder it requires (config.json, model.safetensors, spiece.model, tokenizer.json, 0.89 GB)

AbstractCore uses them for abstractcore models download <backend> <model> and only on that explicit request; AbstractCore 2.42.0 reads the mapping as the model ids and downloads none of them. After a download, the backend's own provider_details (metadata.cached_models) still decides whether the model is usable.

A backend the AbstractCore plugin builds NEVER downloads: every local backend reads the Hugging Face cache only (local_files_only=True in each backend config), and a generation or a residency load whose weights are not complete on this machine raises ModelWeightsMissingError (request_refused = True, named_by = "host", named_by_source = "weights"): the request is refused, not retried, until the weights are downloaded or another model is named; a host reads named_by_source == "weights" to offer the download. The message names what is missing, its size and the explicit ways to download it. Weights are complete only when everything the model's own declared download states is here (the same patterns and requires AbstractCore downloads; for a whole-repository Diffusers pipeline, model_index.json and every component it names): an interrupted download is neither usable nor cached. Stable Audio Open needs its t5-base text encoder in the cache too, and is reported usable only with it. A residency load that finds no weights answers state: "failed", loaded: false, with error.code: "weights_missing" and the refusal fields. Every local backend verifies the weights complete on disk before it calls Diffusers, Transformers or the Hub library; a loader is never used to find out that weights are missing. What is promised: AbstractMusic requests no file from the Hub, and calls no Hub-library function when the weights are absent. What is not: when it loads present weights through Diffusers, Transformers or hf_hub_download (ACE-Step, Diffusers, Stable Audio 3, Stable Audio Open), the Hub library itself may contact huggingface.co for its own metadata (its agent-harness registry, at most once a day) unless HF_HUB_OFFLINE=1; MiniMax-Music3 reads its snapshot from disk and calls no Hub-library function at all. Used directly (the CLI, Python without the plugin), Stable Audio 3, Stable Audio Open and the Diffusers backend still fetch missing files (local_files_only defaults to False for them).

list_models lists every model a provider declares, downloaded or not: each record's metadata carries usable (it can run now), cached (its weights are here; None for a remote service) and cached_models (the provider's verdict, as in provider_details). Keep the records whose metadata.usable is true for "what can run now".

Which backend serves a request is AbstractCore's decision:

  • AbstractCore 2.41.0 selects a backend through a host preference naming its full id, for example create_llm(..., music_backend="abstractmusic:minimax-music3"). It does not resolve a short name or a per-request provider; the plugin then refuses the request, naming the full id, rather than run another backend.
  • Later AbstractCore versions resolve a backend by full id or short name (minimax-music3), for a host preference and per request (provider=), and route a request that names only a model (model="AbstractFramework/minimax-music3-8bit") to the backend that declares it. See AbstractCore's capabilities documentation for the order of precedence.

When nothing is named, the plugin's priorities decide, and every local backend ranks above every remote one, so such a request never leaves the machine: ACE-Step 30, MiniMax-Music3 20, Stable Audio 3 10, Stable Audio 8, Diffusers 0, ElevenLabs -5, ACE Music -10. A backend refuses a model it does not run when the request or its own key (music_<backend>_model_id) names it. The shared key music_model_id configures the backend that runs that model: with AbstractCore 2.41.0 a mismatch is refused; with later versions, which route by model, another backend selected by the request or by the host's backend preference runs its own model. A model named by a request applies to that request only: the next request that names none runs the backend's own model. The Diffusers backend runs any Diffusers audio checkpoint: name it in the request (model=) or in music_diffusers_model_id / music_model_id.

Errors a host should treat as "the request must change" carry request_refused = True (MusicRequestError and CapabilityNotSupportedError, MusicConfigError, UnknownModelError, AceMusicEndpointRetiredError): answer them as a client error and do not retry. Other AbstractMusicError subclasses (a missing optional dependency, a failed generation) carry request_refused = False.

Host settings are config keys, never environment variables:

  • Shared keys: music_model_id, music_device, music_torch_dtype, music_duration_s, music_num_inference_steps, music_guidance_scale, music_revision, music_allow_cpu_retry, music_torch_compile, music_pipeline_class, music_shift, and the MiniMax-Music3 keys (music_runtime, music_memory_mode, music_lm_bits, music_allow_early_end, music_structure_fill, music_silence_after_song_end, music_fade_out_s).
  • Per-backend keys music_<backend>_<name> (prefixes acemusic, elevenlabs, acestep, diffusers, stable_audio, stable_audio_3, minimax) apply to one backend and win over the shared key; for example music_acestep_shift.
  • Remote services: music_acemusic_base_url, music_acemusic_api_key, music_acemusic_model, music_acemusic_timeout_s; music_elevenlabs_api_key, music_elevenlabs_base_url, music_elevenlabs_model, music_elevenlabs_output_format, music_elevenlabs_timeout_s.
  • Injection: music_backend_instance, music_backend_factory, music_text_planner, music_text_planner_mode, music_text_planner_instance, music_text_planner_factory.

A value that cannot be used as given (unparseable, out of range) raises MusicConfigError naming the key. Plugin results record settings_sources (where each setting came from: the request, a per-backend key or a shared key) and ignored_environment when a configuration variable from an earlier version is set. Without an artifact store, t2m returns GeneratedAudioBytes: a bytes subclass with .metadata and .mime_type.

Sound effects and music through AbstractCore. A host calls music.generate(prompt, task=..., model=..., seconds=...) (or t2m(...) with the same keywords):

  • task="text_to_audio" is a sound effect: the prompt reaches the model as written (the music text planner is skipped) and a request without a length lasts 5 seconds. A task the model does not list is refused.
  • seconds is the clip length; duration_s is the same value (send one; different values are refused, and so is a length that is not a positive number).
  • model selects the checkpoint for this request. With stable-audio-3, naming stabilityai/stable-audio-3-small-sfx runs the SFX checkpoint; one checkpoint stays loaded, and a request for another unloads it first (a failing unload is an error). A model the capability cannot run is refused.
  • An explicit format outside the model's formats is refused.

Discovery methods on the capability object: available_providers(task=...), provider_details(task=...), list_models(task=..., provider=...), list_provider_models(...), list_operations(task=...), capability_catalog(task=...). They read the packaged registry and only surface providers and models that can run now; every model record carries capabilities and metadata.capabilities (the typed block as plain data), and every provider record carries metadata.capabilities as a map of model id to block. Provider filters are backend-oriented ids such as elevenlabs, acestep, stable-audio, stable-audio-3, minimax-music3, diffusers and acemusic.

Discovery never imports a model runtime and never loads weights:

  • Local providers: the optional runtime must be installed, and at least one of the provider's models must already have weights in the Hugging Face cache. Cache-root resolution mirrors huggingface_hub (HF_HUB_CACHE, then HUGGINGFACE_HUB_CACHE, then HF_HOME/hub, then ~/.cache/huggingface/hub). Each model record carries metadata.cached.
  • Remote providers: a provider with an API key configured is probed at its own read-only endpoint, all in one concurrent round bounded by a 5 s deadline (abstractmusic.availability.REMOTE_PROBE_TIMEOUT_S). Only a success answer is available; HTTP 401/403 are unauthorized, 410 retired, 404, 429 and other errors unavailable, no answer unreachable. Results are reused for a short window, and an unresponsive provider is never probed twice concurrently.

provider_details(...) returns every known provider with a usable boolean, a status (available, unauthorized, retired, unavailable, unreachable, not-configured, not-installed, no-local-weights, no-loadable-weights when the only cached checkpoints use a layout the backend cannot load, or incompatible-model when a configured model id is known to be unloadable), metadata.reason, the full model catalogue in metadata.models, and the subset already downloaded in metadata.cached_models.

In AbstractCore plugin mode, AbstractMusic also accepts a host-supplied text service structurally when the owner context/config exposes generate_text(...) or generate_structured(...). This keeps LLM planning injectable without adding an AbstractCore dependency or passing raw provider objects into AbstractMusic.

When running under AbstractCore, the capability object also exposes an optional residency surface for local backends:

  • load_resident_model(request)
  • list_loaded_models(filters=None)
  • list_resident_models(filters=None)
  • unload_resident_model(request)

Remote providers remain stateless and do not show up as loaded. Local backends implement preload() / unload() so AbstractCore can warm and release in-process music engines without abusing discovery as a proxy for residency.

Residency is per capability instance: a model belongs to the capability object that loaded it (two instances of one backend in one process hold two copies, and an unload through one frees only its own), so local records say scope: null; remote ones say "remote".

What is listed is what the backend holds in memory now, asked of the backend (loaded_state()): a model a generation left resident is listed (source: "generation"), as is a residency load's (source: "explicit_preload"); after an unload, or with MiniMax-Music3 in staged memory mode (nothing kept between generations), nothing is. A record carries size_bytes (the bytes of the weights held) and what the runtime reports (memory_mode, components; MiniMax-Music3 on MLX adds active_memory_bytes, MLX's counter for every array of the process, named by active_memory_scope). A backend injected with music_backend_instance must implement loaded_state() (a dict naming the model it holds, or None) for the list to answer.

A request or residency load that names another model releases the resident one only when the new one starts loading weights (each local backend calls the callback given to set_before_load there), after every check that can refuse the request: a request refused for missing weights (ModelWeightsMissingError), a request field or a package leaves the resident model loaded and listed. A refusal that only the loaded model can decide still comes after the previous checkpoint is released, so it costs the resident model: Diffusers (the arguments the pipeline accepts, an unknown extra, its sample rate), ACE-Step (its sample rate, a control the pipeline does not take, guidance on a turbo checkpoint), Stable Audio Open (its sample rate, a prompt longer than its encoder reads, a duration beyond its window) and MiniMax-Music3 (a refusal the runtime itself raises, such as a prompt only it can count). A residency load that keeps nothing (staged) answers state: "not_resident". A load answer carries loaded_new: true when this call loaded the weights, false when the model was already resident or nothing was loaded (decided under the lock the load holds); during a generation a load is answered in_use. An unload looks at what is resident only once it holds the model-use lock and answers for the model it released; one naming a model that is no longer resident answers not_loaded and releases nothing. size_bytes is the sum of the runtime's parameter_bytes (MiniMax-Music3) or of the loaded modules' parameters and buffers (the other backends), read from the arrays held.

Audio quality analysis

abstractmusic.audio_analysis provides dependency-light quality inspection for generated audio. The canonical validation gate set is:

from abstractmusic.audio_analysis import evaluate_music_quality_gates

gates = evaluate_music_quality_gates("candidate.wav", "reference.wav")
accepted = all(gates.values())

It returns per-gate booleans for validity, noise texture, single-note collapse, pitch variety, the reference floor, and repetition artifacts. The gate set does not measure tempo stability — rhythm defects such as a double-time opening can pass every gate — so pair automated gates with listening review for release decisions. inspect_tempo_trajectory_file/bytes(...) provides a diagnostic windowed beat-period trajectory for inspecting suspected rhythm problems; read its values as dominant onset rate rather than exact tempo. is_probably_noise_texture(...) screens for wind/whoosh-like generative failures that pass basic validity checks; treat it as a warning to review rather than proof on its own. The acestep backend reports the same screen on every generation as metadata["audio_stats"]["probably_noise_texture"].

Prompt captions are checkpoint-sensitive: template caption expansion (--enhance-prompt) can improve the guidance-distilled turbo checkpoint but degraded the guided XL checkpoints in 30-second validation runs, so expansion is strictly opt-in. Registry entries marked caption_sensitive get compact feature captions (the prompt plus the long-form section map) from the deterministic planner instead of template prose.

MiniMax-Music3 Backend

from abstractmusic import MusicManager
from abstractmusic.backends import MiniMaxMusic3Backend, MiniMaxMusic3BackendConfig

backend = MiniMaxMusic3Backend(config=MiniMaxMusic3BackendConfig(local_files_only=False))
music = MusicManager(backend=backend)
asset = music.generate_audio(
    "Upbeat indie pop, bright guitars, male vocal",
    lyrics="[verse]\nRunning down the empty street tonight\nNeon signs are burning bright\n"
    "[chorus]\nWe are the summer, we are the light\nNever coming down tonight",
    duration_s=15,
    seed=3,
)

MiniMaxMusic3BackendConfig fields (all optional):

Field Default Meaning
model_id MiniMaxAI/MiniMax-Music3 Also accepts the aliases minimax-music3, minimax, music3, or a local directory laid out like the repository
runtime auto auto, mlx, or torch
device auto torch device: auto, cuda, cuda:N, mps, cpu (MLX always uses the Apple GPU)
dtype auto auto, bfloat16 (language model, depth decoder and flow transformer; the condition encoder and vocoder stay float32), float32; float16 is refused
duration_s 30.0 Default length of a generated song in seconds, at most 360
allow_early_end False True lets the model end the song itself, so the result can be shorter than duration_s
structure_fill True Wrap short lyrics (fewer sung words than seconds, with room for an intro and an outro) unchanged in instrumental sections sized to the duration
silence_after_song_end True Fade to silence over 4 s (or the time left) from a persistent end-of-song signal more than 2 s before the end of the clip
fade_out_s None Fade-out at the end of a clip cut at the requested length: None = 1 s but never more than a quarter of the clip; an explicit value is used as given (0 = none)
model_id None None: the 8-bit MLX package AbstractFramework/minimax-music3-8bit where it can run (MLX runtime, dtype auto or bfloat16, no lm_bits), else the published weights MiniMaxAI/MiniMax-Music3; the result's model_id_source says which. A named model is used as named
local_files_only True Set False to allow the one-time download (12.6 GB for the 8-bit package, 28.6 GB for the published weights)
cache_dir, revision None Hugging Face cache directory and revision
memory_mode auto auto, resident, or staged; auto is resident with at least 48 GiB of memory (MLX; torch on MPS or CPU, 96 GiB with a float32 language model) or a CUDA device reporting at least 30 GiB, staged otherwise or when the size is unknown
num_inference_steps 30 Flow-matching steps
guidance_scale 1.5 Autoregressive (prompt-adherence) guidance
fm_guidance_scale 1.7 Flow-matching guidance
ar_top_k, ar_guidance_top_k 50, 50 Sampling top-k
ar_temperature 1.0 Sampling temperature
lm_bits None 8 loads the language model with 8-bit weights (MLX runtime only)
progress None progress(stage, done, total) callback for the ar, flow and vocoder stages

Request mapping: prompt is the music description (required); lyrics are the sung words with section tags; duration_s (or seconds) is the length of the result; seed makes a run repeatable (a random seed is drawn and reported when omitted); num_inference_steps and guidance_scale override the config per request. Extra keywords: allow_early_end, structure_fill, silence_after_song_end, fade_out_s (0 to the clip length), fm_guidance_scale, ar_guidance_top_k, ar_top_k, ar_temperature, depth_guidance_scale, depth_top_k, depth_temperature, instrumental, and the caption hints bpm (a whole number from 20 to 300; 119.6 is refused), keyscale, timesignature and positive_styles; vocal_language (an ISO 639-1 code, optionally with a region such as fr-FR or pt_BR, or an English language name) is written into the caption when lyrics are sung. An unknown keyword that names a sampling setting is refused; a negative_prompt, a format other than wav, a sample_rate other than 44100, an unrecognised key, time signature or language, a bpm outside 20 to 300, and lyrics="auto" sent directly to the backend are refused. What each hint writes into the caption is listed in MiniMax-Music3.

Notes: before generation, the backend emits MiniMaxMusic3Warning (a UserWarning subclass in abstractmusic.backends.minimax_music3, base class abstractmusic.prompt_planner.MusicRequestWarning, with a .code) for lyrics too short, too long or empty for the duration, a voice asked for without lyrics, lyrics dropped for an instrumental, a prompt that mentions an instrumental while lyrics are given, and a prompt that disagrees with an explicit tempo, key, time signature or language. The text planner adds its own notes (MusicRequestWarning): a caption with facts the request did not give, lyrics written although none were requested, auto-lyrics requested but none returned. Notes are delivered for every request, including identical ones, and follow Python's warning filters (with warnings as errors, a note raises before generation). The backend's notes are kept in the result metadata notes and their codes in warnings. See Notes before generation.

Errors: MiniMaxMusic3RequestError (a subclass of abstractmusic.errors.MusicRequestError, itself a CapabilityNotSupportedError and a ValueError) for a request the model cannot run as asked (limits, unsupported or out-of-range values, reserved control text); MiniMaxMusic3RuntimeError (an AbstractMusicError) for a generation that ran and failed (non-finite values, no audio, out of memory, a runtime that cannot start on the requested device, unreadable weight files); OptionalDependencyMissingError when no runtime is installed; AbstractMusicError when the weights are not on the machine and downloads are not allowed. Requests are validated, and the prompt's token budget checked, before any weights load.

Metadata also carries runtime_details with end_token_probability (one value per generated frame: the probability the model gave to ending the song there), end_signal_frame and end_signal_s (the first point where that probability reached 0.5, or None): where the model considered the song finished. The tail handling adds structure_fill (sections added), structure_fill_skipped (why the fill was not applied), lyrics_sent, song_ended_at_s, end_fade_s, silenced_tail_s, fade_out_s (applied) and notes_after_run, and the warning codes mostly_silent and end_signal_unreadable; see Short lyrics and the end of the song.

preload() loads the weights; unload() releases them. One load, unload or generation of this backend runs at a time per process, across backend instances; other calls wait. See MiniMax-Music3 for usage guidance, measurements and the metadata each generation returns.

Through AbstractCore, the plugin builds this backend from host config keys: music_runtime, music_device, music_torch_dtype, music_memory_mode, music_duration_s, music_num_inference_steps, music_guidance_scale, music_revision, music_allow_early_end, music_structure_fill, music_silence_after_song_end, music_fade_out_s and music_lm_bits; the same names with the music_minimax_ prefix (for example music_minimax_runtime) apply to this backend only and win. The plugin never downloads weights; discovery offers the model once all of its component folders are in the cache. A host text planner follows the same rule as above: without prompt enhancement it changes nothing but requested lyrics.

CLI Output

abstractmusic t2m writes the audio to --out (default out.<format> in the working directory, where the format is the model's own unless --format names another it writes), the output path to stdout and, after every generation and for every backend, a one-line run summary to stderr:

run: backend=<backend id> model=<model id> runtime=<runtime> device=<device> dtype=<dtype> audio=<seconds>s@<rate>Hz/<channels>ch wall=<seconds>s memory_mode=<mode> ended_by_end_token=<yes|no> seed=<seed> timings[<stage>=<seconds>s, ...]

runtime, memory_mode (the mode that ran), ended_by_end_token, seed, timings and fallbacks appear when the backend reports them; device and dtype read unreported when it does not. The REPL prints the same line after each generation.

--metadata-out PATH also writes the run's metadata as strict JSON (NaN and infinity as null; backend, model, device, dtype, seed, settings, timings, notes, warnings, and for minimax-music3 the caption sent and the end-of-song signal), for every backend; --metadata-out auto uses the --out path with a .json suffix. The CLI then prints metadata: <path> on stderr. --out and --metadata-out are checked before generating: missing directories are created, and a directory path or an unwritable location is an error (exit 2). If the metadata cannot be written after the audio was saved, the CLI warns and exits 0.

--print-plan prints the plan and, for minimax-music3, Caption sent to the model: and Lyrics sent to the model: with the exact text, just before generation.

Lyrics: --lyrics reads the two characters \n as a line break; --lyrics-file PATH reads a UTF-8 file, one sung line per line; a byte-order mark is ignored (pass one or the other: Pass either --lyrics or --lyrics-file, not both.; an unreadable file stops with Could not read the lyrics file <path>: ..., an empty one with The lyrics file <path> is empty: ...). --duration, when not given, is 30 s for minimax-music3 and 10 s for every other engine.

For minimax-music3, before generating, the CLI prints on stderr the length it is about to render and where it came from (Generating 30 s with minimax-music3 (default; --duration to change). or (--duration)), then each request note once as NOTE: .... A note about the finished audio (the model ended the song early and the rest was silenced) is printed after the run line. The REPL prints the same notes.

Errors are one line on stderr:

  • A usage error exits with status 2 and prints ERROR: <message> (see: abstractmusic <command> --help) with the accepted forms: an unrecognised --keyscale, --timesignature or --vocal-language, a --bpm that is not a whole number from 20 to 300, a --fade-out below 0 or longer than the duration, --duration 0, --steps 0, an unreadable or empty --lyrics-file, --lyrics auto with a non-English --vocal-language, an --out or --metadata-out that is a directory or cannot be written; no engine named; an unregistered --model-id without --backend; a model the engine cannot run; an option the engine does not read; and every request value the model cannot honour (MusicRequestError). --keyscale, --timesignature and --vocal-language are checked before anything loads. For example: ERROR: Unrecognised vocal language 'xx'; use an ISO 639-1 code (en, fr, pt, ja, optionally with a region such as fr-FR or pt_BR) or an English language name (French, Portuguese, Japanese). (see: abstractmusic t2m --help)
  • Another package error (AbstractMusicError, for example a retired ACE Music endpoint, a missing API key, or a device that failed) prints ERROR: <message> and exits with status 1; out of memory also exits 1, with a message that points to --memory-mode staged.
  • Any other failure prints ERROR: <Type>: <message> (rerun with --verbose for the traceback) and exits with status 1.
  • Ctrl-C exits with status 130 and no output.

Package errors live in abstractmusic.errors: AbstractMusicError (base), OptionalDependencyMissingError (a backend's extra is not installed), BackendNotConfiguredError, CapabilityNotSupportedError (the backend or model cannot run the request as asked), UnknownModelError, and MusicConfigError (a host configuration value that cannot be used as given; also a ValueError; the message names the key). abstractmusic.errors.MusicRequestError (a CapabilityNotSupportedError that is also a ValueError) marks a request value the package refuses, and abstractmusic.prompt_planner.MusicRequestWarning is the base class of request notes. Backends add AceMusicEndpointRetiredError and DeviceRunError (raised when a generation fails on the device it was given and no CPU retry is allowed); both are AbstractMusicError subclasses. Every error class above is importable from abstractmusic.errors.

Built-In Backend Kinds

Engine Backend class Model Notes
elevenlabs ElevenLabsMusicBackend elevenlabs/music_v1 Remote, ELEVENLABS_API_KEY; MP3 only (an output_format override must be an mp3_* value); calls /v1/music and /v1/music/plan; 3 to 600 s. music_v1 is deprecated by ElevenLabs (removal 2027-01-31, replacement music_v2_5); results carry deprecation.
acemusic AceMusicBackend acemusic/ace-step-api Remote protocol of self-hosted ACE-Step API servers (/v1/chat/completions, /v1/models); ACEMUSIC_API_KEY and a base_url. WAV, MP3 or FLAC; a WAV shorter than requested, an unreadable or wrong container, or a served model other than a configured one is an error; no inference steps; batch_size 1. Against api.acemusic.ai it raises AceMusicEndpointRetiredError.
acestep AceStepBackend ACE-Step/acestep-v15-xl-turbo-diffusers (default), XL sft and base Package-owned orchestration around Diffusers AceStepPipeline; 10 to 600 s; tempo 30 to 300; turbo checkpoints refuse a guidance value; instrumental=True sends the [Instrumental] lyrics marker; pipeline arguments in extra (including reference_audio) are refused.
minimax-music3 MiniMaxMusic3Backend MiniMaxAI/MiniMax-Music3 AbstractMusic-owned MLX and PyTorch runtimes; up to 360 s; see MiniMax-Music3.
stable-audio-3 StableAudio3Backend stabilityai/stable-audio-3-small-music (default), -small-sfx, -medium Bundled inference code; strict weight loading (a checkpoint mismatch is an error); 8 steps by default. Without a requested length, Small SFX makes 5 s and the music checkpoints 30 s.
stable-audio StableAudioBackend stabilityai/stable-audio-open-small Bundled inference code; sound effects and loops up to 11 s, returned at the requested length.
musicgen MusicGenBackend facebook/musicgen-small Transformers; instrumental only, up to 30 s, exactly the requested length; no inference steps; a checkpoint that states no codebook count is refused.
diffusers DiffusersAudioBackend any Diffusers audio checkpoint you name Generic; its block is generic_capabilities("diffusers"); text limit from the checkpoint's tokenizer.

All backend classes import from abstractmusic.backends with their ...Config classes. Local backends write WAV only; an extra key a backend does not read is refused; an explicit device or precision it cannot run is an error.