Git Repository Guide

LocalAI

LocalAI

AI/ML Self-hostable MIT

When to use this

Use this when you want to replace OpenAI API calls with a locally running server — same API spec, same endpoints, zero cost after setup. Any app built for OpenAI works with LocalAI by changing one URL.

YouTube Tutorials

Click any card to watch on YouTube

What is LocalAI?

LocalAI is a free, open-source alternative to the OpenAI API. It is a drop-in replacement that runs locally on CPU or GPU with no API keys required. It supports multiple model formats and is compatible with OpenAI's full API spec.

What It Replaces

  • POST /v1/chat/completions — LLM chat (GPT-4 equivalent)
  • POST /v1/completions — text completion
  • POST /v1/embeddings — generate embeddings
  • POST /v1/images/generations — image generation (Stable Diffusion)
  • POST /v1/audio/transcriptions — speech to text (Whisper)
  • POST /v1/audio/speech — text to speech

Quick Start

docker run -p 8080:8080 localai/localai:latest-aio-cpu

Then call:

curl http://localhost:8080/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-4", "messages": [{"role": "user", "content": "Hello"}]}'

When to Use LocalAI vs. Ollama

  • Ollama — best for running individual LLM models locally with a clean CLI.
  • LocalAI — best when you need to self-host the full OpenAI API surface (including embeddings, image gen, TTS) and want your existing OpenAI-built apps to work without code changes.