browserbase-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Browserbase CLI

Browserbase CLI

Use the official
browse
CLI for Browserbase platform operations, Functions workflows, and Fetch API calls.
使用官方的
browse
CLI来执行Browserbase平台操作、Functions工作流以及Fetch API调用。

Setup check

安装检查

Before using the CLI, verify it is installed:
bash
which browse || npm install -g browse
browse --help
For authenticated commands, set the API key:
bash
export BROWSERBASE_API_KEY="your_api_key"
使用CLI之前,请确认已安装:
bash
which browse || npm install -g browse
browse --help
对于需要认证的命令,请设置API密钥:
bash
export BROWSERBASE_API_KEY="your_api_key"

When to use this skill

何时使用此技能

Use this skill when the user wants to:
  • run Browserbase commands through
    browse
  • scaffold, develop, publish, or invoke Browserbase Functions
  • inspect or manage Browserbase sessions, projects, contexts, or extensions
  • fetch a page through Browserbase without opening a browser session
  • search the web through Browserbase without opening a browser session
  • browse or scaffold starter templates with
    browse templates
当用户需要以下操作时使用此技能:
  • 通过
    browse
    运行Browserbase命令
  • 搭建、开发、发布或调用Browserbase Functions
  • 查看或管理Browserbase会话、项目、上下文或扩展
  • 无需打开浏览器会话即可通过Browserbase获取页面
  • 无需打开浏览器会话即可通过Browserbase搜索网页
  • 使用
    browse templates
    浏览或搭建起始模板

When not to use this skill

何时不使用此技能

  • For interactive browsing, page inspection, screenshots, clicking, typing, or login flows, prefer the
    browser
    skill.
  • For simple HTTP content retrieval where the user does not care about using the CLI specifically, the dedicated
    fetch
    skill is often a better fit.
  • Use the top-level driver commands (
    browse open
    ,
    browse get
    ,
    browse click
    , …) only when the user explicitly wants the CLI path or is already working in a
    browse
    -centric workflow.
  • 对于交互式浏览、页面检查、截图、点击、输入或登录流程,优先使用
    browser
    技能。
  • 对于不关心是否使用CLI的简单HTTP内容获取,专用的
    fetch
    技能通常是更好的选择。
  • 仅当用户明确想要使用CLI路径或已经在以
    browse
    为中心的工作流中时,才使用顶级驱动命令(
    browse open
    browse get
    browse click
    等)。

Command selection

命令选择

  • browse functions
    for local dev, packaging, publishing, and invocation
  • browse cloud sessions
    ,
    browse cloud projects
    ,
    browse cloud contexts
    ,
    browse cloud extensions
    for Browserbase platform resources
  • browse cloud fetch <url>
    for Fetch API requests
  • browse cloud search "<query>"
    for Search API requests
  • browse templates
    to browse and scaffold starter templates
  • browse open
    ,
    browse get
    ,
    browse click
    , etc. for direct local/remote browser driving
  • browse skills install
    to install Browserbase agent skills for Claude Code
For local browser work,
browse open <url> --local
starts a clean isolated browser. Use
browse open <url> --auto-connect
only when you need to attach to an existing debuggable Chrome session.
  • browse functions
    用于本地开发、打包、发布和调用
  • browse cloud sessions
    browse cloud projects
    browse cloud contexts
    browse cloud extensions
    用于Browserbase平台资源管理
  • browse cloud fetch <url>
    用于发起Fetch API请求
  • browse cloud search "<query>"
    用于发起Search API请求
  • browse templates
    用于浏览和搭建起始模板
  • browse open
    browse get
    browse click
    等用于直接驱动本地/远程浏览器
  • browse skills install
    用于为Claude Code安装Browserbase agent技能
对于本地浏览器操作,
browse open <url> --local
会启动一个干净的隔离浏览器。仅当需要连接到现有的可调试Chrome会话时,才使用
browse open <url> --auto-connect

Common workflows

常见工作流

Functions

Functions

bash
browse functions init my-function
cd my-function
browse functions dev index.ts
browse functions publish index.ts
browse functions invoke <function_id> --params '{"url":"https://example.com"}'
Use
browse functions invoke --check-status <invocation_id>
to poll an existing invocation instead of creating a new one.
bash
browse functions init my-function
cd my-function
browse functions dev index.ts
browse functions publish index.ts
browse functions invoke <function_id> --params '{"url":"https://example.com"}'
使用
browse functions invoke --check-status <invocation_id>
来轮询现有调用,而不是创建新的调用。

Platform APIs

平台APIs

bash
browse cloud projects list
browse cloud sessions create --proxies --verified --region us-east-1
browse cloud sessions create --solve-captchas --context-id ctx_abc --persist
browse cloud sessions get <session_id>
browse cloud sessions downloads get <session_id> --output session-artifacts.zip
browse cloud contexts create --body '{"region":"us-west-2"}'
browse cloud extensions upload ./my-extension.zip
bash
browse cloud projects list
browse cloud sessions create --proxies --verified --region us-east-1
browse cloud sessions create --solve-captchas --context-id ctx_abc --persist
browse cloud sessions get <session_id>
browse cloud sessions downloads get <session_id> --output session-artifacts.zip
browse cloud contexts create --body '{"region":"us-west-2"}'
browse cloud extensions upload ./my-extension.zip

Fetch API

Fetch API

bash
browse cloud fetch https://example.com
browse cloud fetch https://example.com --allow-redirects --output page.html
bash
browse cloud fetch https://example.com
browse cloud fetch https://example.com --allow-redirects --output page.html

Search API

Search API

bash
browse cloud search "browser automation"
browse cloud search "web scraping" --num-results 5
browse cloud search "AI agents" --output results.json
bash
browse cloud search "browser automation"
browse cloud search "web scraping" --num-results 5
browse cloud search "AI agents" --output results.json

Templates

模板

bash
browse templates list
browse templates list --tag Python --source Browserbase
browse templates clone form-filling --language typescript
browse templates clone amazon-product-scraping --language python ./my-scraper
bash
browse templates list
browse templates list --tag Python --source Browserbase
browse templates clone form-filling --language typescript
browse templates clone amazon-product-scraping --language python ./my-scraper

Best practices

最佳实践

  1. Prefer
    browse --help
    and subgroup
    --help
    before guessing flags.
  2. Use dash-case flags exactly as shown in CLI help.
  3. Use
    --output <file>
    on
    browse cloud fetch
    and
    browse cloud search
    to save results to a file.
  4. Use environment variables for auth unless the user explicitly wants one-off overrides.
  5. Pass structured request bodies with JSON strings in
    --body
    or
    --params
    .
  6. Remember that both
    browse functions ...
    and
    browse cloud ...
    use
    --base-url
    for API base URL overrides.
  1. 在猜测参数之前,优先使用
    browse --help
    和子命令的
    --help
  2. 严格按照CLI帮助中显示的短横线格式(dash-case)使用参数。
  3. browse cloud fetch
    browse cloud search
    中使用
    --output <file>
    将结果保存到文件。
  4. 除非用户明确想要一次性覆盖,否则使用环境变量进行认证。
  5. --body
    --params
    中通过JSON字符串传递结构化请求体。
  6. 记住
    browse functions ...
    browse cloud ...
    都可以使用
    --base-url
    来覆盖API基础URL。

Troubleshooting

故障排除

  • Missing API key: set
    BROWSERBASE_API_KEY
    or pass
    --api-key
  • Unknown flag: rerun the relevant command with
    --help
    and use the exact dash-case form
  • Command not found: re-run
    npm install -g browse
    and verify with
    which browse
For command-by-command reference and more examples, see REFERENCE.md.
  • 缺少API密钥:设置
    BROWSERBASE_API_KEY
    或传递
    --api-key
    参数
  • 未知参数:重新运行相关命令并添加
    --help
    ,使用正确的短横线格式参数
  • 命令未找到:重新运行
    npm install -g browse
    并通过
    which browse
    确认安装
如需逐命令参考和更多示例,请查看REFERENCE.md