汇总贴:linweiyuan#74
ChatGPT
登录(返回accessToken
)(目前仅支持ChatGPT
账号,谷歌或微软账号没有测试)
POST /chatgpt/login
{
"username": "email",
"password": "password"
}
- 获取对话列表(历史记录)
GET /chatgpt/conversations?offset=0&limit=20
offset
不传默认为 0, limit
不传默认为 20 (最大为 100)
- 获取对话内容
GET /chatgpt/conversation/{conversationID}
- 新建对话
POST /chatgpt/conversation
{
"action": "next",
"messages": [
{
"id": "message id",
"author": {
"role": "user"
},
"content": {
"content_type": "text",
"parts": [
"Hello World"
]
}
}
],
"parent_message_id": "parent message id",
"conversation_id": "conversation id",
"model": "text-davinci-002-render-sha",
"timezone_offset_min": -480,
"history_and_training_disabled": false
}
- 生成对话标题
POST /chatgpt/conversation/gen_title/{conversationID}
{
"message_id": "role assistant response message id"
}
- 重命名对话标题
PATCH /chatgpt/conversation/{conversationID}
{
"title": "new title"
}
- 删除单个对话
PATCH /chatgpt/conversation/{conversationID}
{
"is_visible": false
}
- 删除所有对话
PATCH /chatgpt/conversations
{
"is_visible": false
}
- 消息反馈
POST /chatgpt/conversation/message_feedback
{
"message_id": "message id",
"conversation_id": "conversation id",
"rating": "thumbsUp/thumbsDown"
}
platform
登录(返回sessionKey
)
POST /platform/login
{
"username": "email",
"password": "password"
}
GET /platform/v1/models
GET /platform/v1/models/{model}
POST /platform/v1/completions
{
"model": "text-davinci-003",
"prompt": "Say this is a test",
"max_tokens": 7,
"temperature": 0,
"stream": true
}
POST /platform/v1/chat/completions
{
"messages": [
{
"role": "user",
"content": "Hello World"
}
],
"model": "gpt-3.5-turbo",
"stream": true
}
POST /platform/v1/edits
{
"model": "text-davinci-edit-001",
"input": "What day of the wek is it?",
"instruction": "Fix the spelling mistakes"
}
POST /platform/v1/images/generations
{
"prompt": "A cute dog",
"n": 2,
"size": "1024x1024"
}
POST /platform/v1/embeddings
{
"model": "text-embedding-ada-002",
"input": "The food was delicious and the waiter..."
}
POST /platform/v1/moderations
{
"model": "text-moderation-stable",
"input": "I want to kill them."
}
GET /platform/v1/files
- 获取
credit grants
(只能传sessionKey
)
GET /platform/dashboard/billing/credit_grants
- 获取
subscription
(只能传sessionKey
)
GET /platform/dashboard/billing/subscription
- 获取
api keys
(只能传sessionKey
)
GET /platform/dashboard/user/api_keys
如需设置代理,可以设置环境变量 GO_CHATGPT_API_PROXY
,比如 GO_CHATGPT_API_PROXY=http://127.0.0.1:20171
或者 GO_CHATGPT_API_PROXY=socks5://127.0.0.1:20170
,注释掉或者留空则不启用
如需配合 warp
使用:GO_CHATGPT_API_PROXY=socks5://chatgpt-proxy-server-warp:65535
,因为需要设置 warp
的场景已经默认可以直接访问 ChatGPT
官网,因此共用一个变量不冲突
docker-compose
配置文件:
services:
go-chatgpt-api:
container_name: go-chatgpt-api
image: linweiyuan/go-chatgpt-api
ports:
- 8080:8080
environment:
- GO_CHATGPT_API_PROXY=
restart: unless-stopped
我仅仅在 Arch Linux
上进行开发和测试,这是一个滚动更新的版本,意味着系统上所有东西都是最新的,如果你在使用的过程中 yaml
报错了,则可以加上 version: '3'
在 services:
前面
如果遇到 Access denied
,但是你的服务器确实在被支持的国家或地区
,尝试一下这个配置(不保证能解决问题,比如你的服务器在 A 地区,但 A 地不在支持列表内,即使用上了 warp
后是 Cloudflare IP
,结果也会是 403
):
services:
go-chatgpt-api:
container_name: go-chatgpt-api
image: linweiyuan/go-chatgpt-api
ports:
- 8080:8080
environment:
- GO_CHATGPT_API_PROXY=socks5://chatgpt-proxy-server-warp:65535
depends_on:
- chatgpt-proxy-server-warp
restart: unless-stopped
chatgpt-proxy-server-warp:
container_name: chatgpt-proxy-server-warp
image: linweiyuan/chatgpt-proxy-server-warp
environment:
- LOG_LEVEL=OFF
restart: unless-stopped
如果你知道什么是 teams-enroll-token
,可以通过环境变量 TEAMS_ENROLL_TOKEN
设置它的值
然后利用这条命令来检查是否生效:
docker-compose exec chatgpt-proxy-server-warp warp-cli --accept-tos account | awk 'NR==1'
Account type: Free (没有生效)
Account type: Team (设置正常)
如果要让运行的镜像总是保持最新,可以配合这个一起使用:
services:
watchtower:
container_name: watchtower
image: containrrr/watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: --interval 3600
restart: unless-stopped
广告位
Vultr
推荐链接:https://www.vultr.com/?ref=7372562
个人微信(没有验证,谁都能加,添加即通过,不用打招呼,直接把问题发出来,日常和私人问题不聊,不进群;可以解答程序使用问题,但最好自己要有一定的基础;可以远程调试,仅限 SSH
或ToDesk
,但不保证能解决):
微信赞赏码(经济条件允许的可以考虑支持下):