Call Qwen models through the DashScope API, and view input and output parameter descriptions and calling examples.
- Singapore
- United States (Virginia)
- China (Beijing)
- Hong Kong (China)
- Germany (Frankfurt)
- Japan (Tokyo)
HTTP request URL:
- Text-only models (such as qwen-plus):
POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/text-generation/generation - Multimodal models (such as qwen3.7-plus or qwen3-vl-plus):
POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation
- Python code
- Java code
- dashscope CLI
{WorkspaceId} with your actual Workspace ID.
You must have already obtained and configured an API Key and set the API Key as an environment variable. If you call through the DashScope SDK, you need to install the DashScope SDK.
Request bodymodelstring (Required)The model name.Supported models: Qwen large language models (commercial and open-source versions), Qwen-VL, Qwen-Coder, math models, DeepSeek, Kimi, GLM, and MiniMax.For specific model names and billing, see Select Model.messagesarray (Required)The context passed to the model, arranged in conversation order.When calling via HTTP, place messages inside the input object.
Message Type System Message object (Optional)The system message, used to define the model's role, tone, task objectives, or constraints. It is generally placed first in the messages array.Setting a System Message is not recommended for QwQ models, and it does not take effect for QVQ models.
Properties content string (Required)The message content.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 contains only text, 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 text string (Required)The input text.imagestring (optional)The image file used for image understanding. Images can be passed in the following three ways:
{"image":"https://xxxx.jpeg"}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, that value is used as the pixel upper limit, taking 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 results in higher input token usage 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.array or string (optional)For 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 video passed in when using Qwen-VL models or QVQ models.
float (optional)Number of frames extracted per second. The value range is [0.1, 10], and the default value is 2.0.
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)The upper limit on the number of frames extracted from a video. When the number of frames calculated by fps exceeds max_frames, the system will automatically adjust to: uniformly sample frames within max_frames, ensuring the total number of frames does not exceed the limit.
Value range
Example value {"type": "video_url","video_url": {"url":"https://xxxx.mp4"},"max_frame": 2000}
When calling with the OpenAI-compatible API, the custom 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 smaller than min_pixels, it will be scaled up until the total pixels exceed min_pixels.
Value range
Example value
integer (Optional)Sets 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 input image pixels exceed max_pixels, the image is scaled down until the total pixels are below max_pixels.
Value range
Example value
integer (Optional)The total pixel budget after video frame extraction.
Maximum value
Example value
object (Optional)Only supported by models that support explicit cache, used to enable explicit cache.
Properties type string (Required)Fixed to ephemeral.string (Required)The role of the user message, fixed to user.object (Optional)The model's reply to the user message.
Properties content string(Optional)The message content. Required unless the assistant message includes the tool_calls parameter.rolestring (Required)Fixed to assistant.partialboolean(Optional)Whether to enable partial mode. Related documentation and supported models: Partial mode.tool_calls array(Optional)The tool and input parameter information returned after Function Calling is initiated, containing one or more objects. Obtained from the tool_calls field of the previous model response.
Properties id stringThe ID of the tool call.type stringThe tool type. Currently, only function is supported.function objectThe tool and input parameter information.
Properties name stringThe tool name.arguments stringThe input parameter information, in JSON format string.integerThe 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 in string format.rolestring (Required)Fixed to tool.tool_call_idstring(Optional)The ID returned after Function Calling is initiated. You can obtain it via response.output.choices[0].message.tool_calls[$index]["id"]. It is used to identify the tool corresponding to the Tool Message.float(Optional)qwen4-max: 1.0 in thinking mode, and 0.7 in non-thinking mode.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)When calling via HTTP, place temperature in the parameters object. It is not recommended to change the default temperature value of QVQ models.top_p float(Optional)qwen4-max: 0.95 in thinking mode, and 0.8 in non-thinking mode.The probability threshold for nucleus sampling, which controls the diversity of the text generated by the model.A higher top_p value makes the generated text more diverse. Conversely, a lower value makes the generated text more deterministic.Value range: (0,1.0].In the Java SDK, it is topP. When calling via HTTP, put top_p in the parameters object. We do not recommend changing the default top_p value of QVQ models.top_k integer (optional)The size of the candidate set sampled during generation. For example, when the value is 50, only the 50 highest-scoring tokens in a single generation form the candidate set for random sampling. A larger value leads to higher randomness in generation; a smaller value leads to higher determinism. A value of None or a top_k greater than 100 indicates that the top_k strategy is disabled, and only the top_p strategy takes effect.The value must be greater than or equal to 0.
top_k default value QVQ series: 10;QwQ series: 40;All other models: 20;GLM series (Alibaba Cloud direct): 20;The DeepSeek/Kimi/MiniMax series do not support the top_k parameter. In the Java SDK, it is topK. When calling via HTTP, put top_k in the parameters object. We do not recommend changing the default top_k value of QVQ models.enable_thinking boolean (optional)Whether to enable thinking mode when using hybrid thinking models. This applies to Qwen4, Qwen3.8, Qwen3.7, Qwen3.6, Qwen3.5, Qwen3, and Qwen3-VL models, as well as the DeepSeek-V4 series, Kimi-K2.6/K2.5 series, and GLM series. The DeepSeek-V4 series enables thinking by default, and you can adjust the reasoning effort via the reasoning_effort parameter.Optional values:
In the Java SDK, it is enableThinking; when calling via HTTP, put enable_thinking in the parameters object.thinking_display string (optional)qwen4-max: "summarized". Chain-of-thought summary and encryption.By default, the complete 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 complete ciphertext are returned. The summary is for display, and the ciphertext is for restoring historical thinking.preserve_thinking boolean (optional) The default value is false (for qwen4-max and qwen3.8-max, the default value istrue)Whether to append the reasoning_content of assistant messages in the conversation history to the model input. This applies to scenarios where the model needs to reference the historical thinking process.Currently supported: qwen4-max, qwen3.8-max (enabled by default), qwen3.8-max-0902 (enabled by default), qwen3.8-flash, qwen3.7-max, qwen3.7-max-2026-05-20 and subsequent 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 (Alibaba Cloud Model Studio deployment), kimi-k2.7-code (Alibaba Cloud Model Studio deployment, enabled by default), kimi/kimi-k2.7-code-highspeed (Moonshot direct, enabled by default), kimi/kimi-k2.7-code (Moonshot direct, enabled by default).Important: When using qwen4-max or qwen3.8-max, preserve_thinking is true by default, and you must pass back all reasoning_content from the conversation history in full. Appending reasoning_content to the content field for passback is not supported.
When calling via HTTP, put preserve_thinking into the parameters object. Not supported by the Java SDK yet.thinking_budget integer (optional)The maximum length of the thinking process. Applicable to Qwen4, Qwen3.8, Qwen3.7, Qwen3.6, Qwen3.5, Qwen3-VL, Qwen3, GLM, and Kimi series models, among which kimi-k3 and kimi-k3.1-pro do not support this parameter. Related document: Limit thinking length. Default value: 131072 (qwen4-max).Other models: the default value is the maximum chain-of-thought length of the model. See: Select ModelIn the Java SDK, this parameter is thinkingBudget. When calling via HTTP, put thinking_budget into the parameters object. Other models: the default value is the maximum chain-of-thought length of the model.reasoning_effort string (optional)qwen4-maxDefault value: reasoning_effort=high.
qwen4-max does not support setting both reasoning_effort and thinking_budget at the same time. thinking_budget must be a positive integer and cannot be set to 0.When only thinking_budget is set, the thinking level is determined based on the following table, and the passed-in budget value is retained.
high and 131072 are used.Controls the reasoning effort of the model. Different models support different available values and default values.kimi-k3.1-pro (deployed on Alibaba Cloud Model Studio): the default value is max.
enable_thinking defaults to true. It can be set to false to disable thinking, but we recommend keeping it enabled, as disabling it significantly affects model output quality.DeepSeek-V4, GLM series, and kimi/kimi-k3 (default value is high)Optional values:
maxOptional values:
enable_thinking only supports true, and passing false will cause the API request to fail.deepseek-v4-flash-0731 and deepseek-v4-pro-0813 models: the default value ishighOptional values:
medium is mapped to high, and xhigh is mapped to high.qwen3.8 series models: the default value isxhighOptional 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 optional values and mapped values will cause an error.Important: The qwen3.8 series does not support setting reasoning_effort and thinking_budget at the same time; setting both simultaneously will cause an error. However, the two support mutual conversion:
When calling via HTTP, put reasoning_effort into the parameters object.tool_stream boolean (optional) The default value is falseOnly affects the streaming output behavior of complex tool parameters, and takes effect only in streaming calls. Regular tool parameters (all parameters are of type string) can be streamed as long as streaming is enabled; tool_stream has no effect on them. Complex tools refer to tools whose definitions contain parameters of type array or object. Currently, only the Qwen and GLM series support this.Qwen series support list:
Complex tools refer to tools whose definitions contain parameters of type array or object.GLM series support list: glm-5, glm-5.1.GLM series usage reference:
When calling via HTTP, put tool_stream into the parameters object.enable_code_interpreter boolean (optional) The default value is falseWhether to enable the code interpreter feature. Related document: Code interpreterOptional values:
The Java SDK is not supported. When calling via HTTP, put enable_code_interpreter into the parameters object.clear_thinking boolean (optional) The default value is falseControls whether the reasoning_content (thinking process) of previous turns is input to the model as context in multi-turn conversations. Only the GLM series models glm-5.3, glm-5.2, glm-5.1, and glm-5 support this. The default value is true for glm-5.3 and false for the other models.
float (optional)The degree of repetition in consecutive sequences during model generation. Increasing repetition_penalty reduces the repetition in model generation; 1.0 means no penalty. There is no strict value range—it only needs to be greater than 0.In the Java SDK, it is repetitionPenalty. When calling via HTTP, put repetition_penalty into the parameters object. It is not recommended to change the default repetition_penalty value of QVQ models.frequency_penalty float (optional)Supports qwen4-max. Applies a penalty based on the number of times a Token has already appeared, to adjust the generation of repeated content.presence_penaltyfloat (Optional)Controls the content repetition in the text generated by the model.Value range: [-2.0, 2.0]. Positive values reduce repetition, and 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 texts, it is recommended to decrease this value.
presence_penalty default value qwen4-max (non-thinking mode), Qwen3.8 (non-thinking mode), Qwen3.7 (non-thinking mode), Qwen3.6 (non-thinking mode), 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, Qwen3-VL (non-thinking): 1.5;qwen-plus/qwen-plus-latest/2025-04-28 (thinking mode): 0.5;All others are 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 positive, 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 repeatedly, thereby reducing content repetition and increasing 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 is 2.0: This movie is excellent. The plot is wonderful, the acting is superb, and the music is delightful to listen to. Overall, the entire film is simply marvelous. In fact, it is truly outstanding. The storyline is captivating, the performances are exceptional, and the soundtrack is equally enchanting.Parameter value is 0.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 great. The plot is very good, the acting is very impressive, and the music is equally excellent.Parameter value is -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. The Java SDK does not support setting this parameter*.* When calling through HTTP, put presence_penalty into the parameters object.vl_high_resolution_images boolean (Optional) The default value is falseFor qwen4-max, even if vl_high_resolution_images=true, the explicitly passed-in max_pixels still takes effect.Whether to raise the pixel limit of the input image to the pixel value corresponding to 16384 Tokens. Related documentation: Process high-resolution images.
In the Java SDK, this parameter is vlHighResolutionImages (the minimum required version is 2.20.8). When calling through HTTP, put vl_high_resolution_images into the parameters object.vl_enable_image_hw_output boolean (Optional) The default value is falseWhether to return the dimensions of the image after scaling. The model scales the input images; when this is set to True, the height and width of the scaled image are returned. When streaming output is enabled, this information is returned in the last chunk. Supported by Qwen-VL models.In the Java SDK, this parameter is vlEnableImageHwOutput, and the minimum Java SDK version is 2.20.8*.* When calling through HTTP, put vl_enable_image_hw_output into the parameters object.max_tokens integer (Optional, will be deprecated soon)
This parameter will be deprecated soon. For new integrations, use The meaning of this parameter varies by model, as follows:
In the Java SDK, this parameter is maxTokens (for Qwen VL models, it is maxLength, in the Java SDK; from version 2.18.4 onwards, it can also be set to maxTokens). When calling through HTTP, put max_tokens into the parameters object.max_completion_tokens integer (Optional)The maximum length of the model's output, including the chain of thought and the model's answer. When the model output 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 in 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 + answer); the specific scope limited by max_tokens varies depending on the model and the thinking_budget setting, as described above. For thinking models, max_completion_tokens is recommended.The following models are supported:
Apart from the ZHIPU direct GLM models listed in the table above, the above models do not include other third-party direct models.
There can be a discrepancy of up to 10 tokens between the actual number of output tokens and the configured The Java SDK does not support this parameter yet. When calling through HTTP, put max_completion_tokens into the parameters object.seed integer (Optional)The random number seed. Used to ensure that results are reproducible under the same input and parameters. If the same seed is passed with other parameters unchanged, the model will return the same result as much as possible.Value range: [0,2 31 −1].When calling through HTTP, put seed into the parameters object.stream boolean (Optional) The default value is falseWhether to stream the response. Parameter values:
This parameter is only supported by the Python SDK. To implement streaming output with the Java SDK, call through the Qwen3 commercial versions (thinking mode), Qwen3 open-source versions, QwQ, and QVQ only support streaming output.incremental_output boolean (Optional) The default is false (for Qwen3-Max, Qwen3-VL, Qwen3 open-source versions, QwQ, and QVQ models, the default value is true)Whether to enable incremental output in streaming output mode. We recommend that you set it to true first.Parameter value:
In the Java SDK, it is incrementalOutput. When calling via HTTP, put incremental_output into the parameters object. QwQ models and Qwen3 models in thinking mode only support setting it to
Qwen3 open-source models do not support setting it to response_formatobject (Optional) Default value: {"type": "text"}The format of the returned content. Valid values:
Related documentation: Structured output. The models supported by If In the Java SDK, it is responseFormat*.* When calling via HTTP, put response_format into the parameters object.
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.For the DashScope method, you need to manually construct the JSON Schema. For the format and examples, see Obtain output in a specified format. Java SDK is not supported yet.
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 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.string(Optional) Default value: text (the default value is message for Qwen3-Max, Qwen3-VL, QwQ models, and Qwen3 open-source models)The format of the returned data. We recommend that you set it to message first, which makes it easier to have multi-turn conversations.
The platform will unify the default value to In the Java SDK, it is resultFormat. When calling via HTTP, put result_format into the parameters object.
When the model is Qwen-VL/QVQ, setting Qwen3-Max, Qwen3-VL, and Qwen3 models in thinking mode can only be set to If you use the Java SDK to call Qwen3 open-source models and pass inlogprobs boolean (Optional) The default value is falseWhether to return the log probabilities of the output tokens. Valid values:
When calling via HTTP, put logprobs into the parameters object.top_logprobs integer (Optional) The default value is 0Specifies the number of candidate tokens with the highest probability to return at each generation step.Value range: [0,5]Takes effect only when logprobs is true.In the Java SDK, it is topLogprobs. When calling via HTTP, put top_logprobs into the parameters object.n integer(Optional) The default value is 1The number of responses to generate. Value range: 1-4. For scenarios that require multiple responses (such as creative writing and advertising copy), you can set a larger n value.
Currently, only Setting a larger n value does not increase input token consumption, but increases output token consumption. When calling via HTTP, put n into the parameters object.stop string or array(Optional)Specifies stop words. When the string or token_id specified by stop appears in the text generated by the model, generation stops immediately.You can pass in sensitive words to control the model's output.When stop is an array, you cannot pass When calling via HTTP, put stop into the parameters object.tools array(Optional)An array containing one or more tool objects for the model to call in Function Calling. Related documentation: Function CallingWhen using tools, you must set result_format to message.You must set the tools parameter both when initiating a Function Calling and when submitting tool execution results.
Properties type string(Required)The tool type. Currently, only function is supported.functionobject(Required)
Properties name string(Required)The name of the tool function. It must consist of letters and digits, and can contain underscores and hyphens, with a maximum length of 64.descriptionstring(Required)A description of the tool function, for the model to determine when and how to call the tool function.parametersobject (Optional) Default value is {}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 indicates that the tool has no input parameters (for example, a time query tool).
To improve the accuracy of tool calling, we recommend passing in When calling via HTTP, put tools into the parameters object. The qwen-vl series models are not supported yet.tool_choice string or object (Optional) Default value is autoThe tool selection policy. If you need to force a specific tool calling method for certain types of questions (for example, always using a specific tool or disabling all tools), you can set this parameter.
In the Java SDK, it is toolChoice. When calling via HTTP, put tool_choice into the parameters object.parallel_tool_calls boolean (Optional) Default value is falseWhether to enable parallel tool calls.Optional values:
In the Java SDK, it is parallelToolCalls. When calling via HTTP, put parallel_tool_calls into the parameters object. |
|
chat response object (streaming and non-streaming output formats are the same)request_idstringThe unique identifier of this call.The Java SDK return parameter is requestId.code stringError code, returned when the call fails.Python SDK 2.0 does not return the envelope fields when a call fails; instead, it throws a DashScopeError (e.code/e.status_code/e.message/e.request_id).output objectThe call result information.
Properties text stringThe reply generated by the model. When the input parameter result_format is set to text, the reply content is returned to this field.finish_reasonstringThis parameter is not empty when the input parameter result_format is set to text.There are four cases:
arrayThe model output information. The choices parameter is returned when result_format is message.
Properties finish_reason stringThere are four cases:
objectThe message object output by the model.
Properties role stringThe role of the output message, fixed to assistant.contentstring or arrayThe content of the output message. It is an array when using qwen-vl or qwen-audio series models, and a string in all other cases.If Function Calling is initiated, this value is empty.
Properties text stringThe content of the output message when using qwen-vl or qwen-audio series models.image_hwarrayWhen the vl_enable_image_hw_output parameter is enabled for Qwen-VL series models, there are two cases:
stringqwen4-max, thinking_display="summarized": The enabling 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 turns. The summary cannot replace the historical chain-of-thought. Chain-of-thought summary and encryption.reasoning_content stringThe model's deep thinking content.tool_callsarrayIf the model needs to call tools, the tool_calls parameter is generated.
Properties function objectThe name of the tool to call, and the input parameters.
Properties name stringThe name of the tool to callargumentsstringThe parameters to be input into the tool, as a JSON string.Due to the inherent randomness of large model responses, the output JSON string may not always satisfy your function. It is recommended that you validate the parameters before passing them to the function. integerThe index of the current tool_calls object in the tool_calls array.id stringThe ID of this tool response.type stringThe tool type, fixed as function.objectThe probability information of the current choices object.
Properties content arrayAn array of tokens 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, which is helpful when processing emojis and Chinese characters.logprob floatThe log probability of the current Token. A returned 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 top_logprobs input parameter.
Properties token stringThe current Token.bytes arrayThe list of raw UTF‑8 bytes of the current Token, used to accurately reconstruct the output content, which is helpful when processing emojis and Chinese characters.logprob floatThe log probability of the current Token. A returned value of null indicates an extremely low probability.mapThe token information used in this chat request.
Properties input_tokens integerThe length of the user input content after being converted into tokens. Additional notesoutput_tokens integerThe length of the model output content after being converted into tokens.input_tokens_details object (optional)Details of the length of the input content after being converted into tokens.
Properties text_tokens integer (optional)The length of the input text after being converted into tokens.image_tokens integer (optional)The length of the input images after being converted into tokens.video_tokens integer (optional)The length of the input video files or image list after being converted into tokens.integerThis field is returned when the input is plain text. It is the sum of input_tokens and output_tokens.image_tokens integerThis field is returned when the input content contains image. It is the length of the image content input by the user after being converted into tokens.video_tokens integerThis field is returned when the input content contains video. It is the length of the video content input by the user after being converted into tokens.audio_tokens integerThis field is returned when the input content contains audio. It is the length of the audio content input by the user after being converted into tokens.output_tokens_details object (optional)Details of the length of the output content after being converted into tokens. Some models return this field.
Properties text_tokens integer (optional)The length of the output text after conversion to tokens.reasoning_tokens integer (optional)The length of the thinking process after conversion to tokens. Only reasoning models return this field.audio_tokens integer (optional)The length of the output audio after conversion to tokens. Only models with audio output return this field.objectThe fine-grained classification of input tokens.
Properties 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 integerThe token length used to create an explicit cache with a 5-minute validity period.integerThe token length used to create an explicit cache.cache_type stringWhen explicit cache is used, the parameter value is ephemeral; otherwise, this parameter does not exist. |