Skip to content
English

Switch theme

// Models · API key guide

DeepSeek API key: how to get one

Create the key in DeepSeek’s own console, then call https://api.deepseek.com with any OpenAI-compatible SDK.

5 stepsofficial docs onlychecked 2026-10-26

01How to get a DeepSeek API key

  1. Open the DeepSeek Open Platform at platform.deepseek.com and sign up / log in (sign-up options are shown on the page).
  2. Go to “API keys” (platform.deepseek.com/api_keys) and click “Create new API key”; give it a name.
  3. Copy the key right away – store it in an environment variable such as DEEPSEEK_API_KEY.
  4. Check your balance under “Usage / Top up” (or call GET /user/balance). Requests fail when both the topped-up and the gifted balance are 0.
  5. Call the API with base_url https://api.deepseek.com and model deepseek-flash (or deepseek-v4-pro).

Official key page: https://platform.deepseek.com/api_keys – console labels may change; follow what the official page shows.

02Real-name, phone and credit card requirements

Real-name / ID verificationThe API docs we checked do not state it; the console tells you if verification is needed before topping up – follow the official prompt.
Phone numberNot stated in the API docs – use whatever sign-up methods the platform offers.
Credit card / paymentNo credit card requirement is mentioned; payment methods are listed on the top-up page.

03Base URL and a minimal call

Base URL:https://api.deepseek.com
OpenAI-compatible. Anthropic-compatible endpoint: https://api.deepseek.com/anthropic (for Claude Code and other Anthropic-format clients).
Anthropic format:https://api.deepseek.com/anthropic
Environment variable:DEEPSEEK_API_KEY · Example model:deepseek-flash
deepseek-flash currently serves DeepSeek-V4.1-Flash; deepseek-v4-pro is the Pro model. Both have a 1M context.

curl

curl https://api.deepseek.com/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DEEPSEEK_API_KEY" \
  -d '{
    "model": "deepseek-flash",
    "messages": [{"role": "user", "content": "你好"}]
  }'

Python

# pip install openai
import os
from openai import OpenAI

client = OpenAI(api_key=os.environ["DEEPSEEK_API_KEY"], base_url="https://api.deepseek.com")
resp = client.chat.completions.create(
    model="deepseek-flash",
    messages=[{"role": "user", "content": "你好"}],
)
print(resp.choices[0].message.content)

There is a “gifted balance” mechanism (the balance API returns granted_balance, and the billing rule says the gifted balance is used first), but the terms say free credit is whatever the platform currently announces – no fixed amount is published. Check your own console. See the DeepSeek free-API page for details.

05DeepSeek API prices

All model prices →

Off-peak hours are half price (peak = Beijing time Mon–Fri 9:00–12:00 and 14:00–18:00, excluding holidays).

ModelInput / 1M tokensOutput / 1M tokensSource
DeepSeek V4.1 Flash 1017 (deepseek-flash)deepseek-flash ¥2¥8 official · 2026-11-19
DeepSeek V4 Pro 0813 (deepseek-v4-pro)deepseek-v4-pro ¥9¥27 official · 2026-10-19

Standard (non-batch) list prices from our price database; cheapest first, max 8 rows. Prices change – the official page wins.

06Keep your API key safe

07FAQ

FAQ

Is the DeepSeek API free?

No free tier with a published amount. New accounts may see a gifted balance in the console (shown as granted_balance), but the terms make the free credit subject to what the platform announces. Otherwise it is pay-as-you-go.

What is the DeepSeek API base URL?

https://api.deepseek.com for the OpenAI format, and https://api.deepseek.com/anthropic for the Anthropic format.

Where do I create the DeepSeek API key?

Only at platform.deepseek.com/api_keys after logging in. The key is shown when created – copy it then.

08Official sources

All facts checked against these pages on 2026-10-26. If anything differs, the official page wins.

09Related

Other API key guides

Data updated: Model API prices · HF model metadata(UTC+8)