How youssofal/mtplx works
MTPLX is a local Apple Silicon language-model runtime with a macOS app, CLI, and monitoring dashboard. The main workflow is choosing and preparing a model, serving it locally, and generating responses with the model’s MTP heads and speculative verification. The map also includes model-building (Forge), cache/session state, and dashboard monitoring. Several runtime relationships are documented in the README; where sampled source does not establish a connection, the edge is marked unverified rather than treated as inspected.
Main entry points: cli.py MTPLX CLI · generation.py Speculative Generation · openai.py HTTP API · MTPLXApp.swift Mac App
Components 22
Setup and Models
- Setup Flow
apps/MTPLXApp/Sources/MTPLXAppCore/Onboarding/OnboardingOrchestrator.swift - Runtime Setup
apps/MTPLXApp/Sources/MTPLXAppCore/Onboarding/RuntimeSetupService.swift - Launch Builder
apps/MTPLXApp/Sources/MTPLXAppCore/Services/MTPLXCommandBuilder.swift - Model Catalog
mtplx/model_catalog.py - Model Forge
mtplx/commands/forge.py
Inference Runtime
- Backend Registry
mtplx/backends/registry.py - Model Backends
mtplx/models/qwen4_exp.py - Speculative Generation
mtplx/generation.py - Runtime Profiles
mtplx/profiles.py - KV Cache
mtplx/cache_state.py - Session Bank
mtplx/session_bank.py - Engine Sessions
mtplx/engine_session.py
Serving and Integrations
- HTTP API
mtplx/server/openai.py - Responses API
mtplx/server/responses.py - Daemon Client
mtplx/daemon_client.py - Client Integrations
mtplx/opencode.py
Monitoring
- Metrics Stream
dashboard/src/hooks/useMetricsStream.ts - Dashboard State
dashboard/src/state/store.ts - Metrics Dashboard
dashboard/src/App.tsx
Other components
- User
Connections 25
- User → Mac App: uses
README.md - User → MTPLX CLI: runs
README.md - Mac App → Setup Flow: starts setup
- Setup Flow → Runtime Setup: prepares runtime
apps/MTPLXApp/Sources/MTPLXAppCore/Onboarding/RuntimeSetupService.swift - Runtime Setup → Launch Builder: configures commands
apps/MTPLXApp/Sources/MTPLXAppCore/Onboarding/RuntimeSetupService.swift - Launch Builder → MTPLX CLI: launches
apps/MTPLXApp/Sources/MTPLXAppCore/Services/MTPLXCommandBuilder.swift - User → Model Catalog: selects model
README.md - MTPLX CLI → Model Catalog: resolves model
- User → Model Forge: creates model
README.md - MTPLX CLI → Backend Registry: loads backend
- Backend Registry → Model Backends: dispatches to
- Model Backends → Speculative Generation: supplies model
- Speculative Generation → Runtime Profiles: uses runtime settings
- Speculative Generation → KV Cache: uses KV state
- Speculative Generation → Session Bank: uses session state
- Session Bank → KV Cache: stores cache state
mtplx/session_bank.py - Engine Sessions → Session Bank: tracks sessions
mtplx/engine_session.py - MTPLX CLI → HTTP API: serves API
README.md - HTTP API → Responses API: offers endpoint
- Daemon Client → HTTP API: attaches to
- Client Integrations → HTTP API: calls API
README.md - Mac App → Metrics Dashboard: offers monitoring
- Metrics Dashboard → Metrics Stream: starts stream
dashboard/src/App.tsx - Metrics Stream → Dashboard State: applies events
dashboard/src/hooks/useMetricsStream.ts - Metrics Dashboard → Dashboard State: reads state
dashboard/src/App.tsx