ChatHub/docs

Search documentation

SUGGESTED FOR YOU135 results

Search published articles · By section

Connect an AI provider

Set up OpenAI, DeepSeek or a custom API in ChatHub: enter a key, select a model, enable AI, save and test with illustrated steps.

Before you start#

This guide helps admins connect the shared AI provider used by ChatHub’s AI Agent features, including reply suggestions, conversation summaries and automated replies. You will select a provider, enter an API key, choose a model, save and check the connection.

  1. 1

    Use a ChatHub account allowed to access and save Settings.

  2. 2

    Prepare an API key for your chosen provider and confirm the API account can use your intended model. Usage is billed directly by the provider.

  3. 3

    For a custom API, also prepare the base API URL and model ID supplied by that service.

This is shared system configuration. Changing the provider, model or key affects features using it. Keep API keys out of URLs, screenshots and support messages.

1. Open AI provider settings#

  1. 1

    Open Quản trị → Cài đặt (Administration → Settings) in ChatHub.

  2. 2

    Choose Nhà cung cấp AI (AI provider) on the left, or open /settings?tab=ai on your ChatHub domain.

  3. 3

    Find the AI provider panel at the top. It contains Provider, API key, Model, Enable AI features, and the Save and Test connection buttons.

Figure 1. Select AI provider on the left and complete the form on the right. Save before testing. The pictured system already has a stored key; an empty New API key field is normal.

2. Choose a provider and obtain an API key#

  1. 1

    OpenAI: select OpenAI in Nhà cung cấp (Provider). Follow the OpenAI link below Model to its key management page.

  2. 2

    DeepSeek: select DeepSeek and follow the DeepSeek link below Model to its key management page.

  3. 3

    API tùy chỉnh (Custom API): choose this for a service or gateway supporting the OpenAI-compatible API format. Obtain the key, base URL and model ID from that service.

OpenAI API key page linked by ChatHub

DeepSeek API key page linked by ChatHub

Figure 2. Selecting OpenAI displays its key management link. The faded model name is this ChatHub version’s default suggestion. This is an unsaved selection, not a verified OpenAI connection.

Sign in to your account on the provider’s management page and create or obtain an API key using its instructions. Copy it for the ChatHub form. This guide demonstrates ChatHub configuration; it does not create keys or change provider billing.

When switching from DeepSeek to OpenAI or to a custom API, enter the correct key for the new provider. Changing the Provider selection alone does not replace the stored key.

3. Enter the key, model and enable AI#

  1. 1

    API key: paste the selected provider’s key for the first setup. If a key is already stored, the field is labeled API key mới (New API key).

  2. 2

    Model: enter the exact model ID your API account can use. Select a suggestion or type directly. Leaving it blank uses the provider default in your installed ChatHub version.

  3. 3

    Check Model again after changing Provider: ChatHub clears the previous selection and shows the newly selected provider’s default suggestion.

  4. 4

    Turn on Bật tính năng AI (Enable AI features) to allow AI calls. To stop AI calls, turn it off and save; the key remains stored.

Leaving New API key blank keeps the stored key; it does not delete it. Only leave it blank when continuing to use that key. Enter a matching new key when replacing credentials or switching providers, then save.

ChatHub encrypts the stored key and never sends it back to the browser. Configured only means a key exists; it does not confirm that the key is valid, the model works or AI is enabled.

4. Configure a custom API#

  1. 1

    Select API tùy chỉnh (Custom API) to reveal URL API.

  2. 2

    Enter the service’s base URL, including the API version when required. https://api.example.com/v1 is an illustrative format; replace it with your actual service URL.

  3. 3

    Do not append /chat/completions or /models. Do not include the API key, login credentials, query parameters (?...) or fragments (#...) in the URL. Put the key in its separate field.

  4. 4

    Enter the custom service’s API key and Model ID. Do not assume the suggested model exists on every gateway.

  5. 5

    Enable AI, then save and test as described below.

Figure 3. URL API appears between the Provider/API key row and Model. The faded example.com URL is only a format example, not a service to use.

The URL must be valid HTTP or HTTPS. The service must support the endpoints ChatHub uses: /models for connection checks and /chat/completions for AI requests. Use the base URL documented by your provider.

5. Save, then test the connection#

  1. 1

    Review Provider, API key, Model, the AI switch and the custom URL if applicable.

  2. 2

    Select Lưu (Save) and wait for “Đã lưu cấu hình AI.” (AI configuration saved).

  3. 3

    Select Kiểm tra kết nối (Test connection). The button is disabled until a key has been stored.

  4. 4

    Read the result: “Gọi được …, model …, mất …ms.” means the provider responded. Check that the displayed provider and model match what you saved.

Test connection uses the configuration stored on the server, not unsaved form edits. If you change the key, model, provider or URL without saving, you are testing the old configuration.

If the result also says the model is not in the provider’s returned list, check its ID and account access, correct it, save and retest. Some services do not list all models, so also verify with an actual AI feature.

The test requests a model list rather than sending a conversation for a generated reply. Success does not guarantee every generation feature will work. Next, try an AI feature in a test conversation containing material appropriate to send to your provider.

6. Troubleshooting and next steps#

  1. 1

    “Cần nhập API key.” (API key required): no key exists for initial setup. Enter a key and save.

  2. 2

    “Cần nhập URL API HTTP hoặc HTTPS hợp lệ.” (Valid HTTP/HTTPS API URL required): check the custom API URL, remove query parameters, fragments and login credentials, and use the correct base URL.

  3. 3

    Not configured despite a stored key: verify that a provider is selected, AI is enabled and the settings were saved. Also check the URL for a custom API.

  4. 4

    Provider rejected the request: read the displayed status and error details, then check credentials, permissions or your API account as indicated.

  5. 5

    Cannot connect: check the API address and network access from the server running ChatHub. Opening the management website on your computer does not prove the ChatHub server can reach the API.

  6. 6

    Connection test passes but a feature does not run: check the model and that feature’s own configuration. Connecting a provider is a prerequisite, not a replacement for bot or automation setup.

Tài liệu huấn luyện AI (AI training documents) below the panel is for your shop’s question-and-answer content, not API credentials. You can configure knowledge content and AI features after connecting the provider.

Screenshots show the Vietnamese ChatHub interface and contain no actual API key. OpenAI and Custom API selections were previewed without saving. Save messages, connection checks and errors were verified against application source; no live check was performed using the stored key.
Connect an AI providerBack to top
© 2026 ChatHub DocsPowered by CMSNT LTDA guide to using ChatHub.