Sam Sokolin 教你如何将昂贵的 Computer Use 任务转化为高效脚本,大幅降低 token 消耗并提升执行速度。
Computer Use 模式成本高昂,一个任务可能需要几十轮视觉推理。Sam Sokolin 提出解决方案:让 Bot 只用一次 Computer Use 完成任务并抓取网络请求。之后重复执行时直接调用 API,不再通过图形界面。这种方法几乎零 token 消耗,执行时间从分钟级降至秒级,且可复用现有登录态。
Computer Use 好用,但很贵!Codex 如此,Grok Bot 也是如此! 那怎么做,能既用上 Computer Use 的能力,又降低 token 消耗成本呢? @SamSokoli...
Computer Use 好用,但很贵!Codex 如此,Grok Bot 也是如此! 那怎么做,能既用上 Computer Use 的能力,又降低 token 消耗成本呢? @SamSokolin 的思路是对的: 让 Bot 只用一次 Computer Use 完成任务,同时抓取过程中的网络请求,然后把这些请求整理成一段脚本。之后重复执行同一任务时,直接调 API,不再走图形界面。 # 为什么这样做? 1. 省 token。 Computer Use 模式的成本结构决定了它很贵:每一步都要截屏 → 模型看图理解 → 决定点哪里 → 再截屏验证。一个"打开发票页、筛选未付款、导出 CSV"的任务可能要几十轮视觉推理。而脚本执行不需要模型参与,几乎零 token。 2. 快得多。 GUI 操作受页面加载、渲染、模型推理延迟的多重限制。直接调 HTTP 接口只受网络往返时间限制,通常从分钟级降到秒级。 3. 复用现有登录态。 推文里"with the same auth"是关键。Bot 在浏览器里已经登录了,抓包时能拿到 session cookie / token,脚本沿用这些凭证,不需要额外申请 API key 或走 OAuth。这也是为什么这种方式对没有公开 API 的 web 应用同样适用——任何网页前端最终都是在调后端接口。 # 看看 Sam 展示的工作流 ① 下达任务 "去 acme. com/invoices,筛选未付款,导出 CSV" ② Bot 执行并抓包 一边点击,一边记录了 4 个请求:GET /api/session、GET /api/invoices?status=unpaid、GET /api/invoices/columns、POST /api/export/csv ③ 生成脚本并加入 routine 输出一段 Python requests 脚本,复用 session、拉取未付款发票、POST 导出、写入本地文件;之后作为定时任务(routine)自动跑 整个流程:访问站点并交互 → 抓取网络请求 → 生成脚本 → 放进 routine 运行 → 返回结果。 # 使用 Agent 重要分工原则 视觉操作用于"探索",代码用于"执行"! Sam Sokolin @SamSokolin Having Grok Bot redo the same clicks in a web app burns a lot of tokens. One of the best ways I've found to stretch your usage is asking @bot to reverse engineer expensive browser use tasks into scripts! Have it capture the network requests from a computer-use run once. Next time, skip the UI and hit the APIs directly with the same auth. This also has the added benefit of being way faster than having Bot click around in a GUI! 🔗 View Quoted Tweet 💬 3 🔄 3 ❤️ 7 👀 1069 📊 5 ⚡