Trans-N-ai/swama

High-performance MLX-based LLM inference engine for macOS with native Swift implementation

Swama – Local AI Runtime for Apple Silicon

What it is Swama is a Swift‑based server that runs a variety of ML models (LLMs, vision, speech‑to‑text, text‑to‑speech, embeddings) directly on Apple‑silicon Macs using the MLX‑Swift library. It exposes the models through an OpenAI‑compatible HTTP API, a command‑line tool, and a menu‑bar macOS app.

Key capabilities

  • OpenAI‑compatible endpoints – chat completions (streaming, tool calling, image input), embeddings, audio transcription, text‑to‑speech, and a stateless /v1/responses subset.
  • Decision scoring – /v1/decisions implements the OpenAI Decisions API, letting you score predicates, multiple‑choice questions, or ordinal scores without generating text.
  • Model aliases & on‑demand download – short aliases like qwen3.5 map to Hugging‑Face model IDs; the first swama run … automatically pulls the model.
  • Menu‑bar app – runs the server in the background, installs the swama CLI, and lets you set the context window size.
  • Supports many model families – Qwen, Llama, Gemma, DeepSeek, Whisper, Parakeet, etc., for language, vision, ASR, and TTS.

Installation

  • Homebrew: brew install swama
  • Pre‑built app: download the DMG from the GitHub releases and install the CLI via the menu.
  • Build from source with Xcode 6.2 and the Swift toolchain (see README for exact commands).

Quick start

# Run a prompt (model is downloaded on first use)
swama run qwen3.5 "Hello!"
# Vision example
swama run qwen3.5 "What do you see?" -i photo.jpg
# Start the API server
swama serve --host 127.0.0.1 --port 28100

You can then call the server with curl using the standard OpenAI JSON payloads.

Supported models Swama can load any MLX model hosted on Hugging Face. Common aliases are provided for:

  • Language – qwen3.5, llama3.2, deepseek-r1, smollm, …
  • Vision – qwen3.5 (image‑capable), gemma3, qwen3‑vl, …
  • ASR – whisper, qwen3‑asr, parakeet, voxtral, …
  • TTS (experimental) – kokoro, orpheus, qwen3‑tts, fish‑speech, … Model aliases are defined in ModelAliases.swift.

API overview

Endpoint What it does
GET /v1/models Lists locally downloaded models
POST /v1/chat/completions Full chat API (streaming, tool calling, image input)
POST /v1/responses Stateless subset of OpenAI Responses API
POST /v1/decisions Scores predicates/choices/scores without text generation
POST /v1/systemone Same engine as /decisions but with a different request shape
POST /v1/embeddings Returns vector embeddings
POST /v1/audio/transcriptions Local speech‑to‑text
POST /v1/audio/speech Text‑to‑speech (experimental)

All endpoints follow the OpenAI schema where possible, with strict validation – unsupported fields return a clear 400 error.

Typical use‑cases

  • Running LLMs locally for privacy‑sensitive applications.
  • Adding vision or speech capabilities to macOS tools without cloud calls.
  • Using the Decisions API for fast scoring of multiple‑choice or rating tasks.
  • Prototyping AI‑augmented macOS apps that need a local server.

License MIT – you can freely use, modify, and redistribute the software.


All details above are taken directly from the repository’s README; no additional features have been inferred.

Related

  • Project
  • Project
  • Project
  • Project