Skip to main content

llm-rapid-mlx

A plugin for LLM to use models served by Rapid-MLX, a local inference server for Apple Silicon built on MLX. The plugin is a Python HTTP client; only the server requires Apple Silicon.

Installation

Requires Python 3.11+ and LLM 0.37.2. From this checkout:

llm install -e .

Or install the locally built wheel with llm install dist/llm_rapid_mlx-0.1.0-py3-none-any.whl. This package has not yet been published to PyPI.

Install and start Rapid-MLX separately (the server requires Python 3.12+ if installed through pip):

brew install rapid-mlx
rapid-mlx serve qwen3.5-4b-4bit --port 8000

The plugin neither starts servers nor downloads model weights.

Usage

llm rapid-mlx models
llm models -q rapid-mlx
llm -m rapid-mlx/mlx-community/Qwen3.5-4B-MLX-4bit 'say hi'
llm -m rapid-mlx/mlx-community/Qwen3.5-4B-MLX-4bit -s 'Answer briefly' 'Remember the word pelican'
llm -c 'What word did I ask you to remember?'

Use the IDs shown by discovery. They are always rapid-mlx/<server-id>; the prefix is removed before sending the request. Streaming is on by default; --no-stream uses a non-streaming request. Standard LLM conversation logging, llm chat, options such as -o temperature 0.5 and -o max_tokens 128, and Python sync/async models work through LLM's OpenAI adapter.

llm -m rapid-mlx/qwen3.5-4b-4bit --functions 'def add(a: int, b: int) -> int: return a + b' 'Use add to calculate 17 + 25'
llm -m rapid-mlx/qwen3.5-4b-4bit --schema '{"type":"object","properties":{"greeting":{"type":"string"}},"required":["greeting"]}' 'Say hello in JSON'

Function tools are enabled when discovery advertises tools. JSON schemas are passed through using OpenAI's response_format; successful generation and schema enforcement depend on the model and server. Vision models advertising vision accept PNG, JPEG, WebP and GIF attachments through -a image.png. Audio, video and PDF attachments are outside this plugin's scope.

Configuration

The default endpoint is http://localhost:8000/v1.

export RAPID_MLX_BASE_URL=http://127.0.0.1:8477/v1
# Persistent alternative (stores a URL, not a secret):
llm keys set rapid-mlx-base-url --value http://127.0.0.1:8477/v1

Endpoint precedence: -o base_url URL for an individual chat request, then RAPID_MLX_BASE_URL, then the rapid-mlx-base-url entry in LLM's key store, then the default. Discovery and embedding requests use the configured endpoint; a chat option alone cannot discover models on a different server. Set the environment variable or persistent URL before listing/selecting those models. A URL without /v1 is normalized to include it, including reverse proxy paths.

Authentication is optional. For an authenticated server:

llm keys set rapid-mlx
# Or: export RAPID_MLX_API_KEY=your-secret
llm -m rapid-mlx/qwen3.5-4b-4bit --key your-key 'Hello'

Keys follow LLM precedence: Python model.key, explicit --key (literal or key alias), stored rapid-mlx key, then RAPID_MLX_API_KEY. Discovery uses the stored key/environment variable, since model discovery runs before a prompt's --key. Without a key the client sends the harmless placeholder not-needed, accepted by Rapid-MLX's default unauthenticated mode. OPENAI_API_KEY is never used.

Discovery and embeddings

Each registration reads GET /v1/models with a two-second timeout and no retries. There is no persistent catalogue cache. Restart an interactive LLM session after changing the server's model catalogue. Offline, unauthenticated or malformed catalogues register no Rapid-MLX models, leaving other plugins usable. llm rapid-mlx models reports discovery failures explicitly.

Models tagged embedding are registered only as embedding models. Names are never used to guess embedding support. Entries with text are chat models; older entries without capabilities are treated as text-only. Other modalities are excluded from chat registration.

If the server advertises an embedding model:

llm embed-models
llm embed -m rapid-mlx/your-discovered-embedding-model -c 'A coastal bird'

Embeddings use /v1/embeddings, text input and batches of up to 32. No embedding model is registered when the server only serves chat. Embedding vectors are returned in input order, with indexes and finite numeric values checked.

Development

python3.12 -m venv .venv
.venv/bin/python -m pip install llm '.[test]' build twine
.venv/bin/llm install -e .
.venv/bin/python -m pytest -q
.venv/bin/python -m build
.venv/bin/python -m twine check dist/*

Offline tests use a mocked HTTP server and exercise the real LLM/OpenAI adapters. Opt in to a small live smoke test against an existing server:

RAPID_MLX_LIVE_URL=http://127.0.0.1:8477/v1 .venv/bin/python -m pytest -m live -q

The optional test does not start or stop a server. Do not set that variable for offline tests. The dependency on LLM's bundled OpenAI adapter is constrained to 0.37.x because that adapter is not a separately versioned public API.

License

MIT. See LICENSE.

Metadata

Release files for llm-rapid-mlx 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llm-rapid-mlx 0.1.0
File Size Uploaded Provenance Actions
llm_rapid_mlx-0.1.0.tar.gz 10.6 kB With provenance Details for llm_rapid_mlx-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llm-rapid-mlx 0.1.0
File Interpreter ABI Platform Actions
llm_rapid_mlx-0.1.0-py3-none-any.whl Python 3 none any Details for llm_rapid_mlx-0.1.0-py3-none-any.whl

Total release size: 18.3 kB

Release files / llm_rapid_mlx-0.1.0.tar.gz

Download URL llm_rapid_mlx-0.1.0.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b9d3cfacb8104ea97a4755057707113cc94f1195737c90bb6f4cfec906576c76
BLAKE2b-256 checksum
How to use checksums
14d334156895849bf000d184fbf3f3078b6a511422200e925d0a3fb598615734
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / llm_rapid_mlx-0.1.0-py3-none-any.whl

Download URL llm_rapid_mlx-0.1.0-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03b6afe3a32a663d12e511bde1e479ce872837ac382e19be410820d74bb45d42
BLAKE2b-256 checksum
How to use checksums
18a7fb216b05b7e60cad38199e02ab32f0edd65eb60a16c8556f24fee44ce98f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Security for llm-rapid-mlx 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for llm_rapid_mlx-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page