diff --git a/agentops/client.py b/agentops/client.py index a760c67a..5e9bd773 100644 --- a/agentops/client.py +++ b/agentops/client.py @@ -13,7 +13,7 @@ import threading import traceback import logging -from decimal import Decimal +from decimal import Decimal, ROUND_HALF_UP from uuid import UUID, uuid4 from typing import Optional, List, Union @@ -424,7 +424,7 @@ def end_session( "This run's cost ${}".format( "{:.2f}".format(token_cost_d) if token_cost_d == 0 - else "{:.6f}".format(token_cost_d) + else "{:.6f}".format(token_cost_d.quantize(Decimal('0.000001'), rounding=ROUND_HALF_UP)) ) )