hermes - 💡(How to fix) Fix Gateway silently uses cloud API keys from environment with no warning, no cost visibility, no spending cap [1 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Hermes gateway picked up ANTHROPIC_API_KEY from my shell environment and began routing all incoming Telegram messages through Anthropic's API with zero disclosure, no cost warnings, and no spending cap. Result: ~$80 in unintended charges in a single night while I was not actively using the tool.

Root Cause

Hermes gateway picked up ANTHROPIC_API_KEY from my shell environment and began routing all incoming Telegram messages through Anthropic's API with zero disclosure, no cost warnings, and no spending cap. Result: ~$80 in unintended charges in a single night while I was not actively using the tool.

Fix Action

Fixed

Code Example

model:
  default: llama3.2
  provider: ollama
  base_url: https://api.anthropic.com
RAW_BUFFERClick to expand / collapse

Summary

Hermes gateway picked up ANTHROPIC_API_KEY from my shell environment and began routing all incoming Telegram messages through Anthropic's API with zero disclosure, no cost warnings, and no spending cap. Result: ~$80 in unintended charges in a single night while I was not actively using the tool.

What happened

  • I run Hermes gateway as a background service on a home server
  • Hermes found ANTHROPIC_API_KEY in the environment and silently set it as the active provider
  • Every inbound Telegram message triggered a full agent session using claude-sonnet-4-20250514
  • Sessions accumulated 28+ API calls per conversation, with 20,000–38,000 input tokens per call
  • Context grew to 90 messages / ~38K tokens with no pruning or warning
  • None of this was visible in any UI or log summary — only discovered by grepping agent.log after the charges hit

Expected behavior

  • Explicit confirmation before using any paid cloud API key discovered in the environment
  • Cost/token visibility surfaced in the gateway (not buried in verbose logs)
  • Session context limits or warnings when context grows large
  • A spending cap or alert mechanism so runaway usage can't silently rack up bills

Actual behavior

Silent billing. No warnings. No cap. No indication that Anthropic's API was being used at all.

Impact

This is a real user safety issue. Anyone running Hermes gateway on a home server or shared machine with API keys in their environment is at risk of surprise charges. The tool should never silently adopt a paid API key without the user explicitly choosing it.

Config snippet (at time of incident)

model:
  default: llama3.2
  provider: ollama
  base_url: https://api.anthropic.com

Note: by this point the config had already been partially changed — the charges occurred when the model was correctly resolving to claude-sonnet-4-20250514 via the Anthropic provider.

Steps to reproduce

  1. Set ANTHROPIC_API_KEY in your shell environment
  2. Run hermes gateway run connected to a messaging platform (Telegram, Discord, etc.)
  3. Send messages from an active chat
  4. Check your Anthropic billing dashboard

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

  • Explicit confirmation before using any paid cloud API key discovered in the environment
  • Cost/token visibility surfaced in the gateway (not buried in verbose logs)
  • Session context limits or warnings when context grows large
  • A spending cap or alert mechanism so runaway usage can't silently rack up bills

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING