# Command-Line Interface for DeepSeek-Reasonix: Architecture and Usage Guide

> Explore the DeepSeek-Reasonix CLI with our architecture and usage guide. Interact, batch execute, serve HTTP, and manage configurations efficiently. Get started today.

- Repository: [YHH/DeepSeek-Reasonix](https://github.com/esengine/DeepSeek-Reasonix)
- Tags: architecture
- Published: 2026-06-25

---

**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`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/cmd/reasonix/main.go), which functions as a minimal wrapper that forwards arguments to the internal CLI package:

```go
// 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`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/internal/cli/cli.go). The `Run` function parses the first argument to determine which sub-command to execute, then dispatches to the appropriate handler:

```go
// 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`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/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`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/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 create [`reasonix.toml`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/reasonix.toml) and populate the global `.env` file with API keys.
- **`init`** - Displays hints for project initialization.
- **`version`** - Displays the current version information.

## Practical Usage Examples

Display the version:

```bash
reasonix version

```

Execute a one-off prompt:

```bash
reasonix run "Write a Go function that reverses a string."

```

Start an interactive chat session:

```bash
reasonix chat

```

Specify a particular model:

```bash
reasonix chat --model deepseek/flash

```

Resume the most recent saved session:

```bash
reasonix chat --continue

```

Select from saved sessions to resume:

```bash
reasonix chat --resume

```

Start the HTTP server on a specific address:

```bash
reasonix serve --addr 0.0.0.0:8787

```

Run the first-time configuration wizard:

```bash
reasonix setup

```

## Configuration Management

The CLI is **config-driven**, reading provider and model settings from [`reasonix.toml`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/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`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/internal/cli/cli.go) handles secure creation of these files through an interactive wizard.

## Summary

- DeepSeek-Reasonix provides a complete CLI via the `reasonix` binary, with the entry point defined in [`cmd/reasonix/main.go`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/cmd/reasonix/main.go).
- Command routing is handled by the `Run` function in [`internal/cli/cli.go`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/internal/cli/cli.go), which supports `run`, `chat`, `code`, `serve`, `setup`, and `init` subcommands.
- Interactive sessions utilize the Bubble Tea-based TUI implemented in [`internal/cli/chat_tui.go`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/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.toml`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/reasonix.toml) and global `.env` files, initialized via the `reasonix setup` command.

## 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`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/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`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/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`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/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`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/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.