DeepSeek API: Pricing, Keys & How to Call It
DeepSeek runs the cheapest frontier-class API in 2026 — V4-Pro at $0.435 input / $0.87 output per million tokens, a fraction of what OpenAI or Anthropic charge for comparable coding quality. This guide gives you the full, verified price table (including the cache-hit rate most articles miss), how to get a key, the rate limits, and how to call it in one line — directly or through a gateway. Every number is checked against DeepSeek's own pricing page.
What the DeepSeek API is
The DeepSeek API gives you programmatic access to DeepSeek's models — the V4 generation (V4-Pro and V4-Flash) plus the prior V3.2 — over an OpenAI-compatible HTTP endpoint. Its headline draw is price: DeepSeek is the cheapest frontier-class API in 2026, and the models are open-weights (MIT), so you can also self-host. For most teams, though, the hosted API is the practical path, and it's remarkably cheap.
DeepSeek API pricing
Here is the complete, current price table — including the cache-hit input rate that most "DeepSeek API pricing" articles omit, and which is the single biggest cost lever for repeated-context workloads:
| Model | Input (cache-miss) | Input (cache-hit) | Output | Context |
|---|---|---|---|---|
| deepseek-v4-pro | $0.435 | $0.0036 | $0.87 | 1M |
| deepseek-v4-flash | $0.14 | $0.0028 | $0.28 | 1M |
| deepseek-v3.2 (prior gen) | $0.23 | — | $0.34 | 131K |
Per 1M tokens, USD. From DeepSeek's API pricing page, June 2026. Cache-hit input applies to repeated prompt prefixes (system prompts, long context) and is roughly 100× cheaper than cache-miss.
How it compares on price
The reason DeepSeek's API gets so much search traffic is simple: on output price — the expensive side of any bill — it undercuts the Western frontier by an order of magnitude, for coding quality within a few points. Here's V4-Pro's output price against the other major APIs:
For the quality side of that trade — where DeepSeek sits on independent benchmarks versus Claude and GPT — see the DeepSeek V4 vs GPT-5.5 vs Opus 4.8 comparison.
How to get a DeepSeek API key
- Sign up at platform.deepseek.com and verify your account.
- Open the API keys section and create a key. Copy it immediately — it's shown once.
- Add billing/credit; new accounts often get trial credit to start.
- Set the key as an environment variable (never hard-code it):
export DEEPSEEK_API_KEY=...
That gives you direct access. If you also want to reach Claude, GPT, Gemini and 300+ other models with the same key, a gateway (covered below) is the alternative — one signup instead of one per provider.
How to call the DeepSeek API (one line)
Because the API is OpenAI-compatible, you use the standard OpenAI SDK and just point it at DeepSeek's base URL:
from openai import OpenAI
client = OpenAI(
base_url="https://api.deepseek.com/v1",
api_key="$DEEPSEEK_API_KEY",
)
resp = client.chat.completions.create(
model="deepseek-v4-pro", # or deepseek-v4-flash for the cheap tier
messages=[{"role": "user", "content": "Review this function for bugs..."}],
)
print(resp.choices[0].message.content)
The same OpenAI-compatible shape means moving between DeepSeek, a gateway, or self-hosted weights is a base-URL and model-id change — no rewrite.
Is the DeepSeek API free? Rate limits
DeepSeek's own API is paid but very cheap, with trial credit for new accounts. For genuinely free usage, some third-party hosts and OpenRouter expose free, rate-limited endpoints of certain DeepSeek models (for example a free R1 endpoint) — fine for prototyping, not for production throughput. On rate limits, DeepSeek doesn't publish one fixed number; throughput scales with account standing and can tighten during peak demand. If steady production throughput matters, calling DeepSeek through a gateway that pools capacity and can fail over to another model is the more reliable pattern.
Which DeepSeek model to use
V4-Pro Hard tasks
- Top reasoning and complex coding. $0.435/$0.87 — still cheap. Use for the cases where a wrong answer is expensive.
V4-Flash High volume
- ~3× cheaper than Pro ($0.14/$0.28). Routine edits, extraction, classification, first-pass drafts.
V3.2 Cheapest prior gen
- $0.23/$0.34, 131K context — the model currently on the DataLLM Lab gateway. Solid, well-tested baseline.
Pattern Route Flash-first
- Send the easy majority to Flash, escalate to Pro only on failure — most traffic stays on the cheapest tier.
Calling DeepSeek through a gateway
If you use more than one provider — or want DeepSeek's price with automatic failover when it's rate-limited — a gateway is the cleaner option. DataLLM Lab carries DeepSeek V3.2 today and reaches 300+ other models through one OpenAI-compatible key, so you can route the cheap bulk to DeepSeek and escalate hard cases to a frontier model without a second integration:
client = OpenAI(base_url="https://www.datallmlab.com/v1", api_key="$DATALLMLAB_API_KEY")
# same code reaches deepseek/deepseek-v3.2, anthropic/claude-opus-4.7, openai/gpt-5.4, ...
Call DeepSeek and 300+ models with one key
DeepSeek V3.2, Qwen3 Coder, Kimi K2.6, Claude Opus 4.7 and more — one OpenAI-compatible endpoint, live price comparison, automatic failover.
FAQ
How much does the DeepSeek API cost?
V4-Pro is $0.435/M input (cache-miss), ~$0.0036/M cache-hit, $0.87/M output. V4-Flash is $0.14/$0.28; V3.2 is $0.23/$0.34. Far below OpenAI or Anthropic for comparable coding quality.
How do I get a DeepSeek API key?
Sign up at platform.deepseek.com, create a key in the API section, add credit. The API is OpenAI-compatible (base_url https://api.deepseek.com/v1). Or call DeepSeek via a gateway like DataLLM Lab with one key for 300+ models.
Is the DeepSeek API free?
DeepSeek's API is paid but cheap, with trial credit for new accounts. Some third-party hosts and OpenRouter offer free, rate-limited DeepSeek endpoints — good for prototyping, not production.
What are the DeepSeek API rate limits?
No single fixed limit is published; throughput scales with account standing and can tighten at peak. For predictable throughput, route DeepSeek through a gateway that pools capacity and fails over.
Which DeepSeek model should I use?
V4-Pro for hard tasks, V4-Flash for high volume (~3× cheaper), V3.2 for the cheapest prior-gen tier. Route Flash-first, escalate to Pro on failure.
Is the DeepSeek API OpenAI-compatible?
Yes — it implements the OpenAI chat-completions format, so the official OpenAI SDK works by changing the base_url and model id. Switching to/from a gateway is a one-line change.
DataLLM Lab