巧用 Warp plus 解锁 chatgpt

背景

访问 chat.openai.com 已然成为了一个对抗的过程了, 我已经很久没有使用 chat.openai.com 了, 自从VPS的IP被 openai 墙了之后我一直使用自己撸的一个 chatgpt-mirror 来使用 chatgpt(背后调用的是api.openai.com来实现的,依然是纯种的 chatgpt)。 目前这个项目在开发付费功能的阶段,等我完善之后,再给大家使用,这样不用翻墙也可以使用chatgpt了。

但是撸 chatgpt-mirror 总是需要参考一下 chat.openai.com 官方的交互以及功能设计, 所以我还是需要使用一下官方的产品。最近 cloudflare 推出了一个 warp 产品,而且我看到有免费的 license 可以搞到,所以通过 我 -> VPS -> warp 这样的数据路由来实现访问。这里注意了,必须是 VPS -> warp才可以的,因为warp 是和访问ip的就近出口IP(我也不知道应该怎么表达,领会精神吧,反正就是要这样)。

步骤

  • 注册 cloudflare (没什么可写的)
  • 安装配置warp
  • 配置xray
  • 遇到的问题及解决办法

安装配置Warp

ubuntu 用户

 1# Add cloudflare gpg key
 2curl https://pkg.cloudflareclient.com/pubkey.gpg | sudo gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg
 3
 4
 5# Add this repo to your apt repositories
 6echo "deb [arch=amd64 signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflare-client.list
 7
 8
 9# Install
10sudo apt-get update && sudo apt-get install cloudflare-warp

配置Warp 准备一个license,默认的license只能免费1GB的流量, 在 Telegram 上搜索 @generatewarpplusbot 关注, 输入 /generate 获取一个很大流量的 license (有多大?应该是一辈子用不完吧)

1warp-cli register
2warp-cli set-license xxx # 把 xxx 替换成你刚刚获取到的 license
3warp-cli set-mode proxy
4warp-cli set-proxy-port 40000
5warp-cli connect

检查状态

1~$ warp-cli  status
2Success
3Status update: Connected

测试一下

 1~$ curl https://www.cloudflare.com/cdn-cgi/trace --socks5 127.0.0.1:40000
 2fl=618f10
 3h=www.cloudflare.com
 4ip=104.28.195.185
 5ts=1688194441.214
 6visit_scheme=https
 7uag=curl/7.58.0
 8colo=LAX
 9sliver=none
10http=http/2
11loc=US
12tls=TLSv1.3
13sni=plaintext
14warp=plus
15gateway=off
16rbi=off
17kex=X25519

到此说明 warp proxy 已经配置好了

配置 xray 的服务器

v2ray的配置我就不多说了,这里说一下需要修改的部分 在 outbounds 里新增一个 warp proxy 的出口

 1{
 2    "tag": "warp",
 3    "protocol": "socks",
 4    "settings": {
 5        "servers": [{
 6            "address": "127.0.0.1",
 7            "port": 40000
 8        }]
 9    }
10}

在 routing 里添加 routing 的规则, 在 routing -> rules 里添加 针对 chat.openai.com, openai.com 的路由规则

1{
2    "type": "field",
3    "outboundTag": "warp",
4    "domain": ["chat.openai.com", "openai.com"]
5}

重启 xray server

重启 xray server 收获成果

貌似注册 cloudflare 没啥用哦。。。反正我是 cloudflare 的注册用户。。。

遇到的问题与解决

1warp-cli status
2Reason: Insufficient system resource: file descriptor

解决办法

1/lib/systemd/system/warp-svc.service

在Service里加入以下内容

1[Service]
2LimitNOFILE=65535
3LimitNOFILESoft=65535