This page is for browser-use 0.x. Current docs: Introduction. Upgrading: Migrating to 1.0. To stay on 0.x, pin it:
pip install 'browser-use<1'.Cost Tracking
To track token usage and costs, enable cost calculation:from browser_use import Agent, ChatBrowserUse
agent = Agent(
task="Search for latest news about AI",
llm=ChatBrowserUse(),
calculate_cost=True # Enable cost tracking
)
history = await agent.run()
# Get usage from history
print(f"Token usage: {history.usage}")
# Or get from usage summary
usage_summary = await agent.token_cost_service.get_usage_summary()
print(f"Usage summary: {usage_summary}")