内容描述生成接口文档
根据文本、图片或视频信息生成一段内容描述,返回简介、模型与用量信息。
接口说明
该接口用于根据业务输入的文本、图片或视频信息,生成一段内容描述。接口输出为模型生成的 description,同时返回模型、耗时、token 用量等信息。
支持三类输入:
- 视频:传入标题/描述 + 视频地址
- 图文:传入标题/描述 + 图片数组
- 文本:传入标题/描述 + 正文章节内容
请求地址
| 参数名 | 说明 |
|---|---|
| 测试地址 | Http POST https://la-raccoon.inaiai.com/v1/workflows/run |
| 线上地址 | Http POST https://la-otter.inaiai.com/v1/workflows/run |
请求头
bash
Authorization: Bearer app-${API_TOKEN}
Content-Type: application/json| 参数名 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| Authorization | string | 是 | 接口路由分发 |
| Content-Type | string | 是 | 固定为 application/json |
通用请求结构
json
{
"inputs": {
"query": {
"desc": "标题或基础描述",
"video": "视频地址,可选",
"images": ["图片地址1", "图片地址2"],
"contents": []
}
},
"response_mode": "blocking",
"user": "abc-123"
}字段说明
| 参数名 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| inputs.query.desc | string | 是 | 标题、名称或基础描述 |
| inputs.query.video | string | 否 | 视频 URL,视频场景使用 |
| inputs.query.images | array | 否 | 图片 URL 数组,图文场景使用 |
| inputs.query.contents | array | 否 | 文本章节内容,文本场景使用 |
| response_mode | string | 是 | 当前使用 blocking |
| user | string | 是 | 调用方用户标识,用于跟踪请求 |
视频输入示例
bash
curl -X POST 'https://la-raccoon.inaiai.com/v1/workflows/run' \
--header 'Authorization: Bearer ${API_TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
"inputs": {
"query": {
"desc": "标题:示例视频标题",
"video": "https://example.com/video.m3u8"
}
},
"response_mode": "blocking",
"user": "abc-123"
}'图片输入示例
bash
curl -X POST 'https://la-raccoon.inaiai.com/v1/workflows/run' \
--header 'Authorization: Bearer ${API_TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
"inputs": {
"query": {
"desc": "标题:示例图文标题",
"images": [
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
]
}
},
"response_mode": "blocking",
"user": "abc-123"
}'如果暂无图片,也可以传空数组:"images": []
文本输入示例
文本内容建议使用结构化章节格式:
bash
curl -X POST 'https://la-raccoon.inaiai.com/v1/workflows/run' \
--header 'Authorization: Bearer ${API_TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
"inputs": {
"query": {
"desc": "标题:示例文本标题",
"contents": [
{
"chapter_index": 1,
"title": "第一章标题",
"text": "第一章正文内容"
},
{
"chapter_index": 2,
"title": "第二章标题",
"text": "第二章正文内容"
}
]
}
},
"response_mode": "blocking",
"user": "abc-123"
}'contents 为数组,每个元素代表一个章节
chapter_index 表示章节序号
title 表示章节标题
text 表示章节正文
正文中的换行需要转义为 \n
正文中的英文双引号 " 需要转义为 \"
建议开发侧通过 JSON.stringify / json.dumps 自动生成请求体,避免手工拼接 JSON 导致报错
返回结构
json
{
"text": "",
"json": [
{
"description": "模型生成的内容简介",
"error": 0,
"error_message": "",
"model": "qwen3-vl-plus",
"usage": {
"completion_tokens": 214,
"elapsed_time": 5.22,
"prompt_tokens": 2058,
"total_tokens": 2272
}
}
],
"error_msg": null
}返回字段说明
| 参数路径 | 类型 | 说明 |
|---|---|---|
| text | string | 文本输出字段,当前通常为空 |
| json | array | 结构化返回结果 |
| json[0].description | string | 生成后的简介 |
| json[0].error | number | 模型内部错误码,0 表示成功 |
| json[0].error_message | string | 模型内部错误信息 |
| json[0].model | string | 实际使用的模型 |
| json[0].usage.elapsed_time | number | 本次模型耗时,单位秒 |
| json[0].usage.prompt_tokens | number | 输入 token 数 |
| json[0].usage.completion_tokens | number | 输出 token 数 |
| json[0].usage.total_tokens | number | 总 token 数 |
| error_msg | string / null | 接口层错误信息 |
成功判断
建议按以下规则判断是否成功:
- HTTP 状态码为 200
- 且 error_msg 为空或 null
- 且 json[0].error = 0
- 且 json[0].description 非空
常见错误
JSON 格式错误
错误示例:字符串中直接换行或引号未转义。
正确方式:"text": "第一段正文 \n 第二段正文"
contents 被错误拆分
错误示例:"contents": [{"chapter_index": 1, "text": "\"\n \""}],通常是转义或拼接逻辑错误,业务正文没有被正确写入。
正确方式:"contents": [{"chapter_index": 1, "title": "第一章标题", "text": "完整正文内容"}]