How to check total cost use
Hello MetaGPT, i have use metaGPT many time and it save to one 1 log with many project i have create, so how can i check total cost and token use in each project, thanks you so much.
For now, MetaGPT will calculate the cost each time calling the API and the cost will be accumulated when running a project. The cost of one project is the last cost calculation message in the log.
Since the log of different project may be saved to the same log.txt like 20240605.txt and the calculation will be mixed.
you can use grep "Total running cost" -n path/to/your_log.txt to manually extract the cost.
@garylin2099 Is it able to set the log_name for a particular project?
@garylin2099 Is it able to set the log_name for a particular project?
I know this, we can do something like this, In main.py file:
from metagpt.logs import logger, define_log_level
def set_log_name():
global logger
logger = define_log_level(name="MY_PROJECT") # This will create a file as: MY_PROJECT_20240605.txt
set_log_name()
Or, we could define a custom define_log_level to change the name of file to anything else.
Since no further responses are needed, we will close it. Please reopen it if necessary.