DeepSeek API Key: How to Get One and What It Costs

This guide covers creating a DeepSeek API key, balance-based billing, peak-hour rates and cache reads. The cost examples use stated token assumptions; they are not predictions of your bill.

Last updated: November 10, 2026 · verified against DeepSeek's official pricing page ↗

Step 1 — Create the key

  1. Go to platform.deepseek.com and sign up (email or Google account).
  2. Open API keys in the left sidebar.
  3. Click Create new API key, give it a name, and copy it immediately — DeepSeek shows the full key only once. If you lose it, delete the key and create a new one.
  4. Store it in an environment variable, never in code or a git repo:
export DEEPSEEK_API_KEY="sk-..."

Step 2 — Add credits (prepaid billing)

DeepSeek deducts usage charges from your topped-up or granted balance. Granted balance is used first when both are available. Check current top-up requirements and any account-specific credits in the official dashboard before paying.

Check your remaining balance and available billing controls in the platform dashboard before using the API in production.

Is the DeepSeek API free? API usage is metered separately from the chat app. Any granted credits depend on your account; do not assume ongoing free API usage. Estimate your token charges in the cost calculator before you commit.

Step 3 — Understand the pricing before you scale

The model you get is deepseek-flash (DeepSeek-V4.1-Flash). Prices below are off-peak rates per 1M tokens, verified November 2026:

Token typeOff-peakPeak
Input (cache miss)$0.15$0.30
Input (cache hit)$0.003$0.006
Output$0.60$1.20

Two things surprise new users:

Step 4 — Make your first call

The API speaks the OpenAI schema, so most existing code needs only a base-URL change:

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": "Explain cache-hit pricing in one line."}],
)
print(resp.choices[0].message.content)

The same key also works with third-party apps that accept an OpenAI-compatible endpoint and key — chat frontends, IDE extensions, and agent frameworks. The pattern is always the same: paste the key, set the base URL to https://api.deepseek.com, and select deepseek-flash as the model. Check the app's own docs for where those fields live.

What your first month will cost

Using a common chat workload — 1,000 input + 500 output tokens per request, all off-peak, no cache hits:

Requests / monthCost
10,000~$4.50
100,000~$45
1,000,000~$450

At 100,000 requests per month with the same token counts, Claude Opus 5.5 costs $1,400 at its listed standard rates, excluding other fees. Compare any workload yourself in the calculator — set the cache ratio to match your prompt reuse.

Key hygiene (the part everyone skips)

FAQ

Estimate your own monthly cost → · DeepSeek pricing deep-dive · Cheapest LLMs for coding