Overview of LobeChat
LobeChat is an open-source framework designed for deploying high-performance conversational AI interfaces. It enables users to launch personalized LLM or ChatGPT web applications with features like speech synthesis, multimodal capabilities, and an extensible plugin architecture.
Motivation for Self-Hosting
While ChatGPT Plus offers a robust feature set, deploying LobeChat addresses several specific requirements:
- Direct access to AI services without relying on VPN connections.
- Seamless voice-to-text and text-to-speech interactions, mimicking native mobile app experiences.
- Securely sharing a single API key with multiple users while maintaining privacy via access controls.
- Flexibility to integrate various large language model providers beyond OpenAI.
- Branding opportunities through custom domains and personalized UI theming.
Core Capabilities
- Visual Comprehension: Leverages GPT-4-vision to process and discuss uploaded images.
- Audio Interaction: Built-in STT/TTS functionality with diverse voice selections.
- Image Generation: Transforms text prompts into visuals using integrated AI tools.
- Extensible Plugins: Broadens functionality with tools for fetching real-time data, news, or documents.
- Assistant Marketplace: A community-driven hub for discovering and sharing specialized AI agents.
- Progressive Web App (PWA): Delivers a native-like experience across desktop and mobile browsers.
- Responsive Design: Fully optimized for mobile screen sizes.
- Theming: Highly customizable appearance settings.
Prerequisites
Before starting the deployment, ensure you have the following:
- A server (only necessary for Docker; Vercel deployment is serverless).
- An OpenAI API Key.
- An API proxy endpoint (required if direct access to OpenAI is restricted; not needed for Vercel if deployed in a supported region).
Deployment Strategy 1: Vercel
Leveraging Vercel eliminates the need for a dedicated server and proxy configuration. The free tier provides sufficient resources for personal use.
1. Fork the Repository
Fork the lobehub/lobe-chat repository on GitHub. Enable the Upstream Sync Action in your fork's settings to automatically fetch updates from the original project.
2. Vercel Account Setup
Create an account on Vercel. The platform handles continuous deployment, CDN distribution, and SSL certificate management automatically upon linking your GitHub repository.
3. Project Creation and Configuration
Import the forked repository into a new Vercel project. Configure the following environment variables during setup:
| Variable | Requirement | Description | Example |
|---|---|---|---|
OPENAI_API_KEY | Required | Your secret key from OpenAI | sk-xxxxxxxxxxxxxxxx |
OPENAI_PROXY_URL | Optional | Base URL for API proxying | https://proxy.example.com/v1 |
ACCESS_CODE | Optional | Password to secure your instance (comma-separated for multiple) | mySecurePassword123 |
CUSTOM_MODELS | Optional | Control model list: + to add, - to remove, = to rename | -gpt-3.5-turbo,+claude-3-opus |
4. Access and Domain Configuration
Once deployment completes, access the application via the Vercel-provided URL. You will be prompted to enter the ACCESS_CODE if configured. Vercel allows you to bind a custom domain directly through the project settings, requiring a corresponding DNS record update with your domain registrar.
Deployment Strategy 2: Docker
For those preferring containerized environments, LobeChat provides an official Docker image.
Fetch the latest container image:
docker image add lobehub/lobe-chat:latest
Launch the container with basic configuration:
docker create --name my-ai-chat -p 3210:3210 \
-e OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxx \
-e ACCESS_CODE=mySecurePassword123 \
lobehub/lobe-chat:latest
docker start my-ai-chat
To route traffic through a proxy, include the proxy URL environment variable:
docker run -d --name proxied-ai-chat -p 3210:3210 \
-e OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxx \
-e OPENAI_PROXY_URL=https://proxy.example.com/v1 \
-e ACCESS_CODE=mySecurePassword123 \
lobehub/lobe-chat:latest