Skip to content

statico/llmac

Repository files navigation

llmac

Note

This was made with Claude Code and Opus 4.8.

Apple's on-device Foundation Models from the command line. Small, fast, no API key, no network.

Inspired by llm. Requires macOS 26 with Apple Intelligence enabled.

Install

brew install statico/tap/llmac

Or from source: swift build -c release, then copy .build/release/llmac onto your PATH.

Use

llmac "why is the sky blue"
cat error.log | llmac "what went wrong here"
llmac -c "and how do I fix it"                       # continue the last conversation
llmac -x "a bash one-liner to list files by size"    # extract code from fences
llmac -p "summarize this"                            # append clipboard contents

Prompts come from the argument, from piped stdin, or from the clipboard with -p. When both an argument and stdin are present, stdin is appended as context.

command
llmac PROMPT run a prompt
llmac chat REPL (.new, .id, .exit)
llmac models list model configurations
llmac logs list stored conversations; --show prints one
llmac ocr [FILE] recognize text in an image; reads the clipboard if no file
llmac serve OpenAI-compatible API on localhost
llmac shell-init zsh|fish print shell helpers

Conversations live in ~/.llmac/conversations (override with $LLMAC_HOME).

Shell helpers

eval "$(llmac shell-init zsh)"      # zsh
llmac shell-init fish | source      # fish

Defines ask (answer a question, rendered with glow when present) and cmd (produce a shell command and load it into your prompt buffer without running it).

ask "what does chmod 755 mean"
cmd "list subprocesses of pid 1234"

Server

llmac serve --port 8080

Implements GET /v1/models and POST /v1/chat/completions, streaming and non-streaming. Binds to 127.0.0.1. There is no authentication — don't expose it to a network you don't control.

OCR

The model itself cannot accept images until macOS 27, so rather than a fake -a flag, OCR is a separate command that composes through a pipe:

llmac ocr                        # whatever image is on the clipboard
llmac ocr shot.png
llmac ocr | llmac "summarize this"

Uses Vision text recognition, not the model.

Notes and limits

  • Context is 4096 tokens, input and output combined. Resumed conversations are trimmed oldest-first, always keeping the system prompt.
  • Four "models", one engine. Apple exposes a single on-device model with no enumeration API. The four entries are its distinct useCase × guardrails configurations.
  • No embeddings. Apple's two on-device text embedding APIs are both unusable here: NLContextualEmbedding fails to load outside an app bundle ("Embedding model requires compilation"), and NLEmbedding.sentenceEmbedding ranks lexical distractors above correct answers and scores negations and antonyms above true paraphrases. FoundationModels exposes no embedding API at all. Use swift-embeddings if you need real ones.
  • Images, tool calling, structured output schemas, and Private Cloud Compute are out of scope.

Prior art

Apple ships an official fm CLI with macOS 27. apfel is a larger, more featureful third-party CLI. llmac is deliberately smaller, and keeps conversation state on disk so -c and logs just work.

License

MIT

About

Apple's on-device Foundation Models from the command line — tiny, fast, no API key, in the spirit of Simon Willison's llm

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages