问题: 使用不同 API 时,Claude Code 仍显示默认模型(如 Sonnet 4.5)
原因:
ai-claude-start设置环境变量(ANTHROPIC_BASE_URL和ANTHROPIC_AUTH_TOKEN)- Claude Code 使用这些环境变量连接到正确的 API
- 但是模型选择需要通过
--model参数指定
解决方案: v1.0.3 新增模型配置功能,自动传递 --model 参数
当你创建或使用 profile 时,工具会:
- 读取 profile 的 model 配置
- 自动添加
--model <模型名>参数 - 传递给 Claude CLI
如果你已有配置,需要重新创建以添加模型:
# 删除旧配置
ai-claude-start delete "BigModel (智谱)"
# 重新创建
ai-claude-start setup
? Choose a profile type: BigModel (智谱)
? Profile name: bigmodel
? Model name (default: glm-4-plus): glm-4-plus ← 按 Enter 使用默认
? Enter your ANTHROPIC_AUTH_TOKEN: ****************
✅ Profile "bigmodel" saved successfully!ai-claude-start list
📋 Available Profiles:
✓ [default] bigmodel
URL: https://open.bigmodel.cn/api/anthropic
Model: glm-4-plus ← 现在显示模型配置
Token: ✓claude-start bigmodel
🚀 Launching with profile: bigmodel
Model: glm-4-plus ← 显示使用的模型
╭─── Claude Code v2.0.14 ───────────────────────────────────────────╮
│ GLM-4-Plus · API Usage Billing ← 现在是正确的模型 │
│ /Users/guohao/Documents/code/test-claude │ │
╰────────────────────────────────────────────────────────────────────╯模型: claude-sonnet-4-5-20250929
说明: Claude Sonnet 4.5(最新版本)
模型: moonshot-v1-8k
说明: Moonshot V1 8K 上下文
模型: glm-4-plus
说明: 智谱 GLM-4-Plus(128K 上下文)
ai-claude-start setup
? Choose a profile type: Custom
? Profile name: my-custom
? Base URL: https://my-api.com
? Model name (optional): my-custom-model-name ← 输入模型名
? Enter your ANTHROPIC_AUTH_TOKEN: ****************ai-claude-start setup
? Choose a profile type: BigModel (智谱)
? Profile name: bigmodel-turbo
? Model name (default: glm-4-plus): glm-4-flash ← 修改为其他模型
? Enter your ANTHROPIC_AUTH_TOKEN: ****************即使 profile 配置了模型,你也可以在命令行覆盖:
# Profile 配置: glm-4-plus
claude-start bigmodel --model glm-4-flash
# 实际使用: glm-4-flash(命令行参数优先)如果不想自动添加 --model,在设置时留空:
? Model name (default: glm-4-plus): [直接按 Enter 留空]claude-sonnet-4-5-20250929 # Sonnet 4.5
claude-3-5-sonnet-20241022 # Sonnet 3.5
claude-3-opus-20240229 # Opus 3
claude-3-haiku-20240307 # Haiku 3
moonshot-v1-8k # 8K 上下文
moonshot-v1-32k # 32K 上下文
moonshot-v1-128k # 128K 上下文
glm-4-plus # GLM-4-Plus (128K)
glm-4 # GLM-4 标准版
glm-4-flash # GLM-4-Flash(快速版)
glm-4-air # GLM-4-Air(轻量版)
# 创建配置
$ ai-claude-start setup
? Choose a profile type: BigModel (智谱)
? Profile name: bigmodel
? Model name (default: glm-4-plus): ← 按 Enter 使用默认
? Enter your ANTHROPIC_AUTH_TOKEN: ****************
# 使用
$ claude-start bigmodel
🚀 Launching with profile: bigmodel
Model: glm-4-plus
# Claude Code 启动,显示正确的模型
╭─── Claude Code ───────────────╮
│ GLM-4-Plus · API Usage │
╰───────────────────────────────╯# 创建配置
$ ai-claude-start setup
? Choose a profile type: Moonshot
? Profile name: moonshot-32k
? Model name (default: moonshot-v1-8k): moonshot-v1-32k ← 修改为 32K
? Enter your ANTHROPIC_AUTH_TOKEN: ****************
# 使用
$ claude-start moonshot-32k
🚀 Launching with profile: moonshot-32k
Model: moonshot-v1-32k# 创建 GLM-4-Plus 配置
$ ai-claude-start setup
? Choose a profile type: BigModel (智谱)
? Profile name: bigmodel-plus
? Model name: glm-4-plus
? Enter your ANTHROPIC_AUTH_TOKEN: ****************
# 创建 GLM-4-Flash 配置
$ ai-claude-start setup
? Choose a profile type: BigModel (智谱)
? Profile name: bigmodel-flash
? Model name: glm-4-flash
? Enter your ANTHROPIC_AUTH_TOKEN: ****************
# 选择使用
$ claude-start
? Select a profile to use:
❯ bigmodel-plus (glm-4-plus,慢但效果好)
bigmodel-flash (glm-4-flash,快但效果一般)$ ai-claude-start list
📋 Available Profiles:
✓ [default] bigmodel
URL: https://open.bigmodel.cn/api/anthropic
Model: glm-4-plus
Token: ✓$ ai-claude-start --cmd "echo" test bigmodel
🚀 Launching with profile: bigmodel
Model: glm-4-plus
--model glm-4-plus test ← 可以看到 --model 参数被添加启动 Claude Code 后,查看欢迎界面应该显示正确的模型名称。
检查 1: 确认 profile 有模型配置
ai-claude-start list
# 应该看到 "Model: xxx"检查 2: 查看实际传递的参数
ai-claude-start --cmd "node -e \"console.log(process.argv)\"" bigmodel
# 应该看到 --model 参数检查 3: 确认 Claude Code 版本
claude --version
# 确保支持 --model 参数# 方案 1: 删除重建
ai-claude-start delete old-profile
ai-claude-start setup
# 方案 2: 手动编辑配置文件
vi ~/.ai-claude-profiles.json
# 或
vi $AI_CLAUDE_CONFIG_PATH- Anthropic: https://docs.anthropic.com/
- Moonshot: https://platform.moonshot.cn/docs
- 智谱: https://open.bigmodel.cn/dev/api
-
为不同场景创建不同配置
bigmodel-plus # 复杂任务,使用 glm-4-plus bigmodel-flash # 简单任务,使用 glm-4-flash
-
使用描述性名称
# ✅ 好 moonshot-32k bigmodel-flash anthropic-opus # ❌ 不好 config1 test my-api
-
设置常用的为默认
ai-claude-start default bigmodel-plus
-
创建别名快速切换
# 在 ~/.bashrc 或 ~/.zshrc alias claude-fast="claude-start bigmodel-flash" alias claude-smart="claude-start bigmodel-plus"
- SIMPLE_GUIDE.md - 简化使用指南
- USAGE_EXAMPLES.md - 使用示例
- README.md - 完整文档