TIL: Claude Code with Chinese LLMs
I was playing around with Chinese Large Language Models (LLMs). Both Kimi K2 and GLM-4.5 feel a bit slower than Claude Sonnet 4 when I’m using Claude Code, though GLM-4.5 definitely feels more responsive than Kimi K2. I haven’t done enough programming with them yet to really compare how they perform, but I can tell GLM-4.5 is way snappier ⚡.
What’s interesting is the pricing - they’re both way more affordable than Claude. GLM-4.5 is $3/month (first month), $6/month thereafter compared to Claude Pro’s $20/month. Kimi K2 uses API-based pricing though, so that could add up depending on how much I use it.
Here’s an example of the cost output from using Kimi K2:
> /cost
⎿ Total cost: $9.22 (costs may be inaccurate due to usage of unknown models)
Total duration (API): 14m 6.5s
Total duration (wall): 30m 52.5s
Total code changes: 269 lines added, 43 lines removed
Usage by model:
claude-3-5-haiku: 21.9k input, 567 output, 0 cache read, 0 cache write
kimi-k2-0905-preview: 3.0m input, 8.6k output, 0 cache read, 0 cache write
Here’s what I have inside my ~/.config/fish/functions/
directory:
# kimi.fish
function kimi
if test -z "$MOONSHOT_API_KEY" # $ZAI_API_KEY
echo "Error: MOONSHOT_API_KEY environment variable is not set"
return 1
end
set -gx ANTHROPIC_BASE_URL https://api.moonshot.ai/anthropic # https://api.z.ai/api/anthropic
set -gx ANTHROPIC_AUTH_TOKEN $MOONSHOT_API_KEY # $ZAI_API_KEY
claude --model kimi-k2-0905-preview $argv # glm-4.5 for GLM-4.5
end
# zai.fish would be identical except for the commented differences above
Since I’m still new to the Fish shell, I also learned today that I can set the $MOONSHOT_API_KEY
and $ZAI_API_KEY
variables without exposing them in env
.
I have a secrets.fish
file recommended by Claude Sonnet 4 inside ~/.config/fish/conf.d
:
# Secret API keys - universal but not exported (won't show in `env`)
set -U MOONSHOT_API_KEY value
set -U ZAI_API_KEY value