Maintain and extend AFM (maclocal-api), a Swift OpenAI-compatible local LLM server and CLI for Apple Foundation Models, MLX models, API gateway proxying, and Vision OCR.

MITAuto-check passedAI & LLM Engineering

Install Afm

skills CLI
$ npx skills add scouzi1966/maclocal-api --skill afm -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install scouzi1966/maclocal-api afm --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/scouzi1966/maclocal-api.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/afm .claude/skills/afm && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
afm
GitHub stars
346
Token cost
~1.2k tokens
SKILL.md length
364 words
Files
11 (incl. references)
Skills in repo
12
Repo updated
First seen
Licence
MIT

At a glance

Maintain and extend AFM (maclocal-api), a Swift OpenAI-compatible local LLM server and CLI for Apple Foundation Models, MLX models, API gateway proxying, and Vision OCR.

  • Works in 7 steps: Overview and Triggers → Key File Reference → Core Rules → …
  • Working on AFM CLI commands (afm
  • SKILL.md covers 1. Overview and Triggers, 2. Key File Reference, 3. Core Rules and 4. Quick Start Commands, plus 3 more sections
  • Calls make and curl

What it does

Afm is an agent skill from scouzi1966/maclocal-api. Maintain and extend AFM (maclocal-api), a Swift OpenAI-compatible local LLM server and CLI for Apple Foundation Models, MLX models, API gateway proxying, and Vision OCR. Use when working on AFM CLI commands (afm, afm mlx, afm vision), OpenAI /v1/chat/completions and /v1/models behavior, streaming SSE, tool-calling, structured outputs, reasoning extraction, AFMKit integration, WebUI packaging, or AFM build/test/release scripts.

Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 12 other files, including reference files (for example `references/api-contract.md`, `references/architecture.md` and `references/cli-and-modes.md`).

It sits in AI & LLM Engineering, covering Structured output and tool calling, iOS development and LLM API integration. It works with OpenAI and macOS. The repository describes itself as: 'afm' command cli: macOS server and single prompt mode that exposes Apple's Foundation and MLX Models and other APIs running on your Mac through a single aggregated…. The licence is MIT.

When your agent uses it

  • Working on AFM CLI commands (afm
  • OpenAI /v1/chat/completions and /v1/models behavior
  • Structured outputs
  • Reasoning extraction

Example prompts

  • “/afm”

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  1. Overview and Triggers
  2. Key File Reference
  3. Core Rules
  4. Quick Start Commands
  5. Primary Workflow
  6. Reference Links
  7. Validation Checklist

What it can do on your machine

Read from SKILL.md and the folder at commit 138ca5d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • make
    • curl

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use curl, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Afm loads about 1.2k tokens when it runs, and up to ~5.5k if it reads all its reference files. Until then it costs about 111 tokens; SKILL.md has 364 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~111
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from scouzi1966/maclocal-api at commit 138ca5d, republished under its MIT licence (© scouzi1966). 364 words, ~1,246 tokens.

Download SKILL.mdSave it as .claude/skills/afm/SKILL.md (or your agent's skills folder). This skill also uses 10 other files; get the full folder from GitHub.
name
afm
description
Maintain and extend AFM (maclocal-api), a Swift OpenAI-compatible local LLM server and CLI for Apple Foundation Models, MLX models, API gateway proxying, and Vision OCR. Use when working on AFM CLI commands (`afm`, `afm mlx`, `afm vision`), OpenAI `/v1/chat/completions` and `/v1/models` behavior, streaming SSE, tool-calling, structured outputs, reasoning extraction, AFMKit integration, WebUI packaging, or AFM build/test/release scripts.

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

PurposeFile Path
CLI modes, flags, single-prompt and stdin behaviorSources/MacLocalAPI/main.swift
Vision commandSources/MacLocalAPI/VisionCommand.swift
Vapor server + route registrationSources/MacLocalAPI/Server.swift
Foundation chat completions controllerSources/MacLocalAPI/Controllers/ChatCompletionsController.swift
MLX chat completions controllerSources/MacLocalAPI/Controllers/MLXChatCompletionsController.swift
Foundation model serviceSources/MacLocalAPI/Models/FoundationModelService.swift
MLX model serviceSources/MacLocalAPI/Models/MLXModelService.swift
OpenAI request schemaSources/MacLocalAPI/Models/OpenAIRequest.swift
OpenAI response schemaSources/MacLocalAPI/Models/OpenAIResponse.swift
Backend discoverySources/MacLocalAPI/Services/BackendDiscoveryService.swift
Backend proxyingSources/MacLocalAPI/Services/BackendProxyService.swift
Backend definitions/capabilitiesSources/MacLocalAPI/Models/BackendConfiguration.swift
Provider boundary checkScripts/check-afmkit-consumer-boundary.sh
Full bootstrap buildScripts/build-from-scratch.sh

3. Core Rules

  • Work from maclocal-api/ project root.
  • Keep OpenAI compatibility first: request fields, response shape, SSE chunk format.
  • Keep Foundation and MLX behavior aligned where practical.
  • Treat AFMKit as the only provider source of truth. Use MACLOCAL_AFMKIT_WORKSPACE_PATH for paired development, then bump the exact AFMKit version after its changes are released.
  • Preserve CORS and streaming headers.
  • Keep both streaming and non-streaming paths correct for every new feature.
Show full SKILL.md (132 more words)Show less

4. Quick Start Commands

bash
# Build against the exact AFMKit release
make build

# Debug build
make debug

# Full bootstrap build
./Scripts/build-from-scratch.sh

# Provider boundary
./Scripts/check-afmkit-consumer-boundary.sh

# Run Foundation server
./.build/debug/afm -p 9999 -v

# Run MLX server
./.build/debug/afm mlx -m mlx-community/Qwen3-0.6B-4bit -p 9999 -v

# Single prompt
./.build/debug/afm mlx -m mlx-community/Qwen3-0.6B-4bit -s "hello"

# Vision OCR
./.build/debug/afm vision -f media/ocr.png

5. Primary Workflow

  1. Identify target mode and load only relevant reference files.
  2. Update shared request/response models first when adding API-visible behavior.
  3. Thread parameters through CLI -> server/controller -> service -> response.
  4. Validate non-streaming and streaming paths.
  5. Run targeted checks, then broader regression scripts.
  6. Update README examples if user-visible behavior changed.
ReferenceWhen to Use
references/architecture.mdRoute wiring, lifecycle, cross-mode request flow
references/cli-and-modes.mdFlag behavior, command dispatch, mode defaults
references/api-contract.mdOpenAI request/response compatibility details
references/mlx-inference-and-tool-calling.mdMLX streaming, tool calls, reasoning extraction, multimodal
references/gateway-discovery-and-proxy.mdGateway scans, backend capabilities, proxy normalization
references/patch-build-test.mdVendor patch process, build scripts, regression commands

7. Validation Checklist

  • CLI parse/help:
    • ./.build/debug/afm --help
    • ./.build/debug/afm mlx --help
    • ./.build/debug/afm vision --help
  • Server health/models:
    • curl http://127.0.0.1:9999/health
    • curl http://127.0.0.1:9999/v1/models
  • Regression scripts:
    • ./test-all-features.sh
    • ./Scripts/afm-cli-tests.sh
    • ./test-streaming.sh
    • ./test-go.sh
    • ./test-metrics.sh

© scouzi1966, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 10 other files (references) in skills/afm of scouzi1966/maclocal-api.

  • SKILL.md
  • references/api-contract.md
  • references/architecture.md
  • references/cli-and-modes.md
  • references/gateway-discovery-and-proxy.md
  • references/mlx-inference-and-tool-calling.md
  • references/patch-build-test.md
  • test-reports/mlx-model-report-20260226_212226.html
  • test-reports/mlx-model-report-20260226_212226.jsonl
  • test-reports/mlx-model-report-20260226_232519.html
  • test-reports/mlx-model-report-20260226_232519.jsonl

Open the folder on GitHubat commit 138ca5d

Compare with similar skills

Afm next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Afm compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Afm this skillscouzi1966/maclocal-api346—~1.2kAutomated safety check: PassMIT
AgentSquad for Swift2FastLabs/agent-squad7.8k—~3.5kAutomated safety check: PassApache-2.0
Perfupraullenchai/Rapid-MLX4k—~1.6kAutomated safety check: NotesCustom licence
Azure Openai To Responsesmicrosoft/ai-agents-for-beginners77k—~6kAutomated safety check: NotesMIT
Instructor Structured LLM OutputsOrchestra-Research/AI-Research-SKILLs13k6 repos~4.2kAutomated safety check: PassMIT
Foundation Models App Builderrryam/FoundationModelsKit162—~1.1kAutomated safety check: PassMIT

Similar skills

  • AgentSquad for Swift

    2FastLabs/agent-squad

    Guides building on-device multi-agent apps in Swift with the AgentSquad framework: which agent, orchestrator, classifier, storage or voice type fits each situation.

    7.8k GitHub stars~3.5k tokensUpdated 2 days ago
    AI & LLM EngineeringAuto-check passed
  • Perfup

    raullenchai/Rapid-MLX

    Autonomous performance optimization: research, PoC, benchmark, implement, review, PR

    4k GitHub stars~1.6k tokensUpdated today
    AI & LLM EngineeringAuto-check: notes
  • Azure Openai To Responses

    microsoft/ai-agents-for-beginners

    Official

    Migrate Python apps from Azure OpenAI Chat Completions to the Responses API.

    77k GitHub stars~6k tokensUpdated today
    AI & LLM EngineeringAuto-check: notes
  • Instructor Structured LLM Outputs

    Orchestra-Research/AI-Research-SKILLs

    Shows how to pull validated, typed data out of LLM responses with Instructor and Pydantic models, including retries on failure and partial streaming.

    13k GitHub starsUsed in 6 repos~4.2k tokens
    AI & LLM EngineeringAuto-check passed
  • Foundation Models App Builder

    rryam/FoundationModelsKit

    Build or modify Apple Foundation Models features in Swift, SwiftUI, iOS, and macOS apps.

    162 GitHub stars~1.1k tokensUpdated 9 days ago
    AI & LLM EngineeringAuto-check passed
  • Azure Openai To Responses

    microsoft/ai-agents-for-beginners

    Official

    Shift Python apps dem from Azure OpenAI Chat Completions go Responses API.

    77k GitHub stars~6k tokensUpdated today
    AI & LLM EngineeringAuto-check: notes

More from scouzi1966/maclocal-api

All 12 skills in this repo
  • Build Afm

    scouzi1966/maclocal-api

    Build AFM from scratch — submodules, patches, webui, and Swift build.

    346 GitHub stars~1.8k tokensUpdated today
    Auto-check: notes
  • Codex Promptfoo Agentic Eval

    scouzi1966/maclocal-api

    Run and review the Promptfoo-based AFM agentic evaluation suite.

    346 GitHub stars~1.8k tokensUpdated today
    Auto-check passed
  • Test Afm Binary

    scouzi1966/maclocal-api

    Test a pre-built afm binary at any path — runs pre-flight safety checks, then any combination of unit tests, assertions, smart analysis, promptfoo evals, batch validation, OpenAI compat, GPU…

    346 GitHub stars~3.8k tokensUpdated today
    Auto-check passed
  • Afm Release Wheel

    scouzi1966/maclocal-api

    A skill your agent uses when user wants to build a PyPI wheel from an existing compiled afm binary and publish to PyPI.

    346 GitHub stars~1.5k tokensUpdated today
    Auto-check: warnings
  • Test Macafm

    scouzi1966/maclocal-api

    Run the maclocal-api (AFM/MLX) test suite — automated assertions and smart analysis.

    346 GitHub stars~7k tokensUpdated today
    Auto-check passed
  • Test Opencode Tooling

    scouzi1966/maclocal-api

    A skill your agent uses when testing tool call reliability between OpenCode and afm — captures streaming XML tool call errors, classifies them as afm translation bugs vs model generation errors, and…

    346 GitHub stars~4.2k tokensUpdated today
    Auto-check passed

Works with

Questions about Afm

What does Afm do?

Maintain and extend AFM (maclocal-api), a Swift OpenAI-compatible local LLM server and CLI for Apple Foundation Models, MLX models, API gateway proxying, and Vision OCR. Afm is an agent skill from scouzi1966/maclocal-api. Maintain and extend AFM (maclocal-api), a Swift OpenAI-compatible local LLM server and CLI for Apple Foundation Models, MLX models, API gateway proxying, and Vision OCR.

When should I use Afm?

Afm fits situations like: working on AFM CLI commands (afm; openAI /v1/chat/completions and /v1/models behavior; structured outputs; reasoning extraction.

How do I install Afm in Claude Code?

Run `npx skills add scouzi1966/maclocal-api --skill afm -a claude-code`. Or copy the skill folder (skills/afm in scouzi1966/maclocal-api) into .claude/skills/afm in your project. Claude Code loads it when a task matches its description.

How do I install Afm in Codex?

Run `npx skills add scouzi1966/maclocal-api --skill afm -a codex`. Or copy the skill folder (skills/afm in scouzi1966/maclocal-api) into .agents/skills/afm in your project. Codex loads it when a task matches its description.

Can I use Afm in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add scouzi1966/maclocal-api --skill afm -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/afm, .gemini/skills/afm, .github/skills/afm and .opencode/skills/afm in your project.

What does Afm need to run?

Going by SKILL.md and its folder, Afm needs the command-line tools its instructions call (make and curl).

Does Afm access the network?

SKILL.md contains no URLs. Its commands use curl, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Afm safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Afm use?

Afm is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Afm use?

About 1.2k tokens (SKILL.md is roughly 5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 4.2k tokens, read only when the agent opens those files.

What are the alternatives to Afm?

Skills that share tags, products or a category with Afm: AgentSquad for Swift (2FastLabs/agent-squad, 7.8k stars), Perfup (raullenchai/Rapid-MLX, 4k stars), Azure Openai To Responses (microsoft/ai-agents-for-beginners, 77k stars) and Instructor Structured LLM Outputs (Orchestra-Research/AI-Research-SKILLs, 13k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Afm?

scouzi1966 (a GitHub user) maintains it in scouzi1966/maclocal-api, which has 346 GitHub stars. The repository holds 12 skills in this directory. The repository was last updated on October 10, 2026.

Source: scouzi1966/maclocal-api on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.