交给你的 AI 智能体
把这段提示词复制到 Claude Code、Cursor、Codex 或任何编程智能体中。它会告诉智能体文档在哪里,以及如何使用你的 API 密钥。
Use the Lovely Router browser agent API: a real browser that clicks, types, fills forms and logs in for a task, and returns an answer plus JSON in a schema I choose.
- Docs (read first): https://lovelyrouter.com/docs/browser-agent.md and https://lovelyrouter.com/docs/api/browser.md
- Start a run: POST https://lovelyrouter.com/v1/browser/runs with `{"goal": "...", "start_url": "https://...", "output_schema": {...}}`. Put every value the task needs in the goal. It returns 202 at once; poll the `poll` path (or stream `events`) until the run ends, then read `answer` and `data`.
- Billed per step (fast mode by default). Set `max_steps` to cap a run. For unattended runs send `"human": false`; by default the agent pauses before purchases, sending or deleting (`approve`).
- If you support MCP, you can instead connect the server https://lovelyrouter.com/mcp (Streamable HTTP, same key; https://lovelyrouter.com/docs/tools/mcp.md) and use suggest_tools, get_tool and run_tool.
- Auth: read my API key from the LOVELY_API_KEY environment variable and send it as `Authorization: Bearer $LOVELY_API_KEY`. Never print or commit the key. If it is not set, ask me to create one at https://lovelyrouter.com/app/keys.
- Billing is prepaid: every call is charged to my balance, so test with a small request before running anything large.
- Every docs page is plain Markdown; the full index is https://lovelyrouter.com/llms.txt.
My task: <describe the site and what the agent should do or extract>输入
goalstring必填What to do, in plain words, with every value the task needs
start_urlstring必填Page to start on
modestringfast (default, $0.006/step) or accurate ($0.012/step: screenshots when unsure + read-only page code; higher success on hard sites)
fast · accurate
output_schemaobjectOptional JSON Schema (or {"field": "type"} shorthand) for structured output in `data`; omit for data: null
modelstringOptional model id from /v1/models (e.g. claude-sonnet-5.5) for the agent's reasoning; its tokens are billed at the normal price × 1.2 on top of the step price
secretsstring[]Names of vault secrets the agent may fill (never shown to the model)
profilestringSaved browser profile (cookies) to start from
save_profilestringSave cookies under this profile name when done
human_timeout_minutesnumberHow long to wait for a human reply or approval, 1–1440 minutes (default 30); time beyond 1 minute per step costs $0.005/min
approvestringPause for approval before risky submits (default risky)
none · risky · submit
试一试
在代码中调用
了解运行、轮询与计费 →curl https://lovelyrouter.com/v1/tools/browser-agent/run \
-H "Authorization: Bearer $LOVELY_API_KEY" \
-H "content-type: application/json" \
-d '{"input":{"goal":"Find the price of the book '\''A Light in the Attic'\''","start_url":"https://books.toscrape.com/"},"max_results":50}'# MCP (agents): suggest_tools → get_tool → run_tool
run_tool({
"tool": "browser-agent",
"input": {"goal":"Find the price of the book 'A Light in the Attic'","start_url":"https://books.toscrape.com/"},
"max_results": 50
})费用示例
| 结果 | 运行次数(每次最多 100 条) | 成本 |
|---|---|---|
| 100 | 1 | $0.60 |
| 1,000 | 10 | $6.00 |
| 10,000 | 100 | $60.00 |
预付费,无需订阅。返回的结果少于请求数量时费用更低。 价格
适用场景
常见问题
Browser agent API 的价格是多少?
$0.006 / step。以每次最多 100 条获取 1,000 条结果,费用为 $6.00。无需订阅:从预付费余额中扣除。
这是浏览器自动化 API吗?
是的。如果你在搜索浏览器自动化 API、AI 浏览器自动化或AI 浏览器代理,这就是:Give it a goal and a start page; an AI agent drives a real browser to do it: navigate, fill forms, log in with saved secrets, ask you for codes, hand over for CAPTCHAs, wait for your approval before purchases, and return structured JSON in your schema. For tasks that need interaction; to just read a page, use Read a web page (web-fetch). $0.006 per step in fast mode, $0.012 in accurate mode (looks at screenshots when unsure, can run read-only code to read data). Each step includes 1 minute; time beyond that (e.g. waiting for your approval) costs $0.005/min. Full API: /v1/browser.
一次运行返回多少条结果?
默认 50 条,每次最多 100 条。用 max_results 限制单次数量:只为实际交付的结果付费。
AI 智能体可以使用这个工具吗?
可以。把 Claude Code、Cursor 或任何 MCP 客户端连接到 Lovely Router 的 MCP 服务器:智能体用 suggest_tools 找到这个工具,再用 run_tool 和 id browser-agent 运行它。
运行失败会怎样?
失败或被停止的运行只为已交付的结果付费,不收调用费。运行开始时会冻结最高费用,结算后释放剩余部分。