前言:
2023年3月份,OpenAI放出了官方最新的gpt-3.5-turbo API ,而且價格還很便宜,ChatGPT API價格為1k tokens/$0.002,大約等于每輸出100萬個單詞,才2.7美金左右,于是很多大佬出來了基于chatgpt api搭建的專案,今天就教大家如何在自己的服務器搭建屬于自己的ChatGPT網站.
準備條件:
1)一個chatgpt賬號獲取api-key
https://platform.openai.com/account/api-keys
2)一臺服務器(這里用centos7)
Cloud Computing Services - Amazon Web Services (AWS)
3)大佬的github專案
https://github.com/Chanzhaoyu/chatgpt-web
一、Docker環境部署
安裝docker和docker-compose
yum install docker
systemclt start docker
systemctl stop docker
systemctl restart docker
安裝 docker-compose
sudo curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
二、創建docker-compose.yml檔案
mkdir chatgpt_web && cd chatgpt_web #創建一個目錄并進入此目錄
創建docker-compose.yml檔案
vim docker-compose.yml #創建一個yml檔案
version: '3'
services:
app:
image: chenzhaoyu94/chatgpt-web:main
ports:
- 3002:3002
environment:
# 二選一
OPENAI_API_KEY: xxxx
# 二選一
OPENAI_ACCESS_TOKEN:
# 反向代理,可選
API_REVERSE_PROXY: xxx
# 超時,單位毫秒,可選
TIMEOUT_MS: 60000
將以上組態檔中OPENAI_API_KEY: xxxxxx填入自己的apikey
根據自己的需求進行適當引數修改
三、部署運行
docker-compose up -d
四、登錄chatgpt_web頁面
注意:需要打開相應埠
http://ip:3002 #根據自己的實際ip和埠
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/549225.html
標籤:其他
上一篇:chatgpt個人搭建
