Skip to main content

ChatGPT-Proxy

Ven2s...About 1 minCodeChatGPT

Build ChatGPT Reverse Proxy

  • Due to the free proxy of the ChatGPT-Web project being down, we choose this project go-chatgpt-apiopen in new window to address the proxy issue.

Build Steps

1. Install Docker and Docker-compose

  • Install Docker
# Update and install essential software

apt-get update && apt-get install -y wget nano

# Install Docker

curl -sSL https://get.docker.com/ | sh

# Start Docker on boot

systemctl start docker
systemctl enable docker
  • Install Docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/v2.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

2. Install go-chatgpt-apiopen in new window

  • Create a directory
mkdir -p /data/docker_data/go-chatgpt-api
cd /data/docker_data/go-chatgpt-api
  • Create a docker-compose.yml file
nano docker-compose.yml
  • Enter the following content in the file, then save with Ctrl+X and exit with Y
version: "3"
services:
  go-chatgpt-api:
    container_name: go-chatgpt-api
    image: linweiyuan/go-chatgpt-api
    ports:
      - 8080:8080  # Container port mapped to host port 8080; adjust host port as needed
    environment:
      - GIN_MODE=release
      - CHATGPT_PROXY_SERVER=http://chatgpt-proxy-server:9515
      #- NETWORK_PROXY_SERVER=http://host:port     # NETWORK_PROXY_SERVER: Shadowsocks proxy address, e.g., http://10.0.5.10:7890
      #- NETWORK_PROXY_SERVER=socks5://host:port   # NETWORK_PROXY_SERVER: Shadowsocks proxy address
    depends_on:
      - chatgpt-proxy-server
    restart: unless-stopped

  chatgpt-proxy-server:
    container_name: chatgpt-proxy-server
    image: linweiyuan/chatgpt-proxy-server
    restart: unless-stopped
  • After creating, run
docker-compose up -d
  • Check running containers; ensure the container status is UP
docker ps
  • Check if the mapped listening port on the host is active
ss -tnlp|grep 8080

3. Use Self-built Reverse Proxy

# Reverse proxy, optional
API_REVERSE_PROXY: https://example.com/conversation
  • Now, access chatgpt-web to see if it works properly. Make sure chatgpt-proxy-server is running correctly, and go-chatgpt-api needs some time to initialize.
# Check container logs for normal operation
docker logs -f chatgpt-proxy-server
docker logs -f go-chatgpt-api

Completed

1
😏

Tutorial Source: ChatGPT-Porxyopen in new window

Comments
  • Latest
  • Oldest
  • Hottest
Powered by Waline v2.15.8