API Guide

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.

DeepSeek API pricing and access guide — V4-Pro, V4-Flash, V3.2 token prices

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.

How this is sourced. Every price below is verified against DeepSeek's own API pricing page, June 2026. Where third-party hosts charge different (usually higher) rates, we say so. For a full model review, see our DeepSeek V4 review.

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:

ModelInput (cache-miss)Input (cache-hit)OutputContext
deepseek-v4-pro$0.435$0.0036$0.871M
deepseek-v4-flash$0.14$0.0028$0.281M
deepseek-v3.2 (prior gen)$0.23$0.34131K

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.

Watch the host. Several sites quote DeepSeek V4-Pro at ~$1.74/$3.48 — that's a third-party host's rate (e.g. DeepInfra), not DeepSeek's official API, which is $0.435/$0.87. Always confirm whose price you're being shown before you budget.

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:

Output price per 1M tokens — DeepSeek vs the frontiereach provider API, June 2026GPT-5.5$30Claude Opus 4.7$25Gemini 3.1 Pro$12DeepSeek V4-Pro$0.87
Chart: DataLLM Lab — output price per 1M tokens, June 2026, from each provider's pricing page. DeepSeek V4-Pro (highlighted) is the cheapest frontier-class API by a wide margin; on independent SWE-bench Verified it's within a few points of the leaders.

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

  1. Sign up at platform.deepseek.com and verify your account.
  2. Open the API keys section and create a key. Copy it immediately — it's shown once.
  3. Add billing/credit; new accounts often get trial credit to start.
  4. 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.

Written by
Kevin Fan

Founder of DataLLM Lab, the unified LLM gateway. Kevin tests models the boring way — same prompts, real costs, unedited outputs — and writes up what the runs actually show.

One API for every model

One API, every model.

Get a single API key for Claude Opus 4.7, GPT-5.4, and 300+ more — with automatic price comparison and routing to the best model for every request.