官方更新 Google Developers Blog 正文 ok 586 words

为什么客户端 SDK 生成工具必须开源:Google 联合 Speakeasy 开源 OpenAPI 代码生成套件

英文标题:Why client SDK generation belongs in the open

Google 宣布与 Speakeasy 合作,在 AGPLv3 协议下正式开源其 OpenAPI 代码生成套件。此前 Google 使用的闭源专有 SDK 生成提供商被收购并突然关停,促使团队认识到闭源生成工具带来的严重平台风险,进而决定推动其成为开源基础设施。该套件支持 Python、TypeScript、Go 等 7 种主流语言的高质量 SDK 生成,并原生支持 Agent CLI 和文档 MCP 服务器生成,目前仅由约 1 名工程师即可维护覆盖多目标的 SDK 流水线。这一举措不仅消除了依赖专有工具的供应链风险,还为 AI 时代下开发者与 Agent 交互提供了兼具确定性与类型安全的底层基石。
打开原文相关 8 · 机会 6
media11.7 KB media236.4 KB media59.6 KB media85.0 KB media136.8 KB

中文

在过去几个月里,我们与 Speakeasy 紧密合作,为我们的 Interactions、Agents 和 Webhooks API 推出了全新的 Google GenAI SDK。今天,我们非常高兴地宣布,我们已与 Speakeasy 达成合作,将其 OpenAPI 代码生成套件正式开源。

python from google import genai

client = genai.Client()

interaction = client.interactions.create( model="gemini-3.8-flash", input="Analyze this commit log and find regressions.", )

print(interaction.output_text)

Python

从快速迭代演进的 OpenAPI 规范中,跨多种语言生成整洁、符合各语言惯用法(idiomatic)的 SDK 是一项艰巨的工程挑战。多年来,包括 Google 在内的前沿 AI 生态系统一直依赖专门的工具来生成客户端库,这些库需要能够处理复杂的流式传输协议、严格的错误层级以及丰富的联合类型(type unions),同时又不能让人感觉是机器生成的机械代码。

2026 年 5 月,正当我们全力筹备 Google I/O 以及 Interactions API 正式发布(General Availability)之际,我们当时所使用的 SDK 生成服务提供商被收购并突然宣布停服。

这一突如其来的中断清晰表明:专有的闭源生成器会带来不可接受的平台风险。如果整个行业都依靠 OpenAPI 来定义接口,那么将这些接口编译为客户端库、CLI 以及 Agent 工具的基础设施,就理应保持开源。

Evaluating the path forward

在时间紧迫的情况下重构 SDK 流水线时,我们的首要任务是最大限度地减少对开发者的干扰,并避免引入破坏性变更(breaking changes)。

我们与 Speakeasy 合作就地迁移了客户端库,其中的核心承诺就是将生成器套件开源。这次迁移需要极其严谨的工程实现:在所有目标语言之间对齐类型定义、保留严格的错误层级与流式传输行为,并将生成器直接集成到我们内部的 monorepo 与构建系统中。

在 Google DeepMind,尽管我们在开发工作流中广泛使用 AI,但我们坚信应当为技术栈的每一层选择合适的工具。将形式化的 API 规范转换为多语言 SDK,需要的是确定性与严格的类型安全。借助 Speakeasy,我们在核心层结合了快速、确定性的生成器,同时搭配 Antigravity AI Agent 加速 SDK 中定制化部分的构建。

以往维护纯手工编写的生成器通常需要多名工程师投入。而如今,这套架构仅需大约一名工程师维护,就能支撑起我们覆盖 6 个目标语言/平台的客户端流水线(目前已发布 3 个 SDK,更多目标很快就会推出)。

What is open sourced today

为了确保更广泛的开发者生态能够获得高质量、维护良好的 SDK 生成工具,同时免除遭遇类似供应链中断的风险,Speakeasy 正在 AGPLv3 许可下将其完整的 OpenAPI 客户端套件开源。

  1. 多语言 SDK 生成器:生成支持 7 种语言(Python、TypeScript、Go、Java、C#、PHP、Ruby)的客户端库。每个库都包含静态类型、服务器发送事件(SSE)流式传输、重试机制和分页支持。
  2. Agent 原生 CLI 生成器:编译独立的 CLI 二进制文件。AI 编码 Agent 可以直接在终端会话中运行你的 API,无需再临时编写一次性 HTTP 调用脚本。
  3. 文档 MCP 服务器生成器:将你的 OpenAPI 规范和 Markdown 文档转换为模型上下文协议(Model Context Protocol, MCP)服务器。像 Antigravity 这样的编码 Agent 可以直接查询实时、经过验证的 schema,无需去猜测已过时的方法。

该生成器采用 AGPLv3 许可证。这允许你在开发或 CI 流水线中运行它,同时完全保留所生成的代码/SDK 在你自选许可证(如 MIT 或 Apache 2.0)下的所有权。如果你修改了生成器编译器本身,AGPL 则可确保这些改进能够继续回馈给社区。

Try it out

你现在就可以使用我们更新后的 SDK 来探索全新的 Gemini Interactions API。如果你希望为自己的服务生成客户端库、CLI 或 MCP 服务器,可以在 GitHub 上获取 Speakeasy 生成器,并在你的 OpenAPI 规范上运行体验。

感谢阅读!Keep on building。

English / 原文

Over the last few months, we worked closely with Speakeasy to ship the new Google GenAI SDKs for our Interactions, Agents, and Webhooks APIs. Today, we're excited to announce that we’ve partnered with Speakeasy to make their OpenAPI code generation suite open source.

from google import genai

client = genai.Client()

interaction = client.interactions.create(
    model="gemini-3.8-flash",
    input="Analyze this commit log and find regressions.",
)

print(interaction.output_text)

Python

Generating clean, idiomatic SDKs across multiple languages from rapidly evolving OpenAPI specs is an engineering challenge. For years, the frontier AI ecosystem, including Google, relied on specialized tooling to generate client libraries that could handle complex streaming protocols, strict error hierarchies, and rich type unions without feeling machine-generated.

In May 2026, right as we were gearing up for Google I/O and the General Availability of the Interactions API, the SDK generation provider we were using was acquired and abruptly announced its shutdown.

This sudden disruption highlighted that proprietary, closed-source generators create unacceptable platform risk. If the industry relies on OpenAPI to define interfaces, the tooling to compile those interfaces into client libraries, CLIs, and agent tools should be open infrastructure.

Evaluating the path forward

As we were reworking our SDK pipeline on a tight timeline, our top priority was minimizing developer disruption and avoiding breaking changes.

We partnered with Speakeasy to migrate our client libraries in place, with the core commitment to make the generator suite open source. The migration required careful engineering: aligning type definitions across all target languages, preserving strict error hierarchies and streaming behavior, and integrating the generator directly into our internal monorepo and build system.

At Google DeepMind, while we use AI across our development workflows, we believe in choosing the right tool for each layer of the stack. Transforming formal API specifications into multi-language SDKs demands determinism and strict type safety. With Speakeasy, we pair a fast, deterministic generator at the core with Antigravity AI agents accelerating the custom parts of the SDK.

Maintaining previously handcrafted generators used to take multiple engineers. Today, this setup powers our client pipeline across six targets (three released SDKs, with more rolling out shortly) with roughly one engineer to maintain.

What is open sourced today

To help ensure the broader developer ecosystem has access to high-quality, well-maintained SDK generation tooling without the risk of similar disruptions, Speakeasy is open sourcing its full OpenAPI client suite under the AGPLv3 license.

  1. Multi-language SDK generators: Generates client libraries for 7 languages (Python, TypeScript, Go, Java, C#, PHP, Ruby). Each library includes static typing, server-sent events (SSE) streaming, retries, and pagination.
  2. An agent-native CLI generator: Compiles standalone CLI binaries. AI coding agents can run your API directly from terminal sessions without writing throwaway HTTP scripts.
  3. A documentation MCP server generator: Turns your OpenAPI specs and markdown documentation into a Model Context Protocol (MCP) server. Coding agents like Antigravity can query live, verified schemas instead of guessing outdated methods.

The generator is licensed under AGPLv3. This allows you to run it in your development or CI pipeline while keeping complete ownership of your generated code/SDKs under your chosen license (such as MIT or Apache 2.0). If you modify the generator compiler itself, the AGPL guarantees those improvements remain open to the community.

Try it out

You can explore the new Gemini Interactions API today using our updated SDKs. If you want to generate your own client libraries, CLIs, or MCP servers, you can find the Speakeasy generator on GitHub and run it against your OpenAPI specs.

Thanks for reading! Keep on building.