DeepSeek api
★★★★★ 4.7 CE

DeepSeek API: Access, Rate Limits & SDKs 2026

The DeepSeek API is OpenAI- and Anthropic-compatible, so a base-URL swap points your existing SDK at deepseek-v4-pro. It caps concurrency, not requests per minute.

DeepSeek API verdict

Verified today·6 sources checked

The DeepSeek API is the easiest of the leading models to adopt from existing code.

It is OpenAI- and Anthropic-compatible, so a bearer key plus a base-URL swap, to https://api.deepseek.com or /anthropic, lets the OpenAI or Anthropic SDK call deepseek-v4-pro unchanged. Agent tools like Claude Code or GitHub Copilot can use it as a backend with no code.

How to build on it

DeepSeek's API is the lowest-friction way to drop a cheap reasoning model into an existing OpenAI- or Anthropic-shaped codebase. Keep your SDK, swap the base URL and key, and point at deepseek-v4-pro. Agent tooling like Claude Code, Copilot and OpenCode treats it as a backend with no code. Plan around concurrency rather than RPM: 500 simultaneous connections per account for v4-pro, expandable for free, with per-user_id sub-limits for multi-tenant apps. Budget on a prepaid balance, and lean on the 99 percent cache-hit discount, at $0.004 per 1M, and the thinking-mode toggle to control reasoning cost. Watch two operational edges. A 402 stops you cold when the balance runs out, and long requests need keep-alive handling with a 10-minute idle cutoff.

Honest limits
  • The limit is concurrency, not requests per minute: 500 simultaneous connections for deepseek-v4-pro at the account level, a 429 over that, with free capacity expansion on request.
  • Billing is a prepaid balance. A 402 Insufficient Balance halts requests until you top up, and the granted balance is spent before the topped-up balance.
  • The model names deepseek-chat and deepseek-reasoner are deprecated on 2026-07-24, so migrate to deepseek-v4-flash or pro with the thinking-mode toggle.
  • Connections are held with keep-alive lines during long inference but closed after 10 minutes without inference, so handle empty lines and SSE keep-alive comments when parsing.
Auth
Bearer API key
Compatibility
OpenAI + Anthropic SDK
Concurrency (pro)
500 (account level)
Cache discount
99% ($0.004/1M)
Context / output
1M / 384K
View sources

Build with the DeepSeek API

Your first DeepSeek API request

POST /chat/completionsbash
curl https://api.deepseek.com/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${DEEPSEEK_API_KEY}" \
  -d '{
    "model": "deepseek-v4-pro",
    "messages": [{"role": "user", "content": "Hello!"}],
    "thinking": {"type": "enabled"},
    "stream": false
  }'

How to authenticate with the DeepSeek API

AspectDetailNotes
AuthBearer API key in Authorization headerAuthorization: Bearer ${DEEPSEEK_API_KEY}
Base URL (OpenAI)https://api.deepseek.comDrop-in for the OpenAI SDK
Base URL (Anthropic)https://api.deepseek.com/anthropicDrop-in for the Anthropic SDK
Modelsdeepseek-v4-pro, deepseek-v4-flashdeepseek-chat / deepseek-reasoner deprecated 2026-07-24
CompatibilityOpenAI / Anthropic request formatReuse existing SDKs or compatible software
Agent toolsClaude Code, GitHub Copilot, OpenCodeUse DeepSeek as backend model, no code
Billing modelPrepaid balance, deducted per tokenGranted balance used before topped-up balance

DeepSeek core endpoints and features

CapabilityHowPurpose
Chat completionsPOST /chat/completionsText generation in OpenAI message format
Thinking modethinking: {type: "enabled"} + reasoning_effortToggle reasoning vs non-thinking output
Streamingstream: true (SSE)Stream tokens as generated
JSON outputJSON Output featureStructured JSON responses
Tool callsTool Calls featureFunction calling / tool use
Prefix / FIMChat Prefix + FIM completion (beta)Continuation and fill-in-the-middle (FIM non-thinking only)
Multi-tenant isolationuser_id parameterContent-safety, KVCache and scheduling isolation per end user
Keep-aliveEmpty lines / SSE : keep-alive commentsConnection held during long inference; closed after 10 min idle

Concurrency limits and isolation

LimitDetailNotes
Concurrency (pro)500 simultaneous connectionsdeepseek-v4-flash: 2500
ScopeAccount level, across all API keysNot per API key
Over-limitHTTP 429 when concurrency exceededWithin limit, all requests are served
Capacity expansionRequest higher concurrency, no extra costMatched to actual business needs
Per-user_id sub-limitEach user_id capped (pro 500) on expanded accountsEmpty id treated as a special user_id
Request timeoutConnection closed after 10 min without inferenceKeep-alive lines sent meanwhile
Context / output ceiling1M context, 384K max outputPer request

DeepSeek SDKs, error handling and developer fit

AspectDetailNotes
SDKsOpenAI SDK or Anthropic SDKSet base_url; user_id goes in extra_body (OpenAI) or metadata (Anthropic)
401 / 422Auth fails / invalid parametersCheck API key; fix request per error hints
402 Insufficient BalancePrepaid balance exhaustedTop up to continue
429 Rate LimitRequests too fast / concurrency exceededPace requests; may fall back to another provider
500 / 503Server error / overloadedRetry after a brief wait
Cost leversCache hit $0.004/1M (99% off); off-peak none, prefer cachingCache miss input $0.435/1M
API pricing (v4-pro)$0.435/1M in (miss), $0.87/1M outIndependent cross-reference

DeepSeek API FAQ

How do I authenticate with the DeepSeek API?

Apply for an API key, then send it as a bearer token in the Authorization header, as Authorization: Bearer ${DEEPSEEK_API_KEY}. The API is OpenAI- and Anthropic-compatible, so you can keep your existing SDK. Just swap the base URL to https://api.deepseek.com for the OpenAI format, or https://api.deepseek.com/anthropic for the Anthropic format, then call model deepseek-v4-pro.

Can I use the OpenAI or Anthropic SDK with DeepSeek?

Yes. The DeepSeek API mirrors both formats, so the official OpenAI SDK and Anthropic SDK work unchanged once you set the base URL and key. The user_id isolation parameter goes under extra_body for the OpenAI SDK and under metadata for the Anthropic SDK. Agent tools like Claude Code, GitHub Copilot and OpenCode can use DeepSeek as a backend model with no code changes.

What are the DeepSeek API rate limits?

DeepSeek does not throttle on requests per minute. It caps concurrency, at 500 simultaneous connections for deepseek-v4-pro and 2,500 for deepseek-v4-flash, calculated at the account level across all API keys. Exceeding the limit returns HTTP 429. You can request a free capacity expansion, and multi-tenant accounts can get per-user_id concurrency sub-limits.

How much does the DeepSeek API cost and how is it billed?

deepseek-v4-pro is $0.435 per 1M input tokens on a cache miss, $0.003625 per 1M cache-hit input, about 99% off, and $0.87 per 1M output tokens. It has a 1M-token context and 384K max output. Billing is prepaid. Fees are deducted per token from your balance, spending granted balance before topped-up balance, and a 402 Insufficient Balance error halts requests until you top up.

How do I handle DeepSeek API errors and long requests?

Error codes follow HTTP conventions: 401 for a bad key, 402 for insufficient balance, 422 for invalid parameters, 429 for too many requests or concurrency, and 500 or 503 for the server. For long inference, the server holds the connection open with keep-alive signals, empty lines for non-streaming and ': keep-alive' SSE comments for streaming, so handle those when parsing. Note the connection is closed after 10 minutes without inference.

Sources & verification

Verified by ComparEdgeMethod: Vendor docs, official pages, and selected independent sources
SourceWhat was checkedLast checked
DeepSeek OfficialOfficial product pageJuly 10, 2026
Artificial AnalysisIndependent referenceJuly 10, 2026
DeepSeekProduct documentationJuly 10, 2026
DeepSeek Quick Start Error CodesQuick Start Error CodesJuly 10, 2026
DeepSeek Quick Start PricingPricing and plansJuly 10, 2026
DeepSeek Quick Start Rate LimitQuick Start Rate LimitJuly 10, 2026

Every fact on this DeepSeek page is tied to a named source and a verification date. Freshness-sensitive figures trace to the sources above; verify against the vendor before relying on them.