本地magpie接入vps中的magpie服务
搭建magpie
- 搭建项目结构
1 2 3
| mkdir -p /opt/magpie/config chown 65532:65532 /opt/magpie/config chown 700 /opt/magpie/config
|
目录结构
1 2 3
| /opt/magpie/ ├── compose.yaml └── config/
|
- 创建配置文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| services: magpie: image: ghcr.io/yetone/magpie:latest container_name: magpie restart: unless-stopped
ports: - "127.0.0.1:3425:3425" - "127.0.0.1:3430:3430"
environment: MAGPIE_WEB_KEY: ${MAGPIE_WEB_KEY} magpie_public_url: "https://magpie.codeshot.xyz" DO_NOT_TRACK: "1"
volumes: - ./config:/config
command: [web, --addr, 0.0.0.0:3430, --no-open]
|
1
| echo "MAGPIE_WEB_KEY=$(openssl rand -hex 24)" > .env
|
- 启动服务
- 配置服务商
ssh tunel访问web管理页面
1
| ssh -N -L 3430:127.0.0.1:3430 vps-rn-la-01
|
浏览器访问127.0.0.1:3430,输入前面生成的web key
验证访问
1 2
| curl -fsS https://magpie.codeshot.xyz/v1/models \ -H "Authorization: Bearer ${MAGPIE_GATEWAY_KEY}"
|
后期升级镜像
1
| docker compose pull && docker compose up -d
|
模型提供方管理
安装magpie cli
设置软链接
1
| ln -s /usr/bin/magpie-cli ~/.local/bin/magpie
|
- 添加远程提供商
1
| magpie provider add remote-magpie "${MAGPIE_GATEWAY_KEY}" url=https://magpie.codeshot.xyz id=vps
|
测试连通性
1
| magpie provider test vps
|
- 获取远程模型列表
新增模型/路由组后,本地刷新
1
| magpie provider refresh vps
|
配置模型
1
| magpie claude Id/provider/modelId
|
1
| magpie claude Id/group/groupId
|
恢复原来的配置
查看本机检测到的agents及当前配置
查看支持的coding agents
服务管理
安装并启动后台服务
查看服务状态
自定义
推荐配置:
在~/.config/magpie/settings.json中配置:
1
| magpie accounts discovery off
|
Tips: 通过命令来控制的开关,可以去掉末尾的on/off来查看配置项的状态
完整配置:
1 2 3 4 5
| { "noStats": true, "noAutoUpdate": true, "noAccountDiscovery": true }
|