---
title: "Use Autohand models in Hermes Agent"
description: "Configure Hermes Agent to use Autohand as a custom endpoint and send delegated tasks to Fantail."
sidebar:
  label: "Hermes Agent"
seo:
  description: "Point Hermes Agent at Autohand Fantail and Moa as a custom OpenAI-compatible endpoint, and run Hermes subagents on Fantail."
---

## How do I use Autohand models in Hermes Agent? [#quick-answer]

Save your key with `hermes config set AUTOHAND_API_KEY`, then set the `model` block in `~/.hermes/config.yaml` to `provider: custom`, `base_url: https://api.autohand.ai/v1`, and `default: fantail`.

|  |  |
| --- | --- |
| Status | Available through a custom OpenAI-compatible endpoint |
| Requires | An Autohand account, an Autohand API key, and Hermes Agent. |
| Configure with | `~/.hermes/config.yaml` and `~/.hermes/.env` |
| Subagents | The `delegation` block, with `model: fantail` |

:::warning
**Know before you start:** This guide follows the Hermes Agent configuration reference. Check your installed version against it, because Hermes changes often.
:::

## Prerequisites

- An Autohand account. [Sign up or sign in to Console](https://console.autohand.ai/). The Free plan includes Fantail. Moa requires the Pro plan or above.
- An Autohand API key. The first step shows how to create one.
- Hermes Agent. Install it with `curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash`.

## Step 1: Create an Autohand API key [#create-key]

1. Sign in to [Autohand Console](https://console.autohand.ai/).
2. Open [API Keys](https://console.autohand.ai/api-keys) and select **Create API Key**.
3. Enter a name that identifies the agent and machine, for example `hermes-laptop`.
4. Select **Create Key** and copy the value. Console shows the key only once.

## Step 2: Store the key [#set-key]

Hermes keeps secrets in `~/.hermes/.env`. The `hermes config set` command saves any upper-case name to that file.

```bash
hermes config set AUTOHAND_API_KEY your-autohand-api-key
```

Confirm that the key works from a terminal where the variable is set. The request lists the models your plan can use.

```bash
curl https://api.autohand.ai/v1/models \
  -H "Authorization: Bearer $AUTOHAND_API_KEY"
```

## Step 3: Point Hermes at Autohand [#configure]

Run `hermes config edit` to open `~/.hermes/config.yaml`, and set the `model` block:

```yaml
model:
  provider: custom
  default: fantail
  base_url: https://api.autohand.ai/v1
  api_key: ${AUTOHAND_API_KEY}
  context_length: 262144
```

Hermes replaces `${AUTOHAND_API_KEY}` with the value from your environment or `~/.hermes/.env`. The `context_length` setting tells Hermes the Fantail context window.

You can also run `hermes model`, select **Custom endpoint**, and enter the base URL, key, and model name when prompted. Hermes checks the endpoint against `/v1/models` before it saves the settings.

## Step 4: Choose Fantail or Moa [#choose-model]

| Model ID | Use it for | Context | Max output | Plans |
| --- | --- | --- | --- | --- |
| `fantail` | Fast agent loops, quick fixes, reviews, and subagents | 256K tokens | 16K tokens | Free and above |
| `moa` | Planning, large refactors, and repository-wide changes | 1M tokens | 262,144 tokens | Pro and above |

To use Moa for the main agent, set `default: moa` and `context_length: 1048576`.

## Step 5: Run a test prompt [#test]

```bash
hermes chat -q "Summarize what this repository does in three sentences"
```

The `-q` option runs one prompt and exits.

## Subagents and Fantail [#subagents]

Hermes starts subagents with its delegate tool. By default, subagents use the main model. To run them on Fantail while the main agent uses Moa, add a `delegation` block:

```yaml
delegation:
  model: fantail
  base_url: https://api.autohand.ai/v1
  api_key: ${AUTOHAND_API_KEY}
  api_mode: chat_completions
```

When `delegation.base_url` is set, subagents call that endpoint directly. Set `delegation.api_key` as shown, because Hermes otherwise falls back to `OPENAI_API_KEY`. The `api_mode` setting tells Hermes to use Chat Completions.

## Troubleshooting

| Symptom | Cause | Fix |
| --- | --- | --- |
| `${AUTOHAND_API_KEY}` appears in errors | The variable is not set, so Hermes keeps the placeholder. | Run `hermes config set AUTOHAND_API_KEY` again. |
| Subagents use a different provider | The `delegation` block has no `base_url` or `api_key`. | Add both keys as shown in the subagent section. |
| `401` with `Credential not recognised` | The key is wrong, revoked, or not set in the environment the agent reads. | Create a new key in Console, set `AUTOHAND_API_KEY` again, and open a new terminal. |
| `401` with `Missing Autohand credential` | The request reached Autohand without an `Authorization` header. | Check that the agent reads the variable name shown in this guide. |
| Model not found | The model ID is misspelled, or your plan does not include it. | Use `fantail` or `moa` in lowercase. Moa requires the Pro plan or above. |
| Context or output limit errors | The agent uses default limits for a model it does not recognize. | Set the limits for Fantail (262,144 context, 16,000 output) or Moa (1,048,576 context, 262,144 output). |

## Next steps

- [Use Autohand models in other coding agents](/integrations/coding-agents)
- [Compare Autohand models](/models)
- [Fantail model reference](/models/fantail)
- [Moa model reference](/models/moa)
- [Create and protect an API key](/agent-sdk/api-key-setup)

**Which provider do I choose in Hermes for Autohand?**

Use `provider: custom` with `base_url: https://api.autohand.ai/v1`.

**Where does Hermes store my Autohand key?**

In `~/.hermes/.env`. Save it with `hermes config set AUTOHAND_API_KEY`.

**How do I run Hermes subagents on Fantail?**

Add a `delegation` block with `model: fantail`, the Autohand base URL, and `api_key: ${AUTOHAND_API_KEY}`.
