llamafarm is a free, open source machine learning infrastructure project written in Python and released under Apache-2.0. It has 836 GitHub stars, 59 forks and 55 open issues, and was last pushed 5 months ago. On this registry it ranks #75 of 89 tracked projects in Machine Learning Infrastructure, with 5 head-to-head comparisons available.

What is llamafarm?

LlamaFarm is an open-source, Apache-2.0 AI platform written in Python that lets developers run models, agents, vector-driven RAG pipelines, and document processing entirely on their own hardware — locally or on a remote machine — without per-token API fees or data leaving the device.

What it is

LlamaFarm is an AI platform that runs entirely on your hardware, distributed as a desktop application, a command-line tool, and a source monorepo. It bundles three cooperating services: a FastAPI server on port 14345 that serves the REST API, the Designer web UI, and project management; a Celery RAG worker that processes documents asynchronously; and a Universal Runtime on port 11540 that handles ML model inference, embeddings, OCR, and anomaly detection. The stack targets Python 3.10+ and Go 1.24+, with the source tree organised as an Nx workspace.

The concrete problem it solves is the cost and data-ownership model of hosted AI APIs. Instead of sending prompts, documents, and images to a third-party service and paying per token, LlamaFarm keeps the whole pipeline — ingestion, embedding, inference, classification, extraction — on hardware the operator controls. It replaces per-token cloud API usage with open-source models that run under a multi-model runtime, and it stays usable offline once the models have been downloaded. It sits in the machine learning infrastructure part of the Python ecosystem, adjacent to local inference runtimes rather than to managed AI platforms.

Key capabilities

  • Multi-model runtime that switches between Ollama, OpenAI, vLLM, and local GGUF models.
  • Retrieval-augmented generation that ingests PDFs, docs, and CSVs and lets you query them with AI.
  • Custom text classifiers trained with SetFit from as few as 8 to 16 examples.
  • Anomaly detection with more than 12 algorithms, covering both batch and streaming workloads.
  • Tool calling through the Model Context Protocol (MCP) to connect models to external tools.
  • OCR and document extraction that pulls text and structured data out of images and PDFs.
  • Named entity recognition for people, organisations, and locations.

Who uses it and how

  • Desktop users on Mac (universal .dmg), Windows (.exe), and Linux (x86_64 and ARM64 AppImage) install and run the app with no command line and no additional setup.
  • CLI users run lf init my-project to generate llamafarm.yaml, lf start to bring up services and open the Designer UI at http://localhost:14345, and lf chat for interactive or one-off messages.
  • Developers working from source clone the repository, install Nx globally, and run nx start server, nx start rag, and nx start universal-runtime in separate terminals.
  • Edge and offline deployments are a first-class target, reflected in the edge and edge-computing topics and in the offline-capable design.
  • Hardware-accelerated setups use automatic GPU/NPU acceleration on Apple Silicon, NVIDIA, and AMD.

Getting started

Download the desktop application for macOS, Windows, or Linux, or install the CLI with the install.sh script on macOS and Linux or install.ps1 on Windows, then run lf init, lf start, and lf chat.

How it compares

LlamaFarm does not replace a single product so much as wrap several runtimes it names directly: Ollama, vLLM, local GGUF models, and the OpenAI API can all be driven through the same project configuration. Where Ollama and vLLM focus on serving models, LlamaFarm adds the surrounding stack — RAG ingestion, classifiers, anomaly detection, OCR, and MCP tool calling — behind one CLI and one Designer UI. The contrast with the OpenAI API is licence and cost model: Apache-2.0 code on your own hardware rather than metered hosted inference.

When to use it — and when not to

A self-hoster must operate three services, including the FastAPI server on port 14345, the Celery RAG worker, and the Universal Runtime on port 11540, and needs Python 3.10+ plus Go 1.24+ if building from source; the development path additionally requires Nx and several terminals. Teams that want a fully managed, hosted service with no local infrastructure, or that do not have GPU/NPU hardware to benefit from acceleration, should look elsewhere. The repository carries 55 open issues, so adopters should expect active, still-settling development rather than a frozen platform.

project readme (upstream, from github) — read inline

LlamaFarm - Edge AI for Everyone

Enterprise AI capabilities on your own hardware. No cloud required.

License: Apache 2.0 Python 3.10+ Go 1.24+ Docs Discord

LlamaFarm is an open-source AI platform that runs entirely on your hardware. Build RAG applications, train custom classifiers, detect anomalies, and run document processing—all locally with complete privacy.

  • 🔒 Complete Privacy — Your data never leaves your device
  • 💰 No API Costs — Use open-source models without per-token fees
  • 🌐 Offline Capable — Works without internet once models are downloaded
  • ⚡ Hardware Optimized — Automatic GPU/NPU acceleration on Apple Silicon, NVIDIA, and AMD

Desktop App Downloads

Get started instantly — no command line required:

Platform Download
Mac (Universal) Download
Windows Download
Linux (x86_64) Download
Linux (ARM64) Download

What Can You Build?

Capability Description
RAG (Retrieval-Augmented Generation) Ingest PDFs, docs, CSVs and query them with AI
Custom Classifiers Train text classifiers with 8-16 examples using SetFit
Anomaly Detection 12+ algorithms for batch and streaming anomaly detection
Tool Calling (MCP) Connect models to external tools via Model Context Protocol
OCR & Document Extraction Extract text and structured data from images and PDFs
Named Entity Recognition Find people, organizations, and locations
Multi-Model Runtime Switch between Ollama, OpenAI, vLLM, or local GGUF models

Video demo (90 seconds): https://youtu.be/W7MHGyN0MdQ


Quickstart

Option 1: Desktop App

Download the desktop app above and run it. No additional setup required.

Option 2: CLI + Development Mode

  1. Install the CLI

    macOS / Linux:

    curl -fsSL https://raw.githubusercontent.com/llama-farm/llamafarm/main/install.sh | bash
    

    Windows (PowerShell):

    irm https://raw.githubusercontent.com/llama-farm/llamafarm/main/install.ps1 | iex
    

    Or download directly from releases.

  2. Create and run a project

    lf init my-project      # Generates llamafarm.yaml
    lf start                # Starts services and opens Designer UI
    
  3. Chat with your AI

    lf chat                           # Interactive chat
    lf chat "Hello, LlamaFarm!"       # One-off message
    

The Designer web interface is available at http://localhost:14345.

Option 3: Development from Source

git clone https://github.com/llama-farm/llamafarm.git
cd llamafarm

# Install Nx globally and initialize the workspace
npm install -g nx
nx init --useDotNxInstallation --interactive=false  # Required on first clone

# Start all services (run each in a separate terminal)
nx start server           # FastAPI server (port 14345)
nx start rag              # RAG worker for document processing
nx start universal-runtime # ML models, OCR, embeddings (port 11540)

Architecture

LlamaFarm consists of three main services:

Service Port Purpose
Server 14345 FastAPI REST API, Designer web UI, project management
RAG Worker - Celery worker for async document processing
Universal Runtime 11540 ML model inference, embeddings, OCR, anomaly detection

All configuration lives in llamafarm.yaml—no scattered settings or hidden defaults.


Runtime Options

Universal Runtime (Recommended)

The Universal Runtime provides access to HuggingFace models plus specialized ML capabilities:

  • Text Generation - Any HuggingFace text model
  • Embeddings - sentence-transformers and other embedding models
  • OCR - Text extraction from images/PDFs (Surya, EasyOCR, PaddleOCR, Tesseract)
  • Document Extraction - Forms, invoices, receipts via vision models
  • Text Classification - Pre-trained or custom models via SetFit
  • Named Entity Recognition - Extract people, organizations, locations
  • Reranking - Cross-encoder models for improved RAG quality
  • Anomaly Detection - Isolation Forest, One-Class SVM, Local Outlier Factor, Autoencoders
runtime:
  models:
    default:
      provider: universal
      model: Qwen/Qwen2.5-1.5B-Instruct
      base_url: http://127.0.0.1:11540/v1

Ollama

Simple setup for GGUF models with CPU/GPU acceleration:

runtime:
  models:
    default:
      provider: ollama
      model: qwen3:8b
      base_url: http://localhost:11434/v1

OpenAI-Compatible

Works with vLLM, Together, Mistral API, or any OpenAI-compatible endpoint:

runtime:
  models:
    default:
      provider: openai
      model: gpt-4o
      base_url: https://api.openai.com/v1
      api_key: ${OPENAI_API_KEY}

Core Workflows

CLI Commands

Task Command
Initialize project lf init my-project
Start services lf start
Interactive chat lf chat
One-off message lf chat "Your question"
List models lf models list
Use specific model lf chat --model powerful "Question"
Create dataset lf datasets create -s pdf_ingest -b main_db research
Upload files (auto-process by default) lf datasets upload research ./docs/*.pdf
Process dataset (if you skipped auto-process) lf datasets process research
Query RAG lf rag query --database main_db "Your query"
Check RAG health lf rag health

RAG Pipeline

  1. Create a dataset linked to a processing strategy and database
  2. Upload files (PDF, DOCX, Markdown, TXT) — processing runs automatically unless you pass --no-process
  3. Process manually only when you intentionally skipped auto-processing (e.g., large batches)
  4. Query using semantic search with optional metadata filtering
lf datasets create -s default -b main_db research
lf datasets upload research ./papers/*.pdf                 # auto-processes by default
# For large batches:
# lf datasets upload research ./papers/*.pdf --no-process
# lf datasets process research
lf rag query --database main_db "What are the key findings?"

Designer Web UI

The Designer at http://localhost:14345 provides:

  • Project management with briefs and quick actions
  • Visual dataset management with drag-and-drop uploads
  • Database & RAG configuration with built-in query testing
  • Prompt engineering with template variables and testing
  • Interactive chat with RAG toggle and retrieved context display
  • Config editor with syntax highlighting, validation, and auto-completion
  • Switch between visual Designer and raw YAML modes in any section

See the Designer Features Guide for details.


Configuration

llamafarm.yaml is the source of truth for each project:

version: v1
name: my-assistant
namespace: default

# Multi-model configuration
runtime:
  default_model: fast

  models:
    fast:
      description: "Fast local model"
      provider: universal
      model: Qwen/Qwen2.5-1.5B-Instruct
      base_url: http://127.0.0.1:11540/v1

    powerful:
      description: "More capable model"
      provider: universal
      model: Qwen/Qwen2.5-7B-Instruct
      base_url: http://127.0.0.1:11540/v1

# System prompts
prompts:
  - name: default
    messages:
      - role: system
        content: You are a helpful assistant.

# RAG configuration
rag:
  databases:
    - name: main_db
      type: ChromaStore
      default_embedding_strategy: default_embeddings
      default_retrieval_strategy: semantic_search
      embedding_strategies:
        - name: default_embeddings
          type: UniversalEmbedder
          config:
            model: sentence-transformers/all-MiniLM-L6-v2
            base_url: http://127.0.0.1:11540/v1
      retrieval_strategies:
        - name: semantic_search
          type: BasicSimilarityStrategy
          config:
            top_k: 5

  data_processing_strategies:
    - name: default
      parsers:
        - type: PDFParser_LlamaIndex
          config:
            chunk_size: 1000
            chunk_overlap: 100
        - type: MarkdownParser_Python
          config:
            chunk_size: 1000
      extractors: []

# Dataset definitions
datasets:
  - name: research
    data_processing_strategy: default
    database: main_db

Environment Variable Substitution

Use ${VAR} syntax to inject secrets from .env files:

runtime:
  models:
    openai:
      api_key: ${OPENAI_API_KEY}
      # With default: ${OPENAI_API_KEY:-sk-default}
      # From specific file: ${file:.env.production:API_KEY}

See the Configuration Guide for complete reference.


REST API

LlamaFarm provides an OpenAI-compatible REST API:

Chat Completions

curl -X POST http://localhost:14345/v1/projects/default/my-project/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [{"role": "user", "content": "Hello"}],
    "stream": false,
    "rag_enabled": true
  }'

RAG Query

curl -X POST http://localhost:14345/v1/projects/default/my-project/rag/query \
  -H "Content-Type: application/json" \
  -d '{
    "query": "What are the requirements?",
    "database": "main_db",
    "top_k": 5
  }'

See the API Reference for all endpoints.


Specialized ML Capabilities

The Universal Runtime provides endpoints beyond chat:

OCR & Document Extraction

curl -X POST http://localhost:14345/v1/vision/ocr \
  -F "file=@document.pdf" \
  -F "model=surya"

Anomaly Detection

LlamaFarm supports 12+ anomaly detection algorithms via PyOD, with both batch and streaming modes.

# Train on normal data
curl -X POST http://localhost:14345/v1/ml/anomaly/fit \
  -H "Content-Type: application/json" \
  -d '{"model": "sensor-detector", "backend": "ecod", "data": [[22.1], [23.5], ...]}'

# Detect anomalies
curl -X POST http://localhost:14345/v1/ml/anomaly/detect \
  -H "Content-Type: application/json" \
  -d '{"model": "sensor-detector", "data": [[22.0], [100.0], [23.0]], "threshold": 0.5}'

# Streaming detection (handles cold start, auto-retraining, sliding windows)
curl -X POST http://localhost:14345/v1/ml/anomaly/stream \
  -H "Content-Type: application/json" \
  -d '{"model": "live-sensor", "data": {"temperature": 72.5}, "backend": "ecod"}'

Available backends: ecod (recommended), isolation_forest, one_class_svm, local_outlier_factor, autoencoder, hbos, copod, knn, mcd, cblof, suod, loda

Text Classification & NER

See the Models Guide for complete documentation.

Tool Calling (MCP)

Give models access to external tools via the Model Context Protocol:

# In llamafarm.yaml
mcp:
  servers:
    - name: filesystem
      transport: stdio
      command: npx
      args: ['-y', '@modelcontextprotocol/server-filesystem', '/data']

runtime:
  models:
    - name: assistant
      provider: ollama
      model: llama3.1:8b
      mcp_servers: [filesystem]

LlamaFarm also exposes its own API as MCP tools for use with Claude Desktop, Cursor, and other MCP clients. See the Tool Calling Guide.


Examples

Example Description Location
RAG Examples
Large Complex PDFs Multi-megabyte planning ordinances examples/large_complex_rag/
Many Small Files FDA correspondence letters examples/many_small_file_rag/
Mixed Formats PDF, Markdown, HTML, text, and code examples/mixed_format_rag/
Quick Notes Rapid smoke tests with small files examples/quick_rag/
Anomaly Detection
Quick Start Simplest anomaly detection example examples/anomaly/01_quick_start.py
Fraud Detection Training, saving, loading models examples/anomaly/02_fraud_detection.py
Streaming Sensors IoT monitoring with rolling features examples/anomaly/03_streaming_sensors.py
Backend Comparison Compare all 12 algorithms examples/anomaly/04_backend_comparison.py
Use Cases
FDA Letters Assistant Regulatory document analysis examples/fda_rag/
Government Planning Large ordinance documents examples/gov_rag/

See examples/README.md for setup instructions and the full list.


Industry Use Cases

LlamaFarm is used across industries for document analysis, monitoring, and fraud detection:


Development & Testing

# Python server tests
cd server && uv sync && uv run --group test python -m pytest

# CLI tests
cd cli && go test ./...

# RAG tests
cd rag && uv sync && uv run pytest tests/

# Universal Runtime tests
cd runtimes/universal && uv sync && uv run pytest tests/

# Build docs
nx build docs

Extensibility

  • Add runtimes by implementing provider support and updating schema
  • Add vector stores by implementing store backends (Chroma, Qdrant, etc.)
  • Add parsers for new file formats (PDF, DOCX, HTML, CSV, etc.)
  • Add extractors for custom metadata extraction
  • Add CLI commands under cli/cmd/

See the Extending Guide for step-by-step instructions.


Community & Support


License

Licensed under the Apache 2.0 License. See CREDITS for acknowledgments.


Build locally. Deploy anywhere. Own your AI.

Frequently asked questions

Is llamafarm free to use?

llamafarm is open source under the Apache-2.0 licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does llamafarm do?

Deploy any AI model, agent, database, RAG, and pipeline locally or remotely in minutes

What is llamafarm written in?

llamafarm is primarily written in Python. Its source is publicly available at https://github.com/llama-farm/llamafarm, and it has 836 GitHub stars.