Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
better logs for tokens
Gregor Žunič2f833b271388
diff --git a/browser_use/tokens/service.py b/browser_use/tokens/service.pyindex eb907cdd1..380b067c7 100644--- a/browser_use/tokens/service.py+++ b/browser_use/tokens/service.py@@ -201,6 +201,13 @@ class TokenCost:return entry+ async def _log_non_usage_llm(self, llm: BaseChatModel) -> None:+ """Log non-usage to the logger"""+ C_CYAN = '\033[96m'+ C_RESET = '\033[0m'++ cost_logger.info(f'🧠 llm : {C_CYAN}{llm.model}{C_RESET} (no usage found)')+async def _log_usage(self, model: str, usage: TokenUsageEntry) -> None:"""Log usage to the logger"""if not self._initialized:@@ -267,6 +274,9 @@ class TokenCost:asyncio.create_task(token_cost_service._log_usage(llm.model, usage))+ else:+ await token_cost_service._log_non_usage_llm(llm)+return result# Replace the method with our tracked version