Integration Guides

Hermes Agent with an OpenAI-Compatible API: Both Directions (2026)

ROIBest AI

Hermes Agent and OpenAI-compatible APIs: two directions

Hermes Agent is the open-source (MIT) agent from Nous Research: a terminal, desktop and messaging agent with tools, memory and self-written skills. "Hermes Agent OpenAI-compatible API" can mean two different jobs, and the setup is different for each:

  1. Hermes as the client. You want Hermes to use a model behind an OpenAI-compatible endpoint: your own vLLM, llama.cpp or Ollama server, a gateway such as LiteLLM, or a third-party API. This is the Custom endpoint provider.
  2. Hermes as the server. You want other apps (Open WebUI, LobeChat, your own code) to talk to Hermes as if it were an OpenAI model. This is Hermes's built-in API server.

This page covers both. It was checked on November 24, 2026 against the Hermes Agent docs for providers and the API server; the latest release at the time was v0.23.3. Do not confuse the agent with Nous's Hermes model family: Hermes Agent can run any model, and Hermes models can be served by any engine.

Part 1: point Hermes at an OpenAI-compatible endpoint

Hermes treats any server that implements /v1/chat/completions as a valid provider. There are two ways to configure it.

Interactive (recommended): run this in a terminal, outside a chat session:

hermes model
# choose "Custom endpoint (self-hosted / VLLM / etc.)"
# enter the API base URL, the API key (or leave empty), and the model name

Manual: edit ~/.hermes/config.yaml:

model:
  default: your-model-name
  provider: custom
  base_url: http://localhost:8000/v1
  api_key: your-key-or-leave-empty-for-local
  # key_env: MY_PROVIDER_API_KEY   # alternative: read the key from an env var

Both write to config.yaml, which is the single source of truth for the model and endpoint. Three details trip people up:

  • OPENAI_BASE_URL does not configure a custom endpoint. Hermes honours it only for its openai-api provider (direct OpenAI access). For everything else, use hermes model or model.base_url. The old LLM_MODEL variable in .env was removed.
  • hermes model and /model are different. hermes model is the setup wizard that adds providers and keys. /model, typed inside a chat, only switches between providers you already set up, for example /model custom:qwen-2.5, or bare /model custom to auto-pick the only model the endpoint serves.
  • Include /v1 in the base URL for most servers, exactly as you would for the OpenAI SDK. Our OpenAI-compatible base URL guide explains when it is needed.

Several endpoints at once: named custom providers

If you use a local server and a remote GPU box, define both under providers: and switch with a three-part name:

providers:
  local:
    api: http://localhost:8080/v1
  work:
    api: https://gpu-server.internal.example.com/v1
    key_env: CORP_API_KEY
    transport: chat_completions

Then /model custom:local:qwen-2.5 or /model custom:work:llama3. Each entry also accepts default_model, context_length, extra_headers, extra_body, and key_cmd, a command that prints a short-lived token, which suits SSO-protected internal gateways. For Anthropic-compatible proxies set transport: anthropic_messages.

Server settings Hermes needs

An agent puts more demands on a server than a chat app does. Two settings decide whether Hermes works at all.

Context of at least 64,000 tokens. Hermes rejects smaller windows at startup, because the system prompt, tool schemas and working state need the room. Context is set on the server, not by the client:

Server

How to get 64K context

Ollama

OLLAMA_CONTEXT_LENGTH=64000 on the server, or a Modelfile with PARAMETER num_ctx 64000. Ollama's default is only 4,096 tokens on GPUs under 24 GB, and it cannot be changed through /v1/chat/completions.

vLLM

--max-model-len 65536 (or 64k)

SGLang

--context-length 65536

llama.cpp llama-server

-c 64000; with parallel sequences (-np) the context is split between them

LM Studio

Set the model's context length in the app; Hermes defaults to http://localhost:1234/v1

Tool calling switched on. Hermes works by calling tools. If the server returns tool calls as plain text, you will see raw JSON in the chat instead of actions:

  • vLLM: --enable-auto-tool-choice plus a matching --tool-call-parser (for example hermes for Qwen 2.5 and Hermes models, llama3_json for Llama 3.x).
  • SGLang: --tool-call-parser for the model family.
  • llama.cpp: Jinja chat templates must be on (--jinja, enabled by default in current builds).
  • Ollama: use a model tagged "tools" in its library.

A typical local setup:

OLLAMA_CONTEXT_LENGTH=64000 ollama serve
# then: hermes model -> Custom endpoint -> http://localhost:11434/v1, no key, model name

Hosted OpenAI-compatible providers (DeepSeek, OpenRouter, Groq and many others) also work as custom endpoints, though Hermes has first-class providers for many of them that need only an API key. For a wider look at what an agent needs from a gateway, see open-source LLM gateways.

Part 2: expose Hermes as an OpenAI-compatible API

The API server makes Hermes look like a model to any OpenAI client. Requests run through the full agent, with tools, memory and skills, and the final answer comes back as a normal completion.

1. Enable it in ~/.hermes/.env:

API_SERVER_ENABLED=true
API_SERVER_KEY=change-me

2. Start the gateway:

hermes gateway
# [API Server] API server listening on http://127.0.0.1:8642

3. Point a client at it:

curl http://localhost:8642/v1/chat/completions \
  -H "Authorization: Bearer change-me" \
  -H "Content-Type: application/json" \
  -d '{"model": "hermes-agent", "messages": [{"role": "user", "content": "Hello"}]}'

What it exposes:

Route

Purpose

POST /v1/chat/completions

Standard chat completions, streaming supported

POST /v1/responses

Responses API, with previous_response_id for multi-turn

GET /v1/models

Lists the agent as one model, named after the profile (hermes-agent by default; change with API_SERVER_MODEL_NAME)

GET /health, GET /v1/health

Liveness, returns {"status": "ok"}

POST /v1/runs

Hermes-specific runs API with an event stream

Settings worth knowing: the port defaults to 8642 (API_SERVER_PORT), the bind address to 127.0.0.1 (API_SERVER_HOST), and browser access is off unless you list origins in API_SERVER_CORS_ORIGINS. In Open WebUI, add a connection with base URL http://<host>:8642/v1 and your API_SERVER_KEY.

Security: this endpoint can run commands

The API server gives callers the agent's whole toolset, including terminal commands on the machine Hermes runs on. The docs make API_SERVER_KEY mandatory for every deployment, even on loopback. Treat that key like an SSH credential:

  • Keep the default 127.0.0.1 bind unless you need remote access, and then prefer a VPN or private network over a public port.
  • Use a long random key and a separate key per Hermes profile.
  • Keep API_SERVER_CORS_ORIGINS to the exact origins that need it.
  • Remember that whoever can call the API can do whatever the agent's tools can do.

Troubleshooting

Symptom

Likely cause

Fix

Rejected at startup for context length

Server window below 64K

Raise context on the server (table above)

Raw JSON tool calls printed in chat

Tool calling off on the server

vLLM flags, llama.cpp Jinja, a tools-capable Ollama model

404 from the endpoint

Wrong base URL or model name

Check GET /v1/models and the /v1 suffix

OPENAI_BASE_URL seems ignored

It only applies to the openai-api provider

Use hermes model or model.base_url

/model doesn't list the new provider

/model can't add providers

Exit and run hermes model

Answers cut short on SGLang

Low server default for max output

Raise the server's default max tokens

401 from Hermes's API server

Missing or wrong API_SERVER_KEY

Send Authorization: Bearer <key>

For other mismatches between servers, see OpenAI compatibility issues.

FAQ

Does Hermes Agent support OpenAI-compatible APIs?

Yes. Run hermes model, choose "Custom endpoint", and enter the base URL, key and model name. Any server that implements /v1/chat/completions works, including vLLM, SGLang, llama.cpp, Ollama and LM Studio.

How do I use Hermes Agent with Ollama?

Start Ollama with at least 64K context (OLLAMA_CONTEXT_LENGTH=64000 ollama serve), then in hermes model choose Custom endpoint with http://localhost:11434/v1, no API key, and a tools-capable model.

Can Hermes Agent be used as an OpenAI-compatible API?

Yes. Set API_SERVER_ENABLED=true and an API_SERVER_KEY in ~/.hermes/.env, run hermes gateway, and point clients at http://localhost:8642/v1 with model hermes-agent.

Why does Hermes ignore OPENAI_BASE_URL?

That variable only applies to the openai-api provider for direct OpenAI access. Custom endpoints are configured with hermes model or model.base_url in config.yaml.

What context length does Hermes Agent need?

At least 64,000 tokens. Hermes rejects smaller windows at startup, and the limit must be raised on the model server, not in the client.

The short version

To run Hermes on your own model, use hermes model and pick Custom endpoint, give the server at least 64K context, and make sure tool calling is on. To let other apps use Hermes, enable the API server, set a strong API_SERVER_KEY, and connect to http://localhost:8642/v1, remembering that the key unlocks terminal access on that machine.