Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ public surface may still change between minor releases.

## [Unreleased]

Nothing yet.
### Library
- `Target(variant=...)` and `run(variant=...)` select a named variant of a
model, for accounts the API has enabled one for; sent as `variant` on the
target. `TargetResult.variant` reports the one that ran.

### CLI
- `audioshake run --variant NAME` passes a model variant; `tasks get` and
`tasks list` show it as `model (variant)`.

## [0.1.0] - 2026-10-27

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ audioshake run song.wav -m vocals,drums -o stems/
audioshake run ./album -m effects,dialogue,music_fx -f mp3 --residual
audioshake run https://example.com/talk.mp3 -m transcription --language en
audioshake run panel.wav -m multi_voice --num-speakers 3
audioshake run meeting.wav -m diarization --variant preview_a # a model variant your account is enabled for

audioshake models # what your account can run, with cost and formats
audioshake tasks list # recent tasks
Expand Down
5 changes: 3 additions & 2 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ that has expired, is a usage error (exit 2) before anything runs.
| `--residual` | off | Also return everything each model did not capture |
| `--language CODE` | | For models that accept one (transcription, alignment); validated per model |
| `--num-speakers N` | | For `multi_voice` |
| `--variant NAME` | | A named variant of a model, for accounts the API has enabled one for (`preview_a`...). Applies to every model in the run; a variant the model does not have, or the account may not use, is rejected by the API before the task is created |
| `-c, --concurrency N` | 10 | Sources processed at once. Each source also fetches its outputs in parallel |
| `-r, --recursive` | off | Descend into sub-directories |
| `--no-download` | off | Leave outputs in the API's storage |
Expand Down Expand Up @@ -98,7 +99,7 @@ still map to one file name, the later one gets `-2` rather than replacing it.
### Progress

In a terminal the run paints a live view. The header says what is running
(models, output formats, language, speakers, residual), how many files run at a
(models, output formats, language, speakers, variant, residual), how many files run at a
time when there are several, and where the outputs go. Below it is
one row per source, with the stage it is at (uploading with a percentage, the
task id once it exists, queued, processing, downloading) and how long it has
Expand Down Expand Up @@ -216,7 +217,7 @@ Created column. `get` shows the task's status and cost, the asset it was made
from as `asset <id> (<original filename>)` (the id alone when the asset can no
longer be read, nothing for a task made from a URL), then one row per model.
That asset id is what `run asset:ID` takes to run more models on the same
upload. `download` writes `DIR/<original filename stem>/<output>.<format>` for every
upload. A model that ran as a variant is shown as `model (variant)`. `download` writes `DIR/<original filename stem>/<output>.<format>` for every
completed model of a finished task, the same layout `run` produces; the task id
is the folder name only if the original asset cannot be looked up. `--json` prints raw task objects (`list`, `get`) or the
written paths (`download`).
Expand Down
18 changes: 11 additions & 7 deletions docs/library.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Both clients are context managers. Call `close()` (or `await close()`) otherwise

```python
client.run(source, models, *, output_dir=None, format=None, residual=False,
language=None, num_speakers=None, download=True,
language=None, num_speakers=None, variant=None, download=True,
poll_interval=10.0, timeout=3600.0, on_progress=None) -> RunResult
```

Expand All @@ -43,11 +43,15 @@ comma list or a sequence, and each model produces those it offers — `"srt,mp3"
gives `alignment` its SRT and the stems their MP3, `("json", "srt")` gives
`alignment` both files from one billed target — while a model offering none of
them keeps its default. A format no selected model offers, or an unsupported
`language`, raises `ValidationError` before upload. `Target` still gives full
per-model control:
`language`, raises `ValidationError` before upload. `variant` names a model
variant the API has enabled for the account (`"preview_a"`, say) and, like
`residual`, applies to every model named by id; the API decides which variants
exist and who may use them, and rejects the task before it is billed otherwise.
`Target` still gives full per-model control:

```python
client.run("song.wav", ["vocals", Target("alignment", formats=("srt",), language="en")])
client.run("meeting.wav", [Target("diarization", formats=("json",), variant="preview_a")])
```

Files are written to `output_dir` (default: current directory) as
Expand Down Expand Up @@ -139,11 +143,11 @@ All are frozen dataclasses, and their sequences are tuples. Response types keep
the full API object in `.raw`.

```python
Target(model, formats=("wav",), residual=False, language=None, num_speakers=None)
Target(model, formats=("wav",), residual=False, language=None, num_speakers=None, variant=None)
Output(name, format, link)
TargetResult(
model, status, cost, duration, error, outputs
) # status: pending|processing|completed|failed
model, status, cost, duration, error, outputs, variant
) # status: pending|processing|completed|failed; variant: as the API reports it
Task(id, targets, raw) # .done .failed .succeeded .cost .outputs .created_at
Asset(id, name, format, link)
Model(
Expand Down Expand Up @@ -212,7 +216,7 @@ Errors raise `AuthError` (an `AudioShakeError`).
```python
audioshake.expand_models(["vocals, drums", "bass"]) # ['vocals', 'drums', 'bass']
audioshake.build_targets(models, *, catalog=None, format=None, residual=False,
language=None, num_speakers=None) -> list[Target]
language=None, num_speakers=None, variant=None) -> list[Target]
# catalog: the list from models.list(), or a {model_id: Model} mapping
audioshake.SPEAKER_COUNT_MODELS
```
Expand Down
2 changes: 1 addition & 1 deletion plugin/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "audioshake-cli",
"displayName": "AudioShake CLI",
"description": "AudioShake is a platform for state-of-the-art AI source separation, transcription, and content analysis — powering post-production workflows, karaoke, dubbing, speech enhancement, music copyright compliance, improving ASR accuracy, and AI training data preparation — at scale, and in production.",
"version": "0.3.11",
"version": "0.3.12",
"author": { "name": "AudioShake" },
"homepage": "https://github.com/audioshake/audioshake-python",
"repository": "https://github.com/audioshake/audioshake-python",
Expand Down
2 changes: 1 addition & 1 deletion plugin/.codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "audioshake-cli",
"version": "0.3.11",
"version": "0.3.12",
"description": "Run AudioShake models from Codex with the audioshake CLI and Python library: stem separation, dialogue isolation, speech clean-up, lyric transcription and alignment.",
"author": { "name": "AudioShake", "url": "https://www.audioshake.ai" },
"homepage": "https://github.com/audioshake/audioshake-python",
Expand Down
9 changes: 8 additions & 1 deletion plugin/skills/audioshake-cli/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ audioshake run https://example.com/talk.mp3 -m transcription --language en
audioshake run song.wav -m alignment --language en -f srt # subtitles
audioshake run song.wav -m vocals,alignment -f srt,mp3 # per-model formats
audioshake run panel.wav -m multi_voice --num-speakers 3
audioshake run meeting.wav -m diarization --variant preview_a # a model variant the account is enabled for
audioshake run asset:ID -m drums,bass # reuse an earlier upload (asset_id from --json); no re-upload
```

Expand All @@ -70,6 +71,7 @@ audioshake run asset:ID -m drums,bass # reuse an earlier upload (asset_id fr
| `--residual` | Also return everything the models did not capture |
| `--language CODE` | For transcription/alignment; validated against the model |
| `--num-speakers N` | For `multi_voice` |
| `--variant NAME` | A named model variant (for example `preview_a`) that AudioShake has enabled for the account. Applies to every model in the run, so give it its own run; a variant the model lacks or the account may not use is a 400 from the API before anything is billed |
| `-c N` | Concurrent sources (default 10) |
| `--no-download` | Leave outputs in the API's storage |
| `--timeout SECONDS` | Per-task wait (default 3600); raise it for very long inputs |
Expand Down Expand Up @@ -180,7 +182,12 @@ itself and logs to the `audioshake` logger.
request bodies. Never paste `-vv` output anywhere shared: it includes
presigned download URLs.
- Global flags (`--json`, `--plain`, `--api-key`, `-v`) go before the subcommand.
- `-m vocals,vocals` is rejected: a model runs once per source.
- `-m vocals,vocals` is rejected: a model runs once per source, so comparing
two variants of one model means two runs (`--variant preview_a`, then
`--variant preview_b`), ideally on the same `asset:ID`.
- Only use `--variant` when the user names one; variants are not listed by
`audioshake models`, and the API's 400 names the model when the account is
not enabled for it.
- Model ids use underscores, not hyphens, their word order matters, and they
are plural (`vocals`, `drums`, `keys`). `-m multi-voice` exits 2 before the
upload with `Did you mean 'multi_voice'?`, and `-m lead-vocal` with
Expand Down
6 changes: 6 additions & 0 deletions src/audioshake/_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def build_targets(
residual: bool = False,
language: str | None = None,
num_speakers: int | None = None,
variant: str | None = None,
) -> list[Target]:
"""Turn model names into fully specified targets.

Expand All @@ -123,6 +124,10 @@ def build_targets(
residual: Also return everything the models did not capture.
language: Applied to models that accept one.
num_speakers: Applied to models that accept one (``multi_voice``).
variant: Applied to every model named here, as ``residual`` is; the
API does not say which models have variants, so it is passed
through for the API to judge. Use :class:`Target` to vary it per
model.
"""
catalog = _catalog_by_id(catalog)
if isinstance(models, str | Target):
Expand Down Expand Up @@ -154,6 +159,7 @@ def build_targets(
residual=residual,
language=language if _accepts_language(name, model) else None,
num_speakers=num_speakers if name in SPEAKER_COUNT_MODELS else None,
variant=variant,
)
)
if catalog is not None:
Expand Down
2 changes: 2 additions & 0 deletions src/audioshake/aio.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ async def run(
residual: bool = False,
language: str | None = None,
num_speakers: int | None = None,
variant: str | None = None,
download: bool = True,
poll_interval: float = 10.0,
timeout: float = 3600.0,
Expand All @@ -151,6 +152,7 @@ async def run(
residual=residual,
language=language,
num_speakers=num_speakers,
variant=variant,
)

asset: Asset | None = None
Expand Down
13 changes: 13 additions & 0 deletions src/audioshake/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class RunOptions:
residual: bool = False
language: str | None = None
num_speakers: int | None = None
variant: str | None = None
download: bool = True
max_concurrent: int = 10
timeout: float = 3600.0
Expand Down Expand Up @@ -366,6 +367,7 @@ def _run_one(self, source: str | Path, node: Node, out_dir: Path) -> RunResult:
residual=self.options.residual,
language=self.options.language,
num_speakers=self.options.num_speakers,
variant=self.options.variant,
download=self.options.download,
timeout=self.options.timeout,
on_progress=lambda event: self._on_event(node, event, tally),
Expand Down Expand Up @@ -837,6 +839,8 @@ def _subtitle(options: RunOptions, targets: Sequence[Target], source_count: int)
parts.append(f"lang {options.language}")
if options.num_speakers is not None:
parts.append(f"{options.num_speakers} speakers")
if options.variant:
parts.append(f"variant {options.variant}")
if options.residual:
parts.append("residual")
if source_count > 1:
Expand Down Expand Up @@ -897,6 +901,11 @@ def _count(n: int, noun: str) -> str:
type=click.IntRange(min=1),
help=f"Speaker count, for {', '.join(SPEAKER_COUNT_MODELS)}",
)
@click.option(
"--variant",
metavar="NAME",
help="Model variant, for accounts the API has enabled one for; applies to every model",
)
@click.option(
"-c",
"--concurrency",
Expand Down Expand Up @@ -931,6 +940,7 @@ def run(
residual: bool,
language: str | None,
num_speakers: int | None,
variant: str | None,
concurrency: int,
recursive: bool,
no_download: bool,
Expand All @@ -946,6 +956,7 @@ def run(
audioshake run song.wav -m alignment --language en -f srt
audioshake run song.wav -m vocals,alignment -f srt,mp3
audioshake run panel.wav -m multi_voice --num-speakers 3
audioshake run meeting.wav -m diarization --variant preview_a
"""
model_list = expand_models(model_values)
if num_speakers is not None and not any(m in SPEAKER_COUNT_MODELS for m in model_list):
Expand All @@ -964,6 +975,7 @@ def run(
residual=residual,
language=language,
num_speakers=num_speakers,
variant=variant,
download=not no_download,
max_concurrent=concurrency,
timeout=timeout,
Expand All @@ -982,6 +994,7 @@ def run(
residual=residual,
language=language,
num_speakers=num_speakers,
variant=variant,
)
_log_format_fallbacks(targets, output_format, catalog)
tracker = ProgressTracker(
Expand Down
11 changes: 8 additions & 3 deletions src/audioshake/cli/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import click
from rich.markup import escape

from audioshake import AudioShake, AudioShakeError, Task
from audioshake import AudioShake, AudioShakeError, TargetResult, Task
from audioshake._run import source_stem

from . import _messages
Expand Down Expand Up @@ -55,7 +55,7 @@ def list_tasks(settings: Settings, limit: int, since: str | None) -> None:
(
task.id,
_created_str(task),
", ".join(t.model for t in task.targets),
", ".join(_model_label(t) for t in task.targets),
_status(task),
credits_or_none(task.cost),
)
Expand Down Expand Up @@ -91,7 +91,7 @@ def get_task(settings: Settings, task_id: str) -> None:
["Model", "Status", "Cost", "Outputs", "Error"],
[
(
t.model,
_model_label(t),
t.status,
credits_or_none(t.cost),
", ".join(f"{o.name}.{o.format}" for o in t.outputs),
Expand Down Expand Up @@ -178,6 +178,11 @@ def _source_folder(client: AudioShake, task: Task) -> str:
return source_stem(name) if name else task.id


def _model_label(target: TargetResult) -> str:
"""The model id, with the variant that ran when the API reports one."""
return f"{target.model} ({target.variant})" if target.variant else target.model


def _created_str(task: Task) -> str:
created = task.created_at
return created.strftime("%Y-%m-%d %H:%M") if created else ""
Expand Down
5 changes: 5 additions & 0 deletions src/audioshake/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def run(
residual: bool = False,
language: str | None = None,
num_speakers: int | None = None,
variant: str | None = None,
download: bool = True,
poll_interval: float = 10.0,
timeout: float = 3600.0,
Expand All @@ -172,6 +173,9 @@ def run(
residual: Also return everything the models did not capture.
language: For models that accept one (transcription, alignment).
num_speakers: For models that accept one (multi_voice).
variant: A named variant of a model, applied to every model named
by id. The API decides which variants exist and who may use
them; pass :class:`Target` objects to vary it per model.
download: Set False to leave results in the API's storage.
poll_interval: Seconds between status checks.
timeout: Give up waiting after this many seconds.
Expand All @@ -197,6 +201,7 @@ def run(
residual=residual,
language=language,
num_speakers=num_speakers,
variant=variant,
)

asset: Asset | None = None
Expand Down
8 changes: 8 additions & 0 deletions src/audioshake/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,17 @@ class Target:
residual: Also return everything the model did not capture.
language: Language code for models that accept one (transcription, alignment).
num_speakers: Speaker count for models that accept one (multi_voice).
variant: A named variant of the model, for accounts the API has enabled
it for. Passed through as given; the API rejects a variant the
model does not have or the account may not use.
"""

model: str
formats: tuple[str, ...] = ("wav",)
residual: bool = False
language: str | None = None
num_speakers: int | None = None
variant: str | None = None

def to_api(self) -> dict[str, Any]:
"""Serialize to the API's target shape (camelCase keys)."""
Expand All @@ -139,6 +143,8 @@ def to_api(self) -> dict[str, Any]:
target["language"] = self.language
if self.num_speakers is not None:
target["numSpeakers"] = self.num_speakers
if self.variant:
target["variant"] = self.variant
return target


Expand Down Expand Up @@ -170,6 +176,7 @@ class TargetResult:
duration: float | None = None
error: str | None = None
outputs: tuple[Output, ...] = ()
variant: str | None = None

@property
def done(self) -> bool:
Expand All @@ -192,6 +199,7 @@ def from_api(cls, data: Mapping[str, Any]) -> TargetResult:
duration=_as_float(data.get("duration")),
error=_error_text(data.get("error")) or _error_text(data.get("message")),
outputs=outputs,
variant=_as_optional_str(data.get("variant")),
)


Expand Down
Loading