Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

fixed cost display

Gregor Žuniče8b1fae75a14
diff --git a/browser_use/tokens/service.py b/browser_use/tokens/service.py
index 9fb263338..265470ca7 100644
--- a/browser_use/tokens/service.py
+++ b/browser_use/tokens/service.py
@@ -293,7 +293,10 @@ class TokenCost:
if not parts:
# Fallback to simple display when no cache information available
total_tokens_fmt = self._format_tokens(usage.prompt_tokens)
- parts.append(f'📥 {C_YELLOW}{total_tokens_fmt}{C_RESET}')
+ if self.include_cost and cost and cost.new_prompt_cost > 0:
+ parts.append(f'📥 {C_YELLOW}{total_tokens_fmt} (${cost.new_prompt_cost:.4f}){C_RESET}')
+ else:
+ parts.append(f'📥 {C_YELLOW}{total_tokens_fmt}{C_RESET}')
return ' + '.join(parts)