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)
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{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.
Request bodymodelstring(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.messages array(Required)The context passed to the large language model, arranged in conversation order.
Message type System Message object(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.
Properties content string(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 .object(Required)The user message, used to pass questions, instructions, or context to the model.
Properties content string 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.
Properties for multimodal models or when explicit cache is enabled type string(Required)Valid values:
stringThe input text. Required when type is text.image_urlobjectThe input image information. Required when type is image_url.
Properties 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:
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.objectThe input audio information. Required when type is input_audio.
Properties 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.arrayFor 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:objectThe 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.
Properties 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.float (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.
Functionality fps has two functions:
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.
Example value
integer (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.
Value range
Example value
integer (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.
Value range
Example value
integer (Optional)The total pixel budget after video frame extraction.
Maximum value
Example value
object (Optional)Only qwen4-max is supported. Specifies the end position of the cache prefix. For more information, see Explicit Cache (Qwen4).
Properties mode string (Required)Only explicit is supported; it must be explicitly passed when setting a breakpoint.object (Optional)Used to enable explicit cache. Related documentation: Explicit Cache.
Properties type string (Required)Only ephemeral is supported.
Properties (Qwen4) 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.string(Required)The role of the user message, fixed as user.object (Optional)The model's reply. Typically passed back to the model as context in multi-turn conversations.
Properties content string (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:
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.
Properties 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.
Properties name string (Required)Tool name.arguments string (Required)The input parameter information, as a string in JSON format.integer (Required)The index of the current tool information in the tool_calls array.object (Optional)The output information of the tool.
Properties content string(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.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).
Properties 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.boolean (Optional) Default value is falseWhether to respond in streaming output mode. Related documentation: Streaming outputValid values:
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. object (Optional)Only used for streaming requests where stream is true. Do not pass stream_options in non-streaming requests.
Properties include_usage boolean (Optional)During streaming output, the last data chunk contains usage, and the choices of that chunk is an empty array.array(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:
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)
Properties voice string (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.float (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.
Default value of temperature
We do not recommend changing the default temperature value of QVQ models.top_p float (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.
Default value of top_p
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_k integer (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.
top_k default value 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_penalty float (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.
repetition_penalty default value
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.
presence_penalty default 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.
How it works 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.
Examples 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_format object (optional) The default value is {"type": "text"}The format of the returned content. Valid values:
Related documentation: Structured output. If you specify
Properties type string(Required)The format of the returned content. Valid values:
object (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
Properties name string(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.integer (optional, to be deprecated)
This parameter will be deprecated. For new integrations, use The meaning of this parameter varies by model, as follows:
integer (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:
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 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.
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}.n integer (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.
Only If you pass the 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:
This parameter is not an OpenAI standard parameter. When calling via the Python SDK, put it in the extra_body object. Configuration: If you do not use the OpenAI SDK and instead call directly via HTTP (such as curl),
MiniMax/MiniMax-M3.1-Flash and MiniMax/MiniMax-M3 supplied directly by Xiyu Technology do not use this parameter; use the thinking object (Optional) Default value: {"type":"adaptive"}Controls the thinking mode of MiniMax models supplied directly by Xiyu Technology.Possible values of thinking.type:
This parameter is not an OpenAI standard parameter. When calling via the Python SDK, put it in the extra_body object. Configuration: reasoning_split boolean (Optional)Controls where MiniMax thinking content is returned:
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.
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: 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: 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.
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.
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)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:
max, only max is supported)Valid values:
maxValid values:
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:
medium is mapped to high, and xhigh is mapped to high.For the deepseek-v4.1-flash model: the default value ishighValid values:
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:
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:
qwen3.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:
stream=true is enabled. Complex tools refer to tools whose definitions contain parameters of the array or object type.
This parameter is not an OpenAI standard parameter. When calling through the Python SDK, put it into the extra_body object. The configuration is: enable_code_interpreter boolean (optional) The default value is falseWhether to enable the code interpreter feature. Related documentation: Code interpreterValid values:
This parameter is not an OpenAI standard parameter. When calling through the Python SDK, put it into the extra_body object. The configuration is: 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].
seed default value The default value for all other models is 1234. boolean (Optional) Default value: falseWhether to return the log probabilities of output tokens. Valid values:
Content generated during the thinking phase (
Supported models
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 You can pass in sensitive words to control the model's output.When stop is an array,tools array(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.
Properties type string(Required)The tool type. Currently, only function is supported.functionobject(Required)
Properties name string(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 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 deepseek-v4.1-flash-1017 supports setting tool_choice to auto, none, required, or a specified function name.Valid values:
boolean (optional) Default value: trueWhether to enable parallel tool calls. For more information, see Parallel tool callsMiniMax/MiniMax-M3.1-Flash and kimi-k3 do not support controlling the parallelism of tool calls through this parameter. Setting it to kimi/kimi-k3.1-pro and kimi/kimi-k3.1-pro-highspeed do not support this parameter.Valid values:
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:
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: search_optionsobject (optional)The web search policy. For more information, see Web search
Properties forced_search boolean (optional) Default value: falseWhether to force web search. This parameter only takes effect when enable_search is true.Valid values:
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:
enable_search is true.Valid values:
This parameter is not an OpenAI standard parameter. When calling through the Python SDK, put it in the extra_body object. Configure it as: 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:
This parameter is not an OpenAI standard parameter. When calling through the Python SDK, put it in the extra_body object. Configure it as: 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:
-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.skill array (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: When using skill, stream must be set to true.
Properties type string(Required)The skill type. Currently supported:
string (Optional)The PPT generation mode. Valid values:
string (Optional)The PPT template ID. Used together when mode is general or mode is not set. Valid values:
boolean (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:
|
Python |
chat response object (Non-Stream)idstringThe unique identifier of this call.choicesarrayAn array of content generated by the model.
Properties finish_reason stringThe reason the model stopped generating.There are three cases:
integerThe index of the current object in the choices array.logprobsobjectThe token probability information output by the model.
Properties content arrayAn array containing each token and its log probability.
Properties 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:
Properties 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.objectThe message generated by the model.
Properties 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.
Properties id stringThe unique identifier of this tool response.type stringThe tool type. Currently only function is supported.function objectTool Information.
Properties 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 integerThe index of the current tool in the tool_calls array.integerThe 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.
Properties 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.
Properties 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.objectFine-grained classification of input tokens.
Properties 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.
Properties ephemeral_5m_input_tokens integerNumber of tokens used to create the explicit cache.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.
Properties (Qwen4) 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.
Properties ephemeral_5m_input_tokens integerNumber of tokens for 5-minute cache creation.ephemeral_1h_input_tokens integerNumber of tokens for 1-hour cache creation.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.
Properties search object (Optional)Usage statistics of web search. Returned when web search is enabled and retrieval is actually triggered.
Properties 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. |
The following is a response example of qwen3.8-max, used to illustrate the response fields. |
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.
Properties delta objectThe incremental object of the request.
Properties 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.
Properties data stringIncremental Base64-encoded audio data.expires_at integerThe timestamp when the request was created.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.
Properties 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.
Properties 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.stringThe tool type. Currently only function is supported.stringThe reason why the model stopped generating. There are four cases:
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.
Properties content arrayA token array with log probability information.
Properties 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.
Properties 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.integerThe 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.
Properties 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.
Properties 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_tokensinteger (optional)The number of output text tokens, which already includes reasoning_tokens.objectFine-grained classification of input tokens.
Properties 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.
Properties ephemeral_5m_input_tokens integerNumber of tokens used to create the explicit cache.integerNumber of tokens used to create the explicit cache.cache_type stringThe cache type, fixed as ephemeral.
Properties (Qwen4) 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.
Properties ephemeral_5m_input_tokens integerNumber of tokens for 5-minute cache creation.ephemeral_1h_input_tokens integerNumber of tokens for 1-hour cache creation.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.
Properties search object (Optional)Usage statistics of web search. Returned when web search is enabled and retrieval is actually triggered.
Properties 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. |
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]. |