GuidesHosting choices

Hermes Agent with Ollama: local models, setup, context

Run Hermes Agent on Ollama: the custom endpoint and config.yaml keys, ollama launch hermes, the 64K context fix, which models work, remote and cloud Ollama.

November 23, 2026The Everpod team
The short answer

Hermes Agent reaches a local Ollama as a custom OpenAI-compatible endpoint; Hermes has no built-in provider for local Ollama, only for Ollama’s cloud. Run hermes model, choose Custom endpoint, enter http://localhost:11434/v1, skip the API key and type the model name, or let Ollama do it with ollama launch hermes. In ~/.hermes/config.yaml that is provider: custom, base_url and default under model:. The part that decides whether it works is the context window: Hermes needs at least 64,000 tokens, Ollama serves 4,096 on a machine with less than 24 GiB of video memory, and Hermes cannot change that over the OpenAI-compatible API. Start Ollama with OLLAMA_CONTEXT_LENGTH=64000 and put the same figure in model.context_length. Pick a model Ollama lists with the tools capability. As of November 23, 2026 (Hermes v0.23.3, Ollama 0.40.17).

Setting it up by hand

Start Ollama and pull a model that supports tools, then point Hermes at it. Nous’s provider docs walk through hermes model: pick “Custom endpoint (self-hosted / VLLM / etc.)”, give http://localhost:11434/v1 as the URL, “Skip API key (Ollama doesn’t need one)”, and enter the model name exactly as ollama list shows it, tag included. In the first-run wizard the same choice sits under More providers…, then Custom endpoint (enter URL manually), per Ollama’s Hermes page. The result in config.yaml, with the window you will give Ollama in the next section:

model:
  provider: custom
  base_url: http://localhost:11434/v1
  default: gemma4:12b
  context_length: 64000
Copied

On a server with no terminal session to answer prompts, hermes config set writes the same keys, since dotted names go to config.yaml (more on that, and on where the file lives, in installing Hermes Agent on a Linux server):

ollama pull gemma4:12b
hermes config set model.provider custom
hermes config set model.base_url http://localhost:11434/v1
hermes config set model.default gemma4:12b
hermes config set model.context_length 64000
Copied

Inside a chat, /model custom picks up the endpoint’s model when exactly one is loaded, and /model custom:<model> switches to another. For one run without touching the config, hermes chat --provider custom --base-url http://localhost:11434/v1 -m gemma4:12b.

The shortcut: ollama launch hermes

Ollama’s launcher picks a model, installs Hermes if it is missing (it asks “Hermes is not installed. Install now?” and runs Nous’s installer with --skip-setup), and offers to connect a messaging app through hermes gateway setup before starting Hermes. What it writes, from the launcher’s source in Ollama 0.40.17:

The context window: where Ollama and Hermes disagree

Hermes refuses any model whose window it measures below 64,000 tokens (MINIMUM_CONTEXT_LENGTH = 64_000 in its source), and its docs give the reason: the system prompt, the tool definitions and the working conversation need the room. Ollama’s context length page sets the served window by video memory: 4K below 24 GiB (or with no GPU), 32K from 24 to 48 GiB, 256K above. So on most machines the default is far under the floor.

The trap is that Hermes does not measure what Ollama is serving. In its source at v0.23.3, for an endpoint on your own machine or network it asks Ollama’s /api/show for the model’s num_ctx parameter if a Modelfile set one, and otherwise for the model’s maximum, the context_length in its file: 256K for gemma4:12b. It then asks for that window on every request, but Ollama’s OpenAI-compatible endpoint has no field for it (both makers’ docs say the window cannot be set that way, and the request handler in Ollama 0.40.17’s source reads no num_ctx). The outcomes, as that source reading predicts them:

Your setupWhat Hermes believesWhat happens
Stock model, nothing set, small GPU
The model’s maximum (256K for gemma4:12b)Starts without complaint, but Ollama serves 4K. Hermes’s own source warns that conversations then “grow past what Ollama allocated and silently truncate”
A model whose maximum is under 64K, such as qwen3:8b (40,960)
40,960Refused at start: “below the minimum 64,000”
OLLAMA_CONTEXT_LENGTH=64000 on the server, nothing in Hermes
Still the model’s maximum; the server variable is not visible to itStarts and works, but Hermes times its compaction to the larger window, so a conversation can grow past the 64K Ollama serves before Hermes compacts it
Server window and model.context_length set to the same figure
That figureHermes compacts before Ollama’s window fills

So set both sides. Ollama’s Hermes page says to leave Hermes’s “Context length in tokens” prompt blank for auto-detect; by the source reading above, auto-detect finds the model’s maximum rather than what Ollama serves, so enter the served figure there instead. On the Ollama machine, per Ollama’s FAQ, a systemd override on Linux:

sudo systemctl edit ollama.service
# in the editor, under [Service]:
Environment="OLLAMA_CONTEXT_LENGTH=64000"

sudo systemctl daemon-reload
sudo systemctl restart ollama
Copied

(or OLLAMA_CONTEXT_LENGTH=64000 ollama serve when you start it by hand, or the context slider in the desktop app). In Hermes, set model.context_length to the same number, as in the config above. The key the refusal message names, model.ollama_num_ctx, works too: it is taken as the window actually served and also brings Hermes’s compaction down to it.

The other route is a Modelfile, which Hermes does read, since a num_ctx in it comes back from /api/show:

FROM gemma4:12b
PARAMETER num_ctx 64000
Copied
ollama create gemma4-12b-64k -f ./Modelfile
hermes config set model.default gemma4-12b-64k
Copied

Whatever you set, check it after the first message: ollama ps shows the window the model was loaded with under CONTEXT, and the CPU and GPU split under PROCESSOR. A bigger window takes more memory; in Ollama’s words, “Setting a larger context length will increase the amount of memory required to run a model.” If 64K pushes the model onto the CPU, a smaller model at 64K is the better trade than a larger one that crawls.

Which models

Hermes drives everything through tool calls, so the model must be one Ollama lists with the tools capability: ollama show <model> prints it under Capabilities, and Nous’s troubleshooting says Ollama’s tool calling “is enabled by default — make sure your model supports it.” Nous’s own example, qwen2.5-coder:32b, has aged. Ollama’s launcher recommends these, as read on November 23, 2026:

ModelRunsNeeds, per Ollama
qwen3.8:27b
LocallyAbout 28 GB of video memory
gemma4:12b
LocallyAbout 11 GB of video memory
qwen3.5:4b
LocallyAbout 6 GB of video memory
glm-5.3-flash:cloud, kimi-k3.1-pro:cloud, deepseek-v4.1-flash:cloud
Ollama’s cloudUsage credits or a paid plan

The open reports about small models are specific. The tool definitions alone are large: in issue #158051 a one-line question to a model on llama.cpp made a 10,776-token prompt, 8,330 tokens of it the 18 tool schemas. In #152731, qwen3.5:4b through Ollama, in Hermes Desktop v0.23.0 on Windows, printed the command it was asked to run as text instead of calling the terminal tool. And in #153962 (open, tested by its reporter up to v0.23.3 with Ollama 0.40.17), 7B and 8B Qwen models kept failing with tool_call requires 'calls'. The reporter traced that to Hermes’s tool search, which by default puts MCP and plugin tools behind three bridge tools (the model called the bridge’s tool_call with the terminal tool’s arguments), and cleared it with hermes config set tools.tool_search.enabled off; Nous’s tool search page itself notes that “Smaller models do this less well.” All three were open on November 23, labelled by triage, with no merged fix. Fewer toolsets for a run (hermes chat -t file,web) also shrinks the prompt.

Ollama on another machine

Ollama “binds 127.0.0.1 port 11434 by default”, and its local API takes no authentication, so anyone who can reach the port can use it. To serve Hermes on another machine, add Environment="OLLAMA_HOST=0.0.0.0:11434" to the same override, keep port 11434 closed to the internet, and reach it over your LAN or a private network such as Tailscale. Then change base_url to that address, with /v1, and check it from the Hermes machine with curl http://<host>:11434/v1/models.

How you write the address matters. Hermes treats an endpoint as local, which is what turns on the Ollama detection, model.ollama_num_ctx and the local wording of its refusal message, when the host is a loopback or private address, a Tailscale address in 100.64.0.0/10, a name ending .local, or a name with no dots at all (its is_local_endpoint in v0.23.3). A full Tailscale name such as gpu-box.tail1234.ts.net is none of those, so Hermes handles it like a hosted API: use the 100.x address or the short name, or rely on model.context_length, which works either way. From WSL2, Nous’s docs add that localhost does not reach Ollama on the Windows side in the default NAT mode; mirrored networking fixes it, or the Windows host’s IP with Ollama bound beyond 127.0.0.1. In a container, localhost is the container itself; a Docker service name or host.docker.internal counts as local.

Ollama’s cloud models

Models ending :cloud run on Ollama’s servers, and Ollama sets them to “their maximum context length by default”, so the window problem goes away. There are two ways in. Through a local Ollama signed in with ollama signin, they appear at the same endpoint as your local models and need no change in Hermes. Without a local Ollama, Hermes has a first-class ollama-cloud provider: in hermes model choose Ollama Cloud and paste an API key from ollama.com’s key settings (stored as OLLAMA_API_KEY), or write it out:

model:
  provider: "ollama-cloud"
  default: "gpt-oss:120b"
Copied

Keep the model’s name:tag form, such as qwen3-coder:480b-cloud; Nous’s docs say “don’t use dashes”. On Ollama’s pricing page as of November 23, 2026, pay-as-you-go is per token, Pro is $20 a month with $60 of usage credits, and Max $100 with $300; Ollama says prompt and response data “is never logged or trained on.” Either way the prompts leave your machine, which is the reason most people chose Ollama in the first place. Whether a GPU of your own pays for itself against that is weighed in local AI box vs cloud.

When it doesn’t work

What you seeWhat to do
Model … has a context window of 40,960 tokens, which is below the minimum 64,000 required by Hermes Agent.
Raise Ollama’s window and tell Hermes the figure, as above; every case is in the guide to that message
Fine at first, then the model forgets the task or its earlier steps
Ollama may be serving less than Hermes thinks. Compare ollama ps CONTEXT with model.context_length and make them match
The model writes the command or a JSON blob as text instead of running it
Check ollama show for tools; try a larger model or fewer toolsets
tool_call requires 'calls', repeating
hermes config set tools.tool_search.enabled off (the reporter’s workaround in #153962)
Connection refused
curl <base_url>/models from the Hermes machine; check OLLAMA_HOST on the Ollama side and what localhost means where Hermes runs
The first reply after a pause is slow
Ollama unloads a model after five minutes idle by default and reloads it on the next request; OLLAMA_KEEP_ALIVE keeps it longer

Hermes installed on an always-on developer pod, which you run yourself.

A developer pod is a permanent cloud computer (VPS), set up and secured for you, with your pick of Claude Code, Codex, OpenCode, Pi, Hermes and OpenClaw installed. Run more agents at once than your laptop can hold, and keep them working when it’s closed. From $24 a month, built in about ten minutes.