> ## Documentation Index
> Fetch the complete documentation index at: https://omer-914cc1c6.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Speakeasy

> 在 API 操作台中自动展示并自动更新你的 SDK 使用片段

由 Speakeasy SDK 自动生成的代码片段可直接集成到 Mintlify 的 API 参考文档中。这些 SDK 使用片段会显示在由 Mintlify 驱动的文档站点中的[交互式操作台](/zh/api-playground/overview)。

<Frame>
  <img src="https://mintcdn.com/omer-914cc1c6/fcMjNrr23zmS_VHA/images/speakeasy/mintlify-with-speakeasy-openapi.png?fit=max&auto=format&n=fcMjNrr23zmS_VHA&q=85&s=ac9cb2d3f3a67c08dcd8c5e199bc42dc" alt="包含 Speakeasy 代码片段的 Mintlify API 操作台。" width="2560" height="1440" data-path="images/speakeasy/mintlify-with-speakeasy-openapi.png" />
</Frame>

<div id="prerequisites">
  ## 先决条件
</div>

要将 Mintlify 与 Speakeasy 集成，您需要：

* 一个 [Mintlify 文档存储库](/zh/quickstart#creating-the-repository)。
* 一个由 Speakeasy 生成且已配置[自动化代码示例 URL](https://www.speakeasy.com/docs/code-samples/automated-code-sample-urls)的 SDK。

<div id="setting-up-the-integration">
  ## 设置集成
</div>

要将 Speakeasy 与 Mintlify 集成，您需要从注册表获取该 API 的合并规范公共 URL，并更新 `docs.json` 配置文件。

<div id="get-the-apis-combined-spec-public-url-from-the-registry">
  ### 从注册表获取该 API 的合并规范公共 URL
</div>

前往 [Speakeasy 控制台](https://app.speakeasy.com)，打开 **API Registry** 标签页。打开该 API 的 `*-with-code-samples` 条目。

<Frame>
  <img src="https://mintcdn.com/omer-914cc1c6/fcMjNrr23zmS_VHA/images/speakeasy/openapi-registry-and-combined-spec.png?fit=max&auto=format&n=fcMjNrr23zmS_VHA&q=85&s=180306a14dd7778b09264b6ad93e8d87" alt="Speakeasy API Registry 页面截图。API Registry 标签页以红色方框和数字 1 标注，API 的条目以红色方框和数字 2 标注。" width="2560" height="1440" data-path="images/speakeasy/openapi-registry-and-combined-spec.png" />
</Frame>

<Note>
  如果该条目未标记为 **Combined Spec**，请确保该 API 已配置[自动代码示例 URL](https://www.speakeasy.com/docs/code-samples/automated-code-sample-urls)。
</Note>

在该注册表条目的页面中，复制提供的公共 URL。

<Frame>
  <img src="https://mintcdn.com/omer-914cc1c6/fcMjNrr23zmS_VHA/images/speakeasy/copy-combined-spec-url.png?fit=max&auto=format&n=fcMjNrr23zmS_VHA&q=85&s=b183d321f0f2658f0f37ff31a0c805da" alt="显示合并规范注册表条目的截图，其中复制 URL 功能以红色方框强调。" width="2560" height="1440" data-path="images/speakeasy/copy-combined-spec-url.png" />
</Frame>

<div id="update-your-docsjson-configuration-file">
  ### 更新您的 `docs.json` 配置文件
</div>

将合并规范 URL 添加到 `docs.json` 文件中的 **Anchors** 或 **Tabs** 部分。

通过如下方式更新 `docs.json` 文件中的 `anchor` 字段，将合并规范 URL 添加到某个锚点：

```json docs.json theme={null}
{
  "anchors": [
    {
      "name": "API 参考",
      // !mark
      "openapi": "SPEAKEASY_COMBINED_SPEC_URL",
      "url": "api-reference",
      "icon": "square-terminal"
    }
  ]
}
```

在 `docs.json` 文件中按如下方式更新 `tab` 字段，将合并后的规范 URL 添加到标签页：

```json docs.json theme={null}
{
  "tabs": [
    {
      "name": "API 参考",
      "url": "api-reference",
      // !mark
      "openapi": "SPEAKEASY_COMBINED_SPEC_URL"
    }
  ]
}
```

由 Speakeasy 生成的代码片段现已可在你的 API 文档中查看，并可在演示环境中交互使用。
