# Running Openmed Ondevice

Run OpenMed models fully on-device with the MLX (Apple Silicon), CoreML (iOS/macOS), or...

- Repository: https://github.com/maziyarpanahi/openmed (5755 stars)
- Category: DevOps
- License: Apache-2.0
- Last updated: 2026-10-31
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add maziyarpanahi/openmed --skill running-openmed-ondevice -g -a claude-code -y`
Codex: `npx skills add maziyarpanahi/openmed --skill running-openmed-ondevice -g -a codex -y`
Cursor: `npx skills add maziyarpanahi/openmed --skill running-openmed-ondevice -g -a cursor -y`
Gemini CLI: `npx skills add maziyarpanahi/openmed --skill running-openmed-ondevice -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add maziyarpanahi/openmed`

## Description

Run OpenMed models fully on-device with the MLX (Apple Silicon), CoreML (iOS/macOS), or ONNX/WebGPU (cross-platform/browser) backends, including convert-quantize-run workflows. Use when the user wants to deploy OpenMed at the edge, run NER/de-id on Apple Silicon, target iPhone/iPad/Mac, export to ONNX or WebGPU, quantize a clinical model to int8/4-bit, run with no network, or pick between MLX/CoreML/ONNX. Covers the mlx/coreml/onnx extras, the convert() functions and python -m convert CLIs, quantization, loading a local MLX artifact through analyze_text, OpenMedMLXLanguageModel/generate_text, and the on-device-only PHI guarantee (nothing leaves the host).

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Running OpenMed on-device

OpenMed runs **fully on-device** by design. These three backends let you take it
further at the edge: **MLX** (Apple Silicon acceleration), **CoreML** (iOS/macOS
/ Neural Engine), and **ONNX / WebGPU** (cross-platform and in-browser). The
flow is the same: **convert → (quantize) → run locally**. Because inference is
local, raw PHI never leaves the device, the strongest privacy posture OpenMed
offers.

## When to use this skill

When you need OpenMed where there is no server: an iOS/macOS app (CoreML),
fast NER/de-id on an Apple Silicon Mac (MLX), or a portable/browser deployment
(ONNX/WebGPU). For a hosted endpoint use `serving-openmed-rest-api`; for an
agent tool use `deploying-openmed-mcp`; for corpora use
`batch-processing-clinical-text`.

## Pick a backend

| Backend | Extra | Best for | Quantization |
| --- | --- | --- | --- |
| **MLX** | `openmed[mlx]` | Apple Silicon Macs; fastest local NER/de-id; on-device LLMs | 4-bit / 8-bit weights |
| **CoreML** | `openmed[coreml]` | iOS/iPadOS/macOS apps, Neural Engine | int8 palettization |
| **ONNX / WebGPU** | `openmed[onnx]` | cross-platform runtimes, browser (transformers.js) | fp16 (WebGPU); int8 via ORT |

## Quick start, MLX (Apple Silicon)

```bash
pip install "openmed[mlx]"

# Convert a HF token-classification model to an OpenMed MLX artifact, 8-bit:
python -m openmed.mlx.convert --model OpenMed/<some-ner-model> --output ./mlx_ner --quantize 8
```

```python
import openmed

# Run NER/de-id through the normal API, pass the local artifact dir as model_name.
# The loader auto-detects the MLX backend from the artifact (or set backend explicitly).
result = openmed.analyze_text(
    "Patient received 75mg clopidogrel for NSTEMI.",
    model_name="./mlx_ner",          # local MLX artifact directory
    output_format="dict",
)

The rest: https://github.com/maziyarpanahi/openmed/blob/HEAD/skills/running-openmed-ondevice/SKILL.md
