hermes-agent/website/docs/user-guide/features
Teknium dd60bcbfb7
feat: OpenAI-compatible API server + WhatsApp configurable reply prefix (#1756)
* feat: OpenAI-compatible API server platform adapter

Salvaged from PR #956, updated for current main.

Adds an HTTP API server as a gateway platform adapter that exposes
hermes-agent via the OpenAI Chat Completions and Responses APIs.
Any OpenAI-compatible frontend (Open WebUI, LobeChat, LibreChat,
AnythingLLM, NextChat, ChatBox, etc.) can connect by pointing at
http://localhost:8642/v1.

Endpoints:
- POST /v1/chat/completions  — stateless Chat Completions API
- POST /v1/responses         — stateful Responses API with chaining
- GET  /v1/responses/{id}    — retrieve stored response
- DELETE /v1/responses/{id}  — delete stored response
- GET  /v1/models            — list hermes-agent as available model
- GET  /health               — health check

Features:
- Real SSE streaming via stream_delta_callback (uses main's streaming)
- In-memory LRU response store for Responses API conversation chaining
- Named conversations via 'conversation' parameter
- Bearer token auth (optional, via API_SERVER_KEY)
- CORS support for browser-based frontends
- System prompt layering (frontend system messages on top of core)
- Real token usage tracking in responses

Integration points:
- Platform.API_SERVER in gateway/config.py
- _create_adapter() branch in gateway/run.py
- API_SERVER_* env vars in hermes_cli/config.py
- Env var overrides in gateway/config.py _apply_env_overrides()

Changes vs original PR #956:
- Removed streaming infrastructure (already on main via stream_consumer.py)
- Removed Telegram reply_to_mode (separate feature, not included)
- Updated _resolve_model() -> _resolve_gateway_model()
- Updated stream_callback -> stream_delta_callback
- Updated connect()/disconnect() to use _mark_connected()/_mark_disconnected()
- Adapted to current Platform enum (includes MATTERMOST, MATRIX, DINGTALK)

Tests: 72 new tests, all passing
Docs: API server guide, Open WebUI integration guide, env var reference

* feat(whatsapp): make reply prefix configurable via config.yaml

Reworked from PR #1764 (ifrederico) to use config.yaml instead of .env.

The WhatsApp bridge prepends a header to every outgoing message.
This was hardcoded to '⚕ *Hermes Agent*'. Users can now customize
or disable it via config.yaml:

  whatsapp:
    reply_prefix: ''                     # disable header
    reply_prefix: '🤖 *My Bot*\n───\n'  # custom prefix

How it works:
- load_gateway_config() reads whatsapp.reply_prefix from config.yaml
  and stores it in PlatformConfig.extra['reply_prefix']
- WhatsAppAdapter reads it from config.extra at init
- When spawning bridge.js, the adapter passes it as
  WHATSAPP_REPLY_PREFIX in the subprocess environment
- bridge.js handles undefined (default), empty (no header),
  or custom values with \\n escape support
- Self-chat echo suppression uses the configured prefix

Also fixes _config_version: was 9 but ENV_VARS_BY_VERSION had a
key 10 (TAVILY_API_KEY), so existing users at v9 would never be
prompted for Tavily. Bumped to 10 to close the gap. Added a
regression test to prevent this from happening again.

Credit: ifrederico (PR #1764) for the bridge.js implementation
and the config version gap discovery.

---------

Co-authored-by: Test <test@test.com>
2026-03-17 10:44:37 -07:00
..
_category_.json feat: add documentation website (Docusaurus) 2026-03-05 05:24:55 -08:00
acp.md docs: add ACP and internal systems implementation guides 2026-03-14 00:29:48 -07:00
api-server.md feat: OpenAI-compatible API server + WhatsApp configurable reply prefix (#1756) 2026-03-17 10:44:37 -07:00
batch-processing.md docs: stabilize website diagrams 2026-03-14 22:49:57 -07:00
browser.md docs: comprehensive documentation update for recent features 2026-03-17 03:42:02 -07:00
checkpoints.md docs: update checkpoint/rollback docs for new features 2026-03-16 04:56:22 -07:00
code-execution.md docs: add 11 new pages + expand 4 existing pages (26 → 37 total) 2026-03-05 07:28:41 -08:00
context-files.md docs: stabilize website diagrams 2026-03-14 22:49:57 -07:00
cron.md docs: clarify gateway service scopes (#1378) 2026-03-14 21:17:41 -07:00
delegation.md feat: add direct endpoint overrides for auxiliary and delegation 2026-03-14 21:11:37 -07:00
fallback-providers.md feat(compression): add summary_base_url + move compression config to YAML-only 2026-03-17 04:46:15 -07:00
honcho.md fix(honcho): isolate session routing for multi-user gateway (#1500) 2026-03-16 00:23:47 -07:00
hooks.md docs: stabilize website diagrams 2026-03-14 22:49:57 -07:00
image-generation.md docs: add 11 new pages + expand 4 existing pages (26 → 37 total) 2026-03-05 07:28:41 -08:00
mcp.md docs(mcp): add comprehensive Hermes MCP docs 2026-03-14 06:36:01 -07:00
memory.md docs(honcho): rewrite Honcho Memory docs as full feature documentation 2026-03-10 16:49:14 -04:00
personality.md docs(soul): add comprehensive SOUL.md guide 2026-03-14 09:37:26 -07:00
plugins.md feat: first-class plugin architecture (#1555) 2026-03-16 07:17:36 -07:00
provider-routing.md docs: fallback providers + /background command documentation 2026-03-15 06:24:28 -07:00
rl-training.md docs: stabilize website diagrams 2026-03-14 22:49:57 -07:00
skills.md docs: stabilize website diagrams 2026-03-14 22:49:57 -07:00
skins.md docs: expand Docusaurus coverage across CLI, tools, skills, and skins (#1232) 2026-03-13 21:34:41 -07:00
tools.md fix(docker): add explicit env allowlist for container credentials (#1436) 2026-03-17 02:34:35 -07:00
tts.md fix: restore local STT fallback for gateway voice notes 2026-03-15 21:51:40 -07:00
vision.md docs: add Vision & Image Paste guide with platform compatibility 2026-03-05 23:51:46 -08:00
voice-mode.md docs: complete voice mode docs 2026-03-14 19:29:01 -07:00