> ## Documentation Index
> Fetch the complete documentation index at: https://evolink.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# GLM-5.2 - OpenAI Compatible API

> - Use the OpenAI Chat Completions protocol to call the GLM-5.2 model
- Synchronous processing mode, returning conversation content in real time
- **Plain-text conversation**: Single-turn or multi-turn contextual dialogue
- **System prompts**: Customize the AI's role and behavior via `role=system` messages
- **Deep thinking**: Toggle the chain of thought via `thinking.type`, and adjust reasoning intensity with `reasoning_effort`; the reasoning process is returned via `reasoning_content`
- **Streaming output**: Supports SSE streaming responses (`stream=true`)
- **Tool calling**: Supports Function Calling, knowledge base retrieval (retrieval), web search (web_search), and MCP (up to 128 tools)
- **Structured output**: Enable JSON mode via `response_format`

**Streaming response notes**: When `stream=true`, responses are returned via Server-Sent Events, with each message formatted as `data: {JSON}`, and `data: [DONE]` returned at the end. Each data chunk (`ChatCompletionChunk`) contains `id`, `created`, `model`, `choices`, and optional `usage` and `content_filter`; within it, `choices[].delta` incrementally returns `role` / `content` / `reasoning_content` / `tool_calls`, and `choices[].finish_reason` provides the termination reason in the final chunk.

<Note>
  **BaseURL**: The default BaseURL is `https://direct.evolink.ai`, which has better support for text models and long-lived connections. `https://api.evolink.ai` is the primary endpoint for multimodal services and serves as a fallback address for text models.
</Note>


## OpenAPI

````yaml en/api-manual/language-series/glm-5.2/glm-5.2-api.json POST /v1/chat/completions
openapi: 3.1.0
info:
  title: GLM-5.2 Complete API Reference (OpenAI-Compatible)
  description: >-
    Complete API reference for the GLM-5.2 chat interface.


    **Model Capabilities**:

    - Latest flagship model, featuring complex reasoning, ultra-long context,
    and exceptional inference speed

    - Maximum output: **131,072 tokens** (128K), recommended no less than
    **1,024 tokens**

    - Deep thinking: Toggle the chain of thought via the `thinking` field, and
    adjust reasoning intensity with `reasoning_effort` (exclusive to GLM-5.2)

    - Tool calling: Supports Function Calling, knowledge base retrieval, web
    search, and MCP (up to 128 tools)

    - Streaming output: Supports SSE streaming responses

    - Structured output: Supports both `text` and `json_object` response formats
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://direct.evolink.ai
    description: Production (Recommended)
  - url: https://api.evolink.ai
    description: Alternative URL
security:
  - bearerAuth: []
tags:
  - name: Chat Completion
    description: AI chat generation related interfaces
paths:
  /v1/chat/completions:
    post:
      tags:
        - Chat Completion
      summary: GLM-5.2 Chat Interface (OpenAI-Compatible)
      description: >-
        - Use the OpenAI Chat Completions protocol to call the GLM-5.2 model

        - Synchronous processing mode, returning conversation content in real
        time

        - **Plain-text conversation**: Single-turn or multi-turn contextual
        dialogue

        - **System prompts**: Customize the AI's role and behavior via
        `role=system` messages

        - **Deep thinking**: Toggle the chain of thought via `thinking.type`,
        and adjust reasoning intensity with `reasoning_effort`; the reasoning
        process is returned via `reasoning_content`

        - **Streaming output**: Supports SSE streaming responses (`stream=true`)

        - **Tool calling**: Supports Function Calling, knowledge base retrieval
        (retrieval), web search (web_search), and MCP (up to 128 tools)

        - **Structured output**: Enable JSON mode via `response_format`


        **Streaming response notes**: When `stream=true`, responses are returned
        via Server-Sent Events, with each message formatted as `data: {JSON}`,
        and `data: [DONE]` returned at the end. Each data chunk
        (`ChatCompletionChunk`) contains `id`, `created`, `model`, `choices`,
        and optional `usage` and `content_filter`; within it, `choices[].delta`
        incrementally returns `role` / `content` / `reasoning_content` /
        `tool_calls`, and `choices[].finish_reason` provides the termination
        reason in the final chunk.
      operationId: createChatCompletionGLM52
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
            examples:
              simple_text:
                summary: Single-turn text conversation
                value:
                  model: glm-5.2
                  messages:
                    - role: user
                      content: Please introduce yourself
              multi_turn:
                summary: Multi-turn conversation (contextual understanding)
                value:
                  model: glm-5.2
                  messages:
                    - role: user
                      content: What is Python?
                    - role: assistant
                      content: Python is a high-level programming language...
                    - role: user
                      content: What are its advantages?
              system_prompt:
                summary: Using a system prompt
                value:
                  model: glm-5.2
                  messages:
                    - role: system
                      content: >-
                        You are a professional Python programming assistant.
                        Answer questions in concise language.
                    - role: user
                      content: How do I read a file?
              deep_thinking:
                summary: Enable deep thinking and adjust reasoning intensity
                value:
                  model: glm-5.2
                  messages:
                    - role: user
                      content: >-
                        A farmer needs to take a wolf, a sheep, and a cabbage
                        across a river, but can only carry one at a time. How
                        can he get them across safely?
                  thinking:
                    type: enabled
                  reasoning_effort: max
              disable_thinking:
                summary: Disable deep thinking (answer directly)
                value:
                  model: glm-5.2
                  messages:
                    - role: user
                      content: Summarize the theory of relativity in one sentence.
                  thinking:
                    type: disabled
              function_calling:
                summary: Tool calling (Function Calling)
                value:
                  model: glm-5.2
                  messages:
                    - role: user
                      content: What's the weather like in Beijing today?
                  tools:
                    - type: function
                      function:
                        name: get_weather
                        description: Query the real-time weather of a specified city
                        parameters:
                          type: object
                          properties:
                            city:
                              type: string
                              description: 'City name, for example: Beijing'
                          required:
                            - city
                  tool_choice: auto
              web_search:
                summary: Enable the web search tool
                value:
                  model: glm-5.2
                  messages:
                    - role: user
                      content: >-
                        Help me find the latest artificial intelligence news
                        from the past week
                  tools:
                    - type: web_search
                      web_search:
                        enable: true
                        search_engine: search_pro
                        count: 10
                        search_recency_filter: oneWeek
              json_mode:
                summary: JSON structured output
                value:
                  model: glm-5.2
                  messages:
                    - role: system
                      content: >-
                        Please output in JSON format, including the two fields
                        name and age.
                    - role: user
                      content: John, 28 years old this year
                  response_format:
                    type: json_object
              streaming:
                summary: Streaming output (SSE)
                value:
                  model: glm-5.2
                  messages:
                    - role: user
                      content: Write a short poem about spring
                  stream: true
      responses:
        '200':
          description: Conversation generated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 400
                  message: Invalid request parameters
                  type: invalid_request_error
        '401':
          description: Unauthenticated, invalid or expired token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 401
                  message: Invalid or expired token
                  type: authentication_error
        '402':
          description: Insufficient quota, top-up required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 402
                  message: Insufficient quota
                  type: insufficient_quota_error
                  fallback_suggestion: https://evolink.ai/dashboard/billing
        '403':
          description: Access denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 403
                  message: Access denied for this model
                  type: permission_error
                  param: model
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 404
                  message: Specified model not found
                  type: not_found_error
                  param: model
                  fallback_suggestion: glm-5.2
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 429
                  message: Rate limit exceeded
                  type: rate_limit_error
                  fallback_suggestion: retry after 60 seconds
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 500
                  message: Internal server error
                  type: internal_server_error
                  fallback_suggestion: try again later
        '502':
          description: Upstream service error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 502
                  message: Upstream AI service unavailable
                  type: upstream_error
                  fallback_suggestion: try different model
        '503':
          description: Service temporarily unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 503
                  message: Service temporarily unavailable
                  type: service_unavailable_error
                  fallback_suggestion: retry after 30 seconds
components:
  schemas:
    ChatCompletionRequest:
      type: object
      required:
        - model
        - messages
      properties:
        model:
          type: string
          description: >-
            The model code to call


            - `glm-5.2`: Latest flagship model, offering complex reasoning,
            ultra-long context, and exceptional inference speed
          enum:
            - glm-5.2
          default: glm-5.2
          example: glm-5.2
        messages:
          type: array
          description: >-
            The list of conversation messages, containing the full context of
            the current conversation


            Supports four roles: `system`, `user`, `assistant`, `tool`. Messages
            of different roles have different field structures; please select
            the corresponding role to view details. Must contain at least 1
            message, and cannot consist solely of system or assistant messages.
          items:
            oneOf:
              - $ref: '#/components/schemas/SystemMessage'
              - $ref: '#/components/schemas/UserMessage'
              - $ref: '#/components/schemas/AssistantRequestMessage'
              - $ref: '#/components/schemas/ToolMessage'
            discriminator:
              propertyName: role
              mapping:
                system:
                  $ref: '#/components/schemas/SystemMessage'
                user:
                  $ref: '#/components/schemas/UserMessage'
                assistant:
                  $ref: '#/components/schemas/AssistantRequestMessage'
                tool:
                  $ref: '#/components/schemas/ToolMessage'
          minItems: 1
        stream:
          type: boolean
          description: >-
            Whether to enable streaming output mode


            - `false`: The model generates the complete response and returns it
            all at once (default), suitable for short text and batch processing

            - `true`: Returns chunks in real time via Server-Sent Events (SSE),
            suitable for chat and long text; returns `data: [DONE]` when the
            stream ends
          default: false
          example: false
        thinking:
          type: object
          description: Controls whether to enable the chain of thought (Chain of Thought)
          properties:
            type:
              type: string
              description: |-
                Chain-of-thought toggle

                - `enabled`: Enable deep thinking (default)
                - `disabled`: Disable deep thinking; the model answers directly
              enum:
                - enabled
                - disabled
              default: enabled
            clear_thinking:
              type: boolean
              description: >-
                Whether to clear the `reasoning_content` from previous
                conversation turns


                - `true` (default): Ignores/removes `reasoning_content` from
                previous turns, using only non-reasoning content
                (user/assistant-visible text, tool calls and results, etc.) as
                context, which can reduce context length and cost

                - `false`: Retains `reasoning_content` from previous turns and
                provides it to the model along with the context (Preserved
                Thinking); in this case, the historical `reasoning_content` must
                be passed through in `messages` **completely, unmodified, and in
                the original order**—missing, truncating, rewriting, or
                reordering it will degrade results or prevent it from taking
                effect

                - Note: This parameter only affects historical thinking across
                turns; it does not change whether thinking is produced in the
                current turn
              default: true
              example: true
        reasoning_effort:
          type: string
          description: >-
            Controls the model's reasoning intensity (exclusive to GLM-5.2)


            **Notes**:

            - Only takes effect when `thinking` is enabled; defaults to `max`

            - Values from strongest to weakest: `max` > `xhigh` > `high` >
            `medium` > `low` > `minimal` > `none`


            **GLM-5.2 mapping rules** (for compatibility with other protocols):

            - `xhigh` → equivalent to `max`

            - `low` / `medium` → equivalent to `high`

            - `none` / `minimal` → skip thinking (no deep reasoning)
          enum:
            - max
            - xhigh
            - high
            - medium
            - low
            - minimal
            - none
          default: max
          example: max
        do_sample:
          type: boolean
          description: >-
            Whether to enable the sampling strategy


            - `true` (default): Uses `temperature` / `top_p` for random
            sampling, producing more varied output

            - `false`: Always selects the highest-probability token (greedy
            decoding), producing more deterministic output; in this case
            `temperature` and `top_p` are ignored


            For tasks requiring consistency and reproducibility (such as code
            generation and translation), setting this to `false` is recommended
          default: true
          example: true
        temperature:
          type: number
          format: float
          description: >-
            Sampling temperature, controlling the randomness and creativity of
            the output


            **Notes**:

            - Value range: `[0.0, 1.0]`, limited to two decimal places

            - Higher values (e.g. 0.8): more random and creative, suitable for
            creative writing

            - Lower values (e.g. 0.2): more stable and deterministic, suitable
            for factual Q&A and code generation

            - GLM-5.2 default value: `1.0`


            **Recommendation**: Do not adjust both `temperature` and `top_p` at
            the same time
          minimum: 0
          maximum: 1
          default: 1
          example: 1
        top_p:
          type: number
          format: float
          description: >-
            Nucleus Sampling parameter, an alternative to `temperature` sampling


            **Notes**:

            - Value range: `[0.01, 1.0]`, limited to two decimal places

            - The model only considers candidate tokens whose cumulative
            probability reaches `top_p`; for example, 0.1 means only the top 10%
            probability tokens are considered

            - Smaller values produce more focused and consistent output; larger
            values increase diversity

            - GLM-5.2 default value: `0.95`


            **Recommendation**: Do not adjust both `temperature` and `top_p` at
            the same time
          minimum: 0.01
          maximum: 1
          default: 0.95
          example: 0.95
        max_tokens:
          type: integer
          description: >-
            The maximum number of tokens limit for the model's output


            **Notes**:

            - GLM-5.2 supports up to **131,072 tokens** (128K) of output length;
            setting no less than `1024` is recommended

            - When `thinking` is enabled, chain-of-thought tokens are also
            counted toward this limit

            - If generation is truncated due to `length`, try increasing this
            value
          minimum: 1
          maximum: 131072
          example: 1024
        tools:
          type: array
          description: >-
            The list of tools the model can call


            **Notes**:

            - Supports function calling (`function`), knowledge base retrieval
            (`retrieval`), web search (`web_search`), and MCP (`mcp`)

            - Supports up to 128 functions
          items:
            oneOf:
              - $ref: '#/components/schemas/FunctionTool'
              - $ref: '#/components/schemas/RetrievalTool'
              - $ref: '#/components/schemas/WebSearchTool'
              - $ref: '#/components/schemas/McpTool'
            discriminator:
              propertyName: type
              mapping:
                function:
                  $ref: '#/components/schemas/FunctionTool'
                retrieval:
                  $ref: '#/components/schemas/RetrievalTool'
                web_search:
                  $ref: '#/components/schemas/WebSearchTool'
                mcp:
                  $ref: '#/components/schemas/McpTool'
          maxItems: 128
        tool_choice:
          type: string
          description: >-
            Controls how the model selects which function to call


            **Notes**: Only takes effect when the tool type is `function`;
            defaults to and only supports `auto` (the model automatically
            decides whether to call a tool)
          enum:
            - auto
          default: auto
          example: auto
        stop:
          type: array
          description: >-
            The list of stop words


            **Notes**:

            - When the generated text encounters a specified string, generation
            stops immediately (the stop word itself is not included in the
            returned text)

            - Currently only a single stop word is supported, in the format
            `["stop_word1"]`, for example `["Human:"]`
          items:
            type: string
          maxItems: 4
          example:
            - 'Human:'
        response_format:
          type: object
          description: >-
            Specifies the model's response output format; defaults to `text`


            **Notes**:

            - `{ "type": "json_object" }` enables JSON mode, and the model
            returns valid JSON-formatted data, suitable for scenarios such as
            structured data extraction

            - When using JSON mode, it is recommended to explicitly request JSON
            output in the `system` or `user` message
          required:
            - type
          properties:
            type:
              type: string
              description: |-
                Output format type

                - `text`: Plain text output (default)
                - `json_object`: JSON-formatted output
              enum:
                - text
                - json_object
              default: text
        request_id:
          type: string
          description: >-
            Unique request identifier


            **Notes**:

            - Passed by the client, 6-64 characters long; using UUID format is
            recommended to ensure uniqueness

            - If not provided, the platform will generate one automatically
          minLength: 6
          maxLength: 64
          example: req-7f3a2c1e8b9d4f0a
        user_id:
          type: string
          description: >-
            Unique identifier of the end user


            **Notes**: 6-128 characters long; using a unique identifier that
            does not contain sensitive information is recommended, which can
            help the platform monitor and detect abusive behavior
          minLength: 6
          maxLength: 128
          example: user-abc123456
    ChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
          description: Task `ID`
          example: chatcmpl-a6613b56-c61c-94ba-9a9f-43d4cdc7d77a
        object:
          type: string
          description: Response type
          enum:
            - chat.completion
          example: chat.completion
        request_id:
          type: string
          description: Request `ID` (returned when `request_id` is provided in the request)
          example: req-7f3a2c1e8b9d4f0a
        created:
          type: integer
          description: Request creation time, `Unix` timestamp (seconds)
          example: 1777021417
        model:
          type: string
          description: Model name
          example: glm-5.2
        choices:
          type: array
          description: The list of model responses
          items:
            $ref: '#/components/schemas/Choice'
        usage:
          $ref: '#/components/schemas/Usage'
        web_search:
          type: array
          description: >-
            Web search-related information, returned when the `web_search` tool
            is used and a search is triggered
          items:
            $ref: '#/components/schemas/WebSearchResult'
        content_filter:
          type: array
          description: Content safety-related information
          items:
            $ref: '#/components/schemas/ContentFilter'
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
              description: HTTP status error code
            message:
              type: string
              description: Error description message
            type:
              type: string
              description: Error type
            param:
              type: string
              description: Related parameter name
            fallback_suggestion:
              type: string
              description: Suggestion when an error occurs
    SystemMessage:
      title: System Message
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - system
          description: Role identifier, fixed as `system`
        content:
          type: string
          description: System prompt content, used to set the AI's role and behavior
    UserMessage:
      title: User Message
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - user
          description: Role identifier, fixed as `user`
        content:
          type: string
          description: User message content (plain text string)
    AssistantRequestMessage:
      title: Assistant Message
      type: object
      description: Assistant message, may contain tool calls
      required:
        - role
      properties:
        role:
          type: string
          enum:
            - assistant
          description: Role identifier, fixed as `assistant`
        content:
          type:
            - string
            - 'null'
          description: >-
            Assistant message content


            **Notes**: Used to pass historical assistant replies in multi-turn
            conversations; typically `null` when `tool_calls` is present
        reasoning_content:
          type:
            - string
            - 'null'
          description: >-
            Historical chain-of-thought content


            **Notes**: Required only when `thinking.clear_thinking=false`
            (Preserved Thinking); pass back the `reasoning_content` from the
            previous response as-is; by default (`clear_thinking=true`) no
            passback is needed
        tool_calls:
          type: array
          description: >-
            The list of tool calls


            Used to pass historical tool call information in multi-turn
            conversations; when this field is provided, `content` is typically
            empty
          items:
            type: object
            required:
              - id
              - type
            properties:
              id:
                type: string
                description: Tool call ID
              type:
                type: string
                enum:
                  - function
                  - web_search
                  - retrieval
                description: Tool type
              function:
                type: object
                description: Function call information, not empty when `type` is `function`
                required:
                  - name
                  - arguments
                properties:
                  name:
                    type: string
                    description: Function name
                  arguments:
                    type: string
                    description: Function arguments (JSON-formatted string)
    ToolMessage:
      title: Tool Message
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - tool
          description: Role identifier, fixed as `tool`
        content:
          type: string
          description: The content of the tool call's returned result
        tool_call_id:
          type: string
          description: >-
            Indicates the tool call `ID` this message corresponds to (matching
            the `id` returned in the assistant message's `tool_calls`)
    FunctionTool:
      title: Function Tool
      type: object
      required:
        - type
        - function
      additionalProperties: false
      properties:
        type:
          type: string
          enum:
            - function
          default: function
          description: Tool type, fixed as `function`
        function:
          type: object
          required:
            - name
            - description
            - parameters
          properties:
            name:
              type: string
              description: >-
                The name of the function to call


                **Notes**: Must consist of the characters `a-z`, `A-Z`, `0-9`,
                or contain underscores and dashes; maximum length 64 characters
              minLength: 1
              maxLength: 64
              pattern: ^[a-zA-Z0-9_-]+$
            description:
              type: string
              description: >-
                A description of the function's capability, for the model to
                choose when and how to call the function
            parameters:
              type: object
              description: >-
                The function's input parameters, described as a JSON Schema
                object
    RetrievalTool:
      title: Retrieval Tool (Knowledge Base Retrieval)
      type: object
      required:
        - type
        - retrieval
      additionalProperties: false
      properties:
        type:
          type: string
          enum:
            - retrieval
          default: retrieval
          description: Tool type, fixed as `retrieval`
        retrieval:
          type: object
          required:
            - knowledge_id
          properties:
            knowledge_id:
              type: string
              description: Knowledge base `ID`, created or obtained from the platform
            prompt_template:
              type: string
              description: >-
                The prompt template used to request the model, a custom template
                containing the placeholders `{{ knowledge }}` and `{{ question
                }}`; the default template is used when not provided
    WebSearchTool:
      title: Web Search Tool (Web Search)
      type: object
      required:
        - type
        - web_search
      additionalProperties: false
      properties:
        type:
          type: string
          enum:
            - web_search
          default: web_search
          description: Tool type, fixed as `web_search`
        web_search:
          type: object
          required:
            - search_engine
          properties:
            enable:
              type: boolean
              description: Whether to enable the search feature; set to `true` to enable
              default: false
            search_engine:
              type: string
              description: Search engine type, defaults to `search_std`
              enum:
                - search_std
                - search_pro
                - search_pro_sogou
                - search_pro_quark
            search_query:
              type: string
              description: Custom keyword that forcibly triggers a search
            search_intent:
              type: string
              description: >-
                Whether to perform search intent recognition; performed by
                default


                - `true`: Perform search intent recognition, and run the search
                once a search intent is detected

                - `false`: Skip intent recognition and run the search directly
            count:
              type: integer
              description: >-
                The number of results to return, ranging `1-50`, defaults to
                `10` (supported by `search_std` / `search_pro` /
                `search_pro_sogou`)
              minimum: 1
              maximum: 50
              default: 10
            search_domain_filter:
              type: string
              description: >-
                Domain allowlist that limits the search results (e.g.
                `www.example.com`)
            search_recency_filter:
              type: string
              description: >-
                Limits the time range of the search results, defaults to
                `noLimit`
              enum:
                - oneDay
                - oneWeek
                - oneMonth
                - oneYear
                - noLimit
              default: noLimit
            content_size:
              type: string
              description: >-
                Controls the word count of web page summaries, defaults to
                `medium`


                - `medium`: Returns summary information, meeting basic reasoning
                needs

                - `high`: Maximizes context with more detailed information
              enum:
                - medium
                - high
              default: medium
            result_sequence:
              type: string
              description: >-
                The position where search results are returned (before or after
                the model's reply), defaults to `after`
              enum:
                - before
                - after
              default: after
            search_result:
              type: boolean
              description: >-
                Whether to return detailed information about the search sources,
                defaults to `false`
              default: false
            require_search:
              type: boolean
              description: >-
                Whether to require that the answer be returned based on search
                results, defaults to `false`
              default: false
            search_prompt:
              type: string
              description: >-
                The `Prompt` used to customize the processing of search results;
                the default template is used when not provided
    McpTool:
      title: MCP Tool
      type: object
      required:
        - type
        - mcp
      additionalProperties: false
      properties:
        type:
          type: string
          enum:
            - mcp
          default: mcp
          description: Tool type, fixed as `mcp`
        mcp:
          type: object
          required:
            - server_label
          properties:
            server_label:
              type: string
              description: >-
                MCP server label; when connecting to a built-in MCP server on
                the platform, fill in the corresponding mcp code, and there is
                no need to fill in `server_url`
            server_url:
              type: string
              description: MCP server address
            transport_type:
              type: string
              description: Transport type
              enum:
                - sse
                - streamable-http
              default: streamable-http
            allowed_tools:
              type: array
              description: The set of tools allowed to be called
              items:
                type: string
            headers:
              type: object
              description: The authentication information required by the MCP server
    Choice:
      type: object
      properties:
        index:
          type: integer
          description: Result index
          example: 0
        message:
          $ref: '#/components/schemas/AssistantMessage'
        finish_reason:
          type: string
          description: >-
            The reason inference terminated


            - `stop`: Natural completion or a stop word was triggered

            - `tool_calls`: The model triggered a function (tool call)

            - `length`: Reached the token length limit

            - `sensitive`: Content was blocked by safety review (please assess
            and decide whether to retract public content)

            - `network_error`: Model inference error

            - `model_context_window_exceeded`: Exceeded the model's context
            window
          enum:
            - stop
            - tool_calls
            - length
            - sensitive
            - network_error
            - model_context_window_exceeded
          example: stop
    Usage:
      type: object
      description: Token usage statistics returned when the call ends
      properties:
        prompt_tokens:
          type: integer
          description: The number of tokens in the user input
          example: 24
        completion_tokens:
          type: integer
          description: >-
            The number of output tokens (including the chain-of-thought
            `reasoning_tokens` portion)
          example: 346
        total_tokens:
          type: integer
          description: Total token count = prompt_tokens + completion_tokens
          example: 370
        prompt_tokens_details:
          type: object
          description: Detailed breakdown of input tokens
          properties:
            cached_tokens:
              type: integer
              description: The number of tokens that hit the cache
              example: 0
        completion_tokens_details:
          type: object
          description: Detailed breakdown of output tokens
          properties:
            reasoning_tokens:
              type: integer
              description: >-
                The number of tokens produced by the chain of thought (deep
                thinking), counted toward `completion_tokens`
              example: 321
    WebSearchResult:
      type: object
      description: A single web search result
      properties:
        icon:
          type: string
          description: The icon of the source website
        title:
          type: string
          description: The title of the search result
        link:
          type: string
          description: The web page link of the search result
        media:
          type: string
          description: The media source name of the search result web page
        publish_date:
          type: string
          description: The website's publish time
        content:
          type: string
          description: The cited text content of the search result web page
        refer:
          type: string
          description: Superscript number
    ContentFilter:
      type: object
      description: Content safety information
      properties:
        role:
          type: string
          description: |-
            The stage where safety takes effect

            - `assistant`: Model inference
            - `user`: User input
            - `history`: Historical context
          enum:
            - assistant
            - user
            - history
        level:
          type: integer
          description: >-
            Severity level `0-3`, where `0` indicates the most severe and `3`
            indicates minor
          minimum: 0
          maximum: 3
    AssistantMessage:
      type: object
      properties:
        role:
          type: string
          description: The current conversation role, defaults to `assistant`
          enum:
            - assistant
          example: assistant
        content:
          type:
            - string
            - 'null'
          description: >-
            Conversation text content


            **Notes**: May be `null` when calling tools (`tool_calls`);
            otherwise returns the model's reply content
          example: >-
            Hello! I'm GLM-5.2, and I can help you with a variety of tasks such
            as conversation, reasoning, writing, and code.
        reasoning_content:
          type: string
          description: >-
            Chain-of-thought content


            **Notes**: Returned when `thinking` is enabled, recording the
            model's reasoning process
          example: Let me first analyze this problem...
        tool_calls:
          type: array
          description: >-
            Generated tool call information (returned when the model decides to
            call a tool)
          items:
            type: object
            properties:
              id:
                type: string
                description: The unique identifier of the tool call
              type:
                type: string
                description: Tool call type
                enum:
                  - function
                  - mcp
              function:
                type: object
                description: >-
                  Function call information (containing the generated function
                  name and JSON-formatted arguments)
                properties:
                  name:
                    type: string
                    description: The generated function name
                  arguments:
                    type: string
                    description: >-
                      The JSON-formatted string of function call arguments;
                      please validate the arguments before calling the function
              mcp:
                type: object
                description: MCP tool call parameters (returned when `type=mcp`)
                properties:
                  id:
                    type: string
                    description: The unique identifier of the MCP tool call
                  type:
                    type: string
                    description: MCP call type
                    enum:
                      - mcp_list_tools
                      - mcp_call
                  server_label:
                    type: string
                    description: MCP server label
                  error:
                    type: string
                    description: Error message
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        ##All interfaces require authentication using a Bearer Token##


        **Get an API Key**:


        Visit the [API Key management page](https://evolink.ai/dashboard/keys)
        to obtain your API Key


        **Add it to the request header when using**:

        ```

        Authorization: Bearer YOUR_API_KEY

        ```

````