midscene
midscene copied to clipboard
[Feature]: The total token consumption statistics function for the entire round of case run by the playwright.
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
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
现在有一个新接口,可以获取整个流程的详情,包括每个步骤的 token 消耗:https://midscenejs.com/zh/api.html#agent_unstablelogcontent
closed by #892