DeepSeek API Key Guide: Free Tier, Context Caching & OpenAI-Compatible Setup

Is DeepSeek Free? The Short Answer

Yes — DeepSeek Platform offers free trial credits on sign-up (typically 5M–10M tokens), no foreign credit card required. New users verify email only, get free quota, and can call deepseek-chat / deepseek-reasoner via the OpenAI-compatible endpoint at https://api.deepseek.com/v1.

Why Choose DeepSeek Official API?

1. Dollar-for-dollar cheaper with Context Caching

Uncached input is billed normally, but cached input is 1/30th the price (~¥0.05 / 1M tokens). For multi-turn coding agents, long docs, or RAG, this saves 90%+.

2. Full OpenAI protocol compatibility

Set base_url="https://api.deepseek.com/v1" in any OpenAI SDK, Cursor, Claude Code, or LangChain — no code changes.

3. Chinese + English excellence

Native high quality on both Chinese and English, strong on code, math, and reasoning.

Free Tier Basis

Register at https://platform.deepseek.com — free trial credits included, no credit card, email verification only. Credits are valid for sampling V4 models. Past trial, pay-as-you-go at official rates; context caching keeps costs very low.

Step-by-Step: Get Your DeepSeek API Key

Step 1: Open https://platform.deepseek.com/ and click Sign Up. Use email or phone, verify email.

Step 2: Complete email verification. No credit card, no GitHub required.

Step 3: Go to API Keys in the dashboard, click Create New Key, copy it. Store securely — it won't be shown again.

Step 4: (Optional) Check Usage / Billing to see free credit balance and expiration.

Code Examples

cURL

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

Python (OpenAI SDK)

python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.deepseek.com/v1",
    api_key="YOUR_DEEPSEEK_API_KEY",
)

resp = client.chat.completions.create(
    model="deepseek-chat",
    messages=[{"role": "user", "content": "Write a Python quicksort."}],
)
print(resp.choices[0].message.content)

Tips

  • Context Caching: Keep the same chat session / prefix to hit cache. Don't shuffle file order.
  • Playground: Try it on Free AI API's endpoint page before integrating.
  • Welfare: Free credits on registration are the current free basis — use them quickly; official pricing may change.

Need more quota? See our GMI Cloud and OpenCode Go guides for cheaper hosted DeepSeek access.

Community Feedback

Comments are tied to your GitHub account — sign in to join the discussion.