TL;DR

Long conversations can resend much more input than the latest message suggests. Keep the current goal, constraints, decisions and essential evidence in a concise task record, and retrieve older details when needed. Trim repeated history and oversized tool output first. Check that the result still satisfies the task: summarization costs tokens, can lose information and may change a reusable cache prefix.

01 / Conversation history and repeated input tokens

With a stateless chat API, the client usually sends relevant conversation history on every turn. A short new message can accompany a long billed input. The visible size of your new message is not the size of the entire request.

02 / Context summaries: keep a concise task record

Summarize the goal, confirmed decisions, changed files, pending work, and essential evidence. Preserve user constraints and text that must remain exact. Keep original material retrievable because summaries lose detail.

Goal: …
Constraints: …
Completed work and evidence: …
Current blocker: …
Next action: …

03 / Tool output: retrieve details on demand

Search for relevant files and symbols before reading large sections. Start with lines around a failure and expand only when needed. Avoid repeatedly including dependency folders, generated files, or entire lockfiles.

04 / Context compression: preserve essential evidence

Summarizing also costs tokens and may break a reusable prefix. Decide when to compact based on input growth, task changes, and answer quality rather than clearing history on a fixed schedule.

Sources and further reading

DS-V4-HUUB · DeepSeek Stateless Chat History Guide ↗api-docs.deepseek.com · Official documentation ↗

Adapted from the source guide, last updated 2026-06-27. Savings depend on your workload and must be measured.