Skip to main content

LLM plugin for Apple Foundation Models (Apple Intelligence)

Project description

llm-apple

LLM plugin for Apple Foundation Models (Apple Intelligence)

This plugin exposes Apple's on-device Foundation Models through the llm CLI tool.

Requirements

  • macOS 15.1 or later
  • Apple Silicon (M1/M2/M3/M4) or compatible device
  • Apple Intelligence enabled
  • Python 3.8 or later
  • apple-foundation-models-py installed

Installation

First, install apple-foundation-models:

# Clone and install apple-foundation-models-py
git clone https://github.com/btucker/apple-foundation-models-py
cd apple-foundation-models-py
pip install -e .

Then install this plugin:

# Install from path
llm install -e /path/to/llm-apple

# Or from current directory
cd llm-apple
llm install -e .

Note: apple-foundation-models is a runtime dependency that requires building from source with Xcode Command Line Tools installed. It's not required for running tests, which use mocks.

Usage

Basic usage:

llm -m apple "What is the capital of France?"

With streaming:

llm -m apple "Tell me a story" --stream

With options:

llm -m apple "Write a poem" -o temperature 1.5 -o max_tokens 500

With system instructions:

llm -m apple "What is Python?" -o instructions "You are a helpful programming tutor"

Conversations

The plugin supports conversations, maintaining context across multiple prompts:

# Start a conversation
llm -m apple "My name is Alice" --save conversation1

# Continue the conversation
llm -m apple "What is my name?" --continue conversation1

Available Options

  • temperature (float, 0.0-2.0, default: 1.0): Controls randomness in generation
    • 0.0 = deterministic
    • 2.0 = very random
  • max_tokens (int, default: 1024): Maximum tokens to generate
  • instructions (str): System instructions to guide AI behavior

Availability

The plugin checks Apple Intelligence availability on startup. If Apple Intelligence is not available, you'll see an error message with details on why.

Common reasons:

  • Device not eligible (requires Apple Silicon)
  • Apple Intelligence not enabled in Settings
  • Model not ready (downloading or initializing)

Examples

Creative writing with higher temperature:

llm -m apple "Write a creative story about a robot" -o temperature 1.8

Factual query with lower temperature:

llm -m apple "Explain quantum computing" -o temperature 0.3

With system instructions:

llm -m apple "Should I learn Python or JavaScript?" \
  -o instructions "You are a career counselor specializing in tech"

Development

Running Tests

# Run tests
uv run pytest

# Run tests with coverage
uv run pytest --cov=llm_apple --cov-report=html --cov-report=term

The tests use mocks to simulate the Apple Foundation Models API, so they can run on any platform without requiring actual Apple Intelligence hardware.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_apple-0.1.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_apple-0.1.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file llm_apple-0.1.0.tar.gz.

File metadata

  • Download URL: llm_apple-0.1.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for llm_apple-0.1.0.tar.gz
Algorithm Hash digest
SHA256 71b2be89493a0f9c7297c1f2292f0595dcd21a3a62831b3afd42e352b2f7ac76
MD5 c9e1e6fb47dfd7fd0b5c1ec642d6d322
BLAKE2b-256 bead7a4a5ba6cdd25a34a5e65fec48147c19f08a5f38fbaaca25c9fa6cabbf7f

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_apple-0.1.0.tar.gz:

Publisher: publish-to-pypi.yml on btucker/llm-apple

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llm_apple-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: llm_apple-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for llm_apple-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f74b37dffe96a47b5180972ec2c47a5e0abd20bb4b4bb0a537dc46046dd0530
MD5 0296c91fa2e331c51262cadd5171467e
BLAKE2b-256 4fcde9d50c6491415755374db17de12d2e84f269b5961f743b683fbd30a4f94a

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_apple-0.1.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on btucker/llm-apple

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page