接口描述
本接口基于多模态大模型提供通用图片分析功能,实现对图片的内容理解,支持通过 POST 请求一次性传入多张图片进行联合分析。
授权说明
服务开通
注意:
数据万象绑定后,如果您手动对存储桶进行数据万象的解绑操作,将无法继续使用该功能。
使用限制
图片格式支持:jpg、png、webp、bmp、avif、heif、gif。
单张图片大小不超过10MB,分辨率不超过7680px × 4320px。
默认频控限制为1QPS。
地域限制:当前仅支持中国大陆公有云地域:成都、重庆、北京、南京、上海、广州。
费用说明
请求
请求示例
POST /?ci-process=AIImageAnalysis HTTP/1.1Host: <BucketName-APPID>.ci.<Region>.myqcloud.comDate: <GMT Date>Authorization: <Auth String>Content-Length: <length>Content-Type: application/xml<Request><Input><Message><Content><Part><Type>Image</Type><ObjectKey>sample/image1.jpg</ObjectKey></Part><Part><Type>Image</Type><Url>https://example.com/image2.jpg</Url></Part><Part><Type>Text</Type><Url>以上两张图为同一个商品的不同角度</Url></Part></Content></Message></Input><Conf><Type>Description</Type><TemplateName>general</TemplateName></Conf></Request>
说明:
请求头
请求体
请求体为 XML 格式,具体节点描述如下:
节点名称(关键字) | 父节点 | 描述 | 类型 | 是否必选 |
Request | 无 | 通用图片分析的请求配置 | Container | 是 |
Container 节点 Request 的具体内容如下:
节点名称(关键字) | 父节点 | 描述 | 类型 | 是否必选 |
Input | Request | 需要分析的输入内容,包含 Message 消息容器。 | Container | 是 |
Conf | Request | 分析配置项 | Container | 是 |
Container 节点 Input 的具体内容如下:
节点名称(关键字) | 父节点 | 描述 | 类型 | 是否必选 |
Message | Request.Input | 消息容器。 | Container | 是 |
Content | Request.Input.Message | 内容容器,由若干 Part 组成 | Container | 是 |
Part | Request.Input.Message.Content | 多模态内容片段,可重复多个,按出现顺序组装为大模型输入。Part 总数最多20个,其中图片类型 Part 最多10个 | Container 数组 | 是 |
Type | Request.Input.Message.Content.Part | 取值: Image:输入的图片内容,可通过 ObjectKey 或 Url 指定图片来源Text:输入的文本内容,会作为上下文信息(如时间戳、描述)与图片一起发送给大模型,辅助模型进行更精准的分析 | String | 是 |
ObjectKey | Request.Input.Message.Content.Part | 存储在 COS 存储桶中的图片对象键,例如目录 test 下的文件 image.jpg,则 ObjectKey 为 test/image.jpg仅在 Type 为 Image 时有效 | String | 否,但必须与 Url 二选一 |
Url | Request.Input.Message.Content.Part | 公网可访问的图片链接地址,例如 http://a-1250000.cos.ap-shanghai.myqcloud.com/image.jpg仅在 Type 为 Image 时有效 | String | 否,但必须与 Url 二选一 |
Text | Request.Input.Message.Content.Part | 文本内容,仅在 Type 为 Text 时有效。长度限制为1024字符。可用于传入时间戳、描述信息、分析指令(Custom 模式下作为 Prompt)等 | String | 否 |
说明:
ObjectKey 和 Url 只能选择其中一种,同时传入时仅生效 ObjectKey。
通过 ObjectKey 进行分析为内网操作,不会产生额外的外网流量,通过 Url 进行分析会产生图片所在源站对应的外网流量。
图片类型和文本类型的 Part 可以任意顺序混合排列,后端按出现顺序组装为大模型输入。
请求中必须包含至少一个图片类型的 Part(
Type = Image)。Container 节点 Conf 的具体内容如下:
节点名称(关键字) | 父节点 | 描述 | 类型 | 是否必选 |
Type | Request.Conf | 分析类型,取值: Description:将所有图片一次性发送给大模型进行联合分析,返回一组统一的描述和整体的标签结果,可能存在不同维度的多组标签,需要与 TemplateName 联合使用。 | String | 是 |
TemplateName | Request.Conf | 图片分析模板,目前支持两种预设模板: general:默认值,开放性标签模板,返回图片整体描述和通用标签信息,返回的标签为通用三层级标签:first_label、second_label、third_labelecommerce:电商标签模板,返回图片整体描述和商品品牌、类别、商标三个层级的标签:brand、category、logo | String | 否 |
响应
响应头
响应体
该响应体返回为 application/xml 数据。
响应体示例
<Response><Code>0</Code><Message>OK</Message><State>Success</State><AnalysisResult><Type>Description</Type><DescriptionResult><Description>两张图片展示了同一款运动鞋的正面和背面视角,白色鞋身搭配黑色 Logo。</Description><LabelDetail><LabelInfos><ConfidenceLevel>high</ConfidenceLevel><LabelInfo><LabelName>Brand</LabelName><LabelValue>Nike</LabelValue></LabelInfo><LabelInfo><LabelName>Category</LabelName><LabelValue>运动鞋</LabelValue></LabelInfo><LabelInfo><LabelName>Logo</LabelName><LabelValue>Swoosh</LabelValue></LabelInfo></LabelInfos></LabelDetail></DescriptionResult></AnalysisResult><RequestId>NmE0Y********QyMw</RequestId></Response>
响应体参数说明
具体节点描述如下:
节点名称(关键字) | 父节点 | 描述 | 类型 |
Response | 无 | 通用图片分析返回的响应内容 | Container |
Container 节点 Response 的具体内容如下:
节点名称(关键字) | 父节点 | 描述 | 类型 |
Code | Response | 错误码,成功时为 0,失败时返回具体错误码 | String |
Message | Response | 请求报错时,该字段返回具体的错误描述,请求成功时返回 OK | String |
State | Response | 分析状态,取值: Success(成功)、Failed(失败) | String |
RequestId | Response | String | |
AnalysisResult | Response | 分析结果容器,分析成功时返回 | Container |
Container 节点 AnalysisResult 的具体内容如下:
节点名称(关键字) | 父节点 | 描述 | 类型 |
Type | Response.AnalysisResult | 分析类型,取值: Description | String |
DescriptionResult | Response.AnalysisResult | 图片综合描述分析结果,包含描述和标签,当 Type 为 Description 时返回 | Container |
Container 节点 DescriptionResult 的具体内容如下:
节点名称(关键字) | 父节点 | 描述 | 类型 |
Description | Response.AnalysisResult.DescriptionResult | 图片的整体描述内容 | String |
LabelDetail | Response.AnalysisResult.DescriptionResult | 识别到的标签结果容器,可包含多组 LabelInfos。仅当大模型成功输出有效标签时返回;若模型未输出标签(如图片无法识别、内容不匹配等场景)或过滤后无有效标签,该字段缺失 | Container |
Container 节点 LabelDetail 的具体内容如下:
节点名称(关键字) | 父节点 | 描述 | 类型 |
LabelInfos | Response.AnalysisResult.DescriptionResult.LabelDetail | 识别到的标签信息容器,每一组 LabelInfos 代表一个识别对象(一个物品/一组维度),对应一个置信度,包含多个 LabelInfo | Container 数组 |
Container 节点 LabelInfos 的具体内容如下:
节点名称(关键字) | 父节点 | 描述 | 类型 |
ConfidenceLevel | Response.AnalysisResult.DescriptionResult.LabelDetail.LabelInfos | 标签置信度,包含: high、medium、low 三个等级,每组 LabelInfos 对应一个置信度 | String |
LabelInfo | Response.AnalysisResult.DescriptionResult.LabelDetail.LabelInfos | 标签信息子节点,每个 LabelInfo 包含一对标签:标签名称和标签值 | Container 数组 |
Container 节点 LabelInfo 的具体内容如下:
节点名称(关键字) | 父节点 | 描述 | 类型 |
LabelName | Response.AnalysisResult.DescriptionResult.LabelDetail.LabelInfos.LabelInfo | 识别出的标签名称。 ecommerce 模板固定为:品牌 brand、商品类型 category、商标 logogeneral 模板固定为:一级标签 first_label、二级标签 second_label、三级标签 third_label | String |
LabelValue | Response.AnalysisResult.DescriptionResult.LabelDetail.LabelInfos.LabelInfo | 识别出的标签名称对应的标签值,例如商品类型对应"上衣"、"裤子",品牌对应"Nike"、"李宁"等 | String |
实际案例
传入多张商品图片,使用
ecommerce 预设模板进行联合标签分析。请求
POST /?ci-process=AIImageAnalysis HTTP/1.1Authorization: q-sign-algorithm=sha1&q-ak=AKID****&q-sign-time=1497530202;1497610202&q-key-time=1497530202;1497610202&q-header-list=&q-url-param-list=&q-signature=28e9a4986df11bed0255e97ff905****Host: examplebucket-1250000000.ci.ap-beijing.myqcloud.comContent-Length: 520Content-Type: application/xml<Request><Input><Message><Content><Part><Type>Image</Type><ObjectKey>products/shoe_front.jpg</ObjectKey></Part><Part><Type>Image</Type><ObjectKey>products/shoe_side.jpg</ObjectKey></Part><Part><Type>Image</Type><Url>https://example.com/products/shoe_back.jpg</Url></Part></Content></Message></Input><Conf><Type>Description</Type><TemplateName>ecommerce</TemplateName></Conf></Request>
响应
HTTP/1.1 200 OKContent-Type: application/xmlContent-Length: 980Connection: keep-aliveDate: Mon, 28 May 2026 15:23:12 GMTServer: tencent-cix-ci-request-id: NWFjMzQ0MDZfOTBmYTUwXzZkZV8z****<Response><Code>0</Code><Message>OK</Message><State>Success</State><AnalysisResult><Type>Description</Type><DescriptionResult><Description>三张图片展示了同一款运动鞋的正面、侧面和背面视角,白色鞋身搭配黑色 Logo,鞋底为橡胶材质。</Description><LabelDetail><LabelInfos><ConfidenceLevel>high</ConfidenceLevel><LabelInfo><LabelName>Brand</LabelName><LabelValue>Nike</LabelValue></LabelInfo><LabelInfo><LabelName>Category</LabelName><LabelValue>运动鞋</LabelValue></LabelInfo><LabelInfo><LabelName>Logo</LabelName><LabelValue>Swoosh</LabelValue></LabelInfo></LabelInfos></LabelDetail></DescriptionResult></AnalysisResult></Response>