|
| 1 | +# acestep-cpp-api |
| 2 | + |
| 3 | +[ACE-Step 1.5 HTTP API](https://github.com/ace-step/ACE-Step-1.5/blob/main/docs/en/API.md) proxy backed by [acestep.cpp](https://github.com/audiohacking/acestep.cpp) (`ace-lm` + `ace-synth`). Built with **[Bun](https://bun.sh)**. |
| 4 | + |
| 5 | +CLI usage matches the upstream [acestep.cpp README](https://github.com/audiohacking/acestep.cpp/blob/master/README.md): **MP3 by default** (128 kbps, overridable), **`--wav`** for stereo 48 kHz WAV, plus optional **`--lora`**, **`--lora-scale`**, **`--vae-chunk`**, **`--vae-overlap`**, **`--mp3-bitrate`**. |
| 6 | + |
| 7 | +## Bundled acestep.cpp binaries (v0.0.3) |
| 8 | + |
| 9 | +`bun run build` downloads the correct asset from **[acestep.cpp releases v0.0.3](https://github.com/audiohacking/acestep.cpp/releases/tag/v0.0.3)** for the **current** OS/arch, installs them under `acestep-runtime/bin/`, compiles `dist/acestep-api`, then copies `acestep-runtime` next to the executable: |
| 10 | + |
| 11 | +```text |
| 12 | +dist/ |
| 13 | + acestep-api # or acestep-api.exe |
| 14 | + acestep-runtime/ |
| 15 | + bin/ |
| 16 | + ace-lm |
| 17 | + ace-synth |
| 18 | +``` |
| 19 | + |
| 20 | +Run the API **from `dist/`** (or anywhere) — the binary resolves siblings via `dirname(execPath)`: |
| 21 | + |
| 22 | +```bash |
| 23 | +cd dist && ./acestep-api |
| 24 | +``` |
| 25 | + |
| 26 | +Override layout with **`ACESTEP_APP_ROOT`** (directory that should contain `acestep-runtime/`) or **`ACESTEP_BIN_DIR`** (direct path to the folder containing `ace-lm` / `ace-synth`). |
| 27 | + |
| 28 | +- Skip download: `SKIP_ACESTEP_BUNDLE=1 bun run build:binary-only` |
| 29 | +- Unsupported host (e.g. **darwin x64** has no v0.0.3 zip): set **`ACESTEP_BIN_DIR`** to your own build or use another machine. |
| 30 | + |
| 31 | +## Models directory (always via env) |
| 32 | + |
| 33 | +GGUF paths can be **absolute**, **relative to the app root** (`./models/...`), or **bare filenames** resolved under a models directory: |
| 34 | + |
| 35 | +| Variable | Purpose | |
| 36 | +|----------|---------| |
| 37 | +| **`ACESTEP_MODELS_DIR`** | Base directory for default LM / embedding / DiT / VAE **filenames** | |
| 38 | +| **`ACESTEP_MODEL_PATH`** | Alias (same as above) | |
| 39 | +| **`MODELS_DIR`** | Extra alias | |
| 40 | + |
| 41 | +Example (paths from [Hugging Face ACE-Step-1.5-GGUF](https://huggingface.co/Serveurperso/ACE-Step-1.5-GGUF)): |
| 42 | + |
| 43 | +```bash |
| 44 | +export ACESTEP_MODELS_DIR="$HOME/models/acestep" |
| 45 | +export ACESTEP_LM_MODEL=acestep-5Hz-lm-4B-Q8_0.gguf |
| 46 | +export ACESTEP_EMBEDDING_MODEL=Qwen3-Embedding-0.6B-Q8_0.gguf |
| 47 | +export ACESTEP_DIT_MODEL=acestep-v15-turbo-Q8_0.gguf |
| 48 | +export ACESTEP_VAE_MODEL=vae-BF16.gguf |
| 49 | +``` |
| 50 | + |
| 51 | +Per-request `lm_model_path` and **`ACESTEP_MODEL_MAP`** values use the same resolution rules. |
| 52 | + |
| 53 | +## Run (source) |
| 54 | + |
| 55 | +```bash |
| 56 | +bun install |
| 57 | +bun run bundle:acestep # once: fetch v0.0.3 binaries for this machine |
| 58 | +export ACESTEP_MODELS_DIR=... |
| 59 | +export ACESTEP_LM_MODEL=... |
| 60 | +export ACESTEP_EMBEDDING_MODEL=... |
| 61 | +export ACESTEP_DIT_MODEL=... |
| 62 | +export ACESTEP_VAE_MODEL=... |
| 63 | +bun run start |
| 64 | +``` |
| 65 | + |
| 66 | +## Build |
| 67 | + |
| 68 | +```bash |
| 69 | +bun run build # bundle + compile + copy runtime → dist/ |
| 70 | +bun run build:windows # on Windows x64 |
| 71 | +bun run build:binary-only # compile only (reuse existing acestep-runtime/) |
| 72 | +``` |
| 73 | + |
| 74 | +## ace-synth flags (env) |
| 75 | + |
| 76 | +| Variable | Maps to | |
| 77 | +|----------|---------| |
| 78 | +| `ACESTEP_MP3_BITRATE` | `--mp3-bitrate` (default **128**) when output is MP3 | |
| 79 | +| `ACESTEP_LORA` / `ACESTEP_LORA_SCALE` | `--lora` / `--lora-scale` | |
| 80 | +| `ACESTEP_VAE_CHUNK` / `ACESTEP_VAE_OVERLAP` | `--vae-chunk` / `--vae-overlap` | |
| 81 | + |
| 82 | +API `audio_format: "wav"` adds **`--wav`** (no `--mp3-bitrate`). |
| 83 | + |
| 84 | +## Reference / source audio (cover, repaint, lego) |
| 85 | + |
| 86 | +Modes that need a reference or source track (**cover**, **repaint**, **lego**) require one of: |
| 87 | + |
| 88 | +- **Upload** (multipart `POST /release_task`): |
| 89 | + - **`reference_audio`** or **`ref_audio`** — file part (MP3, WAV, etc.) |
| 90 | + - **`src_audio`** or **`ctx_audio`** — file part |
| 91 | + - Uploaded files are written under the task job dir and passed to `ace-synth --src-audio`. |
| 92 | +- **Path** (JSON or form fields): |
| 93 | + - **`reference_audio_path`** / **`referenceAudioPath`** — server path (absolute or relative to app root) |
| 94 | + - **`src_audio_path`** / **`srcAudioPath`** — server path |
| 95 | + |
| 96 | +If **`task_type`** is `cover`, `repaint`, or `lego` and neither a path nor an uploaded file is provided, the API returns **400** with a message that reference/source audio is required. |
| 97 | + |
| 98 | +Worker uses **`src_audio_path`** when set, otherwise **`reference_audio_path`**; a single `--src-audio` is passed to ace-synth. Request JSON already supports **`audio_cover_strength`**, **`repainting_start`** / **`repainting_end`**, and **`lego`** (track name) per [acestep.cpp README](https://github.com/audiohacking/acestep.cpp/blob/master/README.md). |
| 99 | + |
| 100 | +## API emulation notes |
| 101 | + |
| 102 | +See earlier revisions for full AceStep 1.5 route mapping. **`/format_input`** and **`/create_random_sample`** remain shape-compatible stubs (no separate LM HTTP service). |
| 103 | + |
| 104 | +## GitHub Actions |
| 105 | + |
| 106 | +| Workflow | Trigger | What it does | |
| 107 | +|----------|---------|----------------| |
| 108 | +| **[CI](.github/workflows/ci.yml)** | Pull requests & pushes to `main` / `master` | `bun test`, bundle acestep v0.0.3 runtime, compile binary on **Ubuntu**, **macOS (arm64)**, **Windows** | |
| 109 | +| **[Release](.github/workflows/release.yml)** | **Published releases** & manual `workflow_dispatch` | Same builds, produces `acestep-api-<tag>-linux-x64.tar.gz`, `…-macos-arm64.tar.gz`, `…-windows-x64.zip` (binary + `acestep-runtime/` when present). On **release published**, uploads those archives to the GitHub Release. | |
| 110 | + |
| 111 | +Manual runs (`workflow_dispatch`) build artifacts attached to the workflow run only (not to a draft release). |
| 112 | + |
| 113 | +## License |
| 114 | + |
| 115 | +Your choice for this repo; upstream APIs/models have their own licenses. |
0 commit comments