接口文档
更新时间 2026-09-26 00:42:20
最近更新时间: 2026-09-26 00:42:20
接口信息
API Path
/aipaas/lm/v1/video/imageGeneralHR
请求协议
HTTPS POST
建立连接时的请求参数:
请求头部:
| 头部标签 | 必填 | 说明 | 类型 | 数据字典 | 限制 | 头部内容 | 示例 |
|---|---|---|---|---|---|---|---|
| Content-Type | 是 | 内容类型 | [string] | - | - | application/json | application/json |
| X-APP-ID | 是 | 控制台--应用管理--AppID | [string] | - | - | - | - |
| Device-Uuid | 否 | 设备管理-设备uuid | [string] | - | - | - | - |
| Authorization | 是 | 鉴权信息 | [string] | - | - | - | - |
请求参数
Json Object
| 参数名 | 说明 | 必填 | 类型 | 数据字典 | 限制 | 示例 |
|---|---|---|---|---|---|---|
seq_id | 请求序列号,请求的唯一标识,建议长度不超过256,不做强校验 | 是 | [string] | - | - | - |
task_id | 算法能力编号【30004】 | 是 | [int] | - | - | 30004 |
image_type | 0,url;1,base64;默认0,本服务仅支持0 | 否 | [int] | - | - | 0 |
image | url,仅支持单张图输入 | 是 | [array] | - | ["http://xxxx.jpg"] | |
prompt | 文本内容,支持中英文,建议长度不超过512 | 是 | [string] | - | - | 蓝天草地马儿跑 |
resolution | 支持[480,480]和[720,720],默认值[720,720] (该参数表示的是生成视频的分辨率为480P/720P) | 否 | [array] | - | - | [720,720] |
add_logo | 是否添加AI水印logo,不传则默认不加 | 否 | [boolean] | - | - | - |
| extra_message | 扩展参数列表,见下表 | 否 | [array] | - | - | - |
| callback_url | 接收回调结果的url地址 | 是 | [string] | - | - | http://0.0.0.0:7777/callback |
return_mode | 结果返回模式,0:push,1:pull,默认为0。push模式即提供callback_url接收最终结果回调;pull模型即通过大模型异步调用结果回查接口查询最终调用结果,接口文档详见开发指南下的大模型异步调用结果回查。 | 是 | [int] | - | - | - |
extra_message支持的参数
| Key | Value | value类型 |
|---|---|---|
| video_seed | 视频算法种子,默认100 | [int] |
| negative_prompt | 视频生成负向提示词,不填默认"" | [string] |
| enable_prompt_enhance | 是否启用提示词增强,默认false,当前版本不支持true | [bool] |
extra_message入参示例如下:
"extra_message": [{
"key": "video_seed",
"value": 100
}, {
"key": "negative_prompt",
"value": ""
}, {
"key": "enable_prompt_enhance",
"value": false
}]返回结果
成功 (200) Json Object
| 参数名 | 说明 | 必填 | 类型 | 数据字典 | 限制 | 示例 |
|---|---|---|---|---|---|---|
seq_id | 请求序列号,唯一标识,与输入保持一致 | 是 | [string] | - | - | - |
send_pts_ms | 发送时间戳(毫秒) | 是 | [long] | - | - | - |
code | 状态响应码 | 是 | [int] | - | - | - |
message | 调用结果描述 | 是 | [string] | - | - | - |
task_id | 能力编号,同输入参数 | 是 | [int] | - | - | - |
flag | 业务上成功或失败:1成功,0失败 | 是 | [string] | - | - | - |
data | 返回结果 | 是 | [object] | - | - | - |
data>>status | 状态:0-未开始,1-执行中,2-执行成功,3-执行失败 | 是 | [int] | - | - | - |
data>>task_result | 任务执行结果,code码不是10000时此字段为空字典 | 否 | [object] | - | - | - |
| data>>task_result>>out_image | 视频首帧图,["http://***.jpg"],返回存放jpg数据的url地址,或jpg的base64数据,生成失败则返回空列表。结果资源获取请参见开发指南-异步调用结果获取-获取大模型生成结果文件信息。 | 否 | [string] | - | - | - |
| data>>task_result>>out_video | 结果视频,["http://***.mp4"],返回存放mp4数据的url地址,或本地mp4文件地址,生成失败则返回空列表。结果资源获取请参见开发指南-异步调用结果获取-获取大模型生成结果文件信息。 | 否 | [string] | - | - | - |
data>>task_result>>out_text | 实际使用的prompt ["xxxxxxxxxx"], 返回生成视频实际使用的prompt,可能与原始数据相同也可能经过提示词增强,生成失败则返回空列表 | 否 | [string] | - | - | - |
服务鉴权
服务接口调用时需要严格遵循服务鉴权规则,服务调用鉴权规则请参见:开发指南 - 接口签名认证。
请求示例
{
"seq_id": "test-001",
"task_id": 1,
"image_type": 0,
"image": ["https://example.com/image.jpg"],
"prompt": "一只猫在奔跑",
"resolution": [720, 720],
"return_mode": 0,
"extra_message": [
{
"key": "video_seed",
"value": "42"
},
{
"key": "negative_prompt",
"value": "模糊,低质量"
},
{
"key": "enable_prompt_enhance",
"value": true
}
],
"callback_url": "https://example.com/callback"
}响应结果示例
{
"seq_id": "test-001",
"send_pts_ms": 1694280000000,
"code": 10000,
"message": "success",
"task_id": 1,
"flag": "success",
"data": {
"status": 0,
"task_result": {
"out_image": "",
"out_video": "",
"out_text": ""
}
}
}调用示例
Java调用示例
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONUtil;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/** 主类,用于发起HTTP请求并处理响应 */
public class Example {
public static void main(String[] args) {
example();
}
/**
* 方法中使用到的 JSONUtil、HttpRequest、HttpResponse均来自Hutool工具类。
* 具体maven依赖为:
* <dependency>
* <groupId>cn.hutool</groupId>
* <artifactId>hutool-all</artifactId>
* <version>5.8.29</version>
* </dependency>
*/
public static void example() {
try {
String url = "算法调用地址";
// 设置请求头
Map<String, String> headers = new HashMap<>();
//调用鉴权
headers.put("Content-Type", "application/json");
headers.put("X-APP-ID", "yourAppId");
headers.put("Authorization", "yourAuthorization");
// 创建请求对象
Map<String, Object> request = new HashMap<>();
request.put("seq_id", "test001");
request.put("task_id", 30004);
request.put("image", Arrays.asList("yourImageUrl"));
request.put("prompt", "she is dancing in the sun");
request.put("callback_url", "http://callbackUrl");
// 将请求对象转换为JsonNode
String requestString = JSONUtil.toJsonStr(request);
// 发起HTTP请求
HttpResponse response =
HttpRequest.post(url)
.headerMap(headers, true)
.body(requestString)
.execute();
// 输出响应结果
System.out.println(response.body());
} catch (Exception e) {
e.printStackTrace();
}
}
}Python调用示例
import json
import hashlib
import hmac
import time
import re
import urllib.parse
import requests
import warnings
from datetime import datetime
import logging
# 配置日志,设置日志级别为INFO,并指定日志格式
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
# 配置环境变量
X_APP_ID = "yourAppId"
AUTHORIZATION = "yourAuthorization"
# URL 和请求数据
url = "算法调用地址" # 请求的URL
request_data = {
"seq_id": "seq_id",
"task_id": 30004,
"image": [
"yourImageUrl"
],
"prompt": " she is dancing in the sun ",
"callback_url": "http://callbackUrl"
}
# 构建请求头
headers = {
"Content-Type": "application/json",
"X-APP-ID": X_APP_ID,
"Authorization": AUTHORIZATION
}
def timeSimple(timestamp):
# 将时间戳转换为HH:MM:SS格式的时间字符串
dt_object = datetime.fromtimestamp(timestamp)
formatted_time = dt_object.strftime("%H:%M:%S")
return formatted_time
def send_request(url):
try:
start_time = time.time()
logging.info(f"请求路径: {url}")
logging.info(f"开始发送: {timeSimple(start_time)}")
with requests.post(
url, json=request_data, headers=headers, stream=True, verify=False
) as response:
first_packet_time = None
if response.status_code == 200:
logging.info(f"接受到返回: {timeSimple(time.time())}")
for chunk in response.iter_content(chunk_size=1024):
if chunk:
if first_packet_time is None:
first_packet_time = time.time()
logging.info(
f"Received chunk: {timeSimple(time.time())} {chunk.decode('utf-8')}"
)
end_time = time.time()
logging.info(f"Time to first byte (TTFB): {first_packet_time - start_time:.3f} seconds")
logging.info(f"Request completed in {end_time - start_time:.3f} seconds")
else:
logging.error(f"Request failed with status code {response.status_code}")
except Exception as e:
logging.error(f"An error occurred: {e}")
# 发送请求
send_request(url)
logging.info(f"headers = {headers}")状态码说明
| 状态码 | 解释 | 说明 | 解决方法 |
|---|---|---|---|
| 10301 | Parameter error | 参数错误 | 检查请求体是否符合接口协议 |
| 10302 | Too many requests | 并发请求过多 | 联系商务,增加并发 |
| 10304 | Parse request body fail | 请求格式错误 | 查看请求的 URL body 格式是否正确,参考接口文档 |
| 10503 | Server connection time out | 服务连接超时 | 联系技术人员 |
| 10903 | Synthesis failed | 合成失败 | 联系技术人员 |
| 10000 | Success | 成功 | 执行下一步操作 |