# How to Use the 1 Million Token Context Window in DeepSeek-TUI

> Unlock the 1 million token context window in DeepSeek-TUI by configuring the client with deepseek-v4-pro or deepseek-v4-flash models. Process extensive data without truncation in a single request.

- Repository: [DeepSeek/awesome-deepseek-agent](https://github.com/deepseek-ai/awesome-deepseek-agent)
- Tags: how-to-guide
- Published: 2026-08-15

---

**To use the 1 million token context window in DeepSeek-TUI, configure the client to use either the `deepseek-v4-pro` or `deepseek-v4-flash` model by setting the `model` key in `~/.deepseek/config.toml` (lines 66-73) or exporting the `DEEPSEEK_MODEL` environment variable (lines 70-73), which allows the API to process up to 1,000,000 tokens in a single request without truncation.**

DeepSeek-TUI is a terminal-based AI coding assistant that interfaces directly with the DeepSeek API. According to the `deepseek-ai/awesome-deepseek-agent` repository, this tool leverages the **DeepSeek-V4-Pro** and **DeepSeek-V4-Flash** models—both of which provide a full **1 million-token context window**—enabling analysis of extensive codebases, multi-file reasoning, and large documentation sets within a single conversation turn.

## How the 1 Million Token Context Window Works

The 1M-token capability relies on a combination of API-side model architecture and client-side configuration. According to [`docs/deepseek-tui.md`](https://github.com/deepseek-ai/awesome-deepseek-agent/blob/main/docs/deepseek-tui.md) (line 5), the V4-Pro and V4-Flash models are explicitly trained with a 1M-token context limit, allowing a single request to contain up to one million tokens of prompt plus conversation history.

The DeepSeek-TUI CLI acts as the front-end client. By default, it selects the **DeepSeek-V4-Pro** model, automatically enabling the large context window. When the selected model supports the extended context range, the CLI transmits the full prompt without truncation, letting you work with very long inputs that would exceed standard 4K or 8K limits.

## Configuring the 1 Million Token Context

Before using the extended context, install DeepSeek-TUI and authenticate with your API key.

### Prerequisites

Install the CLI using **npm** or **Cargo**, or download a prebuilt binary from the GitHub releases page:

```bash
npm install -g deepseek-tui

```

Then authenticate by storing your API key using the built-in auth command or environment variable:

```bash
deepseek auth

# Or set directly:

export DEEPSEEK_API_KEY="your-api-key-here"

```

### Permanent Configuration via config.toml

For persistent settings across sessions, edit the user-level configuration file at `~/.deepseek/config.toml`. As documented in [`docs/deepseek-tui.md`](https://github.com/deepseek-ai/awesome-deepseek-agent/blob/main/docs/deepseek-tui.md) (lines 66-73), set the `model` field to a 1M-token capable variant:

```toml

# ~/.deepseek/config.toml

model = "deepseek-v4-pro"

```

This configuration applies to all future TUI sessions. The client reads this file on startup and initializes the API connection with the specified model.

### Temporary Override via Environment Variables

For ad-hoc usage without modifying configuration files, export the `DEEPSEEK_MODEL` variable before launching the TUI. As shown in lines 70-73 of the documentation:

```bash
export DEEPSEEK_MODEL=deepseek-v4-pro
deepseek

```

This overrides any value set in `~/.deepseek/config.toml` for the current shell session only, forcing the client to use the 1M-token model immediately.

## Verifying Your Configuration

To confirm that DeepSeek-TUI is utilizing the 1 million token context model, execute the diagnostic command:

```bash
deepseek doctor

```

The expected output identifies the active model and its capabilities, displaying `Model: deepseek-v4-pro (1M token context)` when properly configured. This verification step ensures your environment variable or config file changes have taken effect.

## Working with Large Contexts in Practice

Once configured, navigate to your project directory and launch the TUI:

```bash
cd /path/to/large-project
deepseek

```

You can now paste or load files that collectively exceed 100,000 tokens. The model will accept up to 1,000,000 tokens in a single turn, enabling comprehensive analysis of entire repositories or extensive documentation sets. Note that the large context does not alter the TUI shortcuts or interaction workflow; it solely expands the amount of information the model can retain and process per conversation turn.

## Summary

- DeepSeek-TUI supports the **1 million token context window** exclusively through the **DeepSeek-V4-Pro** and **DeepSeek-V4-Flash** models.
- By default, the CLI selects **V4-Pro**, automatically enabling the extended context unless overridden.
- Configure the model permanently in `~/.deepseek/config.toml` using the `model` key, or temporarily via the `DEEPSEEK_MODEL` environment variable.
- The client sends full prompts without truncation when a 1M-token model is selected, as confirmed by the `deepseek doctor` diagnostic tool.
- This capability enables single-turn analysis of very large codebases and documentation files up to the 1,000,000 token limit.

## Frequently Asked Questions

### Which DeepSeek-TUI models support the 1 million token context?

The **DeepSeek-V4-Pro** (default) and **DeepSeek-V4-Flash** models both provide the full 1 million-token context window. These are the only models in the DeepSeek API lineup that support this extended limit. When either model is selected via [`config.toml`](https://github.com/deepseek-ai/awesome-deepseek-agent/blob/main/config.toml) or environment variables, the TUI automatically enables full 1M-token processing.

### How do I know if my prompt is being truncated?

If you have explicitly selected a 1M-token model using the configuration methods described in [`docs/deepseek-tui.md`](https://github.com/deepseek-ai/awesome-deepseek-agent/blob/main/docs/deepseek-tui.md), the DeepSeek-TUI client automatically sends the full prompt without truncation. You can verify the active model and its supported context limits by running `deepseek doctor`, which reports the current model name and token capacity.

### Can I use the 1M context window with custom API endpoints?

The context window capability depends entirely on the underlying model served by the API endpoint. If your custom endpoint hosts **DeepSeek-V4-Pro** or **V4-Flash** (or compatible models with 1M-token architecture), setting the appropriate `model` identifier in DeepSeek-TUI will enable the full context. However, if the endpoint serves models with smaller native context windows (such as standard 4K or 8K variants), the client cannot exceed those limits regardless of configuration.

### Does using the 1 million token context affect API costs or response speed?

While the source documentation does not specify pricing or latency details, processing 1 million tokens requires substantially more computational resources than standard context windows. Requests utilizing the full 1M-token capacity will likely incur higher costs and may experience longer processing times compared to smaller prompts, depending on the complexity of the input and current API load. The `deepseek-v4-flash` model may offer faster throughput than `deepseek-v4-pro` when working with large contexts.