hermes - 💡(How to fix) Fix [Bug]: KIMI_CODE_BASE_URL missing /v1 causes 404 on kimi-coding fallback calls [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#16409Fetched 2026-04-28 06:53:34
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Participants
Timeline (top)
labeled ×5commented ×1

Error Message

Error log:

Root Cause

In hermes_cli/auth.py line ~190:

KIMI_CODE_BASE_URL = "https://api.kimi.com/coding"

The _resolve_kimi_base_url() function (line 409) returns this value for keys with sk-kimi- prefix. Since the OpenAI-compatible client already appends /v1/chat/completions to the base URL, the final path becomes /coding/chat/completions instead of /coding/v1/chat/completions.

Testing confirms:

  • https://api.kimi.com/coding → SSL timeout (unreachable)
  • https://api.kimi.com/coding/v1/models → 200 OK, returns model list including kimi-for-coding

Code Example

API call failed after 3 retries. HTTP 404: The requested resource was not found | provider=kimi-coding model=kimi-for-coding msgs=285 tokens=~60,481

---

KIMI_CODE_BASE_URL = "https://api.kimi.com/coding"

---

# Before
KIMI_CODE_BASE_URL = "https://api.kimi.com/coding"

# After
KIMI_CODE_BASE_URL = "https://api.kimi.com/coding/v1"
RAW_BUFFERClick to expand / collapse

Bug Description

When Hermes falls back to kimi-coding provider, API calls fail with HTTP 404 because the built-in KIMI_CODE_BASE_URL is set to https://api.kimi.com/coding (without /v1), but the correct working endpoint is https://api.kimi.com/coding/v1.

Steps to Reproduce

  1. Configure kimi-coding as a fallback provider in config.yaml
  2. Use a Kimi API key with sk-kimi- prefix (triggers the built-in URL resolution)
  3. Trigger a fallback call (e.g., when primary model fails)
  4. Observe HTTP 404 errors

Expected Behavior

Kimi Coding API calls should succeed. The endpoint https://api.kimi.com/coding/v1/chat/completions should be used.

Actual Behavior

Hermes resolves the base URL to https://api.kimi.com/coding (from KIMI_CODE_BASE_URL in hermes_cli/auth.py), then appends /v1/chat/completions internally, resulting in requests to https://api.kimi.com/coding/v1/chat/completions. However, the actual path constructed is /coding/chat/completions (missing /v1 segment), yielding a 404.

Error log:

API call failed after 3 retries. HTTP 404: The requested resource was not found | provider=kimi-coding model=kimi-for-coding msgs=285 tokens=~60,481

Root Cause Analysis

In hermes_cli/auth.py line ~190:

KIMI_CODE_BASE_URL = "https://api.kimi.com/coding"

The _resolve_kimi_base_url() function (line 409) returns this value for keys with sk-kimi- prefix. Since the OpenAI-compatible client already appends /v1/chat/completions to the base URL, the final path becomes /coding/chat/completions instead of /coding/v1/chat/completions.

Testing confirms:

  • https://api.kimi.com/coding → SSL timeout (unreachable)
  • https://api.kimi.com/coding/v1/models → 200 OK, returns model list including kimi-for-coding

Proposed Fix

Change KIMI_CODE_BASE_URL from https://api.kimi.com/coding to https://api.kimi.com/coding/v1 in hermes_cli/auth.py.

# Before
KIMI_CODE_BASE_URL = "https://api.kimi.com/coding"

# After
KIMI_CODE_BASE_URL = "https://api.kimi.com/coding/v1"

Users can work around this by setting KIMI_BASE_URL=https://api.kimi.com/coding/v1 in their .env file.

Affected Component

  • Configuration (config.yaml, .env, hermes setup)
  • Agent Core (conversation loop, context compression, memory)

Environment

  • OS: macOS 15.5 (Apple Silicon)
  • Python: 3.11.15
  • Hermes: latest (git main)

extent analysis

TL;DR

Update the KIMI_CODE_BASE_URL in hermes_cli/auth.py to https://api.kimi.com/coding/v1 to fix the 404 error.

Guidance

  • Verify the issue by checking the API call URL constructed by Hermes and confirm it's missing the /v1 segment.
  • Apply the proposed fix by changing KIMI_CODE_BASE_URL to https://api.kimi.com/coding/v1 in hermes_cli/auth.py.
  • As a temporary workaround, users can set KIMI_BASE_URL=https://api.kimi.com/coding/v1 in their .env file.
  • Test the fix by triggering a fallback call and checking for successful API responses.

Example

# Updated KIMI_CODE_BASE_URL
KIMI_CODE_BASE_URL = "https://api.kimi.com/coding/v1"

Notes

This fix assumes that the KIMI_CODE_BASE_URL is the only place where the base URL is defined. If there are other occurrences, they may also need to be updated.

Recommendation

Apply the workaround by setting KIMI_BASE_URL=https://api.kimi.com/coding/v1 in the .env file, as this is a non-invasive change that can be easily reverted if needed.

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

hermes - 💡(How to fix) Fix [Bug]: KIMI_CODE_BASE_URL missing /v1 causes 404 on kimi-coding fallback calls [1 comments, 2 participants]