omlx README

项目的 README,来自 github.com/jundot/omlx。合并为一个 markdown 文件:README.md。

oMLX

oMLX

LLM inference, optimized for your Mac
Continuous batching and tiered KV caching, managed directly from your menu bar.

License Python 3.11-3.13 Apple Silicon

[email protected] · https://omlx.ai/me

Install · Quickstart · Features · Models · CLI Configuration · Benchmarks · oMLX.ai

English · 中文 · 한국어 · 日本語 · Italiano


oMLX Admin Dashboard

Every LLM server I tried made me choose between convenience and control. I wanted to pin everyday models in memory, auto-swap heavier ones on demand, set context limits - and manage it all from a menu bar.

oMLX persists KV cache across a hot in-memory tier and cold SSD tier - even when context changes mid-conversation, all past context stays cached and reusable across requests, making local LLMs practical for real coding work with tools like Claude Code. That's why I built it.

Install

macOS App

Download the .dmg from Releases, drag to Applications, done. The app includes in-app auto-update, so future upgrades are just one click. The macOS app also installs a lightweight ~/.omlx/bin/omlx CLI shim so terminal commands and Apple Shortcuts can control the app-managed server.

Homebrew

brew tap jundot/omlx https://github.com/jundot/omlx
brew install jundot/omlx/omlx --with-custom-kernel   # With native custom kernels (needs full Xcode)
# No full Xcode? brew install jundot/omlx/omlx installs without the kernels

# Upgrade to the latest version
brew update && brew upgrade omlx

# Run as a background service (auto-restarts on crash)
omlx start

# Optional: MCP (Model Context Protocol) support, then restart to load it
/opt/homebrew/opt/omlx/libexec/bin/pip install mcp
omlx restart

From Source

git clone https://github.com/jundot/omlx.git
cd omlx
make install                # Editable install with the web UI and native custom kernels
# No full Xcode? make install-no-kernels installs without the kernels
make mcp                    # Optional: MCP support, restart `omlx serve` to load it

Requires macOS 15.0+ (Sequoia), Python 3.11–3.13, and Apple Silicon (M1/M2/M3/M4/M5).

Note on native custom kernels: GLM-5.2, MiniMax M3, and Qwen3.5 need them. Without them those families silently fall back to much slower generic paths -- for GLM-5.2 the fused DSA prefill is roughly 30x faster with the kernels (measured 845 vs ~29 tok/s on an M3 Ultra), and the fallback also uses more memory (#2137). make install builds them and checks that each one loads. That needs full Xcode with the Metal toolchain (xcodebuild -downloadComponent MetalToolchain); Command Line Tools alone do not provide it (xcrun: error: unable to find utility "metal"). Without Xcode, use the official DMG, which ships the kernels precompiled, or make install-no-kernels. A plain pip install -e . also skips them. make kernels rebuilds only the kernels from scratch. Homebrew builds them with --with-custom-kernel, which also needs full Xcode. To verify any install:

python -c "from omlx.custom_kernels import native_kernel_status; print(native_kernel_status())"

Quickstart

macOS App

Launch oMLX from your Applications folder. The Welcome screen guides you through three steps - model directory, server start, and first model download. That's it. To connect OpenClaw, OpenCode, Codex, Hermes Agent, Copilot, or DeepSeek Harness, see Integrations.

oMLX Welcome Screen oMLX Menubar

CLI

# Managed background server (macOS app or Homebrew install)
omlx start
omlx stop
omlx restart

# Foreground server attached to this terminal
omlx serve --model-dir ~/models

The server discovers LLMs, VLMs, embedding models, and rerankers from subdirectories automatically. Any OpenAI-compatible client can connect to http://localhost:8000/v1. A built-in chat UI is also available at http://localhost:8000/admin/chat.

Homebrew Service

If you installed via Homebrew, you can run oMLX as a managed background service:

omlx start                    # Start via brew services
omlx stop                     # Stop
omlx restart                  # Restart

brew services start omlx    # Start (auto-restarts on crash)
brew services stop omlx     # Stop
brew services restart omlx  # Restart
brew services info omlx     # Check status

The service runs omlx serve with zero-config defaults (~/.omlx/models, port 8000). omlx start, omlx stop, and omlx restart are the portable lifecycle commands; Homebrew installs delegate them to brew services. To customize, run omlx serve --model-dir /your/path once to persist settings to ~/.omlx/settings.json.

Logs are written to two locations:

Features

Supports text LLMs, vision-language models (VLM), OCR models, embeddings, and rerankers on Apple Silicon.

Admin Dashboard

Web UI at /admin for real-time monitoring, model management, chat, benchmark, and per-model settings. Supports English, Korean, Japanese, Chinese, French, Russian, Spanish, and Brazilian Portuguese. All CDN dependencies are vendored for fully offline operation.

oMLX Admin Dashboard

Experimental Multi-Mac Inference

Source builds can split one downloaded language model across unequal-memory Macs using MLX pipeline ranks over Ring or Thunderbolt RDMA/JACCL. The Cluster dashboard handles read-only peer discovery, strict SSH/runtime verification, byte-aware unequal shard planning, measured compute/link rebalancing, headroom-aware execution tuning, activation, and a live shard/performance map on both Macs. Interactive, balanced, and throughput profiles expose coalesced batching, prompt-cache affinity, rotating-KV limits, Ring connection tuning, and a capability-gated experimental token-only output path. See Distributed inference across Macs for setup, security boundaries, current limitations, and the physical-hardware validation checklist.

A paired Mac can also speed up prefill without splitting the model: the Prefill Accelerator runs the first layers of long prompts on the other Mac while the model, its cache and decoding stay on this one (DeepSeek V4.1, GLM-5.3, Qwen3.8 Flash-Next, Qwen3.8 27B, MiniMax M3 and Inkling 2). The helper can also be a Linux machine with NVIDIA GPUs running omlx-cuda-helper.

Vision-Language Models

Run VLMs with the same continuous batching and tiered KV cache stack as text LLMs. Supports multi-image chat, base64/URL/file image inputs, and tool calling with vision context. MiMo V2.6 checkpoints with bundled sidecars also accept sampled-frame video and 24 kHz audio. Qwen3.5, Qwen3.6 and Qwen3.8 checkpoints (dense and MoE) accept native video input as base64 video_url / input_video data URIs; video needs OpenCV (opencv-python-headless). oQ conversion of official MiMo V2.6 checkpoints preserves image and audio support. OCR models (DeepSeek-OCR, DOTS-OCR, GLM-OCR) are auto-detected with optimized prompts.

Tiered KV Cache (Hot + Cold)

Block-based KV cache management inspired by vLLM, with prefix sharing and Copy-on-Write. The cache operates across two tiers:

Optional Affine4 and Affine8 KV compression add signed 4-bit and 8-bit cache formats with Metal TensorOps decode attention and a portable fallback. Select either under Model settings → Memory Saving → KV cache compression.

oMLX Hot & Cold Cache

Continuous Batching

Handles concurrent requests through mlx-lm's BatchGenerator. Max concurrent requests is configurable via CLI or admin panel.

Claude Code Optimization

Runs smaller context models with Claude Code by reporting the model's real context window to auto-compact instead of scaling token counts, and SSE keep-alive prevents read timeouts during long prefill.

Multi-Model Serving

Load LLMs, VLMs, embedding models, and rerankers within the same server. Models are managed through a combination of automatic and manual controls:

Per-Model Settings

Configure sampling parameters, chat template kwargs, TTL, model alias, model type override, and more per model directly from the admin panel. Changes apply immediately without server restart.

oMLX Chat Template Kwargs

Built-in Chat

Chat directly with any loaded model from the admin panel. Supports conversation history, model switching, dark mode, reasoning model output, and image upload for VLM/OCR models.

Document attachments support PDF, DOCX, PPTX, TXT, and MD. Attachments are accepted by filename extension. If the client reports a MIME type oMLX does not recognize, such as application/octet-stream, the converter MIME type is inferred from the extension.

oMLX Chat

Model Downloader

Search and download models from HuggingFace directly in the admin dashboard, in MLX, GGUF or all formats. Browse model cards, then pick the files to download: an MLX checkpoint keeps the files it needs, and a GGUF brings its vision projector.

oMLX Model Downloader

Integrations

Set up OpenClaw, OpenCode, Codex, Hermes Agent, Copilot, Pi, Mistral Vibe, and DeepSeek Harness directly from the admin dashboard with a single click. No manual config editing required.

oMLX Integrations

omlx launch codex and omlx launch codex_app give Codex a catalog of every chat model on the server, so you switch models with /model or the app's model picker. --model, the saved Codex model, or the server default picks the starting model. This needs Codex 0.148 or newer; relaunch after you add or remove models.

omlx launch copilot gives Copilot CLI a catalog of every chat model on the server, so you switch models with /model. --model, the saved Copilot model, or the server default picks the starting model. The catalog goes into Copilot's providers.json next to your other providers, and the file is kept at 0600 because it holds the server's API key. This needs Copilot CLI 1.0.83 or newer; relaunch after you add or remove models.

Install Mistral Vibe 2.26.0 or newer with uv tool install mistral-vibe, then run omlx launch vibe to select a local model, or omlx launch vibe --model <model-id>. Vibe's provider, model, API-key reference and context window are configured for that process through its VIBE_* environment overrides. Existing config.toml, VIBE_HOME, tool permissions and cloud configuration are preserved. Pass Vibe arguments after --, for example omlx launch vibe --model <model-id> -- --resume.

Performance Benchmark

One-click benchmarking from the admin panel. Measures prefill (PP) and text generation (TG) tokens per second, with partial prefix cache hit testing for realistic performance numbers.

oMLX Benchmark Tool

macOS Menubar App

Native Swift / SwiftUI menubar app (not Electron). Start, stop, and monitor the server without opening a terminal. Includes local usage history with per-model totals and an hourly heatmap, persistent serving stats (survives restarts), auto-restart on crash, and built-in auto-update.

oMLX Menubar Stats

API Compatibility

Drop-in replacement for OpenAI and Anthropic APIs. Supports streaming usage stats (stream_options.include_usage), llama.cpp-style prefill progress (return_progress), Anthropic adaptive thinking, and vision inputs (images as base64 or URL, video as base64).

Endpoint Description
POST /v1/chat/completions Chat completions (streaming)
POST /v1/completions Text completions (streaming)
POST /v1/messages Anthropic Messages API
POST /v1/embeddings Text embeddings
POST /v1/rerank Document reranking
POST /v1/systemone Typed decisions with decision models or chat models (TypeSafe System One)
GET /v1/models List available models
GET /v1/models/{model_id} Retrieve one model
POST /v1/audio/transcriptions Speech-to-text, including speaker labels when supported
POST /tokenize, POST /detokenize vLLM-compatible tokenizer API (also under /v1); embedding models take prompt only

The admin API for settings, models, downloads, quantization, and benchmarks takes the main API key as a Bearer token and also works in headless mode. See Admin API.

Transcription with speaker labels

Select an installed speech model that supports timed speaker attribution, such as VibeVoice-ASR or Nemotron 3.5 Transcribe. Send a multipart request with the model ID from GET /v1/models:

curl http://127.0.0.1:8000/v1/audio/transcriptions \
  -H "Authorization: Bearer $OMLX_API_KEY" \
  -F "[email protected]" \
  -F "model=$MODEL_ID" \
  -F "response_format=diarized_json" \
  -F "chunking_strategy=auto"

The response includes text, the audio duration, and one segment per speaker turn with speaker, start, end, and text. Speaker labels are local to the recording.

Streaming is not supported, and chunking_strategy must be auto or omitted; the whole file goes to the model. Models without timed speaker labels, including Nemotron checkpoints without the CTC alignment files, return HTTP 400.

Tool Calling & Structured Output

Supports all function calling formats available in mlx-lm, JSON schema validation, and MCP tool integration. Tool calling requires the model's chat template to support the tools parameter. The following model families are auto-detected:

Model Family Format
Llama, Qwen, DeepSeek, etc. JSON <tool_call>
Qwen3.5 Series, Raon-1 mini XML <function=...>
Gemma <start_function_call>
GLM (4.7, 5) <arg_key>/<arg_value> XML
MiniMax Namespaced <minimax:tool_call>
Mistral [TOOL_CALLS]
IFM K2 Horizon XML or JSON inside <ifm|tool_calls>. Requires omlx[grammar]
Kimi K2 <|tool_calls_section_begin|>
Longcat <longcat_tool_call>

Models not listed above may still work if their chat template accepts tools and their output uses a recognized <tool_call> XML format. For tool-enabled streaming, assistant text is emitted incrementally while known tool-call control markup is suppressed from visible content; structured tool calls are emitted after parsing the completed turn.

A bare JSON, EBNF, or regex grammar constrains the answer from the first generated token, so thinking_budget is ignored. Configure a compatible reasoning_parser to combine constrained output with a separate, budgeted reasoning phase.

Models

Point --model-dir at a directory containing MLX-format model subdirectories. Two-level organization folders (e.g., mlx-community/model-name/) are also supported. GGUF files in these folders are listed one model per file and run on an external engine.

~/models/
├── Step-3.5-Flash-8bit/
├── Qwen3-Coder-Next-8bit/
├── gpt-oss-120b-MXFP4-Q8/
├── Qwen3.5-122B-A10B-4bit/
└── bge-m3/

Models are auto-detected by type. You can also download models directly from the admin dashboard.

Type Models
LLM Any model supported by mlx-lm
VLM Qwen3.5 Series, GLM-4V, Pixtral, and other mlx-vlm models
OCR DeepSeek-OCR, DOTS-OCR, GLM-OCR
Embedding BERT, BGE-M3, ModernBERT, EmbeddingGemma 2
Reranker ModernBERT, XLM-RoBERTa
Decision Clef, Clef-Flash, OpenJev, Decision 3.0 (d3, d3-flash, d3-mini, d3-nano, d3-lite, d3-edge)

CLI Configuration

# Managed background server (macOS app or Homebrew install)
omlx start
omlx stop
omlx restart

# Start with default settings (memory guard tier = balanced, manage via admin UI)
omlx serve --model-dir ~/models

# Choose a memory guard tier at startup
omlx serve --model-dir ~/models --memory-guard safe

# Set a custom memory guard ceiling in GB
omlx serve --model-dir ~/models --memory-guard-gb 48

# Enable SSD cache for KV blocks
omlx serve --model-dir ~/models --paged-ssd-cache-dir ~/.omlx/cache

# Set in-memory hot cache size
omlx serve --model-dir ~/models --hot-cache-max-size 20%

# Adjust max concurrent requests (default: 8)
omlx serve --model-dir ~/models --max-concurrent-requests 16

# With MCP tools
omlx serve --model-dir ~/models --mcp-config mcp.json

# HuggingFace mirror endpoint (for restricted regions)
omlx serve --model-dir ~/models --hf-endpoint https://hf-mirror.com

# API key authentication
omlx serve --model-dir ~/models --api-key your-secret-key
# Localhost-only: skip verification via admin panel global settings

# Network access requires authentication
omlx serve --model-dir ~/models --host 0.0.0.0 --api-key your-secret-key

# Inference and admin APIs only, without the web UI (not saved to settings)
omlx serve --model-dir ~/models --headless

The default SSD cache limit, auto, uses 50% of the sum of free disk space and existing SSD cache files, including GDN sidecars. The budget is refreshed during use and does not shrink simply because the cache grows or the server restarts. Other disk usage can change the budget. Set --paged-ssd-cache-max-size 20GB for a fixed limit.

Most settings can also be configured from the web admin panel at /admin. Settings are persisted to ~/.omlx/settings.json, and CLI flags take precedence. Set the main API key before changing the server host to a LAN address or 0.0.0.0, or save both settings together. oMLX refuses to start on any non-loopback address without a main API key. "Disable all authentication" (skip_api_key_verification) turns off both inference and admin authentication, so it stays restricted to loopback-only binds.

For keyless inference on a network bind, turn on "Allow inference without API key" in the web admin settings or the Security screen of the macOS app. It sets auth.allow_unauthenticated_inference, defaults to false, and applies without a restart. This allows anyone who can reach the server to use inference (including stored Responses and audio), MCP tools, and web search. Management endpoints still require the main API key or an admin login.

Architecture
FastAPI Server (OpenAI / Anthropic API)
    │
    ├── EnginePool (multi-model, LRU eviction, TTL, manual load/unload)
    │   ├── BatchedEngine (LLMs, continuous batching)
    │   ├── VLMEngine (vision-language models)
    │   ├── EmbeddingEngine
    │   ├── RerankerEngine
    │   └── DecisionEngine
    │
    ├── ProcessMemoryEnforcer (total memory limit, TTL checks)
    │
    ├── Scheduler (FCFS, configurable concurrency)
    │   └── mlx-lm BatchGenerator
    │
    └── Cache Stack
        ├── PagedCacheManager (GPU, block-based, CoW, prefix sharing)
        ├── Hot Cache (in-memory tier, write-back)
        └── PagedSSDCacheManager (SSD cold tier, safetensors format)

Development

Build commands

Command What it does
make install Editable install of the server and the web UI, then the native custom kernels
make install-no-kernels The same without the kernels, for machines without full Xcode
make mcp Add MCP (Model Context Protocol) support
make dev Same as make install, with dev tools (make dev-no-kernels skips the kernels)
make kernels Delete any built native custom kernels, compile them again in place, and check that each one loads
make web Rebuild the web UI CSS and normalize the translation files
make app Stage a runnable oMLX.app with freshly compiled native custom kernels

The native custom kernels need full Xcode with the Metal toolchain (xcodebuild -downloadComponent MetalToolchain).

CLI Server

git clone https://github.com/jundot/omlx.git
cd omlx
make dev
pytest

Web UI

The web admin UI lives in apps/omlx-web/ and ships in the same package, so make dev installs it too. After editing its templates, JavaScript, or translations, run make web to rebuild the CSS and normalize the translation files.

macOS App

The native SwiftUI app lives at apps/omlx-mac/. Requires Xcode 26.5+ and Python 3.11+. venvstacks is declared as a dev dependency so make dev (or uv sync --dev) brings the pinned version in. The build script also falls back to uvx venvstacks or pipx run venvstacks if you prefer a host-global tool runner.

# Stage a runnable oMLX.app (xcodebuild + venvstacks Python layers + native kernels + ad-hoc sign)
make app

# Result lands at apps/omlx-mac/build/Stage/oMLX.app
open apps/omlx-mac/build/Stage/oMLX.app

# Force a fresh venvstacks rebuild (otherwise it's cached by fingerprint)
apps/omlx-mac/Scripts/build.sh release --rebuild-donor

First cold build takes 10–20 minutes (venvstacks Python layer assembly). Subsequent builds reuse the cached packaging/_export/ and finish in about 4 minutes. See packaging/README.md for the layer configuration and apps/omlx-mac/ for the Swift sources.

Contributing

Contributions are welcome! See Contributing Guide for details.

License

Apache 2.0

Acknowledgments

omlx (jundot/omlx)

正在搜索数据库…

23.7K ·GitHub
这是干什么的?oMLX 是一个面向 Apple Silicon Mac 的本地大模型推理服务器。它可以运行文本大模型、视觉模型、OCR、嵌入(embedding)和重排序(reranker)模型,支持 continuous batching 和分级 KV 缓存,通过 macOS 菜单栏就能管理。
它是菜单栏应用,还是要在终端里运行的服务器?两者都是:它有一个 Python 服务器,外加一个原生的 Swift/SwiftUI 菜单栏应用(不是 Electron),不用碰终端就能启动、停止和监控服务器。另外还附带一个轻量的 omlx 命令行工具,以及 Homebrew 服务模式。
我在 Mac 上怎么安装?最简单的方式:从 GitHub Releases 下载 .dmg 文件,拖进「应用程序」文件夹——欢迎界面会引导你完成模型目录设置、服务器启动和第一个模型的下载。也可以用 Homebrew 安装或从源码编译。
在我的 Intel Mac 或旧版 macOS 上能用吗?不能——它需要搭载 Apple Silicon 芯片(M1 到 M5)的 Mac,并且系统为 macOS 15.0(Sequoia)或更新版本。从源码编译还需要 Python 3.11-3.13。
作者
jundot
大小
96.9 MB
星标
23.7K
时长
9个月
提交 · 90 天