帮助与文档 > 产品文档 > 自然语言翻译服务 > API文档 > DeepSeek模型
DeepSeek模型

DeepSeek模型 API 简介

概念解释

DeepSeek模型:支持DeepSeek模型对话,文本输入。

说明

本文档主要针对需要集成HTTP API的技术开发工程师,详细描述DeepSeek模型的技术内容。

如果您有与我们商务合作的需求,可以通过以下方式联系我们:

商务邮箱: AIcloud_Business@corp.youdao.com

如果您对文档内容有任何疑问,可以通过以下几种方式联系我们:

客服QQ:1906538062

智云翻译技术交流QQ 1群: 652880659

智云翻译技术交流QQ 2群: 669384425

智云翻译技术交流QQ 3群: 807539209

智云翻译技术交流QQ 4群: 936752411

联系邮箱: zhiyun@corp.youdao.com

温馨提示:

  • 本文档主要针对开发人员,接入测试前需要获取 应用ID应用密钥 ,请按照新手指南 获取。

体验地址

有道deepseek (可用手机号登录体验)

接口说明

DeepSeek模型API HTTPS地址:

https://openapi.youdao.com/llmgateway/api/v1/chat/completions

协议须知

调用方在集成大模型翻译API时,请遵循以下规则。

规则 描述
传输方式 HTTPS
请求方式 POST
请求格式 application/json

接口调用参数

调用API需要向接口发送以下字段来访问服务。

  • Headers
参数名称 参数值 是否必须 示例 备注
Content-Type application/json application/json
Authorization Bearer ${api_key} 在智云控制台申请 token鉴权
  • Body

    名称 类型 是否必须 默认值 备注 其他信息
    model string 必须 模型名称
    messages object [] 必须 消息列表 [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How's the weather in Hangzhou?" }, { "role": "assistant", "content": "", "tool_calls": [ { "id": "chatcmpl-tool-f6c2f72b91284f31b51988456cd9e8f0", "type": "function", "function": { "name": "get_weather", "arguments": "{\"location\":\"Hangzhou\"}" } } ] }, { "role": "tool", "tool_call_id": "chatcmpl-tool-f6c2f72b91284f31b51988456cd9e8f0", "content": "24℃" }, { "role": "assistant", "content": "The weather in Hangzhou is currently 24°C." } ]
    stream boolean 非必须 是否流式返回:默认值 false
    stream_options object 非必须 流式响应时的配置 备注: 流式响应时的配置
    max_tokens integer 非必须 模型的最大tokens数量:默认值 4096,最大16k
    stop string [] 非必须 模型遇到 stop 字段所指定的字符串时将停止继续生成,这个词语本身不会输出。最多支持 4 个字符串。 类型: string 或 string []
    presence_penalty number 非必须 存在惩罚系数。如果值为正,会根据新 token 到目前为止是否出现在文本中对其进行惩罚,从而增加模型谈论新主题的可能性。取值范围为 [-2.0, 2.0]。
    frequency_penalty number 非必须 频率惩罚系数。如果值为正,会根据新 token 在文本中的出现频率对其进行惩罚,从而降低模型逐字重复的可能性。取值范围为 [-2.0, 2.0]。
    temperature number 非必须 采样温度。控制了生成文本时对每个候选词的概率分布进行平滑的程度。取值范围为 [0, 2]。当取值为 0 时模型仅考虑对数概率最大的一个 token。较高的值(如 0.8)会使输出更加随机,而较低的值(如 0.2)会使输出更加集中确定。通常建议仅调整 temperature 或 top_p 其中之一,不建议两者都修改。
    top_p number 非必须 核采样概率阈值。模型会考虑概率质量在 top_p 内的 token 结果。取值范围为 [0, 1]。当取值为 0 时模型仅考虑对数概率最大的一个 token。如 0.1 意味着只考虑概率质量最高的前 10% 的 token,取值越大生成的随机性越高,取值越低生成的确定性越高。通常建议仅调整 temperature 或 top_p 其中之一,不建议两者都修改。
    logit_bias object 非必须 调整指定 token 在模型输出内容中出现的概率,使模型生成的内容更加符合特定的偏好。logit_bias 字段接受一个 map 值,其中每个键为词表中的 token ID(使用 tokenization 接口获取),每个值为该 token 的偏差值,取值范围为 [-100, 100]。-1 会减少选择的可能性,1 会增加选择的可能性;-100 会完全禁止选择该 token,100 会导致仅可选择该 token。该参数的实际效果可能因模型而异。 备注: 调整指定 token 在模型输出内容中出现的概率,使模型生成的内容更加符合特定的偏好。logit_bias 字段接受一个 map 值,其中每个键为词表中的 token ID(使用 tokenization 接口获取),每个值为该 token 的偏差值,取值范围为 [-100, 100]。 -1 会减少选择的可能性,1 会增加选择的可能性;-100 会完全禁止选择该 token,100 会导致仅可选择该 token。该参数的实际效果可能因模型而异。
    tools object [] 非必须 待调用工具的列表,模型返回信息中可包含。当您需要让模型返回待调用工具时,需要配置该结构体。 [{ "type": "function", "function": { "name": "get_weather", "description": "Get weather of an location, the user shoud supply a location first", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "The city and state, e.g. San Francisco, CA" } }, "required": ["location"] } } }]
  • Body示例

  {
  "model": "deepseek-r1-250120",
  "messages": [{
  "role": "user",
  "content": "你好,你是谁?"
  }],
  "stream": true,
  "max_tokens": 1000,
  "stream_options": {
  "include_usage": true
  },
  "presence_penalty": 0,
  "frequency_penalty": 0,
  "temperature": 0,
  "top_p": 0
  }

APIKey获取

创建APPID

  1. 登录智云控制台
  2. 控制台:选择自然语言翻译服务-deepseek服务-创建应用-勾选deepseek服务
  3. 已有APPID:选择已有应用,勾选deepseek服务

1chuangjianyingyong.png

获取APIKey

1.点击应用总览-API Key

2chuangjianAPIKEY.png

创建API Key

2zhanshi.png

  • 此步骤生成的apikey用于鉴权,替换“接入Demo语言”中的${api_key}变量

4chuangjianwancheng.png

模型选项

模型 版本 最大上下文长度 最大输入长度(token) 最大输出长度 最大思考内容长度 刊例价(元/1M token)
DeepSeek-R1 实时 64k 48k 16k 16k 输入:4元 输出:16元
DeepSeek-V3 实时 64k 48k 16k - 输入:2元 输出:8元

输出结果

  • 如果stream=false,非流式返回,返回结果为json
  • 如果stream=true,流式返回,输出结果为响应式流。

非流式结果的示例

示例一:“正常返回”结果

{
  "id": "chatcmpl-c26df7f617084d33b35bca90e632d35e",
  "created": 1754381369,
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "delta": null,
      "message": {
        "role": "assistant",
        "content": "\n\n您好!我是由中国的深度求索(DeepSeek)公司开发的智能助手DeepSeek-R1。如您有任何任何问题,我会尽我所能为您提供帮助。",
        "reasoning_content": "您好!我是由中国的深度求索(DeepSeek)公司开发的智能助手DeepSeek-R1。如您有任何任何问题,我会尽我所能为您提供帮助。\n",
        "tool_calls": []
      }
    }
  ],
  "usage": {
    "completion_tokens": 75,
    "prompt_tokens": 4,
    "total_tokens": 79,
    "prompt_tokens_details": {
      "cached_tokens": 0
    },
    "completion_tokens_details": {
      "reasoning_tokens": 37
    }
  },
  "model": "deepseek_r1",
  "object": "chat.completion"
}

示例二:“异常返回”结果

{
  "code": 401,
  "msg": "account overdue bills",
  "request_id": "7da54d61-0b53-4695-9edd-4aea9de0dfc2"
}

流式结果的示例

示例一:“正常返回”结果


data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"您好"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"!"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"我是"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"由"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"中国的"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"深度"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"求"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"索"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"("},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"Deep"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"Se"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"ek"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":")"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"公司"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"开发的"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"智能"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"助手"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"Deep"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"Se"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"ek"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"-R"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"1"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"。"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"如"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"您"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"有任何"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"任何"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"问题"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":","},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"我会"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"尽"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"我"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"所能"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"为您"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"提供"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"帮助"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"","reasoning_content":"。\n"},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"\n\n","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"您好","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"!","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"我是","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"由","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"中国的","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"深度","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"求","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"索","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"(","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"Deep","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"Se","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"ek","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":")","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"公司","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"开发的","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"智能","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"助手","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"Deep","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"Se","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"ek","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"-R","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"1","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"。","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"如","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"您","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"有任何","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"任何","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"问题","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":",","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"我会","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"尽","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"我","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"所能","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"为您","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"提供","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"帮助","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","content":"。","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[{"index":0,"finish_reason":"stop","delta":{"role":"assistant","content":"","reasoning_content":""},"message":null}],"usage":null,"model":"deepseek_r1","object":"chat.completion.chunk"}

data:{"id":"chatcmpl-b36905dcaff0451583b6fc4244fdadc4","created":1751271605,"choices":[],"usage":{"completion_tokens":75,"prompt_tokens":4,"total_tokens":79,"prompt_tokens_details":{"cached_tokens":0},"completion_tokens_details":{"reasoning_tokens":37}},"model":"deepseek_r1","object":"chat.completion.chunk"}

data:[DONE]

示例二:“异常返回”结果

{
  "code": 401,
  "msg": "account overdue bills",
  "request_id": "7da54d61-0b53-4695-9edd-4aea9de0dfc2"
}

错误代码列表

错误码 含义
400 - 格式错误 原因:请求体格式错误解决方法:检查入参格式是否正确,不是合法的JSON结构,content字段要求传String,实际传了Array,返回结构:返回Json结果示例如下 {"code": 400,"msg": "Request","request_id": "ac44d1fc-0daf-4035-8c4b-059c7f6bb221"}
401 - 认证失败 原因:API key 错误、无权限、账户余额不足,认证失败.解决方法:请检查您的 API key 是否正确是否在智云控制台开通了deepseek权限账户余额是否充足.返回结构:返回Json结果示例如下: {"code": 401,"msg": "account overdue bills","request_id": "7da54d61-0b53-4695-9edd-4aea9de0dfc2"}
422 - 业务异常 原因:参数异常、超时异常等,解决方法:请根据错误信息提示修改参数,或联系我们解决.返回结构:返回Json结果示例如下:{"code": 100102,"msg": "USER_WRONG_MESSAGES_ROLE","request_id": "ac44d1fc-0daf-4035-8c4b-059c7f6bb259"}
429 - 请求速率达到上限 因:请求速率(TPM 或 RPM)达到上限.解决方法:请合理规划您的请求速率.返回结构:返回Json结果示例如下:{"code": 104203,"msg": "TPM exceed limit","request_id": "7da54d61-0b53-4695-9edd-4aea9de0dfc2"}
500 - 服务器故障 原因:服务器内部故障.解决方法:请等待后重试。若问题一直存在,请联系我们解决

Demo示例

Demo包含的编程语言:Curl、Python、Java、Node.js,请下载后使用 Demo