> [!NOTE] > 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。 > [English](./README.en.md) · [原始项目](https://github.com/mudler/LocalAI) · [上游 README](https://github.com/mudler/LocalAI/blob/HEAD/README.md) > 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。




LocalAI 星标 LocalAI 许可证

关注 LocalAI_API 加入 LocalAI Discord 社区

mudler%2FLocalAI | Trendshift

Deutsch | Español | français | 日本語 | 한국어 | Português | Русский | 中文

**LocalAI** 是开源 AI 引擎。可在任意硬件上运行任意模型——大语言模型(LLM)、视觉、语音、图像、视频。无需 GPU。 **小巧核心,而非捆绑包。** 每个后端将一流引擎(llama.cpp、vLLM、whisper.cpp、stable-diffusion、MLX……)封装在各自的镜像中,仅在模型需要时才拉取。你只安装会用到的组件。 - **按设计可组合**:后端相互独立并按需拉取,因此你只安装模型所需的部分 - **开放且可扩展**:加载任意模型,或使用开放接口用任意语言构建自己的后端 - **即插即用 API 兼容**:各后端均兼容 OpenAI、Anthropic 和 ElevenLabs API - **任意模型、任意模态**:LLM、视觉、语音、图像和视频,统一 API - **任意硬件**:NVIDIA、AMD、Intel、Apple Silicon、Vulkan,或纯 CPU - **多用户就绪**:API 密钥认证、用户配额、基于角色的访问控制 - **内置 AI 智能体**:具备工具调用、RAG、MCP 和技能的自主智能体 - **隐私优先**:你的数据永不离开你的基础设施 ![小巧的 LocalAI 核心,后端(llama.cpp、vLLM、MLX、whisper.cpp、stable-diffusion、kokoro、parakeet.cpp……)作为独立的按需镜像接入](docs/static/images/diagrams/composable-core.png) 由 [Ettore Di Giacinto](https://github.com/mudler) 创建,并由 [LocalAI 团队](#team) 维护。 > [:book: 文档](https://localai.io/) | [:speech_balloon: Discord](https://discord.gg/uJAeKSAGDy) | [💻 快速入门](https://localai.io/basics/getting_started/) | [🖼️ 模型](https://models.localai.io/) | [❓常见问题](https://localai.io/faq/) ## 导览 https://github.com/user-attachments/assets/08cbb692-57da-48f7-963d-2e7b43883c18
点击查看更多! #### 用户与认证 https://github.com/user-attachments/assets/228fa9ad-81a3-4d43-bfb9-31557e14a36c #### 智能体 https://github.com/user-attachments/assets/6270b331-e21d-4087-a540-6290006b381a #### 每用户使用指标 https://github.com/user-attachments/assets/cbb03379-23b4-4e3d-bd26-d152f057007f #### 微调与量化 https://github.com/user-attachments/assets/5ba4ace9-d3df-4795-b7d4-b0b404ea71ee #### WebRTC https://github.com/user-attachments/assets/ed88e34c-fed3-4b83-8a67-4716a9feeb7b
## 快速入门 ### macOS 下载 macOS 版 LocalAI > **注意:** DMG 未经 Apple 签名。安装后请运行:`sudo xattr -d com.apple.quarantine /Applications/LocalAI.app`。详见 [#6268](https://github.com/mudler/LocalAI/issues/6268)。 ### 容器(Docker、podman……) > 之前运行过 LocalAI?使用 `docker start -i local-ai` 重启现有容器。 #### 仅 CPU: ```bash docker run -ti --name local-ai -p 8080:8080 localai/localai:latest ``` #### NVIDIA GPU: ```bash # CUDA 13 docker run -ti --name local-ai -p 8080:8080 --gpus all localai/localai:latest-gpu-nvidia-cuda-13 # CUDA 12 docker run -ti --name local-ai -p 8080:8080 --gpus all localai/localai:latest-gpu-nvidia-cuda-12 # NVIDIA Jetson ARM64 (CUDA 12, for AGX Orin and similar) docker run -ti --name local-ai -p 8080:8080 --gpus all localai/localai:latest-nvidia-l4t-arm64 # NVIDIA Jetson ARM64 (CUDA 13, for DGX Spark) docker run -ti --name local-ai -p 8080:8080 --gpus all localai/localai:latest-nvidia-l4t-arm64-cuda-13 ``` #### AMD GPU (ROCm): ```bash docker run -ti --name local-ai -p 8080:8080 --device=/dev/kfd --device=/dev/dri --group-add=video localai/localai:latest-gpu-hipblas ``` #### Intel GPU (oneAPI): ```bash docker run -ti --name local-ai -p 8080:8080 --device=/dev/dri/card1 --device=/dev/dri/renderD128 localai/localai:latest-gpu-intel ``` #### Vulkan GPU: ```bash docker run -ti --name local-ai -p 8080:8080 localai/localai:latest-gpu-vulkan ``` ### 加载模型 ```bash # From the model gallery (see available models with `local-ai models list` or at https://models.localai.io) local-ai run llama-3.2-1b-instruct:q4_k_m # From Huggingface local-ai run huggingface://TheBloke/phi-2-GGUF/phi-2.Q8_0.gguf # From the Ollama OCI registry local-ai run ollama://gemma:2b # From a YAML config local-ai run https://gist.githubusercontent.com/.../phi-2.yaml # From a standard OCI registry (e.g., Docker Hub) local-ai run oci://localai/phi-2:latest ``` 要从终端测试正在运行的 LocalAI 服务器,可在另一个 shell 中打开交互式聊天会话。在提示符内,`/models` 列出已安装模型,`/model ` 可在模型间切换。 ```bash # Terminal 1 local-ai run llama-3.2-1b-instruct:q4_k_m # Terminal 2 local-ai chat --model llama-3.2-1b-instruct:q4_k_m ``` > **自动后端检测**:LocalAI 会自动检测你的 GPU 能力并下载相应后端。高级选项请参阅 [GPU 加速](https://localai.io/features/gpu-acceleration/). 更多详情请参阅 [入门指南](https://localai.io/basics/getting_started/). ## 最新动态 - **2026 年 6 月**:LocalAI 团队推出新的原生生物识别后端:[voice-detect.cpp](https://github.com/mudler/voice-detect.cpp) 用于说话人识别与语音分析(ECAPA-TDNN、WeSpeaker、ERes2Net、CAM++、wav2vec2 年龄/性别/情感),以及 [face-detect.cpp](https://github.com/mudler/face-detect.cpp) 用于人脸检测、识别、人口统计信息与防伪(SCRFD/ArcFace、YuNet/SFace)。两者均为从零构建的 C++/ggml 引擎,推理时不依赖 Python 或 onnxruntime,自带 GGUF 权重,与参考实现比特级一致,GPU cuDNN 性能对等,取代较重的 Python `insightface` 与 `speaker-recognition` 后端([PR #10441](https://github.com/mudler/LocalAI/pull/10441)). - **2026 年 6 月**:新的 [实时语音助手演示](https://github.com/localai-org/localai-realtime-demo)(面向 Realtime API 的轻量 Go 客户端,具备完整语音对话回环与工具调用),以及 [实时 LLM / TTS / 转录流水线各阶段流式输出](https://github.com/mudler/LocalAI/pull/10176) 与 [可配置 WebRTC ICE 候选](https://github.com/mudler/LocalAI/pull/10231). - **2026 年 6 月**:语音能力大幅推进:[parakeet.cpp](https://github.com/mudler/parakeet.cpp) ASR 引擎新增 [NeMo 忠实分段时间戳](https://github.com/mudler/LocalAI/pull/10207),、[多语言流式 Nemotron-3.5 模型](https://github.com/mudler/LocalAI/pull/10199),、[并发转录动态批处理](https://github.com/mudler/LocalAI/pull/10112) 与 [CUDA graphs](https://github.com/mudler/LocalAI/pull/10273);;全新 [CrispASR 后端](https://github.com/mudler/LocalAI/pull/10099) 增加多架构 ASR + TTS,模型库新增 [42 种语言的 60 个 Piper TTS 语音](https://github.com/mudler/LocalAI/pull/10296)(另含 [按请求的 TTS 指令与参数](https://github.com/mudler/LocalAI/pull/10172)). - **2026 年 6 月**:新后端与模型:通过 ggml 实现开放词汇目标检测的 [locate-anything.cpp](https://github.com/mudler/LocalAI/pull/10264)、stablediffusion-ggml 中的 [Ideogram4 图像生成](https://github.com/mudler/LocalAI/pull/10201)、[llama.cpp 视频输入](https://github.com/mudler/LocalAI/pull/10216), 以及 [Gemma 4 QAT 系列与 MTP 推测解码配对](https://github.com/mudler/LocalAI/pull/10215).。另有 [交互式 CLI 聊天模式](https://github.com/mudler/LocalAI/pull/10226) 与 [智能体响应中的 RAG 来源引用](https://github.com/mudler/LocalAI/pull/10228). - **2026 年 6 月**:分布式模式加固:[前缀缓存感知路由](https://github.com/mudler/LocalAI/pull/10071),、[具备自动调整 embedding/rerank 批大小的生产级请求路由器](https://github.com/mudler/LocalAI/pull/10104),、[ds4 层拆分分布式推理](https://github.com/mudler/LocalAI/pull/10098),、[NATS JWT 认证 + TLS/mTLS](https://github.com/mudler/LocalAI/pull/10159), 与 [可恢复文件上传](https://github.com/mudler/LocalAI/pull/10109). - **2026 年 5 月**:**LocalAI 4.3.0** — `llama.cpp` [默认启用提示缓存](https://github.com/mudler/LocalAI/pull/9925)(重复系统提示从数分钟缩短至数秒)、[后端 OCI 镜像的无密钥 cosign 签名](https://github.com/mudler/LocalAI/pull/9823),、[按 API 密钥与按用户使用归因](https://github.com/mudler/LocalAI/pull/9920),;Distributed v3 支持 [按请求副本路由](https://github.com/mudler/LocalAI/pull/9968).。[发布说明](https://github.com/mudler/LocalAI/releases/tag/v4.3.0) - **2026 年 5 月**:**LocalAI 4.2.0** — LocalAI 能看能听:[语音识别](https://github.com/mudler/LocalAI/pull/9500),、[人脸识别 + 反欺骗活体检测](https://github.com/mudler/LocalAI/pull/9480),、说话人日记化。另有 [即插即用 Ollama API](https://github.com/mudler/LocalAI/pull/9284),、[视频生成](https://github.com/mudler/LocalAI/pull/9420),、带 i18n 与管理员可配置品牌的新 UI、vLLM 与 llama.cpp 功能对等,以及 11 个新后端。[发布说明](https://github.com/mudler/LocalAI/releases/tag/v4.2.0) - **2026 年 4 月**:**LocalAI 4.1.0** — LocalAI 成为控制塔:分布式集群模式,具备 VRAM 感知智能路由 + 自动扩缩容;多用户平台,支持 OIDC 与 API 密钥;带预测分析的每用户配额;UI 内微调(TRL,自动导出为 GGUF);即时量化后端;可视化流水线编辑器。[发布说明](https://github.com/mudler/LocalAI/releases/tag/v4.1.0) - **2026 年 3 月**:**LocalAI 4.0.0** — 原生智能体编排,配套新版 [Agenthub](https://agenthub.localai.io) 社区中心;React UI 全面重写,含 Canvas 模式;[MCP Apps + 客户端](https://github.com/mudler/LocalAI/pull/8947) 支持工具流式输出;[WebRTC 实时音频](https://github.com/mudler/LocalAI/pull/8790),;[MLX-distributed](https://github.com/mudler/LocalAI/pull/8801).。[发布说明](https://github.com/mudler/LocalAI/releases/tag/v4.0.0) - **2026 年 2 月**:[支持工具调用的音频到音频 Realtime API](https://github.com/mudler/LocalAI/pull/6245),、[ACE-Step 1.5 支持](https://github.com/mudler/LocalAI/pull/8396) - **2026 年 1 月**:**LocalAI 3.10.0** — 支持 Anthropic API、Open Responses API、视频与图像生成(LTX-2)、统一 GPU 后端、工具流式输出、Moonshine、Pocket-TTS。[发布说明](https://github.com/mudler/LocalAI/releases/tag/v3.10.0) - **2025 年 12 月**:[动态内存资源回收器](https://github.com/mudler/LocalAI/pull/7583),、[自动多 GPU 模型适配(llama.cpp)](https://github.com/mudler/LocalAI/pull/7584),、[Vibevoice 后端](https://github.com/mudler/LocalAI/pull/7494) - **2025 年 11 月**:[通过 URL 导入模型](https://github.com/mudler/LocalAI/pull/7245),、[多会话与历史记录](https://github.com/mudler/LocalAI/pull/7325) - **2025 年 10 月**:[模型上下文协议(MCP)](https://localai.io/docs/features/mcp/) 支持智能体能力 - **2025 年 9 月**:macOS 与 Linux 新版启动器,扩展 Mac 与 Nvidia L4T 后端支持,MLX-Audio、WAN 2.2 - **2025 年 8 月**:MLX、MLX-VLM、Diffusers、llama.cpp 现已在 Apple Silicon 上支持 - **2025 年 7 月**:所有后端迁出主二进制文件 — [轻量、模块化架构](https://github.com/mudler/LocalAI/releases/tag/v3.2.0) 要了解更早的新闻和完整发行说明,请参阅 [GitHub Releases](https://github.com/mudler/LocalAI/releases) 以及 [News 页面](https://localai.io/basics/news/). ## 功能特性 - [文本生成](https://localai.io/features/text-generation/)(`llama.cpp`、`transformers`、`vllm` ... [更多](https://localai.io/model-compatibility/)) - [文本转音频](https://localai.io/features/text-to-audio/) - [音频转文本](https://localai.io/features/audio-to-text/) - [图像生成](https://localai.io/features/image-generation) - [兼容 OpenAI 的工具 API](https://localai.io/features/openai-functions/) - [Realtime API](https://localai.io/features/openai-realtime/)(语音到语音,Speech-to-speech) - [嵌入向量生成](https://localai.io/features/embeddings/) - [约束语法](https://localai.io/features/constrained_grammars/) - [从 Huggingface 下载模型](https://localai.io/models/) - [Vision API](https://localai.io/features/gpt-vision/) - [目标检测](https://localai.io/features/object-detection/) - [Reranker API](https://localai.io/features/reranker/) - [P2P 推理](https://localai.io/features/distribute/) - [分布式模式](https://localai.io/features/distributed-mode/) — 基于 PostgreSQL + NATS 的水平扩展 - [Model Context Protocol (MCP)](https://localai.io/docs/features/mcp/) - [内置智能体](https://localai.io/features/agents/) — 具备工具调用、RAG、技能、SSE 流式传输的自主 AI 智能体,以及 [Agent Hub](https://agenthub.localai.io) - [Backend Gallery](https://localai.io/backends/) — 通过 OCI 镜像即时安装/移除后端 - 语音活动检测(Silero-VAD) - 集成 WebUI ## 支持的后端与加速 LocalAI 支持 **60+ 种后端**,包括 llama.cpp、vLLM、SGLang、transformers、whisper.cpp、diffusers、MLX、MLX-VLM 等。硬件加速支持 **NVIDIA**(CUDA 12/13)、**AMD**(ROCm)、**Intel**(oneAPI/SYCL)、**Apple Silicon**(Metal)、**Vulkan** 以及 **NVIDIA Jetson**(L4T)。所有后端均可通过 [Backend Gallery](https://localai.io/backends/). 即时安装。 查看完整的 [后端与模型兼容性表](https://localai.io/model-compatibility/) 以及 [GPU 加速指南](https://localai.io/features/gpu-acceleration/). ### 我们自研的后端 大多数后端封装了同类上游引擎中的最佳实现。其中少数是由 LocalAI 项目自行开发并维护的原生 C/C++/GGML 引擎(推理时不依赖 Python): | 后端 | 功能说明 | |---------|-------------| | [parakeet.cpp](https://github.com/mudler/parakeet.cpp) | NVIDIA NeMo Parakeet ASR(tdt/ctc/rnnt/hybrid)的 C++/GGML 移植版,支持缓存感知的流式转录 | | [moss-transcribe.cpp](https://github.com/mudler/moss-transcribe.cpp) | OpenMOSS MOSS-Transcribe-Diarize 的 C++/GGML 移植版:单次遍历即可完成长文本转录、说话人分离与时间戳标注 | | [ced.cpp](https://github.com/mudler/ced.cpp) | CED 音频标注模型的 C++/GGML 移植版:通过 REST 与 realtime API 对声音事件进行分类(527 类 AudioSet),支持实时识别 | | [voice-detect.cpp](https://github.com/mudler/voice-detect.cpp) | 说话人识别与语音分析(ECAPA-TDNN、WeSpeaker、ERes2Net、CAM++、wav2vec2 年龄/性别/情绪),替代 Python 说话人识别后端 | | [voxtral-tts.c](https://github.com/mudler/voxtral-tts.c) | 纯 C 实现的 Voxtral Realtime 4B 语音转文本 | | [vibevoice.cpp](https://github.com/mudler/vibevoice.cpp) | Microsoft VibeVoice 的原生移植:支持 TTS(语音克隆)及带说话人分离的长文本 ASR | | [rf-detr.cpp](https://github.com/mudler/rf-detr.cpp) | 原生 RF-DETR 目标检测与实例分割 | | [locate-anything.cpp](https://github.com/mudler/locate-anything.cpp) | 开放词汇目标检测与视觉定位(LocateAnything-3B) | | [depth-anything.cpp](https://github.com/mudler/depth-anything.cpp) | Depth Anything 3 单目度量深度与相机位姿估计 | | [face-detect.cpp](https://github.com/mudler/face-detect.cpp) | 人脸检测、识别、人口统计属性分析与防伪(SCRFD/ArcFace、YuNet/SFace),替代 Python insightface 后端 | | [free-splatter.cpp](https://github.com/localai-org/free-splatter.cpp) | 无位姿 3D 重建(FreeSplatter):将少量普通照片转换为 3D Gaussians,无需相机位姿或 GPU | | [privacy-filter.cpp](https://github.com/localai-org/privacy-filter.cpp) | 独立的 GGML PII/NER 词元分类引擎,为 LocalAI 的 PII 脱敏层提供支持 | | [LocalVQE](https://github.com/localai-org/LocalVQE) | 联合声学回声消除、噪声抑制与去混响 | | [local-store](https://github.com/mudler/LocalAI) | 本地优先的嵌入向量数据库(随源码一同发布) | 我们还维护 [apex-quant](https://github.com/localai-org/apex-quant),:一种面向混合专家(Mixture-of-Experts)模型的逐张量、逐层量化方案,利用其结构稀疏性生成质量媲美甚至超越 Q8_0 的 GGUF 文件,且可在原版 llama.cpp 上开箱即用。 ## 资源 - [文档](https://localai.io/) - [LLM 微调指南](https://localai.io/docs/advanced/fine-tuning/) - [从源码构建](https://localai.io/basics/build/) - [Kubernetes 安装](https://localai.io/basics/getting_started/#run-localai-in-kubernetes) - [集成与社区项目](https://localai.io/docs/integrations/) - [安装视频教程](https://www.youtube.com/watch?v=cMVNnlqwfw4) - [媒体与博客文章](https://localai.io/basics/news/#media-blogs-social) - [示例](https://github.com/mudler/LocalAI-examples) — 包括 [实时语音助手演示](https://github.com/localai-org/localai-realtime-demo)(带工具调用的 Realtime API Go 客户端) ## 团队 LocalAI 由一支小型核心团队与广大贡献者社区共同维护。 - **[Ettore Di Giacinto](https://github.com/mudler)** — 原作者兼项目负责人 - **[Richard Palethorpe](https://github.com/richiejp)** — 维护者 衷心感谢每一位贡献代码、审查 PR、提交 issue 以及在 [Discord](https://discord.gg/uJAeKSAGDy) 中帮助用户的成员——LocalAI 是一个社区驱动的项目,离不开你们的支持。查看完整的 [贡献者名单](https://github.com/mudler/LocalAI/graphs/contributors). ## 引用 如果你在下游项目中使用了本仓库或其数据,请考虑引用: ``` @misc{localai, author = {Ettore Di Giacinto}, title = {LocalAI: The free, Open source OpenAI alternative}, year = {2023}, publisher = {GitHub}, journal = {GitHub repository}, howpublished = {\url{https://github.com/go-skynet/LocalAI}}, ``` ## 赞助商 > 觉得 LocalAI 有用吗? 成为 [支持者或赞助商](https://github.com/sponsors/mudler). 来支持本项目。你的 Logo 将显示在此处,并附带指向你网站的链接。 衷心感谢慷慨赞助本项目的赞助商,你们的支持覆盖了 CI 开支;参见我们的 [赞助商名单](https://github.com/sponsors/mudler):

往期赞助商


### 个人赞助商 特别感谢个人赞助商,完整名单见 [GitHub](https://github.com/sponsors/mudler) 与 [buymeacoffee](https://buymeacoffee.com/mudler). 特别鸣谢慷慨支持的 [drikster80](https://github.com/drikster80)。感谢大家! ## Star 历史 [![LocalAI Star history Chart](https://api.star-history.com/svg?repos=go-skynet/LocalAI&type=Date)](https://star-history.com/#go-skynet/LocalAI&Date) ## 许可证 LocalAI 是由 [Ettore Di Giacinto](https://github.com/mudler/) 创建、并由 [LocalAI 团队](#team) 维护的社区驱动项目。 MIT - 作者 Ettore Di Giacinto ## 致谢 LocalAI 的构建离不开社区中已有优秀软件的帮助。谢谢大家! - [llama.cpp](https://github.com/ggerganov/llama.cpp) - https://github.com/tatsu-lab/stanford_alpaca - https://github.com/cornelk/llama-go 为最初的创意 - https://github.com/antimatter15/alpaca.cpp - https://github.com/EdVince/Stable-Diffusion-NCNN - https://github.com/ggerganov/whisper.cpp - https://github.com/rhasspy/piper - [exo](https://github.com/exo-explore/exo) 用于 MLX 分布式自动并行分片(auto-parallel sharding)实现 ## 贡献者 这是一个社区项目,特别感谢我们的贡献者!