AGTCloud API Docs
文件指南API Reference整合與資源更新與幫助
各廠商欄位特性差異

Qwen 參數與協定差異

了解 Qwen 系列模型在相容協定下的參數差異與使用方式。

使用 Qwen 模型時,根據本頁調整所選協定的參數。完整請求和回應結構參閱 Chat Completions、Responses 和 Messages。

適用模型

模型適用範圍
qwen3.8-max-0902、qwen3.8-flash、qwen3.8-max均支援 Chat、Responses 和 Messages;共同規則合併說明,媒體入口的具體範圍見下方表格

Chat Completions 差異

欄位差異說明
enable_thinking、reasoning_effort預設開啟思考;有效深度為 low/medium/xhigh,預設 xhigh。minimal 映射為 low,high/max 映射為 xhigh,none 等價於關閉思考
thinking_budget不能與 reasoning_effort 同時設置,否則報錯。單獨指定深度時,low/medium/xhigh 分別對應 4096/16384/262144 的思考預算
max_tokens、max_completion_tokensmax_tokens 僅限制最終回答,官方注明即將廢棄;新接入使用 max_completion_tokens,限制思考與回答的總 Token 數
temperature範圍 [0,2);思考模式下文字輸入預設 1.0、視覺輸入預設 0.6,低於 0.6 的值按 0.6 處理;非思考模式預設 0.7
top_p、top_ktop_p 範圍 (0,1],思考/非思考預設分別為 0.95/0.8。擴展欄位 top_k 為非負整數,預設 20;null 或大於 100 時禁用 Top-K 策略
repetition_penaltyQwen 擴展,須大於 0,預設 1.0,與 OpenAI 的兩個懲罰欄位不同
preserve_thinking預設開啟;歷史思考通過 assistant 的 reasoning_content 原欄位完整回傳,不要拼入 content。未回傳思考內容不會因此報錯
tool_choice支援 auto/none;思考模式不支援 required 或強制指定函數,非思考模式可指定函數,但 required 仍不保證呼叫工具
tool_stream預設 false,僅在 stream=true 時控制複雜工具參數的增量輸出;Max 系列限文字場景,Flash 支援全模態場景
response_format支援 json_object/json_schema;前者要求提示詞包含 JSON 關鍵詞,後者通過 response_format.json_schema 定義結構,無需關閉思考
enable_search、search_optionsenable_search 預設 false;search_options.forced_search 可強制搜索,本頁模型使用 turbo/max 策略。include_tool_usage=true 時,實際搜索呼叫統計回傳在 usage.x_tools

Responses 差異

欄位差異說明
reasoning.effort支援 none/low/medium/xhigh,預設 xhigh;minimal 映射為 low,high/max 映射為 xhigh
enable_thinking兼容開關,官方建議改用 reasoning.effort,後續將停止支援;兩者同時傳入時,reasoning.effort 優先
max_output_tokens最小為 16,包含思考與最終回答
text.format支援 text/json_object/json_schema;JSON Schema 設定放在 text.format.json_schema 內,包含 name/schema/strict,與原版的平鋪結構不同
tool_choice支援 auto/none/required 和 allowed_tools 物件;required 僅在工具列表只有一個工具時可用
tools除函數外,還支援 web_search、web_extractor、code_interpreter 等內置工具;網頁抓取須搭配搜索,程式碼解釋器須開啟思考
store、previous_response_id、conversation支援伺服器端保存歷史,store 預設 true,回應 ID 有效期為 7 天;後兩個欄位不能同時使用
background、其他擴展參數不支援後台異步執行;官方 Responses Reference 未列出的 OpenAI 參數會被忽略

Messages 差異

欄位差異說明
thinking.type支援 enabled/disabled,預設開啟思考;不要直接套用 Claude 的 adaptive 設定
output_config.effort使用 low/medium/xhigh,預設 xhigh;high/max 映射為 xhigh,不照搬 Chat 的全部兼容映射值
thinking.budget_tokens官方注明即將廢棄,新接入使用 output_config.effort;保留舊預算設定時,max_tokens 須大於該預算
max_tokens必填;Qwen3.8 中限制思考與最終回答的總 Token 數
temperature、messages[].role溫度範圍為 [0,2);消息角色除 user/assistant 外,還允許 system
tool_result.content使用字串回傳工具結果;物件或陣列結果先序列化,不直接套用 Claude 的內容區塊陣列結構
output_config.format支援嚴格 JSON Schema;使用 type: "json_schema",Schema 放在 schema 內,additionalProperties 須為 false
tools 中的 web_search搜索工具名為 web_search,類型使用 web_search_20250305 等日期後綴形式;HTTP/SDK 呼叫還須在 system 中加入用戶端識別碼 x-anthropic-billing-header: cc_entrypoint=cli;

快取差異

欄位差異說明
隱式快取自動開啟;相同前綴至少 1024 Token 才具備命中條件,達到長度不保證每次命中
Chat/Messages 顯式快取在內容區塊上使用 cache_control: { type: "ephemeral" };最少 1024 Token,有效期 5 分鐘,命中後重置;最多設置 4 個標記
顯式快取位置系統提示詞需使用內容區塊陣列;工具定義參與前綴計算,但在工具定義上單獨添加標記會被忽略。不要照搬通用 Reference 的其他 TTL 或快取斷點欄位
Responses Session 快取Header x-dashscope-session-cache: enable 開啟,預設 disable;關閉 Session 快取不等於關閉自動隱式快取
快取用量Chat 查看 usage.prompt_tokens_details.cached_tokens;Responses 查看 usage.input_tokens_details.cached_tokens;Messages 查看 usage.cache_read_input_tokens、usage.cache_creation_input_tokens

媒體輸入差異

輸入協定內容區塊差異說明
圖片image_urlChat:image_url.url 支援公網 URL 或 Base64 Data URL
影片video_urlChat 擴展:video_url.url 支援公網 URL 或 Base64 Data URL;fps 放在內容區塊上,與 video_url 同級
幀列表videoChat 擴展:用 video 陣列傳入按時間排列的圖片,最少 4 幀
圖片input_imageResponses:image_url 為公網 URL 或完整 Base64 Data URL 字串,不使用 Chat 的巢狀物件
PDFinput_fileResponses 官方明確列出 qwen3.8-max、qwen3.8-flash;使用 file_url 傳入公網 PDF,最大 100 MB,不把 OCR 專屬參數套給本頁模型
圖片imageMessages:source.type=url 時提供 url;base64 時提供 media_type 與純 Base64 data
影片videoMessages 擴展:通過 source 提供公網 URL,或 media_type 與純 Base64 data;不是 Claude 原版內容區塊
欄位差異說明
Chat 圖像控制內容區塊上的 min_pixels/max_pixels 調整圖像像素;頂層 vl_high_resolution_images=true 時,max_pixels 不再生效
圖片大小公網圖片不超過 20 MB;Base64 編碼前的圖片不超過 20 MB,編碼後的 Data URL 在 Chat 中不超過 20 MB、Messages 中不超過 32 MB
影片限制公網影片不超過 2 GB,Base64 編碼字串小於 10 MB;影片按畫面理解,不處理其中的音訊
協定範圍三款模型不按 Omni 的音訊接口呼叫;Responses 的 input_audio/input_video 當前限定給 Omni,不把 Chat/Messages 的影片塊直接移入 Responses

呼叫範例

將 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 逾時"}],
    "reasoning_effort": "low",
    "max_completion_tokens": 4096
  }'

官方參考

本頁目錄