典名词元DMTOKENSHome
API DocumentationThird-Party Tools Tutorial
AI Model APIText

Text Generation (Chat)

POST/api/v1/chat/completions

Header Parameters

Authorization*string

Use Bearer Token authentication. Format: Authorization: Bearer sk-xxxxxx

Request Body

application/json

model*string

Model name, example input: gpt-5.3-chat deepseek-v3.2 qwen-flash qwen-flash-character qwen-plus qwen-plus-latest qwen-plus-character qwen-plus-character-ja qwen3-max qwen3-max-preview qwen3-coder-plus qwen3-coder-flash qwen3-coder-next qwen3-vl-32b-instruct qwen3-vl-32b-thinking qwen3-vl-30b-a3b-instruct qwen3-vl-30b-a3b-thinking qwen3-235b-a22b qwen3.5-plus qwen3.5-flash qwen3.5-27b qwen3.5-35b-a3b qwen3.5-122b-a10b qwen3.5-397b-a17b qwen3.6-plus qwen3.6-flash qwen3.6-35b-a3b

Default"gpt-5.3-chat"
messages*array<object>

The context passed to the large language model, arranged in conversation order. Each element in the array is a message object.

[]?object
content*string|array<object>

Message Content

role*string

Message Role

Default"user"
Value in"user" | "system" | "assistant" | "tool"
partial?boolean

Whether to enable prefix continuation. (Used for assistant role messages) Optional values: true: enable; false: disable.

tool_calls?array<object>

After initiating Function Calling, the returned tool and input parameter information contains one or more objects and is obtained from the tool_calls field in the previous model response. (Used for assistant role messages)

[]?object
id*string

The ID of the tool response.

type*string

Tool type, currently only 'function' is supported.

function*object

Tools and Input Parameter Information.

name*string

Tool Name.

arguments*string

Input parameter information, formatted as a JSON string.

index*integer

The index of the current tool information in the tool_calls array.

tool_call_id?string

The ID returned after initiating Function Calling, obtained via completion.choices[0].message.tool_calls[$index].id, is used to identify the tool corresponding to the Tool Message. (Used for tool role messages)

stream?boolean

Whether to stream the response, default is false; false: the model returns the entire content at once after generation; true: streams the output as it is generated, returning a data chunk for each generated segment. These chunks must be read sequentially in real time to assemble the complete response.

Defaultfalse
stream_options?object

Configuration options for streaming output, effective only when stream is true.

include_usage?boolean

Whether to include Token usage information in the last data chunk of the response. Valid values: true: Include; false: Do not include. During streaming output, Token usage information can only appear in the last data chunk of the response.

modalities?array<string>

Output data modality, applicable only to the Qwen-Omni model. The default value is ["text"].

[]?string
audio?object

The voice and format of the output audio are applicable only to the Qwen-Omni model, and the modalities parameter must be set to ["text","audio"].

voice*string

The timbre of the output audio.

format*string

Output audio format, only wav is supported.

temperature?number

Sampling temperature controls the diversity of the text generated by the model. The higher the temperature, the more diverse the generated text; conversely, the more deterministic the generated text. Value range: [0, 2)

top_p?number

The probability threshold for nucleus sampling, controlling the diversity of text generated by the model.

top_k?integer

Specifies the number of candidate tokens to consider for sampling during generation. A larger value results in more random output, while a smaller value makes the output more deterministic. 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.

presence_penalty?number

Controls the degree of content repetition during text generation.

response_format?object

Format of the Returned Content

type*string

The format of the returned content. Valid values: text: outputs a text response; json_object: outputs a standard JSON string; json_schema: outputs a JSON string in a specified format.

json_schema?object

When type is json_schema, this field is required and is used to define the configuration for structured output.

name*string

The unique identifier name of the schema.

description?string

Describe the purpose of the Schema to help the model understand the semantic context of the output.

schema?string

A JSON Schema-compliant object that defines the data structure of the model output.

strict?boolean

Controls whether to force the model to strictly adhere to all constraints of the Schema.

max_tokens?integerDeprecated

Used to limit the maximum number of tokens in the model output.

max_completion_tokens?integer

Used to limit the maximum number of tokens in the model output.

vl_high_resolution_images?boolean

Whether to increase the maximum pixel limit for input images to the pixel count corresponding to 16384 tokens.

n?integer

The number of responses to generate, with a value range of 1-4.

Default3
enable_thinking?boolean

Whether to enable thinking mode when using a hybrid thinking model (which can either reason or skip reasoning before responding).

thinking_budget?integer

Maximum number of tokens for the thinking process.

enable_code_interpreter?boolean

Whether to enable the Code Interpreter feature.

seed?integer

Random seed.

logprobs?boolean

Whether to return log probabilities of output tokens

top_logprobs?integer

Specify the number of candidate tokens with the highest probabilities to return at each generation step.

stop?string|array<string>

Used to specify stop words.

tools?array<object>

An array containing one or more tool objects for the model to invoke during Function Calling.

[]?object
type*string

Tool type, currently only function is supported.

function*object
name*string

Tool Name

description*string

Tool Description

parameters?object

The parameter description for the tool must be a valid JSON Schema.

tool_choice?string|object

Tool selection strategy. Set this parameter to enforce a specific tool calling method for certain types of queries, such as always using a particular tool or disabling all tools. Available values: auto: The model autonomously selects the tool strategy. none: Set the tool_choice parameter to none if no tool calls are desired; {"type": "function", "function": {"name": "the_function_to_call"}}: To force the invocation of a specific tool, set the tool_choice parameter to {"type": "function", "function": {"name": "the_function_to_call"}}, where the_function_to_call is the name of the specified tool function.

parallel_tool_calls?boolean

Whether to enable parallel tool calling.

enable_search?boolean

Whether to enable web search.

search_options?object

Web search strategies.

forced_search?boolean

Whether to force-enable web search, which takes effect only when enable_search is set to true.

search_strategy?string

Search volume strategy, effective only when enable_search is true.

enable_search_extension?boolean

Whether to enable vertical search, effective only when enable_search is true.

Response Body

application/json

Success

TypeScript Definitions

Use the response body type in TypeScript.

id*string

The unique identifier for this request.

choices*array<object>

An array of model-generated content.

[]?object
finish_reason*string

The reason the model stopped generating.

index*integer

The index of the current object in the choices array.

logprobs*object

Token probability information output by the model.

content*array<object>

An array containing each Token and its log probability.

[]?object
token*string

The text of the current Token.

bytes*array<string>

The list of UTF-8 raw bytes for the current Token, used to precisely reconstruct the output content (e.g., emojis or Chinese characters).

[]?string
logprob*number

The log probability of the current token. A return value of null indicates an extremely low probability.

top_logprobs*array<object>

The most likely candidate tokens at the current token position, with the count matching the request parameter top_logprobs.

[]?object
token*string

Candidate Token text.

bytes*array<string>

The list of raw UTF-8 bytes for the current Token, used to accurately reconstruct the output content (e.g., emojis or Chinese characters).

[]?string
logprob*string

The log probability of this candidate Token. A return value of null indicates an extremely low probability.

created*integer

Unix timestamp when the request was created (in seconds).

model*string

The model used for this request.

object*string

Always chat.completion.

service_tier*string

This parameter is currently fixed to null.

system_fingerprint*string

This parameter is currently fixed to null.

usage*object

Token consumption information for this request.

completion_tokens*integer

Number of tokens output by the model.

prompt_tokens*integer

Number of input tokens.

total_tokens*integer

The total number of tokens consumed is the sum of prompt_tokens and completion_tokens.

completion_tokens_details*object

Fine-grained classification of output tokens when using the Qwen-VL model.

audio_tokens*integer

This parameter is currently fixed to null.

reasoning_tokens*integer

This parameter is currently fixed to null.

text_tokens*integer

Number of tokens in the output text of the Qwen-VL model.

01KMSGQTATRB722TFAD8XP77SD?unknown
curl -X POST "https://api.ygw.ai/api/v1/chat/completions" \  -H "Authorization: string" \  -H "Content-Type: application/json" \  -d '{    "model": "gpt-5.3-chat",    "messages": [      {        "content": "Who are you?",        "role": "user"      }    ],    "stream": false,    "n": 3  }'
{
  "id": "string",
  "choices": [
    {
      "finish_reason": "string",
      "index": 0,
      "logprobs": {
        "content": [
          {
            "token": "string",
            "bytes": [
              "string"
            ],
            "logprob": 0,
            "top_logprobs": [
              {
                "token": "string",
                "bytes": [
                  "string"
                ],
                "logprob": "string"
              }
            ]
          }
        ]
      }
    }
  ],
  "created": 0,
  "model": "string",
  "object": "string",
  "service_tier": "string",
  "system_fingerprint": "string",
  "usage": {
    "completion_tokens": 0,
    "prompt_tokens": 0,
    "total_tokens": 0,
    "completion_tokens_details": {
      "audio_tokens": 0,
      "reasoning_tokens": 0,
      "text_tokens": 0,
      "01KMSGQTATRB722TFAD8XP77SD": null
    }
  }
}