maziyarpanahi/openmed
Local-first healthcare AI that never leaves the device
Turn clinical text into structured insight with one line of code.
Entity extraction, PII de-identification, and 1,000+ specialized medical models that run entirely on
your own hardware — from a one-liner in Python to a native Swift app on iPhone, powered by Apple MLX.
No cloud. No vendor lock-in. No patient data leaving your network.
1,000+ models · 12 languages · 247 PII checkpoints · 100% on-device · Apache-2.0
English · 简体中文 · Español · Français · Deutsch · Italiano · Português · Nederlands · العربية · हिन्दी · తెలుగు · 日本語 · Türkçe · فارسی
See it in action
OpenMed runs entirely on the device — clinical text never leaves it. Here it is on iPhone, fully offline:
On iPhone via OpenMedKit — scan a clinical note, de-identify it, and extract clinical signals, all locally with Apple MLX. Nothing is uploaded.
Real-time PII de-identification — the Nemotron Privacy Filter redacting names, addresses, IDs, and billing data from a clinical discharge packet, entirely on-device. (All values shown are synthetic.)
30-second example
|
|
A state-of-the-art clinical NER model running locally — no API key, no network call.
Why OpenMed?
| OpenMed | Cloud medical APIs | |
|---|---|---|
| Runs on your device / servers | ✅ | ❌ |
| Patient data leaves your network | Never | Sent to the vendor |
| Cost | Free & open-source | Per-call pricing |
| Specialized medical models | 1,000+ | Limited |
| Languages | 12+ | Varies |
| Offline / air-gapped | ✅ | ❌ |
| Apple Silicon (MLX) acceleration | ✅ | n/a |
| Native iOS / macOS apps | ✅ via OpenMedKit | ❌ |
| Vendor lock-in | None — Apache-2.0 | Yes |
- Specialized models — 1,000+ curated biomedical & clinical models, many outperforming proprietary stacks.
- HIPAA-aware de-identification — all 18 Safe Harbor identifiers, smart entity merging, format-preserving fakes.
- Runs everywhere — CPU, CUDA, Apple Silicon (MLX), and natively in iOS/macOS apps via OpenMedKit.
- One-line deployment — Python API, Dockerized REST service, or batch pipelines.
- Zero lock-in — Apache-2.0, your infrastructure, your data.
On-device on Apple — Swift, MLX & iOS
OpenMed is built to run where your data already lives. On Apple hardware it accelerates with MLX, and it ships straight into iPhone, iPad, and Mac apps through OpenMedKit — so PII detection and clinical extraction happen fully offline, on the device.
|
|
- MLX runtime for PII token classification, the Privacy Filter family, and experimental GLiNER-family zero-shot tasks — with a CoreML fallback path.
- One model name, every platform — MLX model names automatically fall back to the matching PyTorch checkpoint on non-Apple hardware.
- Python on Apple Silicon too:
pip install "openmed[mlx]".
Guides: MLX backend · OpenMedKit (Swift) · CoreML export
MLX on Apple Silicon: 24–33× faster than CPU PyTorch for the Privacy Filter — median latency per inference step, lower is better.
How it works
flowchart LR
A["Clinical text"] --> B["OpenMed<br/>(100% on-device)"]
B --> C["Medical entities"]
B --> D["PII detected"]
B --> E["De-identified text"]
style B fill:#0D6E6E,stroke:#0A5656,stroke-width:2px,color:#ffffff
style C fill:#D6EBEB,stroke:#0D6E6E,color:#0E1116
style D fill:#F7DCD8,stroke:#C5453A,color:#0E1116
style E fill:#F5E27A,stroke:#A9A088,color:#0E1116
Quick start
|
|
|
Python API
|
REST service
|
Batch
|
Offline / air-gapped? Point model_name (or model_id) at a local directory and OpenMed loads it without contacting the Hugging Face Hub:
|
|
Models
A curated registry of specialized medical NER models — browse the full catalog.
| Model | Specialization | Entity types | Size |
|---|---|---|---|
disease_detection_superclinical |
Disease & conditions | DISEASE, CONDITION, DIAGNOSIS | 434M |
pharma_detection_superclinical |
Drugs & medications | DRUG, MEDICATION, TREATMENT | 434M |
pii_superclinical_large |
PII & de-identification | NAME, DATE, SSN, PHONE, EMAIL, ADDRESS | 434M |
anatomy_detection_electramed |
Anatomy & body parts | ANATOMY, ORGAN, BODY_PART | 109M |
gene_detection_genecorpus |
Genes & proteins | GENE, PROTEIN | 109M |
Privacy: PII detection & de-identification
|
|
- Smart entity merging keeps
01/15/1970whole instead of fragmenting it. - Faker-backed obfuscation with custom clinical-ID providers (CPF, CNPJ, BSN, NIR, Codice Fiscale, NIE, Aadhaar, Steuer-ID, NPI).
- HIPAA: all 18 Safe Harbor identifiers, configurable confidence thresholds.
- Batch PII (v1.5.5): extract or de-identify across many documents with
BatchProcessor(operation="extract_pii" | "deidentify", batch_size=16).
Batch processing — up to 3.3× higher throughput on CPU and 2.2× on MLX vs. one document at a time.
Complete PII notebook · Smart merging · Anonymization
Privacy Filter family — three model families on the OpenAI Privacy Filter architecture
Same model code (gpt-oss-style sparse-MoE transformer with local attention, sink tokens, RoPE+YaRN, tiktoken o200k_base), different training data. All route through the same extract_pii() / deidentify() API — only model_name= changes.
| Variant | PyTorch (CPU + CUDA) | MLX (Apple Silicon) | MLX 8-bit |
|---|---|---|---|
| OpenAI Privacy Filter | openai/privacy-filter |
OpenMed/privacy-filter-mlx |
…-mlx-8bit |
| Nemotron-PII fine-tune | OpenMed/privacy-filter-nemotron |
…-nemotron-mlx |
…-nemotron-mlx-8bit |
| OpenMed Multilingual | OpenMed/privacy-filter-multilingual |
…-multilingual-mlx |
…-multilingual-mlx-8bit |
|
|
On non-Apple-Silicon hosts, MLX model names are automatically substituted with the matching PyTorch checkpoint (with a one-time warning) — ship one model name, run anywhere. See Privacy Filter architecture & backend routing.
Multilingual PII (12 languages)
Extraction and de-identification across en, fr, de, it, es, nl, hi, te, pt, ar, ja, and tr — 247 PII checkpoints total.
|
|
Show per-language examples (Portuguese, Dutch, Hindi, Arabic, Japanese, Turkish)
|
|
REST API
A Docker-friendly FastAPI service with request validation, shared pipeline preload, and unified error envelopes.
|
|
|
|
Model lifecycle (v1.5.5): free memory on demand with GET /models/loaded, POST /models/unload, and a keep_alive idle window:
|
|
See the full REST service guide.
Documentation
Full guides at openmed.life/docs.
| Getting Started | Analyze Text | Model Registry |
| PII Detection Guide | Anonymization | Batch Processing |
| Configuration Profiles | REST Service | MLX Backend |
Meet the mascot
OpenMed’s guardian is a fluffy Persian cat styled as a tiny Avicenna (Ibn Sina) — the great Persian physician whose Canon of Medicine was the world’s standard medical text for some 600 years. He keeps watch over the open book of medical knowledge, in a palette built around Persian turquoise (fīrūza): a local-first guardian for your most private data.
Contributing
Contributions welcome — bug reports, feature requests, and PRs alike.
- Open an issue
- Translations welcome — help complete the other-language READMEs linked in the switcher at the top.
Credits
OpenMed builds on excellent open-source work — particular thanks to OpenAI (the Privacy Filter architecture), NVIDIA (the Nemotron PII dataset), Hugging Face (transformers & the model ecosystem), Apple (MLX), and the Faker maintainers.
License
Released under the Apache-2.0 License.
Citation
|
|
Star History
If OpenMed is useful to you, a star helps others discover it.
Built by the OpenMed team
Website · Docs · X / Twitter · LinkedIn