DeepSeek API: endpoints, authentication, models and limits
Connection details
| Base URL | https://api.deepseek.com |
| Auth | Bearer token via DEEPSEEK_API_KEY |
| OpenAI SDK compatible | Yes |
| SDKs | OpenAI SDK (Python, Node), raw HTTP |
Models and token pricing
| Model | Model ID | Context | In / 1M | Out / 1M |
|---|---|---|---|---|
| DeepSeek R1 | deepseek-reasoner | 128K | $0.550 | $2.19 |
| DeepSeek V4 Pro | deepseek-v4-pro | 1000K | $0.435 | $0.870 |
| DeepSeek V3 | deepseek-chat | 128K | $0.270 | $1.10 |
| DeepSeek V4 Flash | deepseek-v4-flash | 1000K | $0.140 | $0.280 |
Full pricing breakdown, including cached-input rates and tier comparisons: DeepSeek API pricing.
What is distinctive about this API
- Wire-compatible with the OpenAI chat completions API, so the official OpenAI SDKs work by changing base_url and the key — no client library swap.
- Context caching is applied automatically on repeated prefixes rather than requiring an explicit cache-control block, and cache hits are billed at a steep discount.
- Reasoning models return their chain of thought in a separate reasoning_content field, distinct from content, so you can log or discard it independently of the answer.
- Weights for the open models are published under a permissive licence, so the same model can be self-hosted with vLLM or SGLang if data residency requires it.
Constraints worth knowing first
- Reasoning-model output includes reasoning tokens in the billed output count; budget for materially more output tokens than the visible answer suggests.
- Rate limits are applied per account rather than per key, so splitting keys across services does not raise the ceiling.
- Capacity has historically been tighter during Asia-Pacific business hours; if you serve global traffic, plan a fallback route.
Frequently asked
- What is the DeepSeek API base URL?
- https://api.deepseek.com. Authenticate with a bearer token, conventionally read from the DEEPSEEK_API_KEY environment variable.
- Is the DeepSeek API compatible with the OpenAI SDK?
- Yes. The chat completions surface is wire-compatible, so the official OpenAI client libraries work by pointing base_url at https://api.deepseek.com and supplying a DEEPSEEK_API_KEY. No client library change is needed.
- How do I get a DeepSeek API key?
- Create an account with the provider and generate a key from the developer console, then expose it to your application as DEEPSEEK_API_KEY. Keys are secrets: keep them server-side, never in client bundles or committed config.
- Which models does the DeepSeek API expose?
- DeepSeek R1, DeepSeek V4 Pro, DeepSeek V3, DeepSeek V4 Flash. Context windows run to 1000K tokens.
Other provider APIs
DeepSeek publishes official documentation at https://api-docs.deepseek.com. Pricing and limits change; verify against the provider before committing to a budget.