DeepSeek 系列
DeepSeek V4 系列通用模型,OpenAI 兼容,同步或 SSE 流式
响应中如出现推理内容 reasoning_content,不要把该字段回传到下一轮 messages;只回传最终 content 和工具调用消息。
POST/v1/chat/completions
DeepSeek 官方 API 与 OpenAI 格式兼容,通用字段见接口说明。
| 项 | 值 |
|---|---|
| 模型 | 见下表 |
| 模式 | 同步或 SSE 流式 |
| 计费 | 按 token,输入与输出分别计价,价格以定价页为准 |
| 模型 | 类型 | 上下文 | 最大输出 |
|---|---|---|---|
deepseek-v4.1-flash | 通用 | 1,000,000 | 384,000 |
deepseek-v4-flash | 通用 | 1,000,000 | 128,000 |
deepseek-v4-pro | 通用 | 1,000,000 | 128,000 |
快速开始
curl https://api.vibelab.me/v1/chat/completions \
-H "Authorization: Bearer $LOOPTOKEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4-flash",
"messages": [{"role": "user", "content": "用一句话介绍你自己"}],
"max_tokens": 1024
}'{
"id": "chatcmpl_01H...",
"object": "chat.completion",
"created": 1783819200,
"model": "deepseek-v4-flash",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "我是 DeepSeek 开发的 AI 助手……"
},
"finish_reason": "stop"
}],
"usage": {"prompt_tokens": 12, "completion_tokens": 40, "total_tokens": 52}
}请求参数
messages[].role 为 system、user、assistant 或 tool;messages[].content 为字符串。
| 参数 | 类型 | 必填 | 默认 | 说明 |
|---|---|---|---|---|
model | string | 是 | - | 上表模型之一 |
messages | array | 是 | - | 对话消息列表 |
stream | boolean | 否 | false | 是否 SSE 流式输出 |
max_tokens | integer | 否 | 模型默认 | 最大输出 Token 数 |
temperature | number | 否 | 1 | 采样温度,范围 [0, 2) |
top_p | number | 否 | 1 | 核采样阈值,范围 (0, 1] |
frequency_penalty | number | 否 | 0 | 频率惩罚,范围 [-2, 2] |
presence_penalty | number | 否 | 0 | 存在惩罚,范围 [-2, 2] |
stop | string/array | 否 | - | 停止序列 |
tools | array | 否 | - | 函数工具定义 |
tool_choice | string/object | 否 | auto | 工具选择策略 |
response_format | object | 否 | {"type":"text"} | 可设置 JSON Object 输出 |
响应
字段同接口说明,差异:
| 字段 | 类型 | 说明 |
|---|---|---|
choices[].message.content | string/null | 最终答案 |
choices[].message.reasoning_content | string/null | 推理内容(模型返回时出现) |
choices[].message.tool_calls | array | 工具调用列表 |
choices[].finish_reason | string | stop、length 或 tool_calls |
usage.completion_tokens | integer | 输出 Token 数,包含模型返回的推理 Token |
计费
按 token 计费;预扣与结算规则见接口说明。推理 Token 计入输出 Token。
错误
本页无特有错误,见接口说明。