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.
npx agentmods add skills/scouzi1966/maclocal-api/afmnpx skills add scouzi1966/maclocal-api --skill afmgit clone --depth 1 https://github.com/scouzi1966/maclocal-apiWrote 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.
[](https://agentmods.dev/skills/scouzi1966/maclocal-api/afm)<a href="https://agentmods.dev/skills/scouzi1966/maclocal-api/afm"><img src="https://agentmods.dev/badge/skills/scouzi1966/maclocal-api/afm.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00114 | $0.01270 |
| Opus 5 | $0.00057 | $0.00635 |
| Sonnet 5 | $0.00023 | $0.00254 |
| Haiku 4.5 | $0.00011 | $0.00127 |
Grade A, and why
afm scanned grade A with 1 finding 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 4d 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.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
- `curl http://127.0.0.1:9999/health` How it starts
The opening of the file, as written. The whole thing — 120 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AFM Skill
AFM (maclocal-api) is a local OpenAI-compatible API server and CLI for:
- Apple Foundation Models (
afm) - MLX models from Hugging Face (
afm mlx) - Local backend gateway/proxy mode (
afm -g) - Vision OCR/table extraction (
afm vision)
1. Overview and Triggers
Use this skill when working on:
- CLI flags, argument dispatch, or mode routing (
afm,afm mlx,afm vision) - OpenAI-compatible routes (
/v1/chat/completions,/v1/models) - Streaming SSE behavior and response compatibility
- MLX tool calling, parser overrides, reasoning extraction, structured outputs
- Gateway backend discovery/proxying (Ollama, LM Studio, Jan, local OpenAI endpoints)
- Vision OCR and table extraction
- AFMKit provider integration, build scripts, regression tests
2. Key File Reference
| Purpose | File Path |
|---|---|
| CLI modes, flags, single-prompt and stdin behavior | Sources/MacLocalAPI/main.swift |
| Vision command | Sources/MacLocalAPI/VisionCommand.swift |
| Vapor server + route registration | Sources/MacLocalAPI/Server.swift |
| Foundation chat completions controller | Sources/MacLocalAPI/Controllers/ChatCompletionsController.swift |
| MLX chat completions controller | Sources/MacLocalAPI/Controllers/MLXChatCompletionsController.swift |
| Foundation model service | Sources/MacLocalAPI/Models/FoundationModelService.swift |
| MLX model service | Sources/MacLocalAPI/Models/MLXModelService.swift |
| OpenAI request schema | Sources/MacLocalAPI/Models/OpenAIRequest.swift |
| OpenAI response schema | Sources/MacLocalAPI/Models/OpenAIResponse.swift |
| Backend discovery | Sources/MacLocalAPI/Services/BackendDiscoveryService.swift |
| Backend proxying | Sources/MacLocalAPI/Services/BackendProxyService.swift |
| Backend definitions/capabilities | Sources/MacLocalAPI/Models/BackendConfiguration.swift |
| Provider boundary check | Scripts/check-afmkit-consumer-boundary.sh |
| Full bootstrap build | Scripts/build-from-scratch.sh |
What ships with it
10 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- references/api-contract.md 2.5 KB
- references/architecture.md 2.6 KB
- references/cli-and-modes.md 4.3 KB
- references/gateway-discovery-and-proxy.md 2.1 KB
- references/mlx-inference-and-tool-calling.md 2.9 KB
- references/patch-build-test.md 2.0 KB
- test-reports/mlx-model-report-20260226_212226.html 322 KB
- test-reports/mlx-model-report-20260226_212226.jsonl 281 KB
- test-reports/mlx-model-report-20260226_232519.html 323 KB
- test-reports/mlx-model-report-20260226_232519.jsonl 279 KB
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.
- 4d ago First seen · 120 lines · 114 tokens per session scan A 70898fea1355
afm is a skill published in the GitHub repository scouzi1966/maclocal-api (334 stars, last pushed 4d ago), licensed MIT. It adds 114 tokens to every session and 1,270 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
apple-foundation-models-conversation-context-builder
Extract context and build continuation prompts for multi-turn conversations.
apple-foundation-models-dynamic-schemas
Build schemas dynamically at runtime for flexible structured output.
apple-foundation-models-error-recovery
Handle context overflow, refusals, rate limits, and generation errors.
apple-foundation-models-generation-tuning
Tune temperature, sampling, seeds, and token limits for optimal output.
apple-foundation-models-playground-learning
Interactive learning examples and playground experiments for Foundation Models.
apple-foundation-models-session-patterns
Create and configure LanguageModelSession for single-turn and multi-turn conversations.