v1

latestOpenAPI 3.0.1ZHIPU AI 开发者协议和政策2026-07-2649130210.9 KB
Agent API

智能体对话

与智能体进行对话交互。支持同步和流式调用,提供智能体的专业能力。见 智能体文档。点击 Try it 按钮可快速试用。

post/v1/agents

Request body

agent_id'general_translation' | 'slides_glm_agent' | 'ai_drawing_agent' | 'receipt_recognition_agent' | 'clothes_recognition_agent' | 'intelligent_education_solve_agent' | 'vidu_template_agent' required

此处提供 通用翻译智能体 general_translation 的拓展参数模板作为示例,其他内嵌智能体需要参考文档在下方手动设置拓展参数。

streamboolean

是否选择流式输出。当一个 agent 提供流式与非流式两种输出方式时,可根据需求选择一种。

Example request

{
  "messages": [
    {
      "role": "user",
      "content": "请帮我翻译这段文字:Hello World"
    }
  ],
  "custom_variables": {
    "source_lang": "en",
    "target_lang": "zh-CN",
    "strategy": "general",
    "strategy_config": {
      "general": {
        "suggestion": "专业技术文档翻译风格"
      }
    }
  }
}

Response

业务处理成功

idstring

请求唯一标识

agent_idstring

智能体唯一标识

conversation_idstring

对话唯一标识

async_idstring

异步任务唯一标识(异步调用时出现)

Example response

{
  "choices": [
    {
      "messages": [
        {
          "role": "assistant"
        }
      ]
    }
  ]
}