DeepSeek¶
DeepSeek exposes an OpenAI-compatible API — you can reuse the openai Python client and just swap base_url and model name.
Sign up and get a key¶
- Create an account at platform.deepseek.com.
- Top up credits: Billing → Top up (very low minimum compared to US providers).
- Create a key: platform.deepseek.com/api_keys → Create new API key. Copy it immediately.
Install¶
You don't need a DeepSeek-specific SDK — just the OpenAI client:
Hello world¶
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-chat",
messages=[{"role": "user", "content": "Say hi in one short sentence."}],
)
print(resp.choices[0].message.content)
The only differences from the OpenAI example are base_url and the model ID.
Loading the key¶
Model catalog¶
Popular IDs as of April 2026:
deepseek-chat— general-purpose chat model (points at the current DeepSeek-V family).deepseek-reasoner— reasoning model (DeepSeek-R family), emitsreasoning_contentalongside the answer.
Canonical catalog: api-docs.deepseek.com/quick_start/pricing.
Further reading¶
- Docs: api-docs.deepseek.com
- Pricing: api-docs.deepseek.com/quick_start/pricing — notably cheaper than OpenAI / Anthropic, with off-peak discounts.