⭐ If this project is helpful to you, please consider giving it a star! This helps us understand the value of our work and motivates continued development.
🍴 Want to contribute? We welcome forks and pull requests! Feel free to submit improvements, bug fixes, or new features.
If you don't have an API Key, please contact us for enterprise cloud solutions. We are Google Cloud Certified Partners, providing cost-effective enterprise-grade API KEYs, including:
- Claude Series
- Gemini Series
- OpenAI
- Other Open-Source LLMs
📞 Contact Us: http://cmcm.bot/ 📖 Learn More: https://www.polymericcloud.com/
This is a foundational service project for the DeepV Code Client, serving as a lightweight AI proxy server that supports Vertex AI and OpenRouter.
This project aims to provide a unified AI interface access layer for DeepV Code Client, handling authentication, request forwarding, and response format conversion for different AI providers (such as Google Vertex AI and OpenRouter).
- Multi-Provider Support: Integrated with Google Vertex AI and OpenRouter.
- Unified Interface: Provides a unified chat interface supporting both streaming and non-streaming responses.
- Format Conversion: Automatically converts responses from different providers into a unified Google AI format.
- Mock Authentication: Built-in Mock JWT login interface for convenient development and testing.
Before submitting or publishing code, ensure the following information is properly handled:
- Environment Variables:
.envfile is already in.gitignore, make sure not to commit it. - Credential Files: All JSON credential files in the
key/directory are already in.gitignore. - Debug Logs: Recommend adding
.deepvcode/directory to.gitignoreas it contains detailed request and response logs (potentially containing API Keys or sensitive data). - Mock Data: The
deepvlab-logininterface insrc/routes.tscontains hardcoded test email and avatar information, recommend cleaning or anonymizing as needed.
- Node.js (v18+ recommended)
- npm or yarn
npm install- Copy the environment template:
cp .env.example .env
- Edit the
.envfile with the necessary configuration:OPENROUTER_API_KEY: Your OpenRouter API key.VERTEX_CREDENTIALS_PATHS: Path to Vertex AI service account JSON file.GOOGLE_API_KEY: (Optional) Google API key.
npm run devnpm run dev:debugMethod 1: Direct Start (Simple but not recommended)
npm run build
npm run start:prodMethod 2: PM2 Process Manager (Recommended)
PM2 provides auto-restart, log management, process monitoring, and other production-level features.
First, globally install PM2:
npm install -g pm2Then start the application:
npm run pm2:start # Start application (auto-compile + start)
pm2 monit # Monitor application status and performance
npm run pm2:logs # View real-time logs
npm run pm2:restart # Restart application (requires recompilation)
npm run pm2:reload # Graceful restart (zero-downtime)
pm2 kill # Stop all applications
npm run pm2:delete # Stop and delete applicationEnable auto-start on system boot:
npm run pm2:startup # Configure auto-start on boot
pm2 save # Save current configurationMethod 3: Docker Containerization (Best Practice)
Docker ensures consistency and isolation in production environments.
Build image:
docker build -t deepx-mini-server:latest .Start with docker-compose (recommended):
docker-compose up -d # Start in background
docker-compose logs -f # View logs
docker-compose ps # Check container status
docker-compose stop # Stop service
docker-compose down # Stop and remove containersOr run Docker container directly:
docker run -d \
--name deepx-mini-server \
-p 3001:3001 \
-e NODE_ENV=production \
-e OPENROUTER_API_KEY=your_key_here \
-v ./key:/app/key:ro \
-v ./logs:/app/logs \
--restart unless-stopped \
deepx-mini-server:latestMethod 4: Systemd Service (Native Linux Solution)
Copy deepx-mini-server.service to systemd directory:
sudo cp deepx-mini-server.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable deepx-mini-server # Enable auto-start on boot
sudo systemctl start deepx-mini-server # Start service
sudo systemctl status deepx-mini-server # Check status
sudo journalctl -u deepx-mini-server -f # View logsDepending on your client type, follow these steps to configure the proxy server address:
-
Locate the
.deepv/folder in your user home directory:- macOS:
~/.deepv/settings.jsonor/Users/your-username/.deepv/settings.json - Windows:
C:\Users\your-username\.deepv\settings.json
- macOS:
-
Open the
settings.jsonfile -
Add or modify the
customProxyServerUrlconfiguration, for example:{ "customProxyServerUrl": "http://localhost:3001" } -
Restart CLI to apply the configuration
- Open VSCode extension settings
- Search for
Custom Proxy Server Url - Enter the proxy server address, for example:
http://localhost:3001 - Restart VSCode to apply the configuration
Server Address Examples:
- Local development:
http://localhost:3001 - Remote server:
https://your-server-domain.com
- POST
/v1/chat/messages: Unified chat interface. - POST
/v1/chat/stream: Unified streaming chat interface. - POST
/auth/jwt/deepvlab-login: Mock login interface, returns test JWT token. - GET
/health: Health check endpoint.
| Method | Scenario | Advantages | Disadvantages |
|---|---|---|---|
| PM2 | Single machine | Simple to use, auto-restart, log management | No horizontal scaling |
| Docker + docker-compose | Development/small production | Good consistency, easy to scale | Requires Docker knowledge |
| Kubernetes | Large-scale production | High availability, auto-scaling, load balancing | Steep learning curve, complex config |
| Systemd | Linux native | System-level, good resource isolation | Linux only, limited features |
- Small scale & Single machine → PM2
- Medium scale & Need consistency → Docker Compose
- Large scale & High availability → Kubernetes
- Linux system preferred → Systemd
# 1. Enable cluster mode (utilize multi-core CPUs)
# Already configured as 'cluster' mode in ecosystem.config.cjs
# 2. Set reasonable number of processes
# instances: 4 for small business use
# 3. Use reverse proxy (Nginx) for static resources and load balancing
# Recommended configuration in nginx.conf.example
# 4. Configure memory limits to prevent memory leaks
# max_memory_restart: '1G' auto-restarts when exceeding 1GB
# 5. Enable gzip compression (configure at reverse proxy layer)Use PM2 Plus (paid but worth it):
pm2 link # Link to PM2 Plus DashboardOr use open-source solutions:
# Monitor process status
pm2 monit
# Export logs for analysis
pm2 save
pm2 logs --lines 1000 > server.logProduction Environment Sensitive Information:
Never hardcode sensitive information in code, use environment variables:
# .env.production (don't commit to Git)
NODE_ENV=production
PORT=3001
HOST=0.0.0.0
OPENROUTER_API_KEY=sk-xxxxx
VERTEX_CREDENTIALS_PATHS=/opt/deepx-mini-server/key/creds.json
CORS_ORIGIN=https://yourdomain.comWhen using docker-compose, reference the .env file:
docker-compose --env-file .env.production up -d- Express: Web framework.
- TypeScript: Programming language.
- tsx: Development runtime tool.
- Google Auth Library: Google Cloud authentication.
- PM2: Production-grade process manager.
- Docker: Container deployment.