LOG_LEVEL=info # debug, info, warn, error
LOG_PATH= # 日志文件路径,默认为空(不生成日志文件)
BIND=0.0.0.0 # 127.0.0.1
PORT=3040
TOKENS_FILE= # 账号token文件,默认 tokens.yml
PROXY= # http://127.0.0.1:7890,http://127.0.0.1:7890 已支持多个代理(英文 "," 分隔)
AUTHORIZATIONS= # abc,bac (英文 "," 分隔) 注:必须
BASE_URL= # 默认:https://chatgpt.com
mkdir -p $PWD/free-gpt3.5-2api
docker run -itd --name=free-gpt3.5-2api -e AUTHORIZATIONS=abc,bac -p 9846:3040 ghcr.io/aurorax-neo/free-gpt3.5-2api
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower -cR free-gpt3.5-2api --debug
把本仓库根目录的compose.yaml文件下载到你的电脑(最好为它建立一个free-gpt3.5-2api文件夹,放在文件夹里,这样防止多个compose文件冲突),在compose.yaml目录下运行如下命令
docker compose up -d
docker compose pull
docker compose up -d
services:
free-gpt3.5-2api:
container_name: free-gpt3.5-2api #这里写你想起的容器名称
image: ghcr.io/aurorax-neo/free-gpt3.5-2api
ports:
- 7846:3040 #docker默认不经过ufw和firewall,如果想要不暴露端口到外网,在端口前加127.0.0.1,像这样 127.0.0.1:7846:3040
#7846:3040 前面是主机端口,可以自定义,后面是容器端口不要修改
restart: unless-stopped #容器停止和启动须经过手动操作,不会随docker自启
environment:
- AUTHORIZATIONS=abc,bac #注意:“=”后的内容请自行修改,避免接口被刷
Authorization
使用 AUTHORIZATIONS
其中任意一个
curl --location --request GET 'http://127.0.0.1:9846/v1/accTokens' \
--header 'Authorization: Bearer abc'
返回示例说明:count
为ACCESS_TOKEN池中可用授权数
{
"count": 1,
"canUseCount": 1
}
http://<ip>:<port>/v1/chat/completions
curl http://127.0.0.1:9846
curl --location --request POST 'http://127.0.0.1:9846/v1/chat/completions' \
--header 'Authorization: Bearer abc' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "user",
"content": "西红柿炒钢丝球怎么做?"
}
],
"stream": false
}'
"gpt-3.5-turbo": "text-davinci-002-render-sha",
"gpt-3.5-turbo-16k": "text-davinci-002-render-sha",
"gpt-3.5-turbo-16k-0613": "text-davinci-002-render-sha",
"gpt-3.5-turbo-0301": "text-davinci-002-render-sha",
"gpt-3.5-turbo-0613": "text-davinci-002-render-sha",
"gpt-3.5-turbo-1106": "text-davinci-002-render-sha",
"gpt-4o": "gpt-4o",
"auto": "auto",
"gpt-4o-av": "gpt-4o-av",