-
-
Notifications
You must be signed in to change notification settings - Fork 69.4k
[Bug]: Moonshot CN users get 401 after onboard — models.json uses api.moonshot.ai instead of api.moonshot.cn #32607
Description
Bug type
Behavior bug (incorrect output/state without crash)
Summary
Hi~
After running openclaw setup and choosing Moonshot CN as the provider, the agent immediately fails with HTTP 401: Invalid Authentication.
I Tried to find the reason, the root cause: openclaw.json correctly stores baseUrl: "https://api.moonshot.cn/v1", but ~/.openclaw/agents/main/agent/models.json gets baseUrl: "https://api.moonshot.ai/v1" (the international endpoint). Since CN API keys don't work on the international endpoint, all requests return 401.
The issue is in buildMoonshotProvider() in src/agents/models-config.providers.ts — it hardcodes MOONSHOT_BASE_URL (api.moonshot.ai) and resolveImplicitProviders() calls it without passing the user's configured baseUrl.
Workaround: Manually edit ~/.openclaw/agents/main/agent/models.json and change api.moonshot.ai to api.moonshot.cn.
Steps to reproduce
1.openclaw setup
2.Choose Moonshot → Moonshot CN endpoint
3.Enter a CN API key (from platform.moonshot.cn)
4.Try chatting with the agent
5.Actual: run error: HTTP 401: Invalid Authentication
Expected behavior
Agent responds normally
Actual behavior
Agent responds normally
OpenClaw version
Version: 2026.3.1
Operating system
Mac mini m4, macOS Sequoia 15.7.4 (24G517), Node 22.14.0
Install method
No response
Logs, screenshots, and evidence
Impact and severity
No response
Additional information
No response