ByteNoteByteNote

字节笔记本

2026年5月25日

Crush 接入 DeepSeek V4:终端 AI 编程 Agent 配置指南

API中转
¥120

Crush 是由 Charm 开发的开源 AI 编程 Agent,运行在终端中,支持多模型切换、LSP 集成、MCP 服务器和代理式编码工作流。通过配置自定义供应商,可以在 Crush 中使用 DeepSeek V4 模型。

安装 Crush

需要 Node.js,安装命令:

bash
npm install -g @charmland/crush

验证安装:

bash
crush --version

macOS 用户也可以通过 Homebrew 安装:brew install charmbracelet/tap/crush

配置 DeepSeek 供应商

Crush 支持通过 OpenAI 兼容 API 添加自定义供应商。编辑配置文件:

  • Linux / macOS~/.config/crush/crush.json
  • Windows%USERPROFILE%\.config\crush\crush.json
json
{
  "$schema": "https://charm.land/crush.json",
  "providers": {
    "deepseek": {
      "type": "openai-compat",
      "base_url": "https://api.deepseek.com",
      "api_key": "$DEEPSEEK_API_KEY",
      "models": [
        {
          "id": "deepseek-v4-pro",
          "name": "DeepSeek-V4-Pro",
          "context_window": 1048576,
          "default_max_tokens": 32768,
          "can_reason": true
        },
        {
          "id": "deepseek-v4-flash",
          "name": "DeepSeek-V4-Flash",
          "context_window": 1048576,
          "default_max_tokens": 32768,
          "can_reason": true
        }
      ]
    }
  }
}

前往 DeepSeek 开放平台 获取 API Key,然后设置环境变量:

Linux / macOS:

bash
export DEEPSEEK_API_KEY="<你的 DeepSeek API Key>"

Windows:

powershell
$env:DEEPSEEK_API_KEY="<你的 DeepSeek API Key>"

运行并选择模型

进入项目目录执行 Crush:

bash
cd /path/to/my-project
crush

Ctrl+L(或输入 /model)打开模型切换器,选择 DeepSeek 供应商,然后选择 DeepSeek-V4-ProDeepSeek-V4-Flash

分享: