DeepSeek 參數與協定差異
了解 DeepSeek 系列模型在相容協定下的參數差異與使用方式。
使用 DeepSeek 模型時,根據本頁調整所選協定的參數。完整請求和回應結構參閱 Chat Completions、Responses 和 Messages。
| 模型 | 適用範圍 |
|---|
| deepseek-flash | Chat、Responses、Messages;支援圖片輸入 |
| deepseek-v4-pro | Chat、Responses、Messages;不支援圖片輸入,Responses 支援伺服器端搜索 |
| 欄位 | 差異說明 |
|---|
thinking.type | 兩款模型預設開啟思考,支援 enabled/disabled |
reasoning_effort | none 關閉思考,low/high/max 開啟思考,預設 high;兼容檔位 minimal 映射為 low,medium/xhigh 映射為 high,ultra 映射為 max |
temperature | 範圍 0~2;思考模式下傳入值被忽略 |
top_p | Flash:思考時有效範圍 0.95~1,低於 0.95 按 0.95 處理;非思考時固定為 1。Pro:思考時忽略傳入值,攜帶 tools 固定為 0.95,否則為 1;非思考時生效 |
max_tokens | DeepSeek 仍使用此欄位,未標記棄用;範圍 1~393216。非思考時預設 8192,思考時預設 65536,努力程度為 max 時預設 131072 |
presence_penalty、frequency_penalty | 官方已棄用,傳入不會生效 |
stop | 字串或字串陣列,最多 16 個停止串 |
response_format.type | 支援 text/json_object;JSON 模式還須在提示詞中明確要求輸出 JSON |
tools、tool_choice | 僅支援 Function Tool;思考模式下使用 required 或指定函數會回傳 400,須先關閉思考 |
歷史 reasoning_content | 思考模式下,請求攜帶 tools 時須回傳所有歷史 assistant 思考,包括未發生工具呼叫的輪次;未攜帶 tools 時歷史思考被忽略 |
stream_options.include_usage | 只能與 stream: true 同用;無論是否開啟,最後一個內容區塊均有完整 Usage,不另發 choices: [] 的用量塊。開啟後,之前各塊的 usage 為 null |
user_id | DeepSeek 擴展:最長 512 個字符,僅允許字母、數字、下划線和連字符;用於用戶、快取和調度隔離,不應包含個人隱私信息 |
| 欄位 | 差異說明 |
|---|
input、instructions | 至少傳一個;instructions 作為首條 system 消息,developer 角色按 user 處理 |
reasoning.effort | 預設 high,支援 none/low/high/max,兼容檔位映射同上表;none 關閉思考 |
temperature、top_p | 取值和思考模式下的行為同上表,注意 Flash 與 Pro 的區別 |
previous_response_id、conversation、store | 無狀態接口,傳入值被忽略;多輪須回傳歷史輸入和輸出。回應固定為 previous_response_id: null、store: false |
text.format | 支援 text/json_object/json_schema;JSON Schema 須提供 name 和 schema |
text.verbosity、reasoning.summary | 前者不生效,後者不生成摘要;歷史 reasoning 僅支援明文 content,不支援 summary/encrypted_content |
tools | 支援 Function Tool;Custom Tool 僅支援名稱為 apply_patch,其他名稱回傳 400。web_search 僅 Pro 生效,Flash 忽略;file_search、code_interpreter、computer_use、mcp 被忽略 |
tool_choice | 支援 none/auto/required 及指定 Function Tool |
parallel_tool_calls、max_tool_calls | 傳入值被忽略;並行工具呼叫始終開啟,回應的 parallel_tool_calls 固定為 true |
truncation | 被忽略,不自動截斷;輸入超出上下文限制回傳 400 |
background、metadata、include、prompt | 傳入值被忽略 |
service_tier、safety_identifier、context_management、stream_options | 傳入值被忽略 |
| 欄位 | 差異說明 |
|---|
anthropic-version | DeepSeek 忽略該 Header,不按 Anthropic 的版本日期切換欄位規則 |
thinking、output_config.effort | 預設開啟思考;thinking.type 支援 enabled/disabled,budget_tokens 被忽略。深度使用 low/high/max,預設 high,兼容檔位映射同 Chat 表;output_config 僅支援 effort |
temperature、top_p | 取值和思考模式下的行為同 Chat 表;top_k 被忽略 |
tool_choice.type | 支援 none/auto/any/tool;disable_parallel_tool_use 被忽略 |
metadata | 僅支援 user_id,其他欄位被忽略 |
container、mcp_servers、service_tier | 傳入值被忽略 |
| 文字與工具結果 | 文字塊的 citations、工具結果的 is_error 被忽略;快取標記見下表 |
| 內容區塊 | 不支援 document、search_result、redacted_thinking、code_execution_tool_result、mcp_tool_use、mcp_tool_result、container_upload |
| 欄位 | 差異說明 |
|---|
| 自動前綴快取 | 預設開啟,無需添加快取設定;後續請求完整匹配已寫入的前綴單元時可命中,不保證任意相同片段均能命中 |
Responses 的 prompt_cache_key、prompt_cache_retention | 傳入值被忽略,快取由系統自動管理 |
Messages 的 cache_control | 內容區塊及工具定義中的標記被忽略 |
| 快取用量 | Chat 查看 usage.prompt_cache_hit_tokens 和 usage.prompt_cache_miss_tokens;Responses 查看 usage.input_tokens_details.cached_tokens |
僅 deepseek-flash 支援圖片,deepseek-v4-pro 不支援。
將 MODEL_ID 替換為平台提供的完整模型 ID,API Key 使用自己的值。
curl 'https://api.agtcloud.cn/v1/chat/completions' \
-H 'Authorization: Bearer your-api-key' \
-H 'Content-Type: application/json' \
--data '{
"model": "MODEL_ID",
"messages": [{"role": "user", "content": "用三點說明如何排查 API 逾時"}],
"thinking": {"type": "enabled"},
"reasoning_effort": "high",
"max_tokens": 4096
}'