Back to directory

LLM.swift

A Swift library for running large language models locally on macOS, iOS, watchOS, tvOS and visionOS, built around llama.cpp with automatic chat-template handling from a model's GGUF metadata.

LLM.swift

LLM.swift is a library for interacting with large language models locally from Swift, on macOS, iOS, watchOS, tvOS and visionOS. It can load a bundled GGUF model file directly or fetch one from Hugging Face, and by default renders conversations using the chat template embedded in the GGUF file itself through llama.cpp's Jinja engine, so a model works with its own template without extra configuration.

A Template can still be passed explicitly to override the embedded one, for example when a model's metadata is missing or broken, and thinking or reasoning output is separated automatically for models that support it. Conversation context is maintained incrementally between turns, and a maxTokenCount parameter controls the memory and computation trade-off, which matters most on mobile devices.

More in Inference

See all 770
  • OpenDecision

    deepanwadhwa.github.io

    An open-source Python package that answers typed questions about application state or documents using a local natural-language-inference model, returning structured choice, score, yes/no or evidence-relation values instead of free text.

  • Lifeboat

    iterate.ai

    A local inference server that puts an OpenAI- and Anthropic-compatible API in front of open-weight language models running on hardware you control, from a laptop to a GPU cluster.

  • Claude S40

    github.com

    An unofficial Claude chat client for 2007-era Nokia Series 40 phones, built as a Java ME app plus a small Go relay server, with web search, reading mode and saved chats.