npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sinamtz/pi-mlx-provider

v0.1.1

Published

Pi coding agent provider for MLX local AI models on Apple Silicon

Readme

Pi Provider - MLX Local

License: MIT

Note: This is an unofficial, community-built provider. It runs local AI models on Apple Silicon using Apple's MLX framework.

A Pi coding agent provider extension for local AI inference using Apple's MLX framework.

Features

  • Local AI Inference: Run AI models entirely on your Mac (Apple Silicon)
  • No API Costs: Free inference using your local GPU/memory
  • Privacy-First: Your data never leaves your machine
  • Apple Silicon Optimized: Leverages MLX for efficient inference on M1/M2/M3/M4 chips
  • Vision Support: Supports vision-language models for image understanding
  • OpenAI-Compatible: Uses MLX-VLM server with OpenAI-compatible API

Requirements

  • macOS: Monterey 12.3 or later
  • Apple Silicon: M1, M2, M3, or M4 chip
  • Python: 3.10+ with pip
  • MLX-VLM: Installed automatically via /mlx_init

Installation

Option 1: Using pi install (npm)

pi install npm:@sinamtz/pi-mlx-provider

Option 2: Using pi install (git)

pi install git:https://github.com/sinamtz/pi-mlx-provider

Option 3: Install globally via npm

npm install -g @sinamtz/pi-mlx-provider

Option 4: Clone locally

git clone https://github.com/sinamtz/pi-mlx-provider.git
cd pi-mlx-provider
npm install

Configuration

Enable Local AI

  1. Edit ~/.pi/settings.json to add the MLX provider settings:
{
  "mlx-provider": {
    "local_intelligence": true,
    "local_model": true,
    "mlx_model": "mlx-community/gemma-4-e2b-it-4bit",
    "mlx_port": 8080,
    "mlx_host": "127.0.0.1"
  }
}

| Setting | Type | Default | Description | |---------|------|---------|-------------| | local_intelligence | boolean | false | Enable local AI processing | | local_model | boolean | false | Use local model (requires local_intelligence=true) | | mlx_model | string | mlx-community/gemma-4-e2b-it-4bit | MLX model to use | | mlx_port | number | 8080 | Server port | | mlx_host | string | 127.0.0.1 | Server host |

Note: Both local_intelligence AND local_model must be true to enable local mode.

Auto-Start Behavior

The extension automatically starts the MLX server on load when:

  1. Local mode is enabled in settings (local_intelligence and local_model are both true)
  2. A state file exists at ~/.pi/agent/extensions/mlx-settings.json (created by /mlx_init)

This means after running /mlx_init once, the server will automatically start on future loads without needing to re-run /mlx_init.

Usage

Initialize MLX Server (First Time)

pi -e ./pi-mlx-provider
/mlx_init

This will:

  1. Install/upgrade mlx-vlm package
  2. Download the MLX model (first time only)
  3. Start the MLX-VLM server
  4. Save state to ~/.pi/agent/extensions/mlx-settings.json
  5. Register the mlx-local provider

Auto-Start on Future Loads

Once initialized, the server will automatically start on future loads when local mode is enabled. No need to run /mlx_init each time.

Check Server Status

/mlx_status

Stop Server

/mlx_stop

This stops the server and removes the state file, preventing auto-start on future loads.

Select Model

In pi's interactive mode:

/model mlx-local

Or use the model selector UI.

Supported Models

| Model Type | Example | Input | |------------|---------|-------| | Text-only LLM | mlx-community/Llama-3.2-3B-Instruct-4bit | text | | Vision-Language | mlx-community/Qwen2-VL-2B-Instruct-4bit | text, image | | Gemma | mlx-community/gemma-4-e2b-it-4bit | text |

Recommended Models

  • gemma-4-e2b-it-4bit: Good balance of quality and speed (default)
  • Llama-3.2-3B-Instruct-4bit: Fast, good for simple tasks
  • Qwen2-VL-2B-Instruct-4bit: Vision support for image understanding

Troubleshooting

"MLX server is not running"

  • Run /mlx_init to start the server

"Failed to install mlx-vlm"

  • Ensure Python 3.10+ is installed
  • Try: pip3 install --upgrade mlx-vlm

"Model download failed"

  • Check internet connection
  • Ensure sufficient disk space for model files

Port already in use

  • Change mlx_port in settings.json to a different port (e.g., 8081)

Out of memory

  • Use a smaller/quantized model (4bit variants)
  • Close other memory-intensive applications

How It Works

pi agent
    └── pi-mlx-provider extension
            ├── Reads settings from ~/.pi/settings.json
            ├── If local_intelligence + local_model enabled AND state file exists:
            │   ├── Auto-starts mlx-vlm server (or reconnects if already running)
            │   ├── Registers "mlx-local" provider
            │   └── Routes requests to localhost:PORT
            ├── If enabled but no state file:
            │   └── Waits for /mlx_init command
            └── If disabled: uses default cloud provider

State Persistence

The extension maintains state in ~/.pi/agent/extensions/mlx-settings.json:

  • Created by /mlx_init after successful server start
  • Read on extension load to determine if auto-start should occur
  • Removed by /mlx_stop to prevent auto-start on future loads

License

MIT

Contributing

Contributions welcome! Please open an issue or PR on GitHub.