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

# Run n8n locally with CometAPI

> Use this guide to run n8n locally with CometAPI by configuring local deployment settings, credentials, and model access.

Deploy n8n on your own machine and connect it to CometAPI via the community node to run automated AI workflows locally.

## Prerequisites

* Linux (Ubuntu/Debian/CentOS, etc.) or macOS
* 2 GB+ RAM, 10 GB+ free disk space
* Shell access with reach to the public npm registry
* Node.js 18.x or 20.x LTS (see Step 1)
* A CometAPI account with an active API key — [get yours here](https://www.cometapi.com/console/token)

<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="Install Node.js via nvm">
    n8n 1.x requires Node.js 18.x or 20.x. The recommended approach is [nvm](https://github.com/nvm-sh/nvm):

    ```bash theme={null}
    # Install nvm
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

    # Reload your shell profile
    source ~/.bashrc   # or ~/.zshrc on macOS

    # Install and activate the LTS version
    nvm install --lts
    nvm use --lts

    # Verify
    node -v
    npm -v
    ```

    <Note>
      If you see `n8n: command not found` later, restart the terminal or ensure the nvm-managed npm global bin directory is on your `PATH`.
    </Note>
  </Step>

  <Step title="Install and start n8n">
    ```bash theme={null}
    npm install -g n8n
    n8n -v       # verify the installed version
    n8n start    # runs on http://localhost:5678/
    ```

    If port 5678 is already in use:

    ```bash theme={null}
    export N8N_PORT=5679
    n8n start
    ```

    To keep n8n running after closing the terminal:

    ```bash theme={null}
    npm install -g pm2
    pm2 start "n8n" --name n8n
    pm2 save
    pm2 status
    ```

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_360463.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=80fe6068a8af4ec3b3503ff41d378a17" alt="Terminal showing n8n starting successfully" width="715" height="451" data-path="images/integrations/810968_360463.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_360464.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=77cadfd218dbe0fef19fe701550ea363" alt="n8n startup logs in the terminal" width="759" height="460" data-path="images/integrations/810968_360464.png" />
    </Frame>
  </Step>

  <Step title="Create your owner account">
    Open [http://localhost:5678/](http://localhost:5678/) in your browser. On first run, the setup wizard asks you to create an **Owner** account (email + password). Complete this and sign in.

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_360465.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=8fdd100138f2bf01bbf834d9db1ea29e" alt="n8n first-run setup wizard asking for Owner account details" width="1249" height="970" data-path="images/integrations/810968_360465.png" />
    </Frame>
  </Step>

  <Step title="Install the CometAPI community node">
    1. Go to **Settings** (bottom-left) → **Community nodes**
    2. Click **Install a community node**
    3. Enter the package name: `@cometapi-dev/n8n-nodes-cometapi`
    4. Check the risk acknowledgment box and click **Install**

    After installation you can search for **CometAPI** in the node panel.

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_360467.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=1c107922e16332157d278bf834b3e32a" alt="n8n Settings panel showing the Community nodes section" width="1265" height="975" data-path="images/integrations/810968_360467.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_360468.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=98c05d77cb6adf333052b4d5014fc506" alt="Install dialog with the CometAPI package name entered" width="1261" height="965" data-path="images/integrations/810968_360468.png" />
    </Frame>

    <Note>
      If the Community Nodes section is missing: make sure you are signed in as the **Owner** account, and check **Settings → Security** to confirm community node installation is enabled.
    </Note>
  </Step>

  <Step title="Create a workflow and configure credentials">
    1. Click **+ New** at the top to create a workflow.
    2. Click **+** on the canvas and search for **CometAPI** to add the node.

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_360469.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=b47e1304ec3165720dd3ef37e1429485" alt="n8n workflow canvas with the CometAPI node search open" width="1235" height="899" data-path="images/integrations/810968_360469.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_360472.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=b765a2d8024f4c5d36305916c440d02f" alt="CometAPI node added to the n8n canvas" width="1724" height="854" data-path="images/integrations/810968_360472.png" />
    </Frame>

    3. Add a **Manual Trigger** node and connect it to the CometAPI node.
    4. In the CometAPI node, under **Credential to connect with**, choose **Create new**. Paste your CometAPI API key into **CometAPI Key** and click **Save**. The Base URL defaults to `https://api.cometapi.com` and typically needs no change.

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_360474.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=deee1c999cbfb2c432daaa53904d6b38" alt="CometAPI credential dialog with API key entered" width="1906" height="608" data-path="images/integrations/810968_360474.png" />
    </Frame>

    5. Configure the node:

    * **Model**: enter the current model ID you want to use
    * **Messages**: set Role to `user`, Content to your test prompt (e.g. `Hello`)
    * Optional: add a `system` message, set **Max Tokens**, **Temperature**, etc.

    6. Click **Execute step** to run the node. The **Output** panel shows the JSON response.

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_360471.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=6953b97533f02e4f50cb1f0490ff057d" alt="n8n output panel showing a successful CometAPI JSON response" width="2092" height="1762" data-path="images/integrations/810968_360471.png" />
    </Frame>
  </Step>
</Steps>

<AccordionGroup>
  <Accordion title="Troubleshooting">
    * **`node-gyp` or native build errors** — install build tools: `sudo apt install build-essential python3` (Debian/Ubuntu) or Xcode Command Line Tools (macOS).
    * **npm permission errors (EACCES)** — use nvm for a user-level Node.js install; no `sudo` needed.
    * **Port conflict (`localhost:5678` unavailable)** — set `N8N_PORT=5679` (or another free port) before running `n8n start`.
    * **Community Nodes section missing** — sign in as the **Owner** account and check **Settings → Security**.
    * **npm install fails on corporate networks** — configure a proxy: `npm config set proxy http://user:pass@host:port`
    * **CometAPI node returns 401/403** — verify your API key and that the model is accessible on your CometAPI plan.
    * **Empty responses or token limit errors** — increase **Max Tokens**; adjust **Temperature** and **Top P** as needed.
    * **n8n stops when terminal closes** — use pm2: `pm2 start "n8n" --name n8n && pm2 save`.
  </Accordion>
</AccordionGroup>
