兼容多平台,基于https://github.com/xqdoo00o/ChatGPT-to-API
6.7K
关于refresh_token使用方法详见作者项目
从ChatGPT网站模拟使用API
如需使用Railway平台部署请访问https://github.com/slippersheepig/ChatGPT-to-API-Railway
源码https://github.com/xqdoo00o/ChatGPT-to-API
Tip
如果没有账号,将部署代码中包含harPool和account.txt的这两行注释即可(据说不登录账号会比较智障,请自行测试)
使用步骤(摘自原作者项目)
harPool文件夹,将获取到的chatgpt.com.har文件放到文件夹内(如无ChatGPT账号可跳过此步)chatgpt.com.har获取方法(如果此前已导出过chat.openai.com.har,也可以使用chat.openai.com.har代替chatgpt.com.har)
https://chatgpt.com,新建聊天并选择GPT-4模型,随意输入下文字,切换到GPT-3.5模型,随意输入下文字(如果不是付费账号,则忽略切换模型步骤,直接输入文字)。chatgpt.com.har,放置到harPool文件夹里。accounts.txt文件,按如下格式录入保存账号信息(如无ChatGPT账号可跳过此步,注意冒号为英文冒号)
邮箱A:密码
api_keys.txt文件,按如下格式录入保存key信息
sk-123456
docker-compose.yml文件 ,根据需要按如下模板编辑保存
services:
app:
image: sheepgreen/chatgpt-to-api #或使用github镜像ghcr.io/slippersheepig/chatgpt-to-api
container_name: cta
restart: always
ports:
- 8080:8080
volumes:
- ./harPool:/cta/harPool #如无账号,或使用refresh_token时可删此行
- ./api_keys.txt:/cta/api_keys.txt #自建key,说明详见作者项目
- ./accounts.txt:/cta/accounts.txt #如无账号可删此行
#- ./cookies.json:/cta/cookies.json #使用refresh_token时取消注释
environment:
SERVER_HOST: 0.0.0.0
ADMIN_PASSWORD: TotallySecurePassword #自行修改密码
#CLIENT_PROFILE: Chrome_124 #无账号使用时取消注释
#UA: Mozilla/5.0 #无账号使用时取消注释
services:
app:
image: sheepgreen/chatgpt-to-api #或使用github镜像ghcr.io/slippersheepig/chatgpt-to-api
container_name: cta
restart: always
ports:
- 8080:8080
volumes:
- ./harPool:/cta/harPool #如无账号,或使用refresh_token时可删此行
- ./api_keys.txt:/cta/api_keys.txt #自建key,说明详见作者项目
- ./accounts.txt:/cta/accounts.txt #如无账号可删此行
#- ./cookies.json:/cta/cookies.json #使用refresh_token时取消注释
environment:
SERVER_HOST: 0.0.0.0
ADMIN_PASSWORD: TotallySecurePassword #自行修改密码
#CLIENT_PROFILE: Chrome_124 #无账号使用时取消注释
#UA: Mozilla/5.0 #无账号使用时取消注释
HTTP_PROXY: http://wgcf:40002
depends_on:
- wgcf
wgcf:
image: zenexas/wgcf-socks
container_name: wgcf
restart: always
docker-compose up -d即启动成功,API访问地址为http://[ip]:8080/v1/chat/completions,API KEY为api_keys.txt里填写的KEY,根据你使用的ChatGPT项目自行修改代理地址即可
api_keys.txt里填写的KEYapi_keys.txt里填写的KEYapi_keys.txt里填写的KEY"] }Content type
Image
Digest
sha256:5133eef08…
Size
9.4 MB
Last updated
11 months ago
docker pull sheepgreen/chatgpt-to-api