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

# Sử dụng NextChat với CometAPI

> Sử dụng hướng dẫn này để cấu hình NextChat với CometAPI bằng cách thiết lập base URL, API key và các tùy chọn model hoặc provider.

[NextChat](https://nextchat.club/) (trước đây là ChatGPT Next Web) là một ứng dụng chat AI có thể triển khai chỉ với một cú nhấp. Kết nối ứng dụng này với CometAPI bằng các thiết lập API tương thích OpenAI.

## Điều kiện tiên quyết

* [NextChat](https://nextchat.club/) (web, desktop hoặc self-hosted)
* Tài khoản [CometAPI](https://www.cometapi.com) có API key đang hoạt động

## Thiết lập

<Steps>
  <Step title="Lấy CometAPI API key của bạn">
    Đăng nhập vào [bảng điều khiển CometAPI](https://www.cometapi.com/console). Nhấp vào **Add API Key** và sao chép key cùng base URL của bạn (`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="Bảng điều khiển 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 và base URL" width="2434" height="1232" data-path="images/overview/810968_364193.png" />
    </Frame>
  </Step>

  <Step title="Cấu hình API endpoint">
    Mở **Settings** → **Custom Interface** trong NextChat. Chọn **OpenAI API**, nhập `https://api.cometapi.com` vào trường **Interface Address**, dán key của bạn vào **API Key**, rồi nhấp **Save**.

    <Frame>
      <img src="https://mintcdn.com/cometapi/mA1ovj6s0e3RM42l/images/integrations/810968_351592.png?fit=max&auto=format&n=mA1ovj6s0e3RM42l&q=85&s=9e22a16aa7ddec68fcbbecb8ef28c2e6" alt="Cài đặt NextChat — custom interface và các tùy chọn OpenAI API" width="1919" height="930" data-path="images/integrations/810968_351592.png" />
    </Frame>
  </Step>

  <Step title="Kiểm tra kết nối">
    Gửi một tin nhắn thử nghiệm. Nếu nhận được phản hồi thành công, nghĩa là tích hợp đã hoạt động.
  </Step>
</Steps>

<Tip>
  Để thêm model tùy chỉnh, vào **Settings** → **Custom Model Names** và nhập các mục theo định dạng sau:

  ```
  +your-model-id@OpenAI
  ```

  Định dạng: `+` thêm một model, tên trước `@` là model ID, và `@OpenAI` nghĩa là model sử dụng định dạng OpenAI. Phân tách nhiều mục bằng dấu phẩy.
</Tip>

<script type="application/ld+json">
  {`
    {
    "@context": "https://schema.org",
    "@graph": [
      {
        "@type": "HowTo",
        "@id": "https://apidoc.cometapi.com/integrations/next-chat#howto",
        "name": "Sử dụng NextChat với CometAPI",
        "description": "Sử dụng hướng dẫn này để cấu hình NextChat với CometAPI bằng cách thiết lập base URL, API key và các tùy chọn model hoặc provider.",
        "step": [
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/next-chat#step-1",
            "position": 1,
            "name": "Lấy CometAPI API key của bạn",
            "text": "Tạo hoặc mở tài khoản CometAPI của bạn, sau đó sao chép một API key đang hoạt động từ bảng điều khiển."
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/next-chat#step-2",
            "position": 2,
            "name": "Cấu hình API endpoint",
            "text": "Hoàn thành bước Cấu hình API endpoint trong hướng dẫn Sử dụng NextChat với CometAPI."
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/next-chat#step-3",
            "position": 3,
            "name": "Kiểm tra kết nối",
            "text": "Chọn một model ID hiện có từ trang CometAPI Models, sau đó gửi một yêu cầu thử nghiệm từ phần tích hợp."
          }
        ]
      },
      {
        "@type": "BreadcrumbList",
        "itemListElement": [
          {
            "@type": "ListItem",
            "position": 1,
            "name": "Tài liệu CometAPI",
            "item": "https://apidoc.cometapi.com/"
          },
          {
            "@type": "ListItem",
            "position": 2,
            "name": "Tích hợp",
            "item": "https://apidoc.cometapi.com/integrations"
          },
          {
            "@type": "ListItem",
            "position": 3,
            "name": "Sử dụng NextChat với CometAPI",
            "item": "https://apidoc.cometapi.com/integrations/next-chat"
          }
        ]
      }
    ]
    }
    `}
</script>
