Skip to content

[Config issue]: Kimi/Moonshot provider defaults to wrong endpoint for China users #8096

@Luchioxy

Description

@Luchioxy

Bug Description

The Kimi/Moonshot provider defaults to https://api.moonshot.ai/v1, but keys generated from platform.moonshot.cn only work with https://api.moonshot.cn/v1. Most Chinese users register on the .cn platform, so the default endpoint causes a 401 error out of the box.
Suggestion: auto-detect based on the key prefix, or add a prompt during setup asking which platform the key is from.

Steps to Reproduce

Steps to reproduce:
1. hermes setup → Select “Kimi / Moonshot”
2. Paste an API key from platform.moonshot.cn
3. Select model kimi-k2.5
4. Send any message
Expected: Successful response
Actual: HTTP 401 Invalid Authentication
Root cause: Setup defaults endpoint to api.moonshot.ai/v1, but .cn keys only authenticate against api.moonshot.cn/v1
Workaround: Manually edit ~/.hermes/config.yaml and ~/.hermes/.env to replace

Expected Behavior

Hermes auto-detects or prompts for the correct Moonshot endpoint; chat works immediately after setup.

Actual Behavior

Setup hardcodes api.moonshot.ai/v1 as endpoint. Keys from platform.moonshot.cn return 401. User must manually edit config.yaml and .env to fix. No error message hints at endpoint mismatch — only shows “Invalid Authentication”, misleading user into thinking the key itself is wrong.​​​​​​​​​​​​​​​​

Affected Component

Configuration (config.yaml, .env, hermes setup)

Messaging Platform (if gateway-related)

No response

Operating System

MacOS

Python Version

3.11.15

Hermes Version

2.1.0

Relevant Logs / Traceback

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

Add endpoint selection during setup: When user selects Kimi/Moonshot, ask “Which platform? (1) moonshot.cn (2) moonshot.ai” and set base_url accordingly
Probe both endpoints: On 401, automatically retry with the alternate endpoint before failing

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions