九月中旬以来,Open AI公司对于中转站进行了诸多限制,如限制并发、账号降智等问题,笔者与朋友共同购买pro5x,利用一台不关的主机则通过sub2api转发模型请求(未申请域名,假设ip定义为A),其他主机利用Tailscale进行穿透访问ip,可以实现类似于中转站的功能,在不降智情况下的低频多人低价共用。
网络教程较多,故本文对此暂不做具体技术介绍,具体实现效果如下图所示。此方式无需申请域名,利用Tailscale的保护,即可简单安全地实现自用中转。
#mermaid-svg-zJZS50wsbMEUotTB{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-zJZS50wsbMEUotTB .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-zJZS50wsbMEUotTB .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-zJZS50wsbMEUotTB .error-icon{fill:#552222;}#mermaid-svg-zJZS50wsbMEUotTB .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-zJZS50wsbMEUotTB .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-zJZS50wsbMEUotTB .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-zJZS50wsbMEUotTB .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-zJZS50wsbMEUotTB .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-zJZS50wsbMEUotTB .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-zJZS50wsbMEUotTB .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-zJZS50wsbMEUotTB .marker{fill:#333333;stroke:#333333;}#mermaid-svg-zJZS50wsbMEUotTB .marker.cross{stroke:#333333;}#mermaid-svg-zJZS50wsbMEUotTB svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-zJZS50wsbMEUotTB p{margin:0;}#mermaid-svg-zJZS50wsbMEUotTB .label{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;color:#333;}#mermaid-svg-zJZS50wsbMEUotTB .cluster-label text{fill:#333;}#mermaid-svg-zJZS50wsbMEUotTB .cluster-label span{color:#333;}#mermaid-svg-zJZS50wsbMEUotTB .cluster-label span p{background-color:transparent;}#mermaid-svg-zJZS50wsbMEUotTB .label text,#mermaid-svg-zJZS50wsbMEUotTB span{fill:#333;color:#333;}#mermaid-svg-zJZS50wsbMEUotTB .node rect,#mermaid-svg-zJZS50wsbMEUotTB .node circle,#mermaid-svg-zJZS50wsbMEUotTB .node ellipse,#mermaid-svg-zJZS50wsbMEUotTB .node polygon,#mermaid-svg-zJZS50wsbMEUotTB .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-zJZS50wsbMEUotTB .rough-node .label text,#mermaid-svg-zJZS50wsbMEUotTB .node .label text,#mermaid-svg-zJZS50wsbMEUotTB .image-shape .label,#mermaid-svg-zJZS50wsbMEUotTB .icon-shape .label{text-anchor:middle;}#mermaid-svg-zJZS50wsbMEUotTB .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-zJZS50wsbMEUotTB .rough-node .label,#mermaid-svg-zJZS50wsbMEUotTB .node .label,#mermaid-svg-zJZS50wsbMEUotTB .image-shape .label,#mermaid-svg-zJZS50wsbMEUotTB .icon-shape .label{text-align:center;}#mermaid-svg-zJZS50wsbMEUotTB .node.clickable{cursor:pointer;}#mermaid-svg-zJZS50wsbMEUotTB .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-zJZS50wsbMEUotTB .arrowheadPath{fill:#333333;}#mermaid-svg-zJZS50wsbMEUotTB .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-zJZS50wsbMEUotTB .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-zJZS50wsbMEUotTB .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-zJZS50wsbMEUotTB .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-zJZS50wsbMEUotTB .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-zJZS50wsbMEUotTB .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-zJZS50wsbMEUotTB .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-zJZS50wsbMEUotTB .cluster text{fill:#333;}#mermaid-svg-zJZS50wsbMEUotTB .cluster span{color:#333;}#mermaid-svg-zJZS50wsbMEUotTB div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-zJZS50wsbMEUotTB .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-zJZS50wsbMEUotTB rect.text{fill:none;stroke-width:0;}#mermaid-svg-zJZS50wsbMEUotTB .icon-shape,#mermaid-svg-zJZS50wsbMEUotTB .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-zJZS50wsbMEUotTB .icon-shape p,#mermaid-svg-zJZS50wsbMEUotTB .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-zJZS50wsbMEUotTB .icon-shape .label rect,#mermaid-svg-zJZS50wsbMEUotTB .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-zJZS50wsbMEUotTB .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-zJZS50wsbMEUotTB .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-zJZS50wsbMEUotTB :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}
Tailscale 网络
其他使用api的主机
sub2api不关的主机ip地址定义为ipA
上游模型服务
对于需要处理大量数据的工作,我们也希望在这个远程服务器中可以直接使用Codex。
因此,在上述成功的情况下,本文主要介绍在诸如autodl这种没有桌面环境,因而无法下载Tailscale的服务器,如何在VSCode侧边栏插件的codex中使用个人所建立的中转。
tips:实测VSCode中的Tailscale的服务器插件版本最新为v1.1.0,目前可使用最低为v1.38.3或更高,因此VSCode的Tailscale插件亦无法使用。
当然,由于保护原因,直接在autodl中连接ipA,会出现“Reconnecting… waiting for network
Connection failed: error sending request”报错
具体实现操作如下,增加左侧的几个步骤,通过SSH反向转发,增加audodl中所允许的反向转发,增加本机电脑的一个中转,把Tailscale下载导本机中,即可实现。
#mermaid-svg-3VpIghlPg1ZbRBpn{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-3VpIghlPg1ZbRBpn .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-3VpIghlPg1ZbRBpn .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-3VpIghlPg1ZbRBpn .error-icon{fill:#552222;}#mermaid-svg-3VpIghlPg1ZbRBpn .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-3VpIghlPg1ZbRBpn .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-3VpIghlPg1ZbRBpn .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-3VpIghlPg1ZbRBpn .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-3VpIghlPg1ZbRBpn .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-3VpIghlPg1ZbRBpn .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-3VpIghlPg1ZbRBpn .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-3VpIghlPg1ZbRBpn .marker{fill:#333333;stroke:#333333;}#mermaid-svg-3VpIghlPg1ZbRBpn .marker.cross{stroke:#333333;}#mermaid-svg-3VpIghlPg1ZbRBpn svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-3VpIghlPg1ZbRBpn p{margin:0;}#mermaid-svg-3VpIghlPg1ZbRBpn .label{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;color:#333;}#mermaid-svg-3VpIghlPg1ZbRBpn .cluster-label text{fill:#333;}#mermaid-svg-3VpIghlPg1ZbRBpn .cluster-label span{color:#333;}#mermaid-svg-3VpIghlPg1ZbRBpn .cluster-label span p{background-color:transparent;}#mermaid-svg-3VpIghlPg1ZbRBpn .label text,#mermaid-svg-3VpIghlPg1ZbRBpn span{fill:#333;color:#333;}#mermaid-svg-3VpIghlPg1ZbRBpn .node rect,#mermaid-svg-3VpIghlPg1ZbRBpn .node circle,#mermaid-svg-3VpIghlPg1ZbRBpn .node ellipse,#mermaid-svg-3VpIghlPg1ZbRBpn .node polygon,#mermaid-svg-3VpIghlPg1ZbRBpn .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-3VpIghlPg1ZbRBpn .rough-node .label text,#mermaid-svg-3VpIghlPg1ZbRBpn .node .label text,#mermaid-svg-3VpIghlPg1ZbRBpn .image-shape .label,#mermaid-svg-3VpIghlPg1ZbRBpn .icon-shape .label{text-anchor:middle;}#mermaid-svg-3VpIghlPg1ZbRBpn .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-3VpIghlPg1ZbRBpn .rough-node .label,#mermaid-svg-3VpIghlPg1ZbRBpn .node .label,#mermaid-svg-3VpIghlPg1ZbRBpn .image-shape .label,#mermaid-svg-3VpIghlPg1ZbRBpn .icon-shape .label{text-align:center;}#mermaid-svg-3VpIghlPg1ZbRBpn .node.clickable{cursor:pointer;}#mermaid-svg-3VpIghlPg1ZbRBpn .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-3VpIghlPg1ZbRBpn .arrowheadPath{fill:#333333;}#mermaid-svg-3VpIghlPg1ZbRBpn .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-3VpIghlPg1ZbRBpn .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-3VpIghlPg1ZbRBpn .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-3VpIghlPg1ZbRBpn .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-3VpIghlPg1ZbRBpn .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-3VpIghlPg1ZbRBpn .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-3VpIghlPg1ZbRBpn .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-3VpIghlPg1ZbRBpn .cluster text{fill:#333;}#mermaid-svg-3VpIghlPg1ZbRBpn .cluster span{color:#333;}#mermaid-svg-3VpIghlPg1ZbRBpn div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-3VpIghlPg1ZbRBpn .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-3VpIghlPg1ZbRBpn rect.text{fill:none;stroke-width:0;}#mermaid-svg-3VpIghlPg1ZbRBpn .icon-shape,#mermaid-svg-3VpIghlPg1ZbRBpn .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-3VpIghlPg1ZbRBpn .icon-shape p,#mermaid-svg-3VpIghlPg1ZbRBpn .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-3VpIghlPg1ZbRBpn .icon-shape .label rect,#mermaid-svg-3VpIghlPg1ZbRBpn .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-3VpIghlPg1ZbRBpn .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-3VpIghlPg1ZbRBpn .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-3VpIghlPg1ZbRBpn :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}
SSH 反向转发
Tailscale 网络
AutoDL 上的 Codex
AutoDL 本地入口127.0.0.1:8080
Windows 本机
sub2api不关的主机ip地址定义为ipA
上游模型服务
一、在 Windows 上建立反向转发
先确认前提:
1.Windows 上的 Tailscale 已连接,且本机确实能调用 API。(这一步为一般的调用api的方式,教程较多,本文不做赘述)
2.你需要知道sub2api不关的主机的ip地址(本文中以ipA代指)
1.1查找AutoDL控制台提供的SSH地址和端口登录实例
这一个需要查找你的服务器的主机、端口、用户名(一般都是root)、密码,如下图可见。

如:ssh -p 37974 root@connect.westc.seetacloud.com
主机、端口、用户名 分别为: connect.westc.seetacloud.com、37974、root
1.2在本机电脑上建立转发
注意,注意是本机电脑!!
1.2.1
快捷键:win+R打开运行,输入cmd,打开 Windows PowerShell
1.2.2
在 Windows PowerShell 中执行下面这一整行,
100.100.10.20:8080要换成你不关的那个电脑的ipA,
12345要换成你服务器的端口
root要换成你服务器的用户名
connect.example.com要换成你服务器的主机名
ssh –NT –o ExitOnForwardFailure=yes –o ServerAliveInterval=30 –o ServerAliveCountMax=3 –R 127.0.0.1:8080:100.100.10.20:8080 –p 12345 root@connect.example.com
二、修改服务器config.toml文件和auth.json文件
两文件地址一般都在家目录下的root/.codex,如下图所示

2.1修改auth.json
更换成自己的api key

2.2修改config.toml
注意这个地址一定要写127.0.0.1:8080,因为在你自己电脑转发时地址ip写的是这一个,当然端口可以修改,前提是上面也要一同修改。

完成以上操作,保存后即可发现成功使用




