Unode
使用指南接口文档帮助支持商务合作

Qwen 对话

简介

给定一组包含对话的消息列表,模型将返回一个响应。Qwen 是阿里巴巴通义实验室开发的大规模语言模型,支持多语言对话、文本生成、代码生成等功能。

支持的模型

目前支持的模型包括:

模型描述
qwen-turboQwen Turbo 对话模型
qwen-plusQwen Plus 对话模型
qwen-maxQwen Max 对话模型
qwen3.5-flashQwen 3.5 Flash 对话模型
qwen3.5-plusQwen 3.5 Plus 对话模型
qwen3.6-plusQwen 3.6 Plus 对话模型
qwen3.7-maxQwen 3.7 Max 对话模型

请求示例

基础文本对话

curl --location "https://www.unodetech.xyz/api/v1/services/aigc/text-generation/generation" \
  --header "Authorization: Bearer $API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "model": "qwen-plus",
    "input": {
      "messages": [
        {
          "role": "system",
          "content": "You are a helpful assistant."
        },
        {
          "role": "user",
          "content": "Who are you?"
        }
      ]
    }
  }'

响应示例:

{
  "output": {
    "text": "",
    "finish_reason": "",
    "choices": [
      {
        "finish_reason": "stop",
        "message": {
          "content": "Hello! I'm Qwen, a large-scale language model independently developed by the Tongyi Lab under Alibaba Group. I can answer questions, create text such as stories, official documents, emails, scripts, perform logical reasoning, coding, and more. I can also express opinions and play games. I support 100 languages, including but not limited to Chinese, English, German, French, Spanish, etc., meeting international usage needs. If you have any questions or need assistance, feel free to let me know anytime!",
          "role": "assistant"
        }
      }
    ]
  },
  "usage": {
    "input_tokens": 23,
    "output_tokens": 106,
    "total_tokens": 129
  },
  "code": "",
  "message": "",
  "request_id": ""
}

请求

端点

POST /api/v1/services/aigc/text-generation/generation

创建给定聊天对话的模型响应。

鉴权方法

在请求头中包含以下内容进行 API 密钥认证:

Authorization: Bearer $API_KEY

其中 $API_KEY 是您的 API 密钥。

请求体参数

响应

文本生成对象

返回一个文本生成对象。

文本生成对象响应示例

{
  "output": {
    "text": "",
    "finish_reason": "",
    "choices": [
      {
        "finish_reason": "stop",
        "message": {
          "content": "你好!我是 Qwen,由阿里巴巴集团通义实验室独立开发的大规模语言模型。我可以回答问题、创作文本(如故事、公文、邮件、剧本等)、进行逻辑推理、编写代码等,还能表达观点、玩游戏。我支持 100 多种语言,包括但不限于中文、英语、德语、法语、西班牙语等,满足国际化使用需求。如果您有任何问题或需要帮助,随时告诉我!",
          "role": "assistant"
        }
      }
    ]
  },
  "usage": {
    "input_tokens": 23,
    "output_tokens": 106,
    "total_tokens": 129
  },
  "code": "",
  "message": "",
  "request_id": ""
}

最后更新于