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

# Connect Flowise to CometAPI

> Use this guide to connect Flowise to CometAPI by setting the base URL, API key, and model or provider options.

FlowiseAI is a low-code platform for building LLM applications visually. Use the native **ChatCometAPI** node to connect CometAPI to chatflows, Q\&A systems, and RAG workflows that call text chat models.

<Note>
  This guide covers text chat and RAG workflows. It does not cover image generation workflows.
</Note>

## Prerequisites

* A CometAPI account with an active API key - [get yours here](https://www.cometapi.com/console/token)
* A FlowiseAI account or self-hosted Flowise instance - [sign in to Flowise Cloud](https://cloud.flowiseai.com/chatflows)
* A current text model ID from the [CometAPI Models page](/overview/models)
* For RAG, a document source plus a Flowise-supported embeddings provider and vector store

## Configure ChatCometAPI

<Steps>
  <Step title="Get your CometAPI API key">
    Log in to the [CometAPI console](https://www.cometapi.com/console/token). Click **Add API Key** and copy your CometAPI API key.

    <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 dashboard showing the Add API Key button" 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 details with base URL" width="2434" height="1232" data-path="images/overview/810968_364193.png" />
    </Frame>
  </Step>

  <Step title="Add the ChatCometAPI node">
    1. In your FlowiseAI chatflow canvas, click **Add New**.

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_361945.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=f36fc7cc6d541af1acd95f6b8aea9b04" alt="FlowiseAI canvas with the Add New button" width="1874" height="960" data-path="images/integrations/810968_361945.png" />
    </Frame>

    2. Search for **cometapi** and select the **ChatCometAPI** node.

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_361946.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=0da9222351e5378eeeb928b1acf1e959" alt="Node search showing ChatCometAPI result" width="1880" height="910" data-path="images/integrations/810968_361946.png" />
    </Frame>

    3. Drag it onto the canvas.

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_361947.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=c727ab9ff734355a0f2d5de4ff479c97" alt="ChatCometAPI node placed on the canvas" width="1810" height="950" data-path="images/integrations/810968_361947.png" />
    </Frame>
  </Step>

  <Step title="Create the CometAPI credential">
    In the ChatCometAPI node, open **Connect Credential**, select **Create New**, paste your CometAPI API key, and save the credential.

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_361948.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=b64309fa10d20704751e433c3316cf82" alt="Credential dialog with API key entered" width="1820" height="900" data-path="images/integrations/810968_361948.png" />
    </Frame>
  </Step>

  <Step title="Set the CometAPI base path">
    Expand **Additional Parameters** on the ChatCometAPI node.

    If your Flowise build shows a **Base Path** field, set it to:

    ```text theme={null}
    https://api.cometapi.com/v1/
    ```

    If it exposes **Base Options** instead, add a `basePath` entry:

    ```json theme={null}
    {
      "basePath": "https://api.cometapi.com/v1/"
    }
    ```

    Set **Model Name** to the exact text model ID you want to call, for example `your-model-id`, and adjust **Temperature** only if your workflow needs more or less variation.
  </Step>
</Steps>

## Create a basic chatflow

<Steps>
  <Step title="Add a Prompt Template">
    Add a **Prompt Template** node and define the prompt your chatflow will send to the model.

    ```text theme={null}
    Question: {question}
    Answer clearly and concisely.
    ```

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_361949.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=201c0e040b56a7a5338ba34b5761cac1" alt="Prompt Template node with the example template" width="1238" height="850" data-path="images/integrations/810968_361949.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_361950.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=9a872c659549ba024457a015a5c75064" alt="Prompt Template node placed on canvas" width="511" height="805" data-path="images/integrations/810968_361950.png" />
    </Frame>
  </Step>

  <Step title="Add an LLM Chain">
    Add an **LLM Chain** node. Connect the **ChatCometAPI** node to the chain's **Language Model** input, then connect the **Prompt Template** node to the chain's **Prompt** input.

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_361951.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=a44d838bb2fc70911e0407b1ea2ed7f2" alt="LLM Chain node with Language Model and Prompt connected" width="514" height="724" data-path="images/integrations/810968_361951.png" />
    </Frame>
  </Step>

  <Step title="Save and test the flow">
    Save the chatflow, open the chat preview, and send a short test question. A healthy setup returns a normal text answer from the selected CometAPI model.

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_361954.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=73647ee6f0995ed8c36a9fd1a2e6fd97" alt="Complete chatflow with all three nodes connected" width="1466" height="789" data-path="images/integrations/810968_361954.png" />
    </Frame>
  </Step>
</Steps>

## Switch model IDs

To switch models, keep the same CometAPI credential and base path, then change only the ChatCometAPI model ID field.

Use exact model IDs from the [CometAPI Models page](/overview/models). Avoid copying display names, provider names, or extra spaces.

| Use case                  | Model ID value            |
| ------------------------- | ------------------------- |
| General chat model family | `your-chat-model-id`      |
| Reasoning model family    | `your-reasoning-model-id` |
| Coding model family       | `your-coding-model-id`    |

After changing the model ID, save the chatflow and run a short test prompt. If you maintain multiple production flows, duplicate the chatflow first and give each copy a name that reflects the model family.

## Configure retrieval-augmented generation

Flowise RAG has two parts: first prepare and upsert documents in **Document Stores**, then connect the prepared retriever to a chatflow. ChatCometAPI is the chat model that writes the final answer; the Document Store still needs a Flowise-supported embeddings provider and vector store.

<Steps>
  <Step title="Create and process a Document Store">
    In Flowise, open **Document Stores** and create a new store. Add a document loader, such as **File Loader**, **PDF Loader**, **Web Scraper**, or another loader that matches your source. Add a text splitter when the document is long enough to need chunking, then click **Process** to preview the generated chunks.
  </Step>

  <Step title="Configure embeddings and vector storage">
    Click **Upsert** or **Upsert All Chunks**. Select:

    * **Embeddings**: a Flowise embeddings node compatible with your data and vector store.
    * **Vector Store**: the vector database where Flowise should store document embeddings.
    * **Record Manager**: optional. Use it when you want repeat upserts to avoid duplicate records.

    Keep the embedding model dimension aligned with the vector store index dimension. After upsert finishes, use the Document Store's retrieval query test to confirm that relevant chunks are returned before building the chatflow.
  </Step>

  <Step title="Create the retrieval chatflow">
    In a chatflow, add a **Document Store (Vector)** or **Document Store Retriever** node and select the processed Document Store. Set **Top K** to the number of chunks you want Flowise to retrieve for each question.
  </Step>

  <Step title="Connect Conversational Retrieval QA Chain">
    Add **Conversational Retrieval QA Chain** and connect:

    * **Language Model** input from **ChatCometAPI**.
    * **Vector Store Retriever** input from the Document Store retriever.
    * **Memory** only if your chatflow needs conversation history.

    Enable **Return Source Documents** when you want the answer to include citations or retrieved source chunks. Save the flow and ask a question whose answer exists only in the uploaded document.
  </Step>
</Steps>

## Troubleshooting

<AccordionGroup>
  <Accordion title="The ChatCometAPI node is missing">
    Confirm that your Flowise version includes the **ChatCometAPI** chat model integration. In older or customized Flowise deployments, update Flowise or check whether the integration has been disabled by the administrator.
  </Accordion>

  <Accordion title="Requests fail because the base path is wrong">
    Set the CometAPI base path to `https://api.cometapi.com/v1/`. In some Flowise builds this is a **Base Path** field. In others, add `basePath` inside **Base Options**.

    Do not use `https://api.cometapi.com` for the ChatCometAPI chatflow, because the chat node calls OpenAI-compatible `/chat/completions` routes under `/v1`.
  </Accordion>

  <Accordion title="The API key or credential fails">
    Recopy the key from the [CometAPI console](https://www.cometapi.com/console/token), create a fresh Flowise credential, and make sure the chatflow uses that credential. If the same key works in direct API calls but fails in Flowise, check that Flowise is not still using an older credential attached to the node.
  </Accordion>

  <Accordion title="The model ID fails">
    Replace the model ID value in the ChatCometAPI node with an exact current text model ID from the [CometAPI Models page](/overview/models). The value should not include quotes, a provider prefix, a display label, or trailing spaces.
  </Accordion>

  <Accordion title="The workflow tries to generate images">
    ChatCometAPI is a chat model node for text workflows. Use it for chat, chains, agents, and RAG answer generation. Do not use this Flowise setup for image generation nodes or image-only workflows.
  </Accordion>

  <Accordion title="RAG returns no sources or weak answers">
    First test the Document Store retrieval query before testing the full chatflow. If retrieval is weak, tune the text splitter, chunk size, chunk overlap, metadata filters, and **Top K**. If citations are missing, enable **Return Source Documents** on **Conversational Retrieval QA Chain**.
  </Accordion>

  <Accordion title="Upsert or vector store configuration fails">
    Check that the embedding provider, vector store, and vector dimensions match. Flowise Cloud vector stores often require their own reachable service URL and credentials; a local-only vector store URL such as `localhost` will not be reachable from Flowise Cloud. Record Manager is optional, but if you enable it, configure its database connection separately.
  </Accordion>

  <Accordion title="The request times out or is rate limited">
    Lower retrieval **Top K**, reduce prompt size, use smaller chunks, or choose a faster model ID for the ChatCometAPI node. For rate limits, wait and retry with lower concurrency, then check account usage and limits in the CometAPI console.
  </Accordion>
</AccordionGroup>
