stagehand
stagehand copied to clipboard
Error executing agent task: No LLM API key or LLM Client configured. An LLM API key or a custom LLM Client is required to use act, extract, or observe.
import "dotenv/config";
import { createOpenRouter } from '@openrouter/ai-sdk-provider' import { AISdkClient, Stagehand } from '@browserbasehq/stagehand';
async function main() {
console.log('OPENROUTER_API_KEY:', process.env.OPENROUTER_API_KEY ? '已设置' : '未设置');
const openrouter = createOpenRouter({ apiKey: process.env.OPENROUTER_API_KEY, });
const providerClient = new AISdkClient({ model: openrouter("google/gemini-2.5-flash"), });
const stagehand = new Stagehand({ env: "LOCAL", llmClient: providerClient, });
await stagehand.init();