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://chat.openai.com
若要使用TOKENS_FILE内的账号,AUTHORIZATIONS字段内必须配置ac-
开头的AUTHORIZATION并使用ac-***调用本程序,若ACCESS_TOKENS无可用账号则返回401错误,tokens.yml
详见tokens.template.yml
mkdir -p $PWD/free-gpt3.5-2api
docker run -itd --name=free-gpt3.5-2api -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
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
}'