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 — up to 95% cheaper than GPT-4o 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-V3
    $1.37
    Save 89% vs OpenAI
    OpenAI GPT-4o
    $12.50
    Anthropic Claude Sonnet
    $18.00

    Estimates based on published per-token rates (2026). Cache hits reduce DeepSeek input cost by 90%.

    DeepSeek API Pricing per Model

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

    DeepSeek-V3

    General chat & content

    Input$0.27 / 1M
    Output$1.10 / 1M
    Context128K tokens
    • Best for chatbots & RAG
    • Sub-second first token
    Most Popular

    DeepSeek-R1

    Reasoning & analysis

    Input$0.55 / 1M
    Output$2.19 / 1M
    Context128K tokens
    • Chain-of-thought reasoning
    • Strong on math, code & logic

    DeepSeek Coder

    Code generation

    Input$0.14 / 1M
    Output$0.28 / 1M
    Context16K tokens
    • Code completion
    • Bug fixing & refactoring

    * 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-chat",
        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 pricing as of 2026 on the flagship chat model of each provider.

    FeatureDeepSeekOpenAI GPT-4oClaude Sonnet
    Input price (per 1M)$0.27$2.50$3.00
    Output price (per 1M)$1.10$10.00$15.00
    Context window128K128K200K
    Reasoning modelDeepSeek-R1o1Claude Opus
    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 offers some of the lowest prices in the industry — DeepSeek-V3 costs $0.27 per 1M input tokens and $1.10 per 1M output tokens, which is roughly 90% cheaper than OpenAI GPT-4o. New accounts typically receive trial credits to test the API before paying.

    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.

    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 from 'gpt-4o' to 'deepseek-chat' for general tasks or 'deepseek-reasoner' for 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. For comparison, OpenAI tier-1 accounts are capped at 500 RPM and 30,000 TPM on most models.

    deepseek-chat (DeepSeek-V3) is optimised for general conversation, content generation and tool use with low latency. deepseek-reasoner (DeepSeek-R1) is a chain-of-thought model that thinks step by step before answering — slower and more expensive, but stronger on math, code and multi-step logic. Use V3 for production chatbots, R1 for analysis and complex problem solving.

    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 (such as generating illegal content) 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.