DEV Community

Cover image for How to Use DeepSeek V4 Pro 0813 API ?
Hassann
Hassann

Posted on Originally published at apidog.com

How to Use DeepSeek V4 Pro 0813 API ?

DeepSeek V4 Pro left preview on August 12, 2026. The GA build, stamped 0813, now serves the deepseek-v4-pro API endpoint with a 1M-token context window, 384K maximum output, and cache-hit input pricing of $0.003625 per million tokens. As Unite.AI reported, the model that spent four months in preview is now DeepSeek’s flagship.

Try Apidog today

Launch coverage explains what shipped. This guide focuses on implementation: making your first request with the OpenAI SDK, selecting thinking modes, reading reasoning_content, streaming, tool calling, and structuring prompts for cache efficiency. For architecture background, read What is DeepSeek V4.

TL;DR

  • deepseek-v4-pro is the production endpoint for the GA 0813 build as of August 12, 2026.
  • The API is OpenAI-compatible: use the openai SDK with base_url="https://api.deepseek.com".
  • The model supports a 1M-token context window, up to 384K output tokens, and three reasoning modes: none, high, and max.
  • Thinking modes expose reasoning in reasoning_content; do not add that field back into subsequent conversation history.
  • Input costs are $0.435/M tokens on a cache miss and $0.003625/M on a cache hit. Output costs $0.87/M tokens.
  • Test requests, streams, and cache behavior before production. Keep Pro and Flash configurations side by side in Apidog.

What GA build 0813 changes for developers

The V4 Pro preview opened in April 2026. V4 Flash followed in July, and V4 Pro reached general availability as build 0813 on August 12, following DeepSeek’s datestamp convention, similar to v3-0324.

DeepSeek V4 Pro GA announcement

GA changes three practical things:

  1. You have a stable target. Preview models can change behavior and invalidate prompt tuning or eval results. Build 0813 is the production snapshot until DeepSeek publishes another one.
  2. Use the production alias. Call deepseek-v4-pro through the official API. To pin the snapshot through another provider, OpenRouter lists deepseek/deepseek-v4-pro-0813.
  3. The full feature set is available. Thinking modes, function calling, structured outputs, prompt caching, and OpenAI, Anthropic, and Responses-style APIs are available on the GA endpoint.

Under the hood, V4 Pro is a mixture-of-experts model with 1.6T total parameters and 49B active parameters per token. Its Compressed Sparse Attention and Heavily Compressed Attention designs reduce single-token inference compute to 27% of V3.2’s and KV cache usage to 10%.

DeepSeek V4 Pro 0813: specs

Spec DeepSeek V4 Pro 0813
Release GA on August 12, 2026, snapshot 0813
Architecture Mixture-of-experts, 1.6T total parameters, 49B active per token
Attention Compressed Sparse Attention + Heavily Compressed Attention
Inference cost vs. V3.2 27% single-token compute, 10% KV cache
Context window 1,000,000 tokens
Maximum output 384K tokens
Thinking modes non-think, think high, think max
Input price $0.435/M tokens on cache miss; $0.003625/M on cache hit
Output price $0.87/M tokens
API formats OpenAI Chat Completions, Anthropic Messages, DeepSeek Responses
Model ID deepseek-v4-pro
Smaller sibling deepseek-v4-flash — 284B total / 13B active, $0.14/M input and $0.28/M output

DeepSeek’s model card reports SWE-bench Verified at 80.6%, Terminal Bench 2.0 at 67.9%, GPQA Diamond at 90.1%, and LiveCodeBench at 93.5% for V4-Pro-Max. These are vendor-reported results, so run task-specific evals before migrating production workloads.

Get an API key and make your first request

1. Create and export an API key

  1. Create an account at platform.deepseek.com and add credit. The API is prepaid.
  2. Open API Keys, generate a key, and copy it when shown.
  3. Store it in an environment variable:
export DEEPSEEK_API_KEY="sk-..."
Enter fullscreen mode Exit fullscreen mode

2. Install the OpenAI SDK

pip install openai
Enter fullscreen mode Exit fullscreen mode

DeepSeek supports the OpenAI Chat Completions protocol. Use either https://api.deepseek.com or https://api.deepseek.com/v1 as the base URL. The /v1 path is for protocol compatibility, not a model version.

3. Send a chat completion

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["DEEPSEEK_API_KEY"],
    base_url="https://api.deepseek.com",
)

response = client.chat.completions.create(
    model="deepseek-v4-pro",
    messages=[
        {
            "role": "system",
            "content": "You are a concise technical assistant.",
        },
        {
            "role": "user",
            "content": "Explain idempotency in REST APIs in two sentences.",
        },
    ],
)

print(response.choices[0].message.content)
print(response.usage)
Enter fullscreen mode Exit fullscreen mode

Log response.usage from the start. A long prompt cache miss and a long prompt cache hit have very different costs.

Smoke-test with cURL

curl https://api.deepseek.com/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DEEPSEEK_API_KEY" \
  -d '{
    "model": "deepseek-v4-pro",
    "messages": [
      {
        "role": "user",
        "content": "List three ways to version a REST API."
      }
    ]
  }'
Enter fullscreen mode Exit fullscreen mode

See the official DeepSeek docs for the complete parameter reference, Anthropic-compatible endpoint, and DeepSeek Responses API.

Work with the three thinking modes

V4 Pro exposes reasoning through a reasoning_effort parameter.

API value Mode Use it for
none non-think Extraction, classification, formatting, summaries
high think high Coding, debugging, multi-step analysis
max think max Difficult tasks that justify additional latency and output-token cost

Use reasoning_effort in a standard Chat Completions request:

response = client.chat.completions.create(
    model="deepseek-v4-pro",
    reasoning_effort="high",  # "none" | "high" | "max"
    messages=[
        {
            "role": "user",
            "content": (
                "Our API returns 502s under load but only behind the CDN. "
                "Walk through likely causes in order of probability."
            ),
        },
    ],
)

message = response.choices[0].message

print("--- Reasoning ---")
print(message.reasoning_content)

print("--- Answer ---")
print(message.content)
Enter fullscreen mode Exit fullscreen mode

Two implementation rules:

  • Do not send reasoning_content back in conversation history. Persist and resend only previous message content.
  • Budget for reasoning tokens. Reasoning is billed as output at $0.87/M tokens. Use max only when the task needs it.

Stream responses

For large outputs or thinking-enabled requests, use streaming. In reasoning modes, reasoning_content deltas typically arrive before answer content deltas.

stream = client.chat.completions.create(
    model="deepseek-v4-pro",
    reasoning_effort="high",
    stream=True,
    messages=[
        {
            "role": "user",
            "content": (
                "Design a rate limiter for a public API. "
                "Compare token bucket and sliding window."
            ),
        },
    ],
)

for chunk in stream:
    if not chunk.choices:
        continue  # The final chunk may contain usage only.

    delta = chunk.choices[0].delta

    if getattr(delta, "reasoning_content", None):
        print(delta.reasoning_content, end="", flush=True)
    elif delta.content:
        print(delta.content, end="", flush=True)
Enter fullscreen mode Exit fullscreen mode

For a user-facing application:

  1. Render reasoning as a collapsed “Thinking” section.
  2. Switch to normal answer rendering when content deltas begin.
  3. Record final usage data for cost monitoring.

The stream uses server-sent events. See this guide to streaming API responses with SSE for the protocol details.

Add tool calling and structured outputs

V4 Pro supports OpenAI-style function calling. Define tools, inspect tool_calls, execute them in your application, append tool results to the conversation, and call the model again.

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_endpoint_status",
            "description": "Check the health of an internal API endpoint",
            "parameters": {
                "type": "object",
                "properties": {
                    "endpoint": {
                        "type": "string",
                        "description": "Path, for example /v1/orders",
                    }
                },
                "required": ["endpoint"],
            },
        },
    }
]

response = client.chat.completions.create(
    model="deepseek-v4-pro",
    messages=[
        {
            "role": "user",
            "content": "Is /v1/orders healthy right now?",
        }
    ],
    tools=tools,
)

print(response.choices[0].message.tool_calls)
Enter fullscreen mode Exit fullscreen mode

For guaranteed parseable JSON, use the standard response_format parameter. Refer to the official DeepSeek docs for the expected tool-result message shapes.

Design prompts for automatic caching

Prompt caching has a major impact on long-context costs. DeepSeek automatically caches repeated prompt prefixes:

  • Cache miss: $0.435/M input tokens
  • Cache hit: $0.003625/M input tokens
  • Discount: 120x

You do not configure cache headers or a cache TTL. Instead, structure prompts so stable text comes first.

Recommended prompt layout

1. System instructions
2. Static policies and tool definitions
3. Documentation or repository context
4. Previous user-visible conversation content
5. Latest user request
6. Volatile metadata: timestamps, request IDs, trace IDs
Enter fullscreen mode Exit fullscreen mode

Avoid putting volatile values in system instructions or early prompt sections. A changed timestamp near the beginning invalidates the cache from that point forward.

Example: 200K-token coding-agent context

Suppose an agent keeps a 200K-token repository context and makes 50 requests:

  • Without caching: 50 × 200K × $0.435/M ≈ $4.35
  • With caching: one miss at $0.087 plus 49 hits at roughly $0.0007 each, or approximately $0.12

That is roughly 35x cheaper for the same session.

A full 1M-token prompt costs $0.435 on a cache miss, but a stable cached prefix costs about a third of a cent per read. Learn more in What is prompt caching.

Test DeepSeek V4 Pro in Apidog

Before integrating V4 Pro into production, verify request shape, streaming behavior, model routing, and usage data. Since the API is OpenAI-compatible, Apidog can work with it without special handling.

Testing DeepSeek V4 Pro in Apidog

  1. Import a request. Paste the earlier cURL command into Apidog to create an editable request with parsed headers, authentication, and body.
  2. Create Pro and Flash environments. Put base_url, API key, and model name into environment variables. Then switch between deepseek-v4-pro and deepseek-v4-flash without editing request bodies.
  3. Inspect streaming behavior. Send a request with "stream": true to view the SSE event timeline and confirm that reasoning_content arrives before answer content.
  4. Save regression cases. Store representative prompts in a collection. When a new snapshot ships, rerun the same requests and compare behavior before upgrading.
  5. Check token usage. Use each response’s usage block to measure cache-hit behavior while adjusting prompt structure.

Pricing today and the announced increase

Current list prices:

Model Input: cache miss Input: cache hit Output
deepseek-v4-pro $0.435/M $0.003625/M $0.87/M
deepseek-v4-flash $0.14/M $0.28/M

On August 6, 2026, DeepSeek warned that a “significant” API price increase is coming. It did not provide figures or an effective date.

Prepare by:

  • Measuring current per-task costs using actual usage data.
  • Keeping stable prompt prefixes to maximize cache hits.
  • Routing high-volume, simple tasks to V4 Flash.
  • Reserving V4 Pro and higher reasoning efforts for tasks that need long-context analysis, agentic coding, or deeper reasoning.

For a detailed pricing breakdown, see the DeepSeek V4 API pricing guide.

FAQ

Will my existing OpenAI SDK code work unchanged?

Almost. Change base_url to https://api.deepseek.com, provide a DeepSeek API key, and set model="deepseek-v4-pro". Chat Completions, streaming, tools, and structured outputs use OpenAI-compatible shapes.

If your application uses the Anthropic SDK, DeepSeek also provides an Anthropic Messages-compatible endpoint.

When should I use V4 Flash instead of V4 Pro?

Use V4 Flash for high-volume and latency-sensitive work such as classification, extraction, simple chat, and formatting.

Use V4 Pro for agentic coding, long-context analysis, and thinking-mode workloads. Route requests by task requirements rather than using one model for everything.

Can I use V4 Pro 0813 in Cursor?

Yes. Cursor accepts custom OpenAI-compatible endpoints, so you can configure the GA build as a custom model. See How to use DeepSeek V4 Pro with Cursor.

Wrap up

Start with a minimal integration, then validate the pieces that affect production behavior:

  1. Make a basic Chat Completions request.
  2. Select reasoning_effort per task.
  3. Stream long outputs.
  4. Implement tool-call loops where needed.
  5. Log usage.
  6. Keep stable prompt prefixes for cache hits.
  7. Save reproducible requests in an Apidog collection for regression testing.

The 120x cache-hit discount makes prompt ordering an architecture concern. Measure usage, test with representative workloads, and re-run your saved requests when DeepSeek releases another snapshot or changes pricing.

Top comments (0)