Skip to content

feat: add kimi-coding-cn provider for mainland China users#8900

Closed
LoikStyle wants to merge 1 commit into
NousResearch:mainfrom
LoikStyle:fix/kimi-moonshot-cn-support
Closed

feat: add kimi-coding-cn provider for mainland China users#8900
LoikStyle wants to merge 1 commit into
NousResearch:mainfrom
LoikStyle:fix/kimi-moonshot-cn-support

Conversation

@LoikStyle

@LoikStyle LoikStyle commented Apr 13, 2026

Copy link
Copy Markdown

Summary

Moonshot AI has separate endpoints for international and mainland China users. The international endpoint (api.moonshot.ai) is not accessible from China, causing connection failures when using the kimi-coding provider.

This adds a new kimi-coding-cn provider alongside the existing kimi-coding, following the same pattern as minimax / minimax-cn:

Provider Endpoint Region
kimi-coding api.moonshot.ai/v1 International (unchanged)
kimi-coding-cn api.moonshot.cn/v1 Mainland China (new)

Changes

  • hermes_cli/auth.py: Add kimi-coding-cn ProviderConfig with api.moonshot.cn/v1, plus aliases kimi-cn / moonshot-cn
  • hermes_cli/models.py: Register models, labels, and aliases for kimi-coding-cn
  • hermes_cli/main.py: Add to setup menu, CLI choices, and model flow
  • hermes_cli/setup.py: Add model list for kimi-coding-cn
  • hermes_cli/providers.py: Map to kimi-for-coding models.dev ID
  • hermes_cli/runtime_provider.py: Handle kimi-coding-cn in credential resolution
  • hermes_cli/model_normalize.py: Add to prefix-strip providers
  • hermes_cli/doctor.py: Revert to moonshot.ai for default health check (CN uses env override)
  • agent/model_metadata.py: Add api.moonshot.cn to provider auto-detection
  • trajectory_compressor.py: Add moonshot.cn to provider matching

Usage

# Select via setup wizard
hermes setup model  # → choose "Kimi / Moonshot China"

# Or via CLI flag
hermes --provider kimi-coding-cn

# Or via alias
hermes --provider kimi-cn

Test plan

  • Verified api.moonshot.cn/v1/chat/completions returns 200 with valid Kimi API key from China server
  • Verified existing kimi-coding (international) provider unchanged
  • Verified aliases kimi-cn and moonshot-cn resolve correctly
  • Follows existing minimax / minimax-cn dual-provider pattern

🤖 Generated with Claude Code

Moonshot AI has separate endpoints for international (api.moonshot.ai)
and mainland China (api.moonshot.cn) users. The international endpoint
is not accessible from China, causing connection failures.

This adds a new `kimi-coding-cn` provider alongside the existing
`kimi-coding`, following the same pattern as `minimax` / `minimax-cn`:

- `kimi-coding`:    api.moonshot.ai/v1 (international, unchanged)
- `kimi-coding-cn`: api.moonshot.cn/v1 (mainland China, new)

Users in China can select `kimi-coding-cn` via `hermes setup model`
or `--provider kimi-coding-cn`. Aliases: `kimi-cn`, `moonshot-cn`.

Also adds `api.moonshot.cn` to provider auto-detection in
model_metadata.py and trajectory_compressor.py.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@LoikStyle LoikStyle force-pushed the fix/kimi-moonshot-cn-support branch from 508fb89 to 17a7be9 Compare April 13, 2026 09:29
@LoikStyle LoikStyle changed the title fix: use moonshot.cn for Kimi provider (China accessibility) feat: add kimi-coding-cn provider for mainland China users Apr 13, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #9172 which salvaged #7637 as the base and incorporated good ideas from your PR (model_normalize, providers.py, runtime_provider, trajectory_compressor, setup.py changes). The key design difference: #9172 uses a separate KIMI_CN_API_KEY env var (matching the minimax/minimax-cn pattern) so users can have both international and China keys configured simultaneously. Thank you for the contribution @LoikStyle!

@teknium1 teknium1 closed this Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants