Skip to main content
All posts
Guide

Is There a DeepSeek CLI? dsh's CLI and Headless Mode

DeepSeek's official CLI path is DeepSeek Harness (dsh) — covering the dsh command, headless one-shot mode, and the Python and TypeScript SDKs for scripting.

Yes — the closest thing to an official "DeepSeek CLI" is dsh, the command-line entry point for DeepSeek Harness. There's no separate, standalone product called "DeepSeek CLI" distinct from the harness; dsh is a launcher binary with a headless one-shot mode, and DeepSeek also publishes Python and TypeScript SDKs for programmatic use without any GUI at all.

Why people search for "DeepSeek CLI"

If you're coming from tools like the OpenAI Codex CLI or Claude Code — both of which are commonly referred to by that exact "CLI" name — it's natural to look for a "DeepSeek CLI" as the equivalent. DeepSeek's official agent product doesn't market itself primarily as a CLI, though — its most visible entry point is npx @deepseek-ai/dsh web, which launches a browser-based Web UI at http://127.0.0.1:3080. But the dsh binary underneath that command is a full CLI launcher, and it does everything a CLI-first tool would, including running with no browser at all.

The dsh CLI, in brief

dsh has four entry modes:

CommandWhat it does
dsh --profile <name>Launches the profile at $DSH_HOME/profiles/<name>
dsh --profile headless "task text"One-shot, non-interactive task run
dsh webHardcoded alias for --profile web
dsh plugin --profile <name> <pnpm args...>Plugin management, forwarded straight to pnpm

Launcher flags like --patch <path> (layer a YAML config patch), --dump-config (print the combined config tree without starting), and -V/--version must appear before any app-specific arguments. The full reference is in DeepSeek Harness CLI Cheat Sheet.

Headless mode: the actual "no GUI" CLI experience

The mode that behaves most like a traditional CLI tool is headless:

dsh --profile headless "Fix the failing tests in this repository"

This creates a persistent session, runs the task to completion, prints the final response, and exits — completed maps to exit code 0, anything else to 1. Critically, the headless profile doesn't mount an ApiProxy, Host, HTTP server, web runtime, or browser client — there's no listening port at all, making it genuinely suited to scripts and CI pipelines rather than the browser-first Web UI. See DeepSeek Harness Headless Mode for exit codes, SIGTERM behavior, and scripting examples.

Programmatic access: Python and TypeScript SDKs

For anyone who wants "no CLI wrapper at all, just call it from code," DeepSeek publishes an official Python SDK:

python -m pip install deepseek-harness-sdk
from deepseek_harness import DeepSeekHarness

with DeepSeekHarness(
    provider="deepseek-official",
    model="deepseek-v4-flash",
    max_tokens=49_152,
    cwd=str(workspace),
    session_root=str(sessions),
) as harness:
    result = harness.run("Inspect the repository and fix the failing tests.")
print(result.final_response)

It requires Python 3.10+, and the docs list supported platforms as Linux x64, Linux arm64, and macOS 14+ (arm64) — Windows is notably not listed. The SDK bundles its own runtime, so it doesn't need a system Node.js install. Underneath, it drives the same stdio JSON-RPC protocol used by the TypeScript SDK (dsh-sdk-client) and by dsh's ACP (Agent Client Protocol) server for external GUI/orchestration integrations. There's no public REST/HTTP API — the SDKs and ACP are the officially documented ways to drive dsh programmatically. See DeepSeek Harness Python SDK for the full picture, including the danger-full-access warning in the official examples.

"DeepSeek CLI" vs just calling the DeepSeek API from a terminal

It's worth separating two different things people mean by "DeepSeek CLI." One is an agent harness you can drive from the command line — a tool that manages the tool-use loop, file edits, approvals, and session state, which is what dsh is. The other is simply calling DeepSeek's chat API from a terminal, with no agent loop at all — for example with curl against DeepSeek's OpenAI-compatible chat-completions endpoint, or through any generic OpenAI-compatible client library. That second use case doesn't require dsh (or any harness) at all; it's a plain API call. If what you actually want is an agent that can read your repository, run commands, and make edits — not just a chat completion — dsh (or another agent harness pointed at DeepSeek, as covered in Best Harness for DeepSeek V4) is the relevant tool, not a bare API client.

Useful environment variables for CLI and CI usage

A handful of environment variables are specifically relevant if you're driving dsh from scripts or CI rather than interactively:

export DSH_HOME=/custom/path        # harness home dir, default ~/.dsh
export DSH_PERMISSION_MODE=workspace-write   # overrides the process-level permission preset
export DSH_TOOLS_MODE=native        # native | code | both — native tool calls vs "Code Mode"
export DSH_TELEMETRY_DISABLED=1     # hard-disables telemetry, highest priority

Combined with headless mode's clean exit-code semantics (0 for completed, 1 otherwise, 130 on SIGINT, and a five-second graceful-shutdown window on SIGTERM), this is enough to script dsh --profile headless calls inside a CI job without touching the Web UI at all. The full environment variable table lives in DeepSeek Harness CLI Cheat Sheet.

If you want a terminal UI, not just headless output

Headless mode is one-shot and non-interactive by design — it's not a persistent, chat-style terminal session. If what you actually want is an interactive terminal experience similar to what other CLI-first agent tools offer, that's not part of dsh's default install, but it exists as community plugins layered on top of dsh's Web UI-first architecture. dsh-TUI is a Claude Code-style full-screen terminal UI plugin, and dsh-tianshu-tui is another terminal-UI option — see DeepSeek Harness TUI Plugins for the fuller list if the Web UI isn't your preferred interface.

FAQ

Is there an official product literally called "DeepSeek CLI"?

Not as a separate product name. The CLI entry point for DeepSeek Harness is the dsh binary itself, which supports interactive profile launches, one-shot headless tasks, and plugin management commands.

How do I run a one-shot DeepSeek Harness task from a script or CI pipeline?

Use headless mode: dsh --profile headless "task text". It runs without any listening port, prints the final response, and exits with a status code reflecting completion. See DeepSeek Harness Headless Mode.

Can I use dsh without Node.js at all?

Not the standard npx @deepseek-ai/dsh path, which needs Node.js ^22.19.0 || >=24.0.0. If you specifically want to avoid a system Node.js install, the Python SDK (deepseek-harness-sdk) bundles its own runtime — but it's currently limited to Linux x64/arm64 and macOS 14+ arm64, with no Windows support documented.

Does dsh have a real-time interactive terminal chat mode, like a TUI?

Not built in by default — dsh's default interface is the Web UI, and headless mode is one-shot rather than interactive. Community plugins like dsh-TUI add a persistent terminal interface on top of dsh.

Is there a REST API I can call directly, instead of a CLI or SDK?

No. dsh's docs don't describe a public REST/HTTP API intended for third-party integration. The officially supported programmatic paths are the Python and TypeScript SDKs (stdio JSON-RPC underneath) and the ACP server for external orchestration tools.

Next steps