Overview
OpenWebUI (formerly Ollama WebUI) is an open-source web interface providing a ChatGPT-like experience for various LLM backends. It supports multiple backends (Ollama, OpenAI, Anthropic, Google, Groq, DeepSeek), offering conversation management, knowledge base, code execution, file upload, and more.
Features
- ✓Multi-backend support
- ✓Conversation management
- ✓Knowledge base with RAG
- ✓Code execution sandbox
- ✓File upload and processing
- ✓Model management
- ✓Multi-user support
- ✓REST API
- ✓Docker deployment
Installation
docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data ghcr.io/open-webui/open-webui:mainPros
- +Supports multiple LLM backends
- +ChatGPT-like interface
- +Open-source and fully customizable
- +Rich features (knowledge base, code execution)
- +Simple Docker deployment
- +Active community
Cons
- −Requires self-deployment and maintenance
- −Some advanced features need technical knowledge
- −Local models require GPU resources
- −Multi-user management relatively simple
Alternatives
Documentation
OpenWebUI
Overview
OpenWebUI(原 Ollama WebUI)是一个开源的 Web 界面,为各种 LLM 后端提供类 ChatGPT 的用户体验。它支持多种后端模型(Ollama、OpenAI、Anthropic、Google 等),提供对话管理、知识库、代码执行、文件上传等丰富功能。
OpenWebUI 的核心理念是让任何 LLM 后端都能拥有现代化的 Web 界面。无论你是本地运行 Ollama 模型,还是使用云端的 OpenAI API,OpenWebUI 都能提供一个统一、美观、功能丰富的交互界面。
Features
- 多后端支持:Ollama、OpenAI、Anthropic、Google、Groq、DeepSeek 等
- 对话管理:多对话标签、对话历史、搜索
- 知识库:RAG 支持,上传文档进行问答
- 代码执行:内置 Python 代码执行环境
- 文件上传:支持 PDF、TXT、DOCX 等格式
- 模型管理:多模型切换、模型下载(Ollama)
- 用户管理:多用户支持、权限控制
- API 支持:完整的 REST API
- Docker 部署:一键部署,易于维护
Installation
Docker(推荐)
docker run -d -p 3000:8080 \
--add-host=host.docker.internal:host-gateway \
-v open-webui:/app/backend/data \
--name open-webui \
--restart always \
ghcr.io/open-webui/open-webui:main
Docker Compose
version: '3.8'
services:
open-webui:
image: ghcr.io/open-webui/open-webui:main
ports:
- "3000:8080"
environment:
- OLLAMA_BASE_URL=http://ollama:11434
volumes:
- open-webui:/app/backend/data
depends_on:
- ollama
restart: always
ollama:
image: ollama/ollama:latest
volumes:
- ollama:/root/.ollama
volumes:
open-webui:
ollama:
pip 安装
pip install open-webui
open-webui serve
Quick Start
- 启动 OpenWebUI(Docker 或 pip)
- 在浏览器中打开 http://localhost:3000
- 创建第一个管理员账户
- 配置模型后端(Ollama、OpenAI 等)
- 开始对话
Core Concepts
后端集成
OpenWebUI 支持多种后端:
| 后端 | 配置方式 | 说明 |
|---|---|---|
| Ollama | OLLAMA_BASE_URL | 本地运行开源模型 |
| OpenAI | OPENAI_API_KEY | 使用 GPT 系列模型 |
| Anthropic | ANTHROPIC_API_KEY | 使用 Claude 系列模型 |
GOOGLE_API_KEY | 使用 Gemini 系列模型 | |
| Groq | GROQ_API_KEY | 高速推理 API |
| DeepSeek | DEEPSEEK_API_KEY | DeepSeek 模型 |
功能模块
┌─────────────────────────────────────────────┐
│ OpenWebUI │
├─────────────────────────────────────────────┤
│ 对话界面 │
│ ├── 多对话标签 │
│ ├── 对话历史 │
│ └── 消息管理 │
├─────────────────────────────────────────────┤
│ 知识库 │
│ ├── 文档上传 │
│ ├── 向量索引 │
│ └── RAG 问答 │
├─────────────────────────────────────────────┤
│ 模型管理 │
│ ├── 模型切换 │
│ ├── 模型下载(Ollama) │
│ └── 参数配置 │
├─────────────────────────────────────────────┤
│ 用户管理 │
│ ├── 多用户支持 │
│ ├── 权限控制 │
│ └── 使用统计 │
└─────────────────────────────────────────────┘
Examples
示例 1:本地模型对话
# 1. 安装 Ollama
ollama pull llama3
# 2. 启动 OpenWebUI 并配置 Ollama
docker run -d -p 3000:8080 \
--add-host=host.docker.internal:host-gateway \
-v open-webui:/app/backend/data \
-e OLLAMA_BASE_URL=http://host.docker.internal:11434 \
ghcr.io/open-webui/open-webui:main
# 3. 在浏览器中选择 llama3 模型进行对话
示例 2:知识库问答
1. 在 OpenWebUI 中创建知识库
2. 上传 PDF/DOCX/TXT 文档
3. OpenWebUI 自动索引文档
4. 提问:"根据上传的文档,xxx 是什么?"
5. 系统基于文档内容回答
示例 3:代码执行
用户:请用 Python 写一个快速排序算法并运行测试
OpenWebUI:
1. 生成 Python 代码
2. 在内置沙箱中执行
3. 显示执行结果和输出
4. 可以修改后重新运行
Pros
- ✅ 支持多种 LLM 后端,灵活选择
- ✅ 类 ChatGPT 界面,用户体验好
- ✅ 开源免费,完全可定制
- ✅ 丰富的功能(知识库、代码执行等)
- ✅ Docker 部署简单
- ✅ 活跃的社区和频繁更新
Cons
- ❌ 需要自行部署和维护
- ❌ 某些高级功能需要技术知识
- ❌ 本地模型需要 GPU 资源
- ❌ 多用户管理功能相对简单
When to Use
- 想要本地运行开源模型时
- 需要统一的 Web 界面管理多个模型时
- 需要知识库问答功能时
- 想要自托管 ChatGPT 类界面时
- 需要多用户支持时
Use Cases
| Use Case | Why OpenWebUI |
|---|---|
| Self-Hosted ChatGPT | Complete data control with local deployment |
| Multi-Model Management | Unified interface for Ollama, OpenAI, Anthropic, etc. |
| Knowledge Base Q&A | Built-in RAG with document upload and indexing |
| Team Collaboration | Multi-user support with role-based permissions |
Comparison with Alternatives
| Feature | OpenWebUI | Ollama WebUI | ChatUI | LangChain |
|---|---|---|---|---|
| Self-Hosted | ✅ Yes | ✅ Yes | ❌ No | ✅ Yes |
| Multi-Backend | ✅ 10+ | ⚠️ Ollama focus | ❌ No | ✅ Yes |
| RAG Built-in | ✅ Yes | ❌ No | ⚠️ Limited | ⚠️ Manual |
| Code Execution | ✅ Yes | ❌ No | ❌ No | ⚠️ Via tools |
| Multi-User | ✅ Yes | ❌ No | ⚠️ Limited | ❌ No |
| Docker Deploy | ✅ Yes | ✅ Yes | ❌ No | ⚠️ Manual |
| Learning Curve | Low | Low | Low | High |
| Best for | Self-hosted UI | Ollama focus | Simple chat | Developers |
Best Practices
- Use Docker for deployment — Simplest setup with one command
- Configure backends properly — Set environment variables for each LLM provider
- Enable RAG for knowledge — Upload documents for enhanced Q&A capabilities
- Set up multi-user access — Configure permissions for team collaboration
- Use code execution carefully — Sandboxed Python environment for safety
Troubleshooting
| Issue | Solution |
|---|---|
| Docker fails to start | Check port 3000/8080 availability and Docker permissions |
| Model not connecting | Verify backend URL and API key configuration |
| RAG not returning results | Re-index documents and check vector store settings |
| Code execution fails | Check sandbox permissions and Python environment |
