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

# Use Hermes Agent with CometAPI

> Use this guide to connect Hermes Agent to CometAPI through OpenAI-compatible chat or Anthropic Messages settings.

Use [CometAPI](https://www.cometapi.com) as the model provider for [Hermes Agent](https://hermes-agent.nousresearch.com/docs/). Hermes supports two CometAPI paths in this guide: a general OpenAI-compatible endpoint for most text models and a Claude route through Anthropic Messages.

## Prerequisites

* Git
* A CometAPI account with an active API key
* A terminal on macOS, Linux, or WSL2

## Installation

<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 the base URL shown" width="2434" height="1232" data-path="images/overview/810968_364193.png" />
    </Frame>
  </Step>

  <Step title="Install Hermes Agent">
    The following command runs the official installer:

    ```bash theme={null}
    curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash
    ```

    If the current shell does not see the `hermes` command yet, reload the shell configuration:

    ```bash theme={null}
    source ~/.zshrc
    # or
    source ~/.bashrc
    ```

    <Note>
      Hermes stores config in `~/.hermes/`, links the `hermes` command in `~/.local/bin`, and may add `~/.local/bin` to your shell PATH.
    </Note>
  </Step>
</Steps>

## Configuration

Choose the CometAPI route that matches the model family:

| Model family                  | Hermes configuration                                                                       | CometAPI route              |
| ----------------------------- | ------------------------------------------------------------------------------------------ | --------------------------- |
| OpenAI-compatible text models | `model.provider: custom` with `base_url: https://api.cometapi.com/v1`                      | `/v1/chat/completions`      |
| Claude models                 | Named provider with `transport: anthropic_messages`                                        | `/v1/messages`              |
| Gemini models in Hermes       | Use the OpenAI-compatible configuration                                                    | `/v1/chat/completions`      |
| Direct Gemini API calls       | Use the [Gemini `generateContent` API](/api/text/gemini-generating-content) outside Hermes | `/v1beta` `generateContent` |

<Warning>
  Do not configure Hermes with `https://api.cometapi.com/v1beta` as a custom Gemini-native provider. Use the OpenAI-compatible Hermes configuration for Gemini models. For direct Gemini API calls, use the [Gemini `generateContent` API](/api/text/gemini-generating-content).
</Warning>

<Steps>
  <Step title="Store your CometAPI key">
    Open `~/.hermes/.env` and add the following values:

    ```dotenv theme={null}
    COMETAPI_KEY=<COMETAPI_KEY>
    OPENAI_API_KEY=<COMETAPI_KEY>
    ```

    `COMETAPI_KEY` is used by the named Claude provider. `OPENAI_API_KEY` keeps Hermes's custom OpenAI-compatible endpoint fallback working.
  </Step>

  <Step title="Configure the OpenAI-compatible route">
    Use this route for most CometAPI text models, including Gemini models used from Hermes. Open `~/.hermes/config.yaml` and make sure the `model` section looks like this:

    ```yaml theme={null}
    model:
      provider: custom
      default: your-model-id
      base_url: https://api.cometapi.com/v1
    ```

    Replace `your-model-id` with a current text model ID from the [CometAPI Models page](https://www.cometapi.com/models/).

    <Note>
      Keep the API key in `~/.hermes/.env`. Do not hardcode secrets in `config.yaml`.
    </Note>

    <Note>
      This setup configures the main chat model. Hermes can use separate auxiliary models for tasks such as vision or web extraction.
    </Note>
  </Step>

  <Step title="Configure the Claude Messages route">
    Use this route when you want Hermes to call Claude models through Anthropic Messages. Open `~/.hermes/config.yaml` and use a named provider:

    ```yaml theme={null}
    model:
      provider: cometapi-claude
      default: your-claude-model-id

    providers:
      cometapi-claude:
        base_url: https://api.cometapi.com
        key_env: COMETAPI_KEY
        transport: anthropic_messages
        default_model: your-claude-model-id
    ```

    Replace `your-claude-model-id` with a current Claude model ID from the [CometAPI Models page](https://www.cometapi.com/models/).

    <Note>
      Keep `base_url` at `https://api.cometapi.com` for this route. Hermes uses the Anthropic Messages transport from the named provider.
    </Note>
  </Step>
</Steps>

## Verification

<Steps>
  <Step title="Check the configuration">
    The following command confirms that Hermes can read the config and the API key:

    ```bash theme={null}
    hermes config check
    ```

    If `hermes config check` reports missing options after an update, run `hermes config migrate` and check again.
  </Step>

  <Step title="Run a real chat test">
    The following command sends a real request through CometAPI:

    ```bash theme={null}
    hermes chat -Q --ignore-rules --max-turns 1 -q "Reply with CONNECTED only."
    ```

    A successful setup returns `CONNECTED` and no auth or endpoint errors. When the Claude Messages configuration is active, this confirms that Hermes can use the `anthropic_messages` transport through CometAPI.
  </Step>
</Steps>

## Optional configuration

<AccordionGroup>
  <Accordion title="Clean reinstall (optional)">
    If you are replacing an older Hermes install, use the built-in uninstaller first:

    ```bash theme={null}
    hermes uninstall
    ```

    In the uninstaller, choose **Full uninstall** to remove the CLI, PATH entry, and `~/.hermes/` data. Then rerun the install step and continue with the same CometAPI configuration.
  </Accordion>

  <Accordion title="Use hermes model instead (optional)">
    If you prefer the interactive flow for the OpenAI-compatible route, run `hermes model` and choose **Custom endpoint**.

    Then enter the following values:

    * Base URL: `https://api.cometapi.com/v1`
    * API key: your CometAPI API key
    * Model: a current CometAPI text model ID

    This flow writes the OpenAI-compatible provider settings into `config.yaml`. For Claude Messages, edit `config.yaml` directly so the named provider keeps `transport: anthropic_messages`.
  </Accordion>
</AccordionGroup>

<script type="application/ld+json">
  {`
    {
    "@context": "https://schema.org",
    "@graph": [
      {
        "@type": "HowTo",
        "@id": "https://apidoc.cometapi.com/integrations/hermes-agent#howto",
        "name": "Use Hermes Agent with CometAPI",
        "description": "Use this guide to connect Hermes Agent to CometAPI through OpenAI-compatible chat or Anthropic Messages settings.",
        "step": [
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/hermes-agent#step-1",
            "position": 1,
            "name": "Get your CometAPI API key",
            "text": "Create or open your CometAPI account, then copy an active API key from the dashboard."
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/hermes-agent#step-2",
            "position": 2,
            "name": "Install Hermes Agent",
            "text": "Complete the Install Hermes Agent step in the Use Hermes Agent with CometAPI guide."
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/hermes-agent#step-3",
            "position": 3,
            "name": "Store your CometAPI key",
            "text": "Complete the Store your CometAPI key step in the Use Hermes Agent with CometAPI guide."
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/hermes-agent#step-4",
            "position": 4,
            "name": "Configure the OpenAI-compatible route",
            "text": "Complete the Configure the OpenAI-compatible route step in the Use Hermes Agent with CometAPI guide."
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/hermes-agent#step-5",
            "position": 5,
            "name": "Configure the Claude Messages route",
            "text": "Complete the Configure the Claude Messages route step in the Use Hermes Agent with CometAPI guide."
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/hermes-agent#step-6",
            "position": 6,
            "name": "Check the configuration",
            "text": "Complete the Check the configuration step in the Use Hermes Agent with CometAPI guide."
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/hermes-agent#step-7",
            "position": 7,
            "name": "Run a real chat test",
            "text": "Complete the Run a real chat test step in the Use Hermes Agent with CometAPI guide."
          }
        ]
      },
      {
        "@type": "BreadcrumbList",
        "itemListElement": [
          {
            "@type": "ListItem",
            "position": 1,
            "name": "CometAPI Docs",
            "item": "https://apidoc.cometapi.com/"
          },
          {
            "@type": "ListItem",
            "position": 2,
            "name": "Integrations",
            "item": "https://apidoc.cometapi.com/integrations"
          },
          {
            "@type": "ListItem",
            "position": 3,
            "name": "Use Hermes Agent with CometAPI",
            "item": "https://apidoc.cometapi.com/integrations/hermes-agent"
          }
        ]
      }
    ]
    }
    `}
</script>
