mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 00:22:34 +00:00
Merge pull request #534 from kaitranntt/dev
feat(glm): update default model to GLM-5 and fix all GLM pricing
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
"env": {
|
||||
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
|
||||
"ANTHROPIC_AUTH_TOKEN": "YOUR_GLM_API_KEY_HERE",
|
||||
"ANTHROPIC_MODEL": "glm-4.7",
|
||||
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-4.7",
|
||||
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-4.7",
|
||||
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.7"
|
||||
"ANTHROPIC_MODEL": "glm-5",
|
||||
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5",
|
||||
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5",
|
||||
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
"env": {
|
||||
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/coding/paas/v4/chat/completions",
|
||||
"ANTHROPIC_AUTH_TOKEN": "YOUR_GLM_API_KEY_HERE",
|
||||
"ANTHROPIC_MODEL": "glm-4.7",
|
||||
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-4.7",
|
||||
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-4.7",
|
||||
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.7",
|
||||
"ANTHROPIC_MODEL": "glm-5",
|
||||
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5",
|
||||
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5",
|
||||
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-5",
|
||||
"ANTHROPIC_TEMPERATURE": "0.2",
|
||||
"ANTHROPIC_MAX_TOKENS": "65536",
|
||||
"MAX_THINKING_TOKENS": "32768",
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
"env": {
|
||||
"ANTHROPIC_BASE_URL": "https://ollama.com",
|
||||
"ANTHROPIC_AUTH_TOKEN": "YOUR_OLLAMA_CLOUD_API_KEY_HERE",
|
||||
"ANTHROPIC_MODEL": "glm-4.7:cloud",
|
||||
"ANTHROPIC_MODEL": "glm-5:cloud",
|
||||
"ANTHROPIC_DEFAULT_OPUS_MODEL": "qwen3-coder:480b",
|
||||
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-4.7:cloud",
|
||||
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5:cloud",
|
||||
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "minimax-m2.1:cloud"
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@kaitranntt/ccs",
|
||||
"version": "7.42.0",
|
||||
"version": "7.42.0-dev.1",
|
||||
"description": "Claude Code Switch - Instant profile switching between Claude Sonnet 4.5 and GLM 4.6",
|
||||
"keywords": [
|
||||
"cli",
|
||||
|
||||
@@ -65,7 +65,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
||||
description: 'Claude via Z.AI',
|
||||
baseUrl: 'https://api.z.ai/api/anthropic',
|
||||
defaultProfileName: 'glm',
|
||||
defaultModel: 'glm-4.7',
|
||||
defaultModel: 'glm-5',
|
||||
apiKeyPlaceholder: 'ghp_...',
|
||||
apiKeyHint: 'Get your API key from Z.AI',
|
||||
category: 'alternative',
|
||||
@@ -77,7 +77,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
||||
description: 'GLM with Thinking mode support',
|
||||
baseUrl: 'https://api.z.ai/api/coding/paas/v4/chat/completions',
|
||||
defaultProfileName: 'glmt',
|
||||
defaultModel: 'glm-4.7',
|
||||
defaultModel: 'glm-5',
|
||||
apiKeyPlaceholder: 'ghp_...',
|
||||
apiKeyHint: 'Same API key as GLM',
|
||||
category: 'alternative',
|
||||
@@ -156,10 +156,10 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
||||
{
|
||||
id: 'ollama-cloud',
|
||||
name: 'Ollama Cloud',
|
||||
description: 'Ollama cloud models via direct API (glm-4.7:cloud, minimax-m2.1:cloud)',
|
||||
description: 'Ollama cloud models via direct API (glm-5:cloud, minimax-m2.1:cloud)',
|
||||
baseUrl: 'https://ollama.com',
|
||||
defaultProfileName: 'ollama-cloud',
|
||||
defaultModel: 'glm-4.7:cloud',
|
||||
defaultModel: 'glm-5:cloud',
|
||||
apiKeyPlaceholder: 'YOUR_OLLAMA_CLOUD_API_KEY',
|
||||
apiKeyHint: 'Get your API key at ollama.com',
|
||||
category: 'alternative',
|
||||
|
||||
+1
-1
@@ -162,7 +162,7 @@ async function execClaudeWithProxy(
|
||||
|
||||
// 4. Spawn Claude CLI with proxy URL
|
||||
// Use model from user's settings (not hardcoded) - fixes issue #358
|
||||
const configuredModel = envData['ANTHROPIC_MODEL'] || 'glm-4.7';
|
||||
const configuredModel = envData['ANTHROPIC_MODEL'] || 'glm-5';
|
||||
const envVars: NodeJS.ProcessEnv = {
|
||||
ANTHROPIC_BASE_URL: `http://127.0.0.1:${port}`,
|
||||
ANTHROPIC_AUTH_TOKEN: apiKey,
|
||||
|
||||
@@ -463,7 +463,7 @@ async function showHelp(): Promise<void> {
|
||||
` ${color('ollama', 'command')} Ollama - Local open-source models (no API key)`
|
||||
);
|
||||
console.log(
|
||||
` ${color('ollama-cloud', 'command')} Ollama Cloud - glm-4.7:cloud, qwen3-coder:480b`
|
||||
` ${color('ollama-cloud', 'command')} Ollama Cloud - glm-5:cloud, qwen3-coder:480b`
|
||||
);
|
||||
console.log(` ${color('glm', 'command')} GLM - Claude via Z.AI`);
|
||||
console.log(` ${color('glmt', 'command')} GLMT - GLM with Thinking mode`);
|
||||
|
||||
@@ -129,7 +129,7 @@ Run ${color('ccs config', 'command')} for web dashboard`.trim();
|
||||
[`Configure in ${dirDisplay}/*.settings.json`],
|
||||
[
|
||||
['ccs', 'Use default Claude account'],
|
||||
['ccs glm', 'GLM 4.6 (API key required)'],
|
||||
['ccs glm', 'GLM 5 (API key required)'],
|
||||
['ccs glmt', 'GLM with thinking mode'],
|
||||
['ccs kimi', 'Kimi for Coding (API key)'],
|
||||
['ccs ollama', 'Local Ollama (http://localhost:11434)'],
|
||||
@@ -227,7 +227,7 @@ Run ${color('ccs config', 'command')} for web dashboard`.trim();
|
||||
// Delegation
|
||||
printSubSection('Delegation (inside Claude Code CLI)', [
|
||||
['/ccs "task"', 'Delegate task (auto-selects profile)'],
|
||||
['/ccs --glm "task"', 'Force GLM-4.6 for simple tasks'],
|
||||
['/ccs --glm "task"', 'Force GLM-5 for simple tasks'],
|
||||
['/ccs --kimi "task"', 'Force Kimi for long context'],
|
||||
['/ccs:continue "follow-up"', 'Continue last delegation session'],
|
||||
]);
|
||||
|
||||
@@ -113,7 +113,7 @@ export class GlmtTransformer {
|
||||
type: 'message',
|
||||
role: 'assistant',
|
||||
content,
|
||||
model: openaiResponse.model || 'glm-4.7',
|
||||
model: openaiResponse.model || 'glm-5',
|
||||
stop_reason: this.responseBuilder.mapStopReason(choice.finish_reason || 'stop'),
|
||||
usage: {
|
||||
input_tokens: openaiResponse.usage?.prompt_tokens || 0,
|
||||
@@ -131,7 +131,7 @@ export class GlmtTransformer {
|
||||
type: 'message',
|
||||
role: 'assistant',
|
||||
content: [{ type: 'text', text: '[Transformation Error] ' + err.message }],
|
||||
model: 'glm-4.7',
|
||||
model: 'glm-5',
|
||||
stop_reason: 'end_turn',
|
||||
usage: { input_tokens: 0, output_tokens: 0 },
|
||||
};
|
||||
|
||||
@@ -32,7 +32,7 @@ export class ResponseBuilder {
|
||||
type: 'message',
|
||||
role: accumulator.getRole(),
|
||||
content: [],
|
||||
model: accumulator.getModel() || 'glm-4.7',
|
||||
model: accumulator.getModel() || 'glm-5',
|
||||
stop_reason: null,
|
||||
usage: {
|
||||
input_tokens: accumulator.getInputTokens(),
|
||||
|
||||
@@ -337,7 +337,7 @@ export function getModelDisplayName(profile: string): string {
|
||||
const model = settings.env?.ANTHROPIC_MODEL;
|
||||
|
||||
if (model) {
|
||||
// Format: 'glm-4.7' -> 'GLM-4.7' (uppercase letters, preserve numbers)
|
||||
// Format: 'glm-5' -> 'GLM-5' (uppercase letters, preserve numbers)
|
||||
return model
|
||||
.split('-')
|
||||
.map((part) => part.toUpperCase())
|
||||
|
||||
@@ -410,37 +410,43 @@ const PRICING_REGISTRY: Record<string, ModelPricing> = {
|
||||
},
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// GLM Models (Zhipu AI / Z.AI) - Source: better-ccusage
|
||||
// GLM Models (Zhipu AI / Z.AI) - Source: OpenRouter verified pricing
|
||||
// ---------------------------------------------------------------------------
|
||||
'glm-4.7': {
|
||||
inputPerMillion: 0.6,
|
||||
outputPerMillion: 2.2,
|
||||
'glm-5': {
|
||||
inputPerMillion: 1.0,
|
||||
outputPerMillion: 3.2,
|
||||
cacheCreationPerMillion: 0.0,
|
||||
cacheReadPerMillion: 0.11,
|
||||
cacheReadPerMillion: 0.2,
|
||||
},
|
||||
'glm-4.7': {
|
||||
inputPerMillion: 0.4,
|
||||
outputPerMillion: 1.5,
|
||||
cacheCreationPerMillion: 0.0,
|
||||
cacheReadPerMillion: 0.2,
|
||||
},
|
||||
'glm-4.6': {
|
||||
inputPerMillion: 0.6,
|
||||
outputPerMillion: 2.2,
|
||||
inputPerMillion: 0.35,
|
||||
outputPerMillion: 1.5,
|
||||
cacheCreationPerMillion: 0.0,
|
||||
cacheReadPerMillion: 0.11,
|
||||
cacheReadPerMillion: 0.175,
|
||||
},
|
||||
'glm-4.6-cc-max': {
|
||||
inputPerMillion: 0.6,
|
||||
outputPerMillion: 2.2,
|
||||
inputPerMillion: 0.35,
|
||||
outputPerMillion: 1.5,
|
||||
cacheCreationPerMillion: 0.0,
|
||||
cacheReadPerMillion: 0.11,
|
||||
cacheReadPerMillion: 0.175,
|
||||
},
|
||||
'glm-4.5': {
|
||||
inputPerMillion: 0.6,
|
||||
outputPerMillion: 2.2,
|
||||
inputPerMillion: 0.35,
|
||||
outputPerMillion: 1.55,
|
||||
cacheCreationPerMillion: 0.0,
|
||||
cacheReadPerMillion: 0.11,
|
||||
cacheReadPerMillion: 0.175,
|
||||
},
|
||||
'glm-4.5-air': {
|
||||
inputPerMillion: 0.2,
|
||||
outputPerMillion: 1.1,
|
||||
inputPerMillion: 0.13,
|
||||
outputPerMillion: 0.85,
|
||||
cacheCreationPerMillion: 0.0,
|
||||
cacheReadPerMillion: 0.03,
|
||||
cacheReadPerMillion: 0.025,
|
||||
},
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -35,10 +35,10 @@ module.exports = {
|
||||
env: {
|
||||
ANTHROPIC_BASE_URL: "https://api.z.ai/api/anthropic",
|
||||
ANTHROPIC_AUTH_TOKEN: "your_api_key_here",
|
||||
ANTHROPIC_MODEL: "glm-4.7",
|
||||
ANTHROPIC_DEFAULT_OPUS_MODEL: "glm-4.7",
|
||||
ANTHROPIC_DEFAULT_SONNET_MODEL: "glm-4.7",
|
||||
ANTHROPIC_DEFAULT_HAIKU_MODEL: "glm-4.7"
|
||||
ANTHROPIC_MODEL: "glm-5",
|
||||
ANTHROPIC_DEFAULT_OPUS_MODEL: "glm-5",
|
||||
ANTHROPIC_DEFAULT_SONNET_MODEL: "glm-5",
|
||||
ANTHROPIC_DEFAULT_HAIKU_MODEL: "glm-5"
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
||||
defaultProfileName: 'glm',
|
||||
badge: 'Z.AI',
|
||||
icon: '/icons/zai.svg',
|
||||
defaultModel: 'glm-4.7',
|
||||
defaultModel: 'glm-5',
|
||||
requiresApiKey: true,
|
||||
apiKeyPlaceholder: 'ghp_...',
|
||||
apiKeyHint: 'Get your API key from Z.AI',
|
||||
@@ -83,7 +83,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
||||
defaultProfileName: 'glmt',
|
||||
badge: 'Thinking',
|
||||
icon: '/icons/zai.svg',
|
||||
defaultModel: 'glm-4.7',
|
||||
defaultModel: 'glm-5',
|
||||
requiresApiKey: true,
|
||||
apiKeyPlaceholder: 'ghp_...',
|
||||
apiKeyHint: 'Same API key as GLM',
|
||||
@@ -162,12 +162,12 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
||||
{
|
||||
id: 'ollama-cloud',
|
||||
name: 'Ollama Cloud',
|
||||
description: 'Ollama cloud models via direct API (glm-4.7:cloud, minimax-m2.1:cloud)',
|
||||
description: 'Ollama cloud models via direct API (glm-5:cloud, minimax-m2.1:cloud)',
|
||||
baseUrl: 'https://ollama.com',
|
||||
defaultProfileName: 'ollama-cloud',
|
||||
badge: 'Cloud',
|
||||
icon: '/icons/ollama.svg',
|
||||
defaultModel: 'glm-4.7:cloud',
|
||||
defaultModel: 'glm-5:cloud',
|
||||
requiresApiKey: true,
|
||||
apiKeyPlaceholder: 'YOUR_OLLAMA_CLOUD_API_KEY',
|
||||
apiKeyHint: 'Get your API key at ollama.com',
|
||||
|
||||
Reference in New Issue
Block a user