DeepSeek API
快速开始
首次调用 API
模型 & 价格
Temperature 设置
Token 用量计算
限速
错误码
API文档
基本信息
对话补全
POST
FIM 补全(Beta)
POST
列出模型
GET
查询余额
GET
API指南
推理模型 (deepseek-reasoner)
多轮对话
对话前缀续写(Beta)
FIM 补全(Beta)
JSON Output
Function Calling
上下文硬盘缓存
提示库
代码改写
代码解释
代码生成
内容分类
结构化输出
角色扮演(自定义人设)
角色扮演(情景续写)
散文写作
诗歌创作
文案大纲生成
宣传标语生成
模型提示词生成
中英翻译专家
常见问题
FIM 补全(Beta)开发中
POSThttps://api.deepseek.com/beta/completions
创建时间: 2025-05-29 18:01
请求参数
Header 参数
参数名 | 示例值 | 是否必填 | 参数类型 | 描述说明 |
---|---|---|---|---|
Authorization | Bearer {{API_KEY}} | 是 | string | - |
Body 参数application/json
数据结构
modelstring
必填
promptstring
必填
echoboolean
可选
frequency_penaltynumber
可选
logprobsinteger
可选
max_tokensinteger
可选
presence_penaltynumber
可选
stopnull
可选
streamboolean
可选
stream_optionsnull
可选
suffixnull
可选
temperatureinteger
可选
top_pinteger
可选
示例数据
{
"model": "deepseek-chat",
"prompt": "Once upon a time, ",
"echo": false,
"frequency_penalty": 0,
"logprobs": 0,
"max_tokens": 1024,
"presence_penalty": 0,
"stop": null,
"stream": false,
"stream_options": null,
"suffix": null,
"temperature": 1,
"top_p": 1
}
响应示例
成功
HTTP状态码:200
内容格式:JSON
数据结构
idstring
必填
choicesarray<object>
必填
finish_reasonstring
可选
indexinteger
可选
logprobsobject
可选
text_offsetarray<integer>
可选
token_logprobsarray<number>
可选
tokensarray<string>
可选
top_logprobsarray<object>
可选
textstring
可选
createdinteger
必填
modelstring
必填
system_fingerprintstring
可选
objectstring
必填
usageobject
可选
completion_tokensinteger
必填
prompt_tokensinteger
必填
prompt_cache_hit_tokensinteger
必填
prompt_cache_miss_tokensinteger
必填
total_tokensinteger
必填
completion_tokens_detailsobject
可选
reasoning_tokensinteger
可选
响应示例
{
"id": "string",
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": {
"text_offset": [ 0 ],
"token_logprobs": [ 0 ],
"tokens": [ "string" ],
"top_logprobs": [ {} ]
},
"text": "string"
}
],
"created": 0,
"model": "string",
"system_fingerprint": "string",
"object": "text_completion",
"usage": {
"completion_tokens": 0,
"prompt_tokens": 0,
"prompt_cache_hit_tokens": 0,
"prompt_cache_miss_tokens": 0,
"total_tokens": 0,
"completion_tokens_details": { "reasoning_tokens": 0 }
}
}
最后更新: 2 个月前