/>
AIWave API

DeepSeek V4 API: Complete Guide & Tutorial 2026

DeepSeek V4 API Guide Tutorial Pricing
Published: June 25, 2026 · Updated: June 25, 2026

DeepSeek V4 is the latest flagship model from DeepSeek, aimed at coding, reasoning and multilingual work. With a 128K context window and capabilities that rival GPT-4 at a fraction of the cost, DeepSeek V4 has quickly become one of the most popular open-weight models among developers.

In this guide, you'll learn everything about the DeepSeek V4 API: how to get started, pricing details, code examples in Python and Node.js, and a direct comparison with DeepSeek V3, DeepSeek V3.2, and GPT-4.

What is DeepSeek V4?

DeepSeek V4 (also known as DeepSeek V4 Pro) is part of a broader ecosystem of Chinese AI models including Baidu's ERNIE 4.0 and Zhipu's GLM-5 is the fourth-generation large language model from DeepSeek. Released as an open-weight model, it offers:

There are two variants: DeepSeek V4 Pro (the full flagship model) and DeepSeek V4 Flash (a faster, more affordable option). Both are available through the AIWave API.

DeepSeek V4 API Pricing

Model Input (per 1M tokens) Output (per 1M tokens) Context
DeepSeek V4 Pro $0.14 $0.28 128K
DeepSeek V4 Flash $0.07 $0.14 128K
DeepSeek V3 (previous gen) $0.27 $1.10 64K
GPT-4o (for comparison) $2.50 $10.00 128K

💡 Key insight: DeepSeek V4 Pro is ~18x cheaper than GPT-4o on input, making it the best price-performance option for most applications. Compared to DeepSeek V3, it's nearly half the price with better performance.

Getting Started: DeepSeek V4 API Tutorial

Step 1: Get Your API Key

To use the DeepSeek V4 API, you need an API key from a provider. With AIWave, you get $0.20 starter credit instantly — no credit card required.

Sign up at AIWave and grab your API key in under 2 minutes.

Step 2: Install the OpenAI SDK

DeepSeek V4 uses the OpenAI-compatible API format, so you can use the standard openai Python package or the official AIWave SDK:

# Option 1: Standard OpenAI SDK
pip install openai

# Option 2: AIWave SDK (recommended)
pip install aiwave

For Node.js:

# Option 1: Standard OpenAI SDK
npm install openai

# Option 2: AIWave SDK (recommended)
npm install aiwave

Step 3: Make Your First API Call

Python Example:

from openai import OpenAI

client = OpenAI(
    base_url="https://aiwave.live/v1",
    api_key="your-api-key-here"
)

response = client.chat.completions.create(
    model="deepseek-v4-pro",
    messages=[
        {"role": "user", "content": "Explain the advantages of DeepSeek V4 over DeepSeek V3."}
    ]
)

print(response.choices[0].message.content)

Node.js Example:

import OpenAI from 'openai';

const client = new OpenAI({
    baseURL: 'https://aiwave.live/v1',
    apiKey: 'your-api-key-here'
});

const response = await client.chat.completions.create({
    model: 'deepseek-v4-pro',
    messages: [
        { role: 'user', content: 'Compare DeepSeek V4 vs DeepSeek V3 architecture.' }
    ]
});

console.log(response.choices[0].message.content);

Step 4: Try Streaming Responses

from openai import OpenAI

client = OpenAI(
    base_url="https://aiwave.live/v1",
    api_key="your-api-key-here"
)

stream = client.chat.completions.create(
    model="deepseek-v4-pro",
    messages=[{"role": "user", "content": "Write a quick tutorial on DeepSeek V4 API streaming."}],
    stream=True
)

for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

DeepSeek V4 vs V3 vs GPT-4: Which Should You Use?

Feature DeepSeek V4 Pro DeepSeek V3 GPT-4o
Context Window 128K 64K 128K
Input Price (1M tokens) $0.14 $0.27 $2.50
Output Price (1M tokens) $0.28 $1.10 $10.00
Coding ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐ ⭐⭐⭐⭐⭐
Reasoning ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐ ⭐⭐⭐⭐⭐
Multilingual ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐ ⭐⭐⭐⭐⭐
Availability ✅ AIWave API ✅ AIWave API OpenAI-only
No regional mobile ✅ Yes ✅ Yes N/A

🎯 Recommendation: For most applications, DeepSeek V4 Pro offers the best balance of performance and cost. Use DeepSeek V4 Flash for high-throughput, cost-sensitive workloads. DeepSeek V3 remains a solid fallback option for legacy integrations.

Using DeepSeek V4 with Function Calling

from openai import OpenAI

client = OpenAI(
    base_url="https://aiwave.live/v1",
    api_key="your-api-key-here"
)

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_weather",
            "description": "Get current weather for a city",
            "parameters": {
                "type": "object",
                "properties": {
                    "location": {"type": "string", "description": "City name"}
                },
                "required": ["location"]
            }
        }
    }
]

response = client.chat.completions.create(
    model="deepseek-v4-pro",
    messages=[{"role": "user", "content": "What's the weather in San Francisco?"}],
    tools=tools
)

print(response.choices[0].message.tool_calls)

DeepSeek R1 for Chain-of-Thought Reasoning

For tasks that require step-by-step reasoning, DeepSeek R1 (also known as DeepSeek Reasoner) is the specialized chain-of-thought model. While DeepSeek V4 handles most tasks, DeepSeek R1 excels at complex math, logic puzzles, and multi-step problems.

Both models are available through the same AIWave API key — just change the model parameter.

DeepSeek API Pricing: Final Comparison

Model Best For Price (Input)
deepseek-v4-pro Best all-rounder $0.14/M tokens
deepseek-v4-flash Fast & affordable $0.07/M tokens
deepseek-reasoner Chain-of-thought reasoning $0.55/M tokens
deepseek-v3 Legacy, fallback $0.27/M tokens

All DeepSeek models, along with ERNIE 4.0 (Baidu), GLM-5, and 50+ other Chinese AI models, are available through the AIWave API. Use one API key to access DeepSeek V4, V3, R1, and 50+ other Chinese AI models including GLM-5, Kimi K2, ERNIE 4.0, and Qwen.

Start Building with DeepSeek V4 Today

Get $0.20 starter credit. No credit card. No regional mobile

Get Your API Key →

Change one line of code. That's it.

Frequently Asked Questions

Is DeepSeek V4 better than DeepSeek V3?

Yes. DeepSeek V4 significantly outperforms DeepSeek V3 on coding, reasoning, and multilingual benchmarks, while being nearly half the price. The V4 model family includes both Pro (flagship) and Flash (fast/affordable) variants.

Can I use DeepSeek V4 with the OpenAI SDK?

Absolutely. AIWave provides a 100% OpenAI-compatible API. Just change your base_url to https://aiwave.live/v1 and use the standard OpenAI SDK. No code changes needed.

What's the difference between DeepSeek V4 Pro and DeepSeek V4 Flash?

DeepSeek V4 Pro is the full flagship model with maximum performance. DeepSeek V4 Flash is optimized for speed and cost, making it ideal for high-volume production applications.

Does DeepSeek V4 support function calling?

Yes. DeepSeek V4 Pro supports function calling (tools), JSON mode, and streaming, making it suitable for production applications.

What is DeepSeek R1 and how is it different from V4?

DeepSeek R1 (Reasoner) is a specialized chain-of-thought model for complex reasoning tasks. While DeepSeek V4 handles general tasks efficiently, R1 excels at step-by-step problem solving. Both are available through the same API key.

References

Terms of ServicePrivacy PolicyContact © 2026 AIWave

Related: DeepSeek API pricing · DeepSeek V4 Pro

DeepSeek V4 Pro delivers GPT-4o quality at 10x lower cost. Try it free.

Explore Models →