1. 安装

使用 Docker 安装 aaamoon/copilot-gpt4-service

docker run -d \
  --name copilot-gpt4-service \
  --restart always \
  -p 8099:8080 \
  -e HOST=0.0.0.0 \
  aaamoon/copilot-gpt4-service:latest

这里将使用 http://your_ip:8099 作为 API 接口

2. 获取 Copilot Token

通过 Github Copilot CLI 获取 Token

# 如下脚本会自动安装 Github Copilot CLI 并通过授权获取 Github Copilot Plugin Token 
bash -c "$(curl -fsSL https://raw.githubusercontent.com/aaamoon/copilot-gpt4-service/master/shells/get_copilot_token.sh)"

接下来选择 2. Get Github Copilot token by Github Copilot CLI ,然后浏览器访问 https://github.com/login/device ,填入授权码即可得到 Token。

$ bash -c "$(curl -fsSL https://raw.githubusercontent.com/aaamoon/copilot-gpt4-service/master/shells/get_copilot_token.sh)"

Github Copilot token Tools [v0.0.2] # 1. 这里要选择 2
>
    Get Github Copilot token Tools [v0.0.2]
    ————————————————-
    1.  Get Github Copilot token by IDEA Github Copilot plugin
    2.  Get Github Copilot token by Github Copilot CLI
    ————————————————-
    0.  Exit


Please enter a number [0-2]: 2
github-copilot-cli is not installed. Installing...

added 247 packages, and audited 248 packages in 32s

54 packages are looking for funding
  run `npm fund` for details

2 moderate severity vulnerabilities

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
npm notice
npm notice New major version of npm available! 8.19.2 -> 10.3.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.3.0
npm notice Run npm install -g [email protected] to update!
npm notice
Github Copilot CLI token not found. Please authorize.
Copy this code: 1FBE-97DC # 2. 浏览器访问 https://github.com/login/device,然后填入这个 CODE

Then go to https://github.com/login/device, paste the code in and approve the access.
Failed to authenticate: You do not have access to GitHub Copilot CLI. Please join the waitlist at https://githubnext.com/projects/copilot-cli/., Unable to verify waitlist access.
Your Github Copilot CLI token : <your token>

* Press Enter to return to the main menu. *

3. 使用服务

1. 通过 ChatGPT-Next-Web 部署

docker run -d -p 3000:3000 \
   -e OPENAI_API_KEY=ghu-xxxx \
   -e CODE=your-password \
   -e BASE_URL=http://your_ip:8099 \
   yidadaa/chatgpt-next-web

然后访问 http://your_ip:3000 就能使用了!

如果配置了 OPENAI_API_KEY BASE_URL 以及 CODE 可以输入上面的 your-password ,然后到设置将模型修改为 gpt-4,就能使用了。


如果没有配置环境变量或者密钥过期,可以手动输入 API 网址和 TOKEN

现在可以使用了:

2. 其他

可以使用 openai API 的地方都能用,比如 obsidian、chatbox 等等