midscene icon indicating copy to clipboard operation
midscene copied to clipboard

[Feature]: The total token consumption statistics function for the entire round of case run by the playwright.

Open sunny-yu-opus opened this issue 9 months ago • 1 comments

What problem does this feature solve?

playwright整个一轮case跑下来实际消耗的总token统计功能

What does the proposed API look like?

====== 🎯 GPT Token Usage Report (This Test Run) ====== 🔹 Prompt Tokens : 1842 🔹 Completion Tokens : 2098 🔸 Total Tokens : 3940

🧪 Total GPT Calls : 4 🤖 Model Used : gpt-3.5-turbo 📅 Test Time : 2025-04-16 21:35:08 📁 Token Log File : tokens.jsonl

📄 Detailed Usage Per Request: #1 - prompt: 412 | completion: 508 | total: 920 #2 - prompt: 351 | completion: 427 | total: 778 #3 - prompt: 531 | completion: 612 | total: 1143 #4 - prompt: 548 | completion: 551 | total: 1099

sunny-yu-opus avatar Apr 16 '25 09:04 sunny-yu-opus

You can use DEBUG=midscene:ai:profile:stats now. Midscene will print the token cost in detail in stdout.

https://midscenejs.com/model-provider.html

yuyutaotao avatar Apr 17 '25 01:04 yuyutaotao

现在有一个新接口,可以获取整个流程的详情,包括每个步骤的 token 消耗:https://midscenejs.com/zh/api.html#agent_unstablelogcontent

quanru avatar Jun 19 '25 09:06 quanru

closed by #892

Image

quanru avatar Aug 02 '25 10:08 quanru