localai
БесплатноБез исполняемых скриптовНе проверенExpert guidance for LocalAI, the open-source drop-in replacement for OpenAI's API that runs locally. Helps developers self-host LLMs, image generators, audio…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
LocalAI — Self-Hosted OpenAI Alternative
Overview
LocalAI, the open-source drop-in replacement for OpenAI's API that runs locally. Helps developers self-host LLMs, image generators, audio transcription, and text-to-speech models with an OpenAI-compatible API — no GPU required, completely offline and private.
Instructions
Quick Start with Docker
Backends are downloaded on demand the first time a model needs them, so keep the backends volume persistent.
# CPU only
docker run -d --name local-ai -p 8080:8080 \
-v localai-models:/models -v localai-backends:/backends \
localai/localai:latest
# NVIDIA GPU (CUDA 12 image; a CUDA 13 image also exists)
docker run -d --name local-ai -p 8080:8080 --gpus all \
-v localai-models:/models -v localai-backends:/backends \
localai/localai:latest-gpu-nvidia-cuda-12
Other tags: latest-gpu-hipblas (AMD ROCm, add --device=/dev/kfd --device=/dev/dri), latest-gpu-intel, latest-gpu-vulkan. On macOS use the DMG from the GitHub releases page (remove the quarantine flag as the README describes). Pin a version tag such as v4.11.0 in production instead of latest.
# docker-compose.yml
services:
localai:
image: localai/localai:latest
ports:
- "127.0.0.1:8080:8080"
environment:
- MODELS_PATH=/models
- LOCALAI_THREADS=4 # physical cores
- LOCALAI_CONTEXT_SIZE=4096 # default context window
- LOCALAI_API_KEY=${LOCALAI_API_KEY}
volumes:
- models:/models
- backends:/backends
restart: unless-stopped
volumes:
models:
backends:
Docs list env vars as LOCALAI_MODELS_PATH, LOCALAI_THREADS, LOCALAI_CONTEXT_SIZE, LOCALAI_GALLERIES, LOCALAI_ADDRESS and LOCALAI_API_KEY. Without an API key anyone who reaches the port can use it; bind to localhost or put a reverse proxy in front.
Model Installation
# Gallery model by name (downloads weights, writes the YAML, starts serving)
docker exec -it local-ai local-ai run qwen3-4b
# Straight from Hugging Face, the Ollama registry, an OCI image or a YAML URL
local-ai run huggingface://TheBloke/phi-2-GGUF/phi-2.Q8_0.gguf
local-ai run ollama://gemma:2b
local-ai run oci://localai/phi-2:latest
# Browse and install without starting a server
local-ai models list
local-ai models install qwen3-4b
# See what the API serves
curl -s http://localhost:8080/v1/models | jq '.data[].id'
You can also drop a GGUF file into the models directory and add a YAML next to it. context_size, threads, gpu_layers and f16 are top-level keys, not children of parameters. Each model gets its own file (one YAML document per file):
# /models/mistral.yaml
name: mistral
backend: llama-cpp
context_size: 8192
threads: 4
gpu_layers: 0 # 0 = CPU only; raise to offload layers to the GPU
parameters:
model: mistral-7b-instruct-v0.2.Q5_K_M.gguf
temperature: 0.7
top_p: 0.9
Current llama.cpp builds normally read the chat template from the GGUF file; add a template: block (chat, chat_message, completion) only when a model needs an override.
OpenAI-Compatible API
// src/local-ai.ts
import fs from "node:fs";
import OpenAI from "openai";
const ai = new OpenAI({
apiKey: process.env.LOCALAI_API_KEY ?? "not-needed",
baseURL: "http://localhost:8080/v1",
});
async function chat(prompt: string) {
const response = await ai.chat.completions.create({
model: "mistral", // the `name` in the model YAML or the gallery name
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: prompt },
],
});
return response.choices[0].message.content;
}
async function embed(texts: string[]) {
const response = await ai.embeddings.create({ model: "text-embedding-ada-002", input: texts });
return response.data.map((d) => d.embedding);
}
async function transcribe(audioPath: string) {
const response = await ai.audio.transcriptions.create({
model: "whisper-1",
file: fs.createReadStream(audioPath),
});
return response.text;
}
Image generation (ai.images.generate) and speech (ai.audio.speech.create) work the same way: set model to the name of an installed diffusers or TTS model from the gallery.
Multi-Model Configuration
Create one file per model in the models directory:
# /models/embedding.yaml (name matches what OpenAI clients ask for)
name: text-embedding-ada-002
backend: sentencetransformers
embeddings: true
parameters:
model: all-MiniLM-L6-v2
# /models/whisper.yaml
name: whisper-1
backend: whisper
parameters:
model: ggml-base.en.bin
For llama.cpp embeddings use backend: llama-cpp, embeddings: true and a GGUF embedding model. To define many models in one place use a --models-config-file list instead.
Function Calling
The request shape is the OpenAI tools / tool_choice one. With the llama.cpp backend tool calls are parsed automatically fo
Установить localai в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл localai?
Expert guidance for LocalAI, the open-source drop-in replacement for OpenAI's API that runs locally. Helps developers self-host LLMs, image generators, audio transcription, and text-to-speech models with an OpenAI-compatible API — no GPU required, completely offline and private.
Как установить скилл localai?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл localai запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic