You can call models using the OpenAI compatible Chat API. This document describes the input and output parameters and provides call examples.
- Singapore
- US (Virginia)
- China (Beijing)
- Hong Kong (China)
- Germany (Frankfurt)
- Japan (Tokyo)
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.
Obtain an API key and set it as an environment variable. If you use an OpenAI SDK, you must also install the SDK.
Request bodymodelstring(Required)The model name.Supported models: Qwen Large Language Model (commercial and open source versions), Qwen-VL, Qwen-Coder, Qwen-Omni, Qwen-Math, DeepSeek, Kimi, GLM, and MiniMax.For specific model names and billing details, see the Model Studio console.messagesarray(Required)The context passed to the large language model, arranged in conversational order.
Message type System Message object(Optional)A system message that defines the role, tone, task, or constraints for the large language model. It is usually the first element in the messages array.Do not set a system message for QwQ models. System messages have no effect on QVQ models.
Properties content string(Required)The system instruction. It specifies the model's role, behavior, response style, and task constraints.rolestring(Required)The role for the system message. The value is fixed to system.object(Required)The user message. It passes questions, instructions, or context to the model.
Properties content string or array(Required)The message content. The type is string if the input is text only. The type is array if the input contains multimodal data such as images, or if explicit caching is enabled.
Properties for multimodal models or when explicit caching is enabled type string(Required)Valid values:
stringThe input text. This parameter is required when type is text.image_urlobjectThe input image information. This parameter is required when type is image_url.
Properties url string(Required)The URL or Base64-encoded Data URL of the image. To pass a local file, see Image and video understanding.objectThe input audio information. This parameter is required when type is input_audio.
Properties data string(Required)The URL or Base64-encoded Data URL of the audio. To pass a local file, see Input a Base64-encoded local file.formatstring(Required)The format of the input audio, such as mp3 or wav.arrayThe input video information, provided as a list of images. This parameter is required when type is video. For more information about its usage, see Video understanding (Qwen-VL), Video understanding (QVQ), or Video understanding (Qwen-Omni).Example value:objectThe input video file information. This parameter is required when type is video_url.Qwen-VL can only understand the visual information of video files, while Qwen-Omni can understand both visual and audio information.
Properties url string(Required)The public URL or Base64-encoded Data URL of the video file. To input a local video file, see Input a Base64-encoded local file.float(Optional)The number of frames to extract per second. Valid values: [0.1, 10]. Default value: 2.0.The valid range for MiniMax/MiniMax-M3 is [0.2, 5], and the default value is 1.
Feature description The fps parameter has two functions:
fps value is suitable for high-speed motion scenarios, such as sports events or action movies. A smaller fps value is suitable for long videos or scenes with static content.
Example values
integer(Optional)Sets the minimum pixel threshold for input images or video frames. If an input's pixel count is less than min_pixels, it is enlarged until its total pixel count is greater than min_pixels. This parameter applies to Qwen-VL and QVQ models.
Value range
Example values
integer(Optional)Specifies the maximum pixel threshold for input images or video frames. If the pixel count of an input image or video is within the [min_pixels, max_pixels] range, the model processes the original image. If the pixel count is greater than max_pixels, the image is scaled down until its pixel count is less than or equal to max_pixels. This parameter applies to Qwen-VL and QVQ models.
Value range
Example values
integer(Optional)Limits the total pixel count of all frames extracted from a video, which is calculated as (pixels per frame × total frames). If the total pixel count of the video exceeds this limit, the system scales down the video frames. The system ensures that the pixel count of a single frame remains within the [min_pixels, max_pixels] range. This parameter applies to Qwen-VL and QVQ models.For long videos with many extracted frames, you can reduce this value to decrease token consumption and processing time, but this may result in a loss of image detail.
Value range
Example values
object(Optional)Enables explicit caching. For more information, see Explicit caching.
Properties type string(Required)Only ephemeral is supported.string(Required)The role for the user message. The value is fixed to user.object(Optional)The model's reply. It is typically passed back to the model as context in a multi-turn conversation.
Properties content string(Optional)The text content of the model's reply. When tool_calls is included, content can be empty. Otherwise, content is required.rolestring(Required)The role for the assistant message. The value is fixed to assistant.partialboolean(Optional) Default value: falseSpecifies whether to enable partial mode.Valid values:
array(Optional)The information about the tool and its input parameters that the model decides to call. It contains one or more objects and is obtained from the tool_calls field of the previous model response.
Properties id string(Required)The ID of the tool call.type string(Required)The tool type. Currently, only function is supported.function object(Required)Tools and input parameters
Properties name string(Required)The tool name.arguments string(Required)The input parameter information, as a JSON formatted string.integer(Required)The index of this tool call in the tool_calls array.object(Optional)The result of the tool call.
Properties content string(Required)The output content of the tool function. It must be a string. If the tool returns structured data, such as JSON, it must be serialized into a string.rolestring(Required)The value is fixed to tool.tool_call_idstring(Required)The ID of the tool call that this message is a response to. You can obtain it from completion.choices[0].message.tool_calls[$index].id. This ID is used to associate the tool message with the corresponding tool call.boolean(Optional) Default value: falseSpecifies whether to reply in streaming output mode. For more information, see Streaming output.Valid values:
true to improve the user experience and reduce the risk of timeouts.For non-streaming calls, the maximum timeout is at least 300 seconds and varies by region and model. If not completed in time, the service interrupts the request and returns the generated content instead of an error. We recommend that you use streaming calls for scenarios that require long outputs. For more information, see the timeout description in Overview of text generation models. object(Optional)Configuration items for streaming output. This parameter takes effect only when stream is set to true.
Properties include_usage boolean(Optional) Default value: falseSpecifies whether to include token consumption information in the last data chunk of the response.Valid values:
For streaming output, token consumption information can only appear in the last data chunk of the response. array(Optional) Default value: ["text"]The modality of the output data. This parameter applies only to Qwen-Omni models. For more information, see Non-real-time (Qwen-Omni).Valid values:
object(Optional)The voice and format of the output audio. This parameter applies only to Qwen-Omni models and requires the modalities parameter to be set to ["text","audio"]. For more information, see Non-real-time (Qwen-Omni).
Properties voice string (Required)The voice of the output audio. For more information, see Non-real-time (Qwen-Omni).formatstring (Required)The format of the output audio. Only wav is supported.float(Optional)The sampling temperature, which controls the diversity of the text generated by the model.A higher temperature results in more diverse text, while a lower temperature results in more deterministic text.Value range: [0, 2)Both temperature and top_p can control the diversity of the generated text. We recommend that you set only one of them. For more information, see Overview.Do not modify the default temperature value for 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 results in more diverse text. A lower top_p results in more deterministic text.Value range: (0, 1.0]Both temperature and top_p can control the diversity of the generated text. We recommend that you set only one of them. For more information, see Overview.Do not modify the default top_p value for QVQ models.top_k integer(Optional)Specifies the number of candidate tokens to sample from during generation. A larger value results in more random output, while a smaller value results in more deterministic output. If set to null or a value 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.
Default top_k values QVQ series: 10;QwQ series: 40;models before the qwen-vl-plus series, and qwen2.5-omni-7b: 1;Qwen3-Omni-Flash series: 50;All other models: 20.GLM series (supplied by Alibaba Cloud): 20;The DeepSeek, Kimi, and MiniMax series do not support the top_k parameter. This parameter is not a standard OpenAI parameter. When you call using the Python SDK, place it in the extra_body object. Configuration: extra_body={"top_k":xxx}. Do not modify the default top_k value for QVQ models.repetition_penalty float(Optional)The repetition penalty for consecutive sequences during model generation. Increasing repetition_penalty can reduce repetition in the model's output. A value of 1.0 means no penalty. There is no strict value range, as long as it is greater than 0.This parameter is not a standard OpenAI parameter. When you call using the Python SDK, place it in the extra_body object. Configuration: extra_body={"repetition_penalty":xxx}. When you use the qwen-vl-plus_2025-01-25 model for text extraction, set repetition_penalty to 1.0. Do not modify the default repetition_penalty value for QVQ models.presence_penalty float(Optional)Controls the content repetition when the model generates text.Value range: [-2.0, 2.0]. Positive values reduce repetition, while negative values increase it.In scenarios that require diversity, fun, or creativity, such as creative writing or brainstorming, you can increase this value. In scenarios that emphasize consistency and term accuracy, such as technical documents or formal texts, you can decrease this value.
Default presence_penalty values Qwen3.8 (non-thinking mode), Qwen3.7 (non-thinking mode), Qwen3.6 (non-thinking mode), Qwen3.5-Omni, Qwen3.5 (non-thinking mode), qwen3-max-preview (thinking mode), Qwen3 (non-thinking mode), Qwen3-Instruct series/1.7b/4b (thinking mode), QVQ series, qwen-max, qwen2.5-vl series, qwen-vl-max series, qwen-vl-plus, Qwen3-VL (non-thinking): 1.5;qwen3-8b/14b/32b/30b-a3b/235b-a22b (thinking mode), qwen-plus/qwen-plus-latest/2025-04-28 (thinking mode), qwen-turbo/qwen-turbo/2025-04-28 (thinking mode): 0.5;All others are 0.0.DeepSeek series (supplied by Alibaba Cloud): deepseek-r1, deepseek-r1-0528, deepseek-r1-distill-qwen distilled version: 1;Kimi series (supplied by Alibaba Cloud): kimi-k2.7-code, kimi-k2.6, kimi-k2.5: 0.0;Kimi series (supplied by Moonshot AI): 0.0;MiniMax series (supplied by Alibaba Cloud): MiniMax-M2.5, MiniMax-M2.1: 0.0;Other DeepSeek, Kimi, GLM, and 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 text. The penalty is not related to the number of times the token appears. This reduces the likelihood of these tokens reappearing, thus reducing content repetition and increasing word diversity.
Example 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 2.0: This movie is great. The plot is fantastic, the acting is superb, and the music is also very beautiful. Overall, the entire film is just incredible. It is actually truly outstanding. The storyline is very exciting, the performances are excellent, and the soundtrack is so moving.Parameter value 0.0: This movie is good. The plot is good, the acting is good, and the music is good. Overall, the whole movie is very good. In fact, it is really great. The plot is very good, the acting is also very excellent, and the music is equally outstanding.Parameter value -2.0: This movie is good. The plot is good, the acting is good, and the music is good. Overall, the whole movie is good. In fact, it is really good. The plot is very good, the acting is very good, and the music is very good. When you use the qwen-vl-plus model for text extraction, set presence_penalty to 1.5. Do not modify the default presence_penalty value for QVQ models.response_format object (Optional) Default value: {"type": "text"}The format of the response. Valid values:
For more information, see Structured output.
If you specify For supported models, see Structured output.
Properties type string(Required)The format of the returned content. Valid values:
integer(Optional, to be deprecated)
This parameter will be deprecated. For new integrations, use The meaning of this parameter varies by model:
integer(Optional)The maximum length of the model's output, including the chain-of-thought and the model's answer. If the model's output exceeds this value, generation stops early, and the returned finish_reason is length.The default and maximum values are both the model's maximum output length.Difference from max_tokens: max_completion_tokens limits the complete model output (chain-of-thought + answer), while max_tokens only limits the answer part. For thinking models, we recommend that you use max_completion_tokens.The following models are supported:
The models listed above do not include models supplied directly by third parties.
There may be a difference of up to 10 tokens between the actual output token count and the specified vl_high_resolution_imagesboolean(Optional) Default value: falseSpecifies whether to increase the pixel limit for input images to the pixel count that corresponds to 16384 tokens. For more information, see Processing high-resolution images.
This parameter is not a standard OpenAI parameter. When you call using the Python SDK, place it in the extra_body object. Configuration: 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 suitable for scenarios that require multiple candidate responses, such as creative writing or ad copy.Only supported by Qwen3 (non-thinking mode) models. If the Increasing n increases the output token consumption but not the input token consumption.enable_thinking boolean (Optional)When you use a mixed-thinking model, which supports both thinking and non-thinking modes, this parameter specifies whether to enable thinking mode. This applies to Qwen3.7, Qwen3.6, Qwen3.5, Qwen3, Qwen3-Omni-Flash, and Qwen3-VL models, along with the DeepSeek-V4-Pro/V4-Flash series, DeepSeek-V3.2/V3.2-exp/V3.1 series, Kimi-K2.7-code (thinking model only), Kimi-K2.6/K2.5 series, and GLM series. The DeepSeek-V4 series enables thinking by default. You can adjust the inference intensity with the reasoning_effort parameter.Valid values:
This parameter is not a standard OpenAI parameter. When you call using the Python SDK, place it in the extra_body object. Configuration: If you call over HTTP directly (for example, with curl) instead of using the OpenAI SDK, do not use
The MiniMax and MiniMax-M3 models from Xiyu Technology do not use this parameter. Instead, use the thinking object (Optional) Default value: {"type":"adaptive"}Controls the thinking mode of MiniMax/MiniMax-M3 supplied by MiniMax.thinking.type valid values:
This parameter is not a standard OpenAI parameter. When you call using the Python SDK, place it in the extra_body object. Configuration: preserve_thinking boolean (Optional) Default value: false (Default value for qwen3.8-max/qwen3.8-flash:true)Specifies whether to append the reasoning_content from assistant messages in the conversation history to the model input. This is suitable for scenarios where the model needs to refer to the historical thinking process.Currently supported by qwen3.7-max, qwen3.7-max-2026-05-20 and subsequent snapshots, qwen3.6-max-preview, 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, qwen3.8-max (enabled by default), qwen3.8-flash (enabled by default), 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 (supplied by Moonshot AI, enabled by default), and kimi/kimi-k2.7-code (supplied by Moonshot AI, enabled by default).Important (qwen3.8-max/qwen3.8-flash): When using qwen3.8-max/qwen3.8-flash, preserve_thinking defaults to true. You must send back all historical reasoning_content in the reasoning_content field. Do NOT concatenate reasoning_content into the content field. Doing so may degrade model performance.
This parameter is not a standard OpenAI parameter. When you call using the Python SDK, place it in the extra_body object. Configuration: thinking_budget integer (Optional)The maximum number of tokens for the thinking process. This applies to Qwen3.8, Qwen3.7, Qwen3.6, Qwen3.5, Qwen3-VL, Qwen3, GLM and Kimi models, except kimi-k3, which does not support this parameter. For more information, see Limit thinking length.The default value is the model's maximum chain-of-thought length. For more information, see the model list.
This parameter is not a standard OpenAI parameter. When you call using the Python SDK, place it in the extra_body object. Configuration: reasoning_effort string (Optional)Controls the inference intensity of models. The valid values and default values vary by model.DeepSeek-V4 and GLM series (Default value: high)Valid values:
maxValid values:
enable_thinking supports only true. Passing false causes the API request to fail.deepseek-v4-flash-0731 & deepseek-v4-pro-0813: Default value:highValid values:
medium is mapped to high, xhigh is mapped to high.kimi/kimi-k3 (Default value: max; only max is supported)Valid value:
xhighValid 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 values other than the above valid values and mapped values will cause an error.For the qwen3.8 series, reasoning_effort and thinking_budget cannot be set at the same time. Setting both will cause an error. However, they support mutual conversion:
This parameter is not a standard OpenAI parameter. When you call using the Python SDK, place it in the extra_body object. Configuration: tool_stream boolean (Optional) Default value: falseTakes effect only when stream=true. This parameter is currently supported only by Qwen and GLM series.Qwen series support list:
tool_stream only affects complex tool parameters. For normal tool parameters, streaming output is enabled as long as stream=true. Complex tools are tools where some parameter types in the tool definition are array or object.
This parameter is not a standard OpenAI parameter. When you call using the Python SDK, place it in the extra_body object. Configuration: enable_code_interpreter boolean (Optional) Default value: falseSpecifies whether to enable the code interpreter feature. For more information, see Code interpreter.Valid values:
This parameter is not a standard OpenAI parameter. When you call using the Python SDK, place it in the extra_body object. Configuration: seedinteger(Optional)A random number seed. This parameter is used to ensure reproducible results with the same input and parameters. If you pass the same seed value in a call and other parameters remain unchanged, the model returns the same result as much as possible.Value range: [0,2<sup>31</sup>−1].logprobs boolean (Optional) Default value: falseSpecifies whether to return the log probabilities of the output tokens. Valid values:
Content generated during the thinking phase (
Supported models
integer (Optional) Default value: 0Specifies the number of most likely candidate tokens to return at each generation step.Value range: [0, 5]This parameter takes effect only when logprobs is true.stopstring or array(Optional)Used to specify stop words. When a string or token_id specified in stop appears in the generated text, generation stops immediately.You can pass sensitive words to control the model's output.When stop is an array, you cannot input bothtools array(Optional)An array that contains one or more tool objects for the model to call in Function Calling. For more information, see Function calling.If tools is set and the model determines that a tool needs to be called, the response returns tool information in 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, numbers, underscores (_), and hyphens (-) are allowed. The maximum length is 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 for the tool, which must be a valid JSON Schema. For a description of JSON Schema, see the link. If the parameters parameter is empty, the tool has no input parameters, such as a time query tool.
To improve the accuracy of tool calls, we recommend that you pass string or object(Optional) Default value: autoThe tool selection strategy. To force a specific tool calling method for a certain type of problem, such as always using a specific tool or disabling all tools, you can set this parameter.Valid values:
boolean (Optional) Default value: falseSpecifies whether to enable parallel tool calling. For more information, see Parallel tool calling.Valid values:
boolean(Optional) Default value: falseSpecifies whether to enable web search. For more information, see Web search.Valid values:
Enabling the web search feature may increase token consumption.
This parameter is not a standard OpenAI parameter. When you call using the Python SDK, place it in the extra_body object. Configuration: search_optionsobject(Optional)The strategy for web search. For more information, see Web search.
Properties forced_search boolean(Optional) Default value: falseSpecifies whether to force web search. This parameter takes effect only when enable_search is set to true.Valid values:
string(Optional) Default value: turboThe search strategy. This parameter takes effect only when enable_search is set to true.Valid values:
boolean(Optional) Default value: falseSpecifies whether to enable vertical search. This parameter takes effect only when enable_search is set to true.Valid values:
This parameter is not a standard OpenAI parameter. When you call using the Python SDK, place it in the extra_body object. Configuration: clear_thinkingboolean(Optional) Default value: falseControls whether the reasoning_content (thinking process) from previous turns in a multi-turn conversation is used as context input for the model. This parameter is supported only by the GLM series models glm-5.2, glm-5.1, glm-5, and glm-4.7.
This parameter is not a standard OpenAI parameter. When you call using the Python SDK, place it in the extra_body object. Configuration:
|
|
Chat response object (non-streaming output)idstringThe unique identifier for this call.choicesarrayAn array of content generated by the model.
Properties finish_reason stringThe reason why the model stopped generating.Consider the following three scenarios:
integerThe index of this object in the choices array.logprobsobjectThe token probability information of the model's output.
Properties content arrayAn array that contains each token and its log probability.
Properties token stringThe text of the current token.bytes arrayA list of the raw UTF-8 bytes of the current token. This is used to accurately restore the output content, such as emojis 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. The number of tokens is consistent with the top_logprobs request parameter. Each element contains:
Properties token stringThe text of the candidate token.bytes arrayA list of the raw UTF-8 bytes of the current token. This is used to accurately restore the output content, such as emojis or Chinese characters.logprob floatThe log probability of this candidate token. A null value indicates an extremely low probability.objectThe message that is output by the model.
Properties content stringThe content of the model's reply.reasoning_content stringThe chain-of-thought content of the model.refusal stringThis parameter is currently fixed to null.role stringThe role of the message. The value is fixed to assistant.audio objectThis parameter is currently fixed to null.function_call (to be deprecated)objectThis value is fixed to null. For more information, see the tool_calls parameter.tool_calls arrayThe information about the tool and its input parameters that the model decides to call.
Properties id stringThe unique identifier for this tool call.type stringThe tool type. Currently, only function is supported.function objectTool details
Properties name stringThe tool name.arguments stringThe input parameter information, as a JSON formatted string.Because the large language model's response is random, the output parameter information may not conform to the function signature. You must validate the parameters before you call the function. integerThe index of this tool call in the tool_calls array.integerThe Unix timestamp, in seconds, when the request was created.modelstringThe model that is used for this request.object stringThe value is always chat.completion.service_tier stringThis parameter is currently fixed to null.system_fingerprintstringThis parameter is currently fixed to null.usage objectThe token consumption information for this request.
Properties completion_tokens integerThe number of tokens in the model's output.prompt_tokens integerThe number of input tokens. For more information, see Additional notes.total_tokens integerThe total number of tokens consumed. This is the sum of prompt_tokens and completion_tokens.completion_tokens_details object (Optional)A fine-grained classification of output tokens. This field is returned only by some models.
Properties audio_tokens integer (Optional)The number of output audio tokens. This field is returned only for audio output models.reasoning_tokens integer (Optional)The number of tokens in the thinking process. This field is returned only for reasoning models.text_tokens integer (Optional)The number of tokens in the output text.objectA fine-grained classification of input tokens.
Properties audio_tokens integerThis parameter is currently fixed to null.cached_tokens integerThe number of tokens that hit the cache. For more information about Context Cache, see Context cache.text_tokens integerThe number of input text tokens.image_tokens integerThe number of input image tokens.video_tokens integerThe number of tokens for the input video file or image list.cache_creation objectThe explicit cache creation information.
Properties ephemeral_5m_input_tokens integerThe number of tokens that are used to create the explicit cache.integerThe number of tokens that are used to create the explicit cache.cache_type stringWhen you use explicit cache, the parameter value is ephemeral. Otherwise, this parameter does not exist. |
Chat response chunk object (streaming output)idstringThe unique identifier for this call. Each chunk object has the same ID.choicesarrayAn array of content generated by the model, which can contain one or more objects. If the include_usage parameter is set to true, choices is an empty array in the last chunk.
Properties delta objectThe incremental object of the request.
Properties content stringThe incremental message content.reasoning_content stringThe incremental chain-of-thought content.function_call objectThis value defaults to null. For more information, see the tool_calls parameter.audioobjectThe reply that is generated when you use the Qwen-Omni model.
Properties data stringThe incremental 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. It has a value only in the first chunk.tool_calls arrayThe information about the tool and its input parameters that the model decides to call.
Properties index integerThe index of this tool call in the tool_calls array.id stringThe unique identifier for this tool call.function objectThe information about the called tool.
Properties arguments stringThe incremental input parameters. The arguments from all chunks are concatenated to form the complete set of input parameters.Because the large language model's response is random, the output parameter information may not conform to the function signature. You must validate the parameters before you call the function.name stringThe tool name. It has a value only in the first chunk.stringThe tool type. Currently, only function is supported.stringThe reason why the model stopped generating. The value can be one of the following:
integerThe index of the current response in the choices array. When the input parameter n is greater than 1, you can use this parameter to concatenate the complete content that corresponds to different responses.logprobsobjectThe probability information of the current object.
Properties content arrayAn array of tokens with log probability information.
Properties token stringThe current token.bytes arrayA list of the raw UTF-8 bytes of the current token. This is helpful when you process emojis and Chinese characters.logprob floatThe log probability of the current token. A null value 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 arrayA list of the raw UTF-8 bytes of the current token. This is helpful when you process emojis and Chinese characters.logprob floatThe log probability of the current token. A null value indicates an extremely low probability.integerThe timestamp when this request was created. Each chunk has the same timestamp.modelstringThe model that is used for this request.object stringThe value is always 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. It is displayed only in the last chunk when include_usage is set to true.
Properties completion_tokens integerThe number of tokens in the model's output.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)Detailed information about the output tokens. This field is returned only by some models.
Properties audio_tokens integer (Optional)The number of output audio tokens. This field is returned only for audio output models.reasoning_tokens integer (Optional)The number of tokens in the thinking process. This field is returned only for reasoning models.text_tokensinteger (Optional)The number of output text tokens.objectA fine-grained classification of input tokens.
Properties audio_tokens integerThe number of input audio tokens.The number of audio tokens in a video file is returned in this parameter.text_tokens integerThe number of input text tokens.video_tokens integerThe number of tokens for the input video, which can be an image list or a video file.image_tokens integerThe number of input image tokens.cached_tokens integerThe number of tokens that hit the cache. For more information about Context Cache, see Context cache.cache_creation objectThe explicit cache creation information.
Properties ephemeral_5m_input_tokens integerThe number of tokens that are used to create the explicit cache.integerThe number of tokens that are used to create the explicit cache.cache_type stringThe cache type. The value is fixed to ephemeral. |