How to hit the DeepSeek API

DeepSeek's API at https://api.deepseek.com is OpenAI-compatible. deepseek-flash is the current general model; older model names are still accepted.

Authentication

Get a key at platform.deepseek.com. Send it as Authorization: Bearer <key>. In the examples it's written {{DEEPSEEK_API_KEY}}.

Full reference: https://api-docs.deepseek.com/

Chat completion

curl https://api.deepseek.com/chat/completions \
  -H "Authorization: Bearer {{DEEPSEEK_API_KEY}}" \
  -H "Content-Type: application/json" \
  -d '{"model": "deepseek-flash", "messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Hello!"}]}'
Run in PostTaco

List models

curl https://api.deepseek.com/models \
  -H "Authorization: Bearer {{DEEPSEEK_API_KEY}}"
Run in PostTaco

Check your balance

curl https://api.deepseek.com/user/balance \
  -H "Authorization: Bearer {{DEEPSEEK_API_KEY}}"
Run in PostTaco