Last active
March 8, 2023 01:52
-
-
Save airyland/1110aee75c17023e62c1c0cca126dfc5 to your computer and use it in GitHub Desktop.
ChatGPT Bill Caculator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://platform.openai.com/account/usage | |
// Run code in the console to avoid bankruptcy | |
var $labels = document.querySelectorAll('.usage-table .expn-title .expn-icon') | |
$labels[0].click() | |
var $items = document.querySelectorAll('.expn.expanded .expn-content .expn-icon') | |
for (let i = 0; i < $items.length; i++) { | |
$items[i].click() | |
} | |
var $sum = document.querySelectorAll('.sum') | |
let count = 0 | |
for (let i = 0; i < $sum.length; i++) { | |
const _count = $sum[i].innerText.replace('tokens', '').replace(/,/g, '').trim() | |
count += _count * 1 | |
} | |
console.log('Date:', document.querySelector('.usage-day-select').innerText) | |
console.log('Tokens:', count) | |
console.log('Bill:', '$' + new Intl.NumberFormat().format(count / 1000 * 0.002)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@yunyu950908 这个数据是滞后的。turbo model 每天调用的费用并没有计算出来。