How to Reduce DeepSeek API Costs

A DeepSeek API bill is cache-hit input, cache-miss input and output tokens, multiplied by the model, the hour and the thinking setting. A cache hit on deepseek-flash costs 2% of a miss, and peak hours cost twice off-peak. Find out which workload, token type and hour are spending the money first. Then work through eight levers in order: keep the prompt prefix stable, move work that can wait off-peak, use deepseek-flash unless a request needs deepseek-v4-pro, set thinking and reasoning_effort per request, cap the output, trim the input, update old model names, and add a router last. No savings percentage, because the result depends on your traffic.

Published 2026-11-26 by Dor Amir on the Nadir blog.

Filed under Pricing & Models.

To reduce DeepSeek API costs, first find out which workload and which token type are spending the money. Then work through eight levers in order: keep the prompt prefix stable so input bills as a cache hit, move work that can wait into off-peak hours, use deepseek-flash unless a request needs deepseek-v4-pro, set thinking and reasoning_effort per request, cap the output, trim the input, update old model names, and add a router last. On DeepSeek, caching matters more than on most providers. In November 2026 a cache-hit input token on deepseek-flash cost $0.003 per million off-peak, against $0.15 for a cache miss, so a hit costs 2% of a miss.

This is a checklist, not a benchmark. It contains no savings percentage, because the result depends on your traffic. Prices, peak hours, caching behaviour and thinking controls come from DeepSeek's own API documentation as of November 26, 2026. DeepSeek has repriced several times in 2026, so check the [DeepSeek pricing page](https://api-docs.deepseek.com/quick_start/pricing) before you plan around a number.

Where a DeepSeek bill comes from.

DeepSeek bills per token from a prepaid balance, with three token types and two times of day:

Per 1M tokens (Nov 2026)deepseek-flash off-peakdeepseek-flash peakdeepseek-v4-pro off-peakdeepseek-v4-pro peak
Input, cache hit$0.003$0.006$0.022$0.044
Input, cache miss$0.15$0.30$0.66$1.32
Output (answer and thinking)$0.60$1.20$1.98$3.96

Four things set the rate on a given request:

Server-side web search and fetch calls triggered by the model are no longer billed per call since November 18, 2026. The results they return go into the context and bill as input tokens, so a search-heavy agent shows up as input spend.

Step 0: measure before you change anything.

If cache-miss input is the largest share, start with levers 1 and 6. If peak-hour traffic is a large share and some of it can wait, start with lever 2. If output is the largest share, start with levers 4 and 5.

The eight levers.

1. Keep the prompt prefix stable

DeepSeek caches prompt prefixes on disk automatically. Its documentation says a later request hits the cache only if it fully matches a stored prefix unit. Units are stored at the end of each request's input and output, at fixed token intervals in long prompts, and wherever the system notices a prefix shared across requests. In practice:

Caching is best effort, building a cache entry takes seconds, and unused entries are cleared within hours to days. If prompt_cache_hit_tokens stays near zero on requests that share a long prefix, something near the top of the prompt is changing. Why caching comes first is in The Closest Thing to Free Money.

2. Move work that can wait into off-peak hours

DeepSeek's documentation lists no Batch API. Its discount for flexible work is the off-peak window, which halves every token type. Evaluations, backfills, enrichment, nightly classification and document processing can be queued and released outside 01:00 to 04:00 and 06:00 to 10:00 UTC on weekdays. The peak window falls in the European morning and the Asian afternoon, so interactive traffic from those regions pays the peak rate whatever you do. Schedule only the jobs you control. Batch and time-of-day discounts across providers are compared in Half Price, One Day Late.

3. Use deepseek-flash unless a request needs deepseek-v4-pro

Both models have a 1M-token context and support JSON output and tool calls. Flash also takes images, and its concurrency limit is 2,500 against 500 for Pro. Classification, extraction, short summaries and most chat run on Flash. Send a request type to Pro when you have measured that Flash fails on it, and compare cost per completed task rather than per token. In a multi-turn conversation, choose the model at the start, because the cache is per model and a switch re-sends the whole prefix at the miss rate. That cost is worked through in Your Router Is Fighting Your Prompt Cache.

4. Set thinking and reasoning effort per request

Thinking is on by default at high effort on both models, so a team that never set it pays for thinking on every request. On the OpenAI-format API, turn it off with extra_body={"thinking": {"type": "disabled"}}, or keep it on and set reasoning_effort to low, high or max. DeepSeek maps minimal to low and medium to high, so asking for medium does not save anything over high. Disable thinking for lookups, formatting and extraction, and use max only where you have measured that the task needs it.

The history rules differ from other providers. Without tools, earlier reasoning_content is ignored if you send it back, so it does not inflate later turns. With tools, DeepSeek expects the earlier reasoning to be passed back and it is added to the context, so in an agent loop thinking tokens are also billed as input on every later turn. Cross-provider settings are in The Overthinking Tax.

5. Cap and shrink the output

Output costs four times uncached input on deepseek-flash and three times on deepseek-v4-pro, and the maximum output is 384K tokens. Set max_tokens to what the feature needs. Ask for the format you will parse, a label or a JSON object with only the fields you read, and use JSON output so a malformed answer does not cost a retry that pays the full input again. More patterns are in The Expensive Half.

6. Trim the input

A 1M-token context window makes it easy to send far more than the model needs, and every uncached token bills at the miss rate. Send the relevant chunk, not the whole document, and check how many retrieved chunks each query adds, as covered in Twenty Chunks, Three Read. Drop tool definitions the request cannot use. In agent loops, clear old tool results instead of carrying them forward, and watch what web search and fetch add to the context. Trimming inside the cached prefix changes the prefix, so trim when you deploy, not on each request.

7. Update old model names and check prices on a schedule

DeepSeek renames and retires models often. The legacy names deepseek-v4-flash and deepseek-v4-flash-vision-exp are still accepted, but those models are retired and the requests are served by the current Flash model at the Flash price. Code using the older deepseek-chat and deepseek-reasoner aliases needs checking too. Move to the documented names so that what you test is what you pay for. Read the pricing page on a schedule as well. A price table hard-coded in routing logic goes stale without any error, as described in The Cheapest Model in Your Routing Table Just Sent a Warning Shot.

8. Add a router last

Choosing the model and thinking setting in code (levers 3 and 4) works until the request types blur and nobody can say which ones need Pro or max effort. A router helps when traffic is a real mix of easy and hard requests. It does not help when Flash with thinking off already passes nearly everything, which on DeepSeek is common, or when a switch would throw away a warm cache. We published our own negative results in When LLM Routing Does Not Help, and compared the products in How to Choose an LLM Router.

Self-hosting the open weights is a utilization bet.

DeepSeek publishes open weights, so self-hosting is possible. At DeepSeek's API prices it rarely pays: the GPUs have to stay busy to beat $0.15 per million input tokens, and off-peak and cache-hit rates are lower still. Teams usually self-host for data residency or control rather than price. Measure your sustained tokens per minute on the API first. The arithmetic is in Self-Hosted LLM vs API.

Where Nadir fits.

Nadir covers lever 8 and part of lever 4, and on DeepSeek it does that through the decision API.

Nadir does not do levers 1, 2, 5, 6 or 7 for you. Prompt prefix, scheduling, output size, input size and model names are yours to change, and on DeepSeek, where a cache hit costs 2% of a miss, they are usually the larger share of the bill. Nadir publishes no universal savings rate. Measure first, then decide whether a router is worth adding.

The same checklist for the other platforms is How to Reduce OpenAI API Costs, How to Reduce Claude API Costs, How to Reduce Gemini API Costs, How to Reduce Amazon Bedrock Costs, How to Reduce Azure OpenAI Costs and How to Reduce Mistral API Costs. The provider-neutral version is How to Reduce LLM API Costs.

Conclusion.

First find out which workload, which token type and which hour are spending the money. Keep the prompt prefix stable and user_id consistent so input bills as a cache hit. Move work that can wait out of the weekday peak windows. Use deepseek-flash by default, turn thinking off where it adds nothing, cap the output and trim the input. Update old model names and re-read the price page on a schedule. Add a router once the model choice needs to happen without anyone maintaining it by hand.

More on pricing & models

Pages on this site

Machine-readable summaries of this site: llms.txt and llms-full.txt.