{
  "openapi": "3.0.1",
  "info": {
    "title": "ZHIPU AI API",
    "description": "ZHIPU AI 接口提供强大的 AI 能力，包括聊天对话、工具调用和视频生成。",
    "license": {
      "name": "ZHIPU AI 开发者协议和政策",
      "url": "https://chat.z.ai/legal-agreement/terms-of-service"
    },
    "version": "1.0.0",
    "contact": {
      "name": "Z.AI 开发者",
      "url": "https://chat.z.ai/legal-agreement/privacy-policy",
      "email": "user_feedback@z.ai"
    }
  },
  "tags": [
    {
      "name": "模型 API",
      "description": "Chat API"
    },
    {
      "name": "工具 API",
      "description": "Web Search API"
    },
    {
      "name": "Agent API",
      "description": "Agent API"
    },
    {
      "name": "文件 API",
      "description": "File API"
    },
    {
      "name": "知识库 API",
      "description": "Knowledge API"
    },
    {
      "name": "实时 API",
      "description": "Realtime API"
    },
    {
      "name": "批处理 API",
      "description": "Batch API"
    },
    {
      "name": "助理 API",
      "description": "Assistant API"
    },
    {
      "name": "智能体 API（旧）",
      "description": "QingLiu Agent API"
    }
  ],
  "servers": [
    {
      "url": "https://open.bigmodel.cn/api/",
      "description": "开放平台服务"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/paas/v4/chat/completions": {
      "post": {
        "tags": [
          "模型 API"
        ],
        "summary": "对话补全",
        "description": "和 [指定模型](/cn/guide/start/model-overview) 对话，模型根据请求给出响应。支持多种模型，支持多模态（文本、图片、音频、视频、文件），流式和非流式输出，可配置采样，温度，最大令牌数，工具调用等。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "title": "文本模型",
                    "$ref": "#/components/schemas/ChatCompletionTextRequest"
                  },
                  {
                    "title": "视觉模型",
                    "$ref": "#/components/schemas/ChatCompletionVisionRequest"
                  },
                  {
                    "title": "音频模型",
                    "$ref": "#/components/schemas/ChatCompletionAudioRequest"
                  },
                  {
                    "title": "角色模型",
                    "$ref": "#/components/schemas/ChatCompletionHumanOidRequest"
                  }
                ]
              },
              "examples": {
                "基础调用示例": {
                  "value": {
                    "model": "glm-5.2",
                    "messages": [
                      {
                        "role": "system",
                        "content": "你是编程助手，擅长写简洁高效的代码。"
                      },
                      {
                        "role": "user",
                        "content": "写一个 Python 函数，计算斐波那契数列第 n 项。"
                      }
                    ],
                    "temperature": 1.0,
                    "stream": false
                  }
                },
                "流式调用示例": {
                  "value": {
                    "model": "glm-5.2",
                    "messages": [
                      {
                        "role": "user",
                        "content": "请写一个Python函数，计算两个数的和。"
                      }
                    ],
                    "temperature": 1.0,
                    "stream": true
                  }
                },
                "深度思考示例": {
                  "value": {
                    "model": "glm-5.2",
                    "messages": [
                      {
                        "role": "user",
                        "content": "请写一个Python函数，计算两个数的和。"
                      }
                    ],
                    "thinking": {
                      "type": "enabled"
                    },
                    "stream": true
                  }
                },
                "多轮对话示例": {
                  "value": {
                    "model": "glm-5.2",
                    "messages": [
                      {
                        "role": "system",
                        "content": "你是一个专业的编程助手"
                      },
                      {
                        "role": "user",
                        "content": "什么是递归？"
                      },
                      {
                        "role": "assistant",
                        "content": "递归是一种编程技术，函数调用自身来解决问题..."
                      },
                      {
                        "role": "user",
                        "content": "能给我一个 Python 递归的例子吗？"
                      }
                    ],
                    "stream": true
                  }
                },
                "图片理解示例": {
                  "value": {
                    "model": "glm-5v-turbo",
                    "messages": [
                      {
                        "role": "user",
                        "content": [
                          {
                            "type": "image_url",
                            "image_url": {
                              "url": "https://cdn.bigmodel.cn/static/logo/register.png"
                            }
                          },
                          {
                            "type": "image_url",
                            "image_url": {
                              "url": "https://cdn.bigmodel.cn/static/logo/api-key.png"
                            }
                          },
                          {
                            "type": "text",
                            "text": "What are the pics talk about"
                          }
                        ]
                      }
                    ]
                  }
                },
                "视频理解示例": {
                  "value": {
                    "model": "glm-5v-turbo",
                    "messages": [
                      {
                        "role": "user",
                        "content": [
                          {
                            "type": "video_url",
                            "video_url": {
                              "url": "https://cdn.bigmodel.cn/agent-demos/lark/113123.mov"
                            }
                          },
                          {
                            "type": "text",
                            "text": "What are the video show about?"
                          }
                        ]
                      }
                    ]
                  }
                },
                "文件理解示例": {
                  "value": {
                    "model": "glm-5v-turbo",
                    "messages": [
                      {
                        "role": "user",
                        "content": [
                          {
                            "type": "file_url",
                            "file_url": {
                              "url": "https://cdn.bigmodel.cn/static/demo/demo2.txt"
                            }
                          },
                          {
                            "type": "file_url",
                            "file_url": {
                              "url": "https://cdn.bigmodel.cn/static/demo/demo1.pdf"
                            }
                          },
                          {
                            "type": "text",
                            "text": "What are the files show about?"
                          }
                        ]
                      }
                    ]
                  }
                },
                "音频对话示例": {
                  "value": {
                    "model": "glm-4-voice",
                    "messages": [
                      {
                        "role": "user",
                        "content": [
                          {
                            "type": "text",
                            "text": "你好，这是我的语音输入测试，请慢速复述一遍"
                          },
                          {
                            "type": "input_audio",
                            "input_audio": {
                              "data": "base64_voice_xxx",
                              "format": "wav"
                            }
                          }
                        ]
                      }
                    ]
                  }
                },
                "Function Call 示例": {
                  "value": {
                    "model": "glm-5.2",
                    "messages": [
                      {
                        "role": "user",
                        "content": "今天北京的天气怎么样？"
                      }
                    ],
                    "tools": [
                      {
                        "type": "function",
                        "function": {
                          "name": "get_weather",
                          "description": "获取指定城市的天气信息",
                          "parameters": {
                            "type": "object",
                            "properties": {
                              "city": {
                                "type": "string",
                                "description": "城市名称"
                              }
                            },
                            "required": [
                              "city"
                            ]
                          }
                        }
                      }
                    ],
                    "tool_choice": "auto",
                    "temperature": 0.3
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletionResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletionChunk"
                }
              }
            }
          },
          "default": {
            "description": "请求失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/async/chat/completions": {
      "post": {
        "tags": [
          "模型 API"
        ],
        "summary": "对话补全(异步)",
        "description": "和 [指定模型](/cn/guide/start/model-overview) 对话，通过查询异步结果获取模型响应。支持多种模型，支持多模态（文本、图片、音频、视频、文件），可配置采样，温度，最大令牌数，工具调用等。注意此为异步接口，通过 [查询异步结果](/api-reference/%E6%A8%A1%E5%9E%8B-api/%E6%9F%A5%E8%AF%A2%E5%BC%82%E6%AD%A5%E7%BB%93%E6%9E%9C) 获取生成结果。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "title": "文本模型",
                    "$ref": "#/components/schemas/AsyncChatCompletionTextRequest"
                  },
                  {
                    "title": "视觉模型",
                    "$ref": "#/components/schemas/AsyncChatCompletionVisionRequest"
                  },
                  {
                    "title": "音频模型",
                    "$ref": "#/components/schemas/AsyncChatCompletionAudioRequest"
                  },
                  {
                    "title": "角色模型",
                    "$ref": "#/components/schemas/AsyncChatCompletionHumanOidRequest"
                  }
                ]
              },
              "examples": {
                "基础调用示例": {
                  "value": {
                    "model": "glm-5.2",
                    "messages": [
                      {
                        "role": "system",
                        "content": "你是编程助手，擅长写简洁高效的代码。"
                      },
                      {
                        "role": "user",
                        "content": "写一个 Python 函数，计算斐波那契数列第 n 项。"
                      }
                    ],
                    "temperature": 1.0
                  }
                },
                "深度思考示例": {
                  "value": {
                    "model": "glm-5.2",
                    "messages": [
                      {
                        "role": "user",
                        "content": "写一个 Python 函数，计算斐波那契数列第 n 项。"
                      }
                    ],
                    "thinking": {
                      "type": "enabled"
                    }
                  }
                },
                "多轮对话示例": {
                  "value": {
                    "model": "glm-5.2",
                    "messages": [
                      {
                        "role": "system",
                        "content": "你是一个专业的编程助手"
                      },
                      {
                        "role": "user",
                        "content": "什么是递归？"
                      },
                      {
                        "role": "assistant",
                        "content": "递归是一种编程技术，函数调用自身来解决问题..."
                      },
                      {
                        "role": "user",
                        "content": "能给我一个 Python 递归的例子吗？"
                      }
                    ]
                  }
                },
                "图片理解示例": {
                  "value": {
                    "model": "glm-5v-turbo",
                    "messages": [
                      {
                        "role": "user",
                        "content": [
                          {
                            "type": "image_url",
                            "image_url": {
                              "url": "https://cdn.bigmodel.cn/static/logo/register.png"
                            }
                          },
                          {
                            "type": "image_url",
                            "image_url": {
                              "url": "https://cdn.bigmodel.cn/static/logo/api-key.png"
                            }
                          },
                          {
                            "type": "text",
                            "text": "What are the pics talk about?"
                          }
                        ]
                      }
                    ]
                  }
                },
                "视频理解示例": {
                  "value": {
                    "model": "glm-5v-turbo",
                    "messages": [
                      {
                        "role": "user",
                        "content": [
                          {
                            "type": "video_url",
                            "video_url": {
                              "url": "https://cdn.bigmodel.cn/agent-demos/lark/113123.mov"
                            }
                          },
                          {
                            "type": "text",
                            "text": "What are the video show about?"
                          }
                        ]
                      }
                    ]
                  }
                },
                "文件理解示例": {
                  "value": {
                    "model": "glm-5v-turbo",
                    "messages": [
                      {
                        "role": "user",
                        "content": [
                          {
                            "type": "file_url",
                            "file_url": {
                              "url": "https://cdn.bigmodel.cn/static/demo/demo2.txt"
                            }
                          },
                          {
                            "type": "file_url",
                            "file_url": {
                              "url": "https://cdn.bigmodel.cn/static/demo/demo1.pdf"
                            }
                          },
                          {
                            "type": "text",
                            "text": "What are the files show about?"
                          }
                        ]
                      }
                    ]
                  }
                },
                "音频对话示例": {
                  "value": {
                    "model": "glm-4-voice",
                    "messages": [
                      {
                        "role": "user",
                        "content": [
                          {
                            "type": "text",
                            "text": "你好，这是我的语音输入测试，请慢速复述一遍"
                          },
                          {
                            "type": "input_audio",
                            "input_audio": {
                              "data": "base64_voice_xxx",
                              "format": "wav"
                            }
                          }
                        ]
                      }
                    ]
                  }
                },
                "Function Call 示例": {
                  "value": {
                    "model": "glm-5.2",
                    "messages": [
                      {
                        "role": "user",
                        "content": "今天北京的天气怎么样？"
                      }
                    ],
                    "tools": [
                      {
                        "type": "function",
                        "function": {
                          "name": "get_weather",
                          "description": "获取指定城市的天气信息",
                          "parameters": {
                            "type": "object",
                            "properties": {
                              "city": {
                                "type": "string",
                                "description": "城市名称"
                              }
                            },
                            "required": [
                              "city"
                            ]
                          }
                        }
                      }
                    ],
                    "tool_choice": "auto",
                    "temperature": 0.3
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AsyncResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/videos/generations": {
      "post": {
        "tags": [
          "模型 API"
        ],
        "summary": "视频生成(异步)",
        "description": "通过调用 [视频模型](/cn/guide/models/video-generation/cogvideox-3) 能力生成视频内容。支持多种视频生成方式，包括文本转视频、图像转视频等。注意此为异步接口，通过 [查询异步结果](/api-reference/%E6%A8%A1%E5%9E%8B-api/%E6%9F%A5%E8%AF%A2%E5%BC%82%E6%AD%A5%E7%BB%93%E6%9E%9C) 获取生成视频结果。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "title": "CogVideoX-3",
                    "$ref": "#/components/schemas/CogVideoX3Request"
                  },
                  {
                    "title": "CogVideoX",
                    "$ref": "#/components/schemas/CogVideoXRequest"
                  },
                  {
                    "title": "Vidu: Text to Video",
                    "$ref": "#/components/schemas/ViduText2VideoRequest"
                  },
                  {
                    "title": "Vidu: Image to Video",
                    "$ref": "#/components/schemas/ViduImage2VideoRequest"
                  },
                  {
                    "title": "Vidu: First & Last Frame to Video",
                    "$ref": "#/components/schemas/ViduFrames2VideoRequest"
                  },
                  {
                    "title": "Vidu: Ref to Video",
                    "$ref": "#/components/schemas/ViduReference2VideoRequest"
                  }
                ]
              },
              "examples": {
                "文生视频示例": {
                  "value": {
                    "model": "cogvideox-3",
                    "prompt": "A cat is playing with a ball.",
                    "quality": "quality",
                    "with_audio": true,
                    "size": "1920x1080",
                    "fps": 30
                  }
                },
                "图生视频示例": {
                  "value": {
                    "model": "cogvideox-3",
                    "image_url": "https://img.iplaysoft.com/wp-content/uploads/2019/free-images/free_stock_photo.jpg",
                    "prompt": "让画面动起来",
                    "quality": "quality",
                    "with_audio": true,
                    "size": "1920x1080",
                    "fps": 30
                  }
                },
                "首尾帧生示例": {
                  "value": {
                    "model": "cogvideox-3",
                    "image_url": [
                      "https://cdn.bigmodel.cn/markdown/1752547801491cogvideo4.png",
                      "https://cdn.bigmodel.cn/markdown/1752547813297cogvideo5.png"
                    ],
                    "prompt": "让画面动起来",
                    "quality": "quality",
                    "with_audio": true,
                    "size": "1920x1080",
                    "fps": 30
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AsyncResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/async/images/generations": {
      "post": {
        "tags": [
          "模型 API"
        ],
        "summary": "图像生成(异步)",
        "description": "使用 [GLM-Image](/cn/guide/models/image-generation/glm-image) 系列模型从文本提示生成高质量图像。通过对用户文字描述快速、精准的理解，让 `AI` 的图像表达更加精确和个性化。仅支持 `GLM-Image` 模型。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AsyncCreateImageRequest"
              },
              "examples": {
                "图像生成示例": {
                  "value": {
                    "model": "glm-image",
                    "prompt": "一只可爱的小猫咪，坐在阳光明媚的窗台上，背景是蓝天白云.",
                    "size": "1280x1280"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AsyncResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/async-result/{id}": {
      "get": {
        "tags": [
          "模型 API"
        ],
        "summary": "查询异步结果",
        "description": "查询对话补全和视频生成异步请求的处理结果和状态。点击 **Try it** 按钮可快速试用。",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "任务 ID。"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "title": "对话补全",
                      "$ref": "#/components/schemas/ChatCompletionResponse"
                    },
                    {
                      "title": "视频生成",
                      "$ref": "#/components/schemas/AsyncVideoGenerationResponse"
                    },
                    {
                      "title": "图像生成",
                      "$ref": "#/components/schemas/AsyncImageGenerationResponse"
                    }
                  ]
                }
              },
              "text/event-stream": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletionChunk"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/images/generations": {
      "post": {
        "tags": [
          "模型 API"
        ],
        "summary": "图像生成",
        "description": "使用 [GLM-Image](/cn/guide/models/image-generation/glm-image) 等系列模型从文本提示生成高质量图像。通过对用户文字描述快速、精准的理解，让 `AI` 的图像表达更加精确和个性化。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateImageRequest"
              },
              "examples": {
                "图像生成示例": {
                  "value": {
                    "model": "glm-image",
                    "prompt": "一只可爱的小猫咪，坐在阳光明媚的窗台上，背景是蓝天白云.",
                    "size": "1280x1280"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageGenerationResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/audio/transcriptions": {
      "post": {
        "tags": [
          "模型 API"
        ],
        "summary": "语音转文本",
        "description": "使用 [GLM-ASR-2512](/cn/guide/models/sound-and-video/glm-asr-2512) 模型将音频文件转录为文本，支持多语言和实时流式转录。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/AudioTranscriptionRequest"
              },
              "example": {
                "model": "glm-asr-2512",
                "stream": false
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudioTranscriptionResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "$ref": "#/components/schemas/AudioTranscriptionStreamResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/audio/speech": {
      "post": {
        "tags": [
          "模型 API"
        ],
        "summary": "文本转语音",
        "description": "使用 `GLM-TTS` 将文本转换为自然语音，支持多种声音、情感控制和语调调整。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AudioSpeechRequest"
              },
              "examples": {
                "文本转语音示例": {
                  "value": {
                    "model": "glm-tts",
                    "input": "你好，今天天气怎么样.",
                    "voice": "tongtong",
                    "response_format": "wav"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功 \n - 采样率建议设置为24000",
            "content": {
              "audio/wav": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/voice/clone": {
      "post": {
        "tags": [
          "模型 API"
        ],
        "summary": "音色复刻",
        "description": "使用音色复刻技术，基于示例音频生成指定音色、文本内容的语音合成。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VoiceCloneRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VoiceCloneResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/voice/list": {
      "get": {
        "tags": [
          "模型 API"
        ],
        "summary": "音色列表",
        "description": "获取音色列表，支持按音色名称模糊搜索、按音色类型过滤。点击 **Try it** 按钮可快速试用。",
        "parameters": [
          {
            "name": "voiceName",
            "in": "query",
            "description": "音色名称, 如果传入中文, 需要 url encode",
            "schema": {
              "type": "string"
            },
            "required": false
          },
          {
            "name": "voiceType",
            "in": "query",
            "description": "音色类型",
            "schema": {
              "type": "string",
              "enum": [
                "PRIVATE",
                "OFFICIAL"
              ]
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VoiceListResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/voice/delete": {
      "post": {
        "tags": [
          "模型 API"
        ],
        "summary": "删除音色",
        "description": "删除指定的音色。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VoiceSaveRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VoiceSaveResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/embeddings": {
      "post": {
        "tags": [
          "模型 API"
        ],
        "summary": "文本嵌入",
        "description": "使用 [GLM Embedding](/cn/guide/models/embedding/embedding-3) 系列模型将文本转换为高维向量表示，用于语义相似性和搜索。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmbeddingCreateRequest"
              },
              "examples": {
                "文本嵌入示例": {
                  "value": {
                    "model": "embedding-3",
                    "input": "你好，今天天气怎么样.",
                    "dimensions": 2
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmbeddingResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/rerank": {
      "post": {
        "tags": [
          "模型 API"
        ],
        "summary": "文本重排序",
        "description": "`Rerank` 用于文本重排序，通过接收用户的查询文本及候选文本列表，使用模型计算候选文本与查询文本的相关性得分并返回分数。适用于智能问答、信息检索等场景。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RerankRequest"
              },
              "examples": {
                "文本重排序示例": {
                  "value": {
                    "model": "rerank",
                    "query": "查询候选文本A",
                    "top_n": 4,
                    "documents": [
                      "需要打分的候选文本A",
                      "需要打分的候选文本B"
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RerankResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/tokenizer": {
      "post": {
        "tags": [
          "模型 API"
        ],
        "summary": "文本分词器",
        "description": "`Tokenizer` 用于将文本切分为模型可识别的 `token` 并计算数量。它接收用户输入的文本，通过模型进行分词处理，最终返回对应的 `token` 数量。适用于文本长度评估、模型输入预估、对话上下文截断、费用计算等。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TokenizerRequest"
              },
              "examples": {
                "文本分词示例": {
                  "value": {
                    "model": "glm-5.2",
                    "messages": [
                      {
                        "role": "user",
                        "content": "What opportunities and challenges will the Chinese large model industry face in 2025?"
                      }
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenizerResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/layout_parsing": {
      "post": {
        "tags": [
          "模型 API"
        ],
        "summary": "文档解析",
        "description": "使用 [GLM-OCR](/cn/guide/models/vlm/glm-ocr) 模型解析文档和图片的布局并提取文本内容。支持图片和`PDF`文档的`OCR`识别，返回详细的布局信息和可视化结果。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LayoutParsingRequest"
              },
              "examples": {
                "布局解析示例": {
                  "value": {
                    "model": "glm-ocr",
                    "file": "https://cdn.bigmodel.cn/static/logo/introduction.png"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LayoutParsingResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/web_search": {
      "post": {
        "tags": [
          "工具 API"
        ],
        "summary": "网络搜索",
        "description": "`Web Search API` 是一个专给大模型用的搜索引擎，在传统搜索引擎网页读取、排序的能力基础上，增强了意图识别能力，返回更适合大模型处理的结果（网页标题、`URL`、摘要、名称、图标等）。支持意图增强检索、结构化输出和多引擎支持。见 [网络搜索服务](/cn/guide/tools/web-search)。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebSearchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebSearchResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。可能的错误码：1701-网络搜索并发已达上限，请稍后重试或减少并发请求；1702-系统未找到可用的搜索引擎服务，请检查配置或联系管理员；1703-搜索引擎未返回有效数据，请调整查询条件。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/reader": {
      "post": {
        "tags": [
          "工具 API"
        ],
        "summary": "网页阅读",
        "description": "读取并解析指定 `URL` 的网页内容，可选择返回格式、支持控制缓存、图片保留与摘要选项等。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReaderRequest"
              },
              "examples": {
                "Basic": {
                  "value": {
                    "url": "https://www.example.com"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReaderResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/moderations": {
      "post": {
        "tags": [
          "工具 API"
        ],
        "summary": "内容安全",
        "description": "可对文本、图片、音频、视频格式类型的内容进行检测，精准识别涉黄、涉暴、违法违规等风险内容，并输出结构化审核结果（包括内容类型、风险类型及具体风险内容片段），快速定位和处理违规信息。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModerationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModerationResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents": {
      "post": {
        "tags": [
          "Agent API"
        ],
        "summary": "智能体对话",
        "description": "与智能体进行对话交互。支持同步和流式调用，提供智能体的专业能力。见 [智能体文档](/cn/guide/agents/translation)。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/async-result": {
      "post": {
        "tags": [
          "Agent API"
        ],
        "summary": "异步结果",
        "description": "查询智能体异步任务的处理结果和状态。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "async_id",
                  "agent_id"
                ],
                "properties": {
                  "async_id": {
                    "type": "string",
                    "description": "任务ID",
                    "example": "VHJhbnNsYXRvckVudGl0eVRhc2s6OTI5OTY5"
                  },
                  "agent_id": {
                    "type": "string",
                    "description": "智能体ID",
                    "example": "intelligent_education_correction_polling"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentAsyncResultResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agents/conversation": {
      "post": {
        "tags": [
          "Agent API"
        ],
        "summary": "对话历史",
        "description": "查询智能体对话历史，现仅支持 `slides_glm_agent` 智能体。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GlmSlideAgentConversationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GlmSlideAgentConversationResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/files": {
      "post": {
        "tags": [
          "文件 API"
        ],
        "summary": "上传文件",
        "description": "上传用于 `Batch 任务`、`智能体` 等功能的文件。注意 `Try it` 功能仅支持小文件上传，实际支持的文件大小请参见下文 `purpose` 相关说明。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/FileUploadRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileObject"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "文件 API"
        ],
        "summary": "文件列表",
        "description": "获取已上传文件的分页列表，支持按用途和排序过滤。点击 **Try it** 按钮可快速试用。",
        "parameters": [
          {
            "name": "after",
            "in": "query",
            "description": "分页游标",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "purpose",
            "in": "query",
            "description": "按用途过滤文件",
            "schema": {
              "type": "string",
              "enum": [
                "batch",
                "code-interpreter",
                "agent"
              ]
            },
            "required": true
          },
          {
            "name": "order",
            "in": "query",
            "description": "排序方式",
            "schema": {
              "type": "string",
              "enum": [
                "created_at"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "每页返回的文件数量",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileListResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/files/{file_id}": {
      "delete": {
        "tags": [
          "文件 API"
        ],
        "summary": "删除文件",
        "description": "永久删除指定文件及其所有关联数据。点击 **Try it** 按钮可快速试用。",
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "description": "文件唯一标识符",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileDeletedResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/files/{file_id}/content": {
      "get": {
        "tags": [
          "文件 API"
        ],
        "summary": "文件内容",
        "description": "获取文件内容。只支持 `batch` 文件类型。点击 **Try it** 按钮可快速试用。",
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "description": "被请求的文件的唯一标识符，用于指定要获取内容的特定文件。",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "请求成功，返回文件字节流。",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/files/parser/create": {
      "post": {
        "tags": [
          "工具 API"
        ],
        "summary": "文件解析",
        "description": "创建文件解析任务，支持多种文件格式和解析工具。见 [文件解析服务](/cn/guide/tools/file-parser)。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "待解析文件"
                  },
                  "tool_type": {
                    "type": "string",
                    "enum": [
                      "lite",
                      "expert",
                      "prime"
                    ],
                    "description": "使用的解析工具类型"
                  },
                  "file_type": {
                    "type": "string",
                    "enum": [
                      "PDF",
                      "DOCX",
                      "DOC",
                      "XLS",
                      "XLSX",
                      "PPT",
                      "PPTX",
                      "PNG",
                      "JPG",
                      "JPEG",
                      "CSV",
                      "TXT",
                      "MD",
                      "HTML",
                      "BMP",
                      "GIF",
                      "WEBP",
                      "HEIC",
                      "EPS",
                      "ICNS",
                      "IM",
                      "PCX",
                      "PPM",
                      "TIFF",
                      "XBM",
                      "HEIF",
                      "JP2"
                    ],
                    "description": "文件类型。Lite支持：pdf,docx,doc,xls,xlsx,ppt,pptx,png,jpg,jpeg,csv,txt,md。Expert支持：pdf。Prime支持：pdf,docx,doc,xls,xlsx,ppt,pptx,png,jpg,jpeg,csv,txt,md,html,bmp,gif,webp,heic,eps,icns,im,pcx,ppm,tiff,xbm,heif,jp2"
                  }
                },
                "required": [
                  "file",
                  "tool_type"
                ]
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "任务创建成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "message": {
                      "type": "string",
                      "example": "任务创建成功"
                    },
                    "task_id": {
                      "type": "string",
                      "example": "task_123456789"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/files/parser/result/{taskId}/{format_type}": {
      "get": {
        "tags": [
          "工具 API"
        ],
        "summary": "解析结果",
        "description": "异步获取文件解析任务的结果，支持返回纯文本或下载链接格式。见 [文件解析服务](/cn/guide/tools/file-parser)。点击 **Try it** 按钮可快速试用。",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "description": "文件解析任务ID",
            "required": true,
            "schema": {
              "type": "string",
              "example": "task_123456789"
            }
          },
          {
            "name": "format_type",
            "in": "path",
            "description": "结果返回格式类型",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "text",
                "download_link"
              ],
              "example": "text"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "结果获取成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileParseResultResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/files/parser/sync": {
      "post": {
        "tags": [
          "工具 API"
        ],
        "summary": "文件解析(同步)",
        "description": "创建文件解析任务，支持多种文件格式和解析工具。见 [文件解析服务](/cn/guide/tools/file-parser)。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "待解析文件"
                  },
                  "tool_type": {
                    "type": "string",
                    "enum": [
                      "prime-sync"
                    ],
                    "description": "使用的解析工具类型"
                  },
                  "file_type": {
                    "type": "string",
                    "enum": [
                      "WPS",
                      "PDF",
                      "DOCX",
                      "DOC",
                      "XLS",
                      "XLSX",
                      "PPT",
                      "PPTX",
                      "PNG",
                      "JPG",
                      "JPEG",
                      "CSV",
                      "TXT",
                      "MD",
                      "HTML",
                      "BMP",
                      "GIF",
                      "WEBP",
                      "HEIC",
                      "EPS",
                      "ICNS",
                      "IM",
                      "PCX",
                      "PPM",
                      "TIFF",
                      "XBM",
                      "HEIF",
                      "JP2"
                    ],
                    "description": "文件类型支持：pdf,docx,doc,xls,xlsx,ppt,pptx,png,jpg,jpeg,csv,txt,md,html,bmp,gif,webp,heic,eps,icns,im,pcx,ppm,tiff,xbm,heif,jp2"
                  }
                },
                "required": [
                  "file",
                  "tool_type"
                ]
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "结果获取成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileParseResultResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/files/ocr": {
      "post": {
        "tags": [
          "工具 API"
        ],
        "summary": "OCR 服务",
        "description": "上传图片文件，使用指定工具类型进行 OCR（光学字符识别），支持手写体、文字等识别模式，见 [OCR 服务](/cn/guide/tools/zhipu-ocr)。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "待识别的图片文件（如 JPG、PNG）"
                  },
                  "tool_type": {
                    "type": "string",
                    "enum": [
                      "hand_write"
                    ],
                    "description": "OCR识别工具类型，可选 hand_write（手写体识别）"
                  },
                  "language_type": {
                    "type": "string",
                    "enum": [
                      "CHN_ENG",
                      "AUTO",
                      "ENG",
                      "JAP",
                      "KOR",
                      "FRE",
                      "SPA",
                      "POR",
                      "GER",
                      "ITA",
                      "RUS",
                      "DAN",
                      "DUT",
                      "MAL",
                      "SWE",
                      "IND",
                      "POL",
                      "ROM",
                      "TUR",
                      "GRE",
                      "HUN",
                      "THA",
                      "VIE",
                      "ARA",
                      "HIN"
                    ],
                    "description": "语言/识别模型类型，可选 CHN_ENG等"
                  },
                  "probability": {
                    "type": "boolean",
                    "example": true,
                    "default": false,
                    "description": "是否返回置信度（概率）信息。true 为返回"
                  }
                },
                "required": [
                  "file",
                  "tool_type"
                ]
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "结果获取成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OCRResultResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/batches": {
      "post": {
        "tags": [
          "批处理 API"
        ],
        "summary": "创建批处理任务",
        "description": "创建一个新的批量处理任务。见 [批量服务](/cn/guide/tools/batch)。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "批处理 API"
        ],
        "summary": "列出批处理任务",
        "description": "获取批量处理任务列表，支持分页。见 [批量服务](/cn/guide/tools/batch)。点击 **Try it** 按钮可快速试用。",
        "parameters": [
          {
            "name": "after",
            "in": "query",
            "description": "分页游标，用于获取指定ID之后的结果",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "返回结果的最大数量",
            "schema": {
              "type": "integer",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchListResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/batches/{batch_id}": {
      "get": {
        "tags": [
          "批处理 API"
        ],
        "summary": "检索批处理任务",
        "description": "根据批处理任务`ID`获取批量处理任务详情。见 [批量服务](/cn/guide/tools/batch)。点击 **Try it** 按钮可快速试用。",
        "parameters": [
          {
            "name": "batch_id",
            "in": "path",
            "required": true,
            "description": "批处理任务的唯一标识符。",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "请求成功，返回 Batch 对象。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/batches/{batch_id}/cancel": {
      "post": {
        "tags": [
          "批处理 API"
        ],
        "summary": "取消批处理任务",
        "description": "根据批处理任务`ID`取消正在运行的批量处理任务。见 [批量服务](/cn/guide/tools/batch)。点击 **Try it** 按钮可快速试用。",
        "parameters": [
          {
            "name": "batch_id",
            "in": "path",
            "required": true,
            "description": "批处理任务ID",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/llm-application/open/knowledge/retrieve": {
      "post": {
        "tags": [
          "知识库 API"
        ],
        "summary": "知识库检索",
        "description": "用于检索个人知识库，支持向量检索、关键词检索、混合检索，支持自定义重排模型。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KnowledgeRetrieveRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeRetrieveResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        }
      }
    },
    "/zrag/agent/chat": {
      "post": {
        "tags": [
          "Agent API"
        ],
        "summary": "问答 Agent 对话（流式）",
        "description": "基于 ReAct（Reasoning + Acting）推理引擎的流式对话接口。LLM 会根据用户问题自主决定是否调用工具（知识检索、查询重写等），并通过 SSE 实时推送思考过程、工具调用和最终回答。点击 **Try it** 按钮可快速试用。",
        "parameters": [
          {
            "name": "X-Session-Id",
            "in": "header",
            "description": "会话 ID，续聊时传入",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentChatRequest"
              },
              "example": {
                "messages": [
                  {
                    "role": "user",
                    "content": "公司的年假制度是什么？"
                  }
                ],
                "model": "glm-5v-turbo",
                "temperature": 0.2,
                "max_steps": 10,
                "retrieval": {
                  "know_ids": [
                    "123"
                  ],
                  "top_k": 8,
                  "top_n": 10,
                  "enable_rerank": false
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "SSE 流式响应，返回 AgentStreamEvent 事件流",
            "content": {
              "text/event-stream": {
                "schema": {
                  "$ref": "#/components/schemas/AgentStreamEvent"
                }
              }
            }
          },
          "default": {
            "description": "请求失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        }
      }
    },
    "/zrag/retrieval/retrieve": {
      "post": {
        "tags": [
          "知识库 API"
        ],
        "summary": "全模态知识库检索",
        "description": "用于检索全模态知识库，支持文本、图片、视频等多模态输入检索，支持向量检索、关键词检索、混合检索，支持查询重写、重排、QA干预等高级功能。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ZragRetrieveRequest"
              },
              "example": {
                "multimodal": true,
                "knows": [
                  {
                    "id": "1234567890"
                  }
                ],
                "query": "介绍一下小智",
                "multimodal_parts": [
                  {
                    "type": "image_url",
                    "url": "https://example.com/image.png"
                  }
                ],
                "top_k": 8,
                "top_n": 10,
                "recall_method": "mixed",
                "recall_ratio": 0.8,
                "messages": [
                  {
                    "role": "user",
                    "content": "你是谁"
                  },
                  {
                    "role": "assistant",
                    "content": "我是小智，一个智能助手"
                  }
                ]
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ZragRetrieveResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        }
      }
    },
    "/llm-application/open/knowledge": {
      "post": {
        "tags": [
          "知识库 API"
        ],
        "summary": "创建知识库",
        "description": "用于创建个人知识库，支持绑定向量化模型、设置名称、描述、背景色和图标。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KnowledgeCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeCreateResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "知识库 API"
        ],
        "summary": "知识库列表",
        "description": "获取个人知识库列表，支持分页。点击 **Try it** 按钮可快速试用。",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "页码，默认1",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "description": "每页数量，默认10",
            "schema": {
              "type": "integer",
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeListResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        }
      }
    },
    "/llm-application/open/knowledge/{id}": {
      "put": {
        "tags": [
          "知识库 API"
        ],
        "summary": "编辑知识库",
        "description": "用于编辑已经创建好的个人知识库，仅传入要修改的字段。点击 **Try it** 按钮可快速试用。",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "知识库id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KnowledgeEditRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeEditResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "知识库 API"
        ],
        "summary": "知识库详情",
        "description": "根据知识库`ID`获取个人知识库详情。点击 **Try it** 按钮可快速试用。",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "知识库id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeDetailResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "知识库 API"
        ],
        "summary": "删除知识库",
        "description": "根据知识库`ID`删除个人知识库。点击 **Try it** 按钮可快速试用。",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "知识库id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeDeleteResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        }
      }
    },
    "/llm-application/open/knowledge/capacity": {
      "get": {
        "tags": [
          "知识库 API"
        ],
        "summary": "知识库使用量",
        "description": "获取个人知识库的使用量详情，包括字数和字节数。点击 **Try it** 按钮可快速试用。",
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeCapacityResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        }
      }
    },
    "/llm-application/open/document": {
      "get": {
        "tags": [
          "知识库 API"
        ],
        "summary": "文档列表",
        "description": "获取指定知识库下的文档列表。点击 **Try it** 按钮可快速试用。",
        "parameters": [
          {
            "name": "knowledge_id",
            "in": "query",
            "required": true,
            "description": "知识库id",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "页码，默认1",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "description": "每页数量，默认10",
            "schema": {
              "type": "integer",
              "default": 10
            }
          },
          {
            "name": "word",
            "in": "query",
            "required": false,
            "description": "文档名称",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "请求成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeDocumentListResponse"
                },
                "example": {
                  "data": {
                    "list": [
                      {
                        "id": "12312121212",
                        "knowledge_type": 1,
                        "custom_separator": [
                          "\n"
                        ],
                        "sentence_size": 300,
                        "length": 0,
                        "word_num": 100,
                        "name": "",
                        "url": "",
                        "embedding_stat": 0,
                        "failInfo": {
                          "embedding_code": 10002,
                          "embedding_msg": "字数超出限制"
                        }
                      }
                    ],
                    "total": 1
                  },
                  "code": 200,
                  "message": "请求成功",
                  "timestamp": 1689649504996
                }
              }
            }
          },
          "default": {
            "description": "请求失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        }
      }
    },
    "/llm-application/open/document/upload_document/{id}": {
      "post": {
        "tags": [
          "知识库 API"
        ],
        "summary": "上传文件文档",
        "description": "向指定知识库上传文件类型文档，支持多种切片方式和回调。点击 **Try it** 按钮可快速试用。",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "知识库id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/DocumentUploadRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentUploadResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        }
      }
    },
    "/llm-application/open/document/upload_url": {
      "post": {
        "tags": [
          "知识库 API"
        ],
        "summary": "上传URL文档",
        "description": "上传`URL`类型的文档或网页作为内容填充知识库。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UploadUrlKnowledgeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "请求成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadUrlKnowledgeResponse"
                },
                "example": {
                  "data": {
                    "successInfos": [
                      {
                        "documentId": "122121212",
                        "url": "xxx.com"
                      },
                      {
                        "documentId": "12121212121",
                        "url": "xxx.com"
                      }
                    ],
                    "failedInfos": [
                      {
                        "url": "xxx.com",
                        "failReason": "不支持的文档类型"
                      }
                    ]
                  },
                  "code": 200,
                  "message": "请求成功",
                  "timestamp": 1689649504996
                }
              }
            }
          },
          "default": {
            "description": "请求失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        }
      }
    },
    "/llm-application/open/document/slice/image_list/{id}": {
      "post": {
        "tags": [
          "知识库 API"
        ],
        "summary": "解析文档图片",
        "description": "用于获取文件下解析到的图片序号和图片链接映射关系。点击 **Try it** 按钮可快速试用。",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "文档ID",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "请求成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeImageListResponse"
                },
                "example": {
                  "data": {
                    "images": [
                      {
                        "text": "【示意图序号_1829473032620613632_103】",
                        "cos_url": "https://cdn.bigmodel.cn/knowledge_pdf_image/de7163a7-c67f-4e33-8810-97a6d5a83378.png"
                      }
                    ]
                  },
                  "code": 200,
                  "message": "请求成功",
                  "timestamp": 1725070689634
                }
              }
            }
          },
          "default": {
            "description": "请求失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        }
      }
    },
    "/llm-application/open/document/{id}": {
      "get": {
        "tags": [
          "知识库 API"
        ],
        "summary": "文档详情",
        "description": "根据文档`ID`获取文档详情。点击 **Try it** 按钮可快速试用。",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "文档id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "请求成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnowledgeDocumentDetailResponse"
                },
                "example": {
                  "data": {
                    "id": "12121212121212",
                    "knowledge_type": 1,
                    "custom_separator": [
                      "\n"
                    ],
                    "sentence_size": 300,
                    "length": 0,
                    "word_num": 100,
                    "name": "",
                    "url": "",
                    "embedding_stat": 0,
                    "failInfo": {
                      "embedding_code": 10002,
                      "embedding_msg": "字数超出限制"
                    }
                  },
                  "code": 200,
                  "message": "请求成功",
                  "timestamp": 1689649504996
                }
              }
            }
          },
          "default": {
            "description": "请求失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "知识库 API"
        ],
        "summary": "删除文档",
        "description": "根据文档`ID`删除文档。点击 **Try it** 按钮可快速试用。",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "文档ID",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "请求成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteKnowledgeResponse"
                },
                "example": {
                  "code": 200,
                  "message": "请求成功",
                  "timestamp": 1689649504996
                }
              }
            }
          },
          "default": {
            "description": "请求失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        }
      }
    },
    "/llm-application/open/document/embedding/{id}": {
      "post": {
        "tags": [
          "知识库 API"
        ],
        "summary": "重新向量化",
        "description": "用于重新向量化文档（重试等操作）。同步返回成功表示调用成功，向量化完成后调用`callback_url`进行通知，也可调用知识详情接口获取结果。多用于`url`知识场景。点击 **Try it** 按钮可快速试用。",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "文档ID",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReEmbeddingRequest"
              }
            }
          },
          "required": false
        },
        "responses": {
          "200": {
            "description": "请求成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReEmbeddingResponse"
                },
                "example": {
                  "code": 200,
                  "message": "请求成功",
                  "timestamp": 1689649504996
                }
              }
            }
          },
          "default": {
            "description": "请求失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/assistant": {
      "post": {
        "tags": [
          "助理 API"
        ],
        "summary": "助手对话",
        "deprecated": true,
        "description": "与`AI`助手进行对话，支持流式和同步模式。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssistantRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssistantResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "流式响应数据"
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/assistant/list": {
      "post": {
        "tags": [
          "助理 API"
        ],
        "deprecated": true,
        "summary": "助手列表",
        "description": "查询指定的智能体助手列表信息，包括智能体助手的详细配置、工具和元数据。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssistantListRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "msg": {
                      "type": "string",
                      "example": "操作成功"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AssistantInfo"
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/paas/v4/assistant/conversation/list": {
      "post": {
        "tags": [
          "助理 API"
        ],
        "deprecated": true,
        "summary": "助手会话列表",
        "description": "查询指定智能体助手的会话列表，支持分页查询。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConversationListRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "业务处理成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "code": {
                      "type": "integer",
                      "example": 200
                    },
                    "msg": {
                      "type": "string",
                      "example": "操作成功"
                    },
                    "data": {
                      "$ref": "#/components/schemas/ConversationListResponse"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "请求失败。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/llm-application/open/v2/application/{app_id}/variables": {
      "get": {
        "tags": [
          "智能体 API（旧）"
        ],
        "deprecated": true,
        "summary": "获取智能体输入参数",
        "description": "获取指定智能体应用的输入参数列表。点击 **Try it** 按钮可快速试用。",
        "parameters": [
          {
            "name": "app_id",
            "in": "path",
            "required": true,
            "description": "智能体（应用）id，获取位置：我的智能体列表页面",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "请求成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationVariablesResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/llm-application/open/v2/application/file_upload": {
      "post": {
        "tags": [
          "智能体 API（旧）"
        ],
        "deprecated": true,
        "summary": "文件上传",
        "description": "上传文件到智能体（应用），同步返回上传结果。需通过文件解析状态接口获取解析结果。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "app_id": {
                    "type": "string",
                    "description": "智能体（应用）id"
                  },
                  "upload_unit_id": {
                    "type": "string",
                    "description": "上传文件组件id，文本类必须传，对话类临时文件不传"
                  },
                  "files": {
                    "type": "string",
                    "format": "binary",
                    "description": "支持多文件上传，files 字段可重复出现，每个文件单独作为一个 form-data 字段上传。示例：--form 'files=@\"/path/to/file1\"' --form 'files=@\"/path/to/file2\"'"
                  },
                  "conversation_id": {
                    "type": "string",
                    "description": "对话类型应用上传临时文件时需先通过创建新会话获得会话ID（对话类型上传临时文件时必传，文本类不传）"
                  },
                  "file_type": {
                    "type": "integer",
                    "description": "文件类型 1: excel 2: 文档 3: 音频 4: 图片 5: 视频"
                  }
                },
                "required": [
                  "app_id",
                  "files"
                ]
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "请求成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationFileUploadResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/llm-application/open/v2/application/file_stat": {
      "post": {
        "tags": [
          "智能体 API（旧）"
        ],
        "deprecated": true,
        "summary": "获取文件解析状态",
        "description": "获取指定文件的解析状态。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplicationFileStatRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "请求成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationFileStatResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/llm-application/open/v2/application/{app_id}/conversation": {
      "post": {
        "tags": [
          "智能体 API（旧）"
        ],
        "deprecated": true,
        "summary": "创建新会话",
        "description": "为指定智能体（应用）创建新会话，返回会话`ID`。点击 **Try it** 按钮可快速试用。",
        "parameters": [
          {
            "name": "app_id",
            "in": "path",
            "required": true,
            "description": "智能体（应用）id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "请求成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationConversationResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/llm-application/open/v3/application/invoke": {
      "post": {
        "tags": [
          "智能体 API（旧）"
        ],
        "deprecated": true,
        "summary": "推理接口",
        "description": "对话型或文本型应用推理接口，支持同步和流式`SSE`调用。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplicationInvokeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "请求成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationInvokeResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/llm-application/open/v2/application/slice_info": {
      "post": {
        "tags": [
          "智能体 API（旧）"
        ],
        "deprecated": true,
        "summary": "知识库切片引用位置信息",
        "description": "获取知识库切片引用的位置信息。点击 **Try it** 按钮可快速试用。",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplicationSliceInfoRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "请求成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplicationSliceInfoResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/llm-application/open/history_session_record/{app_id}/{conversation_id}": {
      "get": {
        "tags": [
          "智能体 API（旧）"
        ],
        "deprecated": true,
        "summary": "推荐问题接口",
        "description": "获取推荐问题列表。点击 **Try it** 按钮可快速试用。",
        "parameters": [
          {
            "name": "app_id",
            "in": "path",
            "required": true,
            "description": "应用id",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "conversation_id",
            "in": "path",
            "required": true,
            "description": "会话id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "请求成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HistorySessionRecordResponse"
                }
              }
            }
          },
          "default": {
            "description": "请求失败",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LlmApplicationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    }
  },
  "components": {
    "parameters": {
      "AcceptLanguage": {
        "name": "Accept-Language",
        "in": "header",
        "schema": {
          "type": "string",
          "description": "HTTP 请求头，用于告知服务器浏览器的首选语言列表，以便服务器返回最符合用户偏好的语言内容。",
          "default": "cn",
          "enum": [
            "en",
            "cn"
          ]
        }
      }
    },
    "schemas": {
      "ChatCompletionTextRequest": {
        "required": [
          "model",
          "messages"
        ],
        "type": "object",
        "description": "普通对话模型请求，支持纯文本对话和工具调用",
        "properties": {
          "model": {
            "type": "string",
            "description": "调用的模型代码。`GLM-5.2` 是最新的旗舰模型系列，提供了复杂推理、超长上下文、极致推理速度。",
            "example": "glm-5.2",
            "default": "glm-5.2",
            "enum": [
              "glm-5.2",
              "glm-5.1",
              "glm-5-turbo",
              "glm-5",
              "glm-4.7",
              "glm-4.7-flash",
              "glm-4.7-flashx",
              "glm-4.6",
              "glm-4.5-air",
              "glm-4.5-airx",
              "glm-4.5-flash",
              "glm-4-flash-250414",
              "glm-4-flashx-250414"
            ]
          },
          "messages": {
            "type": "array",
            "description": "对话消息列表，包含当前对话的完整上下文信息。每条消息都有特定的角色和内容，模型会根据这些消息生成回复。消息按时间顺序排列，支持四种角色：`system`（系统消息，用于设定`AI`的行为和角色）、`user`（用户消息，来自用户的输入）、`assistant`（助手消息，来自`AI`的回复）、`tool`（工具消息，工具调用的结果）。普通对话模型主要支持纯文本内容。注意不能只包含系统消息或助手消息。",
            "items": {
              "oneOf": [
                {
                  "title": "用户消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "user"
                      ],
                      "description": "消息作者的角色",
                      "default": "user"
                    },
                    "content": {
                      "type": "string",
                      "description": "文本消息内容",
                      "example": "What opportunities and challenges will the Chinese large model industry face in 2025?"
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                },
                {
                  "title": "系统消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "system"
                      ],
                      "description": "消息作者的角色",
                      "default": "system"
                    },
                    "content": {
                      "type": "string",
                      "description": "消息文本内容",
                      "example": "You are a helpful assistant."
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                },
                {
                  "title": "助手消息",
                  "type": "object",
                  "description": "可包含工具调用",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "assistant"
                      ],
                      "description": "消息作者的角色",
                      "default": "assistant"
                    },
                    "content": {
                      "type": "string",
                      "description": "文本消息内容",
                      "example": "I'll help you with that analysis."
                    },
                    "tool_calls": {
                      "type": "array",
                      "description": "模型生成的工具调用消息。当提供此字段时，`content`通常为空。",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "工具调用ID"
                          },
                          "type": {
                            "type": "string",
                            "description": "工具类型，支持 `web_search、retrieval、function`",
                            "enum": [
                              "function",
                              "web_search",
                              "retrieval"
                            ]
                          },
                          "function": {
                            "type": "object",
                            "description": "函数调用信息，当`type`为`function`时不为空",
                            "properties": {
                              "name": {
                                "type": "string",
                                "description": "函数名称"
                              },
                              "arguments": {
                                "type": "string",
                                "description": "函数参数，`JSON`格式字符串"
                              }
                            },
                            "required": [
                              "name",
                              "arguments"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "type"
                        ]
                      }
                    }
                  },
                  "required": [
                    "role"
                  ]
                },
                {
                  "title": "工具消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "tool"
                      ],
                      "description": "消息作者的角色",
                      "default": "tool"
                    },
                    "content": {
                      "type": "string",
                      "description": "消息文本内容",
                      "example": "Function executed successfully with result: ..."
                    },
                    "tool_call_id": {
                      "type": "string",
                      "description": "指示此消息对应的工具调用 `ID`"
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                }
              ]
            },
            "minItems": 1
          },
          "stream": {
            "type": "boolean",
            "example": false,
            "default": false,
            "description": "是否启用流式输出模式。默认值为 `false`。当设置为 `false` 时，模型会在生成完整响应后一次性返回所有内容，适合短文本生成和批处理场景。当设置为 `true` 时，模型会通过`Server-Sent Events (SSE)`流式返回生成的内容，用户可以实时看到文本生成过程，适合聊天对话和长文本生成场景，能提供更好的用户体验。流式输出结束时会返回 `data: [DONE]` 消息。"
          },
          "thinking": {
            "$ref": "#/components/schemas/ChatThinking"
          },
          "reasoning_effort": {
            "type": "string",
            "description": "控制模型的推理程度，`thinking` 开启时生效，默认 `max`。仅 `GLM-5.2` 支持，为保持和其他协议兼容，传入 `none` 或 `minimal` 模型会放弃思考；传入 `low` `medium` 将映射为 `high`；传入 `xhigh` 将映射为 `max`。",
            "example": "max",
            "default": "max",
            "enum": [
              "max",
              "xhigh",
              "high",
              "medium",
              "low",
              "minimal",
              "none"
            ]
          },
          "do_sample": {
            "type": "boolean",
            "example": true,
            "default": true,
            "description": "是否启用采样策略来生成文本。默认值为 `true`。当设置为 `true` 时，模型会使用 `temperature、top_p` 等参数进行随机采样，生成更多样化的输出；当设置为 `false` 时，模型总是选择概率最高的词汇，生成更确定性的输出，此时 `temperature` 和 `top_p` 参数将被忽略。对于需要一致性和可重复性的任务（如代码生成、翻译），建议设置为 `false`。"
          },
          "temperature": {
            "type": "number",
            "description": "采样温度，控制输出的随机性和创造性，取值范围为 `[0.0, 1.0]`，限两位小数。对于`GLM-5.2` `GLM-5.1` `GLM-5` `GLM-4.7` `GLM-4.6`系列默认值为 `1.0`，`GLM-4.5`系列默认值为 `0.6`，`GLM-4`系列默认值为 `0.75`。较高的值（如`0.8`）会使输出更随机、更具创造性，适合创意写作和头脑风暴；较低的值（如`0.2`）会使输出更稳定、更确定，适合事实性问答等场景。建议根据应用场景调整 `top_p` 或 `temperature` 参数，但不要同时调整两个参数。",
            "format": "float",
            "example": 1.0,
            "default": 1.0,
            "minimum": 0.0,
            "maximum": 1.0
          },
          "top_p": {
            "type": "number",
            "description": "核采样（`nucleus sampling`）参数，是`temperature`采样的替代方法，取值范围为 `[0.01, 1.0]`，限两位小数。对于`GLM-5.2` `GLM-5.1` `GLM-5` `GLM-4.7` `GLM-4.6` `GLM-4.5`系列默认值为 `0.95`，`GLM-4`系列默认值为 `0.9`。模型只考虑累积概率达到`top_p`的候选词汇。例如：`0.1`表示只考虑前`10%`概率的词汇，`0.9`表示考虑前`90%`概率的词汇。较小的值会产生更集中、更一致的输出；较大的值会增加输出的多样性。建议根据应用场景调整 `top_p` 或 `temperature` 参数，但不建议同时调整两个参数。",
            "format": "float",
            "example": 0.95,
            "default": 0.95,
            "minimum": 0.01,
            "maximum": 1.0
          },
          "max_tokens": {
            "type": "integer",
            "description": "模型输出的最大令牌`token`数量限制。`GLM-5.2` `GLM-5.1` `GLM-5` `GLM-4.7` `GLM-4.6`系列最大支持`128K`输出长度，`GLM-4.5`系列最大支持`96K`输出长度，建议设置不小于`1024`。令牌是文本的基本单位，通常`1`个令牌约等于`0.75`个英文单词或`1.5`个中文字符。设置合适的`max_tokens`可以控制响应长度和成本，避免过长的输出。如果模型在达到`max_tokens`限制前完成回答，会自然结束；如果达到限制，输出可能被截断。\n默认值和最大值等更多详见 [max_tokens 文档](/cn/guide/start/concept-param#max_tokens)",
            "example": 1024,
            "minimum": 1,
            "maximum": 131072
          },
          "tool_stream": {
            "type": "boolean",
            "example": false,
            "default": false,
            "description": "是否开启流式响应`Function Calls`，仅限`GLM-5.2` `GLM-5.1` `GLM-5` `GLM-5-Turbo` `GLM-4.7` `GLM-4.6`系列支持此参数，默认值`false`。参考 [工具流式输出](/cn/guide/capabilities/stream-tool)"
          },
          "tools": {
            "type": "array",
            "description": "模型可以调用的工具列表。支持函数调用、知识库检索和网络搜索。使用此参数提供模型可以生成 `JSON` 输入的函数列表或配置其他工具。最多支持 `128` 个函数。目前 `GLM-4` 系列已支持所有 `tools`，`GLM-4.5` 已支持 `web search` 和 `retrieval`。",
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/FunctionToolSchema"
                }
              },
              {
                "items": {
                  "$ref": "#/components/schemas/RetrievalToolSchema"
                }
              },
              {
                "items": {
                  "$ref": "#/components/schemas/WebSearchToolSchema"
                }
              },
              {
                "items": {
                  "$ref": "#/components/schemas/MCPToolSchema"
                }
              }
            ]
          },
          "tool_choice": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "auto"
                ],
                "description": "用于控制模型选择调用哪个函数的方式，仅在工具类型为`function`时补充。默认`auto`且仅支持`auto`。"
              }
            ],
            "description": "控制模型如何选择工具。"
          },
          "stop": {
            "type": "array",
            "description": "停止词列表，当模型生成的文本中遇到这些指定的字符串时会立即停止生成。目前仅支持单个停止词，格式为[\"stop_word1\"]。停止词不会包含在返回的文本中。这对于控制输出格式、防止模型生成不需要的内容非常有用，例如在对话场景中可以设置[\"Human:\"]来防止模型模拟用户发言。",
            "items": {
              "type": "string"
            },
            "maxItems": 4
          },
          "response_format": {
            "type": "object",
            "description": "指定模型的响应输出格式，默认为`text`，仅文本模型支持此字段。支持两种格式：{ \"type\": \"text\" } 表示普通文本输出模式，模型返回自然语言文本；{ \"type\": \"json_object\" } 表示`JSON`输出模式，模型会返回有效的`JSON`格式数据，适用于结构化数据提取、`API`响应生成等场景。使用`JSON`模式时，建议在提示词中明确说明需要`JSON`格式输出。",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "text",
                  "json_object"
                ],
                "default": "text",
                "description": "输出格式类型：`text`表示普通文本输出，`json_object`表示`JSON`格式输出"
              }
            },
            "required": [
              "type"
            ]
          },
          "request_id": {
            "type": "string",
            "description": "请求唯一标识符。由用户端传递，`ID`长度要求：最少`6`个字符，最多`64`个字符，建议使用`UUID`格式确保唯一性，若未提供平台将自动生成。",
            "minLength": 6,
            "maxLength": 64
          },
          "user_id": {
            "type": "string",
            "description": "终端用户的唯一标识符。`ID`长度要求：最少`6`个字符，最多`128`个字符，建议使用不包含敏感信息的唯一标识。",
            "minLength": 6,
            "maxLength": 128
          }
        }
      },
      "AsyncChatCompletionTextRequest": {
        "required": [
          "model",
          "messages"
        ],
        "type": "object",
        "description": "普通对话模型请求，支持纯文本对话和工具调用",
        "properties": {
          "model": {
            "type": "string",
            "description": "调用的模型代码。`GLM-5.2` 是最新的旗舰模型系列，提供了复杂推理、超长上下文、极致推理速度。",
            "example": "glm-5.2",
            "default": "glm-5.2",
            "enum": [
              "glm-5.2",
              "glm-5.1",
              "glm-5-turbo",
              "glm-5",
              "glm-4.7",
              "glm-4.6",
              "glm-4.5-air",
              "glm-4.5-airx",
              "glm-4.5-flash",
              "glm-4-flash-250414",
              "glm-4-flashx-250414"
            ]
          },
          "messages": {
            "type": "array",
            "description": "对话消息列表，包含当前对话的完整上下文信息。每条消息都有特定的角色和内容，模型会根据这些消息生成回复。消息按时间顺序排列，支持四种角色：`system`（系统消息，用于设定`AI`的行为和角色）、`user`（用户消息，来自用户的输入）、`assistant`（助手消息，来自`AI`的回复）、`tool`（工具消息，工具调用的结果）。普通对话模型主要支持纯文本内容。注意不能只包含系统消息或助手消息。",
            "items": {
              "oneOf": [
                {
                  "title": "用户消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "user"
                      ],
                      "description": "消息作者的角色",
                      "default": "user"
                    },
                    "content": {
                      "type": "string",
                      "description": "文本消息内容",
                      "example": "What opportunities and challenges will the Chinese large model industry face in 2025?"
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                },
                {
                  "title": "系统消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "system"
                      ],
                      "description": "消息作者的角色",
                      "default": "system"
                    },
                    "content": {
                      "type": "string",
                      "description": "消息文本内容",
                      "example": "You are a helpful assistant."
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                },
                {
                  "title": "助手消息",
                  "type": "object",
                  "description": "可包含工具调用",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "assistant"
                      ],
                      "description": "消息作者的角色",
                      "default": "assistant"
                    },
                    "content": {
                      "type": "string",
                      "description": "文本消息内容",
                      "example": "I'll help you with that analysis."
                    },
                    "tool_calls": {
                      "type": "array",
                      "description": "模型生成的工具调用消息。当提供此字段时，`content`通常为空。",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "工具调用ID"
                          },
                          "type": {
                            "type": "string",
                            "description": "工具类型，支持 `web_search、retrieval、function`",
                            "enum": [
                              "function",
                              "web_search",
                              "retrieval"
                            ]
                          },
                          "function": {
                            "type": "object",
                            "description": "函数调用信息，当`type`为`function`时不为空",
                            "properties": {
                              "name": {
                                "type": "string",
                                "description": "函数名称"
                              },
                              "arguments": {
                                "type": "string",
                                "description": "函数参数，`JSON`格式字符串"
                              }
                            },
                            "required": [
                              "name",
                              "arguments"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "type"
                        ]
                      }
                    }
                  },
                  "required": [
                    "role"
                  ]
                },
                {
                  "title": "工具消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "tool"
                      ],
                      "description": "消息作者的角色",
                      "default": "tool"
                    },
                    "content": {
                      "type": "string",
                      "description": "消息文本内容",
                      "example": "Function executed successfully with result: ..."
                    },
                    "tool_call_id": {
                      "type": "string",
                      "description": "指示此消息对应的工具调用 `ID`"
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                }
              ]
            },
            "minItems": 1
          },
          "thinking": {
            "$ref": "#/components/schemas/ChatThinking"
          },
          "reasoning_effort": {
            "type": "string",
            "description": "控制模型的推理程度，`thinking` 开启时生效，默认 `max`。仅 `GLM-5.2` 支持，为保持和其他协议兼容，传入 `none` 或 `minimal` 模型会放弃思考；传入 `low` `medium` 将映射为 `high`；传入 `xhigh` 将映射为 `max`。",
            "example": "max",
            "default": "max",
            "enum": [
              "max",
              "xhigh",
              "high",
              "medium",
              "low",
              "minimal",
              "none"
            ]
          },
          "do_sample": {
            "type": "boolean",
            "example": true,
            "default": true,
            "description": "是否启用采样策略来生成文本。默认值为 `true`。当设置为 `true` 时，模型会使用 `temperature、top_p` 等参数进行随机采样，生成更多样化的输出；当设置为 `false` 时，模型总是选择概率最高的词汇，生成更确定性的输出，此时 `temperature` 和 `top_p` 参数将被忽略。对于需要一致性和可重复性的任务（如代码生成、翻译），建议设置为 `false`。"
          },
          "temperature": {
            "type": "number",
            "description": "采样温度，控制输出的随机性和创造性，取值范围为 `[0.0, 1.0]`，限两位小数。对于`GLM-5.2` `GLM-5.1` `GLM-5` `GLM-5-Turbo` `GLM-4.7` `GLM-4.6`系列默认值为 `1.0`，`GLM-4.5`系列默认值为 `0.6`，`GLM-4`系列默认值为 `0.75`。较高的值（如`0.8`）会使输出更随机、更具创造性，适合创意写作和头脑风暴；较低的值（如`0.2`）会使输出更稳定、更确定，适合事实性问答等场景。建议根据应用场景调整 `top_p` 或 `temperature` 参数，但不要同时调整两个参数。",
            "format": "float",
            "example": 1.0,
            "default": 1.0,
            "minimum": 0.0,
            "maximum": 1.0
          },
          "top_p": {
            "type": "number",
            "description": "核采样（`nucleus sampling`）参数，是`temperature`采样的替代方法，取值范围为 `[0.01, 1.0]`，限两位小数。对于`GLM-5.2` `GLM-5.1` `GLM-5` `GLM-5-Turbo` `GLM-4.7` `GLM-4.6` `GLM-4.5`系列默认值为 `0.95`，`GLM-4`系列默认值为 `0.9`。模型只考虑累积概率达到`top_p`的候选词汇。例如：`0.1`表示只考虑前`10%`概率的词汇，`0.9`表示考虑前`90%`概率的词汇。较小的值会产生更集中、更一致的输出；较大的值会增加输出的多样性。建议根据应用场景调整 `top_p` 或 `temperature` 参数，但不建议同时调整两个参数。",
            "format": "float",
            "example": 0.95,
            "default": 0.95,
            "minimum": 0.01,
            "maximum": 1.0
          },
          "max_tokens": {
            "type": "integer",
            "description": "模型输出的最大令牌`token`数量限制。`GLM-5.2` `GLM-5.1` `GLM-5` `GLM-5-Turbo` `GLM-4.7` `GLM-4.6`系列最大支持`128K`输出长度，`GLM-4.5`最大支持`96K`输出长度，建议设置不小于`1024`。令牌是文本的基本单位，通常`1`个令牌约等于`0.75`个英文单词或`1.5`个中文字符。设置合适的`max_tokens`可以控制响应长度和成本，避免过长的输出。如果模型在达到`max_tokens`限制前完成回答，会自然结束；如果达到限制，输出可能被截断。\n默认值和最大值等更多详见 [max_tokens 文档](/cn/guide/start/concept-param#max_tokens)",
            "example": 1024,
            "minimum": 1,
            "maximum": 131072
          },
          "tools": {
            "type": "array",
            "description": "模型可以调用的工具列表。支持函数调用、知识库检索和网络搜索。使用此参数提供模型可以生成 `JSON` 输入的函数列表或配置其他工具。最多支持 `128` 个函数。目前 `GLM-4` 系列已支持所有 `tools`，`GLM-4.5` 已支持 `web search` 和 `retrieval`。",
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/FunctionToolSchema"
                }
              },
              {
                "items": {
                  "$ref": "#/components/schemas/RetrievalToolSchema"
                }
              },
              {
                "items": {
                  "$ref": "#/components/schemas/WebSearchToolSchema"
                }
              },
              {
                "items": {
                  "$ref": "#/components/schemas/MCPToolSchema"
                }
              }
            ]
          },
          "tool_choice": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "auto"
                ],
                "description": "用于控制模型选择调用哪个函数的方式，仅在工具类型为`function`时补充。默认`auto`且仅支持`auto`。"
              }
            ],
            "description": "控制模型如何选择工具。"
          },
          "stop": {
            "type": "array",
            "description": "停止词列表，当模型生成的文本中遇到这些指定的字符串时会立即停止生成。目前仅支持单个停止词，格式为[\"stop_word1\"]。停止词不会包含在返回的文本中。这对于控制输出格式、防止模型生成不需要的内容非常有用，例如在对话场景中可以设置[\"Human:\"]来防止模型模拟用户发言。",
            "items": {
              "type": "string"
            },
            "maxItems": 4
          },
          "response_format": {
            "type": "object",
            "description": "指定模型的响应输出格式，默认为`text`，仅文本模型支持此字段。支持两种格式：{ \"type\": \"text\" } 表示普通文本输出模式，模型返回自然语言文本；{ \"type\": \"json_object\" } 表示`JSON`输出模式，模型会返回有效的`JSON`格式数据，适用于结构化数据提取、`API`响应生成等场景。使用`JSON`模式时，建议在提示词中明确说明需要`JSON`格式输出。",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "text",
                  "json_object"
                ],
                "default": "text",
                "description": "输出格式类型：`text`表示普通文本输出，`json_object`表示`JSON`格式输出"
              }
            },
            "required": [
              "type"
            ]
          },
          "request_id": {
            "type": "string",
            "description": "请求唯一标识符。由用户端传递，`ID`长度要求：最少`6`个字符，最多`64`个字符，建议使用`UUID`格式确保唯一性，若未提供平台将自动生成。",
            "minLength": 6,
            "maxLength": 64
          },
          "user_id": {
            "type": "string",
            "description": "终端用户的唯一标识符。`ID`长度要求：最少`6`个字符，最多`128`个字符，建议使用不包含敏感信息的唯一标识。",
            "minLength": 6,
            "maxLength": 128
          }
        }
      },
      "ChatCompletionVisionRequest": {
        "required": [
          "model",
          "messages"
        ],
        "type": "object",
        "description": "视觉模型请求，支持多模态内容（文本、图片、视频、文件）",
        "properties": {
          "model": {
            "type": "string",
            "description": "调用的视觉模型代码。`GLM-5V-Turbo` 系列支持视觉理解，具备卓越的多模态理解能力和工具调用能力。`AutoGLM-Phone` 是手机智能助理模型。",
            "example": "glm-5v-turbo",
            "default": "glm-5v-turbo",
            "enum": [
              "glm-5v-turbo",
              "glm-4.6v",
              "autoglm-phone",
              "glm-4.6v-flash",
              "glm-4.6v-flashx",
              "glm-4v-flash",
              "glm-4.1v-thinking-flashx",
              "glm-4.1v-thinking-flash"
            ]
          },
          "messages": {
            "type": "array",
            "description": "对话消息列表，包含当前对话的完整上下文信息。每条消息都有特定的角色和内容，模型会根据这些消息生成回复。消息按时间顺序排列，支持角色：`system`（系统消息，用于设定`AI`的行为和角色）、`user`（用户消息，来自用户的输入）、`assistant`（助手消息，来自`AI`的回复）。视觉模型支持纯文本和多模态内容（文本、图片、视频、文件）。注意不能只包含系统或助手消息。",
            "items": {
              "oneOf": [
                {
                  "title": "用户消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "user"
                      ],
                      "description": "消息作者的角色",
                      "default": "user"
                    },
                    "content": {
                      "oneOf": [
                        {
                          "type": "array",
                          "description": "多模态消息内容，支持文本、图片、文件、视频（可从上方切换至文本消息）",
                          "items": {
                            "$ref": "#/components/schemas/VisionMultimodalContentItem"
                          }
                        },
                        {
                          "type": "string",
                          "description": "文本消息内容（可从上方切换至多模态消息）",
                          "example": "What opportunities and challenges will the Chinese large model industry face in 2025?"
                        }
                      ]
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                },
                {
                  "title": "系统消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "system"
                      ],
                      "description": "消息作者的角色",
                      "default": "system"
                    },
                    "content": {
                      "oneOf": [
                        {
                          "type": "string",
                          "description": "消息文本内容",
                          "example": "You are a helpful assistant."
                        }
                      ]
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                },
                {
                  "title": "助手消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "assistant"
                      ],
                      "description": "消息作者的角色",
                      "default": "assistant"
                    },
                    "content": {
                      "oneOf": [
                        {
                          "type": "string",
                          "description": "文本消息内容",
                          "example": "I'll help you with that analysis."
                        }
                      ]
                    }
                  },
                  "required": [
                    "role"
                  ]
                }
              ]
            },
            "minItems": 1
          },
          "stream": {
            "type": "boolean",
            "example": false,
            "default": false,
            "description": "是否启用流式输出模式。默认值为 `false`。当设置为 `false` 时，模型会在生成完整响应后一次性返回所有内容，适合短文本生成和批处理场景。当设置为 `true` 时，模型会通过`Server-Sent Events (SSE)`流式返回生成的内容，用户可以实时看到文本生成过程，适合聊天对话和长文本生成场景，能提供更好的用户体验。流式输出结束时会返回 `data: [DONE]` 消息。"
          },
          "thinking": {
            "$ref": "#/components/schemas/ChatThinking"
          },
          "do_sample": {
            "type": "boolean",
            "example": true,
            "default": true,
            "description": "是否启用采样策略来生成文本。默认值为 `true`。当设置为 `true` 时，模型会使用 `temperature、top_p` 等参数进行随机采样，生成更多样化的输出；当设置为 `false` 时，模型总是选择概率最高的词汇，生成更确定性的输出，此时 `temperature` 和 `top_p` 参数将被忽略。对于需要一致性和可重复性的任务（如代码生成、翻译），建议设置为 `false`。"
          },
          "temperature": {
            "type": "number",
            "description": "采样温度，控制输出的随机性和创造性，取值范围为 `[0.0, 1.0]`，限两位小数。对于`GLM-5V-Turbo`，`GLM-4.6V`, `GLM-4.5V`系列默认值为 `0.8`，`AutoGLM-Phone`默认值为 `0.0`，`GLM-4.1v`系列默认值为 `0.8`。较高的值（如`0.8`）会使输出更随机、更具创造性，适合创意写作和头脑风暴；较低的值（如`0.2`）会使输出更稳定、更确定，适合事实性问答等场景。建议根据应用场景调整 `top_p` 或 `temperature` 参数，但不要同时调整两个参数。",
            "format": "float",
            "example": 0.8,
            "default": 0.8,
            "minimum": 0.0,
            "maximum": 1.0
          },
          "top_p": {
            "type": "number",
            "description": "核采样（`nucleus sampling`）参数，是`temperature`采样的替代方法，取值范围为 `[0.01, 1.0]`，限两位小数。对于`GLM-5V-Turbo`，`GLM-4.6V`, `GLM-4.5V`系列默认值为 `0.6`，`AutoGLM-Phone`默认值为 `0.85`，`GLM-4.1v`系列默认值为 `0.6`。模型只考虑累积概率达到`top_p`的候选词汇。例如：`0.1`表示只考虑前`10%`概率的词汇，`0.9`表示考虑前`90%`概率的词汇。较小的值会产生更集中、更一致的输出；较大的值会增加输出的多样性。建议根据应用场景调整 `top_p` 或 `temperature` 参数，但不要同时调整两个参数。",
            "format": "float",
            "example": 0.6,
            "default": 0.6,
            "minimum": 0.01,
            "maximum": 1.0
          },
          "max_tokens": {
            "type": "integer",
            "description": "模型输出的最大令牌`token`数量限制。`GLM-5V-Turbo`最大支持`128K`输出长度，`GLM-4.6V`最大支持`32K`输出长度，`GLM-4.5V`最大支持`16K`输出长度，`AutoGLM-Phone`最大支持`4K`输出长度，`GLM-4.1v`系列最大支持`16K`输出长度，建议设置不小于`1024`。令牌是文本的基本单位，通常`1`个令牌约等于`0.75`个英文单词或`1.5`个中文字符。设置合适的`max_tokens`可以控制响应长度和成本，避免过长的输出。如果模型在达到`max_tokens`限制前完成回答，会自然结束；如果达到限制，输出可能被截断。\n默认值和最大值等更多详见 [max_tokens 文档](/cn/guide/start/concept-param#max_tokens)",
            "example": 1024,
            "minimum": 1,
            "maximum": 131072
          },
          "tools": {
            "type": "array",
            "description": "模型可以调用的工具列表。仅限`GLM-4.6V`和`AutoGLM-Phone`支持。使用此参数提供模型可以生成 `JSON` 输入的函数列表或配置其他工具。最多支持 `128` 个函数。",
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/FunctionToolSchema"
                }
              }
            ]
          },
          "tool_choice": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "auto"
                ],
                "description": "用于控制模型选择调用哪个函数的方式，仅在工具类型为`function`时补充，仅限`GLM-4.6V`支持此参数。默认`auto`且仅支持`auto`。"
              }
            ],
            "description": "控制模型如何选择工具。"
          },
          "stop": {
            "type": "array",
            "description": "停止词列表，当模型生成的文本中遇到这些指定的字符串时会立即停止生成。目前仅支持单个停止词，格式为[\"stop_word1\"]。停止词不会包含在返回的文本中。这对于控制输出格式、防止模型生成不需要的内容非常有用，例如在对话场景中可以设置[\"Human:\"]来防止模型模拟用户发言。",
            "items": {
              "type": "string"
            },
            "maxItems": 4
          },
          "request_id": {
            "type": "string",
            "description": "请求唯一标识符。由用户端传递，`ID`长度要求：最少`6`个字符，最多`64`个字符，建议使用`UUID`格式确保唯一性，若未提供平台将自动生成。",
            "minLength": 6,
            "maxLength": 64
          },
          "user_id": {
            "type": "string",
            "description": "终端用户的唯一标识符。`ID`长度要求：最少`6`个字符，最多`128`个字符，建议使用不包含敏感信息的唯一标识。",
            "minLength": 6,
            "maxLength": 128
          }
        }
      },
      "AsyncChatCompletionVisionRequest": {
        "required": [
          "model",
          "messages"
        ],
        "type": "object",
        "description": "视觉模型请求，支持多模态内容（文本、图片、视频、文件）",
        "properties": {
          "model": {
            "type": "string",
            "description": "调用的视觉模型代码。`GLM-5V-Turbo` 系列支持视觉理解，具备卓越的多模态理解能力和工具调用能力。",
            "example": "glm-5v-turbo",
            "default": "glm-5v-turbo",
            "enum": [
              "glm-5v-turbo",
              "glm-4.6v",
              "glm-4.6v-flash",
              "glm-4.6v-flashx",
              "glm-4v-flash",
              "glm-4.1v-thinking-flashx",
              "glm-4.1v-thinking-flash"
            ]
          },
          "messages": {
            "type": "array",
            "description": "对话消息列表，包含当前对话的完整上下文信息。每条消息都有特定的角色和内容，模型会根据这些消息生成回复。消息按时间顺序排列，支持角色：`system`（系统消息，用于设定`AI`的行为和角色）、`user`（用户消息，来自用户的输入）、`assistant`（助手消息，来自`AI`的回复）。视觉模型支持纯文本和多模态内容（文本、图片、视频、文件）。注意不能只包含系统或助手消息。",
            "items": {
              "oneOf": [
                {
                  "title": "用户消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "user"
                      ],
                      "description": "消息作者的角色",
                      "default": "user"
                    },
                    "content": {
                      "oneOf": [
                        {
                          "type": "array",
                          "description": "多模态消息内容，支持文本、图片、文件、视频（可从上方切换至文本消息）",
                          "items": {
                            "$ref": "#/components/schemas/VisionMultimodalContentItem"
                          }
                        },
                        {
                          "type": "string",
                          "description": "文本消息内容（可从上方切换至多模态消息）",
                          "example": "What opportunities and challenges will the Chinese large model industry face in 2025?"
                        }
                      ]
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                },
                {
                  "title": "系统消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "system"
                      ],
                      "description": "消息作者的角色",
                      "default": "system"
                    },
                    "content": {
                      "oneOf": [
                        {
                          "type": "string",
                          "description": "消息文本内容",
                          "example": "You are a helpful assistant."
                        }
                      ]
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                },
                {
                  "title": "助手消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "assistant"
                      ],
                      "description": "消息作者的角色",
                      "default": "assistant"
                    },
                    "content": {
                      "oneOf": [
                        {
                          "type": "string",
                          "description": "文本消息内容",
                          "example": "I'll help you with that analysis."
                        }
                      ]
                    }
                  },
                  "required": [
                    "role"
                  ]
                }
              ]
            },
            "minItems": 1
          },
          "thinking": {
            "$ref": "#/components/schemas/ChatThinking"
          },
          "do_sample": {
            "type": "boolean",
            "example": true,
            "default": true,
            "description": "是否启用采样策略来生成文本。默认值为 `true`。当设置为 `true` 时，模型会使用 `temperature、top_p` 等参数进行随机采样，生成更多样化的输出；当设置为 `false` 时，模型总是选择概率最高的词汇，生成更确定性的输出，此时 `temperature` 和 `top_p` 参数将被忽略。对于需要一致性和可重复性的任务（如代码生成、翻译），建议设置为 `false`。"
          },
          "temperature": {
            "type": "number",
            "description": "采样温度，控制输出的随机性和创造性，取值范围为 `[0.0, 1.0]`，限两位小数。对于`GLM-5V-Turbo`，`GLM-4.6V`，`GLM-4.5V`系列默认值为 `0.8`，`GLM-4.1v`系列默认值为 `0.8`。较高的值（如`0.8`）会使输出更随机、更具创造性，适合创意写作和头脑风暴；较低的值（如`0.2`）会使输出更稳定、更确定，适合事实性问答等场景。建议根据应用场景调整 `top_p` 或 `temperature` 参数，但不要同时调整两个参数。",
            "format": "float",
            "example": 0.8,
            "default": 0.8,
            "minimum": 0.0,
            "maximum": 1.0
          },
          "top_p": {
            "type": "number",
            "description": "核采样（`nucleus sampling`）参数，是`temperature`采样的替代方法，取值范围为 `[0.01, 1.0]`，限两位小数。对于`GLM-5V-Turbo`，`GLM-4.6V`，`GLM-4.5V`系列默认值为 `0.6`，`GLM-4.1v`系列默认值为 `0.6`。模型只考虑累积概率达到`top_p`的候选词汇。例如：`0.1`表示只考虑前`10%`概率的词汇，`0.9`表示考虑前`90%`概率的词汇。较小的值会产生更集中、更一致的输出；较大的值会增加输出的多样性。建议根据应用场景调整 `top_p` 或 `temperature` 参数，但不要同时调整两个参数。",
            "format": "float",
            "example": 0.6,
            "default": 0.6,
            "minimum": 0.01,
            "maximum": 1.0
          },
          "max_tokens": {
            "type": "integer",
            "description": "模型输出的最大令牌`token`数量限制。`GLM-5V-Turbo`最大支持`128K`输出长度，`GLM-4.6V`最大支持`32K`输出长度，`GLM-4.5V`最大支持`16K`输出长度，`GLM-4.1v`系列最大支持`16K`输出长度，建议设置不小于`1024`。令牌是文本的基本单位，通常`1`个令牌约等于`0.75`个英文单词或`1.5`个中文字符。设置合适的`max_tokens`可以控制响应长度和成本，避免过长的输出。如果模型在达到`max_tokens`限制前完成回答，会自然结束；如果达到限制，输出可能被截断。\n默认值和最大值等更多详见 [max_tokens 文档](/cn/guide/start/concept-param#max_tokens)",
            "example": 1024,
            "minimum": 1,
            "maximum": 131072
          },
          "tools": {
            "type": "array",
            "description": "模型可以调用的工具列表。仅限`GLM-5V-Turbo`, `GLM-4.6V`支持。使用此参数提供模型可以生成 `JSON` 输入的函数列表或配置其他工具。最多支持 `128` 个函数。",
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/FunctionToolSchema"
                }
              }
            ]
          },
          "tool_choice": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "auto"
                ],
                "description": "用于控制模型选择调用哪个函数的方式，仅在工具类型为`function`时补充。默认`auto`且仅支持`auto`。"
              }
            ],
            "description": "控制模型如何选择工具。"
          },
          "stop": {
            "type": "array",
            "description": "停止词列表，当模型生成的文本中遇到这些指定的字符串时会立即停止生成。目前仅支持单个停止词，格式为[\"stop_word1\"]。停止词不会包含在返回的文本中。这对于控制输出格式、防止模型生成不需要的内容非常有用，例如在对话场景中可以设置[\"Human:\"]来防止模型模拟用户发言。",
            "items": {
              "type": "string"
            },
            "maxItems": 4
          },
          "request_id": {
            "type": "string",
            "description": "请求唯一标识符。由用户端传递，`ID`长度要求：最少`6`个字符，最多`64`个字符，建议使用`UUID`格式确保唯一性，若未提供平台将自动生成。",
            "minLength": 6,
            "maxLength": 64
          },
          "user_id": {
            "type": "string",
            "description": "终端用户的唯一标识符。`ID`长度要求：最少`6`个字符，最多`128`个字符，建议使用不包含敏感信息的唯一标识。",
            "minLength": 6,
            "maxLength": 128
          }
        }
      },
      "ChatCompletionAudioRequest": {
        "required": [
          "model",
          "messages"
        ],
        "type": "object",
        "description": "音频模型请求，支持语音理解、生成和识别功能",
        "properties": {
          "model": {
            "type": "string",
            "description": "调用的音频模型代码。`GLM-4-Voice` 支持语音理解和生成。",
            "example": "glm-4-voice",
            "default": "glm-4-voice",
            "enum": [
              "glm-4-voice",
              "禁用仅占位"
            ]
          },
          "messages": {
            "type": "array",
            "description": "对话消息列表，包含当前对话的完整上下文信息。每条消息都有特定的角色和内容，模型会根据这些消息生成回复。消息按时间顺序排列，支持角色：`system`（系统消息，用于设定`AI`的行为和角色）、`user`（用户消息，来自用户的输入）、`assistant`（助手消息，来自`AI`的回复）。音频模型支持文本和音频内容。注意不能只包含系统或助手消息。",
            "items": {
              "oneOf": [
                {
                  "title": "用户消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "user"
                      ],
                      "description": "消息作者的角色",
                      "default": "user"
                    },
                    "content": {
                      "oneOf": [
                        {
                          "type": "array",
                          "description": "多模态消息内容，支持文本、音频",
                          "items": {
                            "$ref": "#/components/schemas/AudioMultimodalContentItem"
                          }
                        },
                        {
                          "type": "string",
                          "description": "消息文本内容",
                          "example": "You are a helpful assistant."
                        }
                      ]
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                },
                {
                  "title": "系统消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "system"
                      ],
                      "description": "消息作者的角色",
                      "default": "system"
                    },
                    "content": {
                      "type": "string",
                      "description": "消息文本内容",
                      "example": "你是一个专业的语音助手，能够理解和生成自然语音。"
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                },
                {
                  "title": "助手消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "assistant"
                      ],
                      "description": "消息作者的角色",
                      "default": "assistant"
                    },
                    "content": {
                      "oneOf": [
                        {
                          "type": "string",
                          "description": "文本消息内容",
                          "example": "I'll help you with that analysis."
                        }
                      ]
                    },
                    "audio": {
                      "type": "object",
                      "description": "语音消息",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "语音消息`id`，用于多轮对话"
                        }
                      }
                    }
                  },
                  "required": [
                    "role"
                  ]
                }
              ]
            },
            "minItems": 1
          },
          "stream": {
            "type": "boolean",
            "example": false,
            "default": false,
            "description": "是否启用流式输出模式。默认值为 `false`。当设置为 `false` 时，模型会在生成完整响应后一次性返回所有内容，适合语音识别和批处理场景。当设置为 `true` 时，模型会通过`Server-Sent Events (SSE)`流式返回生成的内容，用户可以实时看到文本生成过程，适合实时语音对话场景，能提供更好的用户体验。流式输出结束时会返回 `data: [DONE]` 消息。"
          },
          "do_sample": {
            "type": "boolean",
            "example": true,
            "default": true,
            "description": "是否启用采样策略来生成文本。默认值为 `true`。当设置为 `true` 时，模型会使用 `temperature、top_p` 等参数进行随机采样，生成更多样化的输出；当设置为 `false` 时，模型总是选择概率最高的词汇，生成更确定性的输出，此时 `temperature` 和 `top_p` 参数将被忽略。对于需要一致性和可重复性的任务（如语音识别、转录），建议设置为 `false`。"
          },
          "temperature": {
            "type": "number",
            "description": "采样温度，控制输出的随机性和创造性，取值范围为 `[0.0, 1.0]`，限两位小数。对于`GLM-4-Voice`默认值为 `0.8`。较高的值（如`0.8`）会使输出更随机、更具创造性，适合语音生成和对话；较低的值（如`0.1`）会使输出更稳定、更确定，适合语音识别和转录。建议根据应用场景调整 `top_p` 或 `temperature` 参数，但不要同时调整两个参数。",
            "format": "float",
            "example": 0.8,
            "default": 0.8,
            "minimum": 0.0,
            "maximum": 1.0
          },
          "top_p": {
            "type": "number",
            "description": "核采样（`nucleus sampling`）参数，是`temperature`采样的替代方法，取值范围为 `[0.01, 1.0]`，限两位小数。对于`GLM-4-Voice`默认值为 `0.6`。模型只考虑累积概率达到`top_p`的候选词汇。例如：`0.1`表示只考虑前`10%`概率的词汇，`0.9`表示考虑前`90%`概率的词汇。较小的值会产生更集中、更一致的输出；较大的值会增加输出的多样性。建议根据应用场景调整 `top_p` 或 `temperature` 参数，但不要同时调整两个参数。",
            "format": "float",
            "example": 0.6,
            "default": 0.6,
            "minimum": 0.01,
            "maximum": 1.0
          },
          "max_tokens": {
            "type": "integer",
            "description": "模型输出的最大令牌`token`数量限制。`GLM-4-Voice`最大支持`4K`输出长度，默认`1024`。令牌是文本的基本单位。",
            "example": 1024,
            "minimum": 1,
            "maximum": 4096
          },
          "watermark_enabled": {
            "type": "boolean",
            "description": "控制`AI`生成图片时是否添加水印。\n - `true`: 默认启用`AI`生成的显式水印及隐式数字水印，符合政策要求。\n - `false`: 关闭所有水印，仅允许已签署免责声明的客户使用，签署路径：个人中心-安全管理-去水印管理",
            "example": true
          },
          "stop": {
            "type": "array",
            "description": "停止词列表，当模型生成的文本中遇到这些指定的字符串时会立即停止生成。目前仅支持单个停止词，格式为[\"stop_word1\"]。停止词不会包含在返回的文本中。这对于控制输出格式、防止模型生成不需要的内容非常有用。",
            "items": {
              "type": "string"
            },
            "maxItems": 4
          },
          "request_id": {
            "type": "string",
            "description": "请求唯一标识符。由用户端传递，`ID`长度要求：最少`6`个字符，最多`64`个字符，建议使用`UUID`格式确保唯一性，若未提供平台将自动生成。",
            "minLength": 6,
            "maxLength": 64
          },
          "user_id": {
            "type": "string",
            "description": "终端用户的唯一标识符。`ID`长度要求：最少`6`个字符，最多`128`个字符，建议使用不包含敏感信息的唯一标识。",
            "minLength": 6,
            "maxLength": 128
          }
        }
      },
      "AsyncChatCompletionAudioRequest": {
        "required": [
          "model",
          "messages"
        ],
        "type": "object",
        "description": "音频模型请求，支持语音理解、生成和识别功能",
        "properties": {
          "model": {
            "type": "string",
            "description": "调用的音频模型代码。`GLM-4-Voice` 支持语音理解和生成。",
            "example": "glm-4-voice",
            "default": "glm-4-voice",
            "enum": [
              "glm-4-voice",
              "禁用仅占位"
            ]
          },
          "messages": {
            "type": "array",
            "description": "对话消息列表，包含当前对话的完整上下文信息。每条消息都有特定的角色和内容，模型会根据这些消息生成回复。消息按时间顺序排列，支持角色：`system`（系统消息，用于设定`AI`的行为和角色）、`user`（用户消息，来自用户的输入）、`assistant`（助手消息，来自`AI`的回复）。音频模型支持文本和音频内容。注意不能只包含系统或助手消息。",
            "items": {
              "oneOf": [
                {
                  "title": "用户消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "user"
                      ],
                      "description": "消息作者的角色",
                      "default": "user"
                    },
                    "content": {
                      "oneOf": [
                        {
                          "type": "array",
                          "description": "多模态消息内容，支持文本、音频",
                          "items": {
                            "$ref": "#/components/schemas/AudioMultimodalContentItem"
                          }
                        },
                        {
                          "type": "string",
                          "description": "消息文本内容",
                          "example": "You are a helpful assistant."
                        }
                      ]
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                },
                {
                  "title": "系统消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "system"
                      ],
                      "description": "消息作者的角色",
                      "default": "system"
                    },
                    "content": {
                      "type": "string",
                      "description": "消息文本内容",
                      "example": "你是一个专业的语音助手，能够理解和生成自然语音。"
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                },
                {
                  "title": "助手消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "assistant"
                      ],
                      "description": "消息作者的角色",
                      "default": "assistant"
                    },
                    "content": {
                      "oneOf": [
                        {
                          "type": "string",
                          "description": "文本消息内容",
                          "example": "I'll help you with that analysis."
                        }
                      ]
                    },
                    "audio": {
                      "type": "object",
                      "description": "语音消息",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "语音消息`id`，用于多轮对话"
                        }
                      }
                    }
                  },
                  "required": [
                    "role"
                  ]
                }
              ]
            },
            "minItems": 1
          },
          "do_sample": {
            "type": "boolean",
            "example": true,
            "default": true,
            "description": "是否启用采样策略来生成文本。默认值为 `true`。当设置为 `true` 时，模型会使用 `temperature、top_p` 等参数进行随机采样，生成更多样化的输出；当设置为 `false` 时，模型总是选择概率最高的词汇，生成更确定性的输出，此时 `temperature` 和 `top_p` 参数将被忽略。对于需要一致性和可重复性的任务（如语音识别、转录），建议设置为 `false`。"
          },
          "temperature": {
            "type": "number",
            "description": "采样温度，控制输出的随机性和创造性，取值范围为 `[0.0, 1.0]`，限两位小数。对于`GLM-4-Voice`默认值为 `0.8`。较高的值（如`0.8`）会使输出更随机、更具创造性，适合语音生成和对话；较低的值（如`0.1`）会使输出更稳定、更确定，适合语音识别和转录。建议根据应用场景调整 `top_p` 或 `temperature` 参数，但不要同时调整两个参数。",
            "format": "float",
            "example": 0.8,
            "default": 0.8,
            "minimum": 0.0,
            "maximum": 1.0
          },
          "top_p": {
            "type": "number",
            "description": "核采样（`nucleus sampling`）参数，是`temperature`采样的替代方法，取值范围为 `[0.01, 1.0]`，限两位小数。对于`GLM-4-Voice`默认值为 `0.6`。模型只考虑累积概率达到`top_p`的候选词汇。例如：`0.1`表示只考虑前`10%`概率的词汇，`0.9`表示考虑前`90%`概率的词汇。较小的值会产生更集中、更一致的输出；较大的值会增加输出的多样性。建议根据应用场景调整 `top_p` 或 `temperature` 参数，但不要同时调整两个参数。",
            "format": "float",
            "example": 0.6,
            "default": 0.6,
            "minimum": 0.01,
            "maximum": 1.0
          },
          "max_tokens": {
            "type": "integer",
            "description": "模型输出的最大令牌`token`数量限制。`GLM-4-Voice`最大支持`4K`输出长度，默认`1024`。令牌是文本的基本单位。",
            "example": 1024,
            "minimum": 1,
            "maximum": 4096
          },
          "watermark_enabled": {
            "type": "boolean",
            "description": "控制`AI`生成图片时是否添加水印。\n - `true`: 默认启用`AI`生成的显式水印及隐式数字水印，符合政策要求。\n - `false`: 关闭所有水印，仅允许已签署免责声明的客户使用，签署路径：个人中心-安全管理-去水印管理",
            "example": true
          },
          "stop": {
            "type": "array",
            "description": "停止词列表，当模型生成的文本中遇到这些指定的字符串时会立即停止生成。目前仅支持单个停止词，格式为[\"stop_word1\"]。停止词不会包含在返回的文本中。这对于控制输出格式、防止模型生成不需要的内容非常有用。",
            "items": {
              "type": "string"
            },
            "maxItems": 4
          },
          "request_id": {
            "type": "string",
            "description": "请求唯一标识符。由用户端传递，`ID`长度要求：最少`6`个字符，最多`64`个字符，建议使用`UUID`格式确保唯一性，若未提供平台将自动生成。",
            "minLength": 6,
            "maxLength": 64
          },
          "user_id": {
            "type": "string",
            "description": "终端用户的唯一标识符。`ID`长度要求：最少`6`个字符，最多`128`个字符，建议使用不包含敏感信息的唯一标识。",
            "minLength": 6,
            "maxLength": 128
          }
        }
      },
      "ChatCompletionHumanOidRequest": {
        "required": [
          "model",
          "messages"
        ],
        "type": "object",
        "description": "角色扮演，专业心理咨询专用模型",
        "properties": {
          "model": {
            "type": "string",
            "description": "调用的专用模型代码。`CharGLM-4` 是角色扮演专用模型，`Emohaa` 是专业心理咨询模型。",
            "example": "charglm-4",
            "default": "charglm-4",
            "enum": [
              "charglm-4",
              "emohaa"
            ]
          },
          "meta": {
            "type": "object",
            "description": "角色及用户信息数据(仅限 `Emohaa` 支持此参数)",
            "required": [
              "user_info",
              "bot_info",
              "bot_name",
              "user_name"
            ],
            "properties": {
              "user_info": {
                "type": "string",
                "description": "用户信息描述"
              },
              "bot_info": {
                "type": "string",
                "description": "角色信息描述"
              },
              "bot_name": {
                "type": "string",
                "description": "角色名称"
              },
              "user_name": {
                "type": "string",
                "description": "用户名称"
              }
            }
          },
          "messages": {
            "type": "array",
            "description": "对话消息列表，包含当前对话的完整上下文信息。每条消息都有特定的角色和内容，模型会根据这些消息生成回复。消息按时间顺序排列，支持角色：`system`（系统消息，用于设定`AI`的行为和角色）、`user`（用户消息，来自用户的输入）、`assistant`（助手消息，来自`AI`的回复）。注意不能只包含系统消息或助手消息。",
            "items": {
              "oneOf": [
                {
                  "title": "用户消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "user"
                      ],
                      "description": "消息作者的角色",
                      "default": "user"
                    },
                    "content": {
                      "type": "string",
                      "description": "文本消息内容",
                      "example": "我最近工作压力很大，经常感到焦虑，不知道该怎么办"
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                },
                {
                  "title": "系统消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "system"
                      ],
                      "description": "消息作者的角色",
                      "default": "system"
                    },
                    "content": {
                      "type": "string",
                      "description": "消息文本内容",
                      "example": "你乃苏东坡。人生如梦，何不活得潇洒一些？在这忙碌纷繁的现代生活中，帮助大家找到那份属于自己的自在与豁达，共赏人生之美好"
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                },
                {
                  "title": "助手消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "assistant"
                      ],
                      "description": "消息作者的角色",
                      "default": "assistant"
                    },
                    "content": {
                      "type": "string",
                      "description": "文本消息内容",
                      "example": "I'll help you with that analysis."
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                }
              ]
            },
            "minItems": 1
          },
          "stream": {
            "type": "boolean",
            "example": false,
            "default": false,
            "description": "是否启用流式输出模式。默认值为 `false`。当设置为 `fals`e 时，模型会在生成完整响应后一次性返回所有内容，适合语音识别和批处理场景。当设置为 `true` 时，模型会通过`Server-Sent Events (SSE)`流式返回生成的内容，用户可以实时看到文本生成过程，适合实时语音对话场景，能提供更好的用户体验。流式输出结束时会返回 `data: [DONE]` 消息。"
          },
          "do_sample": {
            "type": "boolean",
            "example": true,
            "default": true,
            "description": "是否启用采样策略来生成文本。默认值为 `true`。当设置为 `true` 时，模型会使用 `temperature、top_p` 等参数进行随机采样，生成更多样化的输出；当设置为 `false` 时，模型总是选择概率最高的词汇，生成更确定性的输出，此时 `temperatur`e 和 `top_p` 参数将被忽略。对于需要一致性和可重复性的任务（如语音识别、转录），建议设置为 `false`。"
          },
          "temperature": {
            "type": "number",
            "description": "采样温度，控制输出的随机性和创造性，取值范围为 `[0.0, 1.0]`，限两位小数。`Charglm-4` 和 `Emohaa` 默认值为 `0.95`。建议根据应用场景调整 `top_p` 或 `temperature` 参数，但不要同时调整两个参数。",
            "format": "float",
            "example": 0.8,
            "default": 0.8,
            "minimum": 0.0,
            "maximum": 1.0
          },
          "top_p": {
            "type": "number",
            "description": "核采样（`nucleus sampling`）参数，是`temperature`采样的替代方法，取值范围为 `[0.01, 1.0]`，限两位小数。`Charglm-4` 和 `Emohaa` 默认值为 `0.7`。建议根据应用场景调整 `top_p` 或 `temperature` 参数，但不要同时调整两个参数。",
            "format": "float",
            "example": 0.6,
            "default": 0.6,
            "minimum": 0.01,
            "maximum": 1.0
          },
          "max_tokens": {
            "type": "integer",
            "description": "模型输出的最大令牌`token`数量限制。`Charglm-4` 和 `Emohaa` 最大支持`4K`输出长度，默认`1024`。令牌是文本的基本单位。",
            "example": 1024,
            "minimum": 1,
            "maximum": 4096
          },
          "stop": {
            "type": "array",
            "description": "停止词列表，当模型生成的文本中遇到这些指定的字符串时会立即停止生成。目前仅支持单个停止词，格式为[\"stop_word1\"]。停止词不会包含在返回的文本中。这对于控制输出格式、防止模型生成不需要的内容非常有用。",
            "items": {
              "type": "string"
            },
            "maxItems": 1
          },
          "request_id": {
            "type": "string",
            "description": "请求唯一标识符。由用户端传递，`ID`长度要求：最少`6`个字符，最多`64`个字符，建议使用`UUID`格式确保唯一性，若未提供平台将自动生成。",
            "minLength": 6,
            "maxLength": 64
          },
          "user_id": {
            "type": "string",
            "description": "终端用户的唯一标识符。`ID`长度要求：最少`6`个字符，最多`128`个字符，建议使用不包含敏感信息的唯一标识。",
            "minLength": 6,
            "maxLength": 128
          }
        }
      },
      "AsyncChatCompletionHumanOidRequest": {
        "required": [
          "model",
          "messages"
        ],
        "type": "object",
        "description": "角色扮演，专业心理咨询专用模型",
        "properties": {
          "model": {
            "type": "string",
            "description": "调用的专用模型代码。`CharGLM-4` 是角色扮演专用模型，`Emohaa` 是专业心理咨询模型。",
            "example": "charglm-4",
            "default": "charglm-4",
            "enum": [
              "charglm-4",
              "emohaa"
            ]
          },
          "meta": {
            "type": "object",
            "description": "角色及用户信息数据(仅限 `Emohaa` 支持此参数)",
            "required": [
              "user_info",
              "bot_info",
              "bot_name",
              "user_name"
            ],
            "properties": {
              "user_info": {
                "type": "string",
                "description": "用户信息描述"
              },
              "bot_info": {
                "type": "string",
                "description": "角色信息描述"
              },
              "bot_name": {
                "type": "string",
                "description": "角色名称"
              },
              "user_name": {
                "type": "string",
                "description": "用户名称"
              }
            }
          },
          "messages": {
            "type": "array",
            "description": "对话消息列表，包含当前对话的完整上下文信息。每条消息都有特定的角色和内容，模型会根据这些消息生成回复。消息按时间顺序排列，支持角色：`system`（系统消息，用于设定`AI`的行为和角色）、`user`（用户消息，来自用户的输入）、`assistant`（助手消息，来自`AI`的回复）。注意不能只包含系统消息或助手消息。",
            "items": {
              "oneOf": [
                {
                  "title": "用户消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "user"
                      ],
                      "description": "消息作者的角色",
                      "default": "user"
                    },
                    "content": {
                      "type": "string",
                      "description": "文本消息内容",
                      "example": "我最近工作压力很大，经常感到焦虑，不知道该怎么办"
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                },
                {
                  "title": "系统消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "system"
                      ],
                      "description": "消息作者的角色",
                      "default": "system"
                    },
                    "content": {
                      "type": "string",
                      "description": "消息文本内容",
                      "example": "你乃苏东坡。人生如梦，何不活得潇洒一些？在这忙碌纷繁的现代生活中，帮助大家找到那份属于自己的自在与豁达，共赏人生之美好"
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                },
                {
                  "title": "助手消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "assistant"
                      ],
                      "description": "消息作者的角色",
                      "default": "assistant"
                    },
                    "content": {
                      "type": "string",
                      "description": "文本消息内容",
                      "example": "I'll help you with that analysis."
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                }
              ]
            },
            "minItems": 1
          },
          "do_sample": {
            "type": "boolean",
            "example": true,
            "default": true,
            "description": "是否启用采样策略来生成文本。默认值为 `true`。当设置为 `true` 时，模型会使用 `temperature、top_p` 等参数进行随机采样，生成更多样化的输出；当设置为 `false` 时，模型总是选择概率最高的词汇，生成更确定性的输出，此时 `temperatur`e 和 `top_p` 参数将被忽略。对于需要一致性和可重复性的任务（如语音识别、转录），建议设置为 `false`。"
          },
          "temperature": {
            "type": "number",
            "description": "采样温度，控制输出的随机性和创造性，取值范围为 `[0.0, 1.0]`，限两位小数。`Charglm-4` 和 `Emohaa` 默认值为 `0.95`。建议根据应用场景调整 `top_p` 或 `temperature` 参数，但不要同时调整两个参数。",
            "format": "float",
            "example": 0.8,
            "default": 0.8,
            "minimum": 0.0,
            "maximum": 1.0
          },
          "top_p": {
            "type": "number",
            "description": "核采样（`nucleus sampling`）参数，是`temperature`采样的替代方法，取值范围为 `[0.01, 1.0]`，限两位小数。`Charglm-4` 和 `Emohaa` 默认值为 `0.7`。建议根据应用场景调整 `top_p` 或 `temperature` 参数，但不要同时调整两个参数。",
            "format": "float",
            "example": 0.6,
            "default": 0.6,
            "minimum": 0.01,
            "maximum": 1.0
          },
          "max_tokens": {
            "type": "integer",
            "description": "模型输出的最大令牌`token`数量限制。`Charglm-4` 和 `Emohaa` 最大支持`4K`输出长度，默认`1024`。令牌是文本的基本单位。",
            "example": 1024,
            "minimum": 1,
            "maximum": 4096
          },
          "stop": {
            "type": "array",
            "description": "停止词列表，当模型生成的文本中遇到这些指定的字符串时会立即停止生成。目前仅支持单个停止词，格式为[\"stop_word1\"]。停止词不会包含在返回的文本中。这对于控制输出格式、防止模型生成不需要的内容非常有用。",
            "items": {
              "type": "string"
            },
            "maxItems": 1
          },
          "request_id": {
            "type": "string",
            "description": "请求唯一标识符。由用户端传递，`ID`长度要求：最少`6`个字符，最多`64`个字符，建议使用`UUID`格式确保唯一性，若未提供平台将自动生成。",
            "minLength": 6,
            "maxLength": 64
          },
          "user_id": {
            "type": "string",
            "description": "终端用户的唯一标识符。`ID`长度要求：最少`6`个字符，最多`128`个字符，建议使用不包含敏感信息的唯一标识。",
            "minLength": 6,
            "maxLength": 128
          }
        }
      },
      "MultimodalContentItem": {
        "oneOf": [
          {
            "title": "文本",
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "text"
                ],
                "description": "内容类型为文本",
                "default": "text"
              },
              "text": {
                "type": "string",
                "description": "文本内容"
              }
            },
            "required": [
              "type",
              "text"
            ],
            "additionalProperties": false
          },
          {
            "title": "图片",
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "image_url"
                ],
                "description": "内容类型为图片`URL`",
                "default": "image_url"
              },
              "image_url": {
                "type": "object",
                "description": "图片信息",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "图片的`URL`地址或`Base64`编码。图像大小上传限制为每张图像`5M`以下，且像素不超过`6000*6000`。支持`jpg、png、jpeg`格式。注意：`GLM-4V-Flash`限制`1`张图像，不支持`Base64`编码。`GLM-4V-Plus-0111`最多支持同时处理`5`张图像。"
                  }
                },
                "required": [
                  "url"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "type",
              "image_url"
            ],
            "additionalProperties": false
          },
          {
            "title": "音频",
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "input_audio"
                ],
                "description": "内容类型为音频输入",
                "default": "input_audio"
              },
              "input_audio": {
                "type": "object",
                "description": "音频信息，仅`glm-4-voice`支持音频输入",
                "properties": {
                  "data": {
                    "type": "string",
                    "description": "语音文件的`base64`编码。音频最长不超过 `10` 分钟。`1s`音频=`12.5 Tokens`，向上取整。"
                  },
                  "format": {
                    "type": "string",
                    "description": "语音文件的格式，支持`wav`和`mp3`",
                    "enum": [
                      "wav",
                      "mp3"
                    ]
                  }
                },
                "required": [
                  "data",
                  "format"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "type",
              "input_audio"
            ],
            "additionalProperties": false
          },
          {
            "title": "视频",
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "video_url"
                ],
                "description": "内容类型为视频输入",
                "default": "video_url"
              },
              "video_url": {
                "type": "object",
                "description": "视频信息。注意：`GLM-4V-Plus-0111` 的 `video_url` 参数必须在 `content` 数组的第一位。",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "视频的`URL`地址。`GLM-4.5V`视频大小限制为 `200M` 以内。`GLM-4V-Plus`，视频大小限制为`20M`以内，视频时长不超过`30s`。对于其他多模态模型，视频大小限制为`200M`以内。视频类型：`mp4`，`mkv`，`mov`。"
                  }
                },
                "required": [
                  "url"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "type",
              "video_url"
            ],
            "additionalProperties": false
          },
          {
            "title": "文件",
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "file_url"
                ],
                "description": "内容类型为文件输入(仅`GLM-4.6V` `GLM-4.5V`支持)",
                "default": "file_url"
              },
              "file_url": {
                "type": "object",
                "description": "文件信息。",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "文件的`URL`地址，不支持`Base64`编码。支持`PDF、Word`等格式，最多支持`50`个。"
                  }
                },
                "required": [
                  "url"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "type",
              "file_url"
            ],
            "additionalProperties": false
          }
        ]
      },
      "VisionMultimodalContentItem": {
        "oneOf": [
          {
            "title": "文本",
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "text"
                ],
                "description": "内容类型为文本",
                "default": "text"
              },
              "text": {
                "type": "string",
                "description": "文本内容"
              }
            },
            "required": [
              "type",
              "text"
            ],
            "additionalProperties": false
          },
          {
            "title": "图片",
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "image_url"
                ],
                "description": "内容类型为图片`URL`",
                "default": "image_url"
              },
              "image_url": {
                "type": "object",
                "description": "图片信息",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "图片的`URL`地址或`Base64`编码。图像大小上传限制为每张图像`5M`以下，且像素不超过`6000*6000`。支持`jpg、png、jpeg`格式。`GLM-5V-Turbo` `GLM4.6V` `GLM4.5V` 系列限制`50`张。`GLM-4V-Plus-0111` 限制`5`张。`GLM-4V-Flash`限制`1`张图像且不支持`Base64`编码。"
                  }
                },
                "required": [
                  "url"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "type",
              "image_url"
            ],
            "additionalProperties": false
          },
          {
            "title": "视频",
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "video_url"
                ],
                "description": "内容类型为视频输入",
                "default": "video_url"
              },
              "video_url": {
                "type": "object",
                "description": "视频信息。注意：`GLM-4V-Plus-0111` 的 `video_url` 参数必须在 `content` 数组的第一位。",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "视频的`URL`地址。`GLM-5V-Turbo` `GLM-4.6V` `GLM-4.5V` 系列视频大小限制为 `200M` 以内。`GLM-4V-Plus`视频大小限制为`20M`以内，视频时长不超过`30s`。对于其他多模态模型，视频大小限制为`200M`以内。视频类型：`mp4`，`mkv`，`mov`。"
                  }
                },
                "required": [
                  "url"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "type",
              "video_url"
            ],
            "additionalProperties": false
          },
          {
            "title": "文件",
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "file_url"
                ],
                "description": "内容类型为文件输入(仅`GLM-5V-Turbo` `GLM-4.6V` `GLM-4.5V`支持，且不支持同时传入 `file_url` 和 `image_url` 或 `video_url` 参数)",
                "default": "file_url"
              },
              "file_url": {
                "type": "object",
                "description": "文件信息。",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "文件的`URL`地址，不支持`Base64`编码。支持`pdf、txt、word、jsonl、xlsx、pptx`等格式，最多支持`50`个。"
                  }
                },
                "required": [
                  "url"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "type",
              "file_url"
            ],
            "additionalProperties": false
          }
        ]
      },
      "AudioMultimodalContentItem": {
        "oneOf": [
          {
            "title": "文本",
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "text"
                ],
                "description": "内容类型为文本",
                "default": "text"
              },
              "text": {
                "type": "string",
                "description": "文本内容"
              }
            },
            "required": [
              "type",
              "text"
            ],
            "additionalProperties": false
          },
          {
            "title": "音频",
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "input_audio"
                ],
                "description": "内容类型为音频输入",
                "default": "input_audio"
              },
              "input_audio": {
                "type": "object",
                "description": "音频信息，仅`glm-4-voice`支持音频输入",
                "properties": {
                  "data": {
                    "type": "string",
                    "description": "语音文件的`base64`编码。音频最长不超过 `10` 分钟。`1s`音频=`12.5 Tokens`，向上取整。"
                  },
                  "format": {
                    "type": "string",
                    "description": "语音文件的格式，支持`wav`和`mp3`",
                    "enum": [
                      "wav",
                      "mp3"
                    ]
                  }
                },
                "required": [
                  "data",
                  "format"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "type",
              "input_audio"
            ],
            "additionalProperties": false
          }
        ]
      },
      "FunctionToolSchema": {
        "type": "object",
        "title": "Function Call",
        "properties": {
          "type": {
            "type": "string",
            "default": "function",
            "enum": [
              "function"
            ]
          },
          "function": {
            "$ref": "#/components/schemas/FunctionObject"
          }
        },
        "required": [
          "type",
          "function"
        ],
        "additionalProperties": false
      },
      "FunctionObject": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "要调用的函数名称。必须是 `a-z、A-Z、0-9`，或包含下划线和破折号，最大长度为 `64`。",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-zA-Z0-9_-]+$"
          },
          "description": {
            "type": "string",
            "description": "函数功能的描述，供模型选择何时以及如何调用函数。"
          },
          "parameters": {
            "$ref": "#/components/schemas/FunctionParameters"
          }
        },
        "required": [
          "name",
          "description",
          "parameters"
        ]
      },
      "FunctionParameters": {
        "type": "object",
        "description": "使用 `JSON Schema` 定义的参数。必须传递 `JSON Schema` 对象以准确定义接受的参数。如果调用函数时不需要参数，则省略。",
        "additionalProperties": true
      },
      "RetrievalToolSchema": {
        "type": "object",
        "title": "Retrieval",
        "properties": {
          "type": {
            "type": "string",
            "default": "retrieval",
            "enum": [
              "retrieval"
            ]
          },
          "retrieval": {
            "$ref": "#/components/schemas/RetrievalObject"
          }
        },
        "required": [
          "type",
          "retrieval"
        ],
        "additionalProperties": false
      },
      "RetrievalObject": {
        "type": "object",
        "properties": {
          "knowledge_id": {
            "type": "string",
            "description": "知识库 `ID`，从平台创建或获取"
          },
          "prompt_template": {
            "type": "string",
            "description": "请求模型的提示模板，包含占位符 `{{ knowledge }}` 和 `{{ question }}` 的自定义请求模板。默认模板：`在文档 `{{ knowledge }}` 中搜索问题 `{{question}}` 的答案。如果找到答案，仅使用文档中的陈述进行回应；如果没有找到答案，使用你自己的知识回答并告知用户信息不来自文档。不要重复问题，直接开始答案。`"
          }
        },
        "required": [
          "knowledge_id"
        ]
      },
      "ChatThinking": {
        "type": "object",
        "description": "仅 `GLM-4.5` 及以上模型支持此参数配置. 控制大模型是否开启思维链。",
        "properties": {
          "type": {
            "type": "string",
            "description": "是否开启思维链(当开启后 `GLM-5.2` `GLM-5.1` `GLM-5` `GLM-5-Turbo` `GLM-5v-Turbo` `GLM-4.6` `GLM-4.6V` `GLM-4.5` 为模型自动判断是否思考，`GLM-4.7` `GLM-4.5V` 为强制思考), 默认: `enabled`.",
            "default": "enabled",
            "enum": [
              "enabled",
              "disabled"
            ]
          },
          "clear_thinking": {
            "type": "boolean",
            "description": "默认为 `True`。用于控制是否清除历史对话轮次（`previous turns`）中的 `reasoning_content`。详见 [思考模式](/cn/guide/capabilities/thinking-mode) \n - `true`（默认）：在本次请求中，系统会忽略/移除历史 `turns` 的 `reasoning_content`，仅使用非推理内容（如用户/助手可见文本、工具调用与结果等）作为上下文输入。适用于普通对话与轻量任务，可降低上下文长度与成本 \n - `false`：保留历史 `turns` 的 `reasoning_content` 并随上下文一同提供给模型。若你希望启用 `Preserved Thinking`，必须在 `messages` 中完整、未修改、按原顺序透传历史 `reasoning_content`；缺失、裁剪、改写或重排会导致效果下降或无法生效。\n - 注意：该参数只影响跨 `turn` 的历史 `thinking blocks`；不改变模型在当前 `turn` 内是否产生/输出 `thinking`",
            "default": true,
            "example": true
          }
        }
      },
      "WebSearchToolSchema": {
        "type": "object",
        "title": "Web Search",
        "properties": {
          "type": {
            "type": "string",
            "default": "web_search",
            "enum": [
              "web_search"
            ]
          },
          "web_search": {
            "$ref": "#/components/schemas/WebSearchObject"
          }
        },
        "required": [
          "type",
          "web_search"
        ],
        "additionalProperties": false
      },
      "WebSearchObject": {
        "type": "object",
        "properties": {
          "enable": {
            "type": "boolean",
            "description": "是否启用搜索功能，默认值为 `false`，启用时设置为 `true`"
          },
          "search_engine": {
            "type": "string",
            "description": "搜索引擎类型，默认为 `search_std`；支持`search_std、search_pro、search_pro_sogou、search_pro_quark`。",
            "enum": [
              "search_std",
              "search_pro",
              "search_pro_sogou",
              "search_pro_quark"
            ]
          },
          "search_query": {
            "type": "string",
            "description": "强制触发搜索"
          },
          "search_intent": {
            "type": "string",
            "description": "是否进行搜索意图识别，默认执行搜索意图识别。`true`：执行搜索意图识别，有搜索意图后执行搜索；`false`：跳过搜索意图识别，直接执行搜索"
          },
          "count": {
            "type": "integer",
            "description": "返回结果的条数。可填范围：`1-50`，最大单次搜索返回`50`条，默认为`10`。支持的搜索引擎：`search_std、search_pro、search_pro_sogou`。对于`search_pro_sogou`: 可选枚举值，`10、20、30、40、50`",
            "minimum": 1,
            "maximum": 50
          },
          "search_domain_filter": {
            "type": "string",
            "description": "用于限定搜索结果的范围，仅返回指定白名单域名的内容。\n白名单域名:（如 `www.example.com`）。\n支持的搜索引擎：`search_std、search_pro、search_pro_sogou`"
          },
          "search_recency_filter": {
            "type": "string",
            "description": "搜索指定时间范围内的网页。默认为`noLimit`。可填值：`oneDay`（一天内）、`oneWeek`（一周内）、`oneMonth`（一个月内）、`oneYear`（一年内）、`noLimit`（不限，默认）。支持的搜索引擎：`search_std、search_pro、search_pro_sogou、search_pro_quark`",
            "enum": [
              "oneDay",
              "oneWeek",
              "oneMonth",
              "oneYear",
              "noLimit"
            ]
          },
          "content_size": {
            "type": "string",
            "description": "控制网页摘要的字数。默认值为`medium`。`medium`：返回摘要信息，满足大模型的基础推理需求。`high`：最大化上下文，信息量较大但内容详细，适合需要信息细节的场景。",
            "enum": [
              "medium",
              "high"
            ]
          },
          "result_sequence": {
            "type": "string",
            "description": "指定搜索结果返回的顺序是在模型回复结果之前还是之后，可选值：`before`、`after`，默认 `after`",
            "enum": [
              "before",
              "after"
            ]
          },
          "search_result": {
            "type": "boolean",
            "description": "是否返回搜索来源的详细信息，默认值 `false`"
          },
          "require_search": {
            "type": "boolean",
            "description": "是否强制搜索结果才返回回答，默认值 `false`"
          },
          "search_prompt": {
            "type": "string",
            "description": "用于定制搜索结果处理的`Prompt`，默认`Prompt`：\n\n你是一位智能问答专家，具备整合信息的能力，能够进行时间识别、语义理解与矛盾信息清洗处理。\n当前日期是{{current_date}}，请以此时间为唯一基准，参考以下信息，全面、准确地回答用户问题。\n仅提炼有价值的内容用于回答，确保答案具有实时性与权威性，直接陈述答案，无需说明数据来源或内部处理过程。"
          }
        },
        "required": [
          "search_engine"
        ]
      },
      "MCPToolSchema": {
        "type": "object",
        "title": "MCP",
        "properties": {
          "type": {
            "type": "string",
            "default": "mcp",
            "enum": [
              "mcp"
            ]
          },
          "mcp": {
            "$ref": "#/components/schemas/MCPObject"
          }
        },
        "required": [
          "type",
          "mcp"
        ],
        "additionalProperties": false
      },
      "MCPObject": {
        "type": "object",
        "properties": {
          "server_label": {
            "description": "`mcp server`标识，如果连接智谱的`mcp server`，以`mcp code`填充该字段，且无需填写`server_url`",
            "type": "string"
          },
          "server_url": {
            "description": "`mcp server`地址",
            "type": "string"
          },
          "transport_type": {
            "description": "传输类型",
            "type": "string",
            "default": "streamable-http",
            "enum": [
              "sse",
              "streamable-http"
            ]
          },
          "allowed_tools": {
            "description": "允许的工具集合",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "headers": {
            "description": "`mcp server` 需要的鉴权信息",
            "type": "object"
          }
        },
        "required": [
          "server_label"
        ]
      },
      "ChatCompletionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "description": "任务 `ID`",
            "type": "string"
          },
          "request_id": {
            "description": "请求 `ID`",
            "type": "string"
          },
          "created": {
            "description": "请求创建时间，`Unix` 时间戳（秒）",
            "type": "integer"
          },
          "model": {
            "description": "模型名称",
            "type": "string"
          },
          "choices": {
            "type": "array",
            "description": "模型响应列表",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer",
                  "description": "结果索引"
                },
                "message": {
                  "$ref": "#/components/schemas/ChatCompletionResponseMessage"
                },
                "finish_reason": {
                  "type": "string",
                  "description": "推理终止原因。'stop’表示自然结束或触发stop词，'tool_calls’表示模型命中函数，'length’表示达到token长度限制，'sensitive’表示内容被安全审核接口拦截（用户应判断并决定是否撤回公开内容），'network_error’表示模型推理异常，'model_context_window_exceeded'表示超出模型上下文窗口。"
                }
              }
            }
          },
          "usage": {
            "type": "object",
            "description": "调用结束时返回的 `Token` 使用统计。",
            "properties": {
              "prompt_tokens": {
                "type": "number",
                "description": "用户输入的 `Token` 数量。"
              },
              "completion_tokens": {
                "type": "number",
                "description": "输出的 `Token` 数量"
              },
              "prompt_tokens_details": {
                "type": "object",
                "properties": {
                  "cached_tokens": {
                    "type": "number",
                    "description": "命中的缓存 `Token` 数量"
                  }
                }
              },
              "total_tokens": {
                "type": "integer",
                "description": "`Token` 总数，对于 `glm-4-voice` 模型，`1`秒音频=`12.5 Tokens`，向上取整"
              }
            }
          },
          "video_result": {
            "type": "array",
            "description": "视频生成结果。",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string",
                  "description": "视频链接。"
                },
                "cover_image_url": {
                  "type": "string",
                  "description": "视频封面链接。"
                }
              }
            }
          },
          "web_search": {
            "type": "array",
            "description": "返回与网页搜索相关的信息，使用`WebSearchToolSchema`时返回",
            "items": {
              "type": "object",
              "properties": {
                "icon": {
                  "type": "string",
                  "description": "来源网站的图标"
                },
                "title": {
                  "type": "string",
                  "description": "搜索结果的标题"
                },
                "link": {
                  "type": "string",
                  "description": "搜索结果的网页链接"
                },
                "media": {
                  "type": "string",
                  "description": "搜索结果网页的媒体来源名称"
                },
                "publish_date": {
                  "type": "string",
                  "description": "网站发布时间"
                },
                "content": {
                  "type": "string",
                  "description": "搜索结果网页引用的文本内容"
                },
                "refer": {
                  "type": "string",
                  "description": "角标序号"
                }
              }
            }
          },
          "content_filter": {
            "type": "array",
            "description": "返回内容安全的相关信息",
            "items": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string",
                  "description": "安全生效环节，包括 `role = assistant` 模型推理，`role = user` 用户输入，`role = history` 历史上下文"
                },
                "level": {
                  "type": "integer",
                  "description": "严重程度 `level 0-3`，`level 0`表示最严重，`3`表示轻微"
                }
              }
            }
          }
        }
      },
      "ChatCompletionResponseMessage": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "description": "当前对话角色，默认为 `assistant`",
            "example": "assistant"
          },
          "content": {
            "oneOf": [
              {
                "type": "string",
                "description": "当前对话文本内容。如果调用函数则为 `null`，否则返回推理结果。\n对于`GLM-4.5V`系列模型，返回内容可能包含思考过程标签 `<think> </think>`，文本边界标签 `<|begin_of_box|> <|end_of_box|>`。"
              },
              {
                "type": "array",
                "description": "多模态回复内容，适用于`GLM-4V`系列模型",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "text"
                      ],
                      "description": "回复内容类型，目前为文本"
                    },
                    "text": {
                      "type": "string",
                      "description": "文本内容"
                    }
                  }
                }
              },
              {
                "type": "string",
                "nullable": true,
                "description": "当使用`tool_calls`时，`content`可能为`null`"
              }
            ]
          },
          "reasoning_content": {
            "type": "string",
            "description": "思维链内容，仅在使用 `glm-4.5` 系列, `glm-4.1v-thinking` 系列模型时返回。"
          },
          "audio": {
            "type": "object",
            "description": "当使用 `glm-4-voice` 模型时返回的音频内容",
            "properties": {
              "id": {
                "type": "string",
                "description": "当前对话的音频内容`id`，可用于多轮对话输入"
              },
              "data": {
                "type": "string",
                "description": "当前对话的音频内容`base64`编码"
              },
              "expires_at": {
                "type": "string",
                "description": "当前对话的音频内容过期时间"
              }
            }
          },
          "tool_calls": {
            "type": "array",
            "description": "生成的应该被调用的函数名称和参数。",
            "items": {
              "$ref": "#/components/schemas/ChatCompletionResponseMessageToolCall"
            }
          }
        }
      },
      "ChatCompletionResponseMessageToolCall": {
        "type": "object",
        "properties": {
          "function": {
            "type": "object",
            "description": "包含生成的函数名称和 `JSON` 格式参数。",
            "properties": {
              "name": {
                "type": "string",
                "description": "生成的函数名称。"
              },
              "arguments": {
                "type": "string",
                "description": "生成的函数调用参数的 `JSON` 格式字符串。调用函数前请验证参数。"
              }
            },
            "required": [
              "name",
              "arguments"
            ]
          },
          "mcp": {
            "type": "object",
            "description": "`MCP` 工具调用参数",
            "properties": {
              "id": {
                "description": "`mcp` 工具调用唯一标识",
                "type": "string"
              },
              "type": {
                "description": "工具调用类型, 例如 `mcp_list_tools, mcp_call`",
                "type": "string",
                "enum": [
                  "mcp_list_tools",
                  "mcp_call"
                ]
              },
              "server_label": {
                "description": "`MCP`服务器标签",
                "type": "string"
              },
              "error": {
                "description": "错误信息",
                "type": "string"
              },
              "tools": {
                "description": "`type = mcp_list_tools` 时的工具列表",
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "description": "工具名称",
                      "type": "string"
                    },
                    "description": {
                      "description": "工具描述",
                      "type": "string"
                    },
                    "annotations": {
                      "description": "工具注解",
                      "type": "object"
                    },
                    "input_schema": {
                      "description": "工具输入参数规范",
                      "type": "object",
                      "properties": {
                        "type": {
                          "description": "固定值 'object'",
                          "type": "string",
                          "default": "object",
                          "enum": [
                            "object"
                          ]
                        },
                        "properties": {
                          "description": "参数属性定义",
                          "type": "object"
                        },
                        "required": {
                          "description": "必填属性列表",
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": {
                          "description": "是否允许额外参数",
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              },
              "arguments": {
                "description": "工具调用参数，参数为 `json` 字符串",
                "type": "string"
              },
              "name": {
                "description": "工具名称",
                "type": "string"
              },
              "output": {
                "description": "工具返回的结果输出",
                "type": "object"
              }
            }
          },
          "id": {
            "type": "string",
            "description": "命中函数的唯一标识符。"
          },
          "type": {
            "type": "string",
            "description": "调用的工具类型，目前仅支持 'function', 'mcp'。"
          }
        }
      },
      "ChatCompletionChunk": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "任务 ID"
          },
          "created": {
            "type": "integer",
            "description": "请求创建时间，`Unix` 时间戳（秒）"
          },
          "model": {
            "type": "string",
            "description": "模型名称"
          },
          "choices": {
            "type": "array",
            "description": "模型响应列表",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer",
                  "description": "结果索引"
                },
                "delta": {
                  "type": "object",
                  "description": "模型增量返回的文本信息",
                  "properties": {
                    "role": {
                      "type": "string",
                      "description": "当前对话的角色，目前默认为 `assistant`（模型）"
                    },
                    "content": {
                      "oneOf": [
                        {
                          "type": "string",
                          "description": "当前对话文本内容。如果调用函数则为 `null`，否则返回推理结果。\n对于`GLM-4.5V`系列模型，返回内容可能包含思考过程标签 `<think> </think>`，文本边界标签 `<|begin_of_box|> <|end_of_box|>`。"
                        },
                        {
                          "type": "array",
                          "description": "当前对话的多模态内容（适用于`GLM-4V`系列）",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "text"
                                ],
                                "description": "内容类型，目前为文本"
                              },
                              "text": {
                                "type": "string",
                                "description": "文本内容"
                              }
                            }
                          }
                        },
                        {
                          "type": "string",
                          "nullable": true,
                          "description": "当使用`tool_calls`时，`content`可能为`null`"
                        }
                      ]
                    },
                    "audio": {
                      "type": "object",
                      "description": "当使用 `glm-4-voice` 模型时返回的音频内容",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "当前对话的音频内容`id`，可用于多轮对话输入"
                        },
                        "data": {
                          "type": "string",
                          "description": "当前对话的音频内容`base64`编码"
                        },
                        "expires_at": {
                          "type": "string",
                          "description": "当前对话的音频内容过期时间"
                        }
                      }
                    },
                    "reasoning_content": {
                      "type": "string",
                      "description": "思维链内容, 仅 `glm-4.5` 系列支持"
                    },
                    "tool_calls": {
                      "type": "array",
                      "description": "生成的应该被调用的工具信息，流式返回时会逐步生成",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "description": "工具调用索引"
                          },
                          "id": {
                            "type": "string",
                            "description": "工具调用的唯一标识符"
                          },
                          "type": {
                            "type": "string",
                            "description": "工具类型，目前支持`function`",
                            "enum": [
                              "function"
                            ]
                          },
                          "function": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string",
                                "description": "函数名称"
                              },
                              "arguments": {
                                "type": "string",
                                "description": "函数参数，`JSON`格式字符串"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "finish_reason": {
                  "type": "string",
                  "description": "模型推理终止的原因。`stop` 表示自然结束或触发stop词，`tool_calls` 表示模型命中函数，`length` 表示达到 `token` 长度限制，`sensitive` 表示内容被安全审核接口拦截（用户应判断并决定是否撤回公开内容），`network_error` 表示模型推理异常，'model_context_window_exceeded'表示超出模型上下文窗口。",
                  "enum": [
                    "stop",
                    "length",
                    "tool_calls",
                    "sensitive",
                    "network_error"
                  ]
                }
              }
            }
          },
          "usage": {
            "type": "object",
            "description": "本次模型调用的 `tokens` 数量统计",
            "properties": {
              "prompt_tokens": {
                "type": "integer",
                "description": "用户输入的 `tokens` 数量。对于 `glm-4-voice`，`1`秒音频=`12.5 Tokens`，向上取整。"
              },
              "completion_tokens": {
                "type": "integer",
                "description": "模型输出的 `tokens` 数量"
              },
              "total_tokens": {
                "type": "integer",
                "description": "总 `tokens` 数量，对于 `glm-4-voice` 模型，`1`秒音频=`12.5 Tokens`，向上取整"
              }
            }
          },
          "content_filter": {
            "type": "array",
            "description": "返回内容安全的相关信息",
            "items": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string",
                  "description": "安全生效环节，包括：`role = assistant` 模型推理，`role = user` 用户输入，`role = history` 历史上下文"
                },
                "level": {
                  "type": "integer",
                  "description": "严重程度 `level 0-3`，`level 0` 表示最严重，`3` 表示轻微"
                }
              }
            }
          }
        }
      },
      "CogVideoX3Request": {
        "allOf": [
          {
            "$ref": "#/components/schemas/BaseVideoGenerationRequest"
          },
          {
            "type": "object",
            "properties": {
              "model": {
                "type": "string",
                "description": "要调用的模型编码。",
                "enum": [
                  "cogvideox-3"
                ]
              },
              "prompt": {
                "type": "string",
                "example": "A cat is playing with a ball.",
                "description": "视频的文本描述，字符长度不能超过`512`个字符。`image_url` 和 `prompt` 不能同时为空。"
              },
              "image_url": {
                "description": "提供基于其生成内容的图像，如果传入此参数，系统将以该图像为基础进行操作。支持通过`URL`或`Base64`编码传入图片。图片要求如下：图片支持.`png、.jpeg、.jpg` 格式、图片大小：不超过`5M`。 `image_url` 和 `prompt` 不能同时为空。\n首尾帧：支持输入两张图，上传的第一张图片视作首帧图，第二张图片视作尾帧图，模型将以此参数中传入的图片来生成视频。",
                "$ref": "#/components/schemas/ImageUrlInputExtended"
              },
              "size": {
                "type": "string",
                "description": "默认值：若不指定，默认生成视频的短边为 `1080`，长边根据原图片比例确认。最高支持 `4K` 分辨率。",
                "example": "1920x1080",
                "enum": [
                  "1280x720",
                  "720x1280",
                  "1024x1024",
                  "1920x1080",
                  "1080x1920",
                  "2048x1080",
                  "3840x2160"
                ]
              },
              "fps": {
                "type": "integer",
                "description": "视频帧率（`FPS`），可选值为 `30` 或 `60`。默认值：`30`。",
                "example": 30,
                "enum": [
                  30,
                  60
                ]
              },
              "duration": {
                "type": "integer",
                "description": "视频持续时长，默认`5`秒，支持`5`、`10`",
                "example": 5,
                "enum": [
                  5,
                  10
                ]
              }
            },
            "required": [
              "model"
            ]
          },
          {
            "$ref": "#/components/schemas/VideoCommonRequest"
          }
        ]
      },
      "CogVideoXRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/BaseVideoGenerationRequest"
          },
          {
            "type": "object",
            "properties": {
              "model": {
                "type": "string",
                "description": "要调用的代码。",
                "enum": [
                  "cogvideox-2",
                  "cogvideox-flash"
                ]
              },
              "prompt": {
                "type": "string",
                "description": "视频的文本描述，最大输入长度为 `512` 个字符。必须提供 `image_url` 或 `prompt`，或两者都提供。"
              },
              "image_url": {
                "description": "用于内容生成的基础图像。如果提供，系统将基于此图像进行操作。支持 `URL` 或 `Base64` 编码图像。图像要求：支持 `.png、.jpeg、.jpg` 格式；图像大小不超过 `5M`。必须提供 `image_url` 或 `prompt`，或两者都提供。",
                "$ref": "#/components/schemas/ImageUrlInput"
              },
              "size": {
                "type": "string",
                "description": "默认：如果未指定，生成视频的短边默认为 `1080`，长边根据原始图像比例缩放。支持最高 `4K` 分辨率。分辨率选项：`720x480`、`1024x1024`、`1280x960`、`960x1280`、`1920x1080`、`1080x1920`、`2048x1080`、`3840x2160`。",
                "example": "1920x1080",
                "enum": [
                  "720x480",
                  "1024x1024",
                  "1280x960",
                  "960x1280",
                  "1920x1080",
                  "1080x1920",
                  "2048x1080",
                  "3840x2160"
                ]
              },
              "fps": {
                "type": "integer",
                "description": "视频帧率（`FPS`），可选值为 `30` 或 `60`。默认：`30`。",
                "example": 30,
                "enum": [
                  30,
                  60
                ]
              }
            },
            "required": [
              "model"
            ]
          },
          {
            "$ref": "#/components/schemas/VideoCommonRequest"
          }
        ]
      },
      "ViduText2VideoRequest": {
        "allOf": [
          {
            "type": "object",
            "properties": {
              "model": {
                "type": "string",
                "description": "要调用的代码。",
                "enum": [
                  "viduq1-text"
                ]
              },
              "prompt": {
                "type": "string",
                "description": "视频的文本描述，最大输入长度为 `512` 个字符。"
              },
              "style": {
                "type": "string",
                "description": "风格\n默认：`general`\n可选值：`general`、`anime`\n`general`：通用风格，可以使用提示词控制定义风格。\n`anime`：动漫风格，针对动漫特定视觉效果进行优化。可以使用不同的动漫主题提示词控制风格。",
                "enum": [
                  "general",
                  "anime"
                ]
              },
              "duration": {
                "type": "integer",
                "description": "视频时长参数。\n默认：`5`，可选：`5`。",
                "example": 5,
                "enum": [
                  5
                ]
              },
              "aspect_ratio": {
                "type": "string",
                "description": "宽高比\n默认：`16:9`，可选值：`16:9`、`9:16`、`1:1`",
                "example": "16:9",
                "enum": [
                  "16:9",
                  "9:16",
                  "1:1"
                ]
              },
              "size": {
                "type": "string",
                "description": "分辨率参数\n默认：`1920x1080`，可选：`1920x1080`",
                "example": "1920x1080",
                "enum": [
                  "1920x1080"
                ]
              },
              "movement_amplitude": {
                "type": "string",
                "description": "运动幅度\n默认：`auto`，可选值：`auto`、`small`、`medium`、`large`",
                "example": "auto",
                "enum": [
                  "auto",
                  "small",
                  "medium",
                  "large"
                ]
              }
            },
            "required": [
              "model",
              "prompt"
            ]
          },
          {
            "$ref": "#/components/schemas/VideoCommonRequest"
          }
        ]
      },
      "ViduImage2VideoRequest": {
        "allOf": [
          {
            "type": "object",
            "properties": {
              "model": {
                "type": "string",
                "description": "要调用的代码。",
                "enum": [
                  "viduq1-image",
                  "vidu2-image"
                ]
              },
              "prompt": {
                "type": "string",
                "description": "视频的文本描述，最大输入长度为 `512` 个字符。必须提供 `image_url` 或 `prompt`，或两者都提供。"
              },
              "image_url": {
                "description": "系统将使用此参数中提供的图像作为第一帧来生成视频。\n仅支持 `1` 张图像。\n支持的格式：`png`、`jpeg`、`jpg`、`webp`。\n图像宽高比必须小于 `1:4` 或 `4:1`。\n图像文件大小不得超过 `50MB`。\n注意：`Base64` 解码后，字节长度必须小于 `50MB`，编码必须包含适当的内容类型字符串（例如，`data:image/png;base64,{base64_encode}`）。",
                "$ref": "#/components/schemas/ImageUrlInput"
              },
              "duration": {
                "oneOf": [
                  {
                    "title": "viduq1-image",
                    "type": "integer",
                    "description": "视频时长参数。\n默认：`5`，可选：`5`。",
                    "example": 5,
                    "enum": [
                      5
                    ]
                  },
                  {
                    "title": "viduq2-image",
                    "type": "integer",
                    "description": "视频时长参数。\n默认：`4`，可选：`4`。",
                    "example": 4,
                    "enum": [
                      4
                    ]
                  }
                ]
              },
              "size": {
                "oneOf": [
                  {
                    "title": "viduq1-image",
                    "type": "string",
                    "description": "分辨率参数\n默认：`1920x1080`，可选：`1920x1080`",
                    "example": "1920x1080",
                    "enum": [
                      "1920x1080"
                    ]
                  },
                  {
                    "title": "viduq2-image",
                    "type": "string",
                    "description": "分辨率参数\n默认：`1280x720`，可选：`1280x720`",
                    "example": "1280x720",
                    "default": "1280x720",
                    "enum": [
                      "1280x720"
                    ]
                  }
                ]
              },
              "movement_amplitude": {
                "type": "string",
                "description": "运动幅度\n默认：`auto`，可选值：`auto`、`small`、`medium`、`large`",
                "example": "auto",
                "enum": [
                  "auto",
                  "small",
                  "medium",
                  "large"
                ]
              },
              "with_audio": {
                "type": "boolean",
                "description": "为生成的视频添加背景音乐，仅当最终生成的视频时长为 `4`秒 时支持。"
              }
            },
            "required": [
              "model"
            ]
          },
          {
            "$ref": "#/components/schemas/VideoCommonRequest"
          }
        ]
      },
      "ViduFrames2VideoRequest": {
        "allOf": [
          {
            "type": "object",
            "properties": {
              "model": {
                "type": "string",
                "description": "要调用的代码。",
                "enum": [
                  "viduq1-start-end",
                  "vidu2-start-end"
                ]
              },
              "prompt": {
                "type": "string",
                "description": "视频的文本描述，最大输入长度为 `512` 个字符。必须提供 `image_url` 或 `prompt`，或两者都提供。"
              },
              "image_url": {
                "type": "array",
                "description": "图像\n支持输入两张图像：第一张上传的图像将被视为第一帧，第二张图像作为最后一帧。模型将使用此参数中提供的图像来生成视频。\n两张输入图像（第一帧和最后一帧）的分辨率必须相似，第一帧分辨率与最后一帧分辨率的比例应在 `0.8–1.25` 范围内。此外，图像宽高比必须小于 `1:4` 或 `4:1`。\n支持图像 `URL` 或 `Base64` 编码的图像（确保可访问性；建议使用图像 URL）。\n支持的格式：`png`、`jpeg`、`.jpg`、`webp`。\n图像文件大小不得超过 `50 MB`。\n注意：`Base64` 解码后，字节长度必须小于 `50MB`，编码必须包含适当的内容类型字符串，例如 `data:image/png;base64,{base64_encode}`。",
                "items": {
                  "type": "string",
                  "minLength": 1
                },
                "minItems": 1,
                "maxItems": 2
              },
              "duration": {
                "oneOf": [
                  {
                    "title": "viduq1-start-end",
                    "type": "integer",
                    "description": "视频时长参数。\n默认：`5`，可选：`5`。",
                    "example": 5,
                    "enum": [
                      5
                    ]
                  },
                  {
                    "title": "vidu2-start-end",
                    "type": "integer",
                    "description": "视频时长参数。\n默认：`4`，可选：`4`。",
                    "example": 4,
                    "enum": [
                      4
                    ]
                  }
                ]
              },
              "size": {
                "oneOf": [
                  {
                    "title": "viduq1-start-end",
                    "type": "string",
                    "description": "分辨率参数\n默认：`1920x1080`，可选：`1920x1080`",
                    "example": "1920x1080",
                    "enum": [
                      "1920x1080"
                    ]
                  },
                  {
                    "title": "vidu2-start-end",
                    "type": "string",
                    "description": "分辨率参数\n默认：`1280x720`，可选：`1280x720`, `480x360`",
                    "example": "1280x720",
                    "default": "1280x720",
                    "enum": [
                      "1280x720",
                      "480x360"
                    ]
                  }
                ]
              },
              "movement_amplitude": {
                "type": "string",
                "description": "运动幅度\n默认：`auto`，可选值：`auto`、`small`、`medium`、`large`",
                "example": "auto",
                "enum": [
                  "auto",
                  "small",
                  "medium",
                  "large"
                ]
              },
              "with_audio": {
                "type": "boolean",
                "description": "为生成的视频添加背景音乐。"
              }
            },
            "required": [
              "model"
            ]
          },
          {
            "$ref": "#/components/schemas/VideoCommonRequest"
          }
        ]
      },
      "ViduReference2VideoRequest": {
        "allOf": [
          {
            "type": "object",
            "properties": {
              "model": {
                "type": "string",
                "description": "要调用的代码。",
                "enum": [
                  "vidu2-reference"
                ]
              },
              "prompt": {
                "type": "string",
                "description": "视频的文本描述，最大输入长度为 `512` 个字符。必须提供 `image_url` 或 `prompt`，或两者都提供。"
              },
              "image_url": {
                "type": "array",
                "description": "图像参考\n支持输入 `1` 到 `3` 张图像。模型将使用此参数中提供的图像主题作为参考，生成具有一致主体的视频。\n1. 支持图像 `URL` 或 `Base64` 编码的图像（确保可访问性；建议优先使用图像 URL）。\n2. 支持的格式：`png`、`jpeg`、`.jpg`、`webp`。\n3. 图像分辨率不得小于 `128x128`，宽高比必须小于 `1:4` 或 `4:1`。\n4. 图像文件大小不得超过 `50 MB`。\n5. 注意：`Base64` 解码后，字节长度必须小于 `50MB`，编码必须包含适当的内容类型字符串，例如 `data:image/png;base64,{base64_encode}`。",
                "items": {
                  "type": "string",
                  "minLength": 1
                },
                "minItems": 1,
                "maxItems": 3
              },
              "duration": {
                "title": "vidu2-reference",
                "type": "integer",
                "description": "视频时长参数。\n默认：`4`，可选：`4`。",
                "example": 4,
                "enum": [
                  4
                ]
              },
              "aspect_ratio": {
                "type": "string",
                "description": "宽高比\n默认：`16:9`，可选值：`16:9`、`9:16`、`1:1`",
                "example": "16:9",
                "enum": [
                  "16:9",
                  "9:16",
                  "1:1"
                ]
              },
              "size": {
                "title": "vidu2-reference ",
                "type": "string",
                "description": "分辨率参数\n默认：`1280x720`，可选：`1280x720`",
                "example": "1280x720",
                "enum": [
                  "1280x720"
                ]
              },
              "movement_amplitude": {
                "type": "string",
                "description": "运动幅度\n默认：`auto`，可选值：`auto`、`small`、`medium`、`large`",
                "example": "auto",
                "enum": [
                  "auto",
                  "small",
                  "medium",
                  "large"
                ]
              },
              "with_audio": {
                "type": "boolean",
                "description": "为生成的视频添加背景音乐。"
              }
            },
            "required": [
              "model"
            ]
          },
          {
            "$ref": "#/components/schemas/VideoCommonRequest"
          }
        ]
      },
      "ImageUrlInput": {
        "oneOf": [
          {
            "title": "Image URL",
            "type": "string",
            "format": "uri",
            "example": "https://example.com/image.png"
          },
          {
            "title": "Base64 Encoded Image",
            "type": "string",
            "format": "byte",
            "example": "data:image/png;base64, XXX"
          }
        ]
      },
      "ImageUrlInputExtended": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ImageUrlInput"
          },
          {
            "title": "Image URLs Array (First & Last Frame)",
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            },
            "minItems": 2,
            "maxItems": 2,
            "example": [
              "https://example.com/first_frame.png",
              "https://example.com/last_frame.png"
            ]
          }
        ]
      },
      "BaseVideoGenerationRequest": {
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "description": "视频的文本描述"
          },
          "quality": {
            "type": "string",
            "description": "输出模式，默认为 `speed`。 `quality`：质量优先，生成质量高。 `speed`：速度优先，生成时间更快，质量相对稍低。",
            "example": "speed",
            "enum": [
              "speed",
              "quality"
            ]
          },
          "with_audio": {
            "type": "boolean",
            "description": "是否生成 `AI` 音效。默认值：`False` （不生成音效）。",
            "example": false
          },
          "watermark_enabled": {
            "type": "boolean",
            "description": "控制`AI`生成图片时是否添加水印。\n - `true`: 默认启用`AI`生成的显式水印及隐式数字水印，符合政策要求。\n - `false`: 关闭所有水印，仅允许已签署免责声明的客户使用，签署路径：个人中心-安全管理-去水印管理",
            "example": true
          }
        }
      },
      "VideoCommonRequest": {
        "type": "object",
        "properties": {
          "request_id": {
            "type": "string",
            "description": "由客户端提供，必须唯一；用于区分每个请求的唯一标识符。如果客户端未提供，平台将默认生成一个。"
          },
          "user_id": {
            "type": "string",
            "description": "终端用户的唯一 `ID`，协助平台干预终端用户违规、生成非法或不当信息或其他滥用行为。`ID` 长度要求：最少 `6` 个字符，最多 `128` 个字符。"
          }
        }
      },
      "AsyncResponse": {
        "type": "object",
        "properties": {
          "model": {
            "description": "此次调用使用的名称。",
            "type": "string"
          },
          "id": {
            "description": "生成的任务`ID`，调用请求结果接口时使用此`ID`。",
            "type": "string"
          },
          "request_id": {
            "description": "用户在客户端请求期间提交的任务编号或平台生成的任务编号。",
            "type": "string"
          },
          "task_status": {
            "description": "处理状态，`PROCESSING (处理中)`、`SUCCESS (成功)`、`FAIL (失败)`。结果需要通过查询获取。",
            "type": "string"
          }
        }
      },
      "WebSearchRequest": {
        "type": "object",
        "properties": {
          "search_query": {
            "type": "string",
            "description": "需要进行搜索的内容，建议搜索 `query` 不超过 `70` 个字符。",
            "maxLength": 70
          },
          "search_engine": {
            "type": "string",
            "description": "要调用的搜索引擎编码。目前支持：\n`search_std`：智谱基础版搜索引擎\n`search_pro`：智谱高阶版搜索引擎\n`search_pro_sogou`：搜狗\n`search_pro_quark`：夸克搜索",
            "example": "search_std",
            "enum": [
              "search_std",
              "search_pro",
              "search_pro_sogou",
              "search_pro_quark"
            ]
          },
          "search_intent": {
            "type": "boolean",
            "description": "是否进行搜索意图识别，默认不执行搜索意图识别。\n`true`：执行搜索意图识别，有搜索意图后执行搜索\n`false`：跳过搜索意图识别，直接执行搜索",
            "default": false
          },
          "count": {
            "type": "integer",
            "description": "返回结果的条数。可填范围：`1-50`，最大单次搜索返回`50`条，默认为`10`。\n支持的搜索引擎：`search_pro_sogou`、`search_std`、`search_pro`\n`search_pro_sogou`: 可选枚举值，10、20、30、40、50。注意同时指定 search_domain_filter 和 search_recency_filter 时 count 不生效。",
            "minimum": 1,
            "maximum": 50,
            "default": 10
          },
          "search_domain_filter": {
            "type": "string",
            "description": "用于限定搜索结果的范围，仅返回指定白名单域名的内容。\n白名单域名:（如 `www.example.com`）\n支持的搜索引擎：`search_std、search_pro 、search_pro_sogou`"
          },
          "search_recency_filter": {
            "type": "string",
            "description": "搜索指定时间范围内的网页。默认为 `noLimit`。可填值：`oneDay`（一天内）、`oneWeek`（一周内）、`oneMonth`（一个月内）、`oneYear`（一年内）、`noLimit`（不限，默认）。支持的搜索引擎：`search_std、search_pro、search_pro_Sogou、search_pro_quark`",
            "default": "noLimit",
            "enum": [
              "oneDay",
              "oneWeek",
              "oneMonth",
              "oneYear",
              "noLimit"
            ]
          },
          "content_size": {
            "type": "string",
            "description": "控制返回网页内容的长短。`medium`：返回摘要信息，满足大模型的基础推理需求，满足常规问答任务的信息检索需求。`high`：最大化上下文，信息量较大但内容详细，适合需要信息细节的场景。支持的搜索引擎：`search_std、search_pro、search_pro_Sogou、search_pro_quark`",
            "enum": [
              "medium",
              "high"
            ]
          },
          "request_id": {
            "type": "string",
            "description": "请求唯一标识符。由用户端传递，`ID`长度要求：最少`6`个字符，最多`64`个字符，建议使用`UUID`格式确保唯一性，若未提供平台将自动生成。",
            "minLength": 6,
            "maxLength": 64
          },
          "user_id": {
            "type": "string",
            "description": "终端用户的唯一`ID`，帮助平台对终端用户的非法活动、生成非法不当信息或其他滥用行为进行干预。`ID`长度要求：至少`6`个字符，最多`128`个字符。",
            "minLength": 6,
            "maxLength": 128
          }
        },
        "required": [
          "search_query",
          "search_engine",
          "search_intent"
        ]
      },
      "WebSearchResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "任务 ID"
          },
          "created": {
            "type": "integer",
            "description": "请求创建时间，是以秒为单位的 `Unix` 时间戳"
          },
          "request_id": {
            "type": "string",
            "description": "请求标识符"
          },
          "search_intent": {
            "type": "array",
            "description": "搜索意图结果",
            "items": {
              "type": "object",
              "properties": {
                "query": {
                  "type": "string",
                  "description": "原始搜索query"
                },
                "intent": {
                  "type": "string",
                  "description": "识别的意图类型。`SEARCH_ALL` = 搜索全网，`SEARCH_NONE` = 无搜索意图，`SEARCH_ALWAYS` = 强制搜索模式：当`search_intent=false`时返回此值",
                  "enum": [
                    "SEARCH_ALL",
                    "SEARCH_NONE",
                    "SEARCH_ALWAYS"
                  ]
                },
                "keywords": {
                  "type": "string",
                  "description": "改写后的搜索关键词"
                }
              }
            }
          },
          "search_result": {
            "type": "array",
            "description": "搜索结果",
            "items": {
              "type": "object",
              "properties": {
                "title": {
                  "type": "string",
                  "description": "标题"
                },
                "content": {
                  "type": "string",
                  "description": "内容摘要"
                },
                "link": {
                  "type": "string",
                  "description": "结果链接"
                },
                "media": {
                  "type": "string",
                  "description": "网站名称"
                },
                "icon": {
                  "type": "string",
                  "description": "网站图标"
                },
                "refer": {
                  "type": "string",
                  "description": "角标序号"
                },
                "publish_date": {
                  "type": "string",
                  "description": "网站发布时间"
                }
              }
            }
          }
        }
      },
      "ReaderRequest": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "需要抓取的`url`"
          },
          "timeout": {
            "type": "integer",
            "description": "请求超时时间（秒），默认值 `20`",
            "default": 20
          },
          "no_cache": {
            "type": "boolean",
            "description": "是否禁用缓存（`true`/`false`），默认值 `false`",
            "default": false
          },
          "return_format": {
            "type": "string",
            "description": "返回格式（如：`markdown`、`text`等），默认值 `markdown`",
            "default": "markdown"
          },
          "retain_images": {
            "type": "boolean",
            "description": "是否保留图片（`true`/`false`），默认值 `true`",
            "default": true
          },
          "no_gfm": {
            "type": "boolean",
            "description": "是否禁用 `GitHub Flavored Markdown`（`true`/`false`），默认值 `false`",
            "default": false
          },
          "keep_img_data_url": {
            "type": "boolean",
            "description": "是否保留图片数据 `URL`（`true`/`false`），默认值 `false`",
            "default": false
          },
          "with_images_summary": {
            "type": "boolean",
            "description": "是否包含图片摘要（`true`/`false`），默认值 `false`",
            "default": false
          },
          "with_links_summary": {
            "type": "boolean",
            "description": "是否包含链接摘要（`true`/`false`），默认值 `false`",
            "default": false
          }
        },
        "required": [
          "url"
        ]
      },
      "ReaderResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "任务 `ID`"
          },
          "created": {
            "type": "integer",
            "format": "int64",
            "description": "请求创建时间，是以秒为单位的 `Unix` 时间戳"
          },
          "request_id": {
            "type": "string",
            "description": "由用户端传递，需要唯一；用于区分每次请求的唯一标识符。如果用户端未提供，平台将默认生成。"
          },
          "model": {
            "type": "string",
            "description": "模型编码"
          },
          "reader_result": {
            "type": "object",
            "description": "网页阅读结果",
            "properties": {
              "content": {
                "type": "string",
                "description": "网页解析后的主要内容（正文、图片、链接等标记）"
              },
              "description": {
                "type": "string",
                "description": "网页简要描述"
              },
              "title": {
                "type": "string",
                "description": "网页标题"
              },
              "url": {
                "type": "string",
                "description": "网页原始地址"
              },
              "external": {
                "type": "object",
                "description": "网页引用的外部资源对象",
                "properties": {
                  "stylesheet": {
                    "type": "object",
                    "description": "外部样式表集合",
                    "additionalProperties": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "样式表类型，通常为`text/css`"
                        }
                      }
                    }
                  }
                }
              },
              "metadata": {
                "type": "object",
                "description": "页面元数据信息",
                "properties": {
                  "keywords": {
                    "type": "string",
                    "description": "页面关键词"
                  },
                  "viewport": {
                    "type": "string",
                    "description": "页面视口设置"
                  },
                  "description": {
                    "type": "string",
                    "description": "元数据描述"
                  },
                  "format-detection": {
                    "type": "string",
                    "description": "格式检测设置，如`telephone=no`"
                  }
                }
              }
            }
          }
        }
      },
      "ModerationRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "description": "安全模型",
            "enum": [
              "moderation"
            ],
            "default": "moderation"
          },
          "input": {
            "description": "需要审核的内容\n 纯文本字符串（最大输入长度：`2000` 字符）\n多媒体对象(`type+url`)\n 图片：图片小于 `10M`，最低分辨率 `20* 20`，不超过 `6000 * 6000`\n视频：推荐视频时长 `30` 秒\n音频：推荐音频时长 `60` 秒",
            "oneOf": [
              {
                "type": "string",
                "description": "需要审核的文本内容",
                "example": "审核内容安全样例字符串。"
              },
              {
                "type": "object",
                "description": "单个多模态审核内容",
                "properties": {
                  "type": {
                    "type": "string",
                    "description": "内容类型，可以是文本、视频链接、音频链接或图片链接",
                    "enum": [
                      "text",
                      "image_url",
                      "video_url",
                      "audio_url"
                    ]
                  },
                  "text": {
                    "type": "string",
                    "description": "当 `type` 为 `text` 时的文本内容",
                    "example": "待审核内容"
                  },
                  "image_url": {
                    "type": "object",
                    "description": "当 `type` 为 `image_url` 时的图片参数",
                    "properties": {
                      "url": {
                        "type": "string",
                        "description": "当 `type` 为 `image_url` 时的图片链接地址"
                      }
                    }
                  },
                  "video_url": {
                    "type": "object",
                    "description": "当 `type` 为 `video_url` 时的视频参数",
                    "properties": {
                      "url": {
                        "type": "string",
                        "description": "当 `type` 为 `video_url` 时的视频链接地址"
                      }
                    }
                  },
                  "audio_url": {
                    "type": "object",
                    "description": "当 `type` 为 `audio_url` 时的音频参数",
                    "properties": {
                      "url": {
                        "type": "string",
                        "description": "当 `type` 为 `audio_url` 时的音频链接地址"
                      }
                    }
                  }
                },
                "required": [
                  "type"
                ]
              },
              {
                "type": "array",
                "description": "审核多模态内容数组，支持文本、文件和图片",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "description": "内容类型，可以是文本、视频链接、音频链接或图片链接",
                      "enum": [
                        "text",
                        "image_url",
                        "video_url",
                        "audio_url"
                      ]
                    },
                    "text": {
                      "type": "string",
                      "description": "当 `type` 为 `text` 时的文本内容",
                      "example": "待审核内容"
                    },
                    "image_url": {
                      "type": "object",
                      "description": "当 `type` 为 `image_url` 时的图片参数",
                      "properties": {
                        "url": {
                          "type": "string",
                          "description": "当 `type` 为 `image_url` 时的图片链接地址"
                        }
                      }
                    },
                    "video_url": {
                      "type": "object",
                      "description": "当 `type` 为 `video_url` 时的视频参数",
                      "properties": {
                        "url": {
                          "type": "string",
                          "description": "当 `type` 为 `video_url` 时的视频链接地址"
                        }
                      }
                    },
                    "audio_url": {
                      "type": "object",
                      "description": "当 `type` 为 `audio_url` 时的音频参数",
                      "properties": {
                        "url": {
                          "type": "string",
                          "description": "当 `type` 为 `audio_url` 时的音频链接地址"
                        }
                      }
                    }
                  }
                }
              }
            ]
          }
        },
        "required": [
          "model",
          "input"
        ]
      },
      "ModerationResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "任务 `ID`"
          },
          "created": {
            "type": "integer",
            "description": "请求创建时间，是以秒为单位的 `Unix` 时间戳"
          },
          "request_id": {
            "type": "string",
            "description": "请求标识符"
          },
          "result_list": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "content_type": {
                  "description": "内容类型",
                  "type": "string"
                },
                "risk_level": {
                  "type": "string",
                  "enum": [
                    "PASS",
                    "REVIEW",
                    "BLOCK",
                    "REJECT",
                    "HIGH"
                  ],
                  "description": "检测结果，处置建议，可能返回值：\nPASS：正常，机审不拦截，建议直接放行\nREVIEW：可疑，机审不拦截，建议人工后审\nBLOCK：一般违规，建议机审拦截，但可以不终止本轮对话\nREJECT：违规，建议机审拦截，并终止多轮对话\nHIGH：高危，建议机审拦截，输入也要做回撤处理"
                },
                "risk_type": {
                  "type": "array",
                  "description": "风险类型列表",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "usage": {
            "type": "object",
            "properties": {
              "moderation_text": {
                "type": "object",
                "properties": {
                  "call_count": {
                    "type": "number"
                  }
                }
              }
            }
          }
        }
      },
      "AudioSpeechRequest": {
        "type": "object",
        "required": [
          "model",
          "input",
          "voice"
        ],
        "properties": {
          "model": {
            "type": "string",
            "enum": [
              "glm-tts"
            ],
            "default": "glm-tts",
            "description": "要使用的`TTS`模型"
          },
          "input": {
            "type": "string",
            "description": "要转换为语音的文本",
            "default": "你好，今天天气怎么样",
            "maxLength": 1024
          },
          "voice": {
            "type": "string",
            "enum": [
              "tongtong",
              "chuichui",
              "xiaochen",
              "jam",
              "kazi",
              "douji",
              "luodo"
            ],
            "default": "tongtong",
            "description": "生成音频时使用的音色，支持系统音色以及复刻音色两种类型，其中系统音色如下：\n`tongtong`: 彤彤，默认音色 \n`chuichui`: 锤锤 \n`xiaochen`: 小陈 \n`jam`: 动动动物圈`jam`音色 \n`kazi`: 动动动物圈`kazi`音色 \n`douji`: 动动动物圈`douji`音色 \n`luodo`: 动动动物圈`luodo`音色"
          },
          "watermark_enabled": {
            "type": "boolean",
            "description": "控制`AI`生成音频时是否添加水印。去水印操作路径：右上角个人中心-安全管理-去水印管理-打开开关。\n - `true`: 默认启用`AI`生成的显式水印及隐式数字水印，符合政策要求。\n - `false`: 关闭所有水印，仅对已完成去水印动作的用户生效。",
            "example": true
          },
          "stream": {
            "type": "boolean",
            "default": false,
            "description": "是否启用流式输出。\n- `true`: 启用流式输出，模型将通过标准`Event Stream`逐块返回生成的音频内容。\n- `false`: 关闭流式输出，模型在生成所有内容后一次性返回所有内容。默认值为`false`。"
          },
          "speed": {
            "type": "number",
            "description": "语速，默认1.0，取值范围[0.5, 2]"
          },
          "volume": {
            "type": "number",
            "description": "音量，默认1.0，取值范围(0, 10]"
          },
          "encode_format": {
            "type": "string",
            "enum": [
              "base64",
              "hex"
            ],
            "description": "仅流式返回时，决定返回的编码格式。默认返回对应音频文件格式的`base64`字符串。"
          },
          "response_format": {
            "type": "string",
            "enum": [
              "wav",
              "pcm"
            ],
            "default": "pcm",
            "description": "音频输出格式，默认返回`pcm`格式的文件。流式生成音频时，仅支持返回`pcm`格式的文件"
          }
        }
      },
      "AudioTranscriptionRequest": {
        "type": "object",
        "required": [
          "file",
          "model"
        ],
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "description": "需要转录的音频文件，支持上传的音频文件格式：`.wav / .mp3`，规格限制：文件大小 ≤ `25 MB`、音频时长 ≤ `30 秒`"
          },
          "file_base64": {
            "type": "string",
            "description": "音频文件Base64编码。file_base64 和 file 只需要传一个（同时传入以file为准）"
          },
          "model": {
            "type": "string",
            "description": "要调用的模型编码",
            "enum": [
              "glm-asr-2512"
            ],
            "default": "glm-asr-2512"
          },
          "prompt": {
            "type": "string",
            "description": "在长文本场景中，可以提供之前的转录结果作为上下文。建议小于8000字。"
          },
          "hotwords": {
            "type": "array",
            "description": "热词表，用于提升特定领域词汇识别率。格式例如[\"人名\",\"地名\"]，建议不超过100个。",
            "items": {
              "type": "string"
            },
            "maxItems": 100
          },
          "stream": {
            "type": "boolean",
            "default": false,
            "description": "该参数在使用同步调用时应设置为`false`或省略。表示模型在生成所有内容后一次性返回所有内容。默认值为`false`。如果设置为`true`，模型将通过标准`Event Stream`逐块返回生成的内容。当`Event Stream`结束时，将返回一个`data: [DONE]`消息。"
          },
          "request_id": {
            "type": "string",
            "description": "请求唯一标识符。由用户端传递，`ID`长度要求：最少`6`个字符，最多`64`个字符，建议使用`UUID`格式确保唯一性，若未提供平台将自动生成。",
            "minLength": 6,
            "maxLength": 64
          },
          "user_id": {
            "type": "string",
            "description": "终端用户的唯一`ID`，帮助平台对终端用户的非法活动、生成非法不当信息或其他滥用行为进行干预。`ID`长度要求：至少`6`个字符，最多`128`个字符。"
          }
        }
      },
      "AudioTranscriptionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "任务 ID"
          },
          "created": {
            "type": "integer",
            "format": "int64",
            "description": "请求创建时间，是以秒为单位的 `Unix` 时间戳"
          },
          "request_id": {
            "type": "string",
            "description": "由用户端传递，需要唯一；用于区分每次请求的唯一标识符。如果用户端未提供，平台将默认生成。"
          },
          "model": {
            "type": "string",
            "description": "模型名称"
          },
          "text": {
            "type": "string",
            "description": "音频转录的完整内容"
          }
        }
      },
      "AudioTranscriptionStreamResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "任务 ID"
          },
          "created": {
            "type": "integer",
            "format": "int64",
            "description": "请求创建时间，是以秒为单位的 `Unix` 时间戳"
          },
          "model": {
            "type": "string",
            "description": "模型名称"
          },
          "type": {
            "type": "string",
            "description": "音频转录事件类型，`transcript.text.delta`表示正在转录，`transcript.text.done`表示转录完成"
          },
          "delta": {
            "type": "string",
            "description": "模型增量返回的音频转录信息"
          }
        }
      },
      "VoiceCloneRequest": {
        "type": "object",
        "required": [
          "voice_name",
          "input",
          "file_id",
          "model"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "模型",
            "enum": [
              "glm-tts-clone"
            ],
            "default": "glm-tts-clone",
            "example": "glm-tts-clone"
          },
          "voice_name": {
            "type": "string",
            "description": "指定唯一的音色名称",
            "example": "my_custom_voice_001"
          },
          "text": {
            "type": "string",
            "description": "示例音频的文本内容，选填",
            "example": "你好，这是一段示例音频的文本内容，用于音色复刻参考。"
          },
          "input": {
            "type": "string",
            "description": "生成试听音频的目标文本内容",
            "example": "欢迎使用我们的音色复刻服务，这将生成与示例音频相同音色的语音。"
          },
          "file_id": {
            "type": "string",
            "description": "示例音频的file_id，通过文件接口上传获取。大小限制不超过10M，建议音频时长在3秒到30秒之间。",
            "example": "file_abc123def456ghi789"
          },
          "request_id": {
            "type": "string",
            "description": "请求唯一标识符。由用户端传递，`ID`长度要求：最少`6`个字符，最多`64`个字符，建议使用`UUID`格式确保唯一性，若未提供平台将自动生成。",
            "minLength": 6,
            "maxLength": 64
          }
        }
      },
      "VoiceCloneResponse": {
        "type": "object",
        "properties": {
          "voice": {
            "type": "string",
            "description": "音色",
            "example": "voice_clone_20240315_143052_001"
          },
          "file_id": {
            "type": "string",
            "description": "音频试听文件ID",
            "example": "file_xyz789abc456def123"
          },
          "file_purpose": {
            "type": "string",
            "description": "文件 purpose，固定为voice-clone-output",
            "example": "voice-clone-output"
          },
          "request_id": {
            "type": "string",
            "description": "请求 ID",
            "example": "voice_clone_req_20240315_143052_001"
          }
        }
      },
      "VoiceListResponse": {
        "type": "object",
        "properties": {
          "voice_list": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VoiceVO"
            },
            "description": "音色列表"
          }
        }
      },
      "VoiceSaveRequest": {
        "type": "object",
        "required": [
          "voice"
        ],
        "properties": {
          "voice": {
            "type": "string",
            "description": "音色",
            "example": "voice_clone_20240315_143052_001"
          },
          "request_id": {
            "type": "string",
            "description": "请求ID",
            "example": "voice_save_req_001"
          }
        }
      },
      "VoiceSaveResponse": {
        "type": "object",
        "properties": {
          "voice": {
            "type": "string",
            "description": "音色",
            "example": "voice_clone_20240315_143052_001"
          },
          "update_time": {
            "type": "string",
            "description": "删除时间",
            "example": "2024-03-15 14:30:52"
          }
        }
      },
      "VoiceVO": {
        "type": "object",
        "properties": {
          "voice": {
            "type": "string",
            "description": "音色",
            "example": "voice_clone_20240315_143052_001"
          },
          "voice_name": {
            "type": "string",
            "description": "音色名称",
            "example": "my_custom_voice_001"
          },
          "voice_type": {
            "type": "string",
            "description": "音色类型，OFFICIAL为官方音色，PRIVATE为自定义音色",
            "example": "PRIVATE"
          },
          "download_url": {
            "type": "string",
            "description": "试听音频的下载链接",
            "example": "https://example.com/voice_clone_20240315_143052_001.mp3"
          },
          "create_time": {
            "type": "string",
            "description": "创建时间",
            "example": "2024-03-15 14:30:52"
          }
        }
      },
      "ImageObject": {
        "type": "object",
        "properties": {
          "b64_json": {
            "type": "string",
            "description": "生成图像的base64编码JSON"
          },
          "url": {
            "type": "string",
            "description": "生成图像的URL"
          },
          "revised_prompt": {
            "type": "string",
            "description": "修订后的提示"
          }
        }
      },
      "EmbeddingCreateRequest": {
        "type": "object",
        "required": [
          "model",
          "input"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "嵌入模型名称，如 `embedding-3、embedding-2`",
            "enum": [
              "embedding-3",
              "embedding-2"
            ]
          },
          "input": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ],
            "description": "输入文本，支持字符串或字符串数组。\n- `embedding-2` 的单条请求最多支持 `512` 个`Tokens`，数组总长度不得超过`8K` \n- `embedding-3` 的单条请求最多支持 `3072` 个`Tokens`，且数组最大不得超过 `64` 条"
          },
          "dimensions": {
            "type": "integer",
            "minimum": 1,
            "description": "输出向量维度，`Embedding-3` 默认 `2048`，`Embedding-2` 固定 `1024`。`Embedding-3` 支持自定义，可选值：`256、512、1024`或`2048`。",
            "enum": [
              2048,
              1024,
              512,
              256
            ]
          }
        }
      },
      "EmbeddingResponse": {
        "type": "object",
        "description": "文本嵌入响应对象，包含嵌入向量结果、模型信息和 `tokens` 统计。",
        "properties": {
          "model": {
            "type": "string",
            "description": "模型编码。"
          },
          "object": {
            "type": "string",
            "enum": [
              "list"
            ],
            "description": "结果类型，目前为 `list`。"
          },
          "data": {
            "type": "array",
            "description": "模型生成的数组结果。每个元素为单条文本的嵌入结果对象。",
            "items": {
              "$ref": "#/components/schemas/EmbeddingObject"
            }
          },
          "usage": {
            "$ref": "#/components/schemas/EmbeddingUsage",
            "description": "本次模型调用的 `tokens` 数量统计。"
          }
        }
      },
      "EmbeddingObject": {
        "type": "object",
        "description": "单条文本的嵌入向量对象。",
        "properties": {
          "index": {
            "type": "integer",
            "description": "结果下标。该嵌入向量对应的输入文本在输入数组中的索引。"
          },
          "object": {
            "type": "string",
            "enum": [
              "embedding"
            ],
            "description": "结果类型，目前为 `embedding`。"
          },
          "embedding": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "description": "`embedding` 的处理结果，返回向量化表征的数组。"
          }
        }
      },
      "EmbeddingUsage": {
        "type": "object",
        "description": "本次模型调用的 `tokens` 数量统计。",
        "properties": {
          "prompt_tokens": {
            "type": "integer",
            "description": "用户输入的 `tokens` 数量。"
          },
          "completion_tokens": {
            "type": "integer",
            "description": "模型输出的 `tokens` 数量。"
          },
          "total_tokens": {
            "type": "integer",
            "description": "总 `tokens` 数量。"
          }
        }
      },
      "FileUploadRequest": {
        "type": "object",
        "required": [
          "file",
          "purpose"
        ],
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "description": "要上传的文件"
          },
          "purpose": {
            "type": "string",
            "enum": [
              "batch",
              "code-interpreter",
              "agent",
              "voice-clone-input"
            ],
            "description": "文件的预期用途。\n`batch`：用于批量任务处理，支持 `.jsonl` 文件格式，，单个文件大小限制为`100 MB`，文件数不超过 `1000` 个。`Batch`指南。\n`code-interpreter`：文件上传给代码沙盒`CI`使用，支持的格式包括：`pdf、docx、doc、xls、xlsx、txt、png、jpg、jpeg、csv`，单个文件大小限制为 `20M`，图片大小不超过`5M`，文件数不超过 `100` 个。\n`agent`：用于智能体文件上传，支持的格式包括：`pdf、docx、doc、xls、xlsx、txt、png、jpg、jpeg、csv`，单个文件大小限制为 `20M`，图片大小不超过`5M`，文件数不超过 `1000` 个。\n`voice-clone-input`: 用于音色克隆功能示例音频文件的上传。支持的格式包括`mp3、wav`"
          }
        }
      },
      "FileObject": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "文件标识符"
          },
          "object": {
            "type": "string",
            "enum": [
              "file"
            ]
          },
          "bytes": {
            "type": "integer",
            "description": "文件大小（字节）"
          },
          "created_at": {
            "type": "integer",
            "description": "文件创建的`Unix`时间戳"
          },
          "filename": {
            "type": "string",
            "description": "文件名"
          },
          "purpose": {
            "type": "string",
            "description": "文件的预期用途"
          }
        }
      },
      "FileListResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FileObject"
            }
          },
          "has_more": {
            "type": "boolean",
            "description": "是否有更多数据"
          }
        }
      },
      "BaseApiResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "description": "响应码，`200`为成功"
          },
          "message": {
            "type": "string",
            "description": "响应信息"
          },
          "timestamp": {
            "type": "integer",
            "description": "响应时间戳"
          }
        }
      },
      "BaseDeletedResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "删除的资源`ID`"
          },
          "object": {
            "type": "string",
            "description": "资源类型"
          },
          "deleted": {
            "type": "boolean",
            "description": "是否成功删除"
          }
        }
      },
      "FileDeletedResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/BaseDeletedResponse"
          },
          {
            "type": "object",
            "properties": {
              "object": {
                "type": "string",
                "enum": [
                  "file"
                ]
              }
            }
          }
        ]
      },
      "RerankRequest": {
        "type": "object",
        "required": [
          "model",
          "query",
          "documents"
        ],
        "properties": {
          "model": {
            "type": "string",
            "example": "rerank",
            "description": "要调用的模型编码，默认为`rerank`。",
            "enum": [
              "rerank"
            ]
          },
          "query": {
            "type": "string",
            "example": "查询候选文本A",
            "description": "查询文本，用于与候选文本进行匹配`query`，最大长度为 `4096` 字符。"
          },
          "top_n": {
            "type": "integer",
            "description": "返回得分最高的前 `n` 条结果，默认`0`返回所有。"
          },
          "documents": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "需要打分的候选文本A",
              "需要打分的候选文本B"
            ],
            "description": "需要打分的候选文本数组,最多容纳 `128` 条。单条最大长度为 `4096` 字符。"
          },
          "return_documents": {
            "type": "boolean",
            "description": "是否返回原始文本，默认值为`FALSE`。"
          },
          "return_raw_scores": {
            "type": "boolean",
            "description": "是否返回原始分数。默认 `FALSE`。"
          },
          "request_id": {
            "type": "string",
            "description": "请求唯一标识符。由用户端传递，`ID`长度要求：最少`6`个字符，最多`64`个字符，建议使用`UUID`格式确保唯一性，若未提供平台将自动生成。",
            "minLength": 6,
            "maxLength": 64
          },
          "user_id": {
            "type": "string",
            "description": "终端用户的唯一`ID`"
          }
        }
      },
      "RerankResponse": {
        "type": "object",
        "properties": {
          "created": {
            "type": "integer",
            "format": "int64",
            "example": 1732083164
          },
          "id": {
            "type": "string",
            "example": "20241120141244890ab4ee4af84acf",
            "description": "智谱开放平台生成的任务序号，调用请求结果接口时请使用此序号"
          },
          "request_id": {
            "type": "string",
            "example": "1111111111",
            "description": "用户在客户端请求时提交的任务编号或者平台生成的任务编号"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RerankResult"
            }
          },
          "usage": {
            "$ref": "#/components/schemas/RerankUsage"
          }
        },
        "required": [
          "id",
          "results",
          "usage"
        ]
      },
      "RerankResult": {
        "type": "object",
        "properties": {
          "document": {
            "type": "string",
            "example": "Washington, D.C. is the capital of the United States.",
            "description": "原文本"
          },
          "index": {
            "type": "integer",
            "example": 1
          },
          "relevance_score": {
            "type": "number",
            "format": "float",
            "example": 0.99866986
          }
        },
        "required": [
          "document",
          "index",
          "relevance_score"
        ]
      },
      "RerankUsage": {
        "type": "object",
        "properties": {
          "prompt_tokens": {
            "type": "integer",
            "example": 72
          },
          "total_tokens": {
            "type": "integer",
            "example": 72
          }
        },
        "required": [
          "prompt_tokens",
          "total_tokens"
        ]
      },
      "TokenizerRequest": {
        "type": "object",
        "required": [
          "model",
          "messages"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "调用的模型代码。",
            "example": "glm-5.2",
            "default": "glm-5.2",
            "enum": [
              "glm-5.2",
              "glm-5.1",
              "glm-5-turbo",
              "glm-5",
              "glm-4.7",
              "glm-4.6",
              "glm-4.6v",
              "glm-4.5",
              "glm-4.5-air"
            ]
          },
          "messages": {
            "type": "array",
            "description": "对话消息列表，包含当前对话的完整上下文信息。每条消息都有特定的角色和内容，模型会根据这些消息生成回复。消息按时间顺序排列，支持角色：`system`（系统消息，用于设定`AI`的行为和角色）、`user`（用户消息，来自用户的输入）、`assistant`（助手消息，来自`AI`的回复）。视觉模型支持纯文本和多模态内容（文本、图片、视频、文件）。注意不能只包含系统或助手消息。",
            "items": {
              "oneOf": [
                {
                  "title": "用户消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "user"
                      ],
                      "description": "消息作者的角色",
                      "default": "user"
                    },
                    "content": {
                      "oneOf": [
                        {
                          "type": "array",
                          "description": "多模态消息内容，支持文本、图片、文件、视频（可从上方切换至文本消息）",
                          "items": {
                            "$ref": "#/components/schemas/VisionMultimodalContentItem"
                          }
                        },
                        {
                          "type": "string",
                          "description": "文本消息内容（可从上方切换至多模态消息）",
                          "example": "What opportunities and challenges will the Chinese large model industry face in 2025?"
                        }
                      ]
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                },
                {
                  "title": "系统消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "system"
                      ],
                      "description": "消息作者的角色",
                      "default": "system"
                    },
                    "content": {
                      "oneOf": [
                        {
                          "type": "string",
                          "description": "消息文本内容",
                          "example": "You are a helpful assistant."
                        }
                      ]
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ]
                },
                {
                  "title": "助手消息",
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "assistant"
                      ],
                      "description": "消息作者的角色",
                      "default": "assistant"
                    },
                    "content": {
                      "oneOf": [
                        {
                          "type": "string",
                          "description": "文本消息内容",
                          "example": "I'll help you with that analysis."
                        }
                      ]
                    }
                  },
                  "required": [
                    "role"
                  ]
                }
              ]
            },
            "minItems": 1
          },
          "tools": {
            "type": "array",
            "description": "模型可以调用的工具列表。支持函数调用、知识库检索和网络搜索。使用此参数提供模型可以生成 `JSON` 输入的函数列表或配置其他工具。最多支持 `128` 个函数。目前 `GLM-4` 系列已支持所有 `tools`，`GLM-4.5` 已支持 `web search` 和 `retrieval`。",
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/FunctionToolSchema"
                }
              }
            ]
          },
          "request_id": {
            "type": "string",
            "description": "请求唯一标识符。由用户端传递，`ID`长度要求：最少`6`个字符，最多`64`个字符，建议使用`UUID`格式确保唯一性，若未提供平台将自动生成。",
            "minLength": 6,
            "maxLength": 64
          },
          "user_id": {
            "type": "string",
            "description": "终端用户的唯一`ID`"
          }
        }
      },
      "TokenizerResponse": {
        "type": "object",
        "properties": {
          "created": {
            "type": "integer",
            "format": "int64",
            "example": 1727156815
          },
          "id": {
            "type": "string",
            "example": "20241120141244890ab4ee4af84acf",
            "description": "智谱开放平台生成的任务序号，调用请求结果接口时请使用此序号。"
          },
          "request_id": {
            "type": "string",
            "example": "1",
            "description": "请求发起时客户端提交的任务号或平台生成的任务号。"
          },
          "usage": {
            "type": "object",
            "properties": {
              "prompt_tokens": {
                "type": "number",
                "description": "本次输入的 prompt tokens"
              },
              "video_tokens": {
                "type": "number",
                "description": "本次输入的 video tokens"
              },
              "image_tokens": {
                "type": "number",
                "description": "本次输入的 image tokens"
              },
              "total_tokens": {
                "type": "number",
                "description": "本次输入的总 tokens"
              }
            }
          }
        },
        "required": [
          "id",
          "usage"
        ]
      },
      "LayoutParsingRequest": {
        "type": "object",
        "required": [
          "model",
          "file"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "模型编码：`glm-ocr`",
            "example": "glm-ocr",
            "enum": [
              "glm-ocr"
            ]
          },
          "file": {
            "type": "string",
            "description": "需要识别的图片或者`pdf`文档，支持`url`和`base64`。支持图片格式：`PDF`、`JPG`、`PNG`。单图`≤10MB`，PDF`≤50MB`，最大支持`100页`",
            "example": "https://cdn.bigmodel.cn/static/logo/introduction.png"
          },
          "return_crop_images": {
            "type": "boolean",
            "description": "是否需要截图信息",
            "default": false
          },
          "need_layout_visualization": {
            "type": "boolean",
            "description": "是否需要详细布局图片结果信息",
            "default": false
          },
          "start_page_id": {
            "type": "integer",
            "description": "传入`pdf`时，开始解析的页码",
            "minimum": 1
          },
          "end_page_id": {
            "type": "integer",
            "description": "传入`pdf`时，结束解析的页码",
            "minimum": 1
          },
          "request_id": {
            "type": "string",
            "description": "请求唯一标识符。由用户端传递，`ID`长度要求：最少`6`个字符，最多`64`个字符，建议使用`UUID`格式确保唯一性，若未提供平台将自动生成。",
            "minLength": 6,
            "maxLength": 64
          },
          "user_id": {
            "type": "string",
            "description": "终端用户ID，用于滥用监控。长度：6-128字符",
            "minLength": 6,
            "maxLength": 128,
            "example": "user_123456"
          }
        }
      },
      "LayoutParsingResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "任务 `ID`",
            "example": "task_123456789"
          },
          "created": {
            "type": "integer",
            "format": "int64",
            "description": "请求创建时间，是以秒为单位的 `Unix` 时间戳",
            "example": 1727156815
          },
          "model": {
            "type": "string",
            "description": "模型名称",
            "example": "GLM-OCR"
          },
          "md_results": {
            "type": "string",
            "description": "`Markdown` 格式的识别结果",
            "example": "# 文档标题\n这是文档内容..."
          },
          "layout_details": {
            "type": "array",
            "description": "布局详细信息",
            "items": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/LayoutDetail"
              }
            }
          },
          "layout_visualization": {
            "type": "array",
            "description": "识别结果图片`url`",
            "items": {
              "type": "string"
            }
          },
          "data_info": {
            "$ref": "#/components/schemas/DataInfo"
          },
          "usage": {
            "type": "object",
            "description": "调用结束时返回的 `Token` 使用统计。",
            "properties": {
              "prompt_tokens": {
                "type": "number",
                "description": "用户输入的 `Token` 数量。"
              },
              "completion_tokens": {
                "type": "number",
                "description": "输出的 `Token` 数量"
              },
              "prompt_tokens_details": {
                "type": "object",
                "properties": {
                  "cached_tokens": {
                    "type": "number",
                    "description": "命中的缓存 `Token` 数量"
                  }
                }
              },
              "total_tokens": {
                "type": "integer",
                "description": "`Token` 总数"
              }
            }
          },
          "request_id": {
            "type": "string",
            "description": "请求`ID`",
            "example": "req_123456789"
          }
        },
        "required": [
          "id",
          "created",
          "model"
        ]
      },
      "LayoutDetail": {
        "type": "object",
        "description": "布局详情元素",
        "properties": {
          "index": {
            "type": "integer",
            "description": "元素序号",
            "example": 1
          },
          "label": {
            "type": "string",
            "description": "元素类型：`image`表示图像，`text`表示文本内容，`formula`表示行间公式，`table`表示表格",
            "enum": [
              "image",
              "text",
              "formula",
              "table"
            ],
            "example": "text"
          },
          "bbox_2d": {
            "type": "array",
            "description": "归一化的元素坐标 `[x1,y1,x2,y2]`",
            "items": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            "minItems": 4,
            "maxItems": 4,
            "example": [
              0.1,
              0.1,
              0.5,
              0.3
            ]
          },
          "content": {
            "type": "string",
            "description": "元素内容（文本 / 图片 URL / 表格 HTML）",
            "example": "这是文本内容"
          },
          "height": {
            "type": "integer",
            "description": "页面高度",
            "example": 800
          },
          "width": {
            "type": "integer",
            "description": "页面宽度",
            "example": 600
          }
        },
        "required": [
          "index",
          "label"
        ]
      },
      "DataInfo": {
        "type": "object",
        "description": "文档基础信息",
        "properties": {
          "num_pages": {
            "type": "integer",
            "description": "文档总页数",
            "example": 5
          },
          "pages": {
            "type": "array",
            "description": "文档页面数量信息",
            "items": {
              "$ref": "#/components/schemas/PageInfo"
            }
          }
        },
        "required": [
          "num_pages"
        ]
      },
      "PageInfo": {
        "type": "object",
        "description": "页面尺寸信息",
        "properties": {
          "width": {
            "type": "integer",
            "description": "页面宽度",
            "example": 600
          },
          "height": {
            "type": "integer",
            "description": "页面高度",
            "example": 800
          }
        },
        "required": [
          "width",
          "height"
        ]
      },
      "AgentRequest": {
        "type": "object",
        "required": [
          "agent_id",
          "messages"
        ],
        "properties": {
          "agent_id": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "general_translation",
                  "slides_glm_agent",
                  "ai_drawing_agent",
                  "receipt_recognition_agent",
                  "clothes_recognition_agent",
                  "intelligent_education_solve_agent",
                  "vidu_template_agent"
                ],
                "description": "此处提供 通用翻译智能体 `general_translation` 的拓展参数模板作为示例，其他内嵌智能体需要参考文档在下方手动设置拓展参数。"
              }
            ],
            "description": "智能体 ID"
          },
          "stream": {
            "type": "boolean",
            "description": "是否选择流式输出。当一个 `agent` 提供流式与非流式两种输出方式时，可根据需求选择一种。",
            "default": false
          },
          "messages": {
            "type": "array",
            "description": "会话消息体列表。",
            "items": {
              "type": "object",
              "required": [
                "role",
                "content"
              ],
              "properties": {
                "role": {
                  "type": "string",
                  "description": "消息作者的角色。用户输入时 `role = user`。",
                  "enum": [
                    "system",
                    "user",
                    "assistant"
                  ],
                  "example": "user"
                },
                "content": {
                  "oneOf": [
                    {
                      "type": "string",
                      "description": "用户输入的文本内容。",
                      "example": "请帮我翻译这段文字：Hello World"
                    },
                    {
                      "type": "object",
                      "description": "单个多模态内容，用于只有一个元素的情况",
                      "properties": {
                        "type": {
                          "type": "string",
                          "description": "内容类型，可以是文本、文件`ID`、文件链接或图片链接",
                          "enum": [
                            "text",
                            "file_id",
                            "file_url",
                            "image_url"
                          ]
                        },
                        "text": {
                          "type": "string",
                          "description": "当 `type` 为 `text` 时的文本内容",
                          "example": "请帮我翻译这段文字：Hello World"
                        },
                        "file_id": {
                          "type": "string",
                          "description": "当 `type` 为 `file_id` 时的文件唯一标识",
                          "example": "agent-1750681215-9b92722d788f4b32bab28cc333293584"
                        },
                        "file_url": {
                          "type": "string",
                          "description": "当 `type` 为 `file_url` 时的文件链接",
                          "example": "https://example.com/my_oss/document.pdf"
                        },
                        "image_url": {
                          "type": "string",
                          "description": "当 `type` 为 `image_url` 时的图片链接",
                          "example": "https://example.com/my_oss/image.png"
                        }
                      },
                      "required": [
                        "type"
                      ]
                    },
                    {
                      "type": "array",
                      "description": "多模态内容数组，支持文本、文件和图片",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "description": "内容类型，可以是文本、文件`ID`、文件链接或图片链接",
                            "enum": [
                              "text",
                              "file_id",
                              "file_url",
                              "image_url"
                            ]
                          },
                          "text": {
                            "type": "string",
                            "description": "当 `type` 为 `text` 时的文本内容",
                            "example": "请帮我翻译这段文字：Hello World"
                          },
                          "file_id": {
                            "type": "string",
                            "description": "当 `type` 为 `file_id` 时的文件唯一标识",
                            "example": "agent-1750681215-9b92722d788f4b32bab28cc333293584"
                          },
                          "file_url": {
                            "type": "string",
                            "description": "当 `type` 为 `file_url` 时的文件链接",
                            "example": "https://example.com/my_oss/document.pdf"
                          },
                          "image_url": {
                            "type": "string",
                            "description": "当 `type` 为 `image_url` 时的图片链接",
                            "example": "https://example.com/my_oss/image.png"
                          }
                        },
                        "required": [
                          "type"
                        ]
                      }
                    }
                  ]
                }
              }
            },
            "minItems": 1
          },
          "custom_variables": {
            "description": "智能体扩展参数。根据不同智能体的需求提供相应的参数配置。",
            "oneOf": [
              {
                "title": "通用翻译智能体",
                "$ref": "#/components/schemas/TranslationAgentCustomVariables"
              },
              {
                "title": "自定义智能体扩展",
                "$ref": "#/components/schemas/CustomAgentCustomVariables"
              }
            ]
          }
        }
      },
      "AgentResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "请求唯一标识"
          },
          "agent_id": {
            "type": "string",
            "description": "智能体唯一标识"
          },
          "conversation_id": {
            "type": "string",
            "description": "对话唯一标识"
          },
          "async_id": {
            "type": "string",
            "description": "异步任务唯一标识（异步调用时出现）"
          },
          "choices": {
            "type": "array",
            "description": "智能体响应列表。",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer",
                  "description": "结果索引。"
                },
                "messages": {
                  "type": "array",
                  "description": "智能体生成的响应消息列表。",
                  "items": {
                    "type": "object",
                    "properties": {
                      "role": {
                        "type": "string",
                        "description": "响应角色，通常为 `assistant`。",
                        "example": "assistant"
                      },
                      "content": {
                        "oneOf": [
                          {
                            "type": "string",
                            "description": "智能体生成的响应内容（纯文本格式）。"
                          },
                          {
                            "type": "object",
                            "description": "单个多模态响应内容，用于响应只有一个元素的情况",
                            "properties": {
                              "type": {
                                "type": "string",
                                "description": "内容类型，可以是文本、文件、图片、音频或视频",
                                "enum": [
                                  "text",
                                  "file_url",
                                  "image_url",
                                  "audio_url",
                                  "video_url"
                                ]
                              },
                              "text": {
                                "type": "string",
                                "description": "当 `type` 为 `text` 时的文本内容"
                              },
                              "file_url": {
                                "type": "string",
                                "description": "当 `type` 为 `file_url` 时的文件链接"
                              },
                              "image_url": {
                                "type": "string",
                                "description": "当 `type` 为 `image_url` 时的图片链接"
                              },
                              "audio_url": {
                                "type": "string",
                                "description": "当 `type` 为 `audio_url` 时的音频链接"
                              },
                              "video_url": {
                                "type": "string",
                                "description": "当 `type` 为 `video_url` 时的视频链接"
                              }
                            },
                            "required": [
                              "type"
                            ]
                          },
                          {
                            "type": "array",
                            "description": "多模态响应内容数组，支持文本、文件、图片、音频和视频",
                            "items": {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "description": "内容类型，可以是文本、文件、图片、音频或视频",
                                  "enum": [
                                    "text",
                                    "file_url",
                                    "image_url",
                                    "audio_url",
                                    "video_url"
                                  ]
                                },
                                "text": {
                                  "type": "string",
                                  "description": "当 `type` 为 `text` 时的文本内容"
                                },
                                "file_url": {
                                  "type": "string",
                                  "description": "当 `type` 为 `file_url` 时的文件链接"
                                },
                                "image_url": {
                                  "type": "string",
                                  "description": "当 `type` 为 `image_url` 时的图片链接"
                                },
                                "audio_url": {
                                  "type": "string",
                                  "description": "当 `type` 为 `audio_url` 时的音频链接"
                                },
                                "video_url": {
                                  "type": "string",
                                  "description": "当 `type` 为 `video_url` 时的视频链接"
                                }
                              },
                              "required": [
                                "type"
                              ]
                            }
                          }
                        ]
                      }
                    }
                  }
                },
                "finish_reason": {
                  "type": "string",
                  "description": "响应结束原因。可能的取值为 正常结束-`stop`、长度达到上限-`length`、内容敏感-`sensitive` 或 网络错误-`network_error`。"
                }
              }
            }
          },
          "usage": {
            "$ref": "#/components/schemas/UsageStatistics"
          }
        }
      },
      "TranslationAgentCustomVariables": {
        "type": "object",
        "description": "当前为 [通用翻译智能体](/cn/guide/agents/translation) `general_translation` 扩展参数预设",
        "properties": {
          "source_lang": {
            "type": "string",
            "description": "待翻译文本的源语言代码，默认值为 `auto`",
            "default": "auto",
            "enum": [
              "auto",
              "zh-CN",
              "zh-TW",
              "wyw",
              "yue",
              "en",
              "ja",
              "ko",
              "fr",
              "de",
              "es",
              "ru",
              "pt",
              "it",
              "ar",
              "hi",
              "bg",
              "cs",
              "da",
              "el",
              "et",
              "fi",
              "hu",
              "id",
              "lt",
              "lv",
              "nl",
              "no",
              "pl",
              "ro",
              "sk",
              "sl",
              "sv",
              "th",
              "tr",
              "uk",
              "vi",
              "my",
              "ms",
              "Pinyin",
              "IPA"
            ]
          },
          "target_lang": {
            "type": "string",
            "description": "待翻译文本的目标语言代码，默认为 `zh-CN`",
            "default": "zh-CN",
            "enum": [
              "zh-CN",
              "zh-TW",
              "wyw",
              "yue",
              "en",
              "en-GB",
              "en-US",
              "ja",
              "ko",
              "fr",
              "de",
              "es",
              "ru",
              "pt",
              "it",
              "ar",
              "hi",
              "bg",
              "cs",
              "da",
              "el",
              "et",
              "fi",
              "hu",
              "id",
              "lt",
              "lv",
              "nl",
              "no",
              "pl",
              "ro",
              "sk",
              "sl",
              "sv",
              "th",
              "tr",
              "uk",
              "vi",
              "my",
              "ms",
              "Pinyin",
              "IPA"
            ]
          },
          "glossary": {
            "type": "string",
            "description": "术语表`id`"
          },
          "strategy": {
            "type": "string",
            "description": "翻译策略",
            "default": "general",
            "enum": [
              "general",
              "paraphrase",
              "two_step",
              "three_step",
              "reflection",
              "cot"
            ]
          },
          "strategy_config": {
            "type": "object",
            "description": "翻译策略对应的参数",
            "properties": {
              "general": {
                "type": "object",
                "description": "当翻译策略指定为`general`时生效",
                "properties": {
                  "suggestion": {
                    "type": "string",
                    "description": "翻译建议或风格要求，如术语对照、文体规范等"
                  }
                }
              },
              "cot": {
                "type": "object",
                "description": "当翻译策略指定为`cot`时生效",
                "properties": {
                  "reason_lang": {
                    "type": "string",
                    "description": "翻译理由的语言，取值 [\"from\"｜\"to\"]，默认 \"to\"",
                    "default": "to",
                    "enum": [
                      "from",
                      "to"
                    ]
                  }
                }
              }
            }
          }
        },
        "example": {
          "source_lang": "en",
          "target_lang": "zh-CN",
          "strategy": "general",
          "strategy_config": {
            "general": {
              "suggestion": "专业技术文档翻译风格"
            }
          }
        }
      },
      "CustomAgentCustomVariables": {
        "type": "object",
        "description": "自定义其它智能体的扩展参数，具体参数字段可参考对应的[智能体文档](/cn/guide/agents/translation)",
        "additionalProperties": true,
        "example": {
          "custom_param1": "value1",
          "custom_param2": 42,
          "options": {
            "detailed": true,
            "format": "json"
          }
        }
      },
      "AgentAsyncResultResponse": {
        "type": "object",
        "properties": {
          "agent_id": {
            "type": "string",
            "description": "智能体`ID`"
          },
          "async_id": {
            "type": "string",
            "description": "异步任务的`ID`"
          },
          "status": {
            "type": "string",
            "description": "任务状态，`success/failed/pending`",
            "enum": [
              "success",
              "failed",
              "pending"
            ]
          },
          "choices": {
            "type": "array",
            "description": "`agent`输出",
            "items": {
              "type": "object",
              "properties": {
                "messages": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "role": {
                        "type": "string",
                        "description": "用户的输入 `role = assistant`"
                      },
                      "content": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "description": "目前支持 `type=file_url`"
                            },
                            "file_url": {
                              "type": "string",
                              "description": "url链接"
                            },
                            "tag_cn": {
                              "type": "string",
                              "description": "中文描述"
                            },
                            "tag_en": {
                              "type": "string",
                              "description": "英文描述"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "usage": {
            "type": "object",
            "properties": {
              "total_tokens": {
                "type": "integer",
                "description": "消耗总`tokens`数"
              }
            }
          }
        }
      },
      "GlmSlideAgentConversationRequest": {
        "type": "object",
        "properties": {
          "agent_id": {
            "type": "string",
            "description": "智能体 `ID`"
          },
          "conversation_id": {
            "type": "string",
            "description": "对话 `ID`"
          },
          "custom_variables": {
            "type": "object",
            "description": "自定义参数",
            "properties": {
              "include_pdf": {
                "type": "boolean",
                "description": "是否导出 `pdf` 文件"
              },
              "pages": {
                "type": "array",
                "description": "`Slide` 页信息",
                "items": {
                  "type": "object",
                  "properties": {
                    "position": {
                      "type": "number",
                      "description": "`Slide` 页码"
                    },
                    "width": {
                      "type": "number",
                      "description": "`Slide` 宽度, 单位: `cm`"
                    },
                    "height": {
                      "type": "number",
                      "description": "`Slide` 高度, 单位: `cm`"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "GlmSlideAgentConversationResponse": {
        "type": "object",
        "properties": {
          "conversation_id": {
            "type": "string",
            "description": "对话 `ID`"
          },
          "agent_id": {
            "type": "string",
            "description": "智能体 `ID`"
          },
          "choices": {
            "type": "array",
            "description": "Agent output.",
            "items": {
              "type": "object",
              "properties": {
                "message": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "role": {
                        "type": "string",
                        "description": "智能体的角色 `role = assistant`"
                      },
                      "content": {
                        "type": "array",
                        "description": "智能体响应内容",
                        "items": {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "description": "响应内容类型：文件下载链接-`file_url`、图片下载链接-`image_url`"
                            },
                            "tag_cn": {
                              "type": "string",
                              "description": "CN Tag."
                            },
                            "tag_en": {
                              "type": "string",
                              "description": "EN Tag."
                            },
                            "file_url": {
                              "type": "string",
                              "description": "如果 `type = file_url`，则这个字段给出文件的具体下载链接"
                            },
                            "image_url": {
                              "type": "string",
                              "description": "如果 `type = image_url`，则这个字段给出图片的具体下载链接"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "description": "Error code."
              },
              "message": {
                "type": "string",
                "description": "Error message."
              }
            }
          }
        }
      },
      "AssistantRequest": {
        "type": "object",
        "properties": {
          "assistant_id": {
            "type": "string",
            "title": "智能体选择",
            "description": "智能体ID，必需参数。请从下拉框选择智能体：\n\n• ChatGLM（官方）- 65940acff94777010aa6b796：嗨~ 我是清言，超开心遇见你！😺\n• 数据分析（官方）- 65a265419d72d299a9230616：分析数据并提供图表化\n• 复杂流程图（官方）- 664dd7bd5bb3a13ba0f81668：五秒钟做一张流程图\n• 思维导图 MindMap（官方）- 664e0cade018d633146de0d2：任何复杂概念秒变脑图\n• 提示词工程师（官方）- 6654898292788e88ce9e7f4c：超强结构化提示词专家\n• AI画图（官方）- 66437ef3d920bdc5c60f338e：专属绘画伙伴\n• AI搜索（官方）- 659e54b1b8006379b4b2abd6：连接全网内容，精准搜索\n• PPT助手（官方）- 65d2f07bb2c10188f885bd89：超实用的PPT生成器\n• arXiv论文速读（官方）- 663058948bb259b7e8a22730：深度解析论文\n• 程序员助手Sam（官方）- 65a393b3619c6f13586246cd：编程开发知识搜索引擎\n• 网文写手（官方）- 65b356af6924a59d52832e54：大神写作秘诀\n• 英语语法助手（官方）- 668fdd45405f2e3c9f71f832：检查语法和语法解释",
            "enum": [
              "65940acff94777010aa6b796",
              "65a265419d72d299a9230616",
              "664dd7bd5bb3a13ba0f81668",
              "664e0cade018d633146de0d2",
              "6654898292788e88ce9e7f4c",
              "66437ef3d920bdc5c60f338e",
              "659e54b1b8006379b4b2abd6",
              "65d2f07bb2c10188f885bd89",
              "663058948bb259b7e8a22730",
              "65a393b3619c6f13586246cd",
              "65b356af6924a59d52832e54",
              "668fdd45405f2e3c9f71f832"
            ],
            "x-enum-varnames": [
              "ChatGLM（官方）",
              "数据分析（官方）",
              "复杂流程图（官方）",
              "思维导图 MindMap（官方）",
              "提示词工程师（官方）",
              "AI画图（官方）",
              "AI搜索（官方）",
              "PPT助手（官方）",
              "arXiv论文速读（官方）",
              "程序员助手Sam（官方）",
              "网文写手（官方）",
              "英语语法助手（官方）"
            ],
            "x-enumNames": [
              "ChatGLM（官方）",
              "数据分析（官方）",
              "复杂流程图（官方）",
              "思维导图 MindMap（官方）",
              "提示词工程师（官方）",
              "AI画图（官方）",
              "AI搜索（官方）",
              "PPT助手（官方）",
              "arXiv论文速读（官方）",
              "程序员助手Sam（官方）",
              "网文写手（官方）",
              "英语语法助手（官方）"
            ],
            "x-enum-descriptions": [
              "ChatGLM（官方） - 嗨~ 我是清言，超开心遇见你！😺 你最近有什么好玩的事情想和我分享吗？",
              "数据分析（官方） - 通过分析用户上传文件或数据说明，帮助用户分析数据并提供图表化。也可通过简单的编码完成文件处理的工作。",
              "复杂流程图（官方） - 人人都能掌握的流程图工具，用五秒钟做一张流程图卷到同事。",
              "思维导图 MindMap（官方） - 告别整理烦恼，任何复杂概念秒变脑图。",
              "提示词工程师（官方） - 人人都是提示词工程师，超强结构化提示词专家，一键改写提示词。",
              "AI画图（官方） - 让想象力自由飞翔，你的专属绘画伙伴，画到停不下来。",
              "AI搜索（官方） - 连接全网内容，精准搜索，快速分析并总结的智能助手。",
              "PPT助手（官方） - 超实用的PPT生成器，支持手动编辑大纲、自动填充章节内容。",
              "arXiv论文速读（官方） - 深度解析arXiv论文，让你快速掌握研究动态，节省宝贵时间。",
              "程序员助手Sam（官方） - \"编程开发知识搜索引擎\"，能帮助程序员解决日常问题。",
              "网文写手（官方） - 大神写作秘诀：一套模板不断重复。",
              "英语语法助手（官方） - 输入单词查询；输入句子检查语法，和语法解释。"
            ],
            "default": "65940acff94777010aa6b796"
          },
          "conversation_id": {
            "type": "string",
            "description": "会话`ID`，可选参数，用于继续之前的对话"
          },
          "model": {
            "type": "string",
            "enum": [
              "glm-4-assistant",
              "glm-4-alltools"
            ],
            "description": "使用的模型名称",
            "default": "glm-4-assistant"
          },
          "messages": {
            "type": "array",
            "description": "对话消息列表",
            "items": {
              "type": "object",
              "required": [
                "role",
                "content"
              ],
              "properties": {
                "role": {
                  "type": "string",
                  "description": "消息作者的角色",
                  "enum": [
                    "user"
                  ],
                  "example": "user"
                },
                "content": {
                  "oneOf": [
                    {
                      "type": "string",
                      "description": "消息文本内容",
                      "example": "你好"
                    },
                    {
                      "type": "array",
                      "description": "多模态消息内容，支持文本、图片等",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "text",
                              "image_url"
                            ],
                            "description": "内容类型"
                          },
                          "text": {
                            "type": "string",
                            "description": "文本内容"
                          },
                          "image_url": {
                            "type": "object",
                            "properties": {
                              "url": {
                                "type": "string",
                                "description": "图片`URL`"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            },
            "minItems": 1
          },
          "stream": {
            "type": "boolean",
            "description": "是否启用流式响应",
            "default": true
          },
          "request_id": {
            "type": "string",
            "description": "请求任务`ID`，长度必须位于`6`到`64`位之间",
            "minLength": 6,
            "maxLength": 64
          },
          "user_id": {
            "type": "string",
            "description": "终端用户的唯一`ID`，长度必须位于`6`到`128`位之间",
            "minLength": 6,
            "maxLength": 128
          },
          "do_sample": {
            "type": "boolean",
            "description": "是否稳定输出"
          },
          "attachments": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "附件列表"
          },
          "metadata": {
            "type": "object",
            "description": "元数据信息",
            "additionalProperties": true
          },
          "extra_parameters": {
            "type": "object",
            "description": "额外参数，用于特定智能体的扩展配置",
            "properties": {
              "translate": {
                "type": "object",
                "description": "翻译参数",
                "properties": {
                  "from": {
                    "type": "string",
                    "description": "源语言"
                  },
                  "to": {
                    "type": "string",
                    "description": "目标语言"
                  }
                }
              }
            }
          }
        },
        "required": [
          "assistant_id",
          "model",
          "messages"
        ]
      },
      "AssistantResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "响应`ID`"
          },
          "request_id": {
            "type": "string",
            "description": "请求`ID`"
          },
          "created": {
            "type": "integer",
            "description": "创建时间戳"
          },
          "model": {
            "type": "string",
            "description": "使用的模型"
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "message": {
                  "$ref": "#/components/schemas/ChatCompletionResponseMessage"
                },
                "finish_reason": {
                  "type": "string"
                }
              }
            }
          },
          "usage": {
            "type": "object",
            "properties": {
              "prompt_tokens": {
                "type": "integer"
              },
              "completion_tokens": {
                "type": "integer"
              },
              "total_tokens": {
                "type": "integer"
              }
            }
          }
        }
      },
      "AssistantListRequest": {
        "type": "object",
        "required": [
          "assistant_id_list"
        ],
        "properties": {
          "assistant_id_list": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "智能体`ID`列表，如果为空则查询所有可用智能体",
            "example": [
              "65940acff94777010aa6b796",
              "assistant_2"
            ],
            "default": []
          }
        }
      },
      "AssistantInfo": {
        "type": "object",
        "properties": {
          "assistant_id": {
            "type": "string",
            "description": "智能体`ID`",
            "example": "65940acff94777010aa6b796"
          },
          "name": {
            "type": "string",
            "description": "智能体名称",
            "example": "通用智能助手"
          },
          "avatar": {
            "type": "string",
            "description": "智能体头像URL",
            "example": "https://example.com/avatar.png"
          },
          "description": {
            "type": "string",
            "description": "智能体描述",
            "example": "一个通用的`AI`助手，可以回答各种问题"
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "智能体支持的工具列表",
            "example": [
              "web_search",
              "code_interpreter"
            ]
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "description": "标签键",
                  "example": "category"
                },
                "label": {
                  "type": "string",
                  "description": "标签值",
                  "example": "通用助手"
                }
              }
            },
            "description": "智能体标签列表"
          },
          "status": {
            "type": "string",
            "description": "智能体状态",
            "example": "active"
          },
          "starter_prompts": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "智能体的起始提示语"
          },
          "created_at": {
            "type": "string",
            "description": "创建时间",
            "example": "2024-01-01T00:00:00Z"
          },
          "updated_at": {
            "type": "string",
            "description": "更新时间",
            "example": "2024-01-01T00:00:00Z"
          }
        },
        "required": [
          "assistant_id",
          "name"
        ]
      },
      "ConversationListRequest": {
        "type": "object",
        "required": [
          "assistant_id"
        ],
        "properties": {
          "assistant_id": {
            "type": "string",
            "description": "智能体ID",
            "enum": [
              "65940acff94777010aa6b796",
              "65a265419d72d299a9230616",
              "664dd7bd5bb3a13ba0f81668",
              "664e0cade018d633146de0d2",
              "6654898292788e88ce9e7f4c",
              "66437ef3d920bdc5c60f338e",
              "659e54b1b8006379b4b2abd6",
              "65d2f07bb2c10188f885bd89",
              "663058948bb259b7e8a22730",
              "65a393b3619c6f13586246cd",
              "65b356af6924a59d52832e54",
              "668fdd45405f2e3c9f71f832"
            ],
            "x-enum-varnames": [
              "ChatGLM（官方）",
              "数据分析（官方）",
              "复杂流程图（官方）",
              "思维导图 MindMap（官方）",
              "提示词工程师（官方）",
              "AI画图（官方）",
              "AI搜索（官方）",
              "PPT助手（官方）",
              "arXiv论文速读（官方）",
              "程序员助手Sam（官方）",
              "网文写手（官方）",
              "英语语法助手（官方）"
            ],
            "x-enumNames": [
              "ChatGLM（官方）",
              "数据分析（官方）",
              "复杂流程图（官方）",
              "思维导图 MindMap（官方）",
              "提示词工程师（官方）",
              "AI画图（官方）",
              "AI搜索（官方）",
              "PPT助手（官方）",
              "arXiv论文速读（官方）",
              "程序员助手Sam（官方）",
              "网文写手（官方）",
              "英语语法助手（官方）"
            ],
            "x-enum-descriptions": [
              "ChatGLM（官方） - 嗨~ 我是清言，超开心遇见你！😺 你最近有什么好玩的事情想和我分享吗？",
              "数据分析（官方） - 通过分析用户上传文件或数据说明，帮助用户分析数据并提供图表化。也可通过简单的编码完成文件处理的工作。",
              "复杂流程图（官方） - 人人都能掌握的流程图工具，用五秒钟做一张流程图卷到同事。",
              "思维导图 MindMap（官方） - 告别整理烦恼，任何复杂概念秒变脑图。",
              "提示词工程师（官方） - 人人都是提示词工程师，超强结构化提示词专家，一键改写提示词。",
              "AI画图（官方） - 让想象力自由飞翔，你的专属绘画伙伴，画到停不下来。",
              "AI搜索（官方） - 连接全网内容，精准搜索，快速分析并总结的智能助手。",
              "PPT助手（官方） - 超实用的PPT生成器，支持手动编辑大纲、自动填充章节内容。",
              "arXiv论文速读（官方） - 深度解析arXiv论文，让你快速掌握研究动态，节省宝贵时间。",
              "程序员助手Sam（官方） - \"编程开发知识搜索引擎\"，能帮助程序员解决日常问题。",
              "网文写手（官方） - 大神写作秘诀：一套模板不断重复。",
              "英语语法助手（官方） - 输入单词查询；输入句子检查语法，和语法解释。"
            ],
            "default": "65940acff94777010aa6b796"
          },
          "page": {
            "type": "integer",
            "description": "页码，从1开始",
            "minimum": 1,
            "default": 1,
            "example": 1
          },
          "page_size": {
            "type": "integer",
            "description": "每页大小",
            "minimum": 1,
            "maximum": 100,
            "default": 5,
            "example": 10
          }
        }
      },
      "ConversationListResponse": {
        "type": "object",
        "properties": {
          "assistant_id": {
            "type": "string",
            "description": "智能体`ID`",
            "example": "65940acff94777010aa6b796"
          },
          "conversation_list": {
            "type": "array",
            "description": "会话列表",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "会话`ID`",
                  "example": "conv_123456"
                },
                "assistant_id": {
                  "type": "string",
                  "description": "智能体`ID`",
                  "example": "65940acff94777010aa6b796"
                },
                "create_time": {
                  "type": "string",
                  "description": "创建时间",
                  "example": "2024-01-01T10:00:00Z"
                },
                "update_time": {
                  "type": "string",
                  "description": "更新时间",
                  "example": "2024-01-01T10:30:00Z"
                },
                "usage": {
                  "type": "object",
                  "description": "使用统计",
                  "properties": {
                    "prompt_tokens": {
                      "type": "integer",
                      "description": "输入`token`数"
                    },
                    "completion_tokens": {
                      "type": "integer",
                      "description": "输出`token`数"
                    },
                    "total_tokens": {
                      "type": "integer",
                      "description": "总`token`数"
                    }
                  }
                }
              },
              "required": [
                "id",
                "assistant_id"
              ]
            }
          },
          "has_more": {
            "type": "boolean",
            "description": "是否还有更多数据",
            "example": true
          }
        },
        "required": [
          "assistant_id",
          "conversation_list",
          "has_more"
        ]
      },
      "FileParseResultResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "processing",
              "succeeded",
              "failed"
            ],
            "description": "任务处理状态",
            "example": "succeeded"
          },
          "message": {
            "type": "string",
            "description": "结果状态描述",
            "example": "结果获取成功"
          },
          "content": {
            "type": "string",
            "description": "当`format_type=text`时返回的解析文本内容",
            "example": "这是解析后的文本内容...",
            "nullable": true
          },
          "task_id": {
            "type": "string",
            "description": "文件解析任务`ID`",
            "example": "task_123456789"
          },
          "parsing_result_url": {
            "type": "string",
            "description": "当`format_type=download_link`时返回的结果下载链接",
            "example": "https://example.com/download/result.zip",
            "nullable": true
          }
        },
        "required": [
          "status",
          "message",
          "task_id"
        ]
      },
      "OCRResultResponse": {
        "type": "object",
        "properties": {
          "task_id": {
            "type": "string",
            "description": "OCR识别任务ID",
            "example": "ce2641ced3e34e67b47f3b0feeb25aee"
          },
          "message": {
            "type": "string",
            "description": "结果状态描述",
            "example": "成功"
          },
          "status": {
            "type": "string",
            "enum": [
              "succeeded",
              "failed"
            ],
            "description": "任务处理状态",
            "example": "succeeded"
          },
          "words_result_num": {
            "type": "integer",
            "description": "识别到的文本块/行数",
            "example": 4
          },
          "words_result": {
            "type": "array",
            "description": "每个识别文本块/行的详细结果",
            "items": {
              "type": "object",
              "properties": {
                "location": {
                  "type": "object",
                  "properties": {
                    "left": {
                      "type": "integer",
                      "example": 79
                    },
                    "top": {
                      "type": "integer",
                      "example": 122
                    },
                    "width": {
                      "type": "integer",
                      "example": 1483
                    },
                    "height": {
                      "type": "integer",
                      "example": 182
                    }
                  },
                  "required": [
                    "left",
                    "top",
                    "width",
                    "height"
                  ]
                },
                "words": {
                  "type": "string",
                  "description": "识别出的文本内容",
                  "example": "你好,世界!"
                },
                "probability": {
                  "type": "object",
                  "description": "置信度信息",
                  "properties": {
                    "average": {
                      "type": "number",
                      "example": 0.7320847511
                    },
                    "variance": {
                      "type": "number",
                      "example": 0.08768635988
                    },
                    "min": {
                      "type": "number",
                      "example": 0.3193874359
                    }
                  },
                  "required": [
                    "average",
                    "variance",
                    "min"
                  ]
                }
              },
              "required": [
                "location",
                "words",
                "probability"
              ]
            }
          }
        },
        "required": [
          "task_id",
          "message",
          "status",
          "words_result_num"
        ]
      },
      "BatchCreateRequest": {
        "type": "object",
        "properties": {
          "input_file_id": {
            "type": "string",
            "description": "上传文件的 `ID`，该文件包含`Batch`的请求。输入文件必须是 `.Jsonl` 格式，并且文件上传时的目的必须标记为\"batch\"。"
          },
          "endpoint": {
            "type": "string",
            "description": "`Batch` 中所有请求将使用的端点。目前支持 `/v4/chat/completions`。",
            "enum": [
              "/v4/chat/completions"
            ]
          },
          "auto_delete_input_file": {
            "type": "boolean",
            "description": "是否自动删除`batch`原始文件，默认为`True`：`True`：执行自动删除。`False`：保留原始`batch`文件。",
            "default": true
          },
          "metadata": {
            "type": "object",
            "nullable": true,
            "description": "用于存储与 `Batch` 相关的数据，如客户`I`D、描述或其他任务管理和跟踪所需的额外信息。可附加到对象上的键值对集合最多为 `16` 个。每个键的长度最多为 `64` 个字符，每个值的长度最多为 `512` 个字符。"
          }
        },
        "required": [
          "input_file_id",
          "endpoint"
        ]
      },
      "Batch": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "批处理的唯一标识符。"
          },
          "object": {
            "type": "string",
            "description": "对象类型，这里为 `batch`。"
          },
          "endpoint": {
            "type": "string",
            "description": "批处理使用的 `API` 端点。"
          },
          "input_file_id": {
            "type": "string",
            "description": "批处理使用的输入文件的`ID`。"
          },
          "completion_window": {
            "type": "string",
            "description": "批处理应在此时间框架内完成的期限。"
          },
          "status": {
            "type": "string",
            "description": "批处理的当前状态。"
          },
          "output_file_id": {
            "type": "string",
            "description": "包含成功执行请求的输出的文件`ID`。"
          },
          "error_file_id": {
            "type": "string",
            "description": "包含出现错误的请求的输出的文件`ID`。"
          },
          "created_at": {
            "type": "integer",
            "description": "创建批处理的`Unix`时间戳（秒）。"
          },
          "in_progress_at": {
            "type": "integer",
            "description": "批处理开始处理的`Unix`时间戳（秒）。"
          },
          "expires_at": {
            "type": "integer",
            "description": "批处理将过期的`Unix`时间戳（秒）。"
          },
          "finalizing_at": {
            "type": "integer",
            "description": "批处理开始最终处理的`Unix`时间戳（秒）。"
          },
          "completed_at": {
            "type": "integer",
            "description": "批处理完成的`Unix`时间戳（秒）。"
          },
          "failed_at": {
            "type": "integer",
            "description": "批处理失败的`Unix`时间戳（秒）。"
          },
          "expired_at": {
            "type": "integer",
            "description": "批处理过期的`Unix`时间戳（秒）。"
          },
          "cancelling_at": {
            "type": "integer",
            "description": "批处理开始取消的`Unix`时间戳（秒）。"
          },
          "cancelled_at": {
            "type": "integer",
            "description": "批处理取消完成的`Unix`时间戳（秒）。"
          },
          "request_counts": {
            "type": "integer",
            "description": "batch 请求计数。"
          },
          "total": {
            "type": "integer",
            "description": "批处理中的请求总数。"
          },
          "completed": {
            "type": "integer",
            "description": "批处理中已成功完成的请求数量。"
          },
          "failed": {
            "type": "integer",
            "description": "批处理中失败的请求数量。"
          },
          "metadata": {
            "type": "object",
            "description": "可附加到对象上的 `16` 个键值对的集合。这有助于以结构化格式存储对象的附加信息。键的长度最多为 `64` 个字符，值的长度最多为 `512` 个字符。"
          }
        }
      },
      "BatchListResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Batch"
            }
          },
          "first_id": {
            "type": "string",
            "description": "第一个`ID`"
          },
          "last_id": {
            "type": "string",
            "description": "最后一个`ID`"
          },
          "has_more": {
            "type": "boolean",
            "description": "是否有更多数据"
          }
        }
      },
      "KnowledgeRetrieveRequest": {
        "type": "object",
        "properties": {
          "request_id": {
            "type": "string",
            "description": "请求唯一id，用于定位日志"
          },
          "query": {
            "type": "string",
            "description": "查询内容，限制在1000字以内"
          },
          "knowledge_ids": {
            "type": "array",
            "description": "知识库ID列表",
            "items": {
              "type": "string"
            }
          },
          "document_ids": {
            "type": "array",
            "description": "文档ID列表",
            "items": {
              "type": "string"
            }
          },
          "top_k": {
            "type": "integer",
            "description": "最终召回数量，取值范围为[1~20]，默认为8"
          },
          "top_n": {
            "type": "integer",
            "description": "初始召回数量，取值范围为[1~100]，默认为10"
          },
          "recall_method": {
            "type": "string",
            "enum": [
              "embedding",
              "keyword",
              "mixed"
            ],
            "default": "mixed",
            "description": "检索类型 \n- embedding: 向量化检索\n- keyword:关键词检索\n- mixed: 混合检索（默认）"
          },
          "recall_ratio": {
            "type": "integer",
            "default": 80,
            "description": "混合检索中向量检索的权重，取值范围(0~100)，默认为80"
          },
          "rerank_status": {
            "type": "integer",
            "enum": [
              0,
              1
            ],
            "description": "是否开启重排，0: 不开启，1: 开启，默认不开启"
          },
          "rerank_model": {
            "type": "string",
            "enum": [
              "rerank",
              "rerank-pro"
            ],
            "description": "重排模型，支持rerank、rerank-pro"
          },
          "fractional_threshold": {
            "type": "number",
            "description": "相似度阈值，低于该阈值的切片会被过滤，取值范围为(0~1)"
          }
        },
        "required": [
          "query",
          "knowledge_ids"
        ]
      },
      "KnowledgeRetrieveResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "description": "检索结果列表",
            "items": {
              "type": "object",
              "properties": {
                "text": {
                  "type": "string",
                  "description": "切片内容"
                },
                "score": {
                  "type": "number",
                  "description": "相似度分数"
                },
                "metadata": {
                  "type": "object",
                  "description": "切片元数据",
                  "properties": {
                    "_id": {
                      "type": "string",
                      "description": "切片ID"
                    },
                    "knowledge_id": {
                      "type": "string",
                      "description": "知识库ID"
                    },
                    "doc_id": {
                      "type": "string",
                      "description": "文档ID"
                    },
                    "doc_name": {
                      "type": "string",
                      "description": "文档名称"
                    },
                    "doc_url": {
                      "type": "string",
                      "description": "文档URL"
                    },
                    "contextual_text": {
                      "type": "string",
                      "description": "上下文增强内容，不开启上下文增强则为空"
                    }
                  }
                }
              }
            }
          },
          "code": {
            "type": "integer",
            "description": "响应码，200为成功"
          },
          "message": {
            "type": "string",
            "description": "响应信息"
          },
          "timestamp": {
            "type": "integer",
            "description": "响应时间戳"
          }
        }
      },
      "ZragRetrieveRequest": {
        "type": "object",
        "properties": {
          "multimodal": {
            "type": "boolean",
            "default": true,
            "description": "是否走多模态路径检索，默认值为true"
          },
          "knows": {
            "type": "array",
            "description": "查询的知识库列表",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "知识库ID"
                },
                "doc_ids": {
                  "type": "array",
                  "description": "知识库下的文档ID列表",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "id"
              ]
            }
          },
          "query": {
            "type": "string",
            "description": "文本查询内容，与多模态查询内容必须传入其中之一"
          },
          "multimodal_parts": {
            "type": "array",
            "description": "多模态查询内容，与文本查询内容必须传入其中之一",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "image_url"
                  ],
                  "description": "仅支持图片类型：image_url"
                },
                "url": {
                  "type": "string",
                  "description": "图片URL链接"
                }
              },
              "required": [
                "type",
                "url"
              ]
            }
          },
          "top_k": {
            "type": "integer",
            "default": 8,
            "description": "最终召回数量，默认为8"
          },
          "top_n": {
            "type": "integer",
            "default": 10,
            "description": "初始召回数量，默认为10"
          },
          "recall_method": {
            "type": "string",
            "enum": [
              "embedding",
              "keyword",
              "mixed"
            ],
            "default": "mixed",
            "description": "文本检索方式：embedding（向量检索）、keyword（关键词检索）、mixed（混合检索）"
          },
          "recall_ratio": {
            "type": "number",
            "default": 0.8,
            "description": "混合检索中向量检索的权重，取值范围0~1"
          },
          "enable_rerank": {
            "type": "boolean",
            "default": false,
            "description": "是否开启重排，默认不开启"
          },
          "enable_rewrite": {
            "type": "boolean",
            "default": false,
            "description": "是否开启查询重写，可配合messages参数实现多轮对话改写，默认不开启"
          },
          "enable_expansion": {
            "type": "boolean",
            "default": false,
            "description": "是否开启扩召，默认不开启"
          },
          "similarity_threshold": {
            "type": "number",
            "default": 0.2,
            "description": "相似度阈值，低于该阈值的切片会被过滤"
          },
          "messages": {
            "type": "array",
            "description": "当前对话消息列表，用于多轮对话改写",
            "items": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string",
                  "enum": [
                    "user",
                    "assistant"
                  ]
                },
                "content": {
                  "type": "string",
                  "description": "消息内容，仅支持文本"
                }
              },
              "required": [
                "role",
                "content"
              ]
            }
          },
          "search_filters": {
            "type": "object",
            "description": "过滤条件",
            "properties": {
              "index_types": {
                "type": "array",
                "description": "索引列表",
                "items": {
                  "type": "object",
                  "properties": {
                    "know_id": {
                      "type": "string",
                      "description": "知识库ID"
                    },
                    "index_type_id": {
                      "type": "integer",
                      "description": "索引ID"
                    }
                  },
                  "required": [
                    "know_id",
                    "index_type_id"
                  ]
                }
              },
              "tags": {
                "type": "array",
                "description": "标签列表",
                "items": {
                  "type": "object",
                  "properties": {
                    "tag_id": {
                      "type": "string",
                      "description": "标签ID"
                    },
                    "value_type": {
                      "type": "string",
                      "enum": [
                        "fixed",
                        "ref"
                      ],
                      "description": "固定值：fixed，引用变量：ref"
                    },
                    "filter_type": {
                      "type": "integer",
                      "enum": [
                        1,
                        2,
                        3,
                        4
                      ],
                      "description": "过滤类型：1: >=，2: <=，3: 包含，4: 不包含"
                    },
                    "filter_value": {
                      "type": "string",
                      "description": "日期/文本/引用值"
                    },
                    "multiple_value": {
                      "type": "array",
                      "description": "选项值列表",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "tag_id",
                    "value_type",
                    "filter_type",
                    "filter_value",
                    "multiple_value"
                  ]
                }
              },
              "qa_intervention": {
                "type": "object",
                "description": "QA干预配置",
                "properties": {
                  "qa_similarity_threshold": {
                    "type": "number",
                    "default": 0.6,
                    "description": "QA干预相似度阈值"
                  },
                  "qa_intervention_ids": {
                    "type": "array",
                    "description": "QA知识库ID列表",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "qa_similarity_threshold",
                  "qa_intervention_ids"
                ]
              }
            }
          }
        },
        "required": [
          "knows"
        ]
      },
      "ZragRetrieveResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "contents": {
                "type": "array",
                "description": "检索结果列表",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "切片ID（UUID）"
                    },
                    "know_id": {
                      "type": "string",
                      "description": "知识库ID"
                    },
                    "doc_id": {
                      "type": "string",
                      "description": "文档ID"
                    },
                    "text": {
                      "type": "string",
                      "description": "文本内容"
                    },
                    "medias": {
                      "type": "array",
                      "description": "文本中的媒体文件",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "图片ID"
                          },
                          "url": {
                            "type": "string",
                            "description": "图片URL"
                          },
                          "description": {
                            "type": "string",
                            "description": "图片描述"
                          }
                        }
                      }
                    },
                    "image_url": {
                      "type": "object",
                      "description": "图像URL",
                      "properties": {
                        "url": {
                          "type": "string",
                          "description": "URL"
                        }
                      }
                    },
                    "video_url": {
                      "type": "object",
                      "description": "视频URL",
                      "properties": {
                        "url": {
                          "type": "string",
                          "description": "URL"
                        }
                      }
                    },
                    "index": {
                      "type": "integer",
                      "description": "召回位次"
                    },
                    "score": {
                      "type": "number",
                      "description": "召回分数"
                    },
                    "rerank_index": {
                      "type": "integer",
                      "description": "重排位次"
                    },
                    "rerank_score": {
                      "type": "number",
                      "description": "重排分数"
                    },
                    "metadata": {
                      "type": "object",
                      "description": "元数据",
                      "properties": {
                        "doc_type": {
                          "type": "string",
                          "description": "文档类型，如 pdf、docx、jpeg、png、mp4、mp3 等"
                        },
                        "doc_name": {
                          "type": "string",
                          "description": "文档名称"
                        },
                        "doc_url": {
                          "type": "string",
                          "description": "文档URL"
                        },
                        "index": {
                          "type": "integer",
                          "description": "切片下标"
                        },
                        "page_index": {
                          "type": "integer",
                          "description": "文档页码"
                        },
                        "clip_index": {
                          "type": "integer",
                          "description": "视频切片下标"
                        },
                        "start_time": {
                          "type": "integer",
                          "description": "首帧时间戳"
                        },
                        "end_time": {
                          "type": "integer",
                          "description": "尾帧时间戳"
                        },
                        "duration": {
                          "type": "integer",
                          "description": "视频切片时长"
                        },
                        "frames": {
                          "type": "array",
                          "description": "关键帧列表",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              },
              "rewritten_query": {
                "type": "object",
                "description": "查询重写结果",
                "properties": {
                  "original_query": {
                    "type": "string",
                    "description": "原始查询"
                  },
                  "multi_queries": {
                    "type": "array",
                    "description": "备选查询列表",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "elapsed_ms": {
                "type": "integer",
                "description": "请求耗时（毫秒）"
              },
              "total_tokens": {
                "type": "integer",
                "description": "消耗的token数量"
              },
              "request_id": {
                "type": "string",
                "description": "请求ID"
              }
            }
          },
          "code": {
            "type": "integer",
            "description": "错误码，200为成功"
          },
          "message": {
            "type": "string",
            "description": "错误信息"
          }
        }
      },
      "KnowledgeCreateRequest": {
        "type": "object",
        "properties": {
          "embedding_id": {
            "type": "integer",
            "enum": [
              3,
              11,
              12
            ],
            "description": "知识库绑定的向量化模型ID。可选值：\n- 3: Embedding-2\n- 11: Embedding-3\n- 12: Embedding-3-pro"
          },
          "embedding_model": {
            "type": "string",
            "enum": [
              "Embedding-2",
              "Embedding-3",
              "Embedding-3-pro"
            ],
            "description": "知识库绑定的向量化模型code。可选值：\n- Embedding-2\n- Embedding-3\n- Embedding-3-pro"
          },
          "contextual": {
            "type": "integer",
            "enum": [
              0,
              1
            ],
            "description": "是否开启上下文增强"
          },
          "name": {
            "type": "string",
            "description": "知识库名称"
          },
          "description": {
            "type": "string",
            "description": "知识库描述"
          },
          "background": {
            "type": "string",
            "description": "背景颜色，可选：blue, red, orange, purple, sky, green, yellow，默认blue"
          },
          "icon": {
            "type": "string",
            "description": "知识库图标，可选：question, book, seal, wrench, tag, horn, house，默认question"
          }
        },
        "required": [
          "embedding_id",
          "name"
        ]
      },
      "KnowledgeCreateResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "生成的知识库唯一id"
              }
            }
          },
          "code": {
            "type": "integer",
            "description": "响应码，200为成功"
          },
          "message": {
            "type": "string",
            "description": "响应信息"
          },
          "timestamp": {
            "type": "integer",
            "description": "响应时间戳"
          }
        }
      },
      "KnowledgeEditRequest": {
        "type": "object",
        "properties": {
          "embedding_id": {
            "type": "integer",
            "enum": [
              3,
              11,
              12
            ],
            "description": "知识库绑定的向量化模型ID。可选值：\n- 3: Embedding-2\n- 11: Embedding-3\n- 12: Embedding-3-pro"
          },
          "embedding_model": {
            "type": "string",
            "enum": [
              "Embedding-2",
              "Embedding-3",
              "Embedding-3-pro"
            ],
            "description": "知识库绑定的向量化模型code。可选值：\n- Embedding-2\n- Embedding-3\n- Embedding-3-pro"
          },
          "contextual": {
            "type": "integer",
            "enum": [
              0,
              1
            ],
            "description": "是否开启上下文增强"
          },
          "name": {
            "type": "string",
            "description": "知识库名称"
          },
          "description": {
            "type": "string",
            "description": "知识库描述"
          },
          "background": {
            "type": "string",
            "description": "背景颜色，可选：blue, red, orange, purple, sky, green, yellow"
          },
          "icon": {
            "type": "string",
            "description": "知识库图标，可选：question, book, seal, wrench, tag, horn, house"
          },
          "callback_url": {
            "type": "string",
            "description": "回调地址（若修改向量模型，则需要重新构建知识，由客户决定是否单独配置回调）"
          },
          "callback_header": {
            "type": "object",
            "description": "回调时header携带的k-v（若修改向量模型，则需要重新构建知识，由客户决定是否单独配置回调）"
          }
        }
      },
      "KnowledgeEditResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "description": "响应码，200为成功"
          },
          "message": {
            "type": "string",
            "description": "响应信息"
          },
          "timestamp": {
            "type": "integer",
            "description": "响应时间戳"
          }
        }
      },
      "KnowledgeListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "list": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/KnowledgeListItem"
                },
                "description": "知识库列表"
              },
              "total": {
                "type": "integer",
                "description": "知识库总数量"
              }
            }
          },
          "code": {
            "type": "integer",
            "description": "响应码，200为成功"
          },
          "message": {
            "type": "string",
            "description": "响应信息"
          },
          "timestamp": {
            "type": "integer",
            "description": "响应时间戳"
          }
        }
      },
      "KnowledgeListItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "知识库id"
          },
          "embedding_id": {
            "type": "integer",
            "description": "向量化模型id"
          },
          "name": {
            "type": "string",
            "description": "知识库名称"
          },
          "description": {
            "type": "string",
            "description": "知识库描述"
          },
          "contextual": {
            "type": "integer",
            "description": "是否开启上下文增强"
          },
          "background": {
            "type": "string",
            "description": "背景颜色"
          },
          "icon": {
            "type": "string",
            "description": "知识库图标"
          },
          "document_size": {
            "type": "integer",
            "description": "文档数量"
          },
          "length": {
            "type": "integer",
            "description": "分词后总长度"
          },
          "word_num": {
            "type": "integer",
            "description": "总字数"
          }
        }
      },
      "KnowledgeDetailResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/KnowledgeListItem"
          },
          "code": {
            "type": "integer",
            "description": "响应码，200为成功"
          },
          "message": {
            "type": "string",
            "description": "响应信息"
          },
          "timestamp": {
            "type": "integer",
            "description": "响应时间戳"
          }
        }
      },
      "KnowledgeDeleteResponse": {
        "$ref": "#/components/schemas/BaseApiResponse"
      },
      "KnowledgeCapacityResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "used": {
                "$ref": "#/components/schemas/KnowledgeCapacityItem"
              },
              "total": {
                "$ref": "#/components/schemas/KnowledgeCapacityItem"
              }
            }
          },
          "code": {
            "type": "integer",
            "description": "响应码，200为成功"
          },
          "message": {
            "type": "string",
            "description": "响应信息"
          },
          "timestamp": {
            "type": "integer",
            "description": "响应时间戳"
          }
        }
      },
      "KnowledgeCapacityItem": {
        "type": "object",
        "properties": {
          "word_num": {
            "type": "integer",
            "description": "字数"
          },
          "length": {
            "type": "integer",
            "description": "字节数"
          }
        }
      },
      "DocumentUploadRequest": {
        "type": "object",
        "properties": {
          "files": {
            "type": "string",
            "format": "binary",
            "description": "文件"
          },
          "knowledge_type": {
            "type": "integer",
            "description": "文档类型，不传则动态解析。\n1: 按标题段落切：支持txt,doc,pdf,url,docx,ppt,pptx,md\n2: 按问答对切片：支持txt,doc,pdf,url,docx,ppt,pptx,md\n3: 按行切片：支持xls,xlsx,csv\n5: 自定义切片：支持txt,doc,pdf,url,docx,ppt,pptx,md\n6: 按页切片：支持pdf,ppt,pptx\n7: 按单个切片：支持xls,xlsx,csv"
          },
          "custom_separator": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "自定义切片规则，knowledge_type=5时传，默认\n"
          },
          "sentence_size": {
            "type": "integer",
            "description": "自定义切片大小，knowledge_type=5时传，20-2000，默认300"
          },
          "parse_image": {
            "type": "boolean",
            "description": "是否解析图片，默认不解析"
          },
          "callback_url": {
            "type": "string",
            "description": "回调地址"
          },
          "callback_header": {
            "type": "object",
            "description": "回调时header携带的k-v"
          },
          "word_num_limit": {
            "type": "string",
            "description": "文档字数上限，必须为数字"
          },
          "req_id": {
            "type": "string",
            "description": "请求唯一id"
          }
        },
        "required": [
          "files"
        ]
      },
      "DocumentUploadResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "successInfos": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DocumentUploadSuccessInfo"
                },
                "description": "上传成功的文件"
              },
              "failedInfos": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DocumentUploadFailedInfo"
                },
                "description": "上传失败的文件"
              }
            }
          },
          "code": {
            "type": "integer",
            "description": "响应码，200为成功"
          },
          "message": {
            "type": "string",
            "description": "响应信息"
          },
          "timestamp": {
            "type": "integer",
            "description": "响应时间戳"
          }
        }
      },
      "DocumentUploadSuccessInfo": {
        "type": "object",
        "properties": {
          "documentId": {
            "type": "string",
            "description": "文档ID"
          },
          "fileName": {
            "type": "string",
            "description": "文件名"
          }
        }
      },
      "DocumentUploadFailedInfo": {
        "type": "object",
        "properties": {
          "fileName": {
            "type": "string",
            "description": "文件名"
          },
          "failReason": {
            "type": "string",
            "description": "失败原因"
          }
        }
      },
      "UsageStatistics": {
        "type": "object",
        "description": "调用结束时返回的 `Token` 使用统计。",
        "properties": {
          "prompt_tokens": {
            "type": "integer",
            "description": "用户输入的 `Token` 数量"
          },
          "completion_tokens": {
            "type": "integer",
            "description": "输出的 `Token` 数量"
          },
          "total_tokens": {
            "type": "integer",
            "description": "`Token` 总数"
          }
        }
      },
      "CreateImageRequest": {
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "模型编码",
            "enum": [
              "glm-image",
              "cogview-4-250304",
              "cogview-4",
              "cogview-3-flash"
            ],
            "example": "glm-image"
          },
          "prompt": {
            "type": "string",
            "description": "所需图像的文本描述",
            "example": "一只可爱的小猫咪"
          },
          "quality": {
            "type": "string",
            "description": "生成图像的质量，`glm-image` 默认为 `hd`, 其它默认为 `standard`。`hd`: 生成更精细、细节更丰富的图像，整体一致性更高，耗时约`20`秒；`standard`: 快速生成图像，适合对生成速度有较高要求的场景，耗时约`5-10`秒。`glm-image` 仅支持 `hd`。",
            "enum": [
              "hd",
              "standard"
            ],
            "default": "hd"
          },
          "size": {
            "type": "string",
            "description": "图片尺寸，`glm-image` 推荐枚举值：`1280x1280` (默认), `1568×1056`, `1056×1568`, `1472×1088`, `1088×1472`, `1728×960`, `960×1728`。自定义参数:长宽推荐设置在`1024px-2048px`范围内,并保证最大像素数不超过`2^22px`;长宽均需为`32`的整数倍。\n 其它模型推荐枚举值：`1024x1024` (默认), `768x1344`, `864x1152`, `1344x768`, `1152x864`, `1440x720`, `720x1440`。自定义参数：长宽均需满足`512px-2048px`之间，需被`16`整除，并保证最大像素数不超过`2^21px`。",
            "default": "1280x1280",
            "example": "1280x1280"
          },
          "watermark_enabled": {
            "type": "boolean",
            "description": "控制`AI`生成图片时是否添加水印。\n - `true`: 默认启用`AI`生成的显式水印及隐式数字水印，符合政策要求。\n - `false`: 关闭所有水印，仅允许已签署免责声明的客户使用，签署路径：个人中心-安全管理-去水印管理",
            "example": true
          },
          "user_id": {
            "type": "string",
            "description": "终端用户的唯一`ID`，协助平台对终端用户的违规行为、生成违法及不良信息或其他滥用行为进行干预。`ID`长度要求：最少`6`个字符，最多`128`个字符。",
            "minLength": 6,
            "maxLength": 128
          }
        }
      },
      "AsyncCreateImageRequest": {
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "模型编码",
            "enum": [
              "glm-image"
            ],
            "example": "glm-image"
          },
          "prompt": {
            "type": "string",
            "description": "所需图像的文本描述",
            "example": "一只可爱的小猫咪"
          },
          "quality": {
            "type": "string",
            "description": "生成图像的质量。`hd`: 生成更精细、细节更丰富的图像，整体一致性更高，耗时约`20`秒；",
            "enum": [
              "hd"
            ],
            "default": "hd"
          },
          "size": {
            "type": "string",
            "description": "图片尺寸，推荐枚举值：`1280x1280` (默认), `1568×1056`, `1056×1568`, `1472×1088`, `1088×1472`, `1728×960`, `960×1728`。\n自定义参数:长宽推荐设置在`1024px-2048px`范围内,并保证最大像素数不超过`2^22px`;长宽均需为`32`的整数倍。",
            "default": "1280x1280",
            "example": "1280x1280"
          },
          "watermark_enabled": {
            "type": "boolean",
            "description": "控制`AI`生成图片时是否添加水印。\n - `true`: 默认启用`AI`生成的显式水印及隐式数字水印，符合政策要求。\n - `false`: 关闭所有水印，仅允许已签署免责声明的客户使用，签署路径：个人中心-安全管理-去水印管理",
            "example": true
          },
          "user_id": {
            "type": "string",
            "description": "终端用户的唯一`ID`，协助平台对终端用户的违规行为、生成违法及不良信息或其他滥用行为进行干预。`ID`长度要求：最少`6`个字符，最多`128`个字符。",
            "minLength": 6,
            "maxLength": 128
          }
        }
      },
      "ImageGenerationResponse": {
        "type": "object",
        "properties": {
          "created": {
            "type": "integer",
            "description": "请求创建时间，是以秒为单位的`Unix`时间戳"
          },
          "data": {
            "type": "array",
            "description": "数组，包含生成的图片`URL`。目前数组中只包含一张图片。",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string",
                  "description": "图片链接。图片的临时链接有效期为`30`天，请及时转存图片。"
                }
              },
              "required": [
                "url"
              ]
            }
          },
          "content_filter": {
            "type": "array",
            "description": "返回内容安全的相关信息",
            "items": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string",
                  "description": "安全生效环节，包括 `role = assistant` 模型推理，`role = user` 用户输入，`role = history` 历史上下文",
                  "enum": [
                    "assistant",
                    "user",
                    "history"
                  ]
                },
                "level": {
                  "type": "integer",
                  "description": "严重程度 `level 0-3`，`level 0`表示最严重，`3`表示轻微",
                  "minimum": 0,
                  "maximum": 3
                }
              }
            }
          }
        }
      },
      "AsyncVideoGenerationResponse": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "description": "模型名称。"
          },
          "task_status": {
            "type": "string",
            "description": "任务处理状态，`PROCESSING`（处理中），`SUCCESS`（成功），`FAIL`（失败） 注：处理中状态需通过查询获取结果"
          },
          "video_result": {
            "type": "array",
            "description": "数组，包含生成的视频`URL`。",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string",
                  "description": "视频链接。"
                },
                "cover_image_url": {
                  "type": "string",
                  "description": "视频封面链接。"
                }
              }
            }
          },
          "request_id": {
            "type": "string",
            "description": "标识此次请求的唯一`ID`，可由用户在客户端请求时提交或平台自动生成。"
          }
        }
      },
      "AsyncImageGenerationResponse": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "description": "模型名称。"
          },
          "task_status": {
            "type": "string",
            "description": "任务处理状态，`PROCESSING`（处理中），`SUCCESS`（成功），`FAIL`（失败） 注：处理中状态需通过查询获取结果"
          },
          "image_result": {
            "type": "array",
            "description": "数组，包含生成的图片`URL`。",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string",
                  "description": "图片链接。图片的临时链接有效期为`30`天，请及时转存图片。"
                }
              }
            }
          },
          "request_id": {
            "type": "string",
            "description": "标识此次请求的唯一`ID`，可由用户在客户端请求时提交或平台自动生成。"
          }
        }
      },
      "BadRequestData": {},
      "UnauthorizedData": {},
      "NotFoundData": {},
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "required": [
              "code",
              "message"
            ],
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "RError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer"
          },
          "msg": {
            "type": "string"
          }
        }
      },
      "LlmApplicationError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "KeyValuePair": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "变量id"
          },
          "name": {
            "type": "string",
            "description": "变量名称"
          },
          "type": {
            "type": "string",
            "description": "变量类型 Input: 文本输入 selection_list: 下拉框 upload_file: 文件上传 upload_image: 图片上传 upload_video: 视频上传 upload_audio: 音频上传"
          },
          "tips": {
            "type": "string",
            "description": "提示词"
          },
          "allowed_values": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "下拉框选项, 当type = selection_list, 会有此值"
          },
          "input_template": {
            "$ref": "#/components/schemas/InputTemplate"
          }
        },
        "required": [
          "id",
          "name",
          "type",
          "tips",
          "allowed_values",
          "input_template"
        ]
      },
      "InputTemplate": {
        "type": "object",
        "properties": {
          "options": {
            "type": "array",
            "items": {},
            "description": "可选项"
          }
        },
        "required": [
          "options"
        ]
      },
      "ApplicationVariablesResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KeyValuePair"
            },
            "description": "变量列表"
          },
          "code": {
            "type": "integer",
            "description": "响应码，200为成功"
          },
          "message": {
            "type": "string",
            "description": "响应信息"
          },
          "timestamp": {
            "type": "integer",
            "description": "响应时间戳"
          }
        },
        "required": [
          "data",
          "code",
          "message",
          "timestamp"
        ]
      },
      "ApplicationFileUploadSuccessInfo": {
        "type": "object",
        "properties": {
          "file_id": {
            "type": "string",
            "description": "文件id"
          },
          "file_name": {
            "type": "string",
            "description": "文件名"
          }
        },
        "required": [
          "file_id",
          "file_name"
        ]
      },
      "ApplicationFileUploadFailInfo": {
        "type": "object",
        "properties": {
          "file_name": {
            "type": "string",
            "description": "文件名"
          },
          "fail_reason": {
            "type": "string",
            "description": "失败原因"
          }
        },
        "required": [
          "file_name",
          "fail_reason"
        ]
      },
      "ApplicationFileUploadResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "success_info": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ApplicationFileUploadSuccessInfo"
                },
                "description": "上传成功的文件"
              },
              "fail_info": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ApplicationFileUploadFailInfo"
                },
                "description": "上传失败的文件"
              }
            },
            "required": [
              "success_info",
              "fail_info"
            ]
          },
          "code": {
            "type": "integer",
            "description": "响应码，200为成功"
          },
          "message": {
            "type": "string",
            "description": "响应信息"
          },
          "timestamp": {
            "type": "integer",
            "description": "响应时间戳"
          }
        },
        "required": [
          "data",
          "code",
          "message",
          "timestamp"
        ]
      },
      "ApplicationConversationResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "conversation_id": {
                "type": "string",
                "description": "会话id"
              }
            },
            "required": [
              "conversation_id"
            ]
          },
          "code": {
            "type": "integer",
            "description": "响应码，200为成功"
          },
          "message": {
            "type": "string",
            "description": "响应信息"
          },
          "timestamp": {
            "type": "integer",
            "description": "响应时间戳"
          }
        },
        "required": [
          "data",
          "code",
          "message",
          "timestamp"
        ]
      },
      "ApplicationInvokeRequest": {
        "type": "object",
        "properties": {
          "app_id": {
            "type": "string",
            "description": "应用id"
          },
          "conversation_id": {
            "type": "string",
            "description": "会话id, 未传则默认创建新会话"
          },
          "third_request_id": {
            "type": "string",
            "description": "三方请求id(调用插件时传入, 用于链路排查问题)"
          },
          "stream": {
            "type": "boolean",
            "description": "默认true，false时为同步调用"
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplicationInvokeMessage"
            },
            "description": "用户输入列表"
          },
          "role": {
            "type": "string",
            "description": "对话类应用请求必传：user（用户输入）， assistant（模型返回）"
          },
          "send_log_event": {
            "type": "boolean",
            "description": "是否实时推送过程日志，默认false"
          }
        },
        "required": [
          "app_id",
          "messages"
        ]
      },
      "ApplicationInvokeMessage": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "description": "角色 user/assistant"
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplicationInvokeContent"
            },
            "description": "具体内容"
          }
        },
        "required": [
          "content"
        ]
      },
      "ApplicationInvokeContent": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "内容类型 input/upload_file/upload_image/upload_video/selection_list"
          },
          "value": {
            "type": "string",
            "description": "用户输入/下拉选项/文件ID/图片视频url"
          },
          "key": {
            "type": "string",
            "description": "字段名称(文本类应用请求时必须传该字段)"
          }
        },
        "required": [
          "type",
          "value"
        ]
      },
      "ApplicationInvokeResponse": {
        "type": "object",
        "properties": {
          "request_id": {
            "type": "string",
            "description": "请求id"
          },
          "conversation_id": {
            "type": "string",
            "description": "会话id"
          },
          "app_id": {
            "type": "string",
            "description": "应用id"
          },
          "choices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplicationInvokeChoice"
            },
            "description": "增量返回的信息"
          },
          "usage": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplicationInvokeUsage"
            },
            "description": "本次调用的 tokens 数量统计"
          }
        }
      },
      "ApplicationInvokeChoice": {
        "type": "object",
        "properties": {
          "index": {
            "type": "integer",
            "description": "结果下标"
          },
          "finish_reason": {
            "type": "string",
            "description": "stop: 正常结束 error: 执行失败"
          },
          "error_msg": {
            "type": "object",
            "description": "异常信息",
            "properties": {
              "code": {
                "type": "integer"
              },
              "msg": {
                "type": "string"
              }
            }
          },
          "delta": {
            "$ref": "#/components/schemas/ApplicationInvokeDelta"
          },
          "messages": {
            "$ref": "#/components/schemas/ApplicationInvokeMessages"
          }
        }
      },
      "ApplicationInvokeDelta": {
        "type": "object",
        "properties": {
          "content": {
            "$ref": "#/components/schemas/MessageData"
          },
          "event": {
            "$ref": "#/components/schemas/ApplicationInvokeEvent"
          },
          "tool_calls": {
            "$ref": "#/components/schemas/ToolCallsData"
          }
        }
      },
      "ApplicationInvokeMessages": {
        "type": "object",
        "properties": {
          "content": {
            "$ref": "#/components/schemas/MessageData"
          },
          "event": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplicationInvokeEvent"
            }
          }
        }
      },
      "ApplicationInvokeEvent": {
        "type": "object",
        "properties": {
          "node_id": {
            "type": "string",
            "description": "节点id"
          },
          "node_name": {
            "type": "string",
            "description": "节点名称"
          },
          "type": {
            "type": "string",
            "description": "事件类型 node_processing/tool_processing/tool_finish/node_finish"
          },
          "content": {
            "type": "string",
            "description": "输入输出内容"
          },
          "time": {
            "type": "integer",
            "description": "毫秒"
          },
          "tool_calls": {
            "$ref": "#/components/schemas/ToolCallsData"
          }
        }
      },
      "ToolCallsData": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "function/retrieval/web_search"
          },
          "tool_calls_data": {
            "type": "object",
            "description": "工具消息体/日志体"
          }
        }
      },
      "MessageData": {
        "type": "object",
        "properties": {
          "msg": {
            "type": "string",
            "description": "推理内容/文本/图片/视频/工具等"
          },
          "type": {
            "type": "string",
            "description": "text/image/video/all_tools"
          },
          "code": {
            "type": "string",
            "description": "代码（all_tools时）"
          },
          "file": {
            "type": "string",
            "description": "文件URL（all_tools时）"
          },
          "url": {
            "type": "string",
            "description": "图片/视频url"
          },
          "coverUrl": {
            "type": "string",
            "description": "视频封面url"
          }
        }
      },
      "ApplicationInvokeUsage": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "description": "推理model"
          },
          "nodeName": {
            "type": "string",
            "description": "节点名称"
          },
          "inputTokenCount": {
            "type": "integer",
            "description": "输入的 tokens 数量"
          },
          "outputTokenCount": {
            "type": "integer",
            "description": "输出的 tokens 数量"
          },
          "totalTokenCount": {
            "type": "integer",
            "description": "总 tokens 数量"
          }
        }
      },
      "ApplicationSliceInfoRequest": {
        "type": "object",
        "properties": {
          "request_id": {
            "type": "string",
            "description": "创建对话或文本请求接口返回的id"
          },
          "node_id": {
            "type": "string",
            "description": "节点id"
          }
        },
        "required": [
          "request_id",
          "node_id"
        ]
      },
      "ApplicationSliceInfoResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "document_slices": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DocumentSlices"
                },
                "description": "文档切片信息"
              },
              "has_old_document": {
                "type": "boolean",
                "description": "是否存在没有切片位置的历史文档"
              }
            },
            "required": [
              "document_slices",
              "has_old_document"
            ]
          },
          "code": {
            "type": "integer",
            "description": "响应码，200为成功"
          },
          "message": {
            "type": "string",
            "description": "响应信息"
          },
          "timestamp": {
            "type": "integer",
            "description": "响应时间戳"
          }
        },
        "required": [
          "data",
          "code",
          "message",
          "timestamp"
        ]
      },
      "DocumentSlices": {
        "type": "object",
        "properties": {
          "document": {
            "$ref": "#/components/schemas/DocumentInfo"
          },
          "slice_info": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SliceInfo"
            },
            "description": "切片信息"
          },
          "hide_positions": {
            "type": "boolean",
            "description": "是否存在历史文档切片没有位置信息"
          },
          "images": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SliceImage"
            },
            "description": "图片列表"
          }
        },
        "required": [
          "document",
          "slice_info",
          "hide_positions"
        ]
      },
      "SliceImage": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string",
            "description": "图片名称"
          },
          "cos_url": {
            "type": "string",
            "description": "图片地址"
          }
        },
        "required": [
          "text",
          "cos_url"
        ]
      },
      "DocumentInfo": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "文档ID"
          },
          "name": {
            "type": "string",
            "description": "文档名称"
          },
          "url": {
            "type": "string",
            "description": "文档URL"
          },
          "dtype": {
            "type": "integer",
            "description": "文档类型"
          }
        },
        "required": [
          "id",
          "name",
          "url",
          "dtype"
        ]
      },
      "SliceInfo": {
        "type": "object",
        "properties": {
          "document_id": {
            "type": "string",
            "description": "文档ID"
          },
          "position": {
            "$ref": "#/components/schemas/SlicePosition"
          },
          "line": {
            "type": "integer",
            "description": "sheet行号"
          },
          "sheet_name": {
            "type": "string",
            "description": "sheet名称"
          },
          "text": {
            "type": "string",
            "description": "切片内容"
          }
        },
        "required": [
          "document_id",
          "text"
        ]
      },
      "SlicePosition": {
        "type": "object",
        "properties": {
          "x0": {
            "type": "number",
            "format": "float",
            "description": "左侧到行左侧的距离"
          },
          "x1": {
            "type": "number",
            "format": "float",
            "description": "字符顶部到顶部距离"
          },
          "top": {
            "type": "number",
            "format": "float",
            "description": "字符顶部到顶部距离"
          },
          "bottom": {
            "type": "number",
            "format": "float",
            "description": "字符底部到顶部距离"
          },
          "page": {
            "type": "integer",
            "description": "所在页"
          },
          "height": {
            "type": "number",
            "format": "float",
            "description": "所在页高"
          },
          "width": {
            "type": "number",
            "format": "float",
            "description": "所在页宽度"
          }
        },
        "required": [
          "x0",
          "x1",
          "top",
          "bottom",
          "page",
          "height",
          "width"
        ]
      },
      "HistorySessionRecordResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "problems": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "推荐问题列表"
              }
            },
            "required": [
              "problems"
            ]
          },
          "code": {
            "type": "integer",
            "description": "响应码，200为成功"
          },
          "message": {
            "type": "string",
            "description": "响应信息"
          },
          "timestamp": {
            "type": "integer",
            "description": "响应时间戳"
          }
        },
        "required": [
          "data",
          "code",
          "message",
          "timestamp"
        ]
      },
      "ApplicationFileStatRequest": {
        "type": "object",
        "properties": {
          "app_id": {
            "type": "string",
            "description": "智能体（应用）id"
          },
          "file_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "文件id列表"
          }
        },
        "required": [
          "app_id",
          "file_ids"
        ]
      },
      "ApplicationFileStatResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApplicationFileStatItem"
            },
            "description": "文件解析状态列表"
          },
          "code": {
            "type": "integer",
            "description": "响应码，200为成功"
          },
          "message": {
            "type": "string",
            "description": "响应信息"
          },
          "timestamp": {
            "type": "integer",
            "description": "响应时间戳"
          }
        },
        "required": [
          "data",
          "code",
          "message",
          "timestamp"
        ]
      },
      "ApplicationFileStatItem": {
        "type": "object",
        "properties": {
          "file_id": {
            "type": "string",
            "description": "文件id"
          },
          "code": {
            "type": "integer",
            "description": "文档解析状态码"
          },
          "msg": {
            "type": "string",
            "description": "描述"
          }
        },
        "required": [
          "file_id",
          "code",
          "msg"
        ]
      },
      "EditKnowledgeRequest": {
        "type": "object",
        "properties": {
          "knowledge_type": {
            "type": "integer",
            "description": "文档切片类型。1.按标题段落切；2.按问答对切片；3.按行切片；5.自定义切片；6.按页切片；7.按单个切片。"
          },
          "custom_separator": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "自定义切片分隔符，仅 knowledge_type=5 时生效，默认 \n"
          },
          "sentence_size": {
            "type": "integer",
            "description": "自定义切片字数，仅 knowledge_type=5 时生效，20-2000，默认300"
          },
          "callback_url": {
            "type": "string",
            "description": "回调地址"
          },
          "callback_header": {
            "type": "object",
            "description": "回调时 header 携带的 k-v 对象"
          }
        },
        "required": [
          "knowledge_type"
        ]
      },
      "EditKnowledgeResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "description": "状态码"
          },
          "message": {
            "type": "string",
            "description": "返回信息"
          },
          "timestamp": {
            "type": "integer",
            "description": "时间戳"
          }
        }
      },
      "KnowledgeDocumentListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "list": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/KnowledgeDocumentItem"
                }
              },
              "total": {
                "type": "integer",
                "description": "总数"
              }
            }
          },
          "code": {
            "type": "integer",
            "description": "状态码"
          },
          "message": {
            "type": "string",
            "description": "返回信息"
          },
          "timestamp": {
            "type": "integer",
            "description": "时间戳"
          }
        }
      },
      "KnowledgeDocumentItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "文档id"
          },
          "knowledge_type": {
            "type": "integer",
            "description": "文档切片类型"
          },
          "custom_separator": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "自定义分隔符"
          },
          "sentence_size": {
            "type": "integer",
            "description": "切片字数"
          },
          "length": {
            "type": "integer",
            "description": "文档长度"
          },
          "word_num": {
            "type": "integer",
            "description": "字数"
          },
          "name": {
            "type": "string",
            "description": "文档名称"
          },
          "url": {
            "type": "string",
            "description": "文档URL"
          },
          "embedding_stat": {
            "type": "integer",
            "description": "向量化状态"
          },
          "failInfo": {
            "$ref": "#/components/schemas/KnowledgeDocumentFailInfo"
          }
        }
      },
      "KnowledgeDocumentFailInfo": {
        "type": "object",
        "properties": {
          "embedding_code": {
            "type": "integer",
            "description": "向量化失败状态码"
          },
          "embedding_msg": {
            "type": "string",
            "description": "向量化失败信息"
          }
        }
      },
      "KnowledgeDocumentDetailResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/KnowledgeDocumentItem"
          },
          "code": {
            "type": "integer",
            "description": "状态码"
          },
          "message": {
            "type": "string",
            "description": "返回信息"
          },
          "timestamp": {
            "type": "integer",
            "description": "时间戳"
          }
        }
      },
      "DeleteKnowledgeResponse": {
        "$ref": "#/components/schemas/BaseApiResponse"
      },
      "UploadUrlKnowledgeRequest": {
        "type": "object",
        "properties": {
          "upload_detail": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UrlData"
            },
            "description": "url列表"
          },
          "knowledge_id": {
            "type": "string",
            "description": "知识库id"
          }
        },
        "required": [
          "upload_detail",
          "knowledge_id"
        ]
      },
      "UrlData": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "url"
          },
          "knowledge_type": {
            "type": "integer",
            "description": "文档切片类型"
          },
          "custom_separator": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "自定义切片分隔符，仅 knowledge_type=5 时生效，默认 \n"
          },
          "sentence_size": {
            "type": "integer",
            "description": "自定义切片字数，仅 knowledge_type=5 时生效，20-2000，默认300"
          },
          "callback_url": {
            "type": "string",
            "description": "回调地址"
          },
          "callback_header": {
            "type": "object",
            "description": "回调header k-v"
          }
        },
        "required": [
          "url",
          "knowledge_type"
        ]
      },
      "UploadUrlKnowledgeResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "successInfos": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "documentId": {
                      "type": "string",
                      "description": "文档id"
                    },
                    "url": {
                      "type": "string",
                      "description": "url"
                    }
                  }
                }
              },
              "failedInfos": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "description": "url"
                    },
                    "failReason": {
                      "type": "string",
                      "description": "失败原因"
                    }
                  }
                }
              }
            }
          },
          "code": {
            "type": "integer",
            "description": "状态码"
          },
          "message": {
            "type": "string",
            "description": "返回信息"
          },
          "timestamp": {
            "type": "integer",
            "description": "时间戳"
          }
        }
      },
      "ReEmbeddingRequest": {
        "type": "object",
        "properties": {
          "callback_url": {
            "type": "string",
            "description": "回调地址"
          },
          "callback_header": {
            "type": "object",
            "description": "回调header k-v"
          }
        }
      },
      "ReEmbeddingResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "description": "状态码"
          },
          "message": {
            "type": "string",
            "description": "返回信息"
          },
          "timestamp": {
            "type": "integer",
            "description": "时间戳"
          }
        }
      },
      "KnowledgeImageListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "images": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "text": {
                      "type": "string",
                      "description": "图片序号文本"
                    },
                    "cos_url": {
                      "type": "string",
                      "description": "图片链接"
                    }
                  }
                }
              }
            }
          },
          "code": {
            "type": "integer",
            "description": "状态码"
          },
          "message": {
            "type": "string",
            "description": "返回信息"
          },
          "timestamp": {
            "type": "integer",
            "description": "时间戳"
          }
        }
      },
      "AgentChatRequest": {
        "type": "object",
        "required": [
          "messages",
          "retrieval"
        ],
        "properties": {
          "messages": {
            "type": "array",
            "description": "当前消息列表，支持多模态内容",
            "items": {
              "$ref": "#/components/schemas/AgentMessage"
            }
          },
          "model": {
            "type": "string",
            "default": "glm-5v-turbo",
            "description": "LLM 模型名称，默认为 glm-5v-turbo"
          },
          "temperature": {
            "type": "number",
            "default": 0.7,
            "description": "采样温度，默认为 0.7"
          },
          "max_steps": {
            "type": "integer",
            "default": 10,
            "description": "最大推理步数，默认为 10"
          },
          "retrieval": {
            "$ref": "#/components/schemas/AgentRetrieval"
          },
          "enable_thinking": {
            "type": "boolean",
            "default": false,
            "description": "是否启用思考模式。启用后模型输出推理过程，通过 reasoning 事件流式返回"
          }
        }
      },
      "AgentRetrieval": {
        "type": "object",
        "description": "检索预设参数。预设后 LLM 仅决定是否调用检索，无需自行填写参数",
        "properties": {
          "know_ids": {
            "type": "array",
            "description": "知识库 ID 列表",
            "items": {
              "type": "string"
            }
          },
          "top_k": {
            "type": "integer",
            "description": "检索数量",
            "default": 8
          },
          "top_n": {
            "type": "integer",
            "description": "召回数量",
            "default": 10
          },
          "enable_rerank": {
            "type": "boolean",
            "description": "是否启用重排序",
            "default": false
          },
          "similarity_threshold": {
            "type": "number",
            "description": "相似度阈值",
            "default": 0.2
          }
        },
        "required": [
          "know_ids"
        ]
      },
      "AgentMessage": {
        "type": "object",
        "required": [
          "role",
          "content"
        ],
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "user"
            ],
            "description": "角色：user"
          },
          "content": {
            "description": "消息内容。纯文本用 String，多模态用 ContentPart 数组",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AgentContentPart"
                }
              }
            ]
          }
        }
      },
      "AgentContentPart": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "text",
              "image_url"
            ],
            "description": "内容类型"
          },
          "text": {
            "type": "string",
            "description": "文本内容（type=text 时）"
          },
          "image_url": {
            "type": "object",
            "description": "图片 URL（type=image_url 时）",
            "properties": {
              "url": {
                "type": "string",
                "description": "图片链接地址"
              }
            }
          }
        }
      },
      "AgentToolCallMessage": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "工具调用 ID"
          },
          "type": {
            "type": "string",
            "description": "类型，固定为 function"
          },
          "function": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "description": "工具名称"
              },
              "arguments": {
                "type": "string",
                "description": "工具调用参数（JSON 字符串）"
              }
            }
          }
        }
      },
      "AgentStreamEvent": {
        "type": "object",
        "description": "SSE 事件流中的单个事件对象",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "session_created",
              "reasoning",
              "thought",
              "tool_call",
              "tool_result",
              "answer",
              "done",
              "error"
            ],
            "description": "事件类型"
          },
          "sessionId": {
            "type": "string",
            "description": "会话 ID"
          },
          "messageId": {
            "type": "string",
            "description": "消息 ID（仅 done 事件）"
          },
          "data": {
            "description": "事件负载，结构取决于 type",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "$ref": "#/components/schemas/AgentToolCallData"
              },
              {
                "$ref": "#/components/schemas/AgentToolResultData"
              },
              {
                "$ref": "#/components/schemas/AgentErrorData"
              }
            ]
          },
          "usage": {
            "$ref": "#/components/schemas/AgentUsage"
          }
        }
      },
      "AgentToolCallData": {
        "type": "object",
        "description": "type=tool_call 时的 data 结构",
        "properties": {
          "callId": {
            "type": "string",
            "description": "工具调用 ID"
          },
          "toolName": {
            "type": "string",
            "description": "工具名称"
          },
          "arguments": {
            "type": "object",
            "description": "工具调用参数",
            "additionalProperties": true
          }
        }
      },
      "AgentToolResultData": {
        "type": "object",
        "description": "type=tool_result 时的 data 结构",
        "properties": {
          "callId": {
            "type": "string",
            "description": "工具调用 ID"
          },
          "toolName": {
            "type": "string",
            "description": "工具名称"
          },
          "result": {
            "description": "执行结果",
            "additionalProperties": true
          },
          "status": {
            "type": "string",
            "enum": [
              "success",
              "error"
            ],
            "description": "执行状态"
          },
          "durationMs": {
            "type": "integer",
            "format": "int64",
            "description": "执行耗时（毫秒）"
          }
        }
      },
      "AgentErrorData": {
        "type": "object",
        "description": "type=error 时的 data 结构",
        "properties": {
          "message": {
            "type": "string",
            "description": "错误描述"
          }
        }
      },
      "AgentUsage": {
        "type": "object",
        "description": "Token 用量信息（仅 done 事件）",
        "properties": {
          "prompt_tokens": {
            "type": "integer",
            "description": "输入 Token 数"
          },
          "completion_tokens": {
            "type": "integer",
            "description": "输出 Token 数"
          },
          "total_tokens": {
            "type": "integer",
            "description": "总 Token 数"
          },
          "total_calls": {
            "type": "integer",
            "description": "工具调用总次数"
          },
          "prompt_tokens_details": {
            "type": "object",
            "properties": {
              "cached_tokens": {
                "type": "integer",
                "description": "缓存命中 Token 数"
              }
            }
          },
          "completion_tokens_details": {
            "type": "object",
            "properties": {
              "reasoning_tokens": {
                "type": "integer",
                "description": "推理 Token 数"
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "标准的 HTTP Bearer 认证方式，在 [API Keys](https://bigmodel.cn/usercenter/proj-mgmt/apikeys) 页面获取密钥。"
      }
    }
  }
}
