Loading...
核心接口,兼容 OpenAI Chat Completions API 格式。
https://www.ciyuano.com/v1/chat/completions| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | Yes | 模型 ID,如 deepseek-v4-flash、mimo-v2.5-pro、auto |
messages | array | Yes | 消息列表,包含对话历史 |
stream | boolean | No | 是否使用流式输出,默认 false |
temperature | number | No | 采样温度,范围 0-2,默认 1。值越低输出越确定 |
top_p | number | No | 核采样概率,范围 0-1。建议不要与 temperature 同时修改 |
max_tokens | integer | No | 最大输出 token 数 |
frequency_penalty | number | No | 频率惩罚,范围 -2 到 2。正值降低重复词频率 |
presence_penalty | number | No | 存在惩罚,范围 -2 到 2。正值增加新话题概率 |
stop | string / array | No | 停止词,模型生成到该词时停止 |
tools | array | No | 工具列表,用于 Function Calling |
tool_choice | string / object | No | 工具选择策略:auto / none / required / 指定函数 |
| 字段 | 类型 | 说明 |
|---|---|---|
role | string | system / user / assistant / tool |
content | string / array | 消息内容。纯文本为 string,多模态(图片)为 array |
tool_calls | array | 模型返回的工具调用列表(assistant 角色) |
tool_call_id | string | 工具调用的 ID(tool 角色必填) |
{
"model": "deepseek-v4-flash",
"messages": [
{
"role": "system",
"content": "你是一个有帮助的助手。"
},
{
"role": "user",
"content": "你好!"
}
],
"stream": false,
"temperature": 0.7,
"max_tokens": 2048
}{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1700000000,
"model": "deepseek-v4-flash",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "你好!有什么可以帮助你的吗?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 20,
"completion_tokens": 12,
"total_tokens": 32
}
}