From b81d700c10da875cd832ef7f79f3a56677aca4e2 Mon Sep 17 00:00:00 2001 From: Mike Wallio Date: Wed, 4 Nov 2026 09:15:01 -0500 Subject: [PATCH 01/24] docs: document inference features and operational guidance Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- AGENTS.md | 73 ++++ README.fr.md | 1 - README.ja.md | 1 - README.ko.md | 5 +- README.md | 442 +++++++++++++++++++- README.zh.md | 1 - benchmarks/README.md | 71 ++++ docs/TESTING.md | 23 +- docs/custom-kernels.md | 5 + docs/demos/claude-discovery.cast | 40 ++ docs/experimental/dflash_mlx_integration.md | 5 +- docs/experimental/qwen35_compiled_mlp.md | 35 ++ docs/experimental/qwen38_mtp_depth_head.md | 49 +++ docs/oQ_Quantization.md | 12 +- 14 files changed, 744 insertions(+), 19 deletions(-) create mode 100644 AGENTS.md create mode 100644 benchmarks/README.md create mode 100644 docs/demos/claude-discovery.cast create mode 100644 docs/experimental/qwen35_compiled_mlp.md create mode 100644 docs/experimental/qwen38_mtp_depth_head.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000000..1b22e79b59 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,73 @@ +# oMLX agent guide + +## Project overview + +oMLX is a Python/FastAPI inference server for Apple Silicon Macs. It serves OpenAI-, Anthropic-, and Responses-compatible APIs over MLX models, with continuous batching, multi-model loading, VLM/audio/embedding/reranker engines, MCP tools, and tiered KV caching. + +Keep durable shared guidance in this file. Add nested `AGENTS.md` files only for directories with meaningfully different rules, and avoid scoped Copilot instruction files unless they add targeted value beyond these repo-wide rules. + +This is a fork maintained by rebasing onto `upstream/main`; its history is intentionally not kept stable. Squashing/rewriting the fork's commits since the `upstream/main` merge-base and force-pushing (`git push --force-with-lease`) is acceptable when cleaning up. Always create a `backup/*` tag before a destructive rewrite, and verify the rewrite changed no code (`git diff HEAD` is empty) before pushing. When regrouping heavily interleaved commits (features scattered among dependency bumps and rebase-cleanup chores), prefer `git reset --soft ` then re-stage per file into logical commits over an interactive reorder; the soft-reset approach keeps the final tree byte-identical and avoids reorder conflicts on shared files such as `pyproject.toml`, `README.md`, and `AGENTS.md`. The regroup pattern that stays byte-identical is a stable file-to-group mapping (image engine/registry/routes + admin Imagine + i18n; audio/video API + VLM; server/admin-chat; upstream-rebase reconciliation; git-pinned deps; Copilot integration). Because `git reset --soft`/mixed reset does NOT scrub the working tree, run the regroup only from a verified-clean checkout of the original tip (`git status` empty and `git rev-parse HEAD^{tree}` equal to the backup tree); a dirty tree left over from diagnostics silently commits stale file content and breaks tree identity. If a run drifts, `git reset --hard ` and re-run rather than patching in place. **Never use `git stash` during a merge** — it can discard `MERGE_HEAD` and break the index, leaving you stranded without merge state or staged conflict resolutions. Pushing requires the `scaryrawr` account: the default git credential helper (gcm-core / a `copilot` host helper) can resolve to a different account and 403; push with `gh auth switch --user scaryrawr` active plus an inline helper override, e.g. `git -c credential.helper= -c 'credential.https://github.com.helper=!gh auth git-credential' push --force-with-lease origin main`, then unset any local `credential.helper` entries you added. + +Key areas: + +- `omlx/server.py` wires the FastAPI app, route handlers, auth, streaming responses, and server state. +- `omlx/cli.py`, `omlx/settings.py`, and `omlx/config.py` handle startup, persisted settings, CLI/env/file precedence, and user-visible defaults. +- `omlx/engine_pool.py` discovers models, selects engine types, tracks loaded engines, and enforces LRU/pinning behavior. +- `omlx/scheduler.py`, `omlx/engine/`, and `omlx/engine_core.py` own request scheduling and MLX generation. +- `omlx/utils/model_loading.py` and `omlx/model_discovery.py` handle model loading, tokenizer setup, model classification, and image-manifest discovery. Keep `model_discovery.py`'s image exports aligned with `engine_pool.py`; validate `import omlx.server` after discovery refactors so missing cross-module exports fail fast. +- `omlx/cache/` owns paged, prefix, hot, SSD, hybrid, vision-feature, and recovery cache behavior. Treat cache serialization and MLX buffer lifetime carefully. +- `omlx/api/` contains API models, protocol adapters, route helpers, tool calling, thinking parsing, structured output, and SSE formatting. +- `omlx/adapter/` contains model-family output parsers and Harmony/Gemma-specific adaptation; keep model quirks there instead of in generic server paths. +- `omlx/admin/` contains the admin HTTP API and utilities; `apps/omlx-web/omlx_web/` owns browser routes, templates, static assets, and i18n files, packaged in the same wheel. Keep web rendering independent of `omlx` imports through `WebUIHost`. +- `omlx/integrations/`, `omlx/mcp/`, and `omlx/eval/` cover editor/client setup, MCP execution, and evaluation helpers. +- `packaging/` builds the macOS menubar app bundle and DMG using venvstacks. + +## Setup and validation + +Use `uv run` for Python tooling and tests. If dependencies are missing, start with `uv sync --dev`. Pin validation commands to Python 3.12 (for example, `UV_PYTHON=python3.12 uv run --python python3.12 pytest ...`): `onnxruntime==1.20.1` does not support CPython 3.14. MLX is pinned to 0.32.4 and xgrammar to 0.2.8; rebuild local custom kernels after MLX upgrades with `OMLX_WITH_CUSTOM_KERNEL=1 uv pip install --python .venv/bin/python --reinstall --no-deps -e .`. Native floating-point QMM wrappers must match MLX's template parameters and global-scale argument, even when global scaling is disabled. + +`uv.lock` is intentionally ignored in this repository; dependency pin changes should be tracked in `pyproject.toml` unless a task explicitly changes the lockfile policy. + +When bumping git-sourced dependencies, audit `[project].dependencies`, `[project.optional-dependencies]`, and `tool.uv.override-dependencies`; compare the upstream dependency metadata at the new commit (`pyproject.toml`, `requirements.txt`, or equivalent) for changed version constraints that must be mirrored locally; also check mirrors in `packaging/build.py`, `omlx/admin/routes.py` engine metadata, `Formula/omlx.rb`, `tests/test_admin_engine_info.py`, and user-facing install examples such as `README.md`. Some packaging paths intentionally duplicate pins from `pyproject.toml`; if an optional extra pin changes, run targeted validation with that extra enabled (for example `uv sync --dev --extra audio` for `mlx-audio`). For `mlx-lm` bumps, validate the scheduler and MTP BatchGenerator integration against upstream API shape changes such as stop matching (`StopSequenceMatcher` / `stop_matchers` in current pins, replacing older `SequenceStateMachine` / `state_machines`) and `GenerationBatch.Response` fields; keep every MTP response construction routed through `_generation_response`, including unfinished singleton emissions. For `mlx-vlm` bumps, smoke Qwen3.5 dense and MoE VLM generation when available: model loading alone does not exercise oMLX patches whose upstream helper APIs or call signatures may have changed. When native MTP is enabled, include a multi-token verify/rejection cycle and confirm rollback states are returned without cache-rebuild warnings; a one-token smoke does not exercise the dedicated speculative verifier. + +- Default fast test run: `uv run pytest` +- Explicit fast test selection: `uv run pytest -m "not slow and not integration"` +- Narrow test run: `uv run pytest tests/test_config.py -v` +- Lint: `uv run ruff check .` is the intended Python lint command, but the current tree may have pre-existing full-repo ruff diagnostics; when a task is not a lint cleanup, prefer `uv run ruff check ` plus focused tests and call out any baseline failures separately. Do not include non-Python files such as `README.md` or `Formula/*.rb` in Ruff path lists; use `git diff --check` for whitespace on mixed-file changes. Ruff's SIM118 suggestion is unsafe for `safetensors.safe_open` handles in this environment; keep `f.keys()` there and add a targeted `# noqa: SIM118` if needed. +- Type check: `uv run mypy omlx` +- Format when needed: `uv run black .` +- macOS app build checks live under `packaging/`; see `packaging/README.md` before running `python build.py`. + +`pytest.ini` defaults to verbose tests excluding `slow` and `integration`. Mark tests that require real model files with `@pytest.mark.slow`, and tests that require a live server with `@pytest.mark.integration`. + +For manual server smoke tests, remember `omlx serve` persists non-default CLI flags to `~/.omlx/settings.json`. Prefer a disposable base path such as `--base-path "$(mktemp -d /tmp/omlx-smoke.XXXXXX)"` for temporary runs with flags such as `--model-dir`, `--memory-guard`, or `--max-concurrent-requests`; use `--memory-guard aggressive` for light smoke runs rather than disabling the guard with `off`. If the Homebrew service is already running, prefer an isolated temporary server on an alternate port rather than stopping the service unless you specifically need to validate the service instance. Treat a temporary server as a persistent readiness-gated process, not a bounded command: inspect startup output immediately, probe its health or target endpoint as soon as it reports ready, run the dependent smoke request, and then stop it; never wait for the server process to exit or for a completion notification. When `brew services` is slow or hangs, manage the service directly with the user launch agent label/path (`homebrew.mxcl.omlx`, `~/Library/LaunchAgents/homebrew.mxcl.omlx.plist`) via `launchctl list`, `launchctl bootout`, and `launchctl bootstrap`. For unauthenticated smoke servers, unset `OMLX_API_KEY` before launching; if auth is enabled, the generated key is stored under `auth.api_key` in that temporary settings file. Restart any stopped Homebrew service afterward, and verify it on the configured `server.port` from `~/.omlx/settings.json` rather than assuming the default 8000. Query `/v1/models` before smoke requests and use the returned IDs; models stored under nested `owner/model` directories may be served by basename. For Responses API smoke tests, validate nested `.output[].content[].text` in addition to any convenience `.output_text` field. For lightweight image-generation smoke tests with local mlx-vlm models, use the core mlx-vlm dependency and at least two steps because `steps=1` can fail inside backend progress math rather than validating route behavior. For local image-edit smoke tests with large inputs, prefer multipart `/v1/images/edits` uploads (`-F image=@...`, plus `prompt`, `model`, `steps`, `guidance`, and `image_strength` fields) over JSON data URIs to avoid shell/base64 argument-size limits. + +## Code conventions + +- Keep the Apache 2.0 SPDX header at the top of Python source and test files. +- Prefer dataclasses for configuration and request/response state where surrounding code already uses them. +- Keep protocol-specific conversion in `omlx/api/` or `omlx/api/adapters/`; avoid mixing API wire-format logic into scheduler/cache internals. +- Preserve async boundaries: FastAPI handlers and engine orchestration are async, while MLX generation is isolated through scheduler/engine abstractions. +- Keep optional dependency behavior explicit. Extras such as `mcp`, `audio`, `grammar`, `image`, `modelscope`, and `paroquant` are intentionally separated; use availability helpers such as `omlx/utils/optional_deps.py` rather than importing heavy optional packages in core paths. +- For Copilot CLI integration launches, keep `COPILOT_OFFLINE=true` so subagents do not fall back to GitHub-hosted services. The launcher persists the omlx provider into `~/.copilot/providers.json` (honoring `COPILOT_PROVIDERS_CONFIG`): merge into the existing file, clobber only entries whose provider name/id is `omlx`, preserve all foreign providers/models and unknown top-level keys, keep the file `0600`, and back up before rewriting (skip the write when content is unchanged). +- When adding admin UI i18n keys, update every file under `apps/omlx-web/omlx_web/i18n/*.json` (including `pt-BR.json`) and run focused tests or JSON parsing checks that cover missing locale keys. +- Admin templates ship with precompiled `apps/omlx-web/omlx_web/static/css/tailwind.css`; if you use new arbitrary Tailwind classes (for example `w-[...]`, `h-[...]`, `z-[...]`, or dynamic responsive grid classes), either rebuild and commit the CSS or prefer local semantic CSS in the template so installed pages do not lose layout. +- For image generation/edit defaults, keep request-level `steps`/`guidance`/`image_strength` overrides ahead of manifest `default_*` values, and manifest values ahead of `omlx/image_registry.py` family defaults; resolve family defaults through canonical base-model aliases so every supported alias gets the same behavior, and cover changes with focused `tests/test_image_engine.py` cases. Family-level defaults must be backed by mlx-vlm model configuration or manifests rather than subjective manual results. +- For mlx-vlm image editing, preserve each family’s documented input contract: FLUX.2 and Mage-Flow edit support multi-image requests, while Z-Image and ERNIE-Image require exactly one source image. Current mlx-vlm image families do not support masks. Route `image_strength` through request extras as both `strength` and `image_strength` so Z-Image and ERNIE-Image receive their respective names. +- For VLM/chat media handling, prefer `omlx/utils/image.py`'s `extract_media_from_messages()` in engine paths so image, audio, and video handling stays aligned; keep `extract_images_from_messages()` as compatibility-only unless a three-value API is specifically required. +- Keep Pixtral serving preprocessing MLX-resident via `return_tensors="mlx"` while preserving the image processor's default NumPy output for compatibility. +- For VLM speculative decoding, keep standalone MTP drafter artifacts such as `gemma4_assistant`, `gemma4_unified_assistant`, and `qwen3_5_mtp` out of normal model discovery; they are loaded through parent VLM drafter paths and are not chat-capable models. +- In SpecPrefill chunk selection, reduce chunk scores in one MLX operation and transfer the score vector once; per-chunk `.item()` calls serialize GPU work. Preserve deterministic Python tie ordering. +- For model-family patches under `omlx/patches/`, keep changes narrow and covered by focused regression tests. These files mirror upstream behavior and can be brittle across dependency updates. +- When a model-family patch changes checkpoint sanitization or quantization metadata, test a complete tiny synthetic checkpoint through the real loader with `strict=True`; helper-only conversion tests do not catch config normalization, module replacement, or unexpected/missing binding keys. +- For affine PLE dequantization, promote mixed floating-point scales and biases to their shared MLX result dtype before calling `mx.dequantize`; its Metal kernel reads both buffers using one scalar type. Keep MXFP scales as `uint8` and preserve the precision of checkpoint metadata. +- When changing cache, scheduler, streaming, adapters, or tool-call behavior, add focused tests for token accounting, finish reasons, cancellation/disconnect behavior, cache reuse/regression paths, and protocol output shape. +- Keep streaming `RequestOutput.output_token_ids` empty until the terminal output to avoid quadratic cumulative-list copies; streaming consumers should use `new_token_ids`, while terminal and non-streaming consumers receive the complete token sequence. + +## Safety notes + +- The project targets Apple Silicon and MLX. Avoid adding torch-heavy dependencies to core paths unless they are guarded by an optional extra. +- Do not enable Hugging Face `trust_remote_code` by default; tests assert the safer default. +- Do not swallow MLX, GPU synchronization, cache corruption, model-loading, or settings-persistence errors with broad fallbacks. Surface errors through existing exception types in `omlx/exceptions.py`, route-level HTTP error mapping, or explicit user-facing warnings consistent with nearby code. +- Do not run slow/integration/model-loading tests unless the task needs them and the environment has the required models or server. +- Be careful with commands that build the macOS app or DMG; they can be expensive and may write large artifacts under `packaging/build/` and `packaging/dist/`. diff --git a/README.fr.md b/README.fr.md index 6d453364e6..596d4bdaca 100644 --- a/README.fr.md +++ b/README.fr.md @@ -405,5 +405,4 @@ Les contributions sont les bienvenues ! Voir le [Guide de contribution](docs/CON - [mlx-vlm](https://github.com/Neywa-Labs/mlx-vlm) — inférence de modèles vision-langage sur Apple Silicon - [vllm-mlx](https://github.com/waybarrios/vllm-mlx) — oMLX a démarré à partir de vllm-mlx v0.1.0 et a considérablement évolué avec le service multi-modèles, le cache KV à plusieurs niveaux, le support VLM avec cache paginé complet, un panneau d'admin, et une app dans la barre de menus macOS - [venvstacks](https://venvstacks.lmstudio.ai) — couches d'environnements Python portables pour le bundle de l'app macOS -- [mlx-embeddings](https://github.com/Blaizzy/mlx-embeddings) — support des modèles d'embedding sur Apple Silicon - [dflash-mlx](https://github.com/bstnxbt/dflash-mlx) — décodage spéculatif par diffusion par blocs sur Apple Silicon diff --git a/README.ja.md b/README.ja.md index 7cb83bbe00..bf0450bdbf 100644 --- a/README.ja.md +++ b/README.ja.md @@ -402,5 +402,4 @@ apps/omlx-mac/Scripts/build.sh release --rebuild-donor - [mlx-vlm](https://github.com/Neywa-Labs/mlx-vlm) - Apple Siliconでのビジョン言語モデル推論 - [vllm-mlx](https://github.com/waybarrios/vllm-mlx) - oMLXはvllm-mlx v0.1.0からスタートし、マルチモデルサービング、階層型KVキャッシュ、完全なページドキャッシュ対応のVLM、管理画面、macOSメニューバーアプリへと大きく進化しました - [venvstacks](https://venvstacks.lmstudio.ai) - macOSアプリバンドルのためのポータブルPython環境レイヤリング -- [mlx-embeddings](https://github.com/Blaizzy/mlx-embeddings) - Apple Silicon向けエンベディングモデルサポート - [dflash-mlx](https://github.com/bstnxbt/dflash-mlx) - Apple Siliconでのブロック拡散 speculative decoding diff --git a/README.ko.md b/README.ko.md index b116d7b434..4b624904f4 100644 --- a/README.ko.md +++ b/README.ko.md @@ -310,8 +310,8 @@ mlx-lm에서 사용 가능한 모든 함수 호출 형식, JSON 스키마 검증 | LLM | [mlx-lm](https://github.com/ml-explore/mlx-lm)이 지원하는 모든 모델 | | VLM | Qwen3.5 시리즈, GLM-4V, Pixtral 및 기타 [mlx-vlm](https://github.com/Neywa-Labs/mlx-vlm) 모델 | | OCR | DeepSeek-OCR, DOTS-OCR, GLM-OCR | -| 임베딩 | BERT, BGE-M3, ModernBERT, EmbeddingGemma 2 | -| 리랭커 | ModernBERT, XLM-RoBERTa | +| 임베딩 | BERT, BGE-M3, ModernBERT, EmbeddingGemma, EmbeddingGemma 2, Qwen3-Embedding, Qwen3-VL-Embedding, SigLIP (text only) via [mlx-vlm](https://github.com/Blaizzy/mlx-vlm) or native loaders | +| 리랭커 | ModernBERT, XLM-RoBERTa, Qwen3-Reranker, Qwen3-VL-Reranker | | Decision | Clef, Clef-Flash, OpenJev, Decision 3.0 (d3, d3-flash, d3-mini, d3-nano, d3-lite, d3-edge) | ## CLI 설정 @@ -446,7 +446,6 @@ apps/omlx-mac/Scripts/build.sh release --rebuild-donor - [mlx-vlm](https://github.com/Neywa-Labs/mlx-vlm) - Apple Silicon에서의 비전-언어 모델 추론 - [vllm-mlx](https://github.com/waybarrios/vllm-mlx) - oMLX는 vllm-mlx v0.1.0에서 시작하여 멀티 모델 서빙, 계층형 KV 캐시, 페이지드 캐시를 완전 지원하는 VLM, 관리자 패널, macOS 메뉴 바 앱으로 크게 발전했습니다 - [venvstacks](https://venvstacks.lmstudio.ai) - macOS 앱 번들을 위한 포터블 Python 환경 레이어링 -- [mlx-embeddings](https://github.com/Blaizzy/mlx-embeddings) - Apple Silicon을 위한 임베딩 모델 지원 - [dflash-mlx](https://github.com/bstnxbt/dflash-mlx) - Apple Silicon에서의 블록 디퓨전 speculative decoding - [MTPLX](https://github.com/youssofal/mtplx) - Lightning MTP의 verify-shape Metal 커널은 Youssof Altoukhi의 MTPLX를 기반으로 하며, depth-k 파이프라인도 여기서 영감을 받았습니다 - [mlx-serve](https://github.com/ddalcu/mlx-serve) - Qwen GDN·QSA 커널(하나는 mlx-serve의 mlxfast-challenge 포팅)과 Linux 헬퍼의 expert 커널·MLX CUDA 패치는 mlx-serve의 MIT 라이선스 코드를 바탕으로 수정되었습니다 diff --git a/README.md b/README.md index b878d719b3..10762cb902 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,8 @@ omlx start # Optional: MCP (Model Context Protocol) support, then restart to load it /opt/homebrew/opt/omlx/libexec/bin/pip install mcp omlx restart + +# mlx-vlm image generation and editing support is included with oMLX. ``` ### From Source @@ -81,6 +83,10 @@ make install # Editable install with the web UI and native custom make mcp # Optional: MCP support, restart `omlx serve` to load it ``` +Image generation and editing use the core `mlx-vlm` dependency. The retained +`image` extra is a no-op compatibility alias; source and released installs do +not need 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. @@ -100,6 +106,9 @@ Requires macOS 15.0+ (Sequoia), Python 3.11–3.13, and Apple Silicon (M1/M2/M3/ > python -c "from omlx.custom_kernels import native_kernel_status; print(native_kernel_status())" > ``` +Core installs include text, VLM, embedding, reranker, and mlx-vlm image +generation/editing support. MCP remains optional via the `mcp` extra. + ## Quickstart ### macOS App @@ -123,7 +132,7 @@ omlx restart 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`. +The server discovers LLMs, VLMs, embedding models, rerankers, and image model manifests 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 @@ -148,7 +157,8 @@ Logs are written to two locations: ## Features -Supports text LLMs, vision-language models (VLM), OCR models, embeddings, and rerankers on Apple Silicon. +Supports text LLMs, vision-language models (VLM), OCR models, embeddings, +rerankers, and mlx-vlm image generation/editing models on Apple Silicon. ### Admin Dashboard @@ -181,7 +191,9 @@ NVIDIA GPUs running [omlx-cuda-helper](apps/omlx-cuda-helper/README.md). ### 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. +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; the fork also accepts `input_video: {"data": "", "format": "mp4"}` and inline video file attachments. Video needs OpenCV (`opencv-python-headless`) and cannot be combined with images or audio in one native-video request. Remote video URLs and local file paths are rejected. 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. + +Qwen3.8-Flash-Next (`qwen4_exp`) PLE SSD offloading supports dense/raw-FP8, affine, and native MXFP4 embedding shards, including mixed storage layouts. Native MXFP4 uses packed U32 weights and U8 scales (4 bits, group size 32, no biases). The mmap path reads and dequantizes only requested rows, keeping the full PLE table off the GPU without converting the checkpoint. ### Tiered KV Cache (Hot + Cold) @@ -204,9 +216,20 @@ Handles concurrent requests through mlx-lm's BatchGenerator. Max concurrent requ 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. +`omlx launch claude` enables [gateway model discovery](https://code.claude.com/docs/en/llm-gateway-protocol#model-discovery). +Claude Code's `/model` picker lists visible chat models and exposed profiles with at least 48K context, or an unknown context limit. +The launcher uses `/claude` as its Anthropic base path. +That path advertises models with an `omlx-claude/` prefix because Claude Code filters out IDs without `claude` or `anthropic`. +Messages and token-count requests on that path remove one prefix before normal model and profile resolution. +The standard `/v1/models` catalog and Claude Desktop configuration stay unchanged. +Use Claude Code v2.1.257 or later for discovery while nonessential traffic is disabled, as it is by default in the launcher. +Context and auto-compact overrides remain process-wide, so the launcher uses the smallest known context limit among the initial model, configured tiers, and discoverable chat models. +If the discovery preflight fails, the launcher warns and caps both overrides at the 48K discovery minimum. +Models added after launch appear at the next Claude Code startup. + ### 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: +Load LLMs, VLMs, embedding models, rerankers, and image models within the same server. Models are managed through a combination of automatic and manual controls: - **LRU eviction**: Least-recently-used models are evicted automatically when memory runs low. - **Manual load/unload**: Interactive status badges in the admin panel let you load or unload models on demand. @@ -246,6 +269,10 @@ Search and download models from HuggingFace directly in the admin dashboard, in oMLX Model Downloader

+### Model Upload Tracking + +Open **Models > Uploader** to view the upload queue, including jobs started before a page refresh or from another client. Tracking does not require revalidating your HuggingFace token. The queue refreshes automatically while the Uploader tab is open; **Refresh uploads** requests a fresh status without restarting an upload. If refresh fails, the last-known tasks remain visible with a warning. The animated upload indicator shows activity, not a byte percentage; pending jobs wait for the current upload to finish. + ### 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. @@ -260,6 +287,120 @@ Set up OpenClaw, OpenCode, Codex, Hermes Agent, Copilot, Pi, Mistral Vibe, and D Install [Mistral Vibe](https://github.com/mistralai/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 `. 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 -- --resume`. +#### OpenCode model switching + +OpenCode 2 is required. Run `omlx launch opencode` to register available chat +models in its global configuration. Use `/models` to switch models, or pass `--model ` to +choose the initial default. Without that flag, oMLX uses the saved OpenCode +model, the server default, or the first available chat model, in that order. + +The launcher updates `opencode.jsonc` if it exists, otherwise `opencode.json` +under `$XDG_CONFIG_HOME/opencode` or `~/.config/opencode`. It reads comments and +trailing commas but rewrites the file as plain JSON with two-space indentation. +The launcher attempts to back up the original file, including comments and +formatting, before writing. An existing `.jsonc` filename is retained; plain JSON +is valid JSONC. Other providers and manually configured models are preserved. Models no +longer reported by oMLX remain in the file; remove them manually if needed. If +discovery fails, the existing model list is preserved and an explicitly requested +chat model is added as the default. If no model can be selected, OpenCode uses its +existing default. The output limit leaves at least one quarter of the context +window for input. When a refreshed model has no usable context, reasoning, or model-type +metadata, existing values are preserved because they may be manually +configured. The launcher warns that those values may be stale and retains +configured tool capabilities. The config and backup files use Unix mode `0600` +because they can contain an API key; existing ACLs may grant additional access. +A malformed config stops the launch without replacing it. + +Audio-capable chat models also advertise audio input when oMLX recognizes their +checkpoint's audio-encoder weights; this does not load the model. Stripped Gemma +4 checkpoints without audio weights are not advertised as audio-capable. +When audio detection is inconclusive (including older servers), manually +configured audio input is preserved. The running server must use the updated +code to report audio support; updating only the launcher is not sufficient. +The launcher warns when the server does not expose this metadata. + +Changed existing configs receive a timestamped `.bak` file using the same +best-effort backup-and-write helper as other integrations. If backup creation +fails, oMLX warns and still writes the config. Concurrent edits are not protected, +so avoid editing the file while launching. Unchanged configs are not rewritten. +Symlinked, hard-linked, and non-owned config files are rejected. + +The launcher uses `$OPENCODE_CONFIG_DIR` instead of the default directory when +set. Project, managed, and explicit OpenCode settings can override the global configuration. +Only the current `providers` format is updated; legacy `provider` settings are +left untouched and are not migrated. + +An already-running OpenCode 2 shared service may initially use a cached catalog; +its file watcher can refresh the catalog later. Run `opencode reload` after the +launcher writes the configuration, or pass +`-- --standalone` to launch a private OpenCode server with the updated config. +Reload rebuilds every loaded location and cancels pending permissions and forms +in all projects. The launcher does not reload the shared service automatically. +An explicitly selected `--server` may not use this local configuration at all. + +#### Codex model switching + +```bash +omlx launch codex +omlx launch codex_app +# Optionally select the initial model; other models remain available: +omlx launch codex --model your-model-id +``` + +Both integrations refresh a Codex model catalog from oMLX's available chat models, +so you can switch models with the CLI's `/model` selector or the desktop app's +model picker instead of selecting just one model before launch. Without `--model`, +oMLX uses the saved Codex integration model when available, otherwise the +oMLX default model (including its served alias). If neither is available, +it falls back to the first chat model returned by the server (favorites first). +The selected model starts loading in the background before Codex opens; launch +does not wait for loading to finish. Warm-up request failures produce a warning +without preventing launch, and normal inference can still load the model on demand. + +The catalog preserves served aliases and exposed profiles, includes unloaded +models that oMLX can load on demand, and records each model's context window and +text/image input support. Embedding, reranking, audio, and image-generation models +are excluded when their type is available from the model status endpoint. If +status is unavailable, the public model listing supplies context limits and input +support defaults to text-only. Models with native reasoning-effort metadata +advertise their supported levels. Models without it accept `low`, `medium`, and +`high` as compatibility values; templates without effort controls ignore these +values, and existing thinking defaults remain unchanged. This also lets Codex +Desktop's low-effort background title generator prefer the launch-default model +instead of loading another checkpoint solely for its effort metadata. + +Requires a Codex version supporting +[`model_catalog_json`](https://developers.openai.com/codex/config-reference/#model_catalog_json). +The catalog is loaded at startup: relaunch through oMLX after adding or removing +models, changing aliases, or updating model settings. Restart an already-running +desktop app to apply the refreshed configuration. The CLI uses process-scoped +provider/catalog overrides without changing your `config.toml`; the desktop +integration backs up and updates that file as before. A custom `CODEX_HOME` is +respected, and oMLX's generated catalogs do not overwrite other catalog files. + +#### Copilot CLI model switching + +Run `omlx launch copilot` or `omlx launch copilot --model your-model-id`. +Like Codex, Copilot starts with the saved integration model, the oMLX default, +or the first available chat model, and its `/model` picker can switch among +the server's chat models. The launch-time provider registry includes per-model +context limits, image support and available reasoning-effort levels; relaunch +to refresh it after model changes. Explicitly selected models start loading in +the background. When a context limit is unavailable, the registry uses a +32,768-token fallback; this does not increase a model's actual capacity. + +oMLX runs Copilot in offline mode using the Responses API and stores its +provider in the CLI's `providers.json` (`~/.copilot/providers.json`, or the +file named by `COPILOT_PROVIDERS_CONFIG`). Relaunches refresh only the +omlx-owned provider/model entries; providers and models you configured +yourself are preserved, and the previous file is backed up before rewriting. +The file is kept at `0600` because it contains the server's bearer token in +plaintext, and it remains after Copilot exits so later CLI sessions can use +the models. This requires a Copilot CLI version supporting `providers.json`. +User-specified global context/reasoning overrides in CLI configuration can still +take precedence over catalog metadata; the desktop integration clears these +overrides so limits follow the selected model. + ### 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. @@ -288,6 +429,8 @@ Drop-in replacement for OpenAI and Anthropic APIs. Supports streaming usage stat | `POST /v1/embeddings` | Text embeddings | | `POST /v1/rerank` | Document reranking | | `POST /v1/systemone` | Typed decisions with decision models or chat models (TypeSafe System One) | +| `POST /v1/images/generations` | Image generation | +| `POST /v1/images/edits` | Image editing | | `GET /v1/models` | List available models | | `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 | @@ -349,11 +492,295 @@ Models are auto-detected by type. You can also download models directly from the | Type | Models | |------|--------| | LLM | Any model supported by [mlx-lm](https://github.com/ml-explore/mlx-lm) | -| VLM | Qwen3.5 Series, GLM-4V, Pixtral, and other [mlx-vlm](https://github.com/Neywa-Labs/mlx-vlm) models | +| VLM | Qwen3.5 Series, GLM-4V, Pixtral, Nemotron Nano Omni / Super VL / Bolt, and other [mlx-vlm](https://github.com/Neywa-Labs/mlx-vlm) models | | OCR | DeepSeek-OCR, DOTS-OCR, GLM-OCR | -| Embedding | BERT, BGE-M3, ModernBERT, EmbeddingGemma 2 | -| Reranker | ModernBERT, XLM-RoBERTa | +| Embedding | BERT, BGE-M3, ModernBERT, EmbeddingGemma, EmbeddingGemma 2, Qwen3-Embedding, Qwen3-VL-Embedding, SigLIP (text only) via [mlx-vlm](https://github.com/Blaizzy/mlx-vlm) or native loaders | +| Reranker | ModernBERT, XLM-RoBERTa, Qwen3-Reranker, Qwen3-VL-Reranker | | Decision | Clef, Clef-Flash, OpenJev, Decision 3.0 (d3, d3-flash, d3-mini, d3-nano, d3-lite, d3-edge) | +| Image | mlx-vlm models: Qwen Image 2.1/base/Turbo, FLUX.2 Klein, Mage-Flow, Ming-Image 0.1 Design, ERNIE-Image, Z-Image, Ideogram 4, Bonsai | + +Embedding and reranker models load through mlx-vlm; the separate mlx-embeddings dependency is gone. NomicBERT checkpoints are no longer supported. SigLIP serves text embeddings only and rejects image inputs. Qwen3-VL-Embedding rejects inputs longer than 8192 tokens instead of truncating them. + +### Flint + +RecursiveSI Flint is a text-only MoE model served through native mlx-vlm +(`model_type: flint`), with reasoning and GLM-style XML tool-call parsing. +Discovery and integrations report text-only capabilities (`model_type: llm`) +while retaining `engine_type: vlm` for loading; image, audio, and video inputs +are not supported. +oQ supports resident calibration and layer-streamed calibration on the original +BF16 checkpoint, including routed/shared experts and normalized output-head +inputs. See [oQ Quantization](docs/oQ_Quantization.md). + +### MiniCPM-V 4.7 + +`MiniCPM-V-4.7-35B-A3B` requires the complete native `minicpmv4_7` +implementation; it cannot be aliased to MiniCPM 4.6. The paired +`MiniCPM-V-4.7-35B-A3B-DSpark` checkpoint is a drafter, not an independently +served chat model. Support uses the existing chat, Anthropic Messages and +Responses APIs; no audio or image/video generation capability is implied. + +The model and torch-free processor come from official **mlx-vlm**, pinned +to [commit `4319ef2`](https://github.com/Blaizzy/mlx-vlm/commit/4319ef2c837b7226b758c3dd69edda51b7079785) +(v0.7.10). The former full +vendored implementation and source-hash installation bridge have been removed. +This pin requires Python >=3.10, MLX >=0.32.4 and Transformers >=5.14; +oMLX retains its existing MLX pin and Transformers upper bound. + +Small serving hooks in `omlx/patches/minicpm47.py` preserve request-local +positions, padded-prefill behavior and the existing MiniCPM GDN normalization, +including the official exact verifier. They also expose processor controls to +mlx-vlm's signature-based input dispatcher and resolve legacy ViT-merger +quantization paths through its per-model alias hook. The Qwen MTP constructor +leaves foreign subclasses, including MiniCPM, responsible for their own heads. +Vision packing uses the convolution's input dtype and the token embedding's +floating output dtype, not packed quantized token-table storage. +`omlx/speculative/minicpm_dspark.py` extends the official +DSpark drafter with oMLX's proposal-probability/confidence transport and fixed +paired-helper policy. The model, vision encoder, processor, checkpoint loading +and speculative cache transactions remain upstream implementations. +The official target uses normalized top-k routing; `norm_topk_prob=False` +is not supported. + +Run `UV_PYTHON=python3.12 uv run --python python3.12 pytest tests/test_minicpm47.py tests/test_minicpm_pairing.py` +for isolated, offline CPU compatibility checks. These exercise tiny strict +HF/canonical/mixed-quantized checkpoints, processor/vision inputs, capture and +cache rollback, and real oMLX greedy/sampled DSpark generation with cancellation +and exception cleanup. Existing converted checkpoints and provenance checks +are preserved; no reconversion or metadata changes are required. +Tiny fixtures do not establish full-checkpoint or deployed GPU compatibility. + +The optional `mm_processor_kwargs` request field controls compression and +slicing, separately from `chat_template_kwargs`: + +```json +{ + "mm_processor_kwargs": { + "downsample_mode": "4x", + "max_slice_nums": 36 + } +} +``` + +`downsample_mode` accepts `"4x"` or `"16x"`; `max_slice_nums` must be a positive +integer. These controls can also be stored in per-model settings/profiles. +In the admin UI, open **Model Settings > MiniCPM Media** to edit them. +Choose **Default** for compression or clear the slicing limit to remove that +override. Saving a MiniCPM profile with both controls unset records processor +defaults explicitly rather than retaining previously applied media overrides. +Non-null request values override model settings, then checkpoint/processor +defaults. Omitted controls do not change existing defaults. The same effective +compression mode is used for preprocessing, canvas positions and encoding. +Advanced frame stacking (`stack_frames`) is deferred and rejected. Ordinary +video retains the existing frame limit and can be combined with images. + +DSpark is explicitly opt-in through per-model `dflash_enabled: true` and +`dflash_draft_model` pointing to its existing local paired checkpoint. The +helper uses the target tokenizer and native sequential Markov proposals, +proposal probabilities and confidence outputs. Verification is fixed-width, +with at most eight proposals plus an anchor; confidence is observational, not +an adaptive controller. Unsupported adaptive modes, sampled batches, stochastic +XTC, constrained grammar decoding, sparse prefill, context-window truncation +and private SSD drafter caching fail +explicitly. Helper activation failures do not silently fall back to ordinary +generation. + +Helper admission also checks source provenance, not just matching dimensions. +Original Hugging Face local-directory downloads must retain their +`.cache/huggingface/download/config.json.metadata`. Converted checkpoints +may declare their source in `config.json`: +`"omlx_source": {"repo_id": "...", "revision": "..."}`. The reviewed target +source is `openbmb/MiniCPM-V-4.7-35B-A3B` at +`4c7623a9326e0f74313bbc7292d852a9e3018a70`, and the helper source is +`openbmb/MiniCPM-V-4.7-35B-A3B-DSpark` at +`5facb75c251ffd524524a544c1f5fd97ba0d6c5c`. +Conversion metadata is an explicit origin declaration, not a cryptographic +certification of the trained tensors. + +DSpark requests re-prefill the complete prompt because ordinary KV prefix +entries do not contain its target-layer capture history. Base serving without +DSpark retains normal prefix-cache behavior. MiniCPM vision-feature caching is +disabled until crop/position-equivalent reuse is proven. Original weights and +configs are not rewritten; full checkpoint admission and installed-runtime +validation require a separate memory-safe execution slot. + +### Nemotron multimodal models + +Support uses the official implementation merged in +[Blaizzy/mlx-vlm#2528](https://github.com/Blaizzy/mlx-vlm/pull/2528), +not a vendored architecture. The dependency pin above includes that merge and +requires MLX 0.32.4, which oMLX already pins. + +| Family | Serving inputs | Native Lightning MTP | +|--------|----------------|----------------------| +| Nemotron-3 Nano Omni | Text, images, video; audio when the checkpoint includes `sound_config` | Only when native head tensors and configuration are present | +| Nemotron-3.5 Super VL | Text, images, video | Bundled head; singleton and batched verification | +| Nemotron-3.5 Bolt | Text, images, video | No bundled head | + +These models use the existing chat, Messages, and Responses APIs. Image and +video inputs must use separate requests; each request accepts one video. +Native paired-frame processing, odd-frame duplication, and pruning are retained, +with an oMLX limit of 64 sampled frames. Pruned token IDs and embeddings share +one retained-position map. API prompt usage reports the original processor token +count; scheduling and cache positions use the compacted length. Cross-request +prefix reuse is disabled for pruned video and native MTP because a KV entry alone +cannot restore their complete media/head history. Audio identities are included +in cache keys even when clips have identical lengths. + +Enable **Lightning MTP**, not an external assistant-drafter setting, for Super VL. +Each request owns its native full-prompt head initialization. Batched verification +commits at the earliest mismatch, stop, or token-budget boundary across the +cohort, using the native recurrent-cache rollback transaction. +Grammar-constrained and XTC late joins wait for the active native MTP cohort to +finish; compatible requests still join its batched verification. This preserves +live media-conditioned caches and queued tokens without text-only replay. +Native full-prompt MTP requests cannot be requeued under memory pressure; the +existing abort path applies rather than restarting without their media/head history. + +The existing `omlx.oq.quantize_oq_streaming()` Python API and admin oQ/oQe workflow accept floating-point +sources and the native mixed ModelOpt NVFP4/FP8 source format (including NVIDIA's +Super VL NVFP4 export). Per-expert global scales are folded before stacking, +and Bolt's heterogeneous layer geometry is preserved. ModelOpt sensitivity +measurement streams real source layers even when the full model fits in RAM. +Existing MLX affine quants are serving inputs, not supported requantization +sources. Exports remain multimodal: `text_only=True` is rejected before creating +output. With `preserve_mtp=True`, the native head is exported to an associated +`mtp/` sidecar using the official splitter's native format: ModelOpt FP8 +projections expand to floating point, while NVFP4 stays packed. The head is not +oQe-calibrated, converted to the target's oQ recipe, or included in its +bit-allocation budget. Size estimates count the exported sidecar +once, including FP8 expansion and FP32 global scales. The official splitter can +hold the complete head in memory. +For sources larger than available RAM, oQe automatically streams native decoder +layers from the original checkpoint for calibration instead of using a lossy +proxy. Explicit `stream_calibration=True` also selects this path for smaller +sources; heterogeneous Bolt layers retain their individual geometry and routing. +Calibration uses the built-in text corpus; vision modules retain the weight-only +oQ recipe rather than image/audio calibration. `oq_imatrix_report.json` records +applied statistics and missing entries; this is not a quality claim. + +Coverage includes complete tiny native oQ/oQe checkpoint conversion, strict +reload, mixed-source reconstruction, media alignment, and batched MTP lifecycle +tests. It is not evidence of full-size checkpoint inference, conversion quality, +or performance; those require separate model-specific validation. + +### Image model discovery and manifests + +Image generation and editing use the core mlx-vlm dependency. oMLX asks +mlx-vlm whether each local diffusion checkpoint supports generation, editing, +or both. Checkpoint metadata can identify models in renamed directories. +The fork's alias registry does not restrict which families or tasks can be +discovered. + +Requests override manifest sampling defaults. Otherwise mlx-vlm resolves +sampling defaults from the loaded model. oMLX does not patch mlx-vlm request +dataclasses or keep a separate family sampling-default table. +With `size=auto`, generation uses mlx-vlm's default request size of 512×512; +editing leaves size selection to the model. Explicit output sizes cannot +exceed 4,194,304 pixels. Edit inputs use a private OS temporary directory +per request, removed after inference or after a cancelled worker finishes. + +The fork retains `omlx-image-model.json` for explicit family or task +declarations and per-checkpoint defaults. Add it in a model subdirectory +to expose an mlx-vlm image model through `/v1/images/generations` or +`/v1/images/edits`: + +```json +{ + "backend": "mlx-vlm", + "base_model": "flux2-klein-4b", + "task": ["generation", "edit"], + "model_path": ".", + "default_steps": 28, + "default_guidance": 3.5, + "default_image_strength": 0.4, + "estimated_size": 4294967296 +} +``` + +`model_path`, defaults, and `estimated_size` are optional. When +`estimated_size` is omitted, oMLX uses the local `model_path` size when +available, otherwise a conservative family estimate for memory accounting. +`quantize` is not a valid image manifest setting because mlx-vlm loads the +checkpoint's native weight format directly. + +Supported `base_model` aliases include FLUX.2 Klein 4B/9B/base/KV variants +(generation and multi-image edit), Mage-Flow base/aligned/turbo and their edit +variants, Z-Image and Z-Image Turbo, ERNIE-Image and ERNIE-Image Turbo, +Ming-Image 0.1 Design (generation only), Ideogram 4 FP8, and Bonsai Ternary. +The original `Ming-Image-0.1-Design` and quantized variants (such as +`Ming-Image-0.1-Design-mxfp8`) are discovered without a manifest when placed +under the model directory. Native sampling defaults are 12 steps and guidance 1.0; +the output PNG retains its alpha channel. Z-Image +and ERNIE-Image edit modes require +exactly one source image; masks are not supported by the current mlx-vlm image +families. + +Qwen Image **2.1 base and 2.1 Turbo** support generation and reference-image +editing. Local multi-component checkpoints are detected from their 2.1 +pipeline/transformer/VAE configuration, even after renaming the directory; +a Qwen-looking folder name alone is not sufficient. Older Qwen Image/Edit +architectures are not included in this support. Explicit manifests can use +`qwen-image-2.1` or `qwen-image-2.1-turbo`. + +The saved Turbo recipe has eight denoising steps and guidance 1.0. Schedule +precedence is **request `sigmas` > checkpoint `sample_sigmas` > generated +schedule from `steps`**. Setting only `steps`, including a manifest default, +does not replace a saved checkpoint grid. Base checkpoints without saved +grids keep 30 generation steps or 40 editing steps. Finite positive guidance +overrides remain supported. + +Custom sigma grids are an API extension, not an Imagine editor. Supply a +nonempty, finite, strictly descending JSON array in `(0, 1]`, without terminal +zero; the scheduler applies the checkpoint's shift settings and appends the +terminal zero. For multipart edits, encode the `sigmas` form field as a JSON +array, for example `[1, 0.8, 0.4]`. Each response image includes the backend's +effective `steps` and `guidance` when available, plus its actual output size. +Imagine explains saved-grid precedence and displays the actual result steps. + +Qwen 2.1 editing conditions on all supplied reference images; the existing +API/UI upload limits still apply. With automatic size, the backend selects +the output aspect from the last resized reference. Qwen does not implement +mask editing, `image_strength`, or an alternative `scheduler` selection; +explicit unsupported options are rejected rather than ignored. + +The Qwen image compatibility patch temporarily backports a local mlx-vlm commit +`9a200804c81b98fd420d1f8a064a6824cec76f4f`'s saved-grid, +static-shift, effective-default/result, and nested processor-config fixes. +It activates for recognized Qwen checkpoints before discovery probes or loading, +refuses unknown upstream source shapes, and +does nothing when the complete native fix is present. Remove the backport once +oMLX's mlx-vlm pin contains the complete fix, retaining registry/API/UI wiring +and regression tests. Full-checkpoint generation/edit validation and deployment +are separate from weight-free tests and require a coordinated GPU memory +budget; no checkpoint conversion or modification is needed. + +The source revision above is not yet published in the upstream repository. +The checked-in hunks contain the exact before/after source and AST fingerprints, +normalized across Python versions by omitting only empty type-parameter fields. +Nonempty type parameters and other source changes still affect the fingerprint. +The hunks can be verified without that local commit. Against a public +`Blaizzy/mlx-vlm` checkout containing the original backport base +`4f4634bb813c0298cb1467bed2e957526c71d0b4`, run: + +```bash +uv run --python python3.12 python \ + omlx/patches/mlx_vlm_qwen_image_compat/generate_backport.py \ + --source-repo /path/to/mlx-vlm \ + --verify-from-base +``` + +This reconstructs each target from the public base, verifies every hunk's unique +context and the resulting AST fingerprint, and does not change any files. +To regenerate the backport, a checkout containing the local source commit is +required: + +```bash +uv run --python python3.12 python \ + omlx/patches/mlx_vlm_qwen_image_compat/generate_backport.py \ + --source-repo /path/to/mlx-vlm \ + --source-revision 9a200804c81b98fd420d1f8a064a6824cec76f4f +``` ## CLI Configuration @@ -496,7 +923,6 @@ Contributions are welcome! See [Contributing Guide](docs/CONTRIBUTING.md) for de - [mlx-vlm](https://github.com/Neywa-Labs/mlx-vlm) - Vision-language model inference on Apple Silicon - [vllm-mlx](https://github.com/waybarrios/vllm-mlx) - oMLX started from vllm-mlx v0.1.0 and evolved significantly with multi-model serving, tiered KV caching, VLM with full paged cache support, an admin panel, and a macOS menu bar app - [venvstacks](https://venvstacks.lmstudio.ai) - Portable Python environment layering for the macOS app bundle -- [mlx-embeddings](https://github.com/Blaizzy/mlx-embeddings) - Embedding model support for Apple Silicon - [dflash-mlx](https://github.com/bstnxbt/dflash-mlx) - Block diffusion speculative decoding on Apple Silicon - [MTPLX](https://github.com/youssofal/mtplx) - Lightning MTP's verify-shape Metal kernels are powered by MTPLX by Youssof Altoukhi, which also inspired the depth-k pipeline - [mlx-serve](https://github.com/ddalcu/mlx-serve) - Qwen GDN and QSA kernels (one via its mlxfast-challenge port) and the Linux helper's expert kernels and MLX CUDA patches are adapted from its MIT-licensed code diff --git a/README.zh.md b/README.zh.md index 03240839fa..27301133e1 100644 --- a/README.zh.md +++ b/README.zh.md @@ -411,7 +411,6 @@ apps/omlx-mac/Scripts/build.sh release --rebuild-donor - [mlx-vlm](https://github.com/Neywa-Labs/mlx-vlm) - Apple Silicon 上的视觉语言模型推理 - [vllm-mlx](https://github.com/waybarrios/vllm-mlx) - oMLX 从 vllm-mlx v0.1.0 起步,经过大幅演进,增加了多模型服务、分层 KV 缓存、完整分页缓存支持的 VLM、管理后台和 macOS 菜单栏应用 - [venvstacks](https://venvstacks.lmstudio.ai) - macOS 应用包的便携 Python 环境分层 -- [mlx-embeddings](https://github.com/Blaizzy/mlx-embeddings) - Apple Silicon 嵌入模型支持 - [dflash-mlx](https://github.com/bstnxbt/dflash-mlx) - Apple Silicon 上的块扩散推测解码 (Block diffusion speculative decoding) - [MTPLX](https://github.com/youssofal/mtplx) - Lightning MTP 的验证形态 Metal 内核由 Youssof Altoukhi 的 MTPLX 提供支持,同时也启发了 depth-k 流水线设计 - [mlx-serve](https://github.com/ddalcu/mlx-serve) - Qwen 的 GDN 与 QSA 内核(其一来自 mlx-serve 对 mlxfast-challenge 的移植)以及 Linux helper 的 expert 内核与 MLX CUDA 补丁改编自 mlx-serve 的 MIT 开源代码 diff --git a/benchmarks/README.md b/benchmarks/README.md new file mode 100644 index 0000000000..281d7b258e --- /dev/null +++ b/benchmarks/README.md @@ -0,0 +1,71 @@ +# Qwen verifier benchmark + +`bench_qwen_verify_prework.py` compares upstream GDN prework with oMLX's fused +prework in the real `VLMBatchedEngine` serving path. Native MTP is enabled in +both arms. This does not measure the speedup from enabling MTP. + +Example invocation from the repository root: + +```sh +uv run --python python3.12 python benchmarks/bench_qwen_verify_prework.py \ + ~/.models/scaryrawr/Qwen3.6-35B-A3B-mxfp4 > qwen-result.json +``` + +The default workload has 512 prompt tokens and 128 generated tokens. Each arm +gets one warmup, followed by three baseline/candidate/candidate/baseline groups. +The model stays loaded throughout. `--pp 2048` selects a longer prompt. +`--fixed-depth 1` selects one draft token instead of the default two. + +Fixed draft depth is confined to the benchmark process. Adaptive depth can +change floating-point execution geometry and greedy output tokens, confounding +an exact kernel comparison. Production retains its adaptive policy. + +The JSON includes raw trials, median producer-side decode throughput, complete +output token IDs, MTP and fused-kernel call counts, MTP head dtypes, runtime +information, source hashes, and model metadata fingerprints. Weight contents +are not hashed. Logs go to stderr. + +The runner fails on early EOS, unequal outputs, cache hits, inactive MTP, +inactive treatment, treatment engagement in the baseline, model-file changes, +or missing telemetry. A failed run is not a performance result. Concurrent GPU +work and thermal drift can still distort timing. + +## Measured scope + +On an Apple M4 Max with 128 GB unified memory and MLX 0.32.2, the final paired +512-token runs produced these medians: + +| Model | Upstream prework | Fused prework | Change | +| --- | ---: | ---: | ---: | +| Qwen3.6-35B-A3B-mxfp4 | 113.82 tok/s | 118.91 tok/s | +4.47% | +| Qwen3.8-27B-mxfp4 | 40.97 tok/s | 41.27 tok/s | +0.73% | + +Each run generated identical tokens across all arms. Earlier repeated runs +measured +3.17% for 35B and +1.19% for 27B. The dense-model gain is small. +A 2048-token 35B run measured 87.48 to 89.06 tok/s, a 1.80% increase. +These measurements cover singleton, fixed-depth-two MTP decode, not general +request latency, prefill, or concurrent throughput. + +Both MXFP4 trunks retained BF16 MTP heads on disk and after loading. The 27B +head had 15 tensors, and the 35B head had 20. No model weights were modified. + +## Production switch + +Fused verifier prework is enabled by default for eligible Qwen3.5-family BF16 +blocks with batch size one and sequence lengths 2 through 9. +`OMLX_QWEN35_VERIFY_PREWORK=0` selects upstream prework. Qwen4, ordinary decode, +prefill, masked blocks, and unsupported shapes retain their existing paths. + +## Flash Next + +`Qwen3.8-Flash-Next-heretic-2-mxfp4` uses `qwen4_exp` and L2 normalization. +The Qwen3.5 verifier fusion above does not apply to this model. + +A separate 512-token prompt and 128-token generation run measured 32.57 tok/s +without native MTP. A paired run with the Lightning MTP head resident measured +31.05 tok/s with MTP disabled and 37.66 tok/s with one draft token, a 21.31% +raw throughput increase. The loaded MTP head contained 32 BF16 tensors. + +Outputs were stable within each arm but differed between ordinary and MTP +decode. These rates therefore do not establish a token-identical speedup. +They measure existing native MTP, not a new Flash Next optimization. diff --git a/docs/TESTING.md b/docs/TESTING.md index e87bcfa53b..0f5d816c2a 100644 --- a/docs/TESTING.md +++ b/docs/TESTING.md @@ -4,6 +4,21 @@ Server tests live in `tests/` and must not depend on `apps/`: after the full run Run `node --test` from `apps/omlx-web/tests/` to discover the standalone dashboard script tests. `test_admin_network_auth_ui.py` runs `network_auth_ui_runner.cjs` with backend-generated cases on stdin. +# Live chat compatibility smoke + +Against an isolated server, run +`OMLX_BASE_URL=http://127.0.0.1:18080 OMLX_TEST_MODEL=Qwen3.5-9B-oQ4e-mtp uv run --python python3.12 pytest tests/integration/test_live_tool_calling.py -m integration`. +The selected model must appear in `/v1/models`. Cases cover streaming and +non-streaming tool-call round trips, token usage, chat logprobs and top alternatives, +and chat-backed decision readouts. Enable native MTP in the isolated model settings +to exercise multi-token verification too. Keep the server's base path and `HOME` +isolated so startup cannot overwrite the running service's cluster shim. + +Run `uv run --python python3.12 pytest tests/integration/test_responses_tool_merge.py` +for mocked protocol checks. The Anthropic cases verify that generation and token +counting share the same tools, thinking, reasoning effort, and multimodal +processor options, and that template errors remain visible on both endpoints. + # Qwen3.5 text-only checkpoint tests Run `python -m pytest -q tests/test_oq.py -k Qwen35TextCheckpoint` to check @@ -81,11 +96,15 @@ Run `python -m pytest -q tests/test_engine_teardown.py tests/test_engine_core.py # Claude launcher tests -Run `python -m pytest -q tests/test_cli.py tests/test_integrations.py` to check model selection, saved tier precedence, and the final Claude Code environment. Mixed-context cases verify that the selected initial model is passed through `ANTHROPIC_MODEL` and that the process-wide context and auto-compact limits use the smallest known context window across the initial model and configured tiers. Larger models consequently compact at that shared limit; models without reported limits cannot contribute a limit. +Run `python -m pytest -q tests/test_cli.py tests/test_integrations.py` to check model selection, saved tier precedence, and the final Claude Code environment. Mixed-context cases verify that the selected initial model is passed through `ANTHROPIC_MODEL` and that the process-wide context and auto-compact limits use the smallest known context window across the initial model, configured tiers, and discoverable chat models. Larger models consequently compact at that shared limit; models without reported limits cannot contribute a limit. + +Run `UV_PYTHON=python3.12 uv run --python python3.12 pytest tests/test_integrations.py tests/test_cli.py tests/test_v1_models_visibility.py tests/test_server.py` for Claude gateway discovery. +These tests cover the launch environment, discovery filtering and authentication, unchanged standard model IDs, streaming Messages, token counts, and exposed-profile settings. +Gateway IDs wrap the served ID with `omlx-claude/`, including the initial model and configured tiers. # ModernBERT embedding tests -Run `python -m pytest -q tests/test_modernbert_attention.py tests/test_embedding.py tests/test_mlx_embeddings_compat.py` to check finite padded attention, single-input equivalence, local-window masking, and embedding integration. The attention regression covers fp16, bf16, and fp32 at lengths around the affected SDPA tile boundaries. +Run `python -m pytest -q tests/test_modernbert_attention.py tests/test_embedding.py` to check finite padded attention, single-input equivalence, local-window masking, and embedding integration. The attention regression covers fp16, bf16, and fp32 at lengths around the affected SDPA tile boundaries. # GGUF model tests diff --git a/docs/custom-kernels.md b/docs/custom-kernels.md index fd278f037a..4668c285f9 100644 --- a/docs/custom-kernels.md +++ b/docs/custom-kernels.md @@ -46,6 +46,11 @@ Each package has: ANE offload is off by default. See [Qwen ANE/GPU prefill](experimental/qwen35_ane_prefill.md). +The fork's Qwen MXFP4/MXFP8 prefill wrappers are +`quant_matmul.fast.mxfp4_qmm_t` and `mxfp8_qmm_t`. They share the +`omlx_quant_matmul_kernels.metallib` library with the affine matmul kernels; +there is no separate `qwen35_prefill` extension. + Some kernels are not in this directory. Small JIT kernels (`mx.fast.metal_kernel`) live next to the model code in `omlx/patches`. They compile at runtime and need no build. ## Build diff --git a/docs/demos/claude-discovery.cast b/docs/demos/claude-discovery.cast new file mode 100644 index 0000000000..a5716cb379 --- /dev/null +++ b/docs/demos/claude-discovery.cast @@ -0,0 +1,40 @@ +{"version":2,"width":112,"height":42,"timestamp":1793741315,"idle_time_limit":2.0,"title":"Claude Code discovers local oMLX models"} +[0.024289, "o", "\u001b[2J\u001b[HClaude Code + oMLX: live gateway model discovery\r\n\r\n$ omlx launch claude --port 8001 --model Qwen3.5-9B-oQ4e-mtp\r\n\r\n"] +[2.223665, "o", "Launching Claude Code with model Qwen3.5-9B-oQ4e-mtp...\r\r\n"] +[2.223811, "o", "Launching Claude Code with model Qwen3.5-9B-oQ4e-mtp...\r\r\nAuto-compact window: 262,144 tokens\r\r\n"] +[2.306093, "o", "\u001b7\u001b[r\u001b8\u001b[?25h"] +[2.34369, "o", "\u001b[?2004h\u001b[?2031h\u001b[?1004h"] +[2.343952, "o", "\u001b]0;✳ Claude Code\u0007"] +[2.35575, "o", "\u001b[?1049h\u001b[2J\u001b[H\u001b[?1000h\u001b[?1002h\u001b[?1003h\u001b[?1006h\u001b[?25l\u001b[?25l\u001b[H\r\u001b[1B\u001b[38;2;215;119;87m ▐\u001b[48;2;0;0;0m▛███▛█\u001b[12G\u001b[39m\u001b[49m\u001b[1mClaude Code\u001b[24G\u001b[22m\u001b[38;2;153;153;153mv2.1.311\r\u001b[1B\u001b[38;2;215;119;87m▝▜\u001b[48;2;0;0;0m█████\u001b[49m█▀\u001b[12G\u001b[38;2;153;153;153mQwen3.5-9B-oQ4e-mtp · API Usage Billing\r\u001b[1B\u001b[38;2;215;119;87m ▝▝ ▝▝ \u001b[12G\u001b[38;2;153;153;153m~/project\r\u001b[94C\u001b[34B● high · /effort\r\u001b[1B\u001b[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────\r\u001b[1B\u001b[39m❯ \u001b[7m \r\u001b[1B\u001b[27m\u001b[38;2;136;136;136m────────────────────────────────────────────────────────────────"] +[2.3559, "o", "────────────────────────────────────────────────\r\u001b[2C\u001b[1B\u001b[38;2;255;193;7m⏵⏵ auto mode on\u001b[38;2;153;153;153m (shift+tab to cycle) · ← for agents\u001b[39m\u001b[42;1H\u001b[40;3H"] +[2.368043, "o", "\u001b[>0q\u001b[?u\u001b]7501;?\u0007\u001b[c"] +[5.445684, "o", "\u001b[H\r\u001b[2C\u001b[33B\u001b[38;2;177;185;249m❯ /\u001b[1mmodel\u001b[22m Set the AI \u001b[1mmodel\u001b[22m for Claude Code (currently Qwen3.5-9B-oQ4e-mtp)\r\u001b[2C\u001b[1B\u001b[38;2;153;153;153m /auto-mode-setup Teach auto mode about your environment, plus optional rule tweaks\r\u001b[2C\u001b[1B /code-review Review the current diff or a PR for bugs and cleanups\r\u001b[2C\u001b[1B /update-config Change settings: hooks, permissions, environment variables\r\u001b[2C\u001b[1B /loop Repeat a prompt or command on an interval (e.g. /loop 5m /foo)\u001b[39m\u001b[K\r\u001b[2C\u001b[2B\u001b[38;2;177;185;249m/model\u001b[39m\u001b[7m \r\u001b[38C\u001b[2B\u001b[27m\u001b[K\u001b[42;1H\u001b[40;9H"] +[6.503581, "o", "\u001b[H\r\u001b[22B\u001b[38;2;177;185;249m▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\u001b[95G\u001b[38;2;153;153;153m● high · /effort\u001b[38;2;177;185;249m ▔\r\u001b[3C\u001b[1B\u001b[1mSelect model\r\u001b[3C\u001b[1B\u001b[22m\u001b[38;2;153;153;153mSwitch between Claude models. Your pick becomes the default for new sessions. For other/previous model \r\u001b[3C\u001b[1Bnames, specify with --model.\r\u001b[5C\u001b[2B1. \u001b[39mDefault\u001b[18G(recommended)\u001b[45G\u001b[38;2;153;153;153mUse the default model (currently Qwen3.5-9B-oQ4e-mtp)\r\u001b[3C\u001b[1B\u001b[38;2;177;185;249m❯\u001b[6G\u001b[38;2;153;153;153m2. \u001b[38;2;78;186;101momlx-claude/Qwen3.5-9B-oQ4e-mtp\u001b[42G✔\u001b[45G\u001b[38;2;153;153;153mCustom Opus model\r\u001b[5C\u001b[1B3. \u001b[39mFable\u001b[45G\u001b[38;2;153;153;153mFable 5.1 · Most capable for your hardest and longest-running \r\u001b[44C\u001b[1Btasks · $10/$50 per Mtok\r\u001b[5C\u001b[1B4. \u001b[39momlx-claude/Qw"] +[6.503738, "o", "en3.5-9B-oQ4e-mtp\u001b[45G\u001b[38;2;153;153;153mCustom Sonnet model\r\u001b[5C\u001b[1B5. \u001b[39momlx-claude/Qwen3.5-9B-oQ4e-mtp\u001b[45G\u001b[38;2;153;153;153mCustom Haiku model\r\u001b[2C\u001b[1B\u001b[39m \u001b[38;2;153;153;153m6. \u001b[39mFlint-oQ6e \u001b[38;2;153;153;153mFrom gateway\u001b[39m\u001b[K\r\u001b[2C\u001b[1B \u001b[38;2;153;153;153m7. \u001b[39mQwen3.6-35B-A3B-oQ6e-mtp \u001b[38;2;153;153;153mFrom gateway\u001b[39m\u001b[K\r\u001b[2C\u001b[1B \u001b[38;2;153;153;153m8. \u001b[39mQwen3.8-Flash-Next-oQ4e-mtp \u001b[38;2;153;153;153mF\u001b[47Gom gateway\u001b[39m\u001b[K\r\u001b[2C\u001b[1B \u001b[38;2;153;153;153m9. \u001b[39mgemma-4-12B-it-oQ4e-mtp \u001b[38;2;153;153;153mFrom\u001b[50Ggateway\u001b[39m\u001b[K\r\u001b[2C\u001b[1B \u001b[38;2;153;153;153m10. \u001b[39mgemma-4-26B-A4B-it-oQ6e-mtp \u001b[38;2;153;153;153mFrom gateway\u001b[39m\u001b[K\r\u001b[1B\u001b[K\r\u001b[1B \u001b[38;2;215;119;87m●\u001b[38;2;153;153;153m High effort (default)\u001b[38;2;80;80;80m ←/→ to adjust\r\u001b[1B\u001b[39m\u001b[K\r\u001b[2C\u001b[1B \u001b[38;2;153;153;153mEnter to set as defaul\u001b[27G ·\u001b[30Gs to us\u001b[38G this session only · Esc to cancel\u001b[39m\u001b[42;1H\u001b[29;4H"] +[11.563579, "o", "\u001b(B\u000f\u001b[?2004h\u001b[?1000h\u001b[?1002h\u001b[?1003h\u001b[?1006h"] +[11.575157, "o", "\u001b[H\r\u001b[3C\u001b[28B \r\u001b[3C\u001b[1B\u001b[38;2;177;185;249m❯\u001b[10GFable\u001b[39m\u001b[42;1H\u001b[30;4H"] +[11.881689, "o", "\u001b[H\r\u001b[3C\u001b[29B \u001b[10GFable\r\u001b[3C\u001b[2B\u001b[38;2;177;185;249m❯\u001b[10Gomlx-claude/Qwen3.5-9B-oQ4e-mtp\u001b[39m\u001b[42;1H\u001b[32;4H"] +[12.191094, "o", "\u001b[H\r\u001b[3C\u001b[31B \u001b[10Gomlx-claude/Qwen3.5-9B-oQ4e-mtp\r\u001b[3C\u001b[1B\u001b[38;2;177;185;249m❯\u001b[10Gomlx-claude/Qwen3.5-9B-oQ4e-mtp\u001b[39m\u001b[42;1H\u001b[33;4H"] +[12.356264, "o", "\u001b[H\r\u001b[93C\u001b[22B\u001b[38;2;177;185;249m▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\u001b[39m\u001b[42;1H\u001b[33;4H"] +[12.495979, "o", "\u001b[H\r\u001b[3C\u001b[32B \u001b[10Gomlx-claude/Qwen3.5-9B-oQ4e-mtp\r\u001b[3C\u001b[1B\u001b[38;2;177;185;249m❯\u001b[10GFlint-oQ6e\u001b[39m\u001b[42;1H\u001b[34;4H"] +[12.804536, "o", "\u001b[H\r\u001b[3C\u001b[33B \u001b[10GFlint-oQ6e\r\u001b[3C\u001b[1B\u001b[38;2;177;185;249m❯\u001b[10GQwen3.6-35B-A3B-oQ6e-mtp\u001b[39m\u001b[42;1H\u001b[35;4H"] +[13.11077, "o", "\u001b[H\r\u001b[3C\u001b[34B \u001b[10GQwen3.6-35B-A3B-oQ6e-mtp\r\u001b[3C\u001b[1B\u001b[38;2;177;185;249m❯\u001b[10GQwen3.8-Flash-Next-oQ4e-mtp\u001b[39m\u001b[42;1H\u001b[36;4H"] +[13.42195, "o", "\u001b[H\r\u001b[3C\u001b[35B \u001b[10GQwen3.8-Flash-Next-oQ4e-mtp\r\u001b[3C\u001b[1B\u001b[38;2;177;185;249m❯\u001b[10Ggemma-4-12B-it-oQ4e-mtp\u001b[39m\u001b[42;1H\u001b[37;4H"] +[16.758564, "o", "\u001b[H\r\u001b[11C\u001b[2B\u001b[38;2;153;153;153mgemma-4\u001b[20G12B-it-oQ4e-mtp ·\u001b[38GAPI Usage Billing\r\u001b[4B\u001b[48;2;55;55;55m❯\u001b[39m \u001b[38;2;255;255;255m/model\u001b[39m \r\u001b[1B\u001b[49m\u001b[38;2;153;153;153m ⎿ \u001b[39mSet\u001b[10Gmodel\u001b[16Gto\u001b[19G\u001b[38;2;177;185;249mgemma-4-12B-it-oQ4e-mtp\u001b[43G\u001b[39mfor\u001b[47Gthis\u001b[52Gsession\u001b[60Gonly\r\u001b[15B\u001b[K\r\u001b[3C\u001b[1B\u001b[K\r\u001b[3C\u001b[1B\u001b[K\r\u001b[3C\u001b[1B\u001b[K\r\u001b[5C\u001b[2B\u001b[K\r\u001b[5C\u001b[1B\u001b[K\r\u001b[5C\u001b[1B\u001b[K\r\u001b[44C\u001b[1B\u001b[K\r\u001b[5C\u001b[1B\u001b[K\r\u001b[5C\u001b[1B\u001b[K\r\u001b[5C\u001b[1B\u001b[K\r\u001b[5C\u001b[1B\u001b[K\r\u001b[5C\u001b[1B\u001b[K\r\u001b[3C\u001b[1B\u001b[K\r\u001b[5C\u001b[1B \u001b[45G \u001b[95G\u001b[38;2;153;153;153m● high · /effort\r\u001b[1B\u001b[38;2;136;136;136m───────────────────────────────────────────────────────────────────────────────────────────────────────────────"] +[16.758572, "o", "─\r\u001b[1B\u001b[39m❯ \u001b[7m \u001b[27m\u001b[K\r\u001b[1B\u001b[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────\r\u001b[2C\u001b[1B\u001b[38;2;255;193;7m⏵⏵ auto mode on\u001b[38;2;153;153;153m (shift+\u001b[27Gab\u001b[30Gto cycl\u001b[38G)\u001b[39m\u001b[K\u001b[42;1H\u001b[40;3H"] +[21.78426, "o", "\u001b(B\u000f\u001b[?2004h\u001b[?1000h\u001b[?1002h\u001b[?1003h\u001b[?1006h"] +[21.805903, "o", "\u001b[H\r\u001b[2C\u001b[33B\u001b[38;2;177;185;249m❯ /\u001b[1mmodel\u001b[22m Set the AI \u001b[1mmodel\u001b[22m for Claude Code (currently gemma-4-12B-it-oQ4e-mtp)\r\u001b[2C\u001b[1B\u001b[38;2;153;153;153m /auto-mode-setup Teach auto mode about your environment, plus optional rule tweaks\r\u001b[2C\u001b[1B /code-review Review the current diff or a PR for bugs and cleanups\r\u001b[2C\u001b[1B /update-config Change settings: hooks, permissions, environment variables\r\u001b[2C\u001b[1B /loop Repeat a prompt or command on an interval (e.g. /loop 5m /foo)\u001b[39m\u001b[K\r\u001b[2C\u001b[2B\u001b[38;2;177;185;249m/model\u001b[39m\u001b[7m \u001b[27m\u001b[42;1H\u001b[40;9H"] +[22.863241, "o", "\u001b[H\r\u001b[22B\u001b[38;2;177;185;249m▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\u001b[95G\u001b[38;2;153;153;153m● high · /effort\u001b[38;2;177;185;249m ▔\r\u001b[3C\u001b[1B\u001b[1mSelect model\r\u001b[3C\u001b[1B\u001b[22m\u001b[38;2;153;153;153mSwitch between Claude models. Your pick becomes the default for new sessions. For other/previous model \r\u001b[3C\u001b[1Bnames, specify with --model.\r\u001b[5C\u001b[2B1. \u001b[39mDefault\u001b[18G(recommended)\u001b[43G\u001b[38;2;153;153;153mUse the default model (currently Qwen3.5-9B-oQ4e-mtp)\r\u001b[5C\u001b[1B2. \u001b[39momlx-claude/Qwen3.5-9B-oQ4e-mtp\u001b[43G\u001b[38;2;153;153;153mCustom Opus model\r\u001b[5C\u001b[1B3. \u001b[39mFable\u001b[43G\u001b[38;2;153;153;153mFable 5.1 · Most capable for your hardest and longest-running tasks\r\u001b[42C\u001b[1B· $10/$50 per Mtok\r\u001b[5C\u001b[1B4. \u001b[39momlx-claude/Qwen3.5-9B-oQ4e-mtp\u001b[43G\u001b[38;2;153;153;153mCustom Sonnet model\r\u001b[5C\u001b["] +[22.863419, "o", "1B5. \u001b[39momlx-claude/Qwen3.5-9B-oQ4e-mtp\u001b[43G\u001b[38;2;153;153;153mCustom Haiku model\r\u001b[2C\u001b[1B\u001b[39m \u001b[38;2;153;153;153m6. \u001b[39mFlint-oQ6e \u001b[38;2;153;153;153mFrom gateway\u001b[39m\u001b[K\r\u001b[2C\u001b[1B \u001b[38;2;153;153;153m7. \u001b[39mQwen3.6-35B-A3B-oQ6e-mtp \u001b[38;2;153;153;153mFr\u001b[46Gm g\u001b[50Gteway\u001b[39m\u001b[K\r\u001b[2C\u001b[1B \u001b[38;2;153;153;153m8. \u001b[39mQwen3.8-Flash-Next-oQ4e-mtp \u001b[38;2;153;153;153mFrom ga\u001b[51Geway\u001b[39m\u001b[K\r\u001b[2C\u001b[1B \u001b[38;2;177;185;249m❯\u001b[39m \u001b[38;2;153;153;153m9. \u001b[38;2;78;186;101mgemma-4-12B-it-oQ4e-mtp\u001b[39m \u001b[38;2;78;186;101m✔\u001b[39m \u001b[38;2;153;153;153mFrom gateway\u001b[39m\u001b[K\r\u001b[2C\u001b[1B \u001b[38;2;153;153;153m10. \u001b[39mgemma-4-26B-A4B-it-oQ6e-mtp \u001b[38;2;153;153;153mFrom gateway\u001b[39m\u001b[K\r\u001b[1B\u001b[K\r\u001b[1B \u001b[38;2;215;119;87m●\u001b[38;2;153;153;153m High effort (default)\u001b[38;2;80;80;80m ←/→ to adjust\r\u001b[1B\u001b[39m\u001b[K\r\u001b[2C\u001b[1B \u001b[38;2;153;153;153mEnter to set as defaul\u001b[27G ·\u001b[30Gs to us\u001b[38G this session only · Esc to cancel\u001b[39m\u001b[42;1H\u001b[37;4H"] +[26.762355, "o", "\u001b[H\r\u001b[93C\u001b[22B\u001b[38;2;177;185;249m▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\u001b[39m\u001b[42;1H\u001b[37;4H"] +[27.923414, "o", "\u001b(B\u000f\u001b[?2004h\u001b[?1000h\u001b[?1002h\u001b[?1003h\u001b[?1006h"] +[27.998623, "o", "\u001b[H\r\u001b[9B\u001b[48;2;55;55;55m\u001b[38;2;153;153;153m❯\u001b[39m \u001b[38;2;255;255;255m/model\u001b[39m \r\u001b[1B\u001b[49m\u001b[38;2;153;153;153m ⎿ \u001b[39mKept\u001b[11Gmodel\u001b[17Gas\u001b[20G\u001b[38;2;177;185;249mgemma-4-12B-it-oQ4e-mtp\r\u001b[12B\u001b[39m\u001b[K\r\u001b[3C\u001b[1B\u001b[K\r\u001b[3C\u001b[1B\u001b[K\r\u001b[3C\u001b[1B\u001b[K\r\u001b[5C\u001b[2B\u001b[K\r\u001b[5C\u001b[1B\u001b[K\r\u001b[5C\u001b[1B\u001b[K\r\u001b[42C\u001b[1B\u001b[K\r\u001b[5C\u001b[1B\u001b[K\r\u001b[5C\u001b[1B\u001b[K\r\u001b[5C\u001b[1B\u001b[K\r\u001b[5C\u001b[1B\u001b[K\r\u001b[5C\u001b[1B\u001b[K\r\u001b[3C\u001b[1B\u001b[K\r\u001b[5C\u001b[1B \u001b[43G \u001b[95G\u001b[38;2;153;153;153m● high · /effort\r\u001b[1B\u001b[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────\r\u001b[1B\u001b[39m❯ \u001b[7m \u001b[27m\u001b[K\r\u001b[1B\u001b[38;2;136;136;136m─────────────────────────────────────────────────"] +[27.998632, "o", "───────────────────────────────────────────────────────────────\r\u001b[2C\u001b[1B\u001b[38;2;255;193;7m⏵⏵ auto mode on\u001b[38;2;153;153;153m (shift+\u001b[27Gab\u001b[30Gto cycl\u001b[38G)\u001b[39m\u001b[K\u001b[42;1H\u001b[40;3H"] +[28.928952, "o", "\u001b[?1006l\u001b[?1003l\u001b[?1002l\u001b[?1000l"] +[28.929938, "o", "\u001b[?25h"] +[28.930186, "o", "\u001b[?1004l\u001b[4m\u001b[>4m\u001b[4m\u001b[?1004l\u001b[?2031l\u001b[?2004l\u001b[