> For the complete documentation index, see [llms.txt](https://thegrid.ai/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://thegrid.ai/docs/integrations-and-best-practices/integrations/hermes-agent.md).

# Hermes Agent Integration with The Grid | Provider Setup

Connect Hermes Agent to The Grid through the native Anthropic Messages API. Add your API key, configure one provider block, and start Hermes.

Hermes Agent supports the Anthropic Messages format natively. Point it at The Grid's Messages API beta endpoint and use your Grid consumption key—no client patch or redirect handling is required.

## Prerequisites

* [Hermes Agent](https://github.com/NousResearch/hermes-agent) installed.
* A Grid account at [app.thegrid.ai](https://app.thegrid.ai) with credits.
* A Grid consumption API key from **Settings → API Keys → Create Consumption Key**.

## Setup

### 1. Save your Grid key

```bash
hermes config set THEGRID_API_KEY your-consumption-api-key
```

Hermes stores API keys in `~/.hermes/.env`.

### 2. Configure The Grid in `~/.hermes/config.yaml`

Add The Grid as the default and declare all three Agent instruments:

```yaml
model:
  default: agent-prime
  provider: custom
  base_url: https://messages-beta.api.thegrid.ai
  api_key: ${THEGRID_API_KEY}
  api_mode: anthropic_messages
  context_length: 196608

custom_providers:
  - name: thegrid
    base_url: https://messages-beta.api.thegrid.ai
    key_env: THEGRID_API_KEY
    api_mode: anthropic_messages
    models:
      agent-standard:
        context_length: 128000
      agent-prime:
        context_length: 196608
      agent-max:
        context_length: 1000000
```

`api_mode: anthropic_messages` tells Hermes to use its native Anthropic Messages transport. Set `base_url` to the host root as shown; Hermes adds `/v1/messages`.

### 3. Start Hermes

```bash
hermes chat
```

## Optional: keep The Grid alongside other providers

To switch to The Grid without replacing your default provider, keep the `custom_providers:` block from Step 2 and leave your existing top-level `model:` block unchanged.

Then switch inside Hermes based on the task:

```
/model custom:thegrid:agent-standard  # fast repetitive tool calls and triage
/model custom:thegrid:agent-prime     # everyday multi-step work
/model custom:thegrid:agent-max       # long-running, high-stakes, or deep tool chains
```

See the [current instruments list](/docs/instrument-specifications/current-instruments.md) for current specifications.

## Verification

Ask Hermes to complete a task that uses a tool, such as:

```
List the files in the current directory and summarize the project.
```

A coherent response with a successful tool call confirms the integration works end to end.

{% hint style="info" %}
The Anthropic Messages endpoint is currently in beta. Core messaging, streaming, and tool use are supported, but Anthropic-specific product features and secondary endpoints may not be available.
{% endhint %}

## Troubleshooting

{% hint style="warning" %}
**HTTP 401 Unauthorized.** Confirm you used a Grid consumption key, not a trading key, and that `api_key: ${THEGRID_API_KEY}` matches the variable stored in `~/.hermes/.env`.
{% endhint %}

{% hint style="warning" %}
**HTTP 402 Payment Required.** Your credits are depleted. Top up at [app.thegrid.ai](https://app.thegrid.ai).
{% endhint %}

{% hint style="warning" %}
**Requests go to another provider.** The top-level `model:` block controls the default provider. Replace it with the block above, or use the named-provider configuration and switch with `/model custom:thegrid:agent-prime`.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://thegrid.ai/docs/integrations-and-best-practices/integrations/hermes-agent.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
