hermes - ✅(Solved) Fix [Bug]: kimi-coding Anthropic Messages runtime keeps /coding/v1 and produces /v1/v1/messages [1 pull requests, 1 comments, 2 participants]

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…
GitHub stats
NousResearch/hermes-agent#25104Fetched 2026-05-14 03:48:58
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Participants
Timeline (top)
labeled ×4commented ×1cross-referenced ×1

Root Cause

The OpenAI-compatible Kimi catalog/model endpoint and the Anthropic Messages SDK base URL are not the same string:

  • OpenAI-compatible catalog root: /coding/v1
  • Anthropic SDK base URL: /coding

Hermes needs transport-aware normalization before constructing the Anthropic client.

Fix Action

Fixed

PR fix notes

PR #25135: fix: normalize Kimi runtime base URL

Description (problem / solution / changelog)

Bug

Kimi Code can expose an OpenAI-compatible catalog URL at https://api.kimi.com/coding/v1, but Anthropic Messages clients append /v1/messages internally. Keeping /coding/v1 as the runtime base URL produces /coding/v1/v1/messages and 404s.

Fixes #25104

Summary

Normalize api.kimi.com/coding/v1 to api.kimi.com/coding only when the resolved runtime transport is anthropic_messages. This preserves /models/catalog compatibility elsewhere while preventing the Anthropic SDK double-/v1 path.

TDD / ATDD coverage

  • Added a focused regression test that reproduces the reported behavior.
  • Implemented the minimal production change needed to satisfy the regression.
  • Re-ran the targeted test file to guard nearby behavior.

Test plan

  • /Users/mudrii/src/hermes/hermes-agent/venv/bin/python -m pytest tests/hermes_cli/test_runtime_provider_resolution.py -q -o 'addopts=' -> 111 passed

Review notes

  • Kept the change scoped to the issue-specific runtime path.
  • No secrets are persisted or logged.

Changed files

  • hermes_cli/runtime_provider.py (modified, +21/-0)
  • tests/hermes_cli/test_runtime_provider_resolution.py (modified, +87/-0)

Code Example

https://api.kimi.com/coding/v1

---

https://api.kimi.com/coding/v1/v1/messages

---

https://api.kimi.com/coding

---

https://api.kimi.com/coding/v1/messages
RAW_BUFFERClick to expand / collapse

Bug Description

kimi-coding / Kimi Coding Plan can resolve to the OpenAI-compatible catalog root:

https://api.kimi.com/coding/v1

while Hermes routes the actual chat request through api_mode: anthropic_messages.

The Anthropic SDK appends its own /v1/messages path to the configured base URL. If Hermes passes /coding/v1 as the SDK base, the final request becomes:

https://api.kimi.com/coding/v1/v1/messages

Kimi returns HTTP 404 for that double-/v1 path.

Expected Behavior

When the selected provider/path is Kimi Coding and api_mode == anthropic_messages, Hermes should normalize the Anthropic SDK base URL to the parent path:

https://api.kimi.com/coding

so the SDK constructs:

https://api.kimi.com/coding/v1/messages

Actual Behavior

Current main can keep /coding/v1 in runtime resolution paths, causing /coding/v1/v1/messages and HTTP 404.

Reproduction

  1. Configure a valid Kimi Coding API key.
  2. Select kimi-coding / kimi-k2.6.
  3. Ensure the resolved runtime uses api_mode: anthropic_messages and base_url: https://api.kimi.com/coding/v1.
  4. Send any message.
  5. Observe HTTP 404 from the double-/v1 Anthropic Messages URL.

Root Cause

The OpenAI-compatible Kimi catalog/model endpoint and the Anthropic Messages SDK base URL are not the same string:

  • OpenAI-compatible catalog root: /coding/v1
  • Anthropic SDK base URL: /coding

Hermes needs transport-aware normalization before constructing the Anthropic client.

Suggested Fix

In runtime provider resolution, when:

  • provider is kimi-coding / Kimi Coding, or base URL host/path matches api.kimi.com/coding
  • api_mode == "anthropic_messages"
  • base URL ends with /v1

strip the trailing /v1 before passing the base URL to the Anthropic SDK.

This should be applied consistently across:

  • credential-pool path
  • explicit runtime path
  • API-key fallback path
  • model-switch result path

Related Existing Reports / PRs

This report is a focused current-main reproduction of the same provider bug class as:

  • #21297
  • #24462
  • #15200
  • #22289

Environment

  • Hermes Agent current main around commit 4fdfdf674
  • macOS Apple Silicon
  • Provider: kimi-coding
  • Model: kimi-k2.6

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING