> ## Documentation Index
> Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 将 Open WebUI 与 CometAPI 搭配使用

> 使用本指南通过设置 base URL、API key 以及模型或提供商选项，将 Open WebUI 配置为使用 CometAPI。

[Open WebUI](https://openwebui.com/) 是一个用于 AI 模型的自托管 Web 界面。将其配置为使用 CometAPI 作为外部 OpenAI 兼容连接。

## 先决条件

* 正在运行的 [Open WebUI](https://openwebui.com/)（自托管或通过位于 [open.zetatechs.online](https://openwebui.com/) 的演示）
* 一个拥有有效 API key 的 [CometAPI](https://www.cometapi.com) 账户

## 设置

<Steps>
  <Step title="获取你的 CometAPI API key">
    登录 [CometAPI 控制台](https://www.cometapi.com/console)。点击 **Add API Key**，然后复制你的 key 和 base URL（`https://api.cometapi.com`）。

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/overview/810968_364191.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=aef81a83f29f8eb16655ed4060425f50" alt="CometAPI 控制台——添加 API Key" width="3824" height="1892" data-path="images/overview/810968_364191.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/cometapi/HhtmQffktazbxUvS/images/overview/810968_364193.png?fit=max&auto=format&n=HhtmQffktazbxUvS&q=85&s=d893f659267150d0faf45f99eb5dffc1" alt="CometAPI API key 和 base URL" width="2434" height="1232" data-path="images/overview/810968_364193.png" />
    </Frame>
  </Step>

  <Step title="添加外部 OpenAI 连接">
    在 Open WebUI 中，前往 **Admin Panel** → **Settings** → **External Connections**。启用 **External Link OpenAI API**，在 **API Address** 字段中输入 `https://api.cometapi.com/v1`，将你的 key 粘贴到 **Key** 字段中，然后点击 **Save**。

    <Frame>
      <img src="https://mintcdn.com/cometapi/mA1ovj6s0e3RM42l/images/integrations/810968_351624.png?fit=max&auto=format&n=mA1ovj6s0e3RM42l&q=85&s=4878931888f1deeda5365545bc35a01a" alt="已输入 CometAPI URL 的 Open WebUI 外部连接设置" width="1265" height="346" data-path="images/integrations/810968_351624.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/cometapi/mA1ovj6s0e3RM42l/images/integrations/810968_351625.png?fit=max&auto=format&n=mA1ovj6s0e3RM42l&q=85&s=40e7df7cb60b43a4b585ededa36847f2" alt="已保存设置且 CometAPI 连接处于激活状态的 Open WebUI" width="1265" height="408" data-path="images/integrations/810968_351625.png" />
    </Frame>
  </Step>

  <Step title="测试连接">
    开始一段聊天并发送一条测试消息。成功收到回复即表示集成工作正常。
  </Step>
</Steps>

<script type="application/ld+json">
  {`
    {
    "@context": "https://schema.org",
    "@graph": [
      {
        "@type": "HowTo",
        "@id": "https://apidoc.cometapi.com/integrations/open-webui#howto",
        "name": "将 Open WebUI 与 CometAPI 搭配使用",
        "description": "使用本指南通过设置 base URL、API key 以及模型或提供商选项，将 Open WebUI 配置为使用 CometAPI。",
        "step": [
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/open-webui#step-1",
            "position": 1,
            "name": "获取你的 CometAPI API key",
            "text": "创建或打开你的 CometAPI 账户，然后从控制台复制一个有效的 API key。"
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/open-webui#step-2",
            "position": 2,
            "name": "添加外部 OpenAI 连接",
            "text": "完成“将 Open WebUI 与 CometAPI 搭配使用”指南中的“添加外部 OpenAI 连接”步骤。"
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/open-webui#step-3",
            "position": 3,
            "name": "测试连接",
            "text": "从 CometAPI Models 页面选择一个当前可用的 model ID，然后从该集成发送测试请求。"
          }
        ]
      },
      {
        "@type": "BreadcrumbList",
        "itemListElement": [
          {
            "@type": "ListItem",
            "position": 1,
            "name": "CometAPI 文档",
            "item": "https://apidoc.cometapi.com/"
          },
          {
            "@type": "ListItem",
            "position": 2,
            "name": "集成",
            "item": "https://apidoc.cometapi.com/integrations"
          },
          {
            "@type": "ListItem",
            "position": 3,
            "name": "将 Open WebUI 与 CometAPI 搭配使用",
            "item": "https://apidoc.cometapi.com/integrations/open-webui"
          }
        ]
      }
    ]
    }
    `}
</script>
