uday-rana / codeshift

A command-line tool that translates source code files into a chosen programming language.
MIT License
5 stars 4 forks source link

`-t` does not show correct token count #24

Closed uday-rana closed 1 week ago

uday-rana commented 1 week ago

Describe the bug When using the flag -t or --token usage, the token usage count is stored based on the value returned from the AI API provider. However, this value is re-assigned with each call to the API provider, meaning it ultimately reflects the number of tokens used by the last file sent to the API provider.

To Reproduce Steps to reproduce the behavior: Run program with -t or --token usage and multiple files codeshift -t examples/index.js examples/main.cpp

Expected behavior The combined total token usage for all files is displayed.