站点图标 Lee's Blog

token-monitor 使用Cloudflare同步以及更新

1.部署Cloudflare worker同步

打开官方项目github链接

Javis603/token-monitor: Local-first desktop widget for tracking token usage, costs, limits, and session activity across 46+ AI coding tools—including Claude Code, Codex, Cursor, OpenCode, OpenClaw, and more—with multi-device sync.

在项目readme文件中找到同步,点击”Deploy to Cloudflare”可以一键部署worker,按照官方readme中的介绍,生成一个密钥,填写进去即可。需要关联一个github的仓库,使用自己的github登录,自动创建一个私有仓库即可。

部署完成后绑定自定义域,配置好dns后即可在token-monitor中开启同步,填写密钥和域名即可。

2.更新worker

在软件使用时会提示有worker更新,需要重新构建。这个升级比较麻烦。官方只给了一键部署的方法,没有升级的方法,因此我使用的方法比较笨。

首先将官方的git仓库和自己的私有worker仓库均克隆到本地,自己的仓库是私有的可以使用github的官方软件,会比较方便。

git clone --depth 1 https://github.com/Javis603/token-monitor.git official-tm
git clone https://github.com/<你的用户名>/<自动创建的仓库名>.git my-tm

然后将自己仓库中除了.git 文件夹下的其他文件全部删除。

将官方仓库​official-tm/worker/​ 中的文件全部复制过来。

然后提交再推送,Cloudflare会自动构建

git add -A
git commit -m "sync with upstream"
git push
退出移动版