项目介绍

Ollama 是一个开源的本地大语言模型运行工具,使用 Go 语言开发。它的目标是让任何人都能在自己的电脑上轻松运行大语言模型(LLM),无需复杂的配置和依赖管理。自 2023 年发布以来,Ollama 已经迅速成为 GitHub 上最受欢迎的 AI 相关项目之一,获得了超过 16 万颗星标。

Ollama 的核心理念是简单隐私。所有模型都在本地运行,数据不会发送到任何云端服务器。它支持 macOS、Linux 和 Windows 三大平台,能够自动检测并利用 NVIDIA、AMD 等 GPU 进行加速推理。用户只需一条命令 ollama run llama3 即可开始与 AI 对话。

Ollama 支持运行包括 DeepSeek、Llama 3、Qwen(通义千问)、Gemma、Mistral、Phi、Command R 等在内的数百种开源大语言模型,并且支持自定义模型文件(Modelfile)来创建个性化的 AI 助手。

核心特性

一键运行

只需一条命令即可下载并运行任何支持的大语言模型。无需手动下载模型文件、安装依赖或配置环境变量。

完全本地

所有推理都在本地完成,数据永远不会离开你的设备。适合处理敏感数据、企业内部文档和需要隐私保护的场景。

GPU 加速

自动检测并利用 NVIDIA CUDA、AMD ROCm、Apple Metal 等 GPU 加速技术,显著提升模型推理速度。

跨平台支持

支持 macOS(Intel 和 Apple Silicon)、Linux 和 Windows。提供原生应用和 Docker 镜像两种部署方式。

OpenAI 兼容 API

提供与 OpenAI API 兼容的 REST 接口,现有使用 OpenAI API 的应用可以无缝切换到 Ollama。

自定义模型

通过 Modelfile 创建自定义模型,设定系统提示词、调整参数、合并 LoRA 适配器,打造专属 AI 助手。

  • 多模型并行 — 支持同时加载和运行多个模型,根据请求自动调度。
  • 模型量化 — 支持 GGUF 格式,提供多种量化精度(Q4、Q5、Q8、FP16),在性能和质量间灵活选择。
  • 多模态支持 — 支持视觉模型如 LLaVA,可以分析图片内容并回答问题。
  • 工具调用 — 支持 Function Calling / Tool Use,让模型能够调用外部工具和 API。
  • 结构化输出 — 支持 JSON 模式和结构化输出,方便集成到应用程序中。
  • 热更新 — 模型在运行时可以热切换,无需重启服务。

支持模型

Ollama 支持数百种开源大语言模型,以下是一些最热门的模型:

模型名称参数量说明运行命令
DeepSeek-R17B / 70B深度求索推出的强推理模型,数学和代码能力突出ollama run deepseek-r1
Llama 3.18B / 70B / 405BMeta 发布的开源大模型,综合能力强劲ollama run llama3.1
Qwen 2.50.5B - 72B阿里通义千问系列,中文能力优秀ollama run qwen2.5
Gemma 22B / 9B / 27BGoogle DeepMind 推出的轻量高效模型ollama run gemma2
Mistral7B法国 Mistral AI 出品,性能优秀的小型模型ollama run mistral
Phi-33.8B / 14B微软推出的高效小模型,推理能力出色ollama run phi3
Command R+104BCohere 推出的企业级 RAG 优化模型ollama run command-r-plus
LLaVA7B / 13B多模态视觉语言模型,支持图片理解ollama run llava

快速开始

在你的设备上安装和运行 Ollama 非常简单:

平台安装方式
macOS下载 Ollama.app 或使用 brew install ollama
Linux运行 curl -fsSL https://ollama.com/install.sh | sh
Windows下载 Windows 安装包
Dockerdocker run -d -v ollama:/root/.ollama -p 11434:11434 ollama/ollama

安装完成后,运行你的第一个模型:

# 运行 Llama 3.1(首次运行会自动下载模型)
ollama run llama3.1

# 运行 DeepSeek-R1
ollama run deepseek-r1

# 运行通义千问(中文对话推荐)
ollama run qwen2.5

# 查看本地已下载的模型
ollama list

# 拉取模型但不运行
ollama pull gemma2

# 查看正在运行的模型
ollama ps

使用 Modelfile 创建自定义模型:

# 创建 Modelfile 文件
# FROM llama3.1
# SYSTEM "你是一个专业的中文翻译助手,请将用户输入的内容翻译为流畅的中文。"
# PARAMETER temperature 0.3

# 创建自定义模型
ollama create my-translator -f Modelfile

# 运行自定义模型
ollama run my-translator

API 接口

Ollama 提供 REST API,默认运行在 http://localhost:11434,并兼容 OpenAI API 格式:

# 生成文本(Ollama 原生 API)
curl http://localhost:11434/api/generate -d '{
  "model": "llama3.1",
  "prompt": "请用中文解释什么是机器学习",
  "stream": false
}'

# 使用 OpenAI 兼容 API 进行对话
curl http://localhost:11434/v1/chat/completions -d '{
  "model": "qwen2.5",
  "messages": [
    {"role": "system", "content": "你是一个有帮助的助手。"},
    {"role": "user", "content": "Hello!"}
  ]
}'

Python 中使用 OpenAI 客户端连接 Ollama:

from openai import OpenAI
client = OpenAI(base_url="http://localhost:11434/v1", api_key="ollama")
response = client.chat.completions.create(
    model="llama3.1",
    messages=[{"role": "user", "content": "你好"}]
)
print(response.choices[0].message.content)

生态系统

Open WebUI

功能丰富的 Web 聊天界面,支持多模型切换、对话历史、RAG、插件等,类似 ChatGPT 的使用体验。

LangChain

流行的 LLM 应用开发框架,原生支持 Ollama 作为后端,可构建 RAG、Agent 等复杂应用。

Continue

VS Code / JetBrains 的 AI 编程助手插件,支持使用 Ollama 本地模型进行代码补全和对话。

Ollama JavaScript 库

官方 JavaScript/TypeScript 客户端库,方便在 Node.js 和浏览器中集成 Ollama 功能。

Ollama Python 库

官方 Python 客户端库,提供同步和异步 API,支持流式输出、嵌入向量等功能。

AnythingLLM

全栈 AI 应用,支持 Ollama 作为 LLM 后端,提供文档问答、RAG、Agent 等企业级功能。

常见问题

运行 Ollama 需要什么样的硬件配置?
运行 7B 参数的模型(如 Llama 3.1 8B)至少需要 8GB 内存/显存;13B 模型需要 16GB;70B 模型需要 64GB。如果有 NVIDIA 或 AMD 独立显卡,模型会自动利用 GPU 加速。即使没有 GPU,也可以使用 CPU 运行,只是速度会慢一些。Apple Silicon Mac 的统一内存可以很好地运行大多数模型。
Ollama 和 ChatGPT 有什么区别?
ChatGPT 是 OpenAI 提供的云端 AI 服务,模型运行在 OpenAI 的服务器上。Ollama 则是在你自己的电脑上本地运行开源模型。主要优势是:完全免费(无 API 费用)、数据隐私(数据不离开本地)、无网络要求(离线可用)、可自定义(可以微调和定制模型)。但本地模型的能力通常不如 GPT-4 等最先进的闭源模型。
Ollama 支持中文模型吗?
支持。Ollama 可以运行多种中文能力优秀的模型,推荐使用 Qwen 2.5(通义千问)、DeepSeek 系列、Yi(零一万物)等,这些模型的中文理解和生成能力都很出色。运行命令如 ollama run qwen2.5
如何让局域网内的其他设备访问 Ollama?
默认情况下 Ollama 只监听 localhost。要允许局域网访问,设置环境变量 OLLAMA_HOST=0.0.0.0 后重启 Ollama 服务。其他设备即可通过你的内网 IP 地址访问 API(如 http://192.168.1.100:11434)。
Ollama 的许可证是什么?
Ollama 本身使用 MIT 开源许可证,可以自由使用和修改。但请注意,各个模型有各自的许可证(如 Llama 使用 Meta 的社区许可证,Qwen 使用 Apache 2.0 等),在商业使用前请确认具体模型的许可条款。

社区议题

以下是该项目当前开放的 Issue(按评论数排序),共 100 条,展示社区最关注的话题。

编号 议题标题 创建日期 评论
#2453 Add support for older AMD GPU gfx803, gfx802, gfx805 (e.g. Radeon RX 580, FirePro W7100)
feature requestamdbuild
2024-02-11 220
#1016 Support AMD GPUs on Intel Macs
feature requestamdmacos
2023-11-06 169
#5872 [Ascend ] add ascend npu support 2024-07-23 119
#941 `digest mismatch` on download
bug
2023-10-28 155
#1736 Download slows to a crawl at 99%
bugnetworkingregistry
2023-12-29 124
#1730 MLX backend
feature request
2023-12-27 95
#11691 Structured output with OpenAI SDK and gpt-oss:20b not working
buggpt-oss
2025-08-05 87
#5245 Allow importing multi-file GGUF models
bug
2024-06-23 87
#3368 Reranking models 2024-03-27 86
#2006 Rate limit download speed on pulling new models
networking
2024-01-15 79
#1590 Add support for Intel Arc GPUs
feature requestintel
2023-12-18 72
#3504 I can't pull any models
bug
2024-04-05 61
#162 Don't automatically start on startup / have an option to disable this
feature request
2023-07-21 61
#10430 Adding support for amd new GPUS 9070 and 9070 XT
feature requestwindows
2025-04-27 59
#7865 Model Context Protocol (MCP) support
feature request
2024-11-27 58
#1102 Ollama on FreeBSD
feature request
2023-11-12 58
#5186 AMD Ryzen NPU support
feature requestamd
2024-06-20 57
#10844 discover/gpu.go: Add Support for Distributed Inferencing (continued) 2025-05-24 56
#8618 Support Janus-Pro-7b for vision models
feature request
2025-01-27 56
#5800 Enable speculative decoding
feature requestperformance
2024-07-19 56
#9187 🪟 Windows 11 24H2 | Smart App Control Blocking Ollama | Unsafe
bugwindowsinstall
2025-02-18 52
#3185 ollama doesn't distribute notice licenses in its release artifacts
bug
2024-03-16 50
#9674 Error: POST predict: Post "http://127.0.0.1:62622/completion": read tcp 127.0.0.1:62627->127.0.0.1:62622: wsarecv: The remote host has closed a connection.
bugneeds more info
2025-03-12 49
#11714 gpt-oss 20b gguf model fail to run
bug
2025-08-06 48
#11199 Request for Support of AMD Ryzen AI Platform NPU
feature request
2025-06-25 48
#2169 Inference with OpenVINO on Intel
feature request
2024-01-24 47
#12197 Some requests get processed on CPU, even though model is loaded in GPU (GPT-OSS)
bug
2025-09-06 46
#3144 add /metrics endpoint
feature requestapi
2024-03-14 45
#3243 Support Steam Deck Docker amdgpu - gfx1033
feature requestamd
2024-03-19 43
#4643 Llama.cpp now supports distributed inference across multiple machines.
feature request
2024-05-26 42
#6922 Support for jinaai/jina-embeddings-v3 embedding model
model
2024-09-23 40
#5360 Support for Snapdragon X Elite NPU & GPU
feature requestwindows
2024-06-28 40
#2503 Support Radeon RX 5700 XT (gfx1010)
documentationamd
2024-02-14 40
#12962 feat: Add Support for Qwen3-vl and Qwen2.5-vl Video Mode 2025-11-05 38
#10792 Gemma 3n
model
2025-05-21 39
#9506 Ollama errors on older versions of Linux/GLIBC on 0.5.13
bug
2025-03-05 39
#7650 AMD Radeon 780M GPU (Pop OS !) System 76
buglinuxamdgpu
2024-11-13 37
#6364 docker container can't detect Nvidia GPU - intermittent "cuda driver library failed to get device context 801"
bugnvidianeeds more infodocker
2024-08-14 37
#2929 Ollama only using half of available CPU cores with NUMA multi-socket systems
buglinuxperformance
2024-03-05 37
#12606 GPT-OSS:20b reasoning loop when reasoning==high
bug
2025-10-14 36
#12187 GPT-OSS not completing tool calls
bug
2025-09-04 36
#10989 support for qwen3-embedding and qwen3-reranker models
model
2025-06-05 36
#9387 phi4 multimodal and mini instruct support
model
2025-02-27 36
#4072 Ollama should prevent sleep when working.
feature requestgood first issuewindows
2024-05-01 36
#228 Please don’t clutter the user home directory
feature request
2023-07-27 36
#12149 [Model Request] Support new Apertus model
model
2025-09-02 34
#14116 Tiered context length can exhaust VRAM
bug
2026-02-06 33
#9503 NVIDIA GPU drivers not loaded on Jeston Orin Nano
buglinuxnvidia
2025-03-04 33
#7288 embedding generation failed. wsarecv: An existing connection was forcibly closed by the remote host.
bug
2024-10-21 33
#6958 molmo by allen ai support
model
2024-09-25 32
#3113 Integrated Intel GPU support
feature requestintel
2024-03-13 33
#335 Model import/export
feature request
2023-08-11 33
#9639 Unsupported Value NaN in Ollama log
bug
2025-03-11 32
#3107 Windows Rocm: HSA_OVERRIDE_GFX_VERSION doesn´t work
bugwindowsamd
2024-03-13 32
#3004 Does ollama support accelerated running on npu?
feature request
2024-03-08 32
#10458 Qwen3 MoE 30b-a3b, poor performance and Low GPU utilization issue
bug
2025-04-29 31
#13576 feat: Add support for remote providers and OpenAI integration 2025-12-27 4
#10030 Deepseek R1, 671b is faster than 70b
performance
2025-03-28 30
#8843 Ollama current/stable (or built from source) appears broken on AMD MI300x ROCm gfx942
bugamdgpu
2025-02-05 30
#6262 Batch embeddings get progressively worse with larger batches
bug
2024-08-08 30
#10956 Garbage output when running llama3.2-vision:11b
bugneeds more info
2025-06-03 29
#5747 Support to Intel NPU by Intel NPU Acceleration Library
feature requestintel
2024-07-17 29
#3078 Ollama is not using the 100% of RTX4000 VRAM (18 of 20GB)
performancenvidia
2024-03-12 29
#10331 Client2 Feedback 2025-04-18 28
#9678 Unusually high VRAM usage of Gemma 3 27B
bug
2025-03-12 28
#8605 Error fetching ANY model locally
bugnetworking
2025-01-27 28
#8495 Why do I keep getting "@@@@" as responses?
bug
2025-01-20 28
#8105 Digest mismatch for llama3.3
bug
2024-12-15 28
#12976 Performance Regression on Apple Silicon M1: GPU → CPU Fallback in v0.12.9 (works correctly in v0.12.5)
bugperformancemacosneeds more info
2025-11-05 27
#12064 Tool call parsing errors
bug
2025-08-25 27
#3184 Add Video-LLaVA
feature request
2024-03-16 27
#13543 ggml: Fix PowerPC build and enable MMA Optimizations 2025-12-22 14
#7130 GPU VRAM Usage Timeout Warnings on Embeddings Model Load
bugmemory
2024-10-08 26
#12209 Version 11 bombing out and responds with GGGGGGGGGGGGGGG
bugnvidianeeds more info
2025-09-07 25
#10970 Support for MedGemma
model
2025-06-04 25
#7956 Low GPU usage on second GPU
bug
2024-12-05 25
#6230 Add Generate Embedding for Sparse vector
feature request
2024-08-07 25
#990 TPU backend support
feature request
2023-11-03 25
#914 Locally-hosted library
question
2023-10-26 25
#796 Support `ppc64le` architecture
feature request
2023-10-16 25
#14118 MLX Error
bug
2026-02-06 24
#13547 REGRESSION: NVIDIA-Nemotron-Nano-9B-v2 not working.
bug
2025-12-23 24
#13054 Ollama 0.12.10 embedding crash (nomic-embed-text-v1.5 on macOS)
bugmacosembeddings
2025-11-11 24
#8423 save with OLLAMA_MODELS set doesn't work anymore in 0.5.5
bug
2025-01-14 24
#6537 Add metrics endpoint and basic request metrics otel based 2024-08-27 19
#6294 AirLLM integration?
feature request
2024-08-09 24
#3898 Apple Silicone Neural Engine: Core ML model package format
feature request
2024-04-25 24
#3222 Support Grok
model
2024-03-18 24
#14073 New default context lengths will break 2026-02-04 23
#11772 use cpu to offload moe weights to reduce the VRAM usage.
feature request
2025-08-07 23
#11160 Enable Intel GPU support with SYCL backend 2025-06-22 23
#5629 Crashing or gibberish output on 3x Radeon GPUs
bugamdneeds more info
2024-07-11 23
#13763 Getting nonsense text responses using Intel ARC 750 8GB card (running on TrueNas)
bug
2026-01-17 22
#13297 Downloading from HuggingFace asks me for a token
bug
2025-12-02 22
#12940 Ollama Runner Fails with “Exit Status 2” and Random Non-Responsive Behavior on Windows
bug
2025-11-04 22
#12600 Continue support for AMD gfx906
feature requestamd
2025-10-13 22
#9727 Please support vision models
model
2025-03-13 22
#7167 Fine-tuned Llama 3.2 1B safe_serialized: Error: json: cannot unmarshal array into Go struct field .model.merges of type string
bugcreate
2024-10-10 22
#5321 Llama3: Generated outputs inconsistent despite seed and temperature
bug
2024-06-27 22
#3606 multilingual-e5-large and multilingual-e5-base Embedding Model Support
model
2024-04-11 22