WayToClawEarn
Beginner30 min readMay 25, 2026

DeepSeek Reasonix in action: Build an AI programming agent at zero cost (30-minute tutorial)

From installation to practice, master the Cache-First low-cost and Skills automation of DeepSeek's native programming agent in 30 minutes

Beginner · 30 min · May 25, 2026

Tutorial Objectives

Complete the installation, configuration and practice of DeepSeek Reasonix in 30 minutes. You will learn to use this open source AI programming agent to automatically fix bugs, write functions, and run tests - and because of DeepSeek's prefix-cache mechanism, the cost of long-session input tokens is reduced to 1/5 of the original.

What will you build?

  • AI Programming Agent Environment: Terminal native TUI, start anytime, anywhere npx reasonix code
  • Cache-first long sessions: 94% cache hit, append-only loops keep costs extremely low
  • Skills Automation Script: Use Markdown to write reusable Agent scripts

Preparation list

  • DeepSeek API Key (platform.deepseek.com registered to obtain, billed by volume)
  • Node.js ≥ 22 (macOS/Linux/Windows are acceptable)
  • An existing code project (or create a new demo project to practice)

Overall architecture

Reasonix's loop is append-only: messages and tool results are always appended to the end, and the history is never modified. This keeps DeepSeek's prefix-cache hit after every tool invocation.

ModuleInputOutputEstimated time
Environment installationAPI Key + Node.jsReasonix ready5 minutes
First SessionNatural Language RequirementsAI Generated Code10 Minutes
Skills configurationMarkdown scriptsReusable automation10 minutes
MCP ExtensionsExternal Tools ServerEnhanced Toolset5 Minutes

DeepSeek Reasonix terminal interface diagram

Step 1: Install Reasonix and configure API Key

Reasonix does not require global installation. In Node.js ≥ 22 environment, one line of commands can start:

terminal

# 进入你的项目目录
cd /path/to/your-project

# 直接启动(首次运行会自动引导配置 API Key)
npx reasonix code

首次运行会弹出内置向导,粘贴你的 DeepSeek API Key 即可。这个 Key 会保存在 ~/.reasonix/config.json 中,后续无需重复配置。

提示:DeepSeek API 的计费极低——输入 $0.07/Mtok,命中缓存仅 $0.014/Mtok。Reasonix 的 append-only 循环设计让长会话缓存命中率保持在 90% 以上,实际成本远低于同类工具。

配置完成后,你可以用以下命令检查状态:

terminal

# 查看配置
cat ~/.reasonix/config.json

# 查看帮助
npx reasonix --help

Reasonix 也提供桌面端(Tauri 原生客户端),自带 Node runtime、多 tab 会话和实时 cost/cache/token 表盘,适合不想碰命令行的用户。但本教程聚焦终端版——它更轻量、更适合 CI/CD 集成。

第 2 步:首次 AI 编程会话

启动 Reasonix 后,你会进入一个终端 TUI 界面。它不是一个 IDE 插件——diff 留给 git diff,文件树留给 ls,终端本身就是工作面板。

基础交互

进入会话后,直接用自然语言描述你的需求。Reasonix 默认使用 DeepSeek V4-Flash(快速且低成本),复杂任务可以用 /pro 切到 V4-Pro:

code

# 日常迭代用 Flash(默认)
> 帮我把这个 Python 脚本里的硬编码路径改成配置文件读取

# 复杂重构切 Pro
/pro
> 重构这个模块,把单体函数拆成职责单一的三个类,保持测试通过

Reasonix 会自动读取项目文件、执行 shell 命令、修改代码。所有操作沙箱化到启动目录,不会越权访问。

双档位策略

档位触发方式适用场景成本
V4-Flash默认日常修 bug、小功能、代码审查极低
V4-Pro/pro 命令复杂重构、架构设计、多文件联动中等
全 Pro/preset max整轮对话用 Pro较高

Reasonix dual gear switching diagram

实战示例:让 Reasonix 修一个 bug

假设你的项目有一个 utils.py 文件,其中 parse_config 函数在文件不存在时直接崩溃:

> utils.py 的 parse_config 函数在配置文件不存在时应该返回默认值而不是崩溃,帮我修复

Reasonix 会:

  1. 读取 utils.py,定位 parse_config 函数
  2. 分析错误原因
  3. 生成修复代码(添加 try/except 或 os.path.exists 检查)
  4. 询问你是否确认修改

确认后,Reasonix 应用修改,你可以用 git diff 查看变更。

第 3 步:用 Skills 编排可复用自动化

Skills 是 Reasonix 最强大的功能之一——用 Markdown 编写 Agent 行为剧本,放在 .reasonix/skills/ 目录下即可。

创建一个 Code Review Skill

在项目根目录创建 .reasonix/skills/code-review.md

markdown
---
name: code-review
description: 代码审查:检查安全性、性能和可维护性
runAs: subagent
allowed-tools: [read, grep, glob]
---

## 任务

对当前项目的变更文件进行代码审查。

## 检查维度

1. **安全性**:是否有 SQL 注入、XSS、路径遍历风险
2. **性能**:是否有 N+1 查询、不必要的循环、大对象拷贝
3. **可维护性**:函数是否过长(>30 行)、命名是否清晰

## 输出格式

生成一份 markdown 报告,按严重程度排序。

然后在 Reasonix 会话中直接调用:

code
/skill code-review
``__TOK28 __read`, `grep`, `glob` Three read-only tools - will not modify any code, ensuring the independence of the review.

### More Skill Examples

You can create various Skills:

- **Generate CHANGELOG**: Read git log and automatically generate version update log
- **Run Test + Fix**: Run the test first and automatically fix the code for failed use cases
- **API document generation**: scan routing files and generate OpenAPI documents

Skills are plain text Markdown that can be submitted to the git repository, and team members share the same set of Agent scripts.

## Step 4: Access the MCP extension tool chain

Reasonix provides first-class citizen support for MCP (Model Context Protocol) and supports three transmission protocols: stdio, SSE, and Streamable HTTP.

### Mount an MCP Server

```bash

# 挂载 GitHub MCP Server
npx reasonix code --mcp "github=npx @anthropic/mcp-server-github"

# 挂载文件系统 MCP Server
npx reasonix code --mcp "fs=npx @anthropic/mcp-server-filesystem /path/to/allowed/dir"

也可以在 ~/.reasonix/config.json 中持久化配置:

json
{
  "mcp": {
    "github": {
      "command": "npx",
      "args": ["@anthropic/mcp-server-github"]
    },
    "filesystem": {
      "command": "npx",
      "args": ["@anthropic/mcp-server-filesystem", "/home/user/projects"]
    }
  }
}

每个 MCP server 的工具会以前缀合并进 Reasonix 统一的工具 registry,对模型完全透明。挂载 GitHub MCP 后,你可以直接说"帮我创建一个 PR"——Reasonix 会自动调用 GitHub 工具完成操作。

MCP tool integration diagram

常见问题排查(FAQ)

Q1:npx reasonix code 报错 "Node version too old"?

升级 Node.js 到 ≥ 22。用 node -v 检查版本,推荐用 nvm 管理:

terminal
nvm install 22
nvm use 22

Q2:API Key 配置后仍然提示认证失败?

检查 ~/.reasonix/config.jsonapiKey 字段是否正确。也可以设置环境变量:

terminal
export DEEPSEEK_API_KEY="sk-xxxxxxxxxxxxxxxx"

Q3:长会话 token 成本真的能降到 1/5?

是的。Reasonix 的 append-only 循环设计专门适配 DeepSeek 的 prefix-cache 机制:消息历史不重排、不基于 marker 压缩,缓存前缀在每次工具调用后保持稳定。实测长会话(50+ 轮)缓存命中率 90%+,输入 token 成本降为原来的 1/5~1/4。

Q4:Reasonix 和 Claude Code 有什么区别?

Claude Code 是 Anthropic 生态的编程 Agent,依赖 Claude API。Reasonix 是 DeepSeek 原生设计,核心优势在于极低成本(DeepSeek 的缓存定价 + Reasonix 的 Cache-First 循环)和终端优先的轻量设计。两者可以互补使用——简单任务用 Reasonix(省钱),复杂架构讨论用 Claude Code(推理更强)。

工具词条(触发工具悬浮卡)

正文中自然出现的工具名,平台侧会匹配已维护 tools 库生成 hover-card: DeepSeekReasonixClaude CodeNode.js

Reference video/material

Internal link guidance

DeepSeek topic related tutorials

Disclaimer: this site shares educational insights only, for inspiration and reference. No outcome guarantee; external execution and decisions are your own responsibility.

Related tutorials