How to Run Inference with DeepSeek-Reasonix: A Complete Guide for 2024
Run inference with DeepSeek-Reasonix by installing the reasonix binary, configuring a DeepSeek provider in reasonix.toml, and executing reasonix run "<prompt>" for one-off queries or launching the interactive TUI with reasonix.
DeepSeek-Reasonix is a single-binary Go engine that connects to DeepSeek models through an OpenAI-compatible API adapter. Whether you need quick answers from the command line or extended multi-turn conversations, this guide walks you through running inference with DeepSeek-Reasonix based on the actual source code implementation in the esengine/DeepSeek-Reasonix repository.
Installation Methods
DeepSeek-Reasonix distributes as a self-contained binary with no external runtime dependencies. Choose your preferred installation path:
npm (Cross-Platform)
npm i -g reasonix
Homebrew (macOS)
brew install esengine/reasonix/reasonix
Pre-built Binaries
Download platform-specific releases directly from the GitHub releases page.
Build from Source
git clone https://github.com/esengine/DeepSeek-Reasonix.git
cd DeepSeek-Reasonix
make build # outputs bin/reasonix (or .exe on Windows)
For cross-platform builds, use make cross to generate binaries for multiple architectures simultaneously.
Configuring DeepSeek-Reasonix Inference
Before running inference, you must define a provider configuration that tells Reasonix how to reach DeepSeek's API.
Create the Configuration File
Create a reasonix.toml file in your working directory (or modify the included reasonix.example.toml):
[provider.deepseek]
type = "deepseek"
api_key = "YOUR_DEEPSEEK_API_KEY"
model = "deepseek-chat"
endpoint = "https://api.deepseek.com/v1/chat/completions"
Configuration field reference:
type— Must be"deepseek"to activate the DeepSeek adapterapi_key— Your DeepSeek API credentialmodel— Supported values includedeepseek-chatanddeepseek-coderendpoint— DeepSeek's OpenAI-compatible chat completions URL
The configuration parser validates these fields during startup; invalid or missing credentials produce immediate errors with actionable messages.
Running Single-Turn Inference
Execute one-off prompts without entering the interactive UI:
reasonix run "Explain the Go memory model and its implications for concurrent programming."
What happens during execution:
- Configuration load — Reasonix reads
reasonix.tomland instantiates the DeepSeek provider - Request construction — The provider builds an OpenAI-compatible payload with
messagesarray (system, user roles) - DeepSeek-specific fields — For tool-enabled requests, the engine attaches
reasoning_contentandresponses_itemsas required by DeepSeek's stateless API - Streaming POST — The request streams to
https://api.deepseek.com/v1/chat/completions - Response rendering — Tokens stream to your terminal in real-time
The DeepSeek adapter implementation resides in internal/provider/openai/openai.go, which handles the translation between Reasonix's internal message format and DeepSeek's expected schema.
Interactive Inference Sessions (TUI)
Launch the full-screen terminal interface for extended conversations:
reasonix
Key TUI commands:
/init— Generate project-specific instruction sets based on detected workspace context- Arrow keys /
Enter— Navigate conversation history Ctrl+Cor/quit— Exit cleanly with automatic transcript save
The TUI maintains conversation state across interruptions. When you resume a session, Reasonix replays cached ResponsesItems to restore DeepSeek's context — a critical capability since DeepSeek's API does not natively maintain conversation state between requests.
Understanding the Inference Architecture
The core inference flow relies on several interconnected components:
Provider Abstraction (internal/provider/provider.go)
The Message struct in this file defines the fundamental data model:
type Message struct {
Role string `json:"role"`
Content string `json:"content"`
ReasoningContent string `json:"reasoning_content,omitempty"`
ResponsesItems []ResponseItem `json:"responses_items,omitempty"` // DeepSeek-specific
}
The ResponsesItems field (lines 75-81 in provider.go) specifically enables DeepSeek web-search and tool-call replay functionality. This field stores intermediate tool results that must be resent with subsequent requests since DeepSeek's API is stateless.
DeepSeek Adapter Selection
When type = "deepseek" appears in configuration, the provider registry activates the OpenAI-compatible adapter located in internal/provider/openai/. This adapter:
- Marshals requests to DeepSeek's expected JSON schema
- Unpacks streaming SSE responses
- Extracts
reasoning_contentfor display when present - Manages
ResponsesItemscaching for multi-turn continuity
Caching and Replay Mechanics
Tool calls with DeepSeek require special handling. The first request may trigger web search or code execution; results cache locally in the transcript. Subsequent turns automatically prepend these ResponsesItems to satisfy DeepSeek's requirement that all prior tool results appear in the current request context.
Configuration Verification and Debugging
Validate your setup before production use:
# Test configuration parsing
reasonix config validate
# Enable verbose logging
REASONIX_LOG=debug reasonix run "Test prompt"
Common configuration errors include:
- Missing or malformed
api_key— results in HTTP 401 from DeepSeek - Incorrect
endpointURL — verify the/v1/chat/completionssuffix - Unsupported
modelname — consult DeepSeek's model documentation
Advanced Inference Patterns
Multi-Provider Setups
Define multiple providers in reasonix.toml and select at runtime:
[provider.deepseek-pro]
type = "deepseek"
api_key = "PRO_KEY"
model = "deepseek-chat"
[provider.deepseek-coder]
type = "deepseek"
api_key = "SAME_OR_DIFFERENT_KEY"
model = "deepseek-coder"
Switch with: reasonix --provider deepseek-coder run "Generate a Python parser"
Environment Variable Substitution
For CI/CD security, reference environment variables:
[provider.deepseek]
type = "deepseek"
api_key = "${DEEPSEEK_API_KEY}"
model = "deepseek-chat"
Summary
- Install DeepSeek-Reasonix via npm, Homebrew, or source build to obtain the single
reasonixbinary - Configure a DeepSeek provider in
reasonix.tomlwith your API key, model selection, and endpoint URL - Run single-turn inference with
reasonix run "<prompt>"for quick command-line answers - Launch interactive sessions with
reasonixto leverage multi-turn conversation with automatic caching - Leverage
ResponsesItemshandling ininternal/provider/provider.goto maintain tool-call context across stateless DeepSeek API requests
Frequently Asked Questions
What makes DeepSeek-Reasonix different from using the DeepSeek API directly?
DeepSeek-Reasonix provides a unified CLI/TUI interface with built-in conversation management, tool-call caching via ResponsesItems, and OpenAI-compatible request formatting. While you could script raw HTTP calls to api.deepseek.com, you would need to manually handle streaming responses, token counting, and stateless conversation replay — all of which Reasonix automates through its provider abstraction.
Can I use DeepSeek-Reasonix with OpenAI or other providers?
Yes. The provider system in internal/provider/provider.go supports multiple backends through the same configuration format. Set type = "openai" with appropriate endpoint and model values to switch providers. The DeepSeek adapter specifically handles DeepSeek-specific fields like reasoning_content, but the core inference engine works with any OpenAI-compatible API.
How does conversation resumption work if my terminal crashes?
Reasonix persists conversation transcripts to disk automatically. When you restart in the same directory, the TUI detects the previous session and offers to resume. The engine replays cached ResponsesItems from prior tool calls when rebuilding the request context, satisfying DeepSeek's stateless requirement without losing intermediate computation results.
Where are my API credentials stored and how secure is this?
API keys reside only in your local reasonix.toml or environment variables — never in Reasonix source code or transmitted beyond the configured DeepSeek endpoint. The binary performs direct HTTPS requests with no intermediate servers. For production deployments, use environment variable substitution and restrict file permissions on configuration files (chmod 600 reasonix.toml).
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 →