进阶 ai.google.dev 2026-10-15 02:43:21 · 32 阅读

第12章 Gemini Robotics ER 概览

Gemini 4 Argon 现已上线。立即体验。

Gemini Robotics ER(具身推理)模型属于视觉-语言模型(VLMs),可让机器人感知并与物理世界互动。它们能解读视觉数据,进行空间与时间推理,规划多步骤任务,并统筹调度机器人与工具。

模型 Gemini Robotics ER 2 是 Gemini Robotics 系列中的最新模型。这是更新后的推理模型,旨在帮助机器人精准理解环境。它专注于具身推理能力,例如通过智能体编排控制机器人(如使用 VLA)、机器人视频理解(含进度理解与成功检测)、仪表读数、指向、以及空间推理。

Gemini Robotics ER 2 模型引入了两个模型端点:

* gemini-robotics-er-2-preview:标准 ER 2 模型。基于 Gemini 3.5 Flash,强化了空间推理、视频关键时刻定位、视频进度分类、多机器人编排和多步骤工具调用。 * gemini-robotics-er-2-streaming-preview:针对 Live API 的实时流处理进行了优化。适用于处理连续音视频输入的低延迟机器人智能体。

Gemini Robotics ER 1.6 已于 2026 年 8 月 31 日弃用。若仍在使用 Gemini Robotics ER 1.6,请将 API 调用中的 model="gemini-robotics-er-1.6-preview" 替换为 model="gemini-robotics-er-2-preview" 或 model="gemini-robotics-er-2-streaming-preview",即可升级到 Gemini Robotics ER 2。

在 Google AI Studio 中试用 Gemini Robotics ER 2

机器人能力 Gemini Robotics ER 支持多种具身推理能力。选择某项能力以了解详情:

能力 | 描述 | 指南 --- | --- | --- 空间推理 | 指向物体、在视频中追踪、检测包围盒、规划轨迹。 | 空间推理 智能体视觉 | 利用图像操作工具,通过代码执行增强其他能力。 | 智能体视觉 任务编排 | 结合空间推理与自定义机器人 API,完成长时程任务。 | 任务编排 流式处理(仅限 Gemini Robotics ER 2 流式端点) | 用于低延迟函数调用的实时机器人智能体双向流。 | 机器人流式处理 视频进度(仅限 Gemini Robotics ER 2) | 从连续视频流中进行关键时刻定位与进度分类。 | 视频理解

准备工作 Gemini Robotics ER 模型可通过 Gemini Developer API 获取。要开始使用,请从 Google AI Studio 或 Google Cloud 控制台创建 Gemini API 密钥,并配置你的环境。

关于密钥类型、安全性以及如何在 Python、JavaScript 等语言中配置密钥的详情,请参见使用 Gemini API 密钥。

快速上手 以下示例查找图像中的物体,并返回其归一化的 2D 坐标和标签。你可以将此输出直接传递给机器人 API 或 VLA 模型以生成机器人动作。

Python ```python from google import genai

PROMPT = """ Point to no more than 10 items in the image. The label returned should be an identifying name for the object detected. The answer should follow the json format: [{"point": , "label": }, ...]. The points are in [y, x] format normalized to 0-1000. """ client = genai.Client()

uploaded_file = client.files.upload(file="my-image.png")

image_response = client.interactions.create( model="gemini-robotics-er-2-preview", input=[ { "type": "image", "uri": uploaded_file.uri, "mime_type": uploaded_file.mime_type }, {"type": "text", "text": PROMPT} ], generation_config={"thinking_level": "high"}, )

print(image_response.output_text) ```

JavaScript ```javascript import { GoogleGenAI } from "@google/genai";

const PROMPT = ` Point to no more than 10 items in the image. The label returned should be an identifying name for the object detected. The answer should follow the json format: [{"point": , "label": }, ...]. The points are in [y, x] format normalized to 0-1000. `; const client = new GoogleGenAI();

const uploadedFile = await client.files.upload({ file: "my-image.png" });

const imageResponse = await client.interactions.create({ model: "gemini-robotics-er-2-preview", input: [ { type: "image", uri: uploadedFile.uri, mime_type: uploadedFile.mimeType, }, { type: "text", text: PROMPT }, ], generation_config: { thinking_level: "high" }, });

console.log(imageResponse.output_text); ```

Java ```java import com.google.genai.Client; import com.google.genai.gaos.models.interactions.Content; import com.google.genai.gaos.models.interactions.CreateModelInteraction; import com.google.genai.gaos.models.interactions.GenerationConfig; import com.google.genai.gaos.models.interactions.ImageContent; import com.google.genai.gaos.models.interactions.ImageContentMimeType; import com.google.genai.gaos.models.interactions.Interaction; import com.google.genai.gaos.models.interactions.InteractionsInput; import com.google.genai.gaos.models.interactions.Model; import com.google.genai.gaos.models.interactions.TextContent; import com.google.genai.gaos.models.interactions.ThinkingLevel; import com.google.genai.gaos.models.operations.CreateInteractionRequestBody; import com.google.genai.types.File; import com.google.genai.types.UploadFileConfig; import java.util.List;

Client client = new Client();

String prompt = "Point to no more than 10 items in the image. The label returned " + "should be an identifying name for the object detected. " + "The answer should follow the json format: [{\"point\": , " + "\"label\": }, ...]. The points are in [y, x] format " + "normalized to 0-1000.";

File uploadedFile = client.files.upload( new java.io.File("my-image.png"), UploadFileConfig.builder().mimeType("image/png").build());

Content imageContent = ImageContent.builder() .uri(uploadedFile.uri().orElse("")) .mimeType(ImageContentMimeType.of(uploadedFile.mimeType().orElse("image/png"))) .build(); Content textContent = TextContent.builder().text(prompt).build();

CreateModelInteraction params = CreateModelInteraction.builder() .model(Model.of("gemini-robotics-er-2-preview")) .input(InteractionsInput.ofContent(List.of(imageContent, textContent))) .generationConfig( GenerationConfig.builder().thinkingLevel(ThinkingLevel.HIGH).build()) .build();

Interaction imageResponse = client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();

System.out.println(imageResponse.outputText().orElse("")); ```

Go ```go package main

import ( "context" "fmt" "log"

"google.golang.org/genai" "google.golang.org/genai/interactions/models/interactions" "google.golang.org/genai/interactions/models/operations" )

func main() { ctx := context.Background() client, err := genai.NewClient(ctx, nil) if err != nil { log.Fatal(err) }

prompt := `Point to no more than 10 items in the image. The label returned should be an identifying name for the object detected. The answer should follow the json format: [{"point": , "label": }, ...]. The points are in [y, x] format normalized to 0-1000.`

uploadedFile, err := client.Files.UploadFromPath(ctx, "my-image.png", &genai.UploadFileConfig{ MIMEType: "image/png", }) if err != nil { log.Fatal(err) }

res, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{ Body: operations.NewCreateInteractionRequestBody(interactions.CreateModelInteraction{ Model: interactions.Model("gemini-robotics-er-2-preview"), Input: interactions.NewInteractionsInput([]interactions.Content{ interactions.NewContent(interactions.ImageContent{ URI: genai.Ptr(uploadedFile.URI), MimeType: genai.Ptr(interactions.ImageMimeTypeImagePng), }), interactions.NewContent(interactions.TextContent{ Text: prompt, }), }), GenerationConfig: &interactions.GenerationConfig{ ThinkingLevel: interactions.ThinkingLevelHigh.ToPointer(), }, }), }) if err != nil { log.Fatal(err) } if res.Interaction.OutputText != nil { fmt.Println(*res.Interaction.OutputText) } } ```

REST ```bash # First, ensure you have the image file locally. # Encode the image to base64 IMAGE_BASE64=$(base64 -w 0 my-image.png)

curl -X POST \ "https://generativelanguage.googleapis.com/v1beta/interactions" \ -H "x-goog-api-key: $GEMINI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gemini-robotics-er-2-preview", "input": { "parts": [ { "inlineData": { "mimeType": "image/png", "data": "'"${IMAGE_BASE64}"'" } }, { "text": "Point to no more than 10 items in the image. The label returned should be an identifying name for the object detected. The answer should follow the json format: [{\"point\": [y, x], \"label\": }, ...]. The points are in [y, x] format normalized to 0-1000." } ] }, "generation_config": { "thinking_config": { "thinking_level": "high" } } }' ```

输出将是一个 JSON 数组,其中包含若干对象,每个对象都具有一个点(归一化的 [y, x] 坐标)和用于标识该物体的标签。

JSON ```json [ {"point": [376, 508], "label": "small banana"}, {"point": [287, 609], "label": "larger banana"}, {"point": [223, 303], "label": "pink starfruit"}, {"point": [435, 172], "label": "paper bag"}, {"point": [270, 786], "label": "green plastic bowl"}, {"point": [488, 775], "label": "metal measuring cup"}, {"point": [673, 580], "label": "dark blue bowl"}, {"point": [471, 353], "label": "light blue bowl"}, {"point": [492, 497], "label": "bread"}, {"point": [525, 429], "label": "lime"} ] ```

以下图像展示了如何显示这些坐标点:

工作原理 Gemini Robotics ER 接受图像、视频或音频输入以及自然语言提示词。它识别物体,推理场景上下文和空间关系,并返回坐标或包围盒等结构化输出。

Gemini Robotics ER 还具有智能体特性:它将复杂任务分解为子任务,并通过调用你的机器人函数或运行生成的代码来执行它们。例如,“把苹果放进碗里”会被分解为定位、抓取和放置的系列步骤。

关于 Gemini 如何执行工具调用的详情,请参见函数调用。

安全性 虽然 Gemini Robotics ER 在构建时已考虑安全性,但维护机器人周围的安全环境是你的责任。生成式 AI 模型可能会出错,而实体机器人可能造成损坏。欲了解更多信息,请访问 Gemini Robotics 安全页面。

最佳实践

* 使用平实的自然语言。像对人说话一样描述你希望机器人做什么。如果某个术语不起作用,尝试使用常见的同义词。 * 优化视觉输入。在发送图像前,裁剪或放大细小或不清晰的物体。光线不足和低色彩对比度会影响检测。 * 将复杂任务分解为步骤。将每个步骤作为独立的提示词发送,以保持模型的专注度并提高准确性。 * 对于高精度任务,多次查询并取结果平均值。这种共识方法减少了空间输出的方差。

局限性 在使用 Gemini Robotics ER 开发时,请考虑以下局限性:

* API 密钥限制:Gemini API 不接受来自无限制 API 密钥的请求,并返回 403 Forbidden 错误。通过在 AI Studio 中添加限制来保护你的 API 密钥。详情参见保护无限制 API 密钥。 * 延迟与性能:复杂查询、高分辨率输入或高思考级别可能导致处理时间增加。对于思考级别,建议使用中等级别以在延迟和性能之间取得良好平衡。 * 幻觉:与其他大型语言模型一样,Gemini Robotics ER 模型偶尔会产生“幻觉”或提供错误信息,尤其是针对模糊的提示词或分布外输入时。 * 依赖提示词质量:输出质量取决于输入提示词的清晰度。使用具体、结构良好的提示词。 * 计算成本:运行模型(尤其是使用视频输入或高 thinking_budget 时)会消耗计算资源并产生费用。更多信息参见思考页面。 * 输入类型:关于各模式限制的详细信息,请参阅以下主题。 * 图像输入 * 视频输入 * 音频输入

隐私声明 你确认本文件中引用的模型(“机器人模型”)利用视频和音频数据,根据你的指令运行并移动你的硬件。因此,你可以操作机器人模型,使其收集来自可识别人群的数据,如语音、图像和容貌数据(“个人数据”)。如果你选择以收集个人数据的方式操作机器人模型,你同意你不会允许任何可识别人群与机器人模型互动或出现在其周围区域,除非且直到这些可识别人群已收到充分通知并同意其个人数据可能如 Gemini API 附加服务条款(位于 https://ai.google.dev/gemini-api/terms,以下简称“条款”)中所概述的那样被提供给 Google 并使用,包括符合“Google 如何使用你的数据”章节的规定。你将确保该通知允许按照条款收集和使用个人数据,并将使用商业合理努力,通过模糊面部和处理不含可识别人群的区域等技术来最小化个人数据的收集和分发。

定价 有关定价和可用地区的详细信息,请参见定价页面。

模型端点

Gemini Robotics ER 2 Preview

属性 | 描述 --- | --- 模型代码 | gemini-robotics-er-2-preview 支持的数据类型 | 输入:文本、图像、视频、音频 输出:文本 Token 限制[*] | 输入 Token 限制:131,072 输出 Token 限制:65,536 能力 | 音频生成:不支持 缓存:支持 代码执行:支持 计算机使用:支持 文件搜索:支持 函数调用:支持 结合 Google 地图接地:支持 图像生成:不支持 Live API:不支持 搜索接地:支持 结构化输出:支持 思考:支持 URL 上下文:支持 消费选项 | 批量 API:支持 灵活推理:不支持 优先推理:不支持

123 版本

阅读模型版本模式以了解更多详情。

预览版:gemini-robotics-er-2-preview

最新更新 2026 年 7 月

模型卡片

Gemini Robotics ER 2 Streaming Preview

属性 | 描述 --- | --- 模型代码 | gemini-robotics-er-2-streaming-preview 支持的数据类型 | 输入:文本、图像、视频、音频 输出:文本 Token 限制[*] | 输入 Token 限制:131,072 输出 Token 限制:65,536 能力 | 音频生成:不支持 缓存:不支持 代码执行:不支持 计算机使用:不支持 文件搜索:不支持 函数调用:支持 结合 Google 地图接地:不支持 图像生成:不支持 Live API:支持 搜索接地:支持 结构化输出:不支持 思考:支持 URL 上下文:不支持 消费选项 | 批量 API:不支持 灵活推理:不支持 优先推理:不支持

123 版本

阅读模型版本模式以了解更多详情。

预览版:gemini-robotics-er-2-streaming-preview

最新更新 2026 年 7 月

模型卡片

Gemini Robotics ER 1.6 Preview

属性 | 描述 --- | --- 模型代码 | gemini-robotics-er-1.6-preview 支持的数据类型 | 输入:文本、图像、视频、音频 输出:文本 Token 限制[*] | 输入 Token 限制:131,072 输出 Token 限制:65,536 能力 | 音频生成:不支持 缓存:支持 代码执行:支持 计算机使用:支持 文件搜索:支持 函数调用:支持 结合 Google 地图接地:支持 图像生成:不支持 Live API:不支持 搜索接地:支持 结构化输出:支持 思考:支持 URL 上下文:支持 消费选项 | 批量 API:支持 灵活推理:不支持 优先推理:不支持

123 版本

阅读模型版本模式以了解更多详情。

预览版:gemini-robotics-er-1.6-preview

最新更新 2025 年 12 月

知识截止日期 2025 年 1 月

下一步

* 空间推理 — 指向、追踪、包围盒、轨迹。 * 智能体能力 — 代码执行、仪表读数、图像注释。 * 任务编排 — 通过自定义机器人 API 完成长时程任务。 * 带流式处理的机器人 — 实时双向流(仅限 Gemini Robotics ER 2)。 * 视频理解 — 关键时刻定位与进度分类(仅限 Gemini Robotics ER 2)。 * Gemini Robotics 安全性 — 该模型家族背后的安全研究。

评论 (0)