Browser Use
Control a browser agent with TokenMix-powered OpenAI-compatible models."
Who it is for
browser-use is for developers building browser automation agents: opening pages, clicking buttons, reading content, filling forms, and summarizing websites. It is not a normal chat app; you usually write a small Python script.
Step 1: Prepare TokenMix values
Prepare:
- API Key: your TokenMix key
- Base URL:
https://api.tokenmix.ai/v1 - Model ID: a TokenMix text model ID
Step 2: Install dependencies
Use Python 3.11+. With uv:
uv init tokenmix-browser-agent
cd tokenmix-browser-agent
uv add browser-use langchain-openai
With pip:
python -m venv .venv
source .venv/bin/activate
pip install browser-use langchain-openai
Step 3: Create a minimal script
Create agent.py:
from browser_use import Agent
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="<your-model-short-id>",
api_key="<your-tokenmix-key>",
base_url="https://api.tokenmix.ai/v1",
)
agent = Agent(
task="Open example.com and summarize the page title.",
llm=llm,
)
agent.run_sync()
Run:
python agent.py
Step 4: Replace with a real task
After the minimal script works, try:
Open https://tokenmix.ai, find the Apps page, and summarize what kinds of AI tools are listed there.
Beginners should keep tasks to one to three browser steps. Long browser tasks fail more often.
Troubleshooting
- 401: wrong API key.
- model not found: wrong model ID.
- browser does not open: check browser-use browser dependencies.
- agent gets stuck: shorten the task and test with page title summarization first.
- cost is high: browser agents use multiple reasoning turns, so test with cheaper models first.