我在 Windows 上把 DeepSeek-TUI 从安装跑到了代码生成

今天 GitHub Trending 第一是 DeepSeek-TUI,2434 星------一个在终端里运行的 AI 编程代理。我花了 15 秒装好,配了 API Key,让它生成了代码,也踩了几个坑。这篇文章是我从零到跑通的全过程记录。

环境

Windows 11,Node.js v22.22.1,DeepSeek API Key(platform.deepseek.com 申请)。

第一步:安装(15 秒)

bash 复制代码
npm install -g deepseek-tui --registry=https://registry.npmmirror.com

npmmirror 镜像对国内用户更快。输出只有一行:

go 复制代码
added 1 package in 15s

npm 包本质是个安装器------它自动从 GitHub Releases 拉匹配的 Rust 预编译二进制。装完 deepseek 和 deepseek-tui 两个命令直接可用。

bash 复制代码
$ deepseek --version
deepseek 0.8.14

第二步:跑诊断

任何新工具我习惯先跑诊断命令,看看它到底有什么功能、缺什么配置。

bash 复制代码
$ deepseek doctor

完整输出比较长,我挑关键的说:

yaml 复制代码
Version: deepseek-tui 0.8.14

Configuration:
  ! config.toml not found (using defaults/env)

API Keys:
  · deepseek: env=no, config=no
  ... (6 个 provider 全未配置)

MCP Servers:
  ✓ MCP feature flag enabled

Skills:
  · skills dir not found (3 个位置都未创建)

Platform:
  OS: windows, Arch: x86_64
  ✓ sandbox available

诊断暴露了几个信息:API Key 没配、Skills 目录没建、MCP 和沙箱功能已启用但没配置。这些卡点正好是接下来要解决的。

第三步:配 API Key

三种方式,我选了最省事的------保存到配置文件,一次配置全局生效:

bash 复制代码
$ deepseek auth set --provider deepseek
# 粘贴 API Key,回车。输入时不回显。

saved API key for deepseek to ~\.deepseek\config.toml

另外两种方式:环境变量 export DEEPSEEK_API_KEY=sk-xxx,或者手动写 ~\.deepseek\config.toml 加 api_key = "sk-xxx"。

配完再跑一次 doctor,变化明显:

ini 复制代码
Configuration:
  ✓ config.toml found

API Keys:
  ✓ deepseek: env=yes, config=yes
  ✓ active provider key resolved from config.toml

API Connectivity:
  ✓ API connection successful (model: deepseek-v4-pro)

第四步:看它支持什么模型

bash 复制代码
$ deepseek models
Available models (default: deepseek-v4-pro)
  deepseek-v4-flash (deepseek)
* deepseek-v4-pro (deepseek)

默认是 Pro,还有一个 Flash------Pro 做深度推理,Flash 做快速任务。在交互模式里可以用 /model auto 让它自动选。

第五步:查看功能开关

bash 复制代码
$ deepseek features list
feature        stage         enabled
shell_tool      stable        true
subagents       experimental  true
web_search      experimental  true
apply_patch     experimental  true
mcp             experimental  true
exec_policy     experimental  true

6 个 feature,1 个稳定版(shell_tool),5 个实验版。subagents 支持子 Agent 协调,mcp 支持 Model Context Protocol,web_search 支持联网搜索。这已经不是"对话工具"了------是一个完整的 Agent 运行环境。

第六步:让它写代码

非交互模式用 deepseek exec,适合在脚本里调用:

bash 复制代码
$ deepseek exec "Create a Python file that prints a greeting and calculates fibonacci numbers"

输出:

python 复制代码
# hello_agent.py

def fibonacci(n: int) -> int:
    """Return the n-th Fibonacci number (0-indexed)."""
    if n < 0:
        raise ValueError("Input must be a non-negative integer.")
    if n == 0:
        return 0
    if n == 1:
        return 1
    a, b = 0, 1
    for _ in range(2, n + 1):
        a, b = b, a + b
    return b

if __name__ == "__main__":
    print("DeepSeek TUI Agent says hello!")
    for i in range(10):
        print(f"fibonacci({i}) = {fibonacci(i)}")

代码可以直接用------有类型标注、有边界检查、有迭代而非递归(避免大数栈溢出)。这说明 DeepSeek V4 Pro 的代码生成品质是可以的。

第七步:项目初始化

bash 复制代码
$ deepseek init
✓ Created AGENTS.md

生成的是一个模板文件,包含构建命令、架构概述、数据流等占位区域。编辑它之后,Agent 在项目里运行时会自动加载这些指令------相当于给 Agent 配置了项目上下文。

第八步:让它解释概念

bash 复制代码
$ deepseek exec "DeepSeek-V4-Pro 和 Flash 在推理能力上有什么区别?用一句话回答"

输出:

DeepSeek-V4-Pro excels at deeper, multi-step logical reasoning for complex problems, while DeepSeek-V4-Flash sacrifices some reasoning depth for significantly faster, more efficient inference on simpler tasks.

一句话讲清楚:Pro 做深度推理,Flash 追求速度。

踩到的坑

坑 1:exec 模式不写文件。 deepseek exec 生成代码是在响应里输出的,不会自动创建文件。如果要让它真正操作文件,得进交互模式(直接跑 deepseek 进 TUI)------交互模式里 Agent 模式需要逐次审批文件操作,YOLO 模式自动放行但不建议在正式项目里用。

坑 2:Windows 下没有 Rust 工具链,doctor 显示 rust: unknown。 不影响使用,但如果要 cargo 安装需要先装 Rust。

坑 3:国内访问 DeepSeek API 偶尔超时。 可以在 config.toml 里把 base_url 改成 https://api.deepseeki.com(国内镜像)。

跟同类工具的比较

跟 Claude Code 比:DeepSeek-TUI 的优势是绑定 DeepSeek 模型------1M token 上下文 + 流式推理,处理大代码库能力强。劣势是生态没 Claude Code 成熟,Skills 和 MCP 的社区内容少得多。

跟 Codex CLI 比:Codex 更专注 OpenAI 生态,DeepSeek-TUI 支持多 Provider 切换(deepseek/nvidia-nim/openrouter/fireworks/sglang),选模型更灵活。

结论

DeepSeek-TUI 0.8.14 是一个工具链完整的终端 AI 编程代理。安装零门槛(npm 一行命令),诊断报告清晰(doctor 直接告诉你缺什么),API Key 配置简单(三种方式),代码生成品质达到了可用的标准。

适合谁:已经在用 DeepSeek API 做开发的人,或者想找一个终端原生 AI 编程工具的人。

不适合谁:重度依赖 Claude Code Skills 生态的人(迁移有成本),或者对 experimental 功能零容忍的生产环境。

我接下来准备做的:把 AGENTS.md 按照 SeedScribe 项目的规则写好,然后在交互模式里跑一次实际的 Bug 修复。


安装环境:Windows 11, Node.js v22.22.1, deepseek-tui 0.8.14 API: DeepSeek V4 Pro 时间:2026-05-06 实测

相关推荐
Rain的Java大神之路2 小时前
LeetCode 46 全排列:从「及格答案」到让面试官眼前一亮的三种写法
后端·leetcode·面试
极客先躯3 小时前
智能体开发高级面试每日一题|2026-06-04|Agent 的规划(Planning)能力来自哪里?LLM 原生规划有哪些局限?
人工智能·面试·agent·每日一题·高级面试·智能体开发·agenticworkflow
极客先躯3 小时前
智能体开发高级面试每日一题|2026-06-02|为什么说“Agent 的能力上限由 LLM 决定“?工程层面可以做哪些弥补?
人工智能·面试·大模型·llm·agent·高级面试题·智能体开发
Rain的Java大神之路15 小时前
Spring Boot 3 升级实战:真正吃掉工期的,是 MyBatis-Plus 坐标和 Security 6 重写
java·后端·面试
CoderYanger1 天前
Java EE 进阶:16. Spring原理(第二弹)
java·服务器·spring boot·后端·spring·面试·java-ee
ShineWinsu1 天前
对于Qt:QSS样式属性的解析
开发语言·c++·qt·面试·盒子模型·客户端·qss
极客先躯1 天前
智能体开发高级面试每日一题|2026-06-01|Agent 系统中 LLM 扮演什么角色?除了 LLM 还需要哪些非 LLM 组件?
ai·面试·llm·agent·每日一题·高级面试题·智能体开发
fpcc1 天前
面试系列—虚函数常见的面试问题
c++·面试
Interview Aid1121 天前
Virtu Financial 完整面试指南:OA、Technical Interview 与真实面经
面试·职场和发展
kyriewen2 天前
我让 4 位 AI 面试官打分,同一个我差了 40 分
前端·面试·程序员