You need to enable JavaScript to run this app.
文档中心
AI 数据湖服务

AI 数据湖服务

复制全文
下载 pdf
API 参考:数据面
对话(Chat)API
复制全文
下载 pdf
对话(Chat)API

请求说明

发送包含文本、图片、视频等模态的消息列表,模型将生成对话中的下一条消息。

  • Base URL:以华北 2 (北京)地域为例,Base URL为:https://operator.las.cn-beijing.volces.com,实际使用时,需使用您当前服务地域的Base URL,详情可参见调用方式
  • Path:/api/v1/chat/completions
  • Method: POST
  • Content-type: application/json

请求参数
参数名
数据类型
是否必选
参数说明
model
string
调用的模型 ID(Model ID),开通模型服务后查询获取;多个应用及精细管理场景推荐使用 Endpoint ID 调用
messages
object[]
消息列表,不同模型支持文本、图片、视频等不同类型的消息
thinking
object
控制模型深度思考模式,默认值 {"type":"enabled"}
stream
boolean / null
响应是否流式返回,默认值 false;true 时按 SSE 协议逐块返回,以 data: [DONE] 结束
stream_options
object / null
流式响应选项(仅 stream 为 true 时可设置)
max_tokens
integer / null
模型回答最大长度(单位 token),默认值 4096;不包含思维链内容,受模型上下文长度限制
max_completion_tokens
integer / null
模型输出最大长度(含回答 + 思维链,单位 token),取值范围 [0, 65536];与 max_tokens 互斥,配置后 max_tokens 失效
service_tier
string / null
TPM 保障包使用控制,默认值 auto;auto 优先使用额度,default 不使用
stop
string / string[] / null
模型停止生成触发条件,最多支持 4 个字符串;深度思考模型不支持
reasoning_effort
string / null
思考工作量限制,默认值 medium;可选值:minimal(关闭思考)、low(轻量思考)、medium(均衡)、high(深度分析)
response_format
object
模型回答格式,默认值 {"type": "text"}(beta 阶段)
frequency_penalty
float / null
频率惩罚系数,取值范围 [-2.0, 2.0],默认值 0;正值降低重复 token 概率
presence_penalty
float / null
存在惩罚系数,取值范围 [-2.0, 2.0],默认值 0;正值增加新主题 token 概率
temperature
float / null
采样温度,取值范围 [0, 2],默认值 1;越高越随机,越低越确定(建议仅调整 temperature 或 top_p 之一)
top_p
float / null
核采样概率阈值,取值范围 [0, 1],默认值 0.7;控制候选 token 概率质量范围(建议仅调整 temperature 或 top_p 之一)
logprobs
boolean / null
是否返回输出 token 对数概率,默认值 false;深度思考模型不支持
top_logprobs
integer / null
每个 token 位置返回的最大可能 token 数,取值范围 [0, 20],默认值 0;仅 logprobs 为 true 时有效,深度思考模型不支持
tools
object[] / null
待调用工具列表(需模型返回工具调用时配置)
parallel_tool_calls
boolean
是否允许返回多个工具调用,默认值 true;false 时最多返回 1 个(仅 doubao-seed-1-6-*** 模型生效)
tool_choice
string / object
工具调用控制(仅 doubao-seed-1-6-*** 及之后模型支持);字符串类型可选 none(无工具)、required(必须调用)、auto(自主判断);对象类型指定具体工具

返回参数

非流式调用返回

参数名
数据类型
参数说明
id
string
本次请求的唯一标识
model
string
本次请求实际使用的模型名称和版本
service_tier
string
TPM 保障包使用状态,可选值:scale(已使用额度)、default(未使用)
created
integer
请求创建时间的 Unix 时间戳(秒)
object
string
返回对象类型,固定为 chat.completion
choices
object[]
模型输出内容列表
usage
object / null
token 用量统计

流式调用返回

参数名
数据类型
参数说明
id
string
本次请求的唯一标识
model
string
本次请求实际使用的模型名称和版本
service_tier
string
TPM 保障包使用状态,可选值:scale(已使用额度)、default(未使用)
created
integer
请求创建时间的 Unix 时间戳(秒)
object
string
返回对象类型,固定为 chat.completion.chunk
choices
object[]
模型输出内容列表
usage
object / null
token 用量统计;需设置 stream_options.include_usage 为 true 才返回

使用示例

流式输出

  • request

    curl https://operator.las.cn-beijing.volces.com/api/v1/chat/completions      -H "Content-Type: application/json"      -H "Authorization: Bearer $ARK_API_KEY"      -d $'{
           "messages": [
               {
                   "content": "You are a helpful assistant.",
                   "role": "system"
               },
               {
                   "content": "hello",
                   "role": "user"
               }
           ],
           "model": "doubao-1-5-pro-32k-250115",
           "stream": true
       }'
    
  • response

    {"choices":[{"delta":{"content":"Hello","role":"assistant"},"index":0}],"created":1742632436,"id":"021742632435712396f12d018b5d576a7a55349c2eba0815061fc","model":"doubao-1-5-pro-32k-250115","service_tier":"default","object":"chat.completion.chunk","usage":null}
       
       {"choices":[{"delta":{"content":"!","role":"assistant"},"index":0}],"created":1742632436,"id":"021742632435712396f12d018b5d576a7a55349c2eba0815061fc","model":"doubao-1-5-pro-32k-250115","service_tier":"default","object":"chat.completion.chunk","usage":null}
       
       {"choices":[{"delta":{"content":" How","role":"assistant"},"index":0}],"created":1742632436,"id":"021742632435712396f12d018b5d576a7a55349c2eba0815061fc","model":"doubao-1-5-pro-32k-250115","service_tier":"default","object":"chat.completion.chunk","usage":null}
       
       {"choices":[{"delta":{"content":" can","role":"assistant"},"index":0}],"created":1742632436,"id":"021742632435712396f12d018b5d576a7a55349c2eba0815061fc","model":"doubao-1-5-pro-32k-250115","service_tier":"default","object":"chat.completion.chunk","usage":null}
       
       {"choices":[{"delta":{"content":" I","role":"assistant"},"index":0}],"created":1742632436,"id":"021742632435712396f12d018b5d576a7a55349c2eba0815061fc","model":"doubao-1-5-pro-32k-250115","service_tier":"default","object":"chat.completion.chunk","usage":null}
       
       {"choices":[{"delta":{"content":" help","role":"assistant"},"index":0}],"created":1742632436,"id":"021742632435712396f12d018b5d576a7a55349c2eba0815061fc","model":"doubao-1-5-pro-32k-250115","service_tier":"default","object":"chat.completion.chunk","usage":null}
       
       {"choices":[{"delta":{"content":" you","role":"assistant"},"index":0}],"created":1742632436,"id":"021742632435712396f12d018b5d576a7a55349c2eba0815061fc","model":"doubao-1-5-pro-32k-250115","service_tier":"default","object":"chat.completion.chunk","usage":null}
       
       {"choices":[{"delta":{"content":" today","role":"assistant"},"index":0}],"created":1742632436,"id":"021742632435712396f12d018b5d576a7a55349c2eba0815061fc","model":"doubao-1-5-pro-32k-250115","service_tier":"default","object":"chat.completion.chunk","usage":null}
       
       {"choices":[{"delta":{"content":"?","role":"assistant"},"index":0}],"created":1742632436,"id":"021742632435712396f12d018b5d576a7a55349c2eba0815061fc","model":"doubao-1-5-pro-32k-250115","service_tier":"default","object":"chat.completion.chunk","usage":null}
       
       {"choices":[{"delta":{"content":"","role":"assistant"},"finish_reason":"stop","index":0}],"created":1742632436,"id":"021742632435712396f12d018b5d576a7a55349c2eba0815061fc","model":"doubao-1-5-pro-32k-250115","service_tier":"default","object":"chat.completion.chunk","usage":null}
       
       [DONE]
    

续写模式

  • request

    curl https://operator.las.cn-beijing.volces.com/api/v1/chat/completions      -H "Content-Type: application/json"      -H "Authorization: Bearer $ARK_API_KEY"      -d $'{
           "messages": [
               {
                   "content": "你是一个计算器,请计算: 1 + 1",
                   "role": "user"
               },
               {
                   "content": "=",
                   "role": "assistant"
               }
           ],
           "model": "doubao-1-5-pro-32k-250115"
       }'
    
  • response

    {
         "choices": [
           {
             "finish_reason": "stop",
             "index": 0,
             "logprobs": null,
             "message": {
               "content": " 2",
               "role": "assistant"
             }
           }
         ],
         "created": 1742634165,
         "id": "0217426341647344ee2a242cadeb3c7acc981f0bd805884bc65fc",
         "model": "doubao-1-5-pro-32k-250115",
         "service_tier": "default",
         "object": "chat.completion",
         "usage": {
           "completion_tokens": 2,
           "prompt_tokens": 21,
           "total_tokens": 23,
           "prompt_tokens_details": {
             "cached_tokens": 0
           },
           "completion_tokens_details": {
             "reasoning_tokens": 0
           }
         }
       }
    

图片理解

  • request

    curl https://operator.las.cn-beijing.volces.com/api/v1/chat/completions      -H "Content-Type: application/json"      -H "Authorization: Bearer $ARK_API_KEY"      -d $'{
           "model": "doubao-1-5-vision-pro-32k-250115",
           "messages": [
               {
                   "content": [
                       {
                           "image_url": {
                               "url": "https://ark-project.tos-cn-beijing.volces.com/images/view.jpeg"
                           },
                           "type": "image_url"
                       },
                       {
                           "text": "图片主要讲了什么?",
                           "type": "text"
                       }
                   ],
                   "role": "user"
               }
           ]
       }'
    
  • response

    {
         "choices": [
           {
             "finish_reason": "stop",
             "index": 0,
             "logprobs": null,
             "message": {
               "content": "画面中呈现了一幅宁静的户外景象。一个人乘坐在橙黄色的皮划艇上,手持船桨,正在平静的水面划行。水面如镜,倒映着周围景致。远处是茂密的森林,森林后方矗立着巍峨的雪山,山体覆盖着白雪。天空呈浅蓝色,飘浮着一些云朵。整体氛围静谧而美好,展现出自然的纯净与壮阔。 ",
               "role": "assistant"
             }
           }
         ],
         "created": 1742636149,
         "id": "0217426361458116592a076493be583bc5e33f80ac2dcf1efc31b",
         "model": "doubao-1-5-vision-pro-32k-250115",
         "service_tier": "default",
         "object": "chat.completion",
         "usage": {
           "completion_tokens": 85,
           "prompt_tokens": 521,
           "total_tokens": 606,
           "prompt_tokens_details": {
             "cached_tokens": 0
           },
           "completion_tokens_details": {
             "reasoning_tokens": 0
           }
         }
       }
    

深度推理

  • request

    curl https://operator.las.cn-beijing.volces.com/api/v1/chat/completions      -H "Content-Type: application/json"      -H "Authorization: Bearer $ARK_API_KEY"      -d $'{
           "messages": [
       
               {
                   "content": "我要有研究推理模型与非推理模型区别的课题,怎么体现我的专业性",
                   "role": "user"
               }
           ],
           "model": "doubao-seed-1-6-251015"
       }'
    
  • response

    {
         "choices": [
           {
             "finish_reason": "stop",
             "index": 0,
             "logprobs": null,
             "message": {
               "content": "
    
    推理模型与非推理模型的主要区别在于其处理任务的方式、能力侧重点以及应用场景。以下是两者的核心区别分析:
    
    ---
    
    ### **1. 核心定义**
    - **推理模型**  
      具备**逻辑推理、因果推断或复杂决策**能力,***  
    
    实际应用中,两类模型常配合使用(如用非推理模型提取特征,再交给推理模型决策),以平衡效率与准确性。",
               "reasoning_content": "嗯,用户问的是推理模型和非推理模型有什么区别。我需要先理解这两个术语的具体含义。可能用户对机器学习或深度学习有一定的了解,但需要更清晰的区分。首先,我应该明确这两个概念的定义,然后从不同角度进行比较。
    
    首先,推理模型可能指的是那些需要进行逻辑推理、处理复杂任务的模型,***,而非推理模型侧重于模式识别和直接映射,帮助用户形成清晰的概念框架。
    ",
               "role": "assistant"
             }
           }
         ],
         "created": 1742636537,
         "id": "0217426364949596592a076493be583bc5e33f80ac2dcf1eeaf9b",
         "model": "doubao-seed-1-6-251015",
         "service_tier": "default",
         "object": "chat.completion",
         "usage": {
           "completion_tokens": 1207,
           "prompt_tokens": 11,
           "total_tokens": 1218,
           "prompt_tokens_details": {
             "cached_tokens": 0
           },
           "completion_tokens_details": {
             "reasoning_tokens": 419
           }
         }
       }
    
最近更新时间:2026.08.04 18:50:11
这个页面对您有帮助吗?
有用
有用
无用
无用