Loading...
    • 开发者指南
    • API 参考
    • MCP
    • 资源
    • 更新日志
    Search...
    ⌘K
    入门
    Claude 简介快速开始
    模型与定价
    模型概览选择模型Claude 4.6 新特性迁移指南模型弃用定价
    使用 Claude 构建
    功能概览使用 Messages API处理停止原因提示词最佳实践
    模型能力
    扩展思考自适应思考思考力度快速模式(研究预览)结构化输出引用流式消息批量处理PDF 支持搜索结果多语言支持嵌入视觉
    工具
    概览如何实现工具使用网页搜索工具网页获取工具代码执行工具记忆工具Bash 工具计算机使用工具文本编辑器工具
    工具基础设施
    工具搜索编程式工具调用细粒度工具流式传输
    上下文管理
    上下文窗口压缩上下文编辑提示缓存Token 计数
    文件与资源
    Files API
    Agent 技能
    概览快速开始最佳实践企业版技能通过 API 使用技能
    Agent SDK
    概览快速开始TypeScript SDKTypeScript V2(预览)Python SDK迁移指南
    API 中的 MCP
    MCP 连接器远程 MCP 服务器
    第三方平台上的 Claude
    Amazon BedrockMicrosoft FoundryVertex AI
    提示工程
    概览提示词生成器使用提示词模板提示词优化器清晰直接使用示例(多样本提示)让 Claude 思考(思维链)使用 XML 标签赋予 Claude 角色(系统提示词)链式复杂提示长上下文技巧扩展思考技巧
    测试与评估
    定义成功标准开发测试用例使用评估工具降低延迟
    加强安全护栏
    减少幻觉提高输出一致性防范越狱攻击流式拒绝减少提示词泄露保持 Claude 角色一致
    管理与监控
    Admin API 概览数据驻留工作空间用量与成本 APIClaude Code Analytics API零数据留存
    Console
    Log in
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...

    Solutions

    • AI agents
    • Code modernization
    • Coding
    • Customer support
    • Education
    • Financial services
    • Government
    • Life sciences

    Partners

    • Amazon Bedrock
    • Google Cloud's Vertex AI

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Company

    • Anthropic
    • Careers
    • Economic Futures
    • Research
    • News
    • Responsible Scaling Policy
    • Security and compliance
    • Transparency

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Help and security

    • Availability
    • Status
    • Support
    • Discord

    Terms and policies

    • Privacy policy
    • Responsible disclosure policy
    • Terms of service: Commercial
    • Terms of service: Consumer
    • Usage policy
    工具

    计算机使用工具

    了解如何使用 Claude 的计算机使用工具与桌面环境进行交互,包括截图功能和鼠标/键盘控制。

    Claude 可以通过计算机使用工具与计算机环境进行交互,该工具提供截图功能以及鼠标/键盘控制,用于自主桌面交互。在 WebArena(一个跨真实网站进行自主网页导航的基准测试)上,Claude 在单智能体系统中取得了最先进的成果,展示了端到端完成多步骤浏览器任务的强大能力。

    计算机使用功能处于测试阶段,需要 beta 请求头:

    • "computer-use-2025-11-24" 适用于 Claude Opus 4.6、Claude Sonnet 4.6、Claude Opus 4.5
    • "computer-use-2025-01-24" 适用于 Sonnet 4.5、Haiku 4.5、Opus 4.1、Sonnet 4、Opus 4 和 Sonnet 3.7(已弃用)

    请通过反馈表单分享您对此功能的反馈。

    This feature is eligible for Zero Data Retention (ZDR). When your organization has a ZDR arrangement, data sent through this feature is not stored after the API response is returned.

    概述

    计算机使用是一项测试版功能,使 Claude 能够与桌面环境进行交互。该工具提供:

    • 截图捕获:查看屏幕上当前显示的内容
    • 鼠标控制:点击、拖拽和移动光标
    • 键盘输入:输入文本并使用键盘快捷键
    • 桌面自动化:与任何应用程序或界面进行交互

    虽然计算机使用可以与 bash 和文本编辑器等其他工具结合使用,以实现更全面的自动化工作流,但计算机使用特指计算机使用工具查看和控制桌面环境的能力。

    模型兼容性

    计算机使用功能适用于以下 Claude 模型:

    模型工具版本Beta 标志
    Claude Opus 4.6、Claude Sonnet 4.6、Claude Opus 4.5computer_20251124computer-use-2025-11-24
    所有其他支持的模型computer_20250124computer-use-2025-01-24

    Claude Opus 4.6、Claude Sonnet 4.6 和 Claude Opus 4.5 引入了 computer_20251124 工具版本,新增了包括用于详细屏幕区域检查的缩放操作在内的新功能。所有其他模型(Sonnet 4.5、Haiku 4.5、Sonnet 4、Opus 4、Opus 4.1 和 Sonnet 3.7)使用 computer_20250124 工具版本。

    旧版工具版本不保证与新版模型向后兼容。请始终使用与您的模型版本对应的工具版本。

    安全注意事项

    计算机使用是一项测试版功能,具有与标准 API 功能不同的独特风险。在与互联网交互时,这些风险会更高。

    为了最大程度地降低风险,请考虑采取以下预防措施:

    1. 使用具有最低权限的专用虚拟机或容器,以防止直接的系统攻击或意外。
    2. 避免向模型提供敏感数据(如账户登录信息),以防止信息被盗。
    3. 将互联网访问限制在允许的域名列表中,以减少接触恶意内容的风险。
    4. 对于可能产生重大现实后果的决策,以及任何需要明确同意的任务(如接受 Cookie、执行金融交易或同意服务条款),请让人工进行确认。

    在某些情况下,即使与用户指令相冲突,Claude 也会遵循内容中的命令。例如,网页上或图片中包含的 Claude 指令可能会覆盖指令或导致 Claude 出错。请采取预防措施,将 Claude 与敏感数据和操作隔离,以避免与提示注入相关的风险。

    该模型已经过训练以抵抗这些提示注入,并添加了额外的防御层。如果您使用计算机使用工具,分类器将自动对您的提示运行,以标记潜在的提示注入实例。当这些分类器在截图中识别出潜在的提示注入时,它们将自动引导模型在继续下一步操作之前请求用户确认。这种额外保护并不适合所有使用场景(例如,没有人工参与的使用场景),因此如果您希望选择退出并关闭此功能,请联系支持。

    即使有分类器防御层,这些预防措施仍然很重要。

    在您自己的产品中启用计算机使用功能之前,请告知最终用户相关风险并获得其同意。

    计算机使用参考实现

    通过计算机使用参考实现快速入门,其中包括 Web 界面、Docker 容器、示例工具实现和智能体循环。

    注意: 该实现已更新,包含适用于 Claude 4 模型和 Claude Sonnet 3.7 的新工具。请务必拉取最新版本的代码库以访问这些新功能。

    使用此表单提供关于模型响应质量、API 本身或文档质量的反馈。

    快速入门

    以下是如何开始使用计算机使用功能:

    curl https://api.anthropic.com/v1/messages \
      -H "content-type: application/json" \
      -H "x-api-key: $ANTHROPIC_API_KEY" \
      -H "anthropic-version: 2023-06-01" \
      -H "anthropic-beta: computer-use-2025-11-24" \
      -d '{
        "model": "claude-opus-4-6",
        "max_tokens": 1024,
        "tools": [
          {
            "type": "computer_20251124",
            "name": "computer",
            "display_width_px": 1024,
            "display_height_px": 768,
            "display_number": 1
          },
          {
            "type": "text_editor_20250728",
            "name": "str_replace_based_edit_tool"
          },
          {
            "type": "bash_20250124",
            "name": "bash"
          }
        ],
        "messages": [
          {
            "role": "user",
            "content": "Save a picture of a cat to my desktop."
          }
        ]
      }'

    Beta 请求头仅对计算机使用工具是必需的。

    上面的示例展示了三个工具一起使用,由于包含计算机使用工具,因此需要 beta 请求头。


    计算机使用的工作原理

    1. 1

      向 Claude 提供计算机使用工具和用户提示

      • 将计算机使用工具(以及可选的其他工具)添加到您的 API 请求中。
      • 包含需要桌面交互的用户提示,例如"将一张猫的图片保存到我的桌面。"
    2. 2

      Claude 决定使用计算机使用工具

      • Claude 评估计算机使用工具是否能帮助解决用户的查询。
      • 如果可以,Claude 构建一个格式正确的工具使用请求。
      • API 响应的 stop_reason 为 tool_use,表示 Claude 的意图。
    3. 3

      提取工具输入,在计算机上评估工具,并返回结果

      • 在您这端,从 Claude 的请求中提取工具名称和输入。
      • 在容器或虚拟机上使用该工具。
      • 继续对话,发送包含 tool_result 内容块的新 user 消息。
    4. 4

      Claude 继续调用计算机使用工具,直到完成任务

      • Claude 分析工具结果,以确定是否需要更多工具使用或任务已完成。
      • 如果 Claude 决定需要另一个工具,它会以另一个 tool_use stop_reason 响应,您应返回步骤 3。
      • 否则,它会向用户生成文本响应。

    在没有用户输入的情况下重复步骤 3 和 4 被称为"智能体循环"(即 Claude 以工具使用请求响应,您的应用程序以评估该请求的结果响应 Claude)。

    计算环境

    计算机使用需要一个沙盒计算环境,Claude 可以在其中安全地与应用程序和网络进行交互。该环境包括:

    1. 虚拟显示器:一个虚拟 X11 显示服务器(使用 Xvfb),用于渲染 Claude 将通过截图看到并用鼠标/键盘操作控制的桌面界面。

    2. 桌面环境:在 Linux 上运行的轻量级 UI,带有窗口管理器(Mutter)和面板(Tint2),为 Claude 提供一致的图形界面进行交互。

    3. 应用程序:预安装的 Linux 应用程序,如 Firefox、LibreOffice、文本编辑器和文件管理器,Claude 可以使用这些应用程序完成任务。

    4. 工具实现:将 Claude 的抽象工具请求(如"移动鼠标"或"截图")转换为虚拟环境中实际操作的集成代码。

    5. 智能体循环:处理 Claude 与环境之间通信的程序,将 Claude 的操作发送到环境并将结果(截图、命令输出)返回给 Claude。

    当您使用计算机使用功能时,Claude 不会直接连接到此环境。相反,您的应用程序:

    1. 接收 Claude 的工具使用请求
    2. 将其转换为您的计算环境中的操作
    3. 捕获结果(截图、命令输出等)
    4. 将这些结果返回给 Claude

    为了安全和隔离,参考实现在 Docker 容器内运行所有这些内容,并具有适当的端口映射,用于查看和与环境交互。


    如何实现计算机使用

    从参考实现开始

    提供了一个参考实现,其中包含快速开始使用计算机使用所需的一切:

    • 适合与 Claude 进行计算机使用的容器化环境
    • 计算机使用工具的实现
    • 与 Claude API 交互并执行计算机使用工具的智能体循环
    • 用于与容器、智能体循环和工具交互的 Web 界面。

    理解多智能体循环

    计算机使用的核心是"智能体循环"——Claude 请求工具操作、您的应用程序执行这些操作并将结果返回给 Claude 的循环。以下是一个简化示例:

    async def sampling_loop(
        *,
        model: str,
        messages: list[dict],
        api_key: str,
        max_tokens: int = 4096,
        tool_version: str,
        thinking_budget: int | None = None,
        max_iterations: int = 10,  # Add iteration limit to prevent infinite loops
    ):
        """
        A simple agent loop for Claude computer use interactions.
    
        This function handles the back-and-forth between:
        1. Sending user messages to Claude
        2. Claude requesting to use tools
        3. Your app executing those tools
        4. Sending tool results back to Claude
        """
        # Set up tools and API parameters
        client = Anthropic(api_key=api_key)
        beta_flag = (
            "computer-use-2025-11-24"
            if "20251124" in tool_version
            else "computer-use-2025-01-24"
            if "20250124" in tool_version
            else "computer-use-2024-10-22"
        )
    
        # Configure tools - you should already have these initialized elsewhere
        tools = [
            {
                "type": f"computer_{tool_version}",
                "name": "computer",
                "display_width_px": 1024,
                "display_height_px": 768,
            },
            {"type": f"text_editor_{tool_version}", "name": "str_replace_editor"},
            {"type": f"bash_{tool_version}", "name": "bash"},
        ]
    
        # Main agent loop (with iteration limit to prevent runaway API costs)
        iterations = 0
        while True and iterations < max_iterations:
            iterations += 1
            # Set up optional thinking parameter (for Claude Sonnet 3.7)
            thinking = None
            if thinking_budget:
                thinking = {"type": "enabled", "budget_tokens": thinking_budget}
    
            # Call the Claude API
            response = client.beta.messages.create(
                model=model,
                max_tokens=max_tokens,
                messages=messages,
                tools=tools,
                betas=[beta_flag],
                thinking=thinking,
            )
    
            # Add Claude's response to the conversation history
            response_content = response.content
            messages.append({"role": "assistant", "content": response_content})
    
            # Check if Claude used any tools
            tool_results = []
            for block in response_content:
                if block.type == "tool_use":
                    # In a real app, you would execute the tool here
                    # For example: result = run_tool(block.name, block.input)
                    result = {"result": "Tool executed successfully"}
    
                    # Format the result for Claude
                    tool_results.append(
                        {"type": "tool_result", "tool_use_id": block.id, "content": result}
                    )
    
            # If no tools were used, Claude is done - return the final messages
            if not tool_results:
                return messages
    
            # Add tool results to messages for the next iteration with Claude
            messages.append({"role": "user", "content": tool_results})

    循环持续进行,直到 Claude 在不请求任何工具的情况下响应(任务完成)或达到最大迭代限制。此保护措施可防止可能导致意外 API 费用的潜在无限循环。

    在阅读本文档的其余部分之前,请先尝试参考实现。

    通过提示优化模型性能

    以下是一些获得最佳质量输出的技巧:

    1. 指定简单、明确的任务,并为每个步骤提供明确的指令。
    2. Claude 有时会在不明确检查结果的情况下假设其操作的结果。为了防止这种情况,您可以提示 Claude:After each step, take a screenshot and carefully evaluate if you have achieved the right outcome. Explicitly show your thinking: "I have evaluated step X..." If not correct, try again. Only when you confirm a step was executed correctly should you move on to the next one.
    3. 某些 UI 元素(如下拉菜单和滚动条)可能对 Claude 使用鼠标移动来操作比较困难。如果遇到这种情况,请尝试提示模型使用键盘快捷键。
    4. 对于可重复的任务或 UI 交互,在提示中包含成功结果的示例截图和工具调用。
    5. 如果您需要模型登录,请在提示中使用 xml 标签(如 <robot_credentials>)提供用户名和密码。在需要登录的应用程序中使用计算机使用会增加因提示注入而导致不良结果的风险。在向模型提供登录凭据之前,请查阅缓解提示注入的指南。

    如果您反复遇到一组明确的问题,或者事先知道 Claude 需要完成的任务,请使用系统提示为 Claude 提供关于如何成功完成任务的明确提示或指令。

    对于跨多个会话的智能体,请在每个会话开始时运行端到端验证,而不仅仅是在实现之后。基于浏览器的检查可以捕获仅靠代码级审查无法发现的先前会话中的回归问题。详情请参阅长期运行智能体的有效测试框架。

    系统提示

    当通过 Claude API 请求 Anthropic 定义的工具之一时,会生成一个特定于计算机使用的系统提示。它类似于工具使用系统提示,但以以下内容开头:

    You have access to a set of functions you can use to answer the user's question. This includes access to a sandboxed computing environment. You do NOT currently have the ability to inspect files or interact with external resources, except by invoking the below functions.

    与常规工具使用一样,用户提供的 system_prompt 字段仍然受到尊重,并用于构建组合系统提示。

    可用操作

    计算机使用工具支持以下操作:

    基本操作(所有版本)

    • screenshot - 捕获当前显示
    • left_click - 在坐标 [x, y] 处点击
    • type - 输入文本字符串
    • key - 按下键或组合键(例如,"ctrl+s")
    • mouse_move - 将光标移动到坐标

    增强操作(computer_20250124) 适用于 Claude 4 模型和 Claude Sonnet 3.7:

    • scroll - 在任意方向滚动,带有滚动量控制
    • left_click_drag - 在坐标之间点击并拖拽
    • right_click、middle_click - 额外的鼠标按钮
    • double_click、triple_click - 多次点击
    • left_mouse_down、left_mouse_up - 细粒度点击控制
    • hold_key - 按住某个键持续指定时间(以秒为单位)
    • wait - 在操作之间暂停

    增强操作(computer_20251124) 适用于 Claude Opus 4.6 和 Claude Opus 4.5:

    • computer_20250124 中的所有操作
    • zoom - 以全分辨率查看屏幕的特定区域。需要在工具定义中设置 enable_zoom: true。接受带有坐标 [x1, y1, x2, y2] 的 region 参数,定义要检查区域的左上角和右下角。

    工具参数

    参数是否必需描述
    type是工具版本(computer_20251124、computer_20250124 或 computer_20241022)
    name是必须为 "computer"
    display_width_px是显示宽度(像素)
    display_height_px是显示高度(像素)
    display_number否X11 环境的显示编号
    enable_zoom否启用缩放操作(仅限 computer_20251124)。设置为 true 以允许 Claude 缩放到特定屏幕区域。默认值:false

    重要提示: 计算机使用工具必须由您的应用程序明确执行——Claude 无法直接执行它。您负责根据 Claude 的请求实现截图捕获、鼠标移动、键盘输入和其他操作。

    在 Claude 4 模型和 Claude Sonnet 3.7 中启用思考功能

    Claude Sonnet 3.7 引入了一种新的"思考"功能,允许您在模型处理复杂任务时查看其推理过程。此功能帮助您了解 Claude 如何处理问题,对于调试或教育目的特别有价值。

    要启用思考功能,请在您的 API 请求中添加 thinking 参数:

    "thinking": {
      "type": "enabled",
      "budget_tokens": 1024
    }

    budget_tokens 参数指定 Claude 可以用于思考的令牌数量。这将从您的整体 max_tokens 预算中扣除。

    启用思考功能后,Claude 将在响应中返回其推理过程,这可以帮助您:

    1. 了解模型的决策过程
    2. 识别潜在问题或误解
    3. 从 Claude 解决问题的方法中学习
    4. 更好地了解复杂的多步骤操作

    以下是思考输出可能的示例:

    [Thinking]
    I need to save a picture of a cat to the desktop. Let me break this down into steps:
    
    1. First, I'll take a screenshot to see what's on the desktop
    2. Then I'll look for a web browser to search for cat images
    3. After finding a suitable image, I'll need to save it to the desktop
    
    Let me start by taking a screenshot to see what's available...

    将计算机使用与其他工具结合

    计算机使用工具可以与其他工具结合,创建更强大的自动化工作流程。这在以下情况下特别有用:

    • 执行系统命令(bash 工具)
    • 编辑配置文件或脚本(文本编辑器工具)
    • 与自定义 API 或服务集成(自定义工具)
    curl https://api.anthropic.com/v1/messages \
      -H "content-type: application/json" \
      -H "x-api-key: $ANTHROPIC_API_KEY" \
      -H "anthropic-version: 2023-06-01" \
      -H "anthropic-beta: computer-use-2025-11-24" \
      -d '{
        "model": "claude-opus-4-6",
        "max_tokens": 2000,
        "tools": [
          {
            "type": "computer_20251124",
            "name": "computer",
            "display_width_px": 1024,
            "display_height_px": 768,
            "display_number": 1
          },
          {
            "type": "text_editor_20250728",
            "name": "str_replace_based_edit_tool"
          },
          {
            "type": "bash_20250124",
            "name": "bash"
          },
          {
            "name": "get_weather",
            "description": "Get the current weather in a given location",
            "input_schema": {
              "type": "object",
              "properties": {
                "location": {
                  "type": "string",
                  "description": "The city and state, e.g. San Francisco, CA"
                },
                "unit": {
                  "type": "string",
                  "enum": ["celsius", "fahrenheit"],
                  "description": "The unit of temperature, either 'celsius' or 'fahrenheit'"
                }
              },
              "required": ["location"]
            }
          }
        ],
        "messages": [
          {
            "role": "user",
            "content": "Find flights from San Francisco to a place with warmer weather."
          }
        ],
        "thinking": {
          "type": "enabled",
          "budget_tokens": 1024
        }
      }'

    构建自定义计算机使用环境

    参考实现旨在帮助您快速开始使用计算机使用功能。它包含让 Claude 使用计算机所需的所有组件。但是,您可以根据自己的需求构建自己的计算机使用环境。您需要:

    • 适合 Claude 进行计算机使用的虚拟化或容器化环境
    • 至少一个 Anthropic 定义的计算机使用工具的实现
    • 与 Claude API 交互并使用您的工具实现执行 tool_use 结果的代理循环
    • 允许用户输入以启动代理循环的 API 或 UI

    实现计算机使用工具

    计算机使用工具作为无模式工具实现。使用此工具时,您不需要像其他工具一样提供输入模式;该模式内置于 Claude 的模型中,无法修改。

    1. 1

      设置您的计算环境

      创建虚拟显示器或连接到 Claude 将与之交互的现有显示器。这通常涉及设置 Xvfb(X 虚拟帧缓冲区)或类似技术。

    2. 2

      实现动作处理程序

      创建函数来处理 Claude 可能请求的每种动作类型:

      def handle_computer_action(action_type, params):
          if action_type == "screenshot":
              return capture_screenshot()
          elif action_type == "left_click":
              x, y = params["coordinate"]
              return click_at(x, y)
          elif action_type == "type":
              return type_text(params["text"])
          # ... handle other actions
    3. 3

      处理 Claude 的工具调用

      从 Claude 的响应中提取并执行工具调用:

      for content in response.content:
          if content.type == "tool_use":
              action = content.input["action"]
              result = handle_computer_action(action, content.input)
      
              # Return result to Claude
              tool_result = {
                  "type": "tool_result",
                  "tool_use_id": content.id,
                  "content": result,
              }
    4. 4

      实现代理循环

      创建一个循环,持续运行直到 Claude 完成任务:

      while True:
          response = client.beta.messages.create(...)
      
          # Check if Claude used any tools
          tool_results = process_tool_calls(response)
      
          if not tool_results:
              # No more tool use, task complete
              break
      
          # Continue conversation with tool results
          messages.append({"role": "user", "content": tool_results})

    处理错误

    在实现计算机使用工具时,可能会发生各种错误。以下是处理方法:

    处理更高分辨率的坐标缩放

    API 将图像限制为最长边最多 1568 像素,总计约 115 万像素(详见图像调整大小)。例如,1512x982 的屏幕会被降采样至约 1330x864。Claude 分析这个较小的图像并在该空间中返回坐标,但您的工具在原始屏幕空间中执行点击。

    除非您处理坐标转换,否则这可能导致 Claude 的点击坐标偏离目标。

    要解决此问题,请自行调整截图大小并将 Claude 的坐标按比例放大:

    import math
    
    
    def get_scale_factor(width, height):
        """Calculate scale factor to meet API constraints."""
        long_edge = max(width, height)
        total_pixels = width * height
    
        long_edge_scale = 1568 / long_edge
        total_pixels_scale = math.sqrt(1_150_000 / total_pixels)
    
        return min(1.0, long_edge_scale, total_pixels_scale)
    
    
    # When capturing screenshot
    scale = get_scale_factor(screen_width, screen_height)
    scaled_width = int(screen_width * scale)
    scaled_height = int(screen_height * scale)
    
    # Resize image to scaled dimensions before sending to Claude
    screenshot = capture_and_resize(scaled_width, scaled_height)
    
    
    # When handling Claude's coordinates, scale them back up
    def execute_click(x, y):
        screen_x = x / scale
        screen_y = y / scale
        perform_click(screen_x, screen_y)

    遵循实现最佳实践


    了解计算机使用的局限性

    计算机使用功能目前处于测试阶段。虽然 Claude 的能力处于前沿水平,但开发者应了解其局限性:

    1. 延迟:当前计算机使用中人机交互的延迟可能比常规人工操作计算机慢。请专注于速度不是关键因素的使用场景(例如,在可信环境中进行后台信息收集、自动化软件测试)。
    2. 计算机视觉准确性和可靠性:Claude 在生成动作时输出特定坐标时可能会出错或产生幻觉。Claude Sonnet 3.7 引入了思考能力,可以帮助您了解模型的推理过程并识别潜在问题。
    3. 工具选择准确性和可靠性:Claude 在生成动作时选择工具时可能会出错或产生幻觉,或采取意外动作来解决问题。此外,与小众应用程序或同时与多个应用程序交互时,可靠性可能较低。在请求复杂任务时请仔细提示模型。
    4. 滚动可靠性:Claude Sonnet 3.7 引入了带方向控制的专用滚动动作,提高了可靠性。模型现在可以按指定量明确地向任意方向(上/下/左/右)滚动。
    5. 电子表格交互:Claude Sonnet 3.7 通过添加更精确的鼠标控制动作(如 left_mouse_down、left_mouse_up)和新的修饰键支持,改善了电子表格交互的鼠标点击。通过使用这些精细控制并将修饰键与点击结合使用,单元格选择可以更加可靠。
    6. 在社交和通信平台上创建账户和生成内容:虽然 Claude 会访问网站,但 Claude 在社交媒体网站和平台上创建账户、生成和分享内容或以其他方式进行人类模拟的能力是有限的。此功能可能会在未来更新。
    7. 漏洞:越狱或提示注入等漏洞可能在前沿 AI 系统中持续存在,包括测试版计算机使用 API。在某些情况下,Claude 会遵循内容中发现的命令,有时甚至与用户的指令相冲突。例如,网页上或图像中包含的 Claude 指令可能会覆盖指令或导致 Claude 出错。请考虑以下事项: a. 将计算机使用限制在可信环境中,例如具有最小权限的虚拟机或容器 b. 避免在没有严格监督的情况下让计算机使用访问敏感账户或数据 c. 在启用或请求应用程序中计算机使用功能所需的权限之前,告知最终用户相关风险并获得其同意
    8. 不当或非法行为:根据 Anthropic 的服务条款,您不得使用计算机使用功能违反任何法律或可接受使用政策。

    请务必仔细审查和验证 Claude 的计算机使用动作和日志。在没有人工监督的情况下,请勿将 Claude 用于需要完美精度或涉及敏感用户信息的任务。

    数据保留

    计算机使用是一个客户端工具。会话中涉及的所有截图、鼠标动作、键盘输入和任何文件都在您的环境中捕获和存储,而非由 Anthropic 存储。Anthropic 作为 API 调用的一部分实时处理截图图像和动作请求,但在返回响应后不会保留它们。

    由于您的应用程序控制计算机使用数据的存储位置和方式,计算机使用符合 ZDR 资格。有关所有功能的 ZDR 资格,请参阅 API 和数据保留。

    定价

    Computer use follows the standard tool use pricing. When using the computer use tool:

    System prompt overhead: The computer use beta adds 466-499 tokens to the system prompt

    Computer use tool token usage:

    ModelInput tokens per tool definition
    Claude 4.x models735 tokens
    Claude Sonnet 3.7 (deprecated)735 tokens

    Additional token consumption:

    • Screenshot images (see Vision pricing)
    • Tool execution results returned to Claude

    If you're also using bash or text editor tools alongside computer use, those tools have their own token costs as documented in their respective pages.

    后续步骤

    参考实现

    使用完整的基于 Docker 的实现快速入门

    工具文档

    了解更多关于工具使用和创建自定义工具的信息

    Was this page helpful?

    • 在 Claude 4 模型和 Claude Sonnet 3.7 中启用思考功能