DeepSeek · Sep 9, 2026

DeepSeek V4 Pro API: A Developer's Guide

DeepSeek V4 Pro peak and off-peak pricing, 1M context budgeting, OpenAI-compatible migration, caching, and production checks.

AIWave EngineeringDated 2026-09-09Technical guide
Abstract data-flow illustration for DeepSeek V4 Pro API: A Developer's Guide

DeepSeek V4 Pro is built for agent and coding workloads that need more room than a normal chat request. Its official API exposes a 1M-token context window, up to 384K output, tool calls, JSON output, the Responses API and an Anthropic-compatible endpoint.

That capacity changes what you can send. It does not remove the need to budget tokens, latency and retries.

The current direct price has two clocks

DeepSeek introduced weekday peak and off-peak billing on 2026-08-16. Peak hours are 01:00–04:00 and 06:00–10:00 UTC, Monday through Friday. All other periods are off-peak. Off-peak rates are half of peak rates.

For V4 Pro, the official direct rates per 1M tokens are:

MeterOff-peakPeak
Cached input$0.022$0.044
Uncached input$0.66$1.32
Output$1.98$3.96

Check the official rate page before committing a budget. Model prices are operational data, not permanent documentation.

Peak/off-peak pricing is useful when the job can wait: nightly repository analysis, batch extraction, backfills and evaluation runs. It matters less for an interactive agent that has to answer now. Do not delay a user-facing request to save a fraction of the token bill unless the product can tolerate it.

Moving an OpenAI client

With AIWave, an existing OpenAI client normally needs two configuration changes:

python
client = OpenAI(api_key=os.environ["AIWAVE_API_KEY"], base_url="https://aiwave.live/v1")
model = "deepseek-v4-pro"

Then call client.chat.completions.create(...) as usual. Keep the model ID visible in configuration so a route change remains deliberate and reviewable.

A direct DeepSeek integration follows the same pattern with DeepSeek's base URL and credential. The advantage of a compatible gateway is operational: the same client can test a different Chinese model without another payment account or another integration branch. The tradeoff is a gateway markup and another dependency in the request path.

How to use a 1M-token window

Do not begin by filling it. Begin with a context budget.

For a repository agent, split the request into stable and changing material. Repository maps, interface summaries and policy files are relatively stable; the current diff, failing logs and user instruction change on every turn. Put stable content in repeatable chunks so cache behavior can help. Send only the current evidence needed for the next decision.

Reserve output headroom. A request that consumes the entire advertised window leaves no useful space for reasoning, tool results or the final answer. Your budget should include:

  • system and policy instructions;
  • user messages and conversation state;
  • retrieved files or documents;
  • tool-call inputs and results;
  • expected reasoning and final output;
  • a safety margin for tokenization differences.

Use the usage object returned by the API as the billing record. Character counts are planning estimates. They are not a substitute for provider-reported tokens.

Cache economics

The difference between cached and uncached input is substantial. But a cache only helps when the prefix is stable enough to match. Reordering files, inserting timestamps near the top, or changing a large system prompt can turn an expected cache hit into a miss.

Measure the result instead of assuming it. Log cached input, uncached input, output, latency, retries and status for each request. A cheap cached prompt that repeatedly fails is not cheap.

Production checklist

  1. Pin deepseek-v4-pro in configuration and record the date you validated it.
  2. Test tool calls and structured output with your own schemas.
  3. Set request and output limits below the model maximum.
  4. Handle 401, 402, 429 and upstream 5xx responses separately.
  5. Retry only idempotent work, with a cap and jitter.
  6. Reconcile the API usage object against the per-request ledger.
  7. Keep one tested fallback, but never change it silently.

V4 Pro's long context is most valuable when it lets the model see the evidence that changes a decision. Sending everything is easy. Sending the right evidence, with a cost trail you can audit, is the engineering work.

Primary references

Test the route with your own workload

Use one key, choose an explicit model ID, and check every request against the ledger.

Run a first request