Bug Description
When using third-party Anthropic-compatible providers (Kimi, MiniMax, DashScope, etc.) via api_mode: anthropic_messages, the agent incorrectly self-identifies as "Claude Code" and replaces all mentions of "Hermes Agent" with "Claude Code" in the system prompt.
Root Cause
_is_oauth_token() in agent/anthropic_adapter.py only excludes sk-ant-api* prefixed keys. Any third-party API key (e.g. sk-kimi-*) returns True, causing _is_anthropic_oauth to be set, which triggers:
- System prompt prepend:
"You are Claude Code, Anthropic's official CLI for Claude."
- Text replacement:
"Hermes Agent" → "Claude Code", "Nous Research" → "Anthropic"
- Tool name prefixing with
mcp_
Additionally, this code path hits two secondary crashes:
AttributeError: 'NoneType' object has no attribute 'get' on self.request_overrides.get("speed") when gateway sets request_overrides = None
UnboundLocalError on api_kwargs in the retry-exhaustion error handler
Steps to Reproduce
- Configure a Kimi API key (
sk-kimi-*) with provider: custom and api_mode: anthropic_messages
- Send a message via the gateway (Telegram/Discord/Slack)
- Ask the agent "who are you?"
- Agent responds as "Claude Code" instead of "Hermes Agent"
Expected Behavior
Third-party providers using the Anthropic Messages API should not get Claude Code identity injection.
Environment
- Hermes Agent v0.8.0
- Provider: Kimi (
api_mode: anthropic_messages)
- Platform: Telegram gateway
Bug Description
When using third-party Anthropic-compatible providers (Kimi, MiniMax, DashScope, etc.) via
api_mode: anthropic_messages, the agent incorrectly self-identifies as "Claude Code" and replaces all mentions of "Hermes Agent" with "Claude Code" in the system prompt.Root Cause
_is_oauth_token()inagent/anthropic_adapter.pyonly excludessk-ant-api*prefixed keys. Any third-party API key (e.g.sk-kimi-*) returnsTrue, causing_is_anthropic_oauthto be set, which triggers:"You are Claude Code, Anthropic's official CLI for Claude.""Hermes Agent"→"Claude Code","Nous Research"→"Anthropic"mcp_Additionally, this code path hits two secondary crashes:
AttributeError: 'NoneType' object has no attribute 'get'onself.request_overrides.get("speed")when gateway setsrequest_overrides = NoneUnboundLocalErroronapi_kwargsin the retry-exhaustion error handlerSteps to Reproduce
sk-kimi-*) withprovider: customandapi_mode: anthropic_messagesExpected Behavior
Third-party providers using the Anthropic Messages API should not get Claude Code identity injection.
Environment
api_mode: anthropic_messages)