swift-mlx-lm

swift-mlx-lm is a skill for Claude Code, Codex from PicoMLX/mlx-swift-lm-skill. It costs 52 tokens per session (3,448 once invoked), scanned A, a copy of swift-mlx-lm, MIT.

A Swift package for running language and vision-language models locally on Apple Silicon, the processors used in modern Macs and some Apple devices.

In plain words
What is it for?
It supports local text and image-aware generation, streaming output, tool calls, embeddings for semantic search, memory coordination, model porting, and LoRA or DoRA fine-tuning.
Why use it?
It lets developers work with AI models on supported Apple hardware without relying solely on a remote service.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It supports local text and image-aware generation, streaming output, tool calls, embeddings for semantic search, memory coordination, model porting, and LoRA or DoRA fine-tuning.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/picomlx/mlx-swift-lm-skill/mlx-swift-lm
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add PicoMLX/mlx-swift-lm-skill --skill mlx-swift-lm
Clone the repo
git clone --depth 1 https://github.com/PicoMLX/mlx-swift-lm-skill

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for swift-mlx-lm

README.md
[![agentmods](https://agentmods.dev/badge/skills/picomlx/mlx-swift-lm-skill/mlx-swift-lm/github.svg)](https://agentmods.dev/skills/picomlx/mlx-swift-lm-skill/mlx-swift-lm)
Your own site
<a href="https://agentmods.dev/skills/picomlx/mlx-swift-lm-skill/mlx-swift-lm"><img src="https://agentmods.dev/badge/skills/picomlx/mlx-swift-lm-skill/mlx-swift-lm/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for swift-mlx-lm

Your own site · 80×15
<a href="https://agentmods.dev/skills/picomlx/mlx-swift-lm-skill/mlx-swift-lm"><img src="https://agentmods.dev/badge/skills/picomlx/mlx-swift-lm-skill/mlx-swift-lm.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,448 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00052 $0.03448
Opus 5 $0.00026 $0.01724
Sonnet 5 $0.00010 $0.00690
Haiku 4.5 $0.00005 $0.00345

Measured 11d ago against content hash d50bfd77c1e7, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

swift-mlx-lm scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to swift-mlx-lm — 14 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

mlx-swift-lm/SKILL.md · 420 lines

How it starts

The opening of the file, as written. The whole thing — 420 lines — stays where its author put it; the contents beside it link to each section on GitHub.

mlx-swift-lm Skill

1. Overview & Triggers

mlx-swift-lm is a Swift package for running Large Language Models (LLMs) and Vision-Language Models (VLMs) on Apple Silicon using MLX. It supports local inference, streaming generation, wired-memory coordination, tool calling, LoRA/DoRA fine-tuning, and embeddings.

When to Use This Skill

  • Running LLM/VLM inference on macOS/iOS with Apple Silicon
  • Streaming text generation from local models
  • Coordinating concurrent inference with wired-memory policies and tickets
  • Tool calling / function calling with models
  • LoRA adapter training and fine-tuning
  • Text embeddings for RAG/semantic search
  • Porting model architectures from Python MLX-LM to Swift

Architecture Overview

MLXLMCommon     - Core infra (ModelContainer, ChatSession, Evaluate, KVCache, wired memory helpers)
MLXLLM          - Text-only LLM support (Llama, Qwen, Gemma, Phi, DeepSeek, etc.)
MLXVLM          - Vision-Language Models (Qwen-VL, PaliGemma, Gemma3, etc.)
MLXEmbedders    - Embedding models and pooling utilities

2. Key File Reference

Purpose File Path
Thread-safe model wrapper Libraries/MLXLMCommon/ModelContainer.swift
Simplified chat API Libraries/MLXLMCommon/ChatSession.swift
Generation & streaming APIs Libraries/MLXLMCommon/Evaluate.swift
KV cache types Libraries/MLXLMCommon/KVCache.swift
Wired-memory policies Libraries/MLXLMCommon/WiredMemoryPolicies.swift
Wired-memory measurement helpers Libraries/MLXLMCommon/WiredMemoryUtils.swift
Model configuration Libraries/MLXLMCommon/ModelConfiguration.swift
Chat message types Libraries/MLXLMCommon/Chat.swift
Tool call processing Libraries/MLXLMCommon/Tool/ToolCallFormat.swift
Concurrency utilities Libraries/MLXLMCommon/Utilities/SerialAccessContainer.swift
LLM factory & registry Libraries/MLXLLM/LLMModelFactory.swift
VLM factory & registry Libraries/MLXVLM/VLMModelFactory.swift
LoRA configuration Libraries/MLXLMCommon/Adapters/LoRA/LoRAContainer.swift
LoRA training Libraries/MLXLLM/LoraTrain.swift

Read the full file on GitHub · 420 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 420 lines · 52 tokens per session scan A d50bfd77c1e7

Subscribe to this mod's changes

swift-mlx-lm is a skill published in the GitHub repository PicoMLX/mlx-swift-lm-skill (24 stars, last pushed 6mo ago), licensed MIT. It adds 52 tokens to every session and 3,448 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to swift-mlx-lm, differing in 14 lines, and is treated as a copy.