Authorization: Bearer ********************
data: [DONE]
结尾。stream
参数为true
时,才可设置此参数。true
,在流式消息最后的data: [DONE]
之前将会传输一个额外的块。此块上的 usage 字段显示整个请求的 token 使用统计信息,而 choices 字段将始终是一个空数组。所有其他块也将包含一个 usage 字段,但其值为null
。top_p
,但不建议同时对两者进行修改。top_p
概率的 token 的结果。所以 0.1 就意味着只有包括在最高 10% 概率中的 token 会被考虑。 我们通常建议修改这个值或者更改temperature
,但不建议同时对两者进行修改。none
意味着模型不会调用任何 tool,而是生成一条消息。auto
意味着模型可以选择生成一条消息或调用一个或多个 tool。required
意味着模型必须调用一个或多个 tool。{"type": "function", "function": {"name": "my_function"}}
指定特定 tool,会强制模型调用该 tool。none
。如果有tool
存在,默认值为auto
。none
意味着模型不会调用任何 tool,而是生成一条消息。auto
意味着模型可以选择生成一条消息或调用一个或多个 tool。required
意味着模型必须调用一个或多个 tool。true
,则在message
的content
中返回每个输出 token 的对数概率。logprobs
必须为true
。{
"messages": [
{
"content": "You are a helpful assistant",
"role": "system"
},
{
"content": "Hi",
"role": "user"
}
],
"model": "deepseek-chat",
"frequency_penalty": 0,
"max_tokens": 2048,
"presence_penalty": 0,
"response_format": {
"type": "text"
},
"stop": null,
"stream": false,
"stream_options": null,
"temperature": 1,
"top_p": 1,
"tools": null,
"tool_choice": "none",
"logprobs": false,
"top_logprobs": null
}
curl --location --request POST 'https://api.damodel.com/chat/completions' \
--header 'Content-Type: application/json' \
--data-raw '{
"messages": [
{
"content": "You are a helpful assistant",
"role": "system"
},
{
"content": "Hi",
"role": "user"
}
],
"model": "deepseek-chat",
"frequency_penalty": 0,
"max_tokens": 2048,
"presence_penalty": 0,
"response_format": {
"type": "text"
},
"stop": null,
"stream": false,
"stream_options": null,
"temperature": 1,
"top_p": 1,
"tools": null,
"tool_choice": "none",
"logprobs": false,
"top_logprobs": null
}'
stop
:模型自然停止生成,或遇到stop
序列中列出的字符串。length
:输出长度达到了模型上下文长度限制,或达到了max_tokens
的限制。content_filter
:输出内容因触发过滤策略而被过滤。insufficient_system_resource
:系统推理资源不足,生成被打断。{
"id": "string",
"choices": [
{
"delta": {
"content": "string",
"reasoning_content": "string",
"role": "assistant"
},
"finish_reason": "stop",
"index": 0
}
],
"created": "string",
"model": "string",
"object": "chat.completion.chunk",
"usage": {
"completion_tokens": 0,
"prompt_tokens": 0,
"total_tokens": 0
}
}