Official API endpoints

8 main endpoints. The complete set lives at api-docs.deepseek.com.

MethodPathPurpose
POST/chat/completions对话补全(主要用的就是这个)
POST/completions文本补全(FIM,代码补全常用)
POST/beta/chat/completions带前缀续写等实验特性
POST/models列出可用模型
GET/user/balance查余额
POST/files上传文件
GET/files列出文件
DELETE/files/{id}删除文件

Authentication

Authorization: Bearer $DEEPSEEK_API_KEY

Get a key at platform.deepseek.com/api_keys.

Error codes

Full table on the error codes page. The three you will hit:

CodeMeaningDo this
401Auth failedCheck the key and the Bearer prefix
429Rate limitedBack off and retry
402Insufficient balanceTop up, or switch to a cheaper provider

Related

Official resources · Error codes · Pricing