Deepseek.ai is an independent website and is not affiliated with, sponsored by, or endorsed by Hangzhou DeepSeek Artificial Intelligence Co., Ltd.

    Developer Documentation

    DeepSeek API

    The OpenAI-compatible AI API from $0.14 per 1M tokens — far cheaper than GPT-5.6 or Claude Sonnet 5, with the same SDK.

    Why developers pick the DeepSeek API

    Low latency

    High-throughput inference for real-time applications and streaming chat.

    Enterprise-grade

    TLS encryption, key rotation and SOC 2-aligned infrastructure.

    Scales to millions

    From prototype on a laptop to millions of requests per day, same endpoint.

    OpenAI-compatible

    Drop-in replacement — no SDK swap, no schema rewrite, no retraining.

    Live Calculator

    DeepSeek API Pricing Calculator

    Drag the sliders to see your monthly cost compared to OpenAI and Anthropic.

    1M tokens
    1M tokens
    DeepSeek-V4-Flash
    $0.42
    Save 98% vs OpenAI
    GPT-5.6 Terra
    $17.50
    Claude Sonnet 5
    $12.00

    Estimates use published per-token rates (DeepSeek verified 2026-07-25, competitors 2026-07-25). Cache hits cut DeepSeek input cost by ~98%.

    DeepSeek API Pricing per Model

    All models share the same OpenAI-compatible endpoint. Pick one by setting the model field.

    Most Popular

    deepseek-v4-flash

    General chat, agents & tools

    Input$0.14 / 1M
    Output$0.28 / 1M
    Context128K tokens
    • Cheapest current tier
    • Cache hit input $0.0028 / 1M
    • Best default for production chat

    deepseek-v4-pro

    Reasoning & complex code

    Input$0.435 / 1M
    Output$0.87 / 1M
    Context128K tokens
    • Strongest reasoning tier
    • Cache hit input $0.003625 / 1M
    • Use per-turn, not per-app

    deepseek-chat / deepseek-reasoner

    Retired 24 July 2026

    Input / 1M
    Output / 1M
    Context tokens
    • Legacy aliases, no longer served
    • Migrate to the V4 strings above

    * Cache hits get a 90% discount. Prices exclude VAT. See full pricing page.

    Quick Start — your first API call

    Three steps to a working request. Examples in Python, Node.js, cURL and LangChain below.

    1

    Create account

    Register at platform.deepseek.com

    2

    Generate API key

    Open the API Keys section and create a new key.

    3

    First request

    Copy a snippet below and replace YOUR_DEEPSEEK_API_KEY.

    from openai import OpenAI
    
    client = OpenAI(
        api_key="YOUR_DEEPSEEK_API_KEY",
        base_url="https://api.deepseek.com",
    )
    
    response = client.chat.completions.create(
        model="deepseek-v4-flash",
        messages=[
            {"role": "system", "content": "You are a helpful assistant."},
            {"role": "user", "content": "Explain what an API is in one sentence."},
        ],
    )
    
    print(response.choices[0].message.content)

    DeepSeek API vs OpenAI vs Claude

    Per-token list pricing on each provider's mainstream chat model, verified 2026-07-25.

    FeatureDeepSeekGPT-5.6 TerraClaude Sonnet 5
    Input price (per 1M)$0.14$2.50$2.00
    Output price (per 1M)$0.28$15.00$10.00
    Context window128K128K200K
    Reasoning tierdeepseek-v4-proGPT-5.6 SolClaude Opus 5
    OpenAI-compatible SDKnative
    Cache discount90%50%90%

    See the full DeepSeek vs ChatGPT comparison

    DeepSeek API — Frequently Asked Questions

    The DeepSeek API is not free, but it is one of the cheapest frontier-class APIs available: deepseek-v4-flash costs $0.14 per 1M input tokens (cache miss) and $0.28 per 1M output tokens, which is 94% cheaper on input than GPT-5.6 Terra. Cache hits drop input to $0.0028 per 1M. New accounts typically receive trial credits before you pay anything.

    Go to platform.deepseek.com, create an account or log in, navigate to 'API Keys' in your dashboard, click 'Create new API key', name it (for example 'production') and copy the generated key immediately — it will only be shown once.

    Yes. The DeepSeek API is a drop-in replacement for OpenAI's chat completions endpoint. You only need to change the base URL to https://api.deepseek.com and swap the API key — the entire request and response schema is identical, so existing Python, Node.js or LangChain code works without modification.

    Use deepseek-v4-flash for cheap, fast general work and deepseek-v4-pro for harder reasoning-heavy turns. The legacy aliases deepseek-chat and deepseek-reasoner were retired on 24 July 2026 — requests using them fail, so any integration still pinned to those strings must be migrated.

    In most projects the migration is a 2-line change: set base_url='https://api.deepseek.com' on your OpenAI client and use your DeepSeek API key. Change the model name to 'deepseek-v4-flash' (general) or 'deepseek-v4-pro' (reasoning). No other code changes are required for chat, streaming or function calling.

    DeepSeek does not enforce a hard rate limit by default — capacity is shared and throttling only kicks in during peak load. Enterprise accounts can request dedicated quotas. DeepSeek has announced a peak-hour surcharge, but the percentage and start date are not confirmed yet, so budget on the standard rates for now.

    deepseek-v4-flash ($0.14 in / $0.28 out per 1M) is optimised for general conversation, content generation, agents and tool use at low latency. deepseek-v4-pro ($0.435 in / $0.87 out per 1M) is the stronger reasoning tier for math, complex code and multi-step logic. Start on Flash and escalate only the turns that need Pro.

    Yes. The DeepSeek API is licensed for commercial use, including SaaS products, internal enterprise tools and customer-facing applications. Check DeepSeek's terms of service for prohibited use cases and your local regulations.

    Yes. The API supports server-sent event streaming (stream=true), JSON mode, function/tool calling and structured outputs — all using the exact same schema as the OpenAI Chat Completions API.

    Ready to start with the DeepSeek API?

    Create an account today and receive free trial credits to test every model.