Failed to get models: 401, message='Unauthorized', url='https://api.kimi.com/coding/v1/models'
What version of Kimi Code CLI is running?
kimi, version 1.10.0
Which open platform/subscription were you using?
Kimi Code
Which model were you using?
kimi-for-coding
What platform is your computer?
macOS 11.7.1 x86_64
What issue are you seeing?
Select a platform (↑↓ navigate, Enter select, Ctrl+C cancel):
- Kimi Code 2. Moonshot AI Open Platform (moonshot.cn) 3. Moonshot AI Open Platform (moonshot.ai) Please visit the following URL to finish authorization. Verification URL: https://www.kimi.com/code/authorize_device?user_code=XXXXXX Failed to get models: 401, message='Unauthorized', url='https://api.kimi.com/coding/v1/models'
What steps can reproduce the bug?
/login
What is the expected behavior?
No response
Additional information
No response
same, getting this now
我还以为怎么了,我也遇到这种问题了,什么时候能解决呢?
I thought something was wrong. I also encountered this problem. When will it be solved?
遇到了相同问题,怎么解决?
Encountered the same problem, how to solve it?
遇到了相同问题!就今天
Encountered the same problem! Just today
same +1
same + 10086
I’ve encountered the same issue as well.
I've encontered same error here, even tried to re-authenticate though it returns the same error, from cli and from vs code plugin trying to log back in again.
尝试手动填写coding的apikey,oauth后端可能暂时有点问题
Try to manually fill in the coding apikey. There may be a temporary problem with the oauth backend
Encountered same problem
fill the apikey manually not work, i still can't get the models
怎么解决啊遇到相同问题了
How to solve it? I encountered the same problem.
尝试手动填写coding的apikey,oauth后端可能暂时有点问题
Try to manually fill in the coding apikey. There may be a temporary problem with the oauth backend
tried that as well, same error:
Enter your API key: ************************************************************
************
Failed to get models: 401, message='Unauthorized', url='https://api.moonshot.ai/v
1/models'
Adding my detailed reproduction case - this appears to be the same issue with additional troubleshooting context.
My Environment
- OS: Windows 11 (PowerShell)
- CLI: 1.10.0 (also tested 1.9.0 - same failure)
- Install: UV (
uv tool install) - API Key: Valid and Enabled (Moderato plan, K2.5 access)
Critical Finding
API key works perfectly via direct API call:
curl.exe -H "Authorization: Bearer sk-..." https://api.kimi.com/coding/v1/models
# Returns: {"data":[{"id":"kimi-for-coding"...}]} ✅
But CLI fails to use it:
$env:KIMI_API_KEY="sk-..."
kimi
# Shows: API Key: ****** (from KIMI_API_KEY)
# Shows: Model: not set, send /login to login ❌
Symptoms
/model→No models configured, send "/login" to login/login(Option 1) → 401 Unauthorized/login(Options 2/3) → loops back to login requirementkimi web→LLM is not set--modelflag ignored
Troubleshooting Attempted
- [x] Env vars only
- [x] Config file only (
~/.kimi/config.toml) - [x] Both combined
- [x] Version downgrade to 1.9.0 (
uv tool install --force) - [x] Complete purge (
rm -rf ~/.kimi,uv cache clean) - [x] Different
KIMI_BASE_URLvalues - [x] Explicit model IDs (
kimi-k2-5,kimi-for-coding)
Root Cause Hypothesis
Circular dependency in auth initialization:
- CLI detects API key (shows
API Key: ******) - Model discovery fails silently (empty list)
- CLI demands
/logindespite having valid key - Login fails or doesn't populate models
- Loop continues
Not version-specific (both 1.9.0 and 1.10.0 broken) → suggests server-side change in last 6-12 hours broke backward compatibility.
Workaround Status
None found - complete blocker. Using web interface temporarily.
我在差不多20分钟前windows上遇到了同样的问题,这是我的问题还是kimi的问题?
I had the same problem on windows almost 20 minutes ago, is this my problem or kimi's problem?
试过了笔记本和台式机,VS Code的Kimi Code插件和Terminal环境都一样的问题,而且试过了API Key,也是一样的。典型的服务器端回报出错或者掉包。这么大面积掉包的可能性比较大吧?是不是有服务器需要重启了?【狗头】
I have tried laptops and desktops, and the Kimi Code plug-in and Terminal environment of VS Code have the same problem. I have also tried the API Key, and it is the same. Typical server side reports errors or packet drops. Is it more likely that the package will be dropped on such a large scale? Does any server need to be restarted? 【Dog Head】
试过了笔记本和台式机,VS Code的Kimi Code插件和Terminal环境都一样的问题,而且试过了API Key,也是一样的。典型的服务器端回报出错或者掉包。这么大面积掉包的可能性比较大吧?是不是有服务器需要重启了?【狗头】
I have tried laptops and desktops, and the Kimi Code plug-in and Terminal environment of VS Code have the same problem. I have also tried the API Key, and it is the same. Typical server side reports errors or packet drops. Is it more likely that the package will be dropped on such a large scale? Does any server need to be restarted? 【Dog Head】
已经恢复了
尝试手动填写coding的apikey,oauth后端可能暂时有点问题 Try to manually fill in the coding apikey. There may be a temporary problem with the oauth backend
tried that as well, same error:
Enter your API key: ************************************************************ ************ Failed to get models: 401, message='Unauthorized', url='https://api.moonshot.ai/v 1/models'
has fixed.
yup it works
同样的问题,2026.03.06仍然存在,vs code里cline用kimi2.5返回401