Project Overview
DeepSeek-Reasonix is a terminal-oriented AI coding agent. It is not just a chat-based command line; instead, it organizes the model, tools, plugins, project context, and approval workflow into a configurable local Agent engine.
It has three core features: first, it is optimized for long sessions around DeepSeek by default, with special attention to prefix cache so that token costs stay lower for continuous development tasks; second, the Provider, model, tools, and plugins are all defined in reasonix.toml rather than hard-coded in the program; third, it is distributed as a single Go binary, and the CLI/TUI, desktop app, and VS Code extension can all reuse the same Reasonix engine.
In this article, we will build a minimal working setup together: install Reasonix, configure the DeepSeek API Key, initialize project instructions, let it complete a code modification task, and then connect an OpenAI-compatible gateway. By the end, you will know when to use DeepSeek directly, and when it is more convenient to use Defapi as a unified interface.
Difficulty: Intermediate | Time: 20β40 minutes | Takeaway: Get DeepSeek-Reasonix running, and understand configuration-driven setup, project instructions, dual-model collaboration, and low-cost API integration
Target Audience
- Developers who want to build a low-cost coding Agent with DeepSeek
- Engineers who often modify code in the terminal and want a local AI assistant
- People who want to integrate an AI Agent into a team codebase while keeping token costs in mind
- Users who have already tried Claude Code, Codex, or OpenClaw and want to compare DeepSeek ecosystem tools
Core Dependencies and Environment
| Dependency | Recommended Minimum | Description |
|---|---|---|
| Node.js | 18+ | Used to install the native Reasonix binary via npm |
| npm | 9+ | Handles global installation of reasonix |
| DeepSeek API Key | Required | Used for the default Provider |
| Git | 2.40+ | Helps the Agent identify code changes |
| Go | 1.22+ | Only needed when building from source |
| Windows/macOS/Linux | All supported | Official multi-platform binaries provided |
TIP
If you are only using the CLI/TUI, you do not need to install Go. You only need a Go environment if you want to build Reasonix from source or contribute to the project.
Complete Project Structure Tree
We will prepare a minimal demo project:
reasonix-agent-demo/
βββ .env.example
βββ reasonix.toml
βββ REASONIX.md
βββ tasks/
β βββ bugfix.md
βββ demo-app/
βββ package.json
βββ src/
βββ price.ts
1. Install the Reasonix CLI
The easiest way is to install it via npm:
npm i -g reasonix
Verify the installation:
reasonix --version
If you use macOS, you can also install it with Homebrew:
brew install esengine/reasonix/reasonix
Windows users are advised to run the following in PowerShell or Windows Terminal:
npm i -g reasonix
reasonix --version
WARNING
If the npm global installation directory is not added to PATH, the command may still report that reasonix cannot be found even after installation succeeds. In that case, first run npm config get prefix to check the global install directory, then add the corresponding bin directory to your terminal path.
2. Configure the DeepSeek API Key
Create a demo directory:
mkdir reasonix-agent-demo
cd reasonix-agent-demo
Prepare .env.example:
DEEPSEEK_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxx
DEFAPI_API_KEY=defapi_xxxxxxxxxxxxxxxxxxxxx
Copy it to a local environment file:
cp .env.example .env
PowerShell version:
Copy-Item .env.example .env
Then fill in your own DeepSeek API Key.
WARNING
Keep .env only on your local machine and do not commit it to Git. In Reasonix configuration files, it is also recommended to write only api_key_env rather than the actual secret key.
3. Run setup to complete the initial configuration
Now run the initialization command:
reasonix setup
Follow the prompts to choose the Provider and model. DeepSeek-Reasonix is optimized for DeepSeek by default, so we can first choose the DeepSeek Provider and then select a model suitable for everyday coding tasks.
After configuration is complete, start an interactive session:
reasonix
You can begin with a simple question:
Please explain what files are in the current project directory, and where you recommend starting the initialization.
If Reasonix responds normally, it means the CLI, model, and API Key chain is working.
4. Create reasonix.toml to fix the Provider configuration
To make the configuration reproducible, we put the key settings into reasonix.toml:
default_model = "deepseek"
language = "zh"
[ui]
theme = "auto"
[agent]
temperature = 0.0
reasoning_language = "zh"
soft_compact_ratio = 0.5
tool_result_snip_ratio = 0.6
compact_ratio = 0.8
compact_force_ratio = 0.9
[[providers]]
name = "deepseek"
kind = "openai"
base_url = "https://api.deepseek.com"
models = ["deepseek-v4-flash", "deepseek-v4-pro"]
default = "deepseek-v4-flash"
api_key_env = "DEEPSEEK_API_KEY"
context_window = 1000000
effort = "high"
[environment]
enabled = true
A few key points here:
default_modelpoints to the Provider name, and you can later switch the default model within that Provider.temperature = 0.0is better suited for code modification tasks and produces more stable output.context_windowreserves room for long sessions.soft_compact_ratioandcompact_ratiomake context management more controllable.
Load environment variables explicitly at startup:
export $(grep -v '^#' .env | xargs)
reasonix
PowerShell version:
Get-Content .env | ForEach-Object {
if ($_ -match "^(.*?)=(.*)$") {
[Environment]::SetEnvironmentVariable($matches[1], $matches[2], "Process")
}
}
reasonix
5. Use /init to generate project instructions
When an Agent handles coding tasks, the hardest part is having to re-explain project conventions every time. Reasonix supports running the following in an interactive session:
/init
It will generate a set of project instructions based on the current project. We can also prepare REASONIX.md manually:
# Reasonix Project Instructions
## Project Goal
This is a minimal example project used to verify the Reasonix coding Agent.
## Development Rules
- Explain the plan before modifying code.
- Add Chinese comments to key functions.
- Run project tests after making changes.
- Do not create Git commits unless explicitly requested by the user.
## Common Commands
```bash
npm test
> [!TIP]
> The more stable the project instructions are, the easier it is for DeepSeekβs prefix cache to hit. Do not put task details that change every day into long-term instructions; it is better to keep them in separate task files.
## 6. Prepare a real code task
We will create a minimal TypeScript project:
```bash
mkdir -p demo-app/src tasks
cd demo-app
npm init -y
npm i -D typescript tsx
npx tsc --init
cd ..
Create demo-app/src/price.ts:
export type PriceInput = {
amount: number;
discountRate?: number;
};
export function calculateFinalPrice(input: PriceInput): number {
const discount = input.discountRate || 0;
return input.amount * (1 - discount);
}
This function has a common issue: discountRate has no boundary validation, so passing in 1.5 will produce a negative price.
Create tasks/bugfix.md:
# Task: Fix the price calculation boundary issue
Please modify demo-app/src/price.ts:
1. amount must be greater than or equal to 0.
2. discountRate defaults to 0.
3. discountRate must be between 0 and 1.
4. Add Chinese comments to calculateFinalPrice.
5. Add a minimal test or runnable validation script.
Now let Reasonix execute the task:
reasonix run "Read tasks/bugfix.md and complete the code changes described there."
You will see Reasonix read the task, inspect files, propose a modification plan, and then call tools to write the code. This is what makes a coding agent different from a normal chat bot: it not only explains the problem, but also enters the project and edits files.
7. Configure planner/executor dual-model mode
Single-model mode can already handle many tasks, but complex requirements usually need planning before execution. Reasonix supports splitting planner and executor in the configuration:
[agent]
temperature = 0.0
planner_model = "deepseek-pro"
reasoning_language = "zh"
[[providers]]
name = "deepseek"
kind = "openai"
base_url = "https://api.deepseek.com"
models = ["deepseek-v4-flash", "deepseek-v4-pro"]
default = "deepseek-v4-flash"
api_key_env = "DEEPSEEK_API_KEY"
context_window = 1000000
effort = "high"
[[providers]]
name = "deepseek-pro"
kind = "openai"
base_url = "https://api.deepseek.com"
model = "deepseek-v4-pro"
api_key_env = "DEEPSEEK_API_KEY"
context_window = 1000000
effort = "high"
A practical setup is:
| Role | Model | Use Case |
|---|---|---|
| executor | deepseek-v4-flash | Everyday code editing, file reading, command execution |
| planner | deepseek-v4-pro | Complex task planning, refactoring decomposition, risk analysis |
This keeps costs under control while letting a stronger model participate in critical decision-making steps.
8. Connect a Defapi-compatible interface
Reasonix Providers are configuration-driven. As long as the target service is compatible with OpenAI-style interfaces, it can be connected as a Provider. This is especially suitable for integrating Defapi.
Defapiβs advantage is that pricing is usually only half of the official service, and its models are generally compatible with the following protocols:
v1/chat/completionsv1/messagesv1beta/models/
We can add a Defapi Provider in reasonix.toml:
[[providers]]
name = "defapi-claude"
kind = "openai"
base_url = "https://api.defapi.org/api/v1"
model = "anthropic/claude-sonnet-4.5"
api_key_env = "DEFAPI_API_KEY"
context_window = 200000
Then switch the default model:
default_model = "defapi-claude"
You can also keep DeepSeek as the default executor, while using the stronger model on Defapi as the planner:
default_model = "deepseek"
[agent]
planner_model = "defapi-claude"
temperature = 0.0
[[providers]]
name = "deepseek"
kind = "openai"
base_url = "https://api.deepseek.com"
models = ["deepseek-v4-flash", "deepseek-v4-pro"]
default = "deepseek-v4-flash"
api_key_env = "DEEPSEEK_API_KEY"
context_window = 1000000
effort = "high"
[[providers]]
name = "defapi-claude"
kind = "openai"
base_url = "https://api.defapi.org/api/v1"
model = "anthropic/claude-sonnet-4.5"
api_key_env = "DEFAPI_API_KEY"
context_window = 200000
This combination is very practical for real development: routine tasks go through DeepSeek to control costs, while complex planning or code review uses the stronger model on Defapi. Once the Provider layer is unified, Reasonix does not need to write new code for every model vendor.
9. Run a full validation
Now letβs do a complete validation:
reasonix run "Inspect the implementation of demo-app/src/price.ts and explain whether there are still boundary issues."
Then let it perform a task closer to real work:
reasonix run "Please add an npm test command to demo-app, and use a minimal script to validate the normal price, discount, and invalid discount scenarios of calculateFinalPrice."
Finally, check the Git changes:
git diff
If you see Reasonix modifying code, adding tests, and explaining the reasons for the changes, then the minimal Agent workflow is working end to end.
Common Troubleshooting
1. reasonix command not found
First check the npm global directory:
npm config get prefix
npm bin -g
If npm bin -g is unavailable, you can use:
npm root -g
After finding the global installation directory, add the corresponding executable directory to PATH. Windows users usually need to reopen the terminal.
2. Insufficient permission for npm global installation
On macOS/Linux, it is not recommended to force-install with sudo. You can move the npm global directory to your user directory instead:
mkdir -p ~/.npm-global
npm config set prefix ~/.npm-global
export PATH="$HOME/.npm-global/bin:$PATH"
npm i -g reasonix
Then write the PATH configuration into your shell startup file.
3. DeepSeek API Key is not taking effect
First check whether the environment variable exists:
echo "$DEEPSEEK_API_KEY"
PowerShell:
$env:DEEPSEEK_API_KEY
If it is empty, it means the current terminal has not loaded .env. You can inject it manually first:
export DEEPSEEK_API_KEY="sk-xxxxxxxxxxxxxxxx"
reasonix
4. reasonix.toml is not being read
Reasonix configuration is usually resolved in the order of command-line arguments, current directory configuration, user global configuration, and built-in defaults. First make sure you are running it from the project root:
pwd
ls reasonix.toml
Then run:
reasonix run "Please explain which model and Provider are currently being used."
If the output does not match the configuration, first check whether command-line arguments or global configuration are overriding the current directory configuration.
5. The model is slow or the cost is too high
First break the task into smaller steps:
reasonix run "Only read demo-app/src/price.ts, do not modify it yet, and point out potential issues."
Then let it make the changes:
reasonix run "Based on the issues identified just now, modify only demo-app/src/price.ts."
In long sessions, stable project instructions and task descriptions with fewer changes are more favorable for cache hits. For complex tasks, you can enable planner/executor dual-model mode and let the higher-cost model participate only in the planning stage.
6. The Agent modified files without approval
Check the current working mode. In an interactive session, you can switch to a more conservative mode and require confirmation before tool calls. For team projects, it is recommended to enable approvals by default and avoid entering unattended automatic modification mode directly.
You can first ask Reasonix to do read-only analysis:
reasonix run "Analyze only, do not modify any files: please check the issues in demo-app/src/price.ts."
After confirming the plan, then execute the changes.
7. Chinese garbled text in the Windows terminal
In PowerShell, you can first set UTF-8:
chcp 65001
$OutputEncoding = [System.Text.Encoding]::UTF8
If the output still looks wrong, it is recommended to use Windows Terminal and make sure your editor, terminal, and Git are all using UTF-8.
Further Reading / Advanced Directions
- Use the Reasonix desktop app to move the terminal Agent workflow into a graphical interface.
- Install the VS Code extension so Reasonix can read editor context and handle tool approvals.
- Configure MCP-compatible plugins to connect internal scripts, database queries, and document retrieval to the Agent.
- Use sub-agents for tasks such as
review,security_review, andresearch. - Integrate Reasonix into the OpenClaw workflow so the chat entry point can trigger real coding tasks.
- Connect to Defapi via
v1/chat/completionsorv1/messagesto centrally manage model providers such as DeepSeek, Claude, and Gemini.