Command-Line Interface for DeepSeek-Reasonix: Architecture and Usage Guide
Yes, DeepSeek-Reasonix ships with a full-featured command-line interface invoked as reasonix, providing interactive TUI sessions, batch execution, HTTP serving, and configuration management.
The esengine/DeepSeek-Reasonix repository includes a comprehensive CLI tool that serves as the primary interface for the reasoning engine. This command-line interface for DeepSeek-Reasonix is implemented in Go and supports both interactive and non-interactive operational modes. After building the repository, the reasonix binary provides immediate access to model execution, chat sessions, and server deployment.
CLI Architecture and Entry Points
Binary Entry Point
The CLI binary is built from cmd/reasonix/main.go, which functions as a minimal wrapper that forwards arguments to the internal CLI package:
// cmd/reasonix/main.go
func main() {
os.Exit(cli.Run(os.Args[1:], version))
}
Command Dispatch Logic
All heavy lifting occurs in internal/cli/cli.go. The Run function parses the first argument to determine which sub-command to execute, then dispatches to the appropriate handler:
// internal/cli/cli.go – command dispatch
func Run(args []string, version string) int {
// ...
switch cmd {
case "run":
return runAgent(rest)
case "chat", "code":
return runInteractiveSession(rest)
case "serve":
return runServe(rest)
case "setup":
return setupConfig(rest)
case "init":
return initHint()
// ...
}
}
Interactive Terminal Components
The interactive chat interface is implemented in internal/cli/chat_tui.go, which provides the Bubble Tea-based full-screen terminal UI for reasonix chat and reasonix code commands. For performance tracking, internal/cli/run_metrics.go contains helpers for writing JSON metrics when using the --metrics flag.
Available CLI Commands
The reasonix binary supports several distinct operational modes:
run- Executes a single prompt in non-interactive mode, handling model selection, session persistence, and streaming results to stdout.chat- Launches the interactive TUI for multi-turn conversations with support for session resumption.code- Alternative entry point for code-specific interactive sessions.serve- Starts an HTTP+SSE server exposing the controller over the network.setup- Runs an interactive wizard to createreasonix.tomland populate the global.envfile with API keys.init- Displays hints for project initialization.version- Displays the current version information.
Practical Usage Examples
Display the version:
reasonix version
Execute a one-off prompt:
reasonix run "Write a Go function that reverses a string."
Start an interactive chat session:
reasonix chat
Specify a particular model:
reasonix chat --model deepseek/flash
Resume the most recent saved session:
reasonix chat --continue
Select from saved sessions to resume:
reasonix chat --resume
Start the HTTP server on a specific address:
reasonix serve --addr 0.0.0.0:8787
Run the first-time configuration wizard:
reasonix setup
Configuration Management
The CLI is config-driven, reading provider and model settings from reasonix.toml (or project-local configurations). API keys are stored exclusively in a dedicated global .env file located outside the project directory, ensuring credentials are never committed to version control. The setup command in internal/cli/cli.go handles secure creation of these files through an interactive wizard.
Summary
- DeepSeek-Reasonix provides a complete CLI via the
reasonixbinary, with the entry point defined incmd/reasonix/main.go. - Command routing is handled by the
Runfunction ininternal/cli/cli.go, which supportsrun,chat,code,serve,setup, andinitsubcommands. - Interactive sessions utilize the Bubble Tea-based TUI implemented in
internal/cli/chat_tui.go. - All commands return conventional exit codes (0 for success, non-zero for errors) as dictated by
cli.Run. - Configuration is managed through
reasonix.tomland global.envfiles, initialized via thereasonix setupcommand.
Frequently Asked Questions
How do I install the DeepSeek-Reasonix CLI?
After cloning the esengine/DeepSeek-Reasonix repository, build the binary from cmd/reasonix/main.go. Once compiled, the reasonix command becomes available in your system path, providing access to all documented functionality including interactive chat and HTTP server modes.
Can I use DeepSeek-Reasonix without the interactive interface?
Yes. The reasonix run command executes single prompts in non-interactive mode, streaming results directly to stdout. This is implemented in the runAgent function within internal/cli/cli.go and is ideal for shell scripts and automation pipelines that require conventional exit codes.
Where does the CLI store API keys and configuration?
The CLI stores API keys in a global .env file located outside the project directory, while provider and model preferences are read from reasonix.toml. The reasonix setup command creates these files securely, ensuring credentials remain separate from project source code.
How do I expose DeepSeek-Reasonix as an HTTP service?
Use the reasonix serve command, which starts an HTTP+SSE server. The implementation in internal/cli/cli.go handles the runServe logic, allowing you to specify the bind address with --addr (for example, 0.0.0.0:8787) to expose the controller over the web.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →