# Hermes Agent

> Wire Nous Research's Hermes Agent to HeyEly as a custom endpoint.

Hermes Agent (from Nous Research) connects to custom gateways using Chat Completions, Anthropic Messages, or Responses. Below is the Chat Completions setup targeting `https://heyely.si/v1`.

## Set up

1. Generate an API key in [Developers](https://heyely.si/keys).
2. Store your key inside `~/.hermes/.env` (Hermes loads credentials from `.env`, never from `config.yaml`).

```bash
HEYELY_API_KEY=sk-df-...
```

3. Declare the HeyEly provider and default model in `~/.hermes/config.yaml`.

```yaml
providers:
  heyely:
    api: https://heyely.si/v1
    key_env: HEYELY_API_KEY
    transport: chat_completions
    models:
      "anthropic/claude-sonnet-5.5":
        context_length: 1000000

model:
  default: anthropic/claude-sonnet-5.5
  provider: custom:heyely
```

Not sure where Hermes reads those files on your machine? Run `hermes config path` and `hermes config env-path` to check.

If you prefer an interactive setup flow, run `hermes model`, select **Custom endpoint**, and follow the prompts for base URL, API key, model ID, and wire format.

## Verify

1. Run `hermes doctor` and confirm it exits with zero issues.
2. Run `hermes status` to inspect the active model and provider and verify credentials loaded cleanly without printing the secret.
3. Launch `hermes` and send a quick prompt.
4. Visit [Credit and usage](https://heyely.si/usage) to confirm the call sits at the top of **Spend** under your selected model.

## Pick a model

* Hermes enforces a minimum 64K context window and rejects smaller models at startup. Only configure models at or above 64K. Hermes fetches `context_length` automatically from HeyEly's `GET /v1/models` endpoint, so you only need an explicit override if detection differs.
* Change models mid-session with `/model custom:heyely:anthropic/claude-sonnet-5.5`, adding `--global` to persist it.
* You can switch `transport` to `anthropic_messages` (using `https://heyely.si` without `/v1`) or `codex_responses`. Always declare `transport` explicitly so Hermes does not guess from the URL.

## Troubleshooting

| You see                               | Cause                                                          | Fix                                                                   |
| ------------------------------------- | -------------------------------------------------------------- | --------------------------------------------------------------------- |
| `401 invalid_api_key`                 | Key missing from `~/.hermes/.env` or name mismatches `key_env` | Align the variable name, then run `/reload` or restart Hermes         |
| `401` with a placeholder key          | Field was written as `api_key_env` instead of `key_env`        | Rename the field to `key_env`                                         |
| "context window below minimum 64,000" | Missing or sub-64K `context_length`                            | Provide `context_length` and choose a model with at least 64K context |
| `OPENAI_BASE_URL` ignored             | Hermes only reads it for the built-in `openai-api` provider    | Configure the `providers` block shown above                           |
| `404 model_not_found`                 | Model ID differs from HeyEly's catalog                         | Copy the exact ID from the Models page                                |
| `402 insufficient_credit`             | Account credit balance is empty                                | [Add credit](https://heyely.si/credit?step=add)                                        |
