> ## 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.

# 使用 LibreChat 搭配 CometAPI

> 使用本指南透過設定 base URL、API key，以及模型或供應商選項來配置 LibreChat 與 CometAPI。

[LibreChat](https://www.librechat.ai/) 是一個支援多個 AI 供應商的開源聊天 UI。你可以將它配置為 OpenAI 相容端點來連接 CometAPI。

## 先決條件

* LibreChat — [cloud](https://librechat-librechat.hf.space/)、[self-hosted](https://github.com/danny-avila/LibreChat) 或本機
* 擁有一個啟用中 API key 的 [CometAPI](https://www.cometapi.com) 帳戶

## 設定

<Steps>
  <Step title="取得你的 CometAPI API key">
    登入 [CometAPI 控制台](https://www.cometapi.com/console)。點擊 **Add API 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 控制台 — Add 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 端點">
    在 LibreChat 中，前往 **Settings** → **OpenAI**。在 **URL** 欄位輸入 `https://api.cometapi.com`，將你的金鑰貼到 **API Key**，然後點擊 **Save**。

    <Frame>
      <img src="https://mintcdn.com/cometapi/mA1ovj6s0e3RM42l/images/integrations/810968_351621.png?fit=max&auto=format&n=mA1ovj6s0e3RM42l&q=85&s=5d45cd43d93da40b2a2e0242aae24b04" alt="LibreChat 設定 — OpenAI URL 與金鑰欄位" width="1024" height="496" data-path="images/integrations/810968_351621.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/cometapi/mA1ovj6s0e3RM42l/images/integrations/810968_351622.png?fit=max&auto=format&n=mA1ovj6s0e3RM42l&q=85&s=618a09316772d953db084f36234fd8d5" alt="設定 CometAPI 後的 LibreChat 聊天介面" width="1265" height="607" data-path="images/integrations/810968_351622.png" />
    </Frame>
  </Step>

  <Step title="測試連線">
    在 LibreChat 中開始一段對話。若成功收到回覆，即表示整合運作正常。
  </Step>
</Steps>

<script type="application/ld+json">
  {`
    {
    "@context": "https://schema.org",
    "@graph": [
      {
        "@type": "HowTo",
        "@id": "https://apidoc.cometapi.com/integrations/librechat#howto",
        "name": "使用 LibreChat 搭配 CometAPI",
        "description": "使用本指南透過設定 base URL、API key，以及模型或供應商選項來配置 LibreChat 與 CometAPI。",
        "step": [
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/librechat#step-1",
            "position": 1,
            "name": "取得你的 CometAPI API key",
            "text": "建立或開啟你的 CometAPI 帳戶，然後從控制台複製一個啟用中的 API key。"
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/librechat#step-2",
            "position": 2,
            "name": "設定 OpenAI 端點",
            "text": "完成「使用 LibreChat 搭配 CometAPI」指南中的「設定 OpenAI 端點」步驟。"
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/librechat#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": "使用 LibreChat 搭配 CometAPI",
            "item": "https://apidoc.cometapi.com/integrations/librechat"
          }
        ]
      }
    ]
    }
    `}
</script>
