DeepSeek API

DeepSeek offers reasoning-enhanced LLM APIs compatible with OpenAI and Anthropic formats, supporting chat completions, tool calls, Chain-of-Thought output, and Beta features (prefix completion, FIM).

基础 URL
https://api.deepseek.com
认证
Bearer / Authorization: Bearer
官方 SDK
Python (OpenAI SDK), JavaScript/Node.js (OpenAI SDK), Python (Anthropic SDK)
🔑 API Key 获取
前置要求:Sign up and log in to the DeepSeek developer platform.
入口:https://platform.deepseek.com/api_keys
说明:Create an API key in the developer platform: log in, open the 'API Keys' page, generate and copy your key.

支持模型

API 接口列表

POST /chat/completions Docs

Create a chat completion (OpenAI-compatible), supporting non-thinking and thinking modes (deepseek-chat / deepseek-reasoner), optional streaming and tool calls.

认证Yes
频率限制0 / min
计费模式Pay-per-token
{
  "model": "deepseek-chat",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "Hello!"
    }
  ],
  "stream": false
}
GET /models Docs

List available models and basic metadata (OpenAI format compatible).

认证Yes
频率限制0 / min
计费模式Free
{}
POST /beta/completions Docs

FIM (Fill-In-the-Middle) completion Beta; requires beta base_url and supports middle insertion completions.

认证Yes
频率限制0 / min
计费模式Pay-per-token
{
  "model": "deepseek-chat",
  "prompt": "Once upon a time, ",
  "suffix": null,
  "max_tokens": 1024
}
POST /anthropic/v1/messages Docs

Anthropic-compatible messages endpoint to call DeepSeek models using Anthropic SDK format (unsupported model names map to deepseek-chat).

认证Yes
频率限制0 / min
计费模式Pay-per-token
{
  "model": "deepseek-chat",
  "max_tokens": 1000,
  "system": "You are a helpful assistant.",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "Hi"
        }
      ]
    }
  ]
}