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.
说明:Create an API key in the developer platform: log in, open the 'API Keys' page, generate and copy your key.
支持模型
API 接口列表
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
}List available models and basic metadata (OpenAI format compatible).
认证Yes
频率限制0 / min
计费模式Free
{}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
}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"
}
]
}
]
}