coreml is a native macOS command-line tool for working with Apple Core ML models. Inspect, run inference, benchmark, and compile models directly from the terminal.

Repository: https://github.com/schappim/coreml-cli

What is coreml-cli?

coreml-cli is a Swift-based CLI that wraps Apple's Core ML framework so you can analyze and run .mlmodel, .mlpackage, or .mlmodelc files without Xcode or Python.

JSON output is available across key commands. Use --json for inspect, predict, benchmark, compile, and metadata, and choose JSON or CSV for batch runs.

Core Capabilities

Model Inspection

  • View model inputs, outputs, and metadata

  • See file size and compiled status

  • Emit structured JSON for automation

Inference and Batch Processing

  • Run inference on images, text, or JSON tensor inputs

  • Select compute device: CPU, GPU, ANE, or all

  • Batch process directories with configurable concurrency

  • Export results as JSON or CSV

Benchmarking and Compilation

  • Measure latency percentiles and throughput

  • Warmup and iteration controls for consistent metrics

  • Compile models to optimized .mlmodelc and optionally validate

Metadata

  • Read metadata fields such as author, description, and version

  • Metadata editing is limited; coreml-cli points to coremltools for writes

Everyday Automation Examples

Inspect a Model (JSON)

coreml inspect MobileNetV2.mlmodel --json

Run Inference on an Image

coreml predict MobileNetV2.mlmodel \
  --input photo.jpg \
  --device ane

Save Prediction Output to a File

coreml predict MobileNetV2.mlmodel \
  --input photo.jpg \
  --json \
  --output results.json

Batch Process a Folder

coreml batch MobileNetV2.mlmodel \
  --dir ./photos \
  --out ./results \
  --format csv \
  --concurrency 8

Benchmark Performance

coreml benchmark MobileNetV2.mlmodel \
  --input sample.jpg \
  -n 500 \
  --warmup 50 \
  --json

Compile and Validate a Model

coreml compile MobileNetV2.mlmodel \
  --validate \
  --output-dir ./compiled

Why This Matters for Claude Code Skills

coreml-cli pairs naturally with Claude Code skills because it is local, deterministic, and machine-readable. Claude can safely invoke coreml-cli to inspect models, run predictions, or benchmark changes.

Skill-Oriented Use Cases

1. Local Inference on Demand
Convert user intent into a prediction run:

User: "Classify this image with MobileNet"
Claude: Calls coreml predict ... --json

2. Model Health Checks
Verify inputs and outputs before deployment:

coreml inspect model.mlmodel --json

3. CI Performance Gates
Benchmark models and compare latency trends over time.

The JSON Advantage

coreml-cli emits structured JSON that is easy to parse and automate:

{
  "inputFile": "photo.jpg",
  "outputs": {
    "classLabel": "golden retriever",
    "classLabelProbs": {
      "golden retriever": 0.8721,
      "labrador retriever": 0.0543
    }
  },
  "inferenceTimeMs": 1.66
}

This enables Claude to:

  • Parse model outputs precisely

  • Chain inference with downstream actions

  • Summarize results in human-friendly language

  • Record metrics in logs or dashboards

Optional: Compute Device Selection

coreml-cli lets you choose the best compute target for your workload:

coreml predict model.mlmodel --input photo.jpg --device cpu
coreml predict model.mlmodel --input photo.jpg --device gpu
coreml predict model.mlmodel --input photo.jpg --device ane

Getting Started

Install via Homebrew

brew tap schappim/coreml-cli
brew install coreml-cli

Or Download a Binary

curl -L https://github.com/schappim/coreml-cli/releases/download/v1.0.0/coreml-1.0.0-macos.tar.gz -o coreml.tar.gz
tar -xzf coreml.tar.gz
sudo mv coreml /usr/local/bin/

Or Build from Source

git clone https://github.com/schappim/coreml-cli.git
cd coreml-cli
swift build -c release
sudo cp .build/release/coreml /usr/local/bin/

Requirements

  • macOS 13.0 (Ventura) or later

  • Apple Silicon or Intel Mac

  • Swift 5.9+ (for building from source)

Wrapping Up

coreml-cli brings Core ML workflows to the terminal in a clean, scriptable, and predictable way.

Whether you are running local inference, benchmarking models in CI, or building Claude Code skills, coreml-cli provides a solid native foundation.

Full documentation and source code: https://github.com/schappim/coreml-cli

coreml-cli is open source and contributions are welcome.