mirror of
https://github.com/tiennm99/ccs.git
synced 2026-08-11 16:24:48 +00:00
feat(glm): update default model to GLM-5 and fix all GLM pricing
- Update default GLM model from glm-4.7 to glm-5 across configs, presets, help text, and fallbacks - Add glm-5 pricing entry ($1.00/$3.20 per M tokens, OpenRouter verified) - Fix incorrect glm-4.7 pricing: $0.60/$2.20 -> $0.40/$1.50 (OpenRouter verified) - Fix incorrect glm-4.6 pricing: $0.60/$2.20 -> $0.35/$1.50 (OpenRouter verified) - Fix incorrect glm-4.5 pricing: $0.60/$2.20 -> $0.35/$1.55 (OpenRouter verified) - Keep all previous GLM model entries for backward compatibility Closes #532
This commit is contained in:
@@ -2,9 +2,9 @@
|
|||||||
"env": {
|
"env": {
|
||||||
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
|
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
|
||||||
"ANTHROPIC_AUTH_TOKEN": "YOUR_GLM_API_KEY_HERE",
|
"ANTHROPIC_AUTH_TOKEN": "YOUR_GLM_API_KEY_HERE",
|
||||||
"ANTHROPIC_MODEL": "glm-4.7",
|
"ANTHROPIC_MODEL": "glm-5",
|
||||||
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-4.7",
|
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5",
|
||||||
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-4.7",
|
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5",
|
||||||
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.7"
|
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
"env": {
|
"env": {
|
||||||
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/coding/paas/v4/chat/completions",
|
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/coding/paas/v4/chat/completions",
|
||||||
"ANTHROPIC_AUTH_TOKEN": "YOUR_GLM_API_KEY_HERE",
|
"ANTHROPIC_AUTH_TOKEN": "YOUR_GLM_API_KEY_HERE",
|
||||||
"ANTHROPIC_MODEL": "glm-4.7",
|
"ANTHROPIC_MODEL": "glm-5",
|
||||||
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-4.7",
|
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5",
|
||||||
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-4.7",
|
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5",
|
||||||
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.7",
|
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-5",
|
||||||
"ANTHROPIC_TEMPERATURE": "0.2",
|
"ANTHROPIC_TEMPERATURE": "0.2",
|
||||||
"ANTHROPIC_MAX_TOKENS": "65536",
|
"ANTHROPIC_MAX_TOKENS": "65536",
|
||||||
"MAX_THINKING_TOKENS": "32768",
|
"MAX_THINKING_TOKENS": "32768",
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
"env": {
|
"env": {
|
||||||
"ANTHROPIC_BASE_URL": "https://ollama.com",
|
"ANTHROPIC_BASE_URL": "https://ollama.com",
|
||||||
"ANTHROPIC_AUTH_TOKEN": "YOUR_OLLAMA_CLOUD_API_KEY_HERE",
|
"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_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"
|
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "minimax-m2.1:cloud"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
|||||||
description: 'Claude via Z.AI',
|
description: 'Claude via Z.AI',
|
||||||
baseUrl: 'https://api.z.ai/api/anthropic',
|
baseUrl: 'https://api.z.ai/api/anthropic',
|
||||||
defaultProfileName: 'glm',
|
defaultProfileName: 'glm',
|
||||||
defaultModel: 'glm-4.7',
|
defaultModel: 'glm-5',
|
||||||
apiKeyPlaceholder: 'ghp_...',
|
apiKeyPlaceholder: 'ghp_...',
|
||||||
apiKeyHint: 'Get your API key from Z.AI',
|
apiKeyHint: 'Get your API key from Z.AI',
|
||||||
category: 'alternative',
|
category: 'alternative',
|
||||||
@@ -77,7 +77,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
|||||||
description: 'GLM with Thinking mode support',
|
description: 'GLM with Thinking mode support',
|
||||||
baseUrl: 'https://api.z.ai/api/coding/paas/v4/chat/completions',
|
baseUrl: 'https://api.z.ai/api/coding/paas/v4/chat/completions',
|
||||||
defaultProfileName: 'glmt',
|
defaultProfileName: 'glmt',
|
||||||
defaultModel: 'glm-4.7',
|
defaultModel: 'glm-5',
|
||||||
apiKeyPlaceholder: 'ghp_...',
|
apiKeyPlaceholder: 'ghp_...',
|
||||||
apiKeyHint: 'Same API key as GLM',
|
apiKeyHint: 'Same API key as GLM',
|
||||||
category: 'alternative',
|
category: 'alternative',
|
||||||
@@ -156,10 +156,10 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
|||||||
{
|
{
|
||||||
id: 'ollama-cloud',
|
id: 'ollama-cloud',
|
||||||
name: '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',
|
baseUrl: 'https://ollama.com',
|
||||||
defaultProfileName: 'ollama-cloud',
|
defaultProfileName: 'ollama-cloud',
|
||||||
defaultModel: 'glm-4.7:cloud',
|
defaultModel: 'glm-5:cloud',
|
||||||
apiKeyPlaceholder: 'YOUR_OLLAMA_CLOUD_API_KEY',
|
apiKeyPlaceholder: 'YOUR_OLLAMA_CLOUD_API_KEY',
|
||||||
apiKeyHint: 'Get your API key at ollama.com',
|
apiKeyHint: 'Get your API key at ollama.com',
|
||||||
category: 'alternative',
|
category: 'alternative',
|
||||||
|
|||||||
+1
-1
@@ -162,7 +162,7 @@ async function execClaudeWithProxy(
|
|||||||
|
|
||||||
// 4. Spawn Claude CLI with proxy URL
|
// 4. Spawn Claude CLI with proxy URL
|
||||||
// Use model from user's settings (not hardcoded) - fixes issue #358
|
// 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 = {
|
const envVars: NodeJS.ProcessEnv = {
|
||||||
ANTHROPIC_BASE_URL: `http://127.0.0.1:${port}`,
|
ANTHROPIC_BASE_URL: `http://127.0.0.1:${port}`,
|
||||||
ANTHROPIC_AUTH_TOKEN: apiKey,
|
ANTHROPIC_AUTH_TOKEN: apiKey,
|
||||||
|
|||||||
@@ -463,7 +463,7 @@ async function showHelp(): Promise<void> {
|
|||||||
` ${color('ollama', 'command')} Ollama - Local open-source models (no API key)`
|
` ${color('ollama', 'command')} Ollama - Local open-source models (no API key)`
|
||||||
);
|
);
|
||||||
console.log(
|
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('glm', 'command')} GLM - Claude via Z.AI`);
|
||||||
console.log(` ${color('glmt', 'command')} GLMT - GLM with Thinking mode`);
|
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`],
|
[`Configure in ${dirDisplay}/*.settings.json`],
|
||||||
[
|
[
|
||||||
['ccs', 'Use default Claude account'],
|
['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 glmt', 'GLM with thinking mode'],
|
||||||
['ccs kimi', 'Kimi for Coding (API key)'],
|
['ccs kimi', 'Kimi for Coding (API key)'],
|
||||||
['ccs ollama', 'Local Ollama (http://localhost:11434)'],
|
['ccs ollama', 'Local Ollama (http://localhost:11434)'],
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ export class GlmtTransformer {
|
|||||||
type: 'message',
|
type: 'message',
|
||||||
role: 'assistant',
|
role: 'assistant',
|
||||||
content,
|
content,
|
||||||
model: openaiResponse.model || 'glm-4.7',
|
model: openaiResponse.model || 'glm-5',
|
||||||
stop_reason: this.responseBuilder.mapStopReason(choice.finish_reason || 'stop'),
|
stop_reason: this.responseBuilder.mapStopReason(choice.finish_reason || 'stop'),
|
||||||
usage: {
|
usage: {
|
||||||
input_tokens: openaiResponse.usage?.prompt_tokens || 0,
|
input_tokens: openaiResponse.usage?.prompt_tokens || 0,
|
||||||
@@ -131,7 +131,7 @@ export class GlmtTransformer {
|
|||||||
type: 'message',
|
type: 'message',
|
||||||
role: 'assistant',
|
role: 'assistant',
|
||||||
content: [{ type: 'text', text: '[Transformation Error] ' + err.message }],
|
content: [{ type: 'text', text: '[Transformation Error] ' + err.message }],
|
||||||
model: 'glm-4.7',
|
model: 'glm-5',
|
||||||
stop_reason: 'end_turn',
|
stop_reason: 'end_turn',
|
||||||
usage: { input_tokens: 0, output_tokens: 0 },
|
usage: { input_tokens: 0, output_tokens: 0 },
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export class ResponseBuilder {
|
|||||||
type: 'message',
|
type: 'message',
|
||||||
role: accumulator.getRole(),
|
role: accumulator.getRole(),
|
||||||
content: [],
|
content: [],
|
||||||
model: accumulator.getModel() || 'glm-4.7',
|
model: accumulator.getModel() || 'glm-5',
|
||||||
stop_reason: null,
|
stop_reason: null,
|
||||||
usage: {
|
usage: {
|
||||||
input_tokens: accumulator.getInputTokens(),
|
input_tokens: accumulator.getInputTokens(),
|
||||||
|
|||||||
@@ -337,7 +337,7 @@ export function getModelDisplayName(profile: string): string {
|
|||||||
const model = settings.env?.ANTHROPIC_MODEL;
|
const model = settings.env?.ANTHROPIC_MODEL;
|
||||||
|
|
||||||
if (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
|
return model
|
||||||
.split('-')
|
.split('-')
|
||||||
.map((part) => part.toUpperCase())
|
.map((part) => part.toUpperCase())
|
||||||
|
|||||||
@@ -410,31 +410,37 @@ 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': {
|
'glm-5': {
|
||||||
inputPerMillion: 0.6,
|
inputPerMillion: 1.0,
|
||||||
outputPerMillion: 2.2,
|
outputPerMillion: 3.2,
|
||||||
cacheCreationPerMillion: 0.0,
|
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': {
|
'glm-4.6': {
|
||||||
inputPerMillion: 0.6,
|
inputPerMillion: 0.35,
|
||||||
outputPerMillion: 2.2,
|
outputPerMillion: 1.5,
|
||||||
cacheCreationPerMillion: 0.0,
|
cacheCreationPerMillion: 0.0,
|
||||||
cacheReadPerMillion: 0.11,
|
cacheReadPerMillion: 0.175,
|
||||||
},
|
},
|
||||||
'glm-4.6-cc-max': {
|
'glm-4.6-cc-max': {
|
||||||
inputPerMillion: 0.6,
|
inputPerMillion: 0.35,
|
||||||
outputPerMillion: 2.2,
|
outputPerMillion: 1.5,
|
||||||
cacheCreationPerMillion: 0.0,
|
cacheCreationPerMillion: 0.0,
|
||||||
cacheReadPerMillion: 0.11,
|
cacheReadPerMillion: 0.175,
|
||||||
},
|
},
|
||||||
'glm-4.5': {
|
'glm-4.5': {
|
||||||
inputPerMillion: 0.6,
|
inputPerMillion: 0.35,
|
||||||
outputPerMillion: 2.2,
|
outputPerMillion: 1.55,
|
||||||
cacheCreationPerMillion: 0.0,
|
cacheCreationPerMillion: 0.0,
|
||||||
cacheReadPerMillion: 0.11,
|
cacheReadPerMillion: 0.175,
|
||||||
},
|
},
|
||||||
'glm-4.5-air': {
|
'glm-4.5-air': {
|
||||||
inputPerMillion: 0.2,
|
inputPerMillion: 0.2,
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ module.exports = {
|
|||||||
env: {
|
env: {
|
||||||
ANTHROPIC_BASE_URL: "https://api.z.ai/api/anthropic",
|
ANTHROPIC_BASE_URL: "https://api.z.ai/api/anthropic",
|
||||||
ANTHROPIC_AUTH_TOKEN: "your_api_key_here",
|
ANTHROPIC_AUTH_TOKEN: "your_api_key_here",
|
||||||
ANTHROPIC_MODEL: "glm-4.7",
|
ANTHROPIC_MODEL: "glm-5",
|
||||||
ANTHROPIC_DEFAULT_OPUS_MODEL: "glm-4.7",
|
ANTHROPIC_DEFAULT_OPUS_MODEL: "glm-5",
|
||||||
ANTHROPIC_DEFAULT_SONNET_MODEL: "glm-4.7",
|
ANTHROPIC_DEFAULT_SONNET_MODEL: "glm-5",
|
||||||
ANTHROPIC_DEFAULT_HAIKU_MODEL: "glm-4.7"
|
ANTHROPIC_DEFAULT_HAIKU_MODEL: "glm-5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
|||||||
defaultProfileName: 'glm',
|
defaultProfileName: 'glm',
|
||||||
badge: 'Z.AI',
|
badge: 'Z.AI',
|
||||||
icon: '/icons/zai.svg',
|
icon: '/icons/zai.svg',
|
||||||
defaultModel: 'glm-4.7',
|
defaultModel: 'glm-5',
|
||||||
requiresApiKey: true,
|
requiresApiKey: true,
|
||||||
apiKeyPlaceholder: 'ghp_...',
|
apiKeyPlaceholder: 'ghp_...',
|
||||||
apiKeyHint: 'Get your API key from Z.AI',
|
apiKeyHint: 'Get your API key from Z.AI',
|
||||||
@@ -83,7 +83,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
|||||||
defaultProfileName: 'glmt',
|
defaultProfileName: 'glmt',
|
||||||
badge: 'Thinking',
|
badge: 'Thinking',
|
||||||
icon: '/icons/zai.svg',
|
icon: '/icons/zai.svg',
|
||||||
defaultModel: 'glm-4.7',
|
defaultModel: 'glm-5',
|
||||||
requiresApiKey: true,
|
requiresApiKey: true,
|
||||||
apiKeyPlaceholder: 'ghp_...',
|
apiKeyPlaceholder: 'ghp_...',
|
||||||
apiKeyHint: 'Same API key as GLM',
|
apiKeyHint: 'Same API key as GLM',
|
||||||
@@ -162,12 +162,12 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
|||||||
{
|
{
|
||||||
id: 'ollama-cloud',
|
id: 'ollama-cloud',
|
||||||
name: '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',
|
baseUrl: 'https://ollama.com',
|
||||||
defaultProfileName: 'ollama-cloud',
|
defaultProfileName: 'ollama-cloud',
|
||||||
badge: 'Cloud',
|
badge: 'Cloud',
|
||||||
icon: '/icons/ollama.svg',
|
icon: '/icons/ollama.svg',
|
||||||
defaultModel: 'glm-4.7:cloud',
|
defaultModel: 'glm-5:cloud',
|
||||||
requiresApiKey: true,
|
requiresApiKey: true,
|
||||||
apiKeyPlaceholder: 'YOUR_OLLAMA_CLOUD_API_KEY',
|
apiKeyPlaceholder: 'YOUR_OLLAMA_CLOUD_API_KEY',
|
||||||
apiKeyHint: 'Get your API key at ollama.com',
|
apiKeyHint: 'Get your API key at ollama.com',
|
||||||
|
|||||||
Reference in New Issue
Block a user