支持转发CoCopilot2ChatApi、Copilot2ChatApi、Gemini2ChatApi等各大平台API转发。
5.0K
Github:https://github.com/dalefengs/chat-api-proxy
docker run -d \
--name chat-api-proxy \
-p 18818:8818 \
dalefengs/chat-api-proxy
/copilot/copilot_internal/v2/token
curl --location 'http://127.0.0.1:18818/copilot/copilot_internal/v2/token' \
--header 'Authorization: token ghu_xxxxxxxxxxxxxxxx'
/copilot/v1/chat/completions
curl --location 'http://127.0.0.1:18818/copilot/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer tid=xxxxxxxx;ol=xxb457a0be36d3;exp=1705149290;sku=copilot_for_business_seat;st=dotcom;ssc=1;chat=1;sn=1;8kp=1:18b175a4e4bbf73xx3a627e7180a6469540d8316884d4ea6713edb28' \
--data '{
"stream": true,
"model": "gpt-4",
"messages": [
{
"role": "user",
"content": "你好"
}
]
}'
/cocopilot/copilot_internal/v2/token
curl --location 'http://127.0.0.1:18818/cocopilot/copilot_internal/v2/token' \
--header 'Authorization: token cuu_xxxxxxxxxxxxxxxx'
⚠拿到的 ccu-xxx ,一定要小心保存,防止泄露❗❗❗
通过CoCopilot获取token后调用官方 Github Copilot Completions API
curl --location 'http://127.0.0.1:18818/gemini/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer AIzaSyCGpzxxxxxxxxxx' \
--data '{
"stream": true,
"model": "gemini-pro",
"messages": [
{
"role": "user",
"content": "你好"
}
]
}'
Github Copliot 和 CoCopilot 都适用
脚本下载:https://cocopilot.org/static/assets/files/cocopilot_scripts.zip
将脚本中的 copilot_internal/v2/token 替换为你获取到的 <BaseURL>/cocopilot/copilot_internal/v2/token
Windows 示例:
@echo off
setlocal
set folder=%userprofile%\AppData\Local\github-copilot
set jsonfile=%folder%\hosts.json
if not exist "%folder%" (
mkdir "%folder%"
)
echo {"github.com":{"user":"cocopilot","oauth_token":"ccu_Vxxxxx","dev_override":{"copilot_token_url":"https://<BaseURL>/cocopilot/copilot_internal/v2/token"}}} > "%jsonfile%"
echo done. please restart your ide.
pause
Content type
Image
Digest
sha256:3272501b8…
Size
102.4 MB
Last updated
over 2 years ago
docker pull dalefengs/chat-api-proxy