Skip to content

Qubhu/zhipu-usage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

智谱 (GLM) API 用量查询技能

统计智谱 GLM 系列模型的 token 消耗和费用(人民币),数据来源于 OpenClaw 本地 session 日志。

快速使用

# 今日用量
python3 scripts/zhipu-usage.py --today

# 近7天
python3 scripts/zhipu-usage.py --week

# 本月
python3 scripts/zhipu-usage.py --month

# JSON 输出
python3 scripts/zhipu-usage.py --today --json

# 自定义 OpenClaw 数据目录
python3 scripts/zhipu-usage.py --today --dir /path/to/.openclaw

原理

  1. 解析 OpenClaw session 日志(~/.openclaw/agents/*/sessions/*.jsonl
  2. 识别 GLM 系列模型(支持 model_change、model-snapshot、消息级 model 字段)
  3. 按官方定价计算费用(来源:https://bigmodel.cn/pricing)
  4. 默认人民币计价,可选美元

要求

  • Python 3.8+(纯标准库,零依赖)
  • OpenClaw session 数据在 ~/.openclaw/agents/

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages