Official API endpoints
8 main endpoints. The complete set lives at api-docs.deepseek.com.
| Method | Path | Purpose |
|---|---|---|
| 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:
| Code | Meaning | Do this |
|---|---|---|
| 401 | Auth failed | Check the key and the Bearer prefix |
| 429 | Rate limited | Back off and retry |
| 402 | Insufficient balance | Top up, or switch to a cheaper provider |