Files
browser-use__browser-use/examples/models/openrouter.py
2025-11-21 13:46:48 -08:00

35 lines
648 B
Python

"""
Simple try of the agent.
@dev You need to add OPENAI_API_KEY to your environment variables.
"""
import asyncio
import os
from dotenv import load_dotenv
from browser_use import Agent, ChatOpenAI
load_dotenv()
# All the models are type safe from OpenAI in case you need a list of supported models
llm = ChatOpenAI(
# model='x-ai/grok-4',
model='deepcogito/cogito-v2.1-671b',
base_url='https://openrouter.ai/api/v1',
api_key=os.getenv('OPENROUTER_API_KEY'),
)
agent = Agent(
task='Find the number of stars of the browser-use repo',
llm=llm,
use_vision=False,
)
async def main():
await agent.run(max_steps=10)
asyncio.run(main())