For the complete documentation index, see llms.txt. This page is also available as Markdown.

Hermes Agent Integration with The Grid | Provider Setup

Connect Hermes Agent to The Grid as a custom provider. Update config.yaml, set your API key, patch redirects, and route agent runs.

Hermes Agent talks to The Grid the same way it talks to Ollama, vLLM, or any other OpenAI-compatible endpoint: as a custom provider. No plugin, one config block, and the messaging gateway, cron scheduler, and sub-agents all route through it.

There are two gotchas in current Hermes builds that catch nearly every new user. Both are documented below as required setup steps -- not as troubleshooting -- so read the whole Setup section before you start editing files.

Prerequisites

  • Hermes Agent installed from the Hermes GitHub repo. There is no published uvx hermes-agent package; install from source. Windows runs under WSL2 only.

  • A Grid account at app.thegrid.ai.

  • Credits in your account. The Grid is prepaid; zero credits returns 402.

  • A Grid consumption API key from Settings → API Keys → Create Consumption Key.

Shell vs in-chat REPL. Commands like hermes chat, hermes config set, hermes model, hermes doctor run in your terminal. Slash commands like /model, /usage, /exit run inside an active Hermes chat session. Don't type hermes model inside the REPL — it sends as a chat message and won't do anything.

Setup

1. Save your Grid key

hermes config set THEGRID_API_KEY your-consumption-api-key

hermes config set auto-routes API keys to ~/.hermes/.env. Editing the file directly works too.

2. Make The Grid your active provider in ~/.hermes/config.yaml

This is the step new users miss most often. Hermes routes inference based on the top model: block of config.yaml. If you only add an entry to custom_providers:, your existing provider (Gemini, OpenRouter, Anthropic, whatever) stays as the default and your messages get routed there with a model name like custom:thegrid:agent-prime -- which that other provider has never heard of, producing a confusing 404 from a host that isn't even The Grid.

To make The Grid the default, the top model: block must look like this:

Pick the path that fits your situation:

Path A: interactive wizard

Choose Custom endpoint (self-hosted / VLLM / etc.) from the provider list. Then:

  • API base URL: https://api.thegrid.ai/v1

  • API key: paste, or press Enter to use the value already saved in .env

  • Model name: agent-prime

  • Context length: 256000

Hermes writes this to ~/.hermes/config.yaml.

Path B: edit config.yaml directly

Paste the model: block above. The api_key: ${THEGRID_API_KEY} line is required even with the key in .env. In recent Hermes versions, setting THEGRID_API_KEY in ~/.hermes/.env is not enough on its own when using a custom base_url; the model: block has to reference the variable explicitly.

3. Patch Hermes' HTTP client to follow redirects (required)

This is required, not optional troubleshooting. The Grid redirects consumption requests from /v1/chat/completions to /r/v1/chat/completions for routing, and Hermes' bundled httpx.Client does not follow redirects by default. Without the patch, every chat message returns HTTP 307 with an HTML error page.

Open ~/.hermes/hermes-agent/run_agent.py, find the _build_keepalive_http_client() static method, and add follow_redirects=True to the httpx.Client(...) constructor:

Verify the patch landed exactly once:

1 means the patch is in place. 0 means it didn't apply.

4. Restart Hermes

Fully exit any running Hermes session (Ctrl+D in the REPL or close the terminal) so the patched file is loaded fresh. Restarting in-place is not enough -- the Python process keeps the old module in memory.

5. (Optional) Add The Grid alongside other providers

If you already have OpenRouter, Anthropic, or Nous Portal configured and want to keep them, register The Grid as a named custom provider so it sits next to them:

Switch mid-session with /model custom:thegrid:agent-prime (or any other instrument). Adding this entry does not change your default — the top model: block from Step 2 still controls that.

6. (Optional) Tier auxiliary tasks

Hermes splits the main loop from auxiliary tasks (vision, web summarization, session search). Point auxiliary tasks at Text Standard so cheap work stays cheap. The same pattern works for cron jobs that run unattended.

Verification

Inside the session, switch to The Grid if it isn't your default:

Try something representative: "Search my home directory for files changed in the last 24 hours, summarize what changed, and write the summary to ~/changes.md." If Hermes executes tool calls, returns a coherent text summary (not an HTML error block), and writes the file, the integration works end to end.

Copy-paste prompt — let your existing AI assistant set this up for you

If you already have a working AI coding assistant (Cursor, Claude Code, OpenAI Codex CLI, Aider, anything with shell access), paste this prompt to it. The assistant will walk through every step on your machine, including the redirect patch, and verify each one before moving on.

Troubleshooting

Sharing hermes config show output. Hermes expands ${THEGRID_API_KEY} in the displayed model: block, so the raw consumption key ends up in the output. Redact the api_key: line before pasting into Discord, GitHub issues, or Slack.

Connection diagnostic. hermes doctor runs a diagnostic sweep. Confirm provider is set to custom (unquoted), base_url is exactly https://api.thegrid.ai/v1, and that THEGRID_API_KEY resolves in your shell.

Last updated

Was this helpful?