Skip to main content

Unix-style CLI wrappers for MLX speech, language, and TTS models

Project description

mlx-pipe

Unix-style CLI wrappers for MLX speech and language models.

Alpha software: mlx-pipe currently targets Apple Silicon Macs and Python 3.11 or 3.12. The MLX audio ecosystem is moving quickly, so model-specific behavior may change between releases.

mlx-pipe keeps stdout pipe-friendly:

  • stt and llm write plain text to stdout.
  • tts writes WAV bytes to stdout, or to --out.
  • progress, model loading, and warnings go to stderr.
  • --json is available when structured output is needed.

Install

From PyPI. The package is published as mlx-pipe; the installed CLI command is mlx-pipe:

uv tool install mlx-pipe --python 3.12
mlx-pipe --help

For local development, clone the repository and use uv:

uv sync
uv run mlx-pipe --help

Python is pinned to >=3.11,<3.13 because the MLX audio stack is not yet stable on Python 3.13.

Quick Start

Run a local LLM:

uv run mlx-pipe llm "Say hello in one short sentence" \
  --model mlx-community/gemma-3-1b-it-4bit

Transcribe audio:

uv run mlx-pipe stt /tmp/asr.wav \
  --model RayyTien/Breeze-ASR-26-mlx-4bit

Generate speech:

uv run mlx-pipe tts "Hello from Voxtral." \
  --model mlx-community/Voxtral-4B-TTS-2603-mlx-4bit \
  --voice casual_male \
  --out /tmp/voxtral.wav

file /tmp/voxtral.wav

Expected file output:

RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 24000 Hz

Pipe Composition

Transcribe speech, then send the transcript to an LLM:

uv run mlx-pipe stt /tmp/asr.wav \
  --model RayyTien/Breeze-ASR-26-mlx-4bit \
| uv run mlx-pipe llm "translate to Chinese" \
  --model mlx-community/gemma-3-1b-it-4bit

Generate text, then synthesize it:

uv run mlx-pipe llm "explain MLX in one sentence" \
  --model mlx-community/gemma-3-1b-it-4bit \
| uv run mlx-pipe tts \
  --model mlx-community/Voxtral-4B-TTS-2603-mlx-4bit \
  --voice casual_male \
  --out /tmp/mlx.wav

When stdin is piped into llm, the positional prompt is treated as the instruction:

{instruction}:

{stdin text}

Logprobs

Use --json --logprobs to include generated token metadata. Use --top-logprobs N to include the top N alternatives for each generated token.

uv run mlx-pipe llm "Say hello" \
  --model mlx-community/gemma-3-1b-it-4bit \
  --json \
  --logprobs \
  --top-logprobs 5 \
  --max-tokens 8

Output shape:

{
  "text": "Hello there! How can I help you",
  "meta": {"model": "mlx-community/gemma-3-1b-it-4bit"},
  "tokens": [
    {
      "token": 9259,
      "text": "Hello",
      "logprob": 0.0,
      "top_logprobs": [
        {"token": 9259, "text": "Hello", "logprob": 0.0}
      ]
    }
  ]
}

Config

Model resolution priority is:

  1. explicit --model
  2. user config
  3. built-in defaults

Set defaults:

uv run mlx-pipe config set llm.default mlx-community/gemma-3-1b-it-4bit
uv run mlx-pipe config set stt.default RayyTien/Breeze-ASR-26-mlx-4bit
uv run mlx-pipe config set tts.default mlx-community/Voxtral-4B-TTS-2603-mlx-4bit

Read config:

uv run mlx-pipe config get llm.default
uv run mlx-pipe config list

By default config is stored at:

~/.config/mlx-pipe/config.json

For tests or isolated runs, override it:

MLX_PIPE_CONFIG_HOME=$(mktemp -d) uv run mlx-pipe config list

Model Management

Download a model:

uv run mlx-pipe pull mlx-community/gemma-3-1b-it-4bit

List cached Hugging Face models:

uv run mlx-pipe list

Remove cached models:

uv run mlx-pipe remove mlx-community/gemma-3-1b-it-4bit

Suggested Models

LLM:

mlx-community/gemma-3-1b-it-4bit

ASR:

RayyTien/Breeze-ASR-26-mlx-4bit

Breeze-ASR-26 is intended for Taiwanese Hokkien / Taigi audio with Mandarin Chinese character output. For English test audio, use an English Whisper model instead.

TTS:

mlx-community/Voxtral-4B-TTS-2603-mlx-4bit

Voxtral requires tiktoken, which is included in this package's dependencies.

Development

Run the local checks:

uv sync
uv run pytest
uv run ruff check .
uv run python -m build
uv run twine check dist/*

Run CLI smoke checks without downloading models:

uv run mlx-pipe --help
uv run mlx-pipe llm --help
uv run mlx-pipe stt --help
uv run mlx-pipe tts --help

Run a config smoke check:

tmpdir=$(mktemp -d)
MLX_PIPE_CONFIG_HOME=$tmpdir uv run mlx-pipe config set llm.default local-llm
MLX_PIPE_CONFIG_HOME=$tmpdir uv run mlx-pipe config get llm.default
MLX_PIPE_CONFIG_HOME=$tmpdir uv run mlx-pipe config list

CI

The GitHub Actions workflow runs on a macOS arm64 hosted runner because MLX is Apple Silicon oriented. It verifies:

  • locked dependency resolution
  • unit tests
  • ruff lint
  • CLI help/config smoke checks

Full model e2e tests are intentionally manual for now because they download large models and can make routine CI slow and expensive.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mlx_pipe-0.1.0a1.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mlx_pipe-0.1.0a1-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file mlx_pipe-0.1.0a1.tar.gz.

File metadata

  • Download URL: mlx_pipe-0.1.0a1.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mlx_pipe-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 79c0a85f15c991757855a4f558dfef36afe3b9e48327a752dd781812eead939f
MD5 8607b98130435e76a85fc2522cf712d4
BLAKE2b-256 df77e43dc8f09e6bead67c4c83c5e1cc2b719a1da5e7360066804d95eeae6146

See more details on using hashes here.

Provenance

The following attestation bundles were made for mlx_pipe-0.1.0a1.tar.gz:

Publisher: publish.yml on Ray0907/mlx-pipe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mlx_pipe-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: mlx_pipe-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mlx_pipe-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 a9d2d20ecc51c2637ec47e9a7f8338bf146fdb1526fc42af70d31a4d92b48be2
MD5 c9fd61568ccc4ab46489bb2b00758c7f
BLAKE2b-256 57fc456b7f14e2f94467e28ff18c81465bf05a8b54722ac79de5d5b1ed4335f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for mlx_pipe-0.1.0a1-py3-none-any.whl:

Publisher: publish.yml on Ray0907/mlx-pipe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page