freshcrate
Skin:/
Home > MCP Servers > vllm-mlx

vllm-mlx

OpenAI and Anthropic compatible server for Apple Silicon. Run LLMs and vision-language models (Llama, Qwen-VL, LLaVA) with continuous batching, MCP tool calling, and multimodal support. Native MLX bac

Why this rank:Strong adoptionRecent releaseHealthy release cadence

Description

OpenAI and Anthropic compatible server for Apple Silicon. Run LLMs and vision-language models (Llama, Qwen-VL, LLaVA) with continuous batching, MCP tool calling, and multimodal support. Native MLX backend, 400+ tok/s. Works with Claude Code.

README

vLLM-MLX

vLLM-like inference for Apple Silicon - GPU-accelerated Text, Image, Video & Audio on Mac

License Python 3.10+ Apple Silicon GitHub

Overview

vllm-mlx brings native Apple Silicon GPU acceleration to vLLM by integrating:

  • MLX: Apple's ML framework with unified memory and Metal kernels
  • mlx-lm: Optimized LLM inference with KV cache and quantization
  • mlx-vlm: Vision-language models for multimodal inference
  • mlx-audio: Speech-to-Text and Text-to-Speech with native voices
  • mlx-embeddings: Text embeddings for semantic search and RAG

Features

  • Multimodal - Text, Image, Video & Audio in one platform
  • Native GPU acceleration on Apple Silicon (M1, M2, M3, M4)
  • Native TTS voices - Spanish, French, Chinese, Japanese + 5 more languages
  • OpenAI API compatible - drop-in replacement for OpenAI client
  • Anthropic Messages API - native /v1/messages endpoint for Claude Code and OpenCode
  • Embeddings - OpenAI-compatible /v1/embeddings endpoint with mlx-embeddings
  • Reasoning Models - extract thinking process from Qwen3, DeepSeek-R1
  • MCP Tool Calling - integrate external tools via Model Context Protocol
  • Paged KV Cache - memory-efficient caching with prefix sharing
  • Continuous Batching - high throughput for multiple concurrent users

Quick Start

Installation

Using uv (recommended):

# Install as CLI tool (system-wide)
uv tool install git+https://github.com/waybarrios/vllm-mlx.git

# Or install in a project/virtual environment
uv pip install git+https://github.com/waybarrios/vllm-mlx.git

Using pip:

# Install from GitHub
pip install git+https://github.com/waybarrios/vllm-mlx.git

# Or clone and install in development mode
git clone https://github.com/waybarrios/vllm-mlx.git
cd vllm-mlx
pip install -e .

Start Server

# Simple mode (single user, max throughput)
vllm-mlx serve mlx-community/Llama-3.2-3B-Instruct-4bit --port 8000

# Continuous batching (multiple users)
vllm-mlx serve mlx-community/Llama-3.2-3B-Instruct-4bit --port 8000 --continuous-batching

# With API key authentication
vllm-mlx serve mlx-community/Llama-3.2-3B-Instruct-4bit --port 8000 --api-key your-secret-key

Use with OpenAI SDK

from openai import OpenAI

# Without API key (local development)
client = OpenAI(base_url="http://localhost:8000/v1", api_key="not-needed")

# With API key (production)
client = OpenAI(base_url="http://localhost:8000/v1", api_key="your-secret-key")

response = client.chat.completions.create(
    model="default",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)

Use with Anthropic SDK

vllm-mlx exposes an Anthropic-compatible /v1/messages endpoint, so tools like Claude Code and OpenCode can connect directly.

from anthropic import Anthropic

client = Anthropic(base_url="http://localhost:8000", api_key="not-needed")

response = client.messages.create(
    model="default",
    max_tokens=256,
    messages=[{"role": "user", "content": "Hello!"}]
)
print(response.content[0].text)

To use with Claude Code:

export ANTHROPIC_BASE_URL=http://localhost:8000
export ANTHROPIC_API_KEY=not-needed
claude

See Anthropic Messages API docs for streaming, tool calling, system messages, and token counting.

Multimodal (Images & Video)

vllm-mlx serve mlx-community/Qwen3-VL-4B-Instruct-3bit --port 8000
response = client.chat.completions.create(
    model="default",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "What's in this image?"},
            {"type": "image_url", "image_url": {"url": "https://example.com/image.jpg"}}
        ]
    }]
)

Audio (TTS/STT)

# Install audio dependencies
pip install vllm-mlx[audio]
python -m spacy download en_core_web_sm
brew install espeak-ng  # macOS, for non-English languages
# Text-to-Speech (English)
python examples/tts_example.py "Hello, how are you?" --play

# Text-to-Speech (Spanish)
python examples/tts_multilingual.py "Hola mundo" --lang es --play

# List available models and languages
python examples/tts_multilingual.py --list-models
python examples/tts_multilingual.py --list-languages

Supported TTS Models:

Model Languages Description
Kokoro EN, ES, FR, JA, ZH, IT, PT, HI Fast, 82M params, 11 voices
Chatterbox 15+ languages Expressive, voice cloning
VibeVoice EN Realtime, low latency
VoxCPM ZH, EN High quality Chinese/English

Reasoning Models

Extract the thinking process from reasoning models like Qwen3 and DeepSeek-R1:

# Start server with reasoning parser
vllm-mlx serve mlx-community/Qwen3-8B-4bit --reasoning-parser qwen3
response = client.chat.completions.create(
    model="default",
    messages=[{"role": "user", "content": "What is 17 × 23?"}]
)

# Access reasoning separately from the answer
print("Thinking:", response.choices[0].message.reasoning)
print("Answer:", response.choices[0].message.content)

Supported Parsers:

Parser Models Description
qwen3 Qwen3 series Requires both <think> and </think> tags
deepseek_r1 DeepSeek-R1 Handles implicit <think> tag

Embeddings

Generate text embeddings for semantic search, RAG, and similarity:

# Start server with an embedding model pre-loaded
vllm-mlx serve mlx-community/Llama-3.2-3B-Instruct-4bit --embedding-model mlx-community/all-MiniLM-L6-v2-4bit
# Generate embeddings using the OpenAI SDK
embeddings = client.embeddings.create(
    model="mlx-community/all-MiniLM-L6-v2-4bit",
    input=["Hello world", "How are you?"]
)
print(f"Dimensions: {len(embeddings.data[0].embedding)}")

See Embeddings Guide for details on supported models and lazy loading.

Documentation

For full documentation, see the docs directory:

Architecture

┌─────────────────────────────────────────────────────────────────────────┐
│                           vLLM API Layer                                │
│                    (OpenAI-compatible interface)                         │
└─────────────────────────────────────────────────────────────────────────┘
                                   │
                                   ▼
┌─────────────────────────────────────────────────────────────────────────┐
│                            MLXPlatform                                  │
│               (vLLM platform plugin for Apple Silicon)                  │
└─────────────────────────────────────────────────────────────────────────┘
                                   │
        ┌─────────────┬────────────┴────────────┬─────────────┐
        ▼             ▼                         ▼             ▼
┌───────────────┐ ┌───────────────┐ ┌───────────────┐ ┌───────────────┐
│    mlx-lm     │ │   mlx-vlm     │ │   mlx-audio   │ │mlx-embeddings │
│(LLM inference)│ │ (Vision+LLM)  │ │  (TTS + STT)  │ │ (Embeddings)  │
└───────────────┘ └───────────────┘ └───────────────┘ └───────────────┘
        │             │                         │             │
        └─────────────┴─────────────────────────┴─────────────┘
                                   │
                                   ▼
┌─────────────────────────────────────────────────────────────────────────┐
│                              MLX                                        │
│                (Apple ML Framework - Metal kernels)                      │
└─────────────────────────────────────────────────────────────────────────┘

Performance

LLM Performance (M4 Max, 128GB):

Model Speed Memory
Qwen3-0.6B-8bit 402 tok/s 0.7 GB
Llama-3.2-1B-4bit 464 tok/s 0.7 GB
Llama-3.2-3B-4bit 200 tok/s 1.8 GB

Continuous Batching (5 concurrent requests):

Model Single Batched Speedup
Qwen3-0.6B-8bit 328 tok/s 1112 tok/s 3.4x
Llama-3.2-1B-4bit 299 tok/s 613 tok/s 2.0x

Audio - Speech-to-Text (M4 Max, 128GB):

Model RTF* Use Case
whisper-tiny 197x Real-time, low latency
whisper-large-v3-turbo 55x Best quality/speed balance
whisper-large-v3 24x Highest accuracy

*RTF = Real-Time Factor. RTF of 100x means 1 minute transcribes in ~0.6 seconds.

See benchmarks for detailed results.

Gemma 3 Support

vllm-mlx includes native support for Gemma 3 vision models. Gemma 3 is automatically detected as MLLM.

Usage

# Start server with Gemma 3
vllm-mlx serve mlx-community/gemma-3-27b-it-4bit --port 8000

# Verify it loaded as MLLM (not LLM)
curl http://localhost:8000/health
# Should show: "model_type": "mllm"

Long Context Patch (mlx-vlm)

Gemma 3's default sliding_window=1024 limits context to ~10K tokens on Apple Silicon (Metal GPU timeout at higher context). To enable longer context (up to ~50K tokens), patch mlx-vlm:

Location: ~/.../site-packages/mlx_vlm/models/gemma3/language.py

Find the make_cache method and replace with:

def make_cache(self):
    import os
    # Set GEMMA3_SLIDING_WINDOW=8192 for ~40K context
    # Set GEMMA3_SLIDING_WINDOW=0 for ~50K context (full KVCache)
    sliding_window = int(os.environ.get('GEMMA3_SLIDING_WINDOW', self.config.sliding_window))

    caches = []
    for i in range(self.config.num_hidden_layers):
        if (
            i % self.config.sliding_window_pattern
            == self.config.sliding_window_pattern - 1
        ):
            caches.append(KVCache())
        elif sliding_window == 0:
            caches.append(KVCache())  # Full context for all layers
        else:
            caches.append(RotatingKVCache(max_size=sliding_window, keep=0))
    return caches

Usage:

# Default (~10K max context)
vllm-mlx serve mlx-community/gemma-3-27b-it-4bit --port 8000

# Extended context (~40K max)
GEMMA3_SLIDING_WINDOW=8192 vllm-mlx serve mlx-community/gemma-3-27b-it-4bit --port 8000

# Maximum context (~50K max)
GEMMA3_SLIDING_WINDOW=0 vllm-mlx serve mlx-community/gemma-3-27b-it-4bit --port 8000

Benchmark Results (M4 Max 128GB):

Setting Max Context Memory
Default (1024) ~10K tokens ~16GB
GEMMA3_SLIDING_WINDOW=8192 ~40K tokens ~25GB
GEMMA3_SLIDING_WINDOW=0 ~50K tokens ~35GB

Contributing

We welcome contributions! See Contributing Guide for details.

  • Bug fixes and improvements
  • Performance optimizations
  • Documentation improvements
  • Benchmarks on different Apple Silicon chips

Submit PRs to: https://github.com/waybarrios/vllm-mlx

License

Apache 2.0 - see LICENSE for details.

Citation

If you use vLLM-MLX in your research or project, please cite:

@software{vllm_mlx2025,
  author = {Barrios, Wayner},
  title = {vLLM-MLX: Apple Silicon MLX Backend for vLLM},
  year = {2025},
  url = {https://github.com/waybarrios/vllm-mlx},
  note = {Native GPU-accelerated LLM and vision-language model inference on Apple Silicon}
}

Acknowledgments

Release History

VersionChangesUrgencyDate
v0.6.0vllm-mlx 0.6.0 adds media-aware SpecPrefill, broader assistant-drafter loading, and more reliable multimodal requests, tool calls, caching, and model cleanup for Apple Silicon. ## Highlights - **Media-aware SpecPrefill:** use sparse prefill with supported VLMs on batched media routes. Assistant drafters now load through architecture-aware loaders, with safer registered MTP drafter resolution and validation. - **More reliable multimodal APIs:** preserve Anthropic image blocks, reject invalid muHigh10/20/2026
v0.5.0vllm-mlx 0.5.0 adds reusable conversation caching, broader model and parser support, and more reliable streaming and resource management for Apple Silicon. ## Highlights - **SimpleEngine prefix-trie caching:** reuse growing conversation prefixes with configurable entry and memory limits. This release also fixes a completion race so a normally finished stream stores its cache entry reliably. - **DeepSeek-V4-Flash support:** native prompt encoding, reasoning extraction, and DSML tool calls, inclHigh9/17/2026
v0.4.1vllm-mlx 0.4.1 collects the latest scheduler, streaming, MTP, parser, memory, and model compatibility improvements merged since 0.4.0. ## Highlights - Preserve active streams and correct finish reasons across SimpleEngine streaming paths. - Support native mlx-lm chunked prefill while keeping MLLM media generation on its owner thread. - Improve MTP compatibility for Qwen models, sampled concurrent MLLM decoding, and native status counters. - Add request-local Poolside v1 parsing and complete GPHigh8/12/2026
v0.4.0vllm-mlx 0.4.0 finalizes the 0.4.0 line (promoting `0.4.0rc1`). It brings harmony/GPT-OSS prompt rendering, omni audio-from-video fusion, a tiered SSD KV cache that now covers multimodal models, configurable Metal memory, and a long list of tool-calling, reasoning, and MLLM correctness fixes. ## Highlights - **GPT-OSS / harmony prompt rendering** through the official `openai-harmony` renderer, so prior assistant `tool_calls` survive multi-turn agentic conversations instead of being flattened tHigh6/28/2026
v0.3.0## Highlights - **Registry-backed multi-model serving** — register and qualify multiple models, swap them per request, with `--no-mllm` opt-out and lifecycle-managed residency for the default model. - **Gemma 4 audio** — chat completions now accept Gemma 4 audio inputs through the unified pipeline. - **MLLM chunked prefill** — non-blocking interleaved prefill/decode for multimodal requests, plus async preprocessing that no longer blocks the event loop. - **`--max-kv-size` CLI flag** — per-sequeHigh5/9/2026
v0.2.9## v0.2.9 ### Security Large wave of server hardening landed in this release. If you expose the server, upgrade. - MCP sandbox enforced on execute endpoint (#329) - MCP high-risk tools blocked by default (#343) - MCP interpreter inline execution flags blocked (#331) - MCP newline and path traversal validation (#333) - MCP config security bypass removed (#326, #345) - Reject arbitrary endpoint model loads (#330) - `trust_remote_code` now requires explicit opt-in (#328) - Block local path traveHigh4/22/2026
v0.2.8## Compatibility & Bug Fixes - mlx-lm 0.31.x BatchGenerator API compatibility (#294, closes #293) - Gemma 4 BatchKVCache, attention and RotatingKVCache patches (#268, #256) - Qwen3.5 ArraysCache hybrid model batching (#160) - mlx-lm 0.31.x prompt_checkpoints tuple compatibility - RotatingKVCache support in MLLM batching - Streaming UTF-8 safe detokenizer (#109) - Platform module rename to avoid stdlib shadowing (#185) - Base64 image hash no longer truncated (#206) - Specprefill: avoid dense tailHigh4/12/2026
v0.2.7## What's New ### Features - **SpecPrefill**: attention-based sparse prefill for TTFT reduction (#180) - **Native video support**: Qwen3-VL video pipeline with temporal 3D conv + M-RoPE (#150) - **MTP speculative decoding** for Qwen3-Next (#82) - **Qwen3.5 model support** with text-only loading and dynamic memory threshold (#127) - **GPT-OSS reasoning parser** for channel-based token format (#53) - **KV cache quantization** for prefix cache memory reduction (#62) - **`--served-model-name` CLI pMedium3/31/2026
v0.2.6This is a major feature release with tool calling, embeddings, reasoning support, Anthropic Messages API, and numerous fixes. ## New Features ### Tool Calling Support Full tool calling / function calling with 12 parsers covering major model families: Mistral, DeepSeek, Granite, Nemotron, GLM-4.7, Harmony (GPT-OSS), and more. Includes native format support and streaming tool call parsing for Qwen3-Coder. (#28, #31, #42, #50, #55, #64) ### Embeddings API OpenAI-compatible `/v1/embeddings` endpoLow2/13/2026
v0.2.5This release brings significant performance improvements for multimodal models through prefix caching and continuous batching support. ## What's New ### Prefix Cache for Multimodal Models When you send the same image multiple times (like in a multi-turn conversation), the vision encoder normally has to process it again each time. Now, vllm-mlx caches the vision embeddings and KV states, so subsequent requests with the same image skip the encoder entirely. **Real-world impact:** On a Qwen3-VLLow1/26/2026
v0.2.4## What's New ### Dependency conflict resolved Fixed pip installation error when mlx-audio conflicted with mlx-lm version requirements. **Changes:** - mlx-audio moved to optional dependencies (install with `pip install vllm-mlx[audio]`) - Removed transformers<5.0.0 constraint for mlx-lm 0.30.2+ compatibility ### Install ```bash pip install vllm-mlx==0.2.4 # With audio support pip install vllm-mlx[audio]==0.2.4 ``` Fixes #19Low1/23/2026
v0.2.3## What's New ### Stability improvements for continuous batching This release fixes two issues reported in #16 when running with `--continuous-batching`: **Metal crash fix** - Added proper synchronization for MLX operations. Previously, concurrent requests could cause Metal command buffer conflicts resulting in crashes. Now requests are serialized internally to prevent this. **Memory management** - The prefix cache now tracks actual memory usage instead of just counting entries. For large moLow1/22/2026
v0.2.1## What's New ### Security - Timing attack prevention with `secrets.compare_digest()` for API key verification - Rate limiting support with sliding window algorithm (`--rate-limit` flag) - Request timeout to prevent resource exhaustion (`--timeout` flag) ### Reliability - TempFileManager for automatic cleanup of temporary files (images/videos) - Thread-safe `_waiting_consumers` counter in RequestOutputCollector - Fixed asyncio timeout by running model calls in thread pool ### API Changes - NeLow1/16/2026
v0.2.0## 🚀 What's New vLLM-MLX now supports **Text, Image, Video & Audio** - all GPU-accelerated on Apple Silicon. ### 🎙️ Audio Support (NEW) - **STT (Speech-to-Text)**: Whisper, Parakeet - **TTS (Text-to-Speech)**: Kokoro with native multilingual voices - **Native voices**: English, Spanish, French, Chinese, Japanese, Italian, Portuguese, Hindi - **Bug fix included** for mlx-audio 0.2.9 multilingual support ### 📦 Modular Architecture | Modality | Library | Install | |----------|--Low1/6/2026
v0.1.0## 🚀 Initial Release vLLM-MLX brings **vLLM-like inference to Apple Silicon** with native GPU acceleration. ### ✨ Features - **Text (LLM)** - Fast inference with mlx-lm - **Image Understanding** - Vision-language models with mlx-vlm - **Video Understanding** - Multi-frame video analysis - **Continuous Batching** - High throughput for multiple concurrent users - **Paged KV Cache** - Memory-efficient caching with prefix sharing - **MCP Tool Calling** - Integrate external tools via Model ContexLow1/6/2026

Dependencies & License Audit

Loading dependencies...

Similar Packages

agentroveYour own Claude Code UI, sandbox, in-browser VS Code, terminal, multi-provider support (Anthropic, OpenAI, GitHub Copilot, OpenRouter), custom skills, and MCP servers.v0.1.64
coderunnerA local sandbox for your AI agentsmain@2026-10-10
litellmPython SDK, Proxy Server (AI Gateway) to call 100+ LLM APIs in OpenAI (or native) format, with cost tracking, guardrails, loadbalancing and logging. [Bedrock, Azure, OpenAI, VertexAI, Cohere, Anthropiv1.106.4
langfuse-mcpA Model Context Protocol (MCP) server for Langfuse, enabling AI agents to query Langfuse trace data for enhanced debugging and observabilityv0.14.0
ouroborosStop prompting. Start specifying.v0.59.9

More in MCP Servers

litellmPython SDK, Proxy Server (AI Gateway) to call 100+ LLM APIs in OpenAI (or native) format, with cost tracking, guardrails, loadbalancing and logging. [Bedrock, Azure, OpenAI, VertexAI, Cohere, Anthropi
ruflo🌊 The leading agent orchestration platform for Claude. Deploy intelligent multi-agent swarms, coordinate autonomous workflows, and build conversational AI systems. Features enterprise-grade archit
@claude-flow/cliRuflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code
claude-plugins-officialOfficial, Anthropic-managed directory of high quality Claude Code Plugins.