| 项目 | 内容 |
|---|---|
| 环境 | 公网 |
| 地址 | https://api-maas.teleai.com.cn/aipaas/lm/v1/video/texthr |
| API Path | /aipaas/lm/v1/video/texthr |
| 请求方法 | POST |
| Content-Type | application/json |
调用时需按鉴权规则,在建立 WebSocket 连接时通过请求头传递鉴权信息。
请求头格式:Authorization: <鉴权信息>
| 请求头 | 必填 | 说明 |
|---|---|---|
| Content-Type | 否 | 固定为 application/json |
| X-APP-ID | 否 | 控制台"应用及API Key"中创建应用后的 AppID |
| Device-Uuid | 否 | 设备 UUID |
| Authorization | 是 | 鉴权信息 |
相关参考:开发指南中的签名认证方式、API 在线签名计算工具。
请求头格式:Authorization: Bearer <用户申请的API-KEY>
API Key 可在 API Key 管理页面获取。
| 请求头 | 必填 | 说明 |
|---|---|---|
| Content-Type | 否 | 固定为 application/json |
| Device-Uuid | 否 | 设备 UUID |
| Authorization | 是 | Bearer <API_KEY> |
根据文字提示生成高清视频,时长约 5 秒,最高 1080p。
入参限制:
prompt 为文本提示,中英文均可,建议不超过 256 字符。resolution 可选 [480,480]、[720,720]、[1080,1080],默认 [720,720]。return_mode 取 0(push,需传 callback_url)或 1(pull),默认 0。| 日期 | 版本 | 内容 |
|---|---|---|
| 2025-10-28 | v1.2.0 | extra_message 新增 enable_prompt_enhance;调整部分入参说明 |
| 2025-09-18 | v1.0.0 | 初版 API 文档 |
| 字段 | 必填 | 类型 | 说明/限制 |
|---|---|---|---|
seq_id |
是 | string | 请求唯一标识,建议不超过 256 字符 |
task_id |
是 | int | 文生视频填 30003 |
prompt |
是 | string | 文本提示,中英文均可,建议不超过 256 字符 |
resolution |
否 | array | 可选 [480,480]、[720,720]、[1080,1080],默认 [720,720];对应 480p/720p/1080p |
resolution_ratio |
否 | array | 支持 [16,9]、[9,16]、[4,3]、[3,4]、[2,3]、[3,2]、[1,1],默认 [16,9] |
extra_message |
否 | array | 算法扩展参数,见下表 |
callback_url |
否 | string | 接收回调的地址;return_mode=0 时必传 |
return_mode |
否 | int | 0 为 push,1 为 pull,默认 0 |
extra_message 数组元素| key | value 类型 | 默认 | 说明 |
|---|---|---|---|
video_seed |
int | 100 |
视频算法种子 |
negative_prompt |
string | 空 | 负向提示词 |
enable_prompt_enhance |
bool | true |
是否启用提示词增强;启用后需配置 LLM |
请求示例:
{
"seq_id": "demo-1",
"task_id": 30003,
"prompt": "a dancer in sunlight",
"resolution": [720, 720],
"resolution_ratio": [16, 9],
"extra_message": [
{
"video_seed": 100,
"negative_prompt": "",
"enable_prompt_enhance": true
}
],
"callback_url": "http://example.com/callback",
"return_mode": 0
}
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
msg |
是 | string | 调用结果描述 |
code |
是 | string | 状态响应码 |
requestId |
是 | string | 用于查询生成结果的请求 ID |
成功响应示例:
{
"msg": "调用成功",
"code": "10000",
"requestId": "tushengshipin"
}
/aipaas/lm/v1/video/texthr 发送 POST JSON 请求。code、msg、requestId。return_mode=0:最终结果推送到 callback_url。return_mode=1:通过大模型异步结果回查接口轮询结果。| 状态码 | 说明 |
|---|---|
10000 |
成功 |
10202 |
推理失败,或结果文件生成失败 |
10203 |
结果文件上传 ceph/minIO 失败 |
10301 |
必填参数缺失或未填写 |
10304 |
入参校验失败 |
10305 |
请求参数范围错误 |
10401 |
生成任务仍在执行,需稍后重试 |
10406 |
视频首帧封面截取失败 |
10503 |
请求依赖服务超时 |
10903 |
服务执行失败,可能为组件连接或模型运行异常 |
网关认证类通用状态码见状态码文档。
curl -X POST '算法调用地址' \
-H 'Content-Type: application/json' \
-H 'X-APP-ID: your_app_id' \
-H 'Authorization: your_authorization' \
-d '{
"seq_id": "demo-1",
"task_id": 30003,
"prompt": "a dancer in sunlight",
"callback_url": "http://example.com/callback"
}'
import requests
url = "算法调用地址"
headers = {
"Content-Type": "application/json",
"X-APP-ID": "your_app_id",
"Authorization": "your_authorization"
}
body = {
"seq_id": "demo-1",
"task_id": 30003,
"prompt": "a dancer in sunlight",
"callback_url": "http://example.com/callback"
}
response = requests.post(url, json=body, headers=headers)
print(response.status_code, response.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class TextToVideoHR {
public static void main(String[] args) {
String url = "算法调用地址";
String appId = "your_app_id";
String auth = "your_authorization";
String body = "{\"seq_id\":\"demo-1\",\"task_id\":30003,\"prompt\":\"a dancer in sunlight\"}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder(URI.create(url))
.header("Content-Type", "application/json")
.header("X-APP-ID", appId)
.header("Authorization", auth)
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
try {
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
} catch (Exception e) {
e.printStackTrace();
}
}
}