Install
openclaw skills install model-pricing-sync抓取模型厂商与代码工具价格页面,读取 Markdown 后补 JSON 提取文件,并同步到飞书普通电子表格。需要收集模型价格、补全价格 JSON、追踪价格变化或推送 Lark Sheets 时使用。
openclaw skills install model-pricing-sync按下面流程执行。
路径约定:本文所有路径都相对于本 skill 目录。执行前先定位 skills/model-pricing-sync/,下文用 <skill_dir> 表示。<run_dir> 表示本次运行生成的目录名,通常为 YYYYMMDD。
新增来源约定:如果用户要求新增某厂商的 API 或订阅跟踪,先搜索并确认官方价格页,再把来源和目标条目补到 <skill_dir>/config/ 下对应 CSV。
运行:
python <skill_dir>/scripts/sync_pricing.py --mode collect
作用:
<skill_dir>/artifacts/<run_dir>/collected/pages/*.md<skill_dir>/artifacts/<run_dir>/extracted/api_pricing.json<skill_dir>/artifacts/<run_dir>/extracted/subscription_plans.json<skill_dir>/artifacts/latest_run.json<skill_dir>/artifacts/latest_run.json 指向的这个 run_dir只想跑部分来源时,可传 --vendors anthropic,google。
采集异常只看:
<skill_dir>/artifacts/<run_dir>/collected/collect_issues.csv如果有记录,先根据 source_url 和 message 判断原因:
--vendors openai<skill_dir>/config/vendors.csv,再只对对应 vendor 重新运行采集只处理当前 run_dir:
<skill_dir>/artifacts/<run_dir>/collected/pages/*.md先根据本次采集的 Markdown 更新目标表,再生成待填 JSON。目标表是跟踪对象身份的唯一来源;页面 URL 只在 <skill_dir>/config/vendors.csv 维护:
<skill_dir>/config/target_api_models.csv<skill_dir>/config/target_subscription_plans.csv目标表更新规则:
<skill_dir>/artifacts/<run_dir>/collected/pages/*.md,若 Markdown 正文异常、抽取错位或信息明显不全,可按 vendor_key + region + track_type 到 <skill_dir>/config/vendors.csv 找对应 source_url,并直接打开网页作为依据。required=true、is_active=true,除非页面明确只是临时预告、不可购买或不计划跟踪prices[] 里补价格is_active=false目标表确认无误后再运行:
python <skill_dir>/scripts/sync_pricing.py --mode prepare
prepare 会按目标表更新当前 run 的两个待填写文件:
<skill_dir>/artifacts/<run_dir>/extracted/api_pricing.json<skill_dir>/artifacts/<run_dir>/extracted/subscription_plans.json它只追加缺失的模型 / 套餐对象,不覆盖已经填写的 prices[]。
打开并填写当前 run 的两个文件:
<skill_dir>/artifacts/<run_dir>/extracted/api_pricing.json<skill_dir>/artifacts/<run_dir>/extracted/subscription_plans.json填写依据:
<skill_dir>/artifacts/<run_dir>/collected/pages/*.md 里明确出现的信息填写original_price_text 写法、notes 风格和套餐/模型摘要的一致性pages/*.md 填;只有当采集结果明显不可靠时,直接访问对应网页补齐source_url、original_price_text 和必要 notesprepare 已经预填的身份字段--mode prepare填写 api_pricing.json:
notes 和 prices[]prices[] 字段:price_dimension、source_price_amount、currency、unit_basis、original_price_text、notesnotes 说明original_price_text;notes 统一写 基准阶梯价prices[] 为空,并在顶层 notes 写明疑点prices[] 拆价格;常用维度是 input、cached_input、outputinput、output填写 subscription_plans.json:
features、plan_summary、notes 和 prices[]prices[] 字段:billing_cycle、source_price_amount、currency、unit_basis、seat_rule、original_price_text、notesprices[] 里features[];如果需要人工整理摘要,再写 plan_summary推荐词表:
price_dimension:input、output、cached_input、cached_output、embedding、image、audio、otherunit_basis:per_1m_tokens、per_1k_tokens、per_image、per_minute、per_month、otherbilling_cycle:monthly、quarterly、annual、空unit_basis:per_month、per_user_month、per_year、per_user_year、per_quarter、空region:优先用配置已有值,不自行发明新口径,除非页面明确出现且现有值无法表达运行:
python <skill_dir>/scripts/sync_pricing.py --mode build
build 会生成扁平 CSV,并把全量问题写到 <skill_dir>/artifacts/<run_dir>/build_issues.csv。
如果 build_issues.csv 里有能补齐的信息,修正后重新运行 --mode build。如果剩余问题是当前材料无法补齐的来源失败、页面未写价格或目标暂时缺价,保留 issue,继续推送。
推送:
python <skill_dir>/scripts/sync_pricing.py --mode push
push 同步最近一次 build 生成的数据。