Skip to main content

OpenAI-compatible Chat

Call models through the OpenAI-compatible Chat API, and view input and output parameter descriptions and invocation examples.

  • Singapore
  • China (Beijing)
  • US (Virginia)
  • Germany (Frankfurt)
  • Japan (Tokyo)
  • Hong Kong (China)
SDK call configuration for base_url: https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1HTTP request: POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions
When calling, replace {WorkspaceId} with your actual Workspace ID. You must first obtain and configure an API Key. If you call the API through the OpenAI SDK, you need to install the SDK.
Alibaba Cloud Bailian has launched workspace-specific domains for the China (Beijing), Singapore, and Hong Kong (China) regions, which provide superior performance and higher stability for inference requests. We recommend that you migrate to the new domains:
  • China (Beijing) region: migrate from https://dashscope.aliyuncs.com to https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com
  • Singapore region: migrate from https://dashscope-intl.aliyuncs.com to https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com
Here, {WorkspaceId} is your workspace ID, which you can view on the Workspace Details page in the Alibaba Cloud Bailian console. The existing domains still work as usual.

Request body

modelstring(Required)The model name.Supported models: Qwen large language models (commercial and open-source versions), Qwen-VL, Qwen-Coder, Qwen-Omni, Qwen-Math, DeepSeek (Alibaba Cloud direct, SiliconFlow direct, Kuaishou Wanqing direct), Kimi (Alibaba Cloud direct, Moonshot AI direct), GLM (Alibaba Cloud direct), MiniMax (Alibaba Cloud direct, Xiyu Technology direct).
Third-party direct models are available only in the China (Beijing) region of the China site. Before calling them, you must enable the corresponding service in the Bailian console (taking SiliconFlow DeepSeek as an example: search for deepseek → find the SiliconFlow DeepSeek model card → click Activate Now → Confirm Authorization).
Qwen-Audio does not support the OpenAI-compatible protocol; it only supports the DashScope protocol.
For specific model names and billing, see theBailian console.messagesarray(Required)The context passed to the large language model, arranged in conversation order.

Message type

System Messageobject(Optional)The system message, used to define the role, tone, task objectives, or constraints of the large language model. It is generally placed first in the messages array.
Setting a System Message is not recommended for QwQ models; for QVQ models, the System Message does not take effect.
contentstring(Required)The system instruction, used to specify the model's role, behavior rules, response style, and task constraints.rolestring(Required)The role of the system message, fixed as system .
User Messageobject(Required)The user message, used to pass questions, instructions, or context to the model.
contentstring or array(Required)The message content. If the input is text only, it is of the string type; if the input contains multimodal data such as images, or explicit cache is enabled, it is of the array type.
typestring(Required)Valid values:
  • text Set this to text when the input is text.
  • image_url Set this to image_url when the input is an image.
  • input_audio Set this to input_audio when the input is audio.
  • video Set this to video when the input is a video in the form of an image list.
  • video_url Set this to video_url when the input is a video file.
    Only some Qwen-VL models support video file input. For more information, see Video Understanding (Qwen-VL); QVQ and Qwen-Omni models support passing video files directly.
textstringThe input text. Required when type is text.image_urlobjectThe input image information. Required when type is image_url.
url string (Required)The image URL or Base64 Data URL. To pass in local files, see Image and video understanding.detail string (Optional)Image processing detail. Max, Plus, and Flash models support this parameter starting with Qwen4. The default is high.When max_pixels is not specified:
  • high: Processes at the original image resolution, with an upper limit of 16777216 pixels.
  • low: The pixel upper limit is 2621440.
  • auto: Same as low.
When max_pixels is explicitly specified, this value is used as the pixel upper limit and takes precedence over detail. The maximum value is 16777216. In Chat Completions, max_pixels is at the same level as image_url; in DashScope, it is at the same level as image.For high-resolution images, using high typically consumes more input tokens than low.In Chat Completions, detail can be passed inside image_url or at the same level as image_url; in DashScope, it is passed at the same level as image.
{"type":"image_url","image_url":{"url":"https://example.com/image.jpg","detail":"high"}}
input_audioobjectThe input audio information. Required when type is input_audio.
data string (Required)The audio URL or Base64 Data URL. To pass in local files, see Input Base64-encoded local files.formatstring (Required)The format of the input audio, such as mp3 or wav.
videoarrayFor Qwen4-Max, Qwen3.8, Qwen3.7, Qwen3.6, and Qwen3.5 series models, video input as a public URL image list supports 4–8000 images; Base64 image lists support up to 250 images.The input video information in the form of an image list. Required when type is video. For usage, see Video understanding (Qwen-VL, QVQ) or Video understanding (Qwen-Omni).Example values:
[
    "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241108/xzsgiz/football1.jpg",
    "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241108/tdescd/football2.jpg",
    "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241108/zefdja/football3.jpg",
    "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241108/aedbqh/football4.jpg"
]
video_urlobjectThe input video file information. Required when type is video_url.Qwen-VL can only understand the visual information in video files, while Qwen-Omni can understand both the visual and audio information in video files.
url string (Required)The public URL or Base64 Data URL of the video file. To input local video files, see Input Base64-encoded local files.
fpsfloat (Optional)Frames extracted per second. Value range: [0.1, 10]; default value: 2.0.
For MiniMax/MiniMax-M3.1-Flash and MiniMax/MiniMax-M3, the fps value range is [0.2, 5], and the default value is 1.
fps has two functions:
  • When a video file is input, it controls the frame extraction frequency: one frame is extracted every 1/fps seconds.
    Applies to Qwen-VL and QVQ and MiniMax/MiniMax-M3.1-Flash and MiniMax/MiniMax-M3 models.
  • Informs the model of the time interval between adjacent frames, helping it better understand the temporal dynamics of the video. It also applies to both video file and image list inputs. This feature supports both video file and image list inputs, and is suitable for scenarios such as event temporal localization or segmented content summarization.
    Supported models include Qwen3.7, Qwen3.6, Qwen3.5, Qwen3-VL, Qwen2.5-VL, Qwen3.8-Omni-Flash, Qwen3.5-Omni, and QVQ.
A larger fps is suitable for high-speed motion scenarios (such as sports events and action movies), while a smaller fps is suitable for long videos or relatively static content.
  • Pass in an image list: {"video":["https://xx1.jpg",...,"https://xxn.jpg"],"fps":2}
  • Pass in a video file: {"video": "https://xx1.mp4","fps":2}
min_pixelsinteger (Optional)Sets the minimum pixel threshold for input images or video frames. When the pixels of an input image or video frame are less than min_pixels, the image or video frame will be scaled up until the total pixels exceed min_pixels. For applicable models and values, see the description below.
  • Input images:
    • qwen4-max, qwen3.8-max, qwen3.8-max-0902, qwen3.8-flash, qwen3.8-2.4t-a95b, qwen3.8-27b, Qwen3.7, Qwen3.6, Qwen3.5, Qwen3-VL: The default value and minimum value are both 65536
    • qwen3.8-omni-flash, Qwen3.5-Omni: The default value and minimum value are both 24576
    • Qwen2.5-VL open-source series and QVQ series models: The default value and minimum value are both 3136
  • Input video files or image lists:
    • qwen4-max, qwen3-omni-flash, qwen3-vl-plus, qwen3.5-122b-a10b, qwen3.5-27b, qwen3.5-35b-a3b, qwen3.5-397b-a17b, qwen3.5-flash, qwen3.5-flash-2026-02-23, qwen3.5-omni-flash, qwen3.5-omni-flash-2026-03-15, qwen3.5-omni-plus, qwen3.5-omni-plus-2026-03-15, qwen3.5-plus, qwen3.5-plus-2026-02-15, qwen3.5-plus-2026-04-20, qwen3.6-27b, qwen3.6-35b-a3b, qwen3.6-flash, qwen3.6-flash-2026-04-16, qwen3.6-plus, qwen3.6-plus-2026-04-02, qwen3.7-flash, qwen3.7-flash-2026-07-15, qwen3.7-max-2026-06-08, qwen3.7-plus, qwen3.7-plus-2026-05-26, qwen3.8-27b, qwen3.8-flash, qwen3.8-max, qwen3.8-max-0902, qwen3.8-omni-flash: The default value is 65536, and the minimum value is 4096.
    • kimi-k2.5, kimi-k2.6, kimi-k2.7-code: The minimum value is 3136.
    • The Qwen2.5-VL open-source series and QVQ series models: The default value is 50176, and the minimum value is 3136
  • Input image: {"type": "image_url","image_url": {"url":"https://xxxx.jpg"},"min_pixels": 65536}
  • When inputting a video file: {"type": "video_url","video_url": {"url":"https://xxxx.mp4"},"min_pixels": 65536}
  • When inputting an image list: {"type": "video","video": ["https://xx1.jpg",...,"https://xxn.jpg"],"min_pixels": 65536}
max_pixelsinteger (Optional)Used to set the maximum pixel threshold for input images or video frames. When the pixels of an input image or video are within the [min_pixels, max_pixels] range, the model recognizes the original image. When the pixels of an input image exceed max_pixels, the image will be scaled down until the total pixels are less than max_pixels. For applicable models and values, see the description below.
  • Input images:
    • qwen4-max: The maximum value is 16777216. If this parameter is not specified, images are processed based on detail; an explicitly passed max_pixels is not affected by vl_high_resolution_images.
    Other models: The value of max_pixels depends on whether the vl_high_resolution_images parameter is enabled.
    • When vl_high_resolution_images is False:
      • qwen3.8-max, qwen3.8-max-0902, qwen3.8-flash, qwen3.8-2.4t-a95b, qwen3.8-27b, Qwen3.7, Qwen3.6, Qwen3.5, Qwen3-VL: The default value is 2621440, and the maximum value is 16777216
      • qwen3.8-omni-flash, Qwen3.5-Omni: The default value is 1310720, and the maximum value is 16777216
      • Qwen2.5-VL open-source series and QVQ series models: The default value is 1003520, and the maximum value is 12845056
    • When vl_high_resolution_images is True:
      • qwen3.8-max, qwen3.8-max-0902, qwen3.8-flash, qwen3.8-2.4t-a95b, qwen3.8-27b, qwen3.8-omni-flash, Qwen3.7, Qwen3.6, Qwen3.5-Omni, Qwen3.5, Qwen3-VL: max_pixels is invalid, and the maximum pixels of input images is fixed at 16777216
      • Qwen2.5-VL open-source series and QVQ series models: max_pixels is invalid, and the maximum pixels of input images is fixed at 12845056
  • Input video files or image lists: When both min_pixels and max_pixels are set, max_pixels must not be less than min_pixels.
    • qwen4-max, qwen3-vl-plus, qwen3.5-122b-a10b, qwen3.5-27b, qwen3.5-35b-a3b, qwen3.5-397b-a17b, qwen3.5-flash, qwen3.5-flash-2026-02-23, qwen3.5-omni-flash, qwen3.5-omni-flash-2026-03-15, qwen3.5-omni-plus, qwen3.5-omni-plus-2026-03-15, qwen3.5-plus, qwen3.5-plus-2026-02-15, qwen3.5-plus-2026-04-20, qwen3.6-27b, qwen3.6-35b-a3b, qwen3.6-flash, qwen3.6-flash-2026-04-16, qwen3.6-plus, qwen3.6-plus-2026-04-02, qwen3.7-flash, qwen3.7-flash-2026-07-15, qwen3.7-max-2026-06-08, qwen3.7-plus, qwen3.7-plus-2026-05-26, qwen3.8-27b, qwen3.8-flash, qwen3.8-max, qwen3.8-max-0902, qwen3.8-omni-flash: The default value is 655360, and the maximum value is 2048000.
    • Other Qwen3-VL open-source models: The default value is 655360, and the maximum value is 786432
    • qwen3-omni-flash: The default value is 655360, and the maximum value is 786432.
    • kimi-k2.7-code, kimi-k2.6, kimi-k2.5: The maximum value is 1568000.
    • Qwen2.5-VL open-source series and QVQ series models: The default value is 501760, and the maximum value is 602112
  • Input image: {"type": "image_url","image_url": {"url":"https://xxxx.jpg"},"max_pixels": 8388608}
  • When inputting a video file: {"type": "video_url","video_url": {"url":"https://xxxx.mp4"},"max_pixels": 655360}
  • When inputting an image list: {"type": "video","video": ["https://xx1.jpg",...,"https://xxn.jpg"],"max_pixels": 655360}
total_pixelsinteger (Optional)The total pixel budget after video frame extraction.
  • 268435456: qwen4-max, qwen3.8-max、qwen3.8-max-0902。
  • 234881024:qwen3.7-plus、qwen3.7-plus-2026-05-26、qwen3.7-max-2026-06-08。
  • 819200000:qwen3.8-flash、qwen3.8-27b、qwen3.7-flash、qwen3.7-flash-2026-07-15、qwen3.6-flash。
  • 184549376:qwen3.8-omni-flash。
  • 102760448:kimi-k2.5、kimi-k2.6。
  • When inputting a video file: {"type": "video_url","video_url": {"url":"https://xxxx.mp4"},"total_pixels": 134217728}
  • When inputting an image list: {"type": "video","video": ["https://xx1.jpg",...,"https://xxn.jpg"],"total_pixels": 134217728}
prompt_cache_breakpoint object (Optional)Only qwen4-max is supported. Specifies the end position of the cache prefix. For more information, see Explicit Cache (Qwen4).
mode string (Required)Only explicit is supported; it must be explicitly passed when setting a breakpoint.
cache_controlobject (Optional)Used to enable explicit cache. Related documentation: Explicit Cache.
type string (Required)Only ephemeral is supported.
Only qwen4-max is supported. The content block cache marker of Qwen4 also supports ttl, with options 5m and 1h, and the default is 5m. For more information, see Explicit Cache (Qwen4).type string (Required)ephemeralttl string (Optional)Cache validity period. Supports 5m and 1h, and the default is 5m.
rolestring(Required)The role of the user message, fixed as user.
Assistant Message object (Optional)The model's reply. Typically passed back to the model as context in multi-turn conversations.
contentstring (Optional)The text content of the model reply. When tool_calls is included, content can be empty; otherwise content is required.rolestring(Required)The role of the assistant message, fixed as assistant.encrypted_content stringqwen4-max, thinking_display="summarized": The enabling parameter must be passed in every turn. The client can only pass the ciphertext back as-is; it cannot read, truncate, re-encode, modify, or concatenate ciphertext from multiple turns. The summary cannot replace the historical chain-of-thought. Chain-of-thought summary and encryption. The ciphertext must be passed back as-is.partialboolean (Optional), default value is falseWhether to enable partial mode.Valid values:
  • true: enabled;
  • false: disabled.
For supported models, see partial mode.tool_calls array (Optional)The tool and input parameter information returned after initiating Function Calling, containing one or more objects. Obtained from the tool_calls field of the model response in the previous turn.
id string (Required)The ID of the tool response.type string (Required)The tool type. Currently only function is supported.function object (Required)The tool and input parameter information.
name string (Required)Tool name.arguments string (Required)The input parameter information, as a string in JSON format.
index integer (Required)The index of the current tool information in the tool_calls array.
Tool Message object (Optional)The output information of the tool.
contentstring(Required)The output content of the tool function, which must be a string. If the tool returns structured data (such as JSON), you must serialize it into a string.rolestring(Required)Fixed to tool.tool_call_idstring(Required)The id returned after initiating Function Calling, obtained via completion.choices[0].message.tool_calls[$index].id, used to identify the tool corresponding to the Tool Message.
prompt_cache_options object (Optional)Only qwen4-max is supported. Cache configuration at the top level of the request. The Python SDK passes top-level non-standard parameters via extra_body; the Node.js SDK and curl pass them directly. For more information, see Explicit Cache (Qwen4).
mode string (Optional)implicit: cache breakpoints are set automatically, no manual configuration required.explicit: breakpoints are not set automatically; creating an explicit cache requires manual breakpoints.ttl string (Optional)Cache validity period. Supports 5m and 1h, and the default is 5m.Applies to all cache breakpoints of this request. If the top-level ttl is not set, the ttl in the last cache_control marker is used; if that marker does not set ttl or there is no marker, 5m is used.
streamboolean (Optional) Default value is falseWhether to respond in streaming output mode. Related documentation: Streaming outputValid values:
  • false: the model returns all generated content at once;
  • true: output is generated incrementally, and a data chunk is returned each time part of the content is generated. You need to read these chunks in real time one by one to assemble the complete response.
Setting it to true is recommended, which improves the reading experience and reduces the risk of timeouts.
The maximum timeout for non-streaming calls is no less than 300 seconds, and the actual duration varies depending on the deployment region and the model used. If the request is not completed before the timeout, the service will interrupt the request and return the generated content (instead of reporting an error). For scenarios with long outputs, be sure to use streaming calls. For more information about timeouts, see Text generation model overview.
stream_optionsobject (Optional)Only used for streaming requests where stream is true. Do not pass stream_options in non-streaming requests.

Properties

include_usageboolean (Optional)During streaming output, the last data chunk contains usage, and the choices of that chunk is an empty array.
modalitiesarray(Optional) Default value is ["text"]The modalities of the output data, only applicable to Qwen-Omni models. Related documentation: Non-realtime (Qwen-Omni)Valid values:
  • ["text","audio"]: outputs text and audio, applicable to models that support audio output;
  • ["text"]: outputs text only.
qwen3.8-omni-flash outputs text only. For examples, see Qwen3.8-Omni-Flash.audioobject (Optional)The voice and format of the output audio, applicable to Qwen-Omni models that support audio output, and the modalities parameter must be ["text","audio"]. Related documentation: Non-realtime (Qwen-Omni)
voicestring (Required)The voice of the output audio. See Non-realtime (Qwen-Omni).formatstring (Required)The format of the output audio, which can only be set to wav.
temperaturefloat (Optional)The sampling temperature, which controls the diversity of the text generated by the model.A higher temperature produces more diverse text, while a lower temperature produces more deterministic text.Value range: [0, 2)MiniMax/MiniMax-M3.1-Flash and MiniMax/MiniMax-M3 use a fixed value of 1.0, which cannot be customized; any other value does not take effect.Both temperature and top_p control the diversity of generated text. We recommend setting only one of them. For more information, see Overview.
  • qwen4-max: 1.0 in thinking mode, 0.7 in non-thinking mode.
  • qwen3.8-max/qwen3.8-flash (thinking mode): 0.6 for visual understanding, 1.0 for text input; temperature values below 0.6 are changed to 0.6 by default
  • Qwen3.8-Omni-Flash: 0.6 in thinking mode, 0.7 in non-thinking mode;
  • Qwen3.8 (non-thinking mode), Qwen3.7 (non-thinking mode), Qwen3.6 (non-thinking mode), Qwen3.5-Omni, Qwen3.5 (non-thinking mode), Qwen3 (non-thinking mode), Qwen3-Instruct series, Qwen3-Coder series, qwen-max series, qwen-plus series (non-thinking mode), qwen-flash series (non-thinking mode), Qwen open-source series, qwen-coder series, qwen-doc-turbo, Qwen3-VL (non-thinking): 0.7;
  • QVQ series: 0.5;
  • qwen-audio-turbo series: 0.00001;
  • qwen-vl series: 0.01;
  • qwen-math series: 0;
  • Qwen3.7 (thinking mode), Qwen3.6 (thinking mode), Qwen3.5 (thinking mode), Qwen3 (thinking mode), Qwen3-Thinking, Qwen3-Omni-Captioner, QwQ series: 0.6;
  • qwen-long series: 1.0;
  • qwen-plus-character: 0.92
  • qwen3-omni-flash series: 0.9
  • Qwen3-VL (thinking mode): 0.8
  • DeepSeek series (directly provided by Alibaba Cloud): deepseek-v4.1-flash, deepseek-v4-pro: 1.0; deepseek-r1-distill-qwen distilled version: 0.6;
  • DeepSeek series (directly provided by SiliconFlow): siliconflow/deepseek-v3.2, siliconflow/deepseek-v3.1-terminus, siliconflow/deepseek-r1-0528, siliconflow/deepseek-v3-0324: 1.0;
  • DeepSeek series (directly provided by Kuaishou Wanqing): vanchin/deepseek-v3.2-think (thinking mode): 0.6; vanchin/deepseek-v3.1-terminus: 0.7; vanchin/deepseek-v3.2-speciale, vanchin/deepseek-r1, vanchin/deepseek-v3, vanchin/deepseek-ocr: 1.0;
  • Kimi series (directly provided by Alibaba Cloud): kimi-k2.7-code, kimi-k2.6 (thinking mode), kimi-k2.5 (thinking mode): 1.0; kimi-k2.6 (non-thinking mode), kimi-k2.5 (non-thinking mode): 0.6;
  • Kimi series (directly provided by Moonshot AI): kimi/kimi-k3, kimi/kimi-k3.1-pro, kimi/kimi-k3.1-pro-highspeed, kimi/kimi-k2.7-code-highspeed, kimi/kimi-k2.7-code, kimi/kimi-k2.6 (thinking mode), kimi/kimi-k2.5 (thinking mode): 1.0; kimi/kimi-k2.6 (non-thinking mode), kimi/kimi-k2.5 (non-thinking mode): 0.6;
  • GLM series (directly provided by Alibaba Cloud): glm-5.1, glm-5: 1.0;
  • GLM series (directly provided by Zhipu): ZHIPU/GLM-5.1, ZHIPU/GLM-5: 0.6;
  • MiniMax series (directly provided by Alibaba Cloud): MiniMax-M2.5: 1.0;
  • MiniMax series (directly provided by Xiyu Technology): MiniMax/MiniMax-M3.1-Flash, MiniMax/MiniMax-M3, MiniMax/MiniMax-M2.7, MiniMax/MiniMax-M2.5, MiniMax/MiniMax-M2.1: 1.0.
  • MiMo series (directly provided by Xiaomi): mimo-v2.5-pro: 1.0, range [0, 1.5]; xiaomi/mimo-v2.6-pro-ultraspeed: 1.0, which cannot be customized; any other value passed in still takes effect as 1.0.
We do not recommend changing the default temperature value of QVQ models.
top_pfloat (Optional)The probability threshold for nucleus sampling, which controls the diversity of the text generated by the model.A higher top_p produces more diverse text, while a lower top_p produces more deterministic text.Value range: (0, 1.0]MiniMax/MiniMax-M3.1-Flash and MiniMax/MiniMax-M3 use a fixed value of 0.95, which cannot be customized; any other value does not take effect.Both temperature and top_p control the diversity of generated text. We recommend setting only one of them. For more information, see Overview.
  • qwen4-max: 0.95 in thinking mode, 0.8 in non-thinking mode.
The following models in non-thinking mode (qwen3.8-max, qwen3.8-max-0902, qwen3.8-flash, qwen3.8-2.4t-a95b, qwen3.8-27b), Qwen3.7 (non-thinking mode), Qwen3.6 (non-thinking mode), Qwen3.5-Omni, Qwen3.5 (non-thinking mode), Qwen3 (non-thinking mode), Qwen3-Instruct series, Qwen3-Coder series, qwen-max series, qwen-plus series (non-thinking mode), qwen-flash series (non-thinking mode), Qwen 2.5 open-source series, qwen-coder series, qwen-long, qwen-doc-turbo, Qwen3-VL (non-thinking): 0.8;Qwen3.8-Omni-Flash: 0.95 in thinking mode, 0.8 in non-thinking mode;QVQ series: 0.5;qwen-math series, Qwen3-Omni-Flash series: 1.0;The following models in thinking mode (qwen3.8-max, qwen3.8-max-0902, qwen3.8-flash, qwen3.8-2.4t-a95b, qwen3.8-27b), Qwen3.7 (thinking mode), Qwen3.6 (thinking mode), Qwen3.5 (thinking mode), Qwen3 (thinking mode), Qwen3-VL (thinking mode), Qwen3-Thinking, QwQ series, Qwen3-Omni-Captioner, qwen-plus-character: 0.95DeepSeek series (directly provided by Alibaba Cloud): deepseek-v4-pro, deepseek-r1-distill-qwen distilled version: 0.95;DeepSeek series (directly provided by SiliconFlow): siliconflow/deepseek-v3.2, siliconflow/deepseek-v3.1-terminus, siliconflow/deepseek-r1-0528, siliconflow/deepseek-v3-0324: 1.0;DeepSeek series (directly provided by Kuaishou Wanqing): vanchin/deepseek-v3.2-think, vanchin/deepseek-v3.1-terminus: 0.95; vanchin/deepseek-v3.2-speciale: 0.9; vanchin/deepseek-r1: 0.8; vanchin/deepseek-v3, vanchin/deepseek-ocr: 1.0;Kimi series (directly provided by Alibaba Cloud): kimi-k2.7-code, kimi-k2.6, kimi-k2.5: 0.95;Kimi series (directly provided by Moonshot AI): kimi/kimi-k3, kimi/kimi-k3.1-pro, kimi/kimi-k3.1-pro-highspeed, kimi/kimi-k2.7-code-highspeed, kimi/kimi-k2.7-code, kimi/kimi-k2.6, kimi/kimi-k2.5: 0.95;GLM series (directly provided by Alibaba Cloud): 0.95;GLM series (directly provided by ZHIPU): ZHIPU/GLM-5.1, ZHIPU/GLM-5: 0.95;MiniMax series (directly provided by Alibaba Cloud): MiniMax-M2.5: 0.95;MiniMax series (directly provided by Xiyu Technology): MiniMax/MiniMax-M3.1-Flash, MiniMax/MiniMax-M3: 0.95; MiniMax/MiniMax-M2.7, MiniMax/MiniMax-M2.5, MiniMax/MiniMax-M2.1: 0.9.MiMo series (directly provided by Xiaomi): xiaomi/mimo-v2.5-pro: 0.95, range [0.01, 1.0]; xiaomi/mimo-v2.6-pro-ultraspeed: 0.95, customization is not supported, and any other value passed in still takes effect as 0.95.
Modifying the default top_p value of QVQ models is not recommended.
top_kinteger (Optional)The number of candidate Tokens used for sampling during generation. The larger the value, the more random the output; the smaller the value, the more deterministic the output. If set to null or greater than 100, the top_k strategy is disabled and only the top_p strategy takes effect. The value must be an integer greater than or equal to 0.
QVQ series: 10;QwQ series: 40;qwen-math series, qwen-audio-turbo series: 1;Qwen3-Omni-Flash series: 50;All other models: 20.GLM series (directly provided by Alibaba Cloud): 20;The DeepSeek/Kimi/MiniMax series do not support the top_k parameter.
This parameter is not an OpenAI standard parameter. When calling through the Python SDK, put it in the extra_body object. The configuration method is: extra_body={"top_k":xxx}.
Modifying the default top_k value of QVQ models is not recommended.
repetition_penaltyfloat (Optional)The repetition degree in consecutive sequences during model generation. Increasing repetition_penalty can reduce the repetition degree of model-generated content, where 1.0 indicates no penalty. There is no strict value range; it only needs to be greater than 0.
  • qwen4-max, qwen3.8-max, qwen3.8-max-0902, qwen3.8-flash, qwen3.8-2.4t-a95b, qwen3.8-27b, qwen-max, qwen-math series, qwen-audio-turbo series, QVQ series, QwQ series, Qwen3-VL: 1.0;
  • qwen-coder series, qwen2-1.5b-instruct, qwen2-0.5b-instruct: 1.1;
  • Other models: 1.05.
  • GLM series (directly provided by Alibaba Cloud): 1.0;
  • Kimi series (directly provided by Moonshot AI): 0.0.
This parameter is not an OpenAI standard parameter. When calling through the Python SDK, put it in the extra_body object. The configuration method is: extra_body={"repetition_penalty":xxx}.
Modifying the default repetition_penalty value of QVQ models is not recommended.
frequency_penalty float (Optional)Supported on qwen4-max. Applies a penalty based on the number of times a Token has already appeared, to adjust the generation of repeated content.presence_penalty float (Optional)Controls the content repetition degree when the model generates text.Value range: [-2.0, 2.0]. Positive values reduce repetition; negative values increase repetition.In scenarios that require diversity, fun, or creativity, such as creative writing or brainstorming, it is recommended to increase this value; in scenarios that emphasize consistency and terminology accuracy, such as technical documentation or formal text, it is recommended to decrease this value.
The following models in non-thinking mode (qwen4-max, qwen3.8-max, qwen3.8-max-0902, qwen3.8-flash, qwen3.8-2.4t-a95b, qwen3.8-27b), Qwen3.7 (non-thinking mode), Qwen3.6 (non-thinking mode), Qwen3.5-Omni, Qwen3.5 (non-thinking mode), Qwen3 (non-thinking mode), Qwen3-Instruct series/1.7b/4b (thinking mode), QVQ series, qwen-max, qwen2.5-vl series, and Qwen3-VL (non-thinking mode): 1.5;Qwen3.8-Omni-Flash: 0.0 in thinking mode and 1.5 in non-thinking mode;qwen-plus/qwen-plus-latest/2025-04-28 (thinking mode), qwen-turbo-2025-04-28 (thinking mode): 0.5;All others default to 0.0.DeepSeek series (Alibaba Cloud direct supply): deepseek-r1-distill-qwen distilled version: 1;Kimi series (Alibaba Cloud direct supply): kimi-k2.7-code, kimi-k2.6, kimi-k2.5: 0.0;Kimi series (Moonshot AI direct supply): 0.0;MiniMax series (Alibaba Cloud direct supply): MiniMax-M2.5: 0.0;Other DeepSeek/Kimi/GLM/MiniMax models have no default value.
If the parameter value is a positive number, the model applies a penalty to tokens that already exist in the current text (the penalty is independent of the number of times the text appears), reducing the probability of these tokens appearing again. This reduces content repetition and increases word diversity.
Prompt: Translate this sentence into Chinese: "This movie is good. The plot is good, the acting is good, the music is good, and overall, the whole movie is just good. It is really good, in fact. The plot is so good, and the acting is so good, and the music is so good."Parameter value of 2.0: This movie is wonderful. The plot is engaging, the acting is superb, the music is delightful, and overall, the entire film is simply marvelous. In fact, it is truly outstanding. The storyline is brilliant, the performances are remarkable, and the soundtrack is enchanting.Parameter value of 0.0: This movie is good. The plot is good, the acting is good, the music is good, and overall, the whole movie is just good. It is really good, in fact. The plot is very good, and the acting is very good, and the music is very good.Parameter value of -2.0: This movie is good. The plot is good, the acting is good, the music is good, and overall, the whole movie is good. In fact, it is really good. The plot is really good, the acting is really good, and the music is really good.
It is not recommended to change the default presence_penalty value of QVQ models.
response_formatobject (optional) The default value is {"type": "text"}The format of the returned content. Valid values:
  • {"type": "text"}: Outputs a text response;
  • {"type": "json_object"}: Outputs a JSON string in standard format.
  • {"type": "json_schema", "json_schema": {...}}: Outputs a JSON string that strictly conforms to the specified JSON Schema, allowing precise control over the output structure and field types.
Related documentation: Structured output. json_object and json_schema support different models. See Supported models.
If you specify {"type": "json_object"}, you must explicitly instruct the model to output JSON in the prompt, for example, "Please output in JSON format"; otherwise an error will occur. If you specify {"type": "json_schema", ...}, the prompt does not need to include the JSON keyword.
typestring(Required)The format of the returned content. Valid values:
  • text: Outputs a text response;
  • json_object: Outputs a JSON string in standard format;
  • json_schema: Outputs a JSON string that strictly conforms to the structure defined by the json_schema field.
json_schemaobject (optional)Required when type is json_schema. It defines the JSON structure that the model output must follow. Related documentation: Obtain output in a specified format.
When calling through the parse method of the OpenAI SDK, you can directly pass in a Python Pydantic class or a Node.js Zod object, and the SDK automatically converts it to a JSON Schema, so you do not need to construct it manually.
namestring(Required)The name of the Schema.schemaobject(Required)The JSON Schema object that describes the output structure. Use properties to define the field structure, required to declare the list of required fields, and additionalProperties to control whether fields not defined in the Schema are allowed in the output (we recommend setting it to false, that is, outputting only the defined fields). Supported data types: string, number, integer, boolean, object, array, enum. Related documentation: Configuration guide.strictboolean (optional)Whether to strictly follow the structure defined by schema. We recommend setting it to true.
max_tokensinteger (optional, to be deprecated)
This parameter will be deprecated. For new integrations, use max_completion_tokens instead.
The meaning of this parameter varies by model, as follows:
  • qwen4-max, deepseek-v4.1-flash, deepseek-v4-pro, deepseek-v4-pro-0813, deepseek-v4-flash-0731: the maximum total number of tokens for the model response plus chain-of-thought content; max_tokens is equivalent to max_completion_tokens. When the model output exceeds this value, generation stops early and the returned finish_reason is length.
  • glm-5.3: max_tokens is the maximum total number of tokens for the model response plus chain-of-thought content. When the model output exceeds this value, generation stops early and the returned finish_reason is length. glm-5.3 ignores the thinking_budget parameter.
  • glm-5.2: When the thinking_budget parameter is not passed, max_tokens is the maximum total number of tokens for the model response plus chain-of-thought content; when the model output exceeds this value, generation stops early and the returned finish_reason is length. When the thinking_budget parameter is passed, max_tokens is only the maximum number of tokens for the model response, and the number of tokens for the chain-of-thought part is controlled separately by thinking_budget.
  • Other models: the maximum number of tokens for the model response (excluding the chain of thought). If the generated content exceeds this value, generation stops early and the returned finish_reason is length.
The default and maximum values of GLM models are shown in the table below. For other models, both the default and maximum values are the model's maximum output length.
Supply methodModelDefault valueMaximum value
Alibaba Cloud directglm-5.3, glm-5.2, glm-5.2-fast-preview, glm-5.1, glm-565536131072
ZHIPU directZHIPU/GLM-5.3, ZHIPU/GLM-5.3-Flash, ZHIPU/GLM-5.3-FlashX, ZHIPU/GLM-5.2, ZHIPU/GLM-5.1, ZHIPU/GLM-565536131072
max_completion_tokensinteger (optional)The maximum length of the model output, including the chain of thought and the model response. When the model output exceeds this value, generation stops early and the returned finish_reason is length.For the default and maximum values of GLM models, see the table under the max_tokens parameter. For other models, both the default and maximum values are the model's maximum output length.Differences from max_tokens: max_completion_tokens always limits the model's complete output (chain of thought + response); the specific limit scope of max_tokens varies depending on the model and the thinking_budget setting; see the descriptions above. For thinking models, we recommend using max_completion_tokens.The following models are supported:
  • Qwen Max: Qwen3.7-Max and later models
  • Qwen Plus: Qwen3.5-Plus and later models
  • Qwen Flash: Qwen3.5-Flash and later models
  • Kimi: kimi-k2.5 and later Kimi models
  • GLM: the Alibaba Cloud direct and ZHIPU direct models listed in the table above
  • MiniMax: MiniMax-M2.5 and later MiniMax models
  • DeepSeek: deepseek-v4-pro and later DeepSeek models
Apart from the ZHIPU-direct GLM models listed in the table above, the models above do not include other third-party direct-supply models.
There can be a difference of up to 10 tokens between the actual number of output tokens and the configured max_completion_tokens value.
vl_high_resolution_imagesboolean (optional) Default value: falseFor qwen4-max, even if vl_high_resolution_images=true, an explicitly passed max_pixels still takes effect.Whether to raise the pixel limit of input images to the pixel value corresponding to 16384 tokens. Related documentation: Processing high-resolution images.
  • vl_high_resolution_images:true: Uses a fixed resolution strategy, ignores the max_pixels setting, and scales down the total pixels of the image to within this upper limit when the resolution is exceeded.
    When vl_high_resolution_images is True, the pixel limit differs by model:
    • qwen3.8-flash, qwen3.8-omni-flash, Qwen3.7 series, Qwen3.6 series, Qwen3.5 series, and Qwen3-VL series models: 16777216 (each Token corresponds to 32*32 pixels, that is, 16384*32*32)
    • QVQ series and other Qwen2.5-VL series models: 12845056 (each Token corresponds to 28*28 pixels, that is, 16384*28*28)
  • When vl_high_resolution_images is false, the pixel limit is determined by max_pixels. If the pixels of an input image exceed max_pixels, the image is scaled down to within max_pixels. The default pixel limit of each model is the default value of max_pixels.
This parameter is not an OpenAI standard parameter. When calling through the Python SDK, put it in the extra_body object. The configuration method is: extra_body={"vl_high_resolution_images":xxx}.
ninteger (optional) Default value: 1The number of responses to generate. The value range is 1-4. This is useful for scenarios that require multiple candidate responses, such as creative writing or advertising copy.
n=0 is equivalent to n=1.
Only qwen4-max, Qwen3 (non-thinking mode), and qwen-plus-character support setting n to greater than 1. MiniMax/MiniMax-M3.1-Flash and MiniMax/MiniMax-M3 only support n=1. kimi/kimi-k3.1-pro and kimi/kimi-k3.1-pro-highspeed do not support this parameter.
If you pass the tools parameter, set n to 1.
Increasing n increases output Token consumption, but does not increase input Token consumption.
enable_thinking boolean (Optional)The default value for kimi-k3.1-pro (deployed on Alibaba Cloud Model Studio) is true. You can set it to false to disable thinking, but keeping it enabled is strongly recommended, as disabling it significantly affects output quality.Whether to enable thinking mode when using hybrid thinking models (which may or may not think before replying). Applicable to Qwen3.8, Qwen3.7, Qwen3.6, Qwen3.5, Qwen3, Qwen3.8-Omni-Flash, Qwen3-Omni-Flash, and Qwen3-VL models, as well as the DeepSeek-V4.1-Flash, DeepSeek-V4-Pro/V4-Flash series (Alibaba Cloud direct), DeepSeek-V3.2/V3.2-exp/V3.1 series (Alibaba Cloud direct, SiliconFlow direct, Kuaishou Wanqing direct), Kimi-K2.7-code (thinking-only model), Kimi-K2.6/K2.5 series (Alibaba Cloud direct, Moonshot direct), and GLM series. The DeepSeek-V4 series has thinking enabled by default, and you can adjust the reasoning effort via the reasoning_effort parameter.Valid values:
  • true: Enable
    When enabled, thinking content is returned via the reasoning_content field.
  • false: Do not enable
Default values for different models: Supported models
This parameter is not an OpenAI standard parameter. When calling via the Python SDK, put it in the extra_body object. Configuration: extra_body={"enable_thinking": xxx}.
If you do not use the OpenAI SDK and instead call directly via HTTP (such as curl), extra_body is not required. Simply place enable_thinking at the top level of the request body (body) like parameters such as model and messages, for example "enable_thinking": true.
MiniMax/MiniMax-M3.1-Flash and MiniMax/MiniMax-M3 supplied directly by Xiyu Technology do not use this parameter; use the thinking parameter instead.
thinking object (Optional) Default value: {"type":"adaptive"}Controls the thinking mode of MiniMax models supplied directly by Xiyu Technology.Possible values of thinking.type:
  • adaptive: Enable thinking. MiniMax/MiniMax-M3.1-Flash always uses this mode; MiniMax/MiniMax-M3 uses this mode by default.
  • disabled: Disable thinking, supported only by MiniMax/MiniMax-M3. Setting this value for MiniMax/MiniMax-M3.1-Flash returns a 400 error.
This parameter is not an OpenAI standard parameter. When calling via the Python SDK, put it in the extra_body object. Configuration: extra_body={"thinking": {"type": "adaptive"}}.
reasoning_split boolean (Optional)Controls where MiniMax thinking content is returned:
  • true: Returned separately via the reasoning_content field. MiniMax/MiniMax-M3.1-Flash supports only this value.
  • false: Returned in the content field with the <think> tag. Only MiniMax/MiniMax-M3 supports this value.
This parameter is not an OpenAI standard parameter. When calling via the Python SDK, put it in the extra_body object, for example extra_body={"reasoning_split": True}.thinking_display string (Optional)qwen4-max: "summarized". Chain-of-thought summary and encryption.By default, the full chain-of-thought is returned. After this feature is enabled, the original chain-of-thought is no longer returned in plaintext; instead, a summary and the full ciphertext are returned. The summary is for display, and the ciphertext is for restoring historical thinking.preserve_thinking boolean (Optional) Default value: falseWhether to concatenate the reasoning_content of assistant messages in the conversation history into the model input. Applicable to scenarios where the model needs to refer to the historical thinking process. Default value: true (qwen4-max).kimi-k3.1-pro and kimi-k3 (deployed on Alibaba Cloud Model Studio) retain the historical reasoning_content passed in by the client by default. It is recommended to pass back the full historical assistant messages and their reasoning_content in messages.kimi/kimi-k3.1-pro and kimi/kimi-k3.1-pro-highspeed support this parameter, and it is disabled by default.When the model needs to refer to the thinking from the previous turn, put it in the reasoning_content field of the historical assistant message and pass it back with messages. For usage, see Passing the thinking process.Currently supported: qwen4-max, qwen3.8-max, qwen3.8-max-0902, qwen3.8-flash (enabled by default), qwen3.8-omni-flash (enabled by default), qwen3.7-max, qwen3.7-max-2026-05-20 and later snapshots, qwen3.7-plus, qwen3.7-plus-2026-05-26, qwen3.6-plus, qwen3.6-plus-2026-04-02, qwen3.7-flash, qwen3.7-flash-2026-07-15, qwen3.6-flash, qwen3.6-flash-2026-04-16, kimi-k2.6 (deployed on Alibaba Cloud Model Studio), kimi-k2.7-code (deployed on Alibaba Cloud Model Studio, enabled by default), kimi/kimi-k2.7-code-highspeed (Moonshot direct, enabled by default), and kimi/kimi-k2.7-code (Moonshot direct, enabled by default).
Important: When using qwen4-max, qwen3.8-max/qwen3.8-flash, preserve_thinking defaults to true, and you must pass back all reasoning_content from the history conversation in full. Concatenating reasoning_content into the content field and passing it back is not supported.
  • For the models above that support this parameter — qwen4-max, qwen3.8-max, qwen3.8-max-0902, qwen3.8-flash, Qwen3.7, Qwen3.6, and Kimi models — if the history messages do not contain reasoning_content, enabling this parameter will not return an error.
  • After it is enabled, the reasoning_content in the history conversation counts toward the input token count and is billed.
This parameter is not an OpenAI standard parameter. When calling through the Python SDK, put it into the extra_body object. The configuration method is: extra_body={"preserve_thinking": True}.
thinking_budget integer (optional)The maximum number of tokens for the thinking process. Applicable to qwen4-max, qwen3.8-max, qwen3.8-max-0902, qwen3.8-flash, qwen3.8-2.4t-a95b, qwen3.8-27b, as well as the Qwen3.7, Qwen3.6, Qwen3.5, Qwen3-VL, Qwen3, GLM (Alibaba Cloud direct), and Kimi (Alibaba Cloud direct) series models, among which kimi-k3.1-pro and kimi-k3 do not support this parameter. For more information, see Limit thinking length. Default value: 131072 (qwen4-max).Other models: The default value for the above models is the maximum chain-of-thought length of the model. For more information, see: Models
This parameter is not an OpenAI standard parameter. When calling through the Python SDK, put it into the extra_body object. The configuration method is: extra_body={"thinking_budget": xxx}.
use_multichannel boolean (optional)Controls whether to parse spatial information in multichannel audio. Applicable to audio input of qwen3.8-omni-flash, defaults to false, and all audio is parsed as mono. When set to true and the input is two-channel (left and right) or four-channel (FOA, WYZX order) audio, spatial audio information is parsed. In HTTP requests, place it at the top level of the request body; when using the OpenAI Python SDK, pass it via extra_body={"use_multichannel": True}.reasoning_effort string (optional)qwen4-maxDefault value: reasoning_effort=high.
reasoning_effortActual level
minimal, lowlow
medium, highhigh
xhigh, maxxhigh
noneDisables thinking
qwen4-max does not support setting both reasoning_effort and thinking_budget. thinking_budget must be a positive integer and cannot be set to 0.When only thinking_budget is set, the thinking level is determined according to the following table, and the passed-in budget value is retained.
thinking_budgetActual level
1–4096low
4097–131072high
131073–262144xhigh
When neither is set, high and 131072 are used.Controls the model's reasoning effort level; different models support different optional values and default values.kimi-k3.1-pro (deployed on Alibaba Cloud Model Studio) (default value is max)
  • max (default): deep reasoning
  • high: enhanced reasoning
  • medium: moderate reasoning
  • low: light reasoning
MiniMax/MiniMax-M3.1-Flash (default value is max)The optional values, from the lowest to the highest reasoning effort, are low, medium, high, xhigh, and max. The model always has thinking enabled; setting none returns a 400 error.DeepSeek-V4, GLM series (default value is high)Valid values:
  • high: high-effort reasoning
  • max: maximum-effort reasoning
low and medium are mapped to high, and xhigh is mapped to max.Applicable to glm-5.2, glm-5.1, glm-5, deepseek-v4-pro (Alibaba Cloud direct)kimi/kimi-k3, kimi/kimi-k3.1-pro, kimi/kimi-k3.1-pro-highspeed (Moonshot AI direct) (default value is max, only max is supported)Valid values:
  • max: maximum-effort reasoning
glm-5.3, ZHIPU/GLM-5.3, ZHIPU/GLM-5.3-Flash, ZHIPU/GLM-5.3-FlashX, and kimi-k3 (Alibaba Cloud direct) models: default value ismaxValid values:
  • max (default): deep reasoning
  • high: enhanced reasoning
  • low: light reasoning
The glm-5.3 series models always have thinking enabled. enable_thinking only supports true; passing false will cause the API request to fail. kimi-k3 supports passing false to disable thinking.For the deepseek-v4-flash-0731 and deepseek-v4-pro-0813 models: the default value ishighValid values:
  • max: maximum-effort reasoning
  • high (default): high-effort reasoning
  • low: low-effort reasoning
For compatibility, medium is mapped to high, and xhigh is mapped to high.For the deepseek-v4.1-flash model: the default value ishighValid values:
  • max: maximum-effort reasoning
  • high (default): high-effort reasoning
  • low: low-effort reasoning
minimal is mapped to low, medium and xhigh are mapped to high, and ultra is mapped to max.qwen3.8-max, qwen3.8-max-0902, qwen3.8-flash, qwen3.8-2.4t-a95b, qwen3.8-27b: the default value isxhighValid values:
  • xhigh (default): high-effort reasoning
  • medium: medium-effort reasoning
  • low: low-effort reasoning
max is mapped to xhigh, high is mapped to xhigh, minimal is mapped to low, and none is mapped to enable_thinking=False.
Setting a value other than the above valid values and mapped values will cause an error.
Important:qwen3.8-max, qwen3.8-max-0902, qwen3.8-flash, qwen3.8-2.4t-a95b, and qwen3.8-27b do not support setting reasoning_effort and thinking_budget at the same time; setting both will cause an error. However, the two can be converted to each other:
  • When thinking_budget is not set, the reasoning_effort level is automatically mapped to thinking_budget: low corresponds to 4096, medium to 16384, and xhigh to 262144.
  • When reasoning_effort is not set, thinking_budget is automatically mapped back to reasoning_effort: 0~4096 corresponds to low, 4097~16384 to medium, and 16385~262144 to xhigh.
  • When neither is set, the default thinking_budget (131072) and the default reasoning_effort (xhigh) are used.
Qwen3.8-Omni-Flashqwen3.8-omni-flash has thinking enabled by default, and reasoning_effort defaults to xhigh. The reasoning_effort of Chat Completions accepts none, minimal, low, medium, high, xhigh, and max, and cannot be set together with thinking_budget. For the parameter location and examples, see Qwen3.8 Omni.You can directly choose from three thinking effort levels: low, medium, and xhigh. Among the compatible values, minimal is mapped to low, high and max are mapped to xhigh, and none means disabling thinking.tool_stream boolean (optional) The default value is falseOnly effective when stream=true. Currently only supported by the Qwen and GLM series.Qwen series support list:
  • qwen-max series: qwen4-max, and the text modality of the qwen3.8-max and qwen3.7-max series
  • qwen-plus series: the text modality of the qwen3.7-plus and qwen3.6-plus series, as well as the omni modality of the qwen3.5-plus series
  • qwen-flash series: the omni modality of the qwen3.8-flash, qwen3.7-flash, qwen3.6-flash, and qwen3.5-flash series
Qwen series usage reference:tool_stream only affects the case of complex tool parameters. Ordinary tool parameters are streamed as long as stream=true is enabled. Complex tools refer to tools whose definitions contain parameters of the array or object type.
  • tool_stream=false: complex tool parameters are output all at once; this is the default behavior, and the complex format is more accurate.
  • tool_stream=true: complex tool parameters are streamed, with no timeout risk for the complex format.
GLM series support list: glm-5 and glm-5.1 (directly provided by Alibaba Cloud).GLM series usage reference:
  • tool_stream=false: tool parameters are output all at once; this is the default behavior, and the complex format is more accurate.
  • tool_stream=true: tool parameters are streamed, with no timeout risk for the complex format.
This parameter is not an OpenAI standard parameter. When calling through the Python SDK, put it into the extra_body object. The configuration is: extra_body={"tool_stream": true}.
enable_code_interpreter boolean (optional) The default value is falseWhether to enable the code interpreter feature. Related documentation: Code interpreterValid values:
  • true: Enable
  • false: Do not enable
This parameter is not an OpenAI standard parameter. When calling through the Python SDK, put it into the extra_body object. The configuration is: extra_body={"enable_code_interpreter": xxx}.
seedinteger (optional)Random seed. Used to ensure that generation results are reproducible under the same input and parameters. If the same seed is passed in the call and other parameters remain unchanged, the model will return the same result as much as possible.Value range: [0,2 31 −1].
The default value for all other models is 1234.
logprobs boolean (Optional) Default value: falseWhether to return the log probabilities of output tokens. Valid values:
  • true Return
  • false Do not return
Content generated during the thinking phase (reasoning_content) does not return log probabilities.
  • Snapshot models in the qwen-plus series (excluding stable models)
  • Models in the qwen3-vl-plus series (including stable models)
  • Qwen3 open-source models
  • qwen4-max
top_logprobs integer (Optional) Default value: 0Specifies the number of candidate tokens with the highest model probabilities to return at each generation step.Value range: [0,5]Only effective when logprobs is true.stopstring or array(Optional)Used to specify stop words. When the string or token_id specified by stop appears in the text generated by the model, generation will stop immediately.
MiniMax/MiniMax-M3.1-Flash does not support this parameter. The output will not be truncated at the specified stop words; the request may still succeed and return finish_reason: "stop", but this does not mean the specified stop words have taken effect.
You can pass in sensitive words to control the model's output.
When stop is an array, token_id and strings cannot be used as elements at the same time; for example, you cannot specify ["hello",104307].
toolsarray(Optional)An array containing one or more tool objects for the model to call in Function Calling. Related documentation: Function CallingWhen tools is set and the model determines that a tool needs to be called, the response returns tool information via tool_calls.
typestring(Required)The tool type. Currently, only function is supported.functionobject(Required)
namestring(Required)The tool name. Only letters, digits, underscores (_), and hyphens (-) are allowed, with a maximum of 64 tokens.descriptionstring(Required)The tool description, which helps the model determine when and how to call the tool.parametersobject (Optional) Default value: {}The parameter description of the tool, which must be a valid JSON Schema. For a description of JSON Schema, see link. If the parameters parameter is empty, it means the tool has no input parameters (for example, a time query tool).
To improve the accuracy of tool calling, we recommend passing in parameters.
tool_choice string or object (optional) Default value: autoThe tool selection policy. If you need to force a specific tool calling behavior for certain types of questions (for example, always using a specific tool or disabling all tools), you can set this parameter.
MiniMax/MiniMax-M3.1-Flash only supports auto. Other values such as none, required, or a specified function name may cause errors or not take effect; specifying a function name does not guarantee that the model will call the function.
deepseek-v4.1-flash-1017 supports setting tool_choice to auto, none, required, or a specified function name.Valid values:
  • auto The model autonomously selects the tool strategy.
  • none If you do not want tool calling to be performed, set the tool_choice parameter to none;
  • required If you want to force at least one tool to be called, set the tool_choice parameter to required, and the model will always return tool call information.
    Qwen series models do not currently support required: in non-thinking mode, tool calling cannot be guaranteed, and in thinking mode, required is not currently supported.
  • {"type": "function", "function": {"name": "the_function_to_call"}} If you want to force a specific tool to be called, set the tool_choice parameter to {"type": "function", "function": {"name": "the_function_to_call"}}, where the_function_to_call is the specified tool function name.
    Models in thinking mode do not support forcing a specific tool to be called.
parallel_tool_calls boolean (optional) Default value: trueWhether to enable parallel tool calls. For more information, see Parallel tool calls
MiniMax/MiniMax-M3.1-Flash and kimi-k3 do not support controlling the parallelism of tool calls through this parameter. Setting it to false does not guarantee serial calling; the model may still return multiple tool_calls in a single round. Process the results based on the actual returned responses.
kimi/kimi-k3.1-pro and kimi/kimi-k3.1-pro-highspeed do not support this parameter.
Valid values:
  • true: Enable
  • false: Do not enable
enable_search boolean (optional) Default value: falseWhether to enable web search. This parameter is supported by kimi-k3.1-pro (deployed on Alibaba Cloud Model Studio) and is available in Beijing, Singapore, United States (Virginia), Germany (Frankfurt), Japan (Tokyo), and Hong Kong (China). For more information, see Web searchValid values:
  • true: Enabled;
    If web search is not performed after it is enabled, you can optimize the prompt, or set the forced_search parameter in search_options to enable forced search.
  • false: Disabled.
Enabling the web search feature may increase token consumption.
This parameter is not an OpenAI standard parameter. When calling through the Python SDK, put it in the extra_body object. The configuration is: extra_body={"enable_search": True}.
search_optionsobject (optional)The web search policy. For more information, see Web search
forced_search boolean (optional) Default value: falseWhether to force web search. This parameter only takes effect when enable_search is true.Valid values:
  • true: Force enable;
  • false: Do not force enable; the model decides whether to perform web search.
search_strategy string (optional) Default value: turboThe search scale strategy, which only takes effect when enable_search is true.When web search is enabled for qwen3.8-omni-flash, you must set this parameter to agent.Valid values:
  • turbo (default): Balances response speed and search quality, suitable for most scenarios.
  • max: Uses a more comprehensive search strategy and can call multiple search engines to obtain more detailed search results, but the response time may be longer.
  • agent: Can call the web search tool and the model multiple times to perform multi-round information retrieval and content integration.
    This policy applies only to qwen3.5-plus, qwen3.5-plus-2026-02-15, qwen3.5-flash, qwen3.5-flash-2026-02-23, qwen3.8-omni-flash, qwen3.5-omni-plus, qwen3.5-omni-plus-2026-03-15, qwen3.5-omni-flash, and qwen3.5-omni-flash-2026-03-15. enable_search_extension boolean (Optional) The default value is false
Whether to enable vertical search. It takes effect only when enable_search is true.Valid values:
  • true: Enable.
  • false: Do not enable.
This parameter is not an OpenAI standard parameter. When calling through the Python SDK, put it in the extra_body object. Configure it as: extra_body={"search_options": xxx}.
include_tool_usage boolean (Optional) The default value is falseWhether to return the statistics of web search calls in the usage of the response.Valid values:
  • true: Return the x_tools field in usage.
  • false: Do not return it.
x_tools is returned only when this request actually triggers a web search. If enable_search is not enabled, or the model determines that no web search is needed, this field will not be returned even if this parameter is set to true.
This parameter is not an OpenAI standard parameter. When calling through the Python SDK, put it in the extra_body object. Configure it as: extra_body={"include_tool_usage": True}.
X-DashScope-DataInspectionstring (Optional)Based on the content security capabilities of the Qwen API, whether to further identify violating information in input and output content. Valid values:
  • '{"input":"cip","output":"cip"}': Further identification;
  • Not setting this parameter: No further identification.
When calling via HTTP, put it in the request header: -H "X-DashScope-DataInspection: {\"input\": \"cip\", \"output\": \"cip\"}";When calling through the Python SDK, configure it via extra_headers: extra_headers={'X-DashScope-DataInspection': '{"input":"cip","output":"cip"}'}.For detailed usage, see Input and output AI guardrails; if you do not want to modify the calling code, you can enable the guardrail via the workspace-level switch.
Not supported when configured through the Node.js SDK.
skillarray (Optional)The skill parameter, used to enable specific generation skills (such as PPT generation). Only the qwen-doc-turbo model supports it. For detailed usage, see Generate a PPT.
This parameter is not an OpenAI standard parameter. When calling through the Python SDK, put it in the extra_body object. Configure it as: extra_body={"skill": [...]}.
When using skill, stream must be set to true.
typestring(Required)The skill type. Currently supported:
  • ppt: PPT generation.
modestring (Optional)The PPT generation mode. Valid values:
  • general (default): Template mode, which requires template_id and generates PPTs in HTML format.
  • creative : Creative mode, which requires no template and generates image-based PPTs (each page is an image).
template_idstring (Optional)The PPT template ID. Used together when mode is general or mode is not set. Valid values:
  • news_01: News template
  • summary_01: Summary template
  • internet_01: Internet template
  • thesis_01: Thesis template
clear_thinkingboolean (Optional) The default value is false.Controls whether the reasoning_content (thinking process) of historical turns is included as context input to the model in multi-turn conversations. Only the GLM series glm-5.3, glm-5.2, glm-5.1, and glm-5 models support this parameter. The default value is true for glm-5.3, and false for the other models.
This parameter is not an OpenAI standard parameter. When calling via the Python SDK, place it in the extra_body object. The configuration method is: extra_body={"enable_thinking": True,"clear_thinking": True}.
  • true: Ignore the reasoning_content of historical turns and use only non-reasoning content such as visible text, tool calls, and results as context input, which can reduce context length and cost.
  • false (default): Retain the reasoning_content of historical turns and provide it to the model along with the context. If you want to enable Preserved Thinking, you must pass the historical reasoning_content in messages completely, unmodified, and in the original order; missing, truncated, rewritten, or reordered content will degrade the effect or cause it to fail.
  • Text input
  • Streaming output
  • Image input
  • Video input
  • Tool calling
  • Asynchronous Call
  • Document understanding
  • PPT generation
Python
import os
from openai import OpenAI

client = OpenAI(
    # If the environment variable is not configured, replace the next line with your Model Studio API key: api_key="sk-xxx"
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    base_url="https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
)

completion = client.chat.completions.create(
    # Model list: https://www.alibabacloud.com/help/en/model-studio/getting-started/models
    model="qwen4-max",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Who are you?"},
    ]
)
print(completion.model_dump_json())

chat response object (Non-Stream)

idstringThe unique identifier of this call.choicesarrayAn array of content generated by the model.
finish_reasonstringThe reason the model stopped generating.There are three cases:
  • stop when the stop parameter in the input parameters is triggered, or when output stops naturally;
  • length when generation ends due to excessive length;
  • tool_calls when generation ends because a tool needs to be called.
indexintegerThe index of the current object in the choices array.logprobsobjectThe token probability information output by the model.
content arrayAn array containing each token and its log probability.
token stringThe text of the current Token.bytes arrayThe list of raw UTF-8 bytes of the current Token, used to precisely reconstruct the output content (for example, emoji or Chinese characters).logprob floatThe log probability of the current Token. A return value of null indicates an extremely low probability.top_logprobs arrayThe most likely candidate Tokens at the current Token position, with the count matching the request parameter top_logprobs. Each element contains:
token stringThe candidate Token text.bytes arrayThe list of raw UTF-8 bytes of the current Token, used to precisely reconstruct the output content (for example, emoji or Chinese characters).logprob floatThe log probability of this candidate Token. A return value of null indicates an extremely low probability.
messageobjectThe message generated by the model.
content stringThe reply content of the model.encrypted_content stringqwen4-max, thinking_display="summarized": The enable parameter must be passed in every turn. The client can only return the ciphertext as-is; it cannot read, truncate, re-encode, modify, or concatenate ciphertext across multiple turns. The summary cannot replace the historical chain-of-thought. For more information, see Chain-of-thought summary and encryption.reasoning_content stringThe chain-of-thought content of the model.refusal stringThis parameter is currently fixed to null.role stringThe role of the message, fixed to assistant.audio objectThis parameter is currently fixed to null.function_call (to be deprecated) objectThis value is fixed to null. See the tool_calls parameter.tool_calls arrayThe tool and input parameter information generated by the model after Function Calling is initiated.
id stringThe unique identifier of this tool response.type stringThe tool type. Currently only function is supported.function objectTool Information.
name stringTool name.arguments stringThe input parameter information, as a string in JSON format.
Due to the inherent randomness of large model responses, the output parameter information may not conform to the function signature. Please validate the parameters before calling
index integerThe index of the current tool in the tool_calls array.
createdintegerThe Unix timestamp (in seconds) when the request was created.modelstringThe model used for this request.object stringAlways chat.completion.service_tier stringIt is null for pay-as-you-go calls; when calling with a throughput-reserved dedicated model code, the performance tier is returned (ptu_default / ptu_fast). For more information, see Throughput reservation overview.system_fingerprintstringThis parameter is currently fixed to null.usage objectThe Token consumption information for this request.
completion_tokens integerThe number of Tokens generated by the model.prompt_tokens integerThe number of input Tokens. Additional notestotal_tokens integerThe total number of Tokens consumed, which is the sum of prompt_tokens and completion_tokens.completion_tokens_details object (optional)The fine-grained breakdown of output Tokens. Some models return this field. text_tokens includes reasoning_tokens—reasoning_tokens is the subset of text_tokens corresponding to the thinking process, and only text_tokens minus reasoning_tokens gives the number of Tokens in the final visible reply. This field is usually returned only when the model outputs a thinking process; when thinking is not enabled, it may be null or not returned.
audio_tokens integer (Optional)Number of audio tokens in the output.reasoning_tokens integer (Optional)Number of thinking process tokens, which is a subset of text_tokens.text_tokens integer (Optional)Number of output text tokens, which already includes reasoning_tokens.
prompt_tokens_details objectFine-grained classification of input tokens.
audio_tokens integerThis parameter is currently fixed to null.cached_tokens integerNumber of cache hit tokens. For more information about Context Cache, see Context Cache.text_tokens integerNumber of input text tokens.image_tokens integerNumber of input image tokens.video_tokens integerNumber of tokens for input video files or image lists.cache_creation objectInformation about Explicit Cache creation.
ephemeral_5m_input_tokens integerNumber of tokens used to create the explicit cache.
cache_creation_input_tokens integerNumber of tokens used to create the explicit cache.cache_type stringWhen Explicit Cache is used, the parameter value is ephemeral; otherwise, this parameter does not exist.
For more information, see Explicit Cache (Qwen4).cached_tokens integerNumber of cache hit tokens. For more information about Context Cache, see Context Cache.text_tokens integerNumber of input text tokens.image_tokens integerNumber of input image tokens.video_tokens integerNumber of tokens for input video files or image lists.cache_write_tokens integerNumber of input tokens for cache creation.cache_creation_input_tokens integerSame as cache_write_tokens; do not count them twice when aggregating statistics.cache_type stringephemeralcache_creation objectCache creation details broken down by TTL. The sum of the token counts of the two TTLs equals the number of tokens used to create the cache in this request.
ephemeral_5m_input_tokens integerNumber of tokens for 5-minute cache creation.ephemeral_1h_input_tokens integerNumber of tokens for 1-hour cache creation.
x_tools object (Optional)Usage statistics of web search. Returned only when include_tool_usage is true in the request and web search is actually triggered in this request.
search object (Optional)Usage statistics of web search. Returned when web search is enabled and retrieval is actually triggered.
count integerNumber of times web search was triggered in this request. When the agent search strategy is used, the model can perform multiple rounds of retrieval, so this value may be greater than 1.This value is set at the intent determination stage; it is counted even if rate limiting is triggered or retrieval returns no results. It does not indicate that retrieval has actually completed, and should not be used as a basis for billing or reconciliation. For more information, see Inconsistency between bill count and count field.strategy stringThe search strategy actually used for this web search, consistent with the value of search_options.search_strategy in the request, such as turbo, max, and agent.
  • Text input
  • Image input
  • Video input
  • Tool calling
  • Web search
  • Asynchronous Call
The following is a response example of qwen3.8-max, used to illustrate the response fields.
{
    "id": "chatcmpl-ad786040-102b-97f8-a6d8-d0ef7895f01c",
    "object": "chat.completion",
    "created": 1794384851,
    "model": "qwen3.8-max",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "reasoning_content": "The user asks who I am, so I should introduce myself. According to the system prompt, I am Qwen, developed by Alibaba Group's Tongyi Lab. The response should be concise and natural, without revealing internal instructions or mentioning a version number. I can describe my capabilities and purpose in a friendly tone.",
                "content": "I am Qwen, a large language model developed by Alibaba Group's Tongyi Lab.  \nI can help answer questions, improve writing, write code, reason through problems, and organize information. I can also chat, brainstorm, or help you study.  \nIf you like, you can tell me…"
            },
            "finish_reason": "stop",
            "logprobs": null
        }
    ],
    "usage": {
        "prompt_tokens": 61,
        "total_tokens": 177,
        "completion_tokens": 116,
        "prompt_tokens_details": {
            "cached_tokens": 0,
            "text_tokens": 61
        },
        "completion_tokens_details": {
            "reasoning_tokens": 52,
            "text_tokens": 116
        }
    }
}

chat response chunk object (streaming output)

idstringThe unique identifier of this call. Each chunk object has the same id.choicesarrayAn array of content generated by the model, which can contain one or more objects. In the last chunk used to return Token usage information, choices is an empty array.
delta objectThe incremental object of the request.
content stringIncremental message content.encrypted_content stringqwen4-max, thinking_display="summarized": The enable parameters must be passed in every turn. The client can only return the ciphertext as-is, and must not read, truncate, re-encode, modify, or concatenate ciphertext across multiple turns. The summary cannot replace the historical chain-of-thought. Chain-of-thought summary and encryption. The ciphertext is returned in an independent data frame and must not be concatenated with other frames or multi-turn ciphertext.reasoning_content stringIncremental chain-of-thought content.function_call objectThis value defaults to null. For more information, see the tool_calls parameter.audioobjectThe response generated when using the Qwen-Omni model.
data stringIncremental Base64-encoded audio data.expires_at integerThe timestamp when the request was created.
refusal objectThis parameter is currently fixed to null.role stringThe role of the incremental message object, which has a value only in the first chunk.tool_calls arrayThe tool and input parameter information generated by the model after Function Calling is initiated.
index integerThe index of the current tool in the tool_calls array.id stringThe unique identifier of this tool response.function objectInformation about the tool being called.
arguments stringIncremental input parameter information. The arguments of all chunks, when concatenated, form the complete input parameters.
Since large model responses involve a degree of randomness, the output input parameter information may not conform to the function signature. Validate the parameter validity before calling.
name stringThe tool name, which has a value only in the first chunk.
type stringThe tool type. Currently only function is supported.
finish_reason stringThe reason why the model stopped generating. There are four cases:
  • stop when the stop parameter in the input parameters is triggered, or when output stops naturally;
  • null when generation is not yet finished;
  • length when generation ends because the length is too long;
  • tool_calls when generation ends because a tool needs to be called.
index integerThe index of the current response in the choices array. When the input parameter n is greater than 1, use this parameter to assemble the complete content corresponding to each different response.logprobsobjectThe probability information of the current object.
content arrayA token array with log probability information.
token stringThe current token.bytes arrayThe list of raw UTF-8 bytes of the current token, used to accurately reconstruct the output content. It is helpful when processing emojis and Chinese characters.logprob floatThe log probability of the current token. A return value of null indicates an extremely low probability.top_logprobs arrayThe most likely tokens at the current token position and their log probabilities. The number of elements is consistent with the input parameter top_logprobs.
token stringThe current token.bytes arrayThe list of raw UTF-8 bytes of the current token, used to accurately reconstruct the output content. It is helpful when processing emojis and Chinese characters.logprob floatThe log probability of the current token. A return value of null indicates an extremely low probability.
createdintegerThe timestamp when this request was created. Each chunk has the same timestamp.modelstringThe model used for this request.object stringAlways chat.completion.chunk.service_tier stringThis parameter is currently fixed to null.system_fingerprintstringThis parameter is currently fixed to null.usage objectThe tokens consumed by this request. Returned in the last chunk.
completion_tokens integerThe number of Tokens generated by the model.prompt_tokens integerThe number of input tokens.total_tokens integerThe total number of tokens, which is the sum of prompt_tokens and completion_tokens.completion_tokens_details object (optional)Details of output tokens. Some models return this field. Among them, text_tokens includes reasoning_tokens—reasoning_tokens is a subset of text_tokens corresponding to the thinking process, and text_tokens minus reasoning_tokens is the number of tokens in the final visible response. This field is usually returned only when the model outputs a thinking process; when thinking is not enabled, it may be null or not returned.
audio_tokensinteger (optional)Number of audio tokens in the output.reasoning_tokens integer (Optional)Number of thinking process tokens, which is a subset of text_tokens.text_tokensinteger (optional)The number of output text tokens, which already includes reasoning_tokens.
prompt_tokens_details objectFine-grained classification of input tokens.
audio_tokens integerThe number of tokens of the input audio.
The number of audio tokens in video files is returned via this parameter.
text_tokens integerThe number of tokens of the input text.video_tokens integerThe number of tokens of the input video (as a list of images or as a video file).image_tokens integerThe number of tokens of the input image.cached_tokens integerThe number of tokens that hit the cache. For more information about Context Cache, see context cache.cache_creation objectInformation about Explicit Cache creation.
ephemeral_5m_input_tokens integerNumber of tokens used to create the explicit cache.
cache_creation_input_tokens integerNumber of tokens used to create the explicit cache.cache_type stringThe cache type, fixed as ephemeral.
For more information, see Explicit Cache (Qwen4).text_tokens integerThe number of tokens of the input text.video_tokens integerThe number of tokens of the input video (as a list of images or as a video file).image_tokens integerThe number of tokens of the input image.cached_tokens integerThe number of tokens that hit the cache. For more information about Context Cache, see context cache.cache_write_tokens integerNumber of input tokens for cache creation.cache_creation_input_tokens integerSame as cache_write_tokens; do not count them twice when aggregating statistics.cache_type stringephemeralcache_creation objectCache creation details broken down by TTL. The sum of the token counts of the two TTLs equals the number of tokens used to create the cache in this request.
ephemeral_5m_input_tokens integerNumber of tokens for 5-minute cache creation.ephemeral_1h_input_tokens integerNumber of tokens for 1-hour cache creation.
x_tools object (Optional)The call statistics of web search. Returned only when include_tool_usage is true in the request and this request actually triggers web search, and displayed with usage in the last chunk.
search object (Optional)Usage statistics of web search. Returned when web search is enabled and retrieval is actually triggered.
count integerNumber of times web search was triggered in this request. When the agent search strategy is used, the model can perform multiple rounds of retrieval, so this value may be greater than 1.This value is set at the intent determination stage; it is counted even if rate limiting is triggered or retrieval returns no results. It does not indicate that retrieval has actually completed, and should not be used as a basis for billing or reconciliation. For more information, see Inconsistency between bill count and count field.strategy stringThe search strategy actually used for this web search, consistent with the value of search_options.search_strategy in the request, such as turbo, max, and agent.
  • Streaming output
  • Document understanding
  • PPT generation
  • Web search
The streaming response of curl uses the SSE format: each event starts with data:, events are separated by blank lines, and the stream ends with data: [DONE]. The following omits repeated intermediate chunks and keeps the role, thinking, body, end, and usage events; the SDK parses SSE and does not output data: and [DONE].
The following is a response example of qwen3.8-max, used to illustrate the response fields.

Error codes

If the model call fails and returns an error message, see error codes for troubleshooting.