mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-13 02:14:32 +00:00
feat(kimi): update default model to kimi-k2-thinking-turbo
- Update base-kimi.settings.json with model fields - Update install.sh KIMI_MODEL variable - Update postinstall.js template and migration to add model fields - Migration now adds model fields instead of removing them (v5.5.0)
This commit is contained in:
1 parent
4c30cee9ff
commit
134511c38b
3 files changed
+32
-20
No files matched your search
@@ -1,7 +1,11 @@
|
|||||||
{
|
{
|
||||||
"env": {
|
"env": {
|
||||||
"ANTHROPIC_BASE_URL": "https://api.kimi.com/coding/",
|
"ANTHROPIC_BASE_URL": "https://api.kimi.com/coding/",
|
||||||
"ANTHROPIC_AUTH_TOKEN": "YOUR_KIMI_API_KEY_HERE"
|
"ANTHROPIC_AUTH_TOKEN": "YOUR_KIMI_API_KEY_HERE",
|
||||||
|
"ANTHROPIC_MODEL": "kimi-k2-thinking-turbo",
|
||||||
|
"ANTHROPIC_DEFAULT_OPUS_MODEL": "kimi-k2-thinking-turbo",
|
||||||
|
"ANTHROPIC_DEFAULT_SONNET_MODEL": "kimi-k2-thinking-turbo",
|
||||||
|
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "kimi-k2-thinking-turbo"
|
||||||
},
|
},
|
||||||
"alwaysThinkingEnabled": true
|
"alwaysThinkingEnabled": true
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,7 @@ INSTALL_DIR="${INSTALL_DIR:-$HOME/.local/bin}"
|
|||||||
CCS_DIR="$HOME/.ccs"
|
CCS_DIR="$HOME/.ccs"
|
||||||
CLAUDE_DIR="$HOME/.claude"
|
CLAUDE_DIR="$HOME/.claude"
|
||||||
GLM_MODEL="glm-4.6"
|
GLM_MODEL="glm-4.6"
|
||||||
KIMI_MODEL="kimi-for-coding"
|
KIMI_MODEL="kimi-k2-thinking-turbo"
|
||||||
|
|
||||||
# Resolve script directory (handles both file-based and piped execution)
|
# Resolve script directory (handles both file-based and piped execution)
|
||||||
if [[ -n "${BASH_SOURCE[0]:-}" ]]; then
|
if [[ -n "${BASH_SOURCE[0]:-}" ]]; then
|
||||||
|
|||||||
+26
-18
@@ -336,7 +336,11 @@ function createConfigFiles() {
|
|||||||
const kimiSettings = {
|
const kimiSettings = {
|
||||||
env: {
|
env: {
|
||||||
ANTHROPIC_BASE_URL: 'https://api.kimi.com/coding/',
|
ANTHROPIC_BASE_URL: 'https://api.kimi.com/coding/',
|
||||||
ANTHROPIC_AUTH_TOKEN: 'YOUR_KIMI_API_KEY_HERE'
|
ANTHROPIC_AUTH_TOKEN: 'YOUR_KIMI_API_KEY_HERE',
|
||||||
|
ANTHROPIC_MODEL: 'kimi-k2-thinking-turbo',
|
||||||
|
ANTHROPIC_DEFAULT_OPUS_MODEL: 'kimi-k2-thinking-turbo',
|
||||||
|
ANTHROPIC_DEFAULT_SONNET_MODEL: 'kimi-k2-thinking-turbo',
|
||||||
|
ANTHROPIC_DEFAULT_HAIKU_MODEL: 'kimi-k2-thinking-turbo'
|
||||||
},
|
},
|
||||||
alwaysThinkingEnabled: true
|
alwaysThinkingEnabled: true
|
||||||
};
|
};
|
||||||
@@ -360,12 +364,13 @@ function createConfigFiles() {
|
|||||||
// They are created on-demand when user runs `ccs gemini` or `ccs codex` for the first time
|
// They are created on-demand when user runs `ccs gemini` or `ccs codex` for the first time
|
||||||
// This prevents confusion - users need to run `--auth` first anyway
|
// This prevents confusion - users need to run `--auth` first anyway
|
||||||
|
|
||||||
// Migrate existing Kimi configs to remove deprecated model fields (v4.1.2)
|
// Migrate existing Kimi configs to use kimi-k2-thinking-turbo model (v5.5.0)
|
||||||
// Kimi API changed - model fields now cause 401 errors
|
// Kimi API now supports model specification with thinking models
|
||||||
if (fs.existsSync(kimiSettingsPath)) {
|
if (fs.existsSync(kimiSettingsPath)) {
|
||||||
try {
|
try {
|
||||||
const existing = JSON.parse(fs.readFileSync(kimiSettingsPath, 'utf8'));
|
const existing = JSON.parse(fs.readFileSync(kimiSettingsPath, 'utf8'));
|
||||||
let updated = false;
|
let updated = false;
|
||||||
|
const defaultModel = 'kimi-k2-thinking-turbo';
|
||||||
|
|
||||||
// Ensure env object exists
|
// Ensure env object exists
|
||||||
if (!existing.env) {
|
if (!existing.env) {
|
||||||
@@ -373,22 +378,27 @@ function createConfigFiles() {
|
|||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove deprecated model fields that cause 401 errors
|
// Add/update model fields to use kimi-k2-thinking-turbo
|
||||||
const deprecatedFields = [
|
const modelFields = {
|
||||||
'ANTHROPIC_MODEL',
|
ANTHROPIC_MODEL: defaultModel,
|
||||||
'ANTHROPIC_SMALL_FAST_MODEL',
|
ANTHROPIC_DEFAULT_OPUS_MODEL: defaultModel,
|
||||||
'ANTHROPIC_DEFAULT_OPUS_MODEL',
|
ANTHROPIC_DEFAULT_SONNET_MODEL: defaultModel,
|
||||||
'ANTHROPIC_DEFAULT_SONNET_MODEL',
|
ANTHROPIC_DEFAULT_HAIKU_MODEL: defaultModel
|
||||||
'ANTHROPIC_DEFAULT_HAIKU_MODEL'
|
};
|
||||||
];
|
|
||||||
|
|
||||||
for (const field of deprecatedFields) {
|
for (const [field, value] of Object.entries(modelFields)) {
|
||||||
if (existing.env[field] !== undefined) {
|
if (existing.env[field] !== value) {
|
||||||
delete existing.env[field];
|
existing.env[field] = value;
|
||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove deprecated ANTHROPIC_SMALL_FAST_MODEL if present
|
||||||
|
if (existing.env.ANTHROPIC_SMALL_FAST_MODEL !== undefined) {
|
||||||
|
delete existing.env.ANTHROPIC_SMALL_FAST_MODEL;
|
||||||
|
updated = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure required fields exist
|
// Ensure required fields exist
|
||||||
if (!existing.env.ANTHROPIC_BASE_URL) {
|
if (!existing.env.ANTHROPIC_BASE_URL) {
|
||||||
existing.env.ANTHROPIC_BASE_URL = 'https://api.kimi.com/coding/';
|
existing.env.ANTHROPIC_BASE_URL = 'https://api.kimi.com/coding/';
|
||||||
@@ -406,13 +416,11 @@ function createConfigFiles() {
|
|||||||
const tmpPath = `${kimiSettingsPath}.tmp`;
|
const tmpPath = `${kimiSettingsPath}.tmp`;
|
||||||
fs.writeFileSync(tmpPath, JSON.stringify(existing, null, 2) + '\n', 'utf8');
|
fs.writeFileSync(tmpPath, JSON.stringify(existing, null, 2) + '\n', 'utf8');
|
||||||
fs.renameSync(tmpPath, kimiSettingsPath);
|
fs.renameSync(tmpPath, kimiSettingsPath);
|
||||||
console.log('[OK] Migrated Kimi config (v4.1.2): removed deprecated model fields');
|
console.log('[OK] Migrated Kimi config (v5.5.0): updated to kimi-k2-thinking-turbo model');
|
||||||
console.log(' Kimi API no longer requires model fields (they cause 401 errors)');
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn('[!] Kimi config migration failed:', err.message);
|
console.warn('[!] Kimi config migration failed:', err.message);
|
||||||
console.warn(' Existing config preserved, but may cause 401 errors');
|
console.warn(' Existing config preserved');
|
||||||
console.warn(' Manually remove ANTHROPIC_MODEL fields from ~/.ccs/kimi.settings.json');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user