mirror of
https://github.com/tiennm99/ccs.git
synced 2026-08-13 02:22:08 +00:00
fix(kimi): resolve API 401 errors from deprecated model fields
- Remove 5 deprecated model fields from Kimi settings causing auth failures - Update config/base-kimi.settings.json template with clean configuration - Add automatic migration in scripts/postinstall.js to remove deprecated fields - Preserve user API keys and custom settings during migration - Update CHANGELOG.md with v4.1.1 and v4.1.2 entries - Bump version to 4.1.2 across all files and installers Fixes authentication issues with Moonshot AI (Kimi) API due to deprecated model parameters that are now rejected by the service.
This commit is contained in:
@@ -2,6 +2,37 @@
|
||||
|
||||
Format: [Keep a Changelog](https://keepachangelog.com/)
|
||||
|
||||
## [4.1.2] - 2025-11-16
|
||||
|
||||
### Fixed
|
||||
- **Kimi API 401 errors** caused by deprecated model fields
|
||||
- Removed `ANTHROPIC_MODEL`, `ANTHROPIC_SMALL_FAST_MODEL`, `ANTHROPIC_DEFAULT_OPUS_MODEL`, `ANTHROPIC_DEFAULT_SONNET_MODEL`, `ANTHROPIC_DEFAULT_HAIKU_MODEL` from Kimi settings
|
||||
- Kimi API update now rejects requests with these fields (previously optional, now break authentication)
|
||||
- Automatic migration removes deprecated fields from existing `~/.ccs/kimi.settings.json`
|
||||
- Preserves user API keys and custom settings during migration
|
||||
- Updated `config/base-kimi.settings.json` template
|
||||
- Users experiencing 401 errors will be automatically fixed on next install/update
|
||||
|
||||
### Changed
|
||||
- Kimi settings now minimal: only `ANTHROPIC_BASE_URL` and `ANTHROPIC_AUTH_TOKEN` required
|
||||
|
||||
---
|
||||
|
||||
## [4.1.1] - 2025-11-16
|
||||
|
||||
### Fixed
|
||||
- **npm install fails to copy .claude/ directory** to `~/.ccs/.claude/`
|
||||
- Error: "[!] CCS .claude/ directory not found, skipping symlink installation"
|
||||
- Created `bin/utils/claude-dir-installer.js` utility to copy `.claude/` from package
|
||||
- Updated `scripts/postinstall.js` to copy `.claude/` before creating symlinks
|
||||
- Updated `ccs update` command to re-install `.claude/` directory
|
||||
- Supports Node.js 14+ with fallback for versions < 16.7.0
|
||||
|
||||
### Added
|
||||
- `ClaudeDirInstaller` utility class for managing `.claude/` directory installation
|
||||
|
||||
---
|
||||
|
||||
## [4.1.0] - 2025-11-16
|
||||
|
||||
### Added
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
{
|
||||
"env": {
|
||||
"ANTHROPIC_BASE_URL": "https://api.kimi.com/coding/",
|
||||
"ANTHROPIC_AUTH_TOKEN": "YOUR_KIMI_API_KEY_HERE",
|
||||
"ANTHROPIC_MODEL": "kimi-for-coding",
|
||||
"ANTHROPIC_SMALL_FAST_MODEL": "kimi-for-coding",
|
||||
"ANTHROPIC_DEFAULT_OPUS_MODEL": "kimi-for-coding",
|
||||
"ANTHROPIC_DEFAULT_SONNET_MODEL": "kimi-for-coding",
|
||||
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "kimi-for-coding"
|
||||
"ANTHROPIC_AUTH_TOKEN": "YOUR_KIMI_API_KEY_HERE"
|
||||
},
|
||||
"alwaysThinkingEnabled": true
|
||||
}
|
||||
@@ -31,7 +31,7 @@ $InstallMethod = if ($ScriptDir -and ((Test-Path "$ScriptDir\lib\ccs.ps1") -or (
|
||||
# IMPORTANT: Update this version when releasing new versions!
|
||||
# This hardcoded version is used for standalone installations (irm | iex)
|
||||
# For git installations, VERSION file is read if available
|
||||
$CcsVersion = "4.1.1"
|
||||
$CcsVersion = "4.1.2"
|
||||
|
||||
# Try to read VERSION file for git installations
|
||||
if ($ScriptDir) {
|
||||
|
||||
@@ -32,7 +32,7 @@ fi
|
||||
# IMPORTANT: Update this version when releasing new versions!
|
||||
# This hardcoded version is used for standalone installations (curl | bash)
|
||||
# For git installations, VERSION file is read if available
|
||||
CCS_VERSION="4.1.1"
|
||||
CCS_VERSION="4.1.2"
|
||||
|
||||
# Try to read VERSION file for git installations
|
||||
if [[ -f "$SCRIPT_DIR/VERSION" ]]; then
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
set -euo pipefail
|
||||
|
||||
# Version (updated by scripts/bump-version.sh)
|
||||
CCS_VERSION="4.1.1"
|
||||
CCS_VERSION="4.1.2"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
readonly CONFIG_FILE="${CCS_CONFIG:-$HOME/.ccs/config.json}"
|
||||
readonly PROFILES_JSON="$HOME/.ccs/profiles.json"
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ param(
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
# Version (updated by scripts/bump-version.sh)
|
||||
$CcsVersion = "4.1.1"
|
||||
$CcsVersion = "4.1.2"
|
||||
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$ConfigFile = if ($env:CCS_CONFIG) { $env:CCS_CONFIG } else { "$env:USERPROFILE\.ccs\config.json" }
|
||||
$ProfilesJson = "$env:USERPROFILE\.ccs\profiles.json"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@kaitranntt/ccs",
|
||||
"version": "4.1.1",
|
||||
"version": "4.1.2",
|
||||
"description": "Claude Code Switch - Instant profile switching between Claude Sonnet 4.5 and GLM 4.6",
|
||||
"keywords": [
|
||||
"cli",
|
||||
|
||||
+57
-6
@@ -284,12 +284,7 @@ function createConfigFiles() {
|
||||
const kimiSettings = {
|
||||
env: {
|
||||
ANTHROPIC_BASE_URL: 'https://api.kimi.com/coding/',
|
||||
ANTHROPIC_AUTH_TOKEN: 'YOUR_KIMI_API_KEY_HERE',
|
||||
ANTHROPIC_MODEL: 'kimi-for-coding',
|
||||
ANTHROPIC_SMALL_FAST_MODEL: 'kimi-for-coding',
|
||||
ANTHROPIC_DEFAULT_OPUS_MODEL: 'kimi-for-coding',
|
||||
ANTHROPIC_DEFAULT_SONNET_MODEL: 'kimi-for-coding',
|
||||
ANTHROPIC_DEFAULT_HAIKU_MODEL: 'kimi-for-coding'
|
||||
ANTHROPIC_AUTH_TOKEN: 'YOUR_KIMI_API_KEY_HERE'
|
||||
},
|
||||
alwaysThinkingEnabled: true
|
||||
};
|
||||
@@ -309,6 +304,62 @@ function createConfigFiles() {
|
||||
console.log('[OK] Kimi profile exists: ~/.ccs/kimi.settings.json (preserved)');
|
||||
}
|
||||
|
||||
// Migrate existing Kimi configs to remove deprecated model fields (v4.1.2)
|
||||
// Kimi API changed - model fields now cause 401 errors
|
||||
if (fs.existsSync(kimiSettingsPath)) {
|
||||
try {
|
||||
const existing = JSON.parse(fs.readFileSync(kimiSettingsPath, 'utf8'));
|
||||
let updated = false;
|
||||
|
||||
// Ensure env object exists
|
||||
if (!existing.env) {
|
||||
existing.env = {};
|
||||
updated = true;
|
||||
}
|
||||
|
||||
// Remove deprecated model fields that cause 401 errors
|
||||
const deprecatedFields = [
|
||||
'ANTHROPIC_MODEL',
|
||||
'ANTHROPIC_SMALL_FAST_MODEL',
|
||||
'ANTHROPIC_DEFAULT_OPUS_MODEL',
|
||||
'ANTHROPIC_DEFAULT_SONNET_MODEL',
|
||||
'ANTHROPIC_DEFAULT_HAIKU_MODEL'
|
||||
];
|
||||
|
||||
for (const field of deprecatedFields) {
|
||||
if (existing.env[field] !== undefined) {
|
||||
delete existing.env[field];
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure required fields exist
|
||||
if (!existing.env.ANTHROPIC_BASE_URL) {
|
||||
existing.env.ANTHROPIC_BASE_URL = 'https://api.kimi.com/coding/';
|
||||
updated = true;
|
||||
}
|
||||
|
||||
// Add alwaysThinkingEnabled if missing
|
||||
if (existing.alwaysThinkingEnabled === undefined) {
|
||||
existing.alwaysThinkingEnabled = true;
|
||||
updated = true;
|
||||
}
|
||||
|
||||
// Write back if updated
|
||||
if (updated) {
|
||||
const tmpPath = `${kimiSettingsPath}.tmp`;
|
||||
fs.writeFileSync(tmpPath, JSON.stringify(existing, null, 2) + '\n', 'utf8');
|
||||
fs.renameSync(tmpPath, kimiSettingsPath);
|
||||
console.log('[OK] Migrated Kimi config (v4.1.2): removed deprecated model fields');
|
||||
console.log(' Kimi API no longer requires model fields (they cause 401 errors)');
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('[!] Kimi config migration failed:', err.message);
|
||||
console.warn(' Existing config preserved, but may cause 401 errors');
|
||||
console.warn(' Manually remove ANTHROPIC_MODEL fields from ~/.ccs/kimi.settings.json');
|
||||
}
|
||||
}
|
||||
|
||||
// Copy shell completion files to ~/.ccs/completions/
|
||||
const completionsDir = path.join(ccsDir, 'completions');
|
||||
const scriptsCompletionDir = path.join(__dirname, '../scripts/completion');
|
||||
|
||||
Reference in New Issue
Block a user