体验中心
体验中国电信星辰大模型效果
API Path
/aipaas/mllm/v1/xingchenVideoGen/video-synthesis
请求协议
HTTPS
请求方法
POST
请求头部:
| 头部标签 | 必填 | 说明 | 类型 | 数据字典 | 限制 | 头部内容 | 示例 |
|---|---|---|---|---|---|---|---|
| Content-Type | 是 | 内容类型 | application/json | application/json | |||
| Authorization | 是 | 鉴权信息 | |||||
| X-APP-ID | 是 | 控制台--应用管理--AppID | |||||
| Device-Uuid | 是 | 设备管理-设备uuid |
请求参数 Json
Object
| 参数名 | 说明 | 必填 | 类型 | 数据字典 | 限制 | 示例 |
|---|---|---|---|---|---|---|
| model | 模型名称,本项目必须为:Xing-Video2.1 | 是 | [string] | 0 | "Xing-Video2.1" | |
| callback_url | 回调接口,返回生成结果 | 否 | [string] | 0 | ||
| return_mode | 结果返回模式,0:push,1:pull,默认为0。push模式即提供callback_url接收最终结果回调;pull模型即通过大模型异步调用结果回查接口查询最终调用结果,接口文档详见开发指南下的大模型异步调用结果回查。 | 否 | [int] | 32 | ||
| input | 输入的基本信息,如提示词等 | 是 | [object] | 0 | "一只柯基犬在夕阳下的沙滩上奔跑,海浪拍打岸边,镜头跟随小狗,画面温暖治愈" | |
| input>>prompt | 文本提示词。用于描述期望生成的视频内容。支持任何语言输入,长度不超过5000个非中文字符或2500个中文字符,超过部分将自动截断。 | 是 | [string] | 0 | ||
| input>>media | 媒体素材数组,本项目支持图像作为输入。可不填,不填即为文生视频功能。 | 否 | [array] | 0 | ||
| input>>media>>type | 媒体素材类型。可选值为: first_frame:首帧图像。最多1张,严格作为视频第一帧。 last_frame:尾帧图像。最多1张,严格作为视频最后一帧。 | 否 | [string] | 0 | ||
| input>>media>>url | 媒体素材URL。 传入图像(type=first_frame / last_frame) | 否 | [string] | 0 | "https://cdn.example.com/ref_img_1.png" | |
| parameters | 视频处理参数。 | 否 | [object] | 0 | ||
| parameters>>resolution | 生成视频的分辨率档位。默认值为720P。可选值:720P、480P | 否 | [string] | 0 | "720P" | |
| parameters>>ratio | 16:9(默认值)、4:3、1:1、3:4、9:16、21:9。仅文生图时生效,有图片输入时自适应长宽比,根据输入媒体比例和意图自动推荐合适的长宽比。 | 否 | [string] | 0 | "16:9" | |
| parameters>>duration | 生成视频的时长,单位为秒。默认值为5。取值范围为[5.0, 15.0]的浮点数 | 否 | [float] | 0 | 5.0 | |
| parameters>>seed | 随机种子,用于复现生成结果。取值范围:-1或[0, 2147483647]。传入-1或未指定时,系统自动生成随机种子。即使使用相同seed,也不能保证每次生成结果完全一致。 | 否 | [int] | 0 | 0 | |
| parameters>>prompt_extend | 是否开启prompt智能改写。开启后使用大模型对输入prompt进行智能改写。对于较短的prompt生成效果提升明显,但会增加耗时。 true:默认值,开启智能改写。 false:不开启智能改写。 | 否 | [boolean] | 0 | true |
响应内容:
返回结果
成功 (200)
Json
Object
| 参数名 | 说明 | 必填 | 类型 | 数据字典 | 限制 | 示例 |
|---|---|---|---|---|---|---|
| output | 任务输出信息。 | 是 | [object] | 0 | ||
| output>>task_id | 任务ID | 是 | [string] | 0 | ||
| output>>task_status | PENDING:任务排队中;RUNNING:任务处理中;SUCCEEDED:任务执行成功;FAILED:任务执行失败;UNKNOWN:任务不存在或状态未知 | 是 | [string] | 0 | ||
| output>>submit_time | 任务提交时间,格式:YYYY-MM-DD HH:mm:ss.SSS | 是 | [string] | 0 | ||
| output>>scheduled_time | 任务执行时间,格式为 YYYY-MM-DD HH:mm:ss.SSS | 是 | [string] | 0 | ||
| output>>end_time | 任务完成时间,格式为 YYYY-MM-DD HH:mm:ss.SSS | 是 | [string] | 0 | ||
| output>>orig_prompt | 原始输入的提示词 | 是 | [string] | 0 | ||
| output>>actual_prompt | 改写后的提示词 | 是 | [string] | 0 | ||
| output>>video_url | S3模式生成视频的URL地址: {download_path}/{bucket}/{upload_path}/{task_id}_video.mp4 本地模式生成视频的URL地址(ENV_S3_ENABLED=false): {download_path}/{task_id}_video.mp4 | 是 | [string] | 0 | ||
| output>>code | 请求失败的错误码 | 是 | [string] | 0 | ||
| output>>message | 请求失败的详细信息 | 是 | [string] | 0 | ||
| usage | 输出信息统计 | 是 | [object] | 0 | ||
| usage>>video_count | 生成视频的数量 | 是 | [int] | 0 | ||
| usage>>duration | 总视频时长,单位为秒 | 是 | [float] | 0 | ||
| usage>>output_video_duration | 输出视频的时长,单位为秒 | 是 | [float] | 0 | ||
| usage>>fps | 生成视频的帧率 | 是 | [float] | 0 | ||
| usage>>SR | 生成视频的分辨率,示例值:720 | 是 | [int] | 0 | ||
| usage>>conversion_factor | Token计算折算系数,本项目为1.5 | 是 | [float] | 0 | ||
| usage>>output_width | 最终实际输出视频的宽度(像素) | 是 | [int] | 0 | ||
| usage>>output_height | 最终实际输出视频的高度(像素) | 是 | [int] | 0 | ||
| request_id | 请求唯一标识。可用于请求明细溯源和问题排查。 | 是 | [string] | 0 |
成功示例
{
"output": {
"task_id": "task_550e8400e29b41d4a716446655440000_1798022400",
"task_status": "PENDING"
},
"request_id": "req_xxx",
"code": "",
"message": ""
}
星辰视频生成,支持文生视频,图生视频(首帧生视频),首尾帧生视频。
V2.1.0
V1.0.1
V1.0.0
| 修订日期 | 算法版本号 | 修订内容 |
|---|---|---|
| 2026-10-30 | V2.1.0 | 使用新版协议,算法更新模型 |
| 2026-10-12 | V1.0.1 | 修复显存泄漏问题,增加计费接口,增加探针 |
| 2026-09-11 | V1.0.0 | 算法初版,支持文生视频,图生视频(首帧生视频),首尾帧生视频 |
服务接口调用时需要严格遵循服务鉴权规则,服务调用鉴权规则请参见:开发指南 - 接口签名认证。
返回的图片的为url链接,使用的话需要做下载,具体下载路径需要在返回的链接前拼接上星河的代理,具体可参考星河接入规范
{
"model": "Xing-Video2.1",
"input": {
"prompt": "一只柯基犬在夕阳下的沙滩上奔跑,海浪拍打岸边,镜头跟随小狗,画面温暖治愈"
},
"parameters": {
"resolution": "720P",
"ratio": "16:9",
"duration": 5.0,
"seed": 100,
"prompt_extend": true,
}
}
{
"model": "Xing-Video2.1",
"input": {
"prompt": "一只柯基犬在夕阳下的沙滩上奔跑,海浪拍打岸边,镜头跟随小狗,画面温暖治愈",
"media": [
{"type": "first_frame", "url": "https://cdn.example.com/ref_img_1.png"}
]
},
"parameters": {
"resolution": "720P",
"ratio": "16:9",
"duration": 5.0,
"seed": 100,
"prompt_extend": true,
}
}
{
"model": "Xing-Video2.1",
"input": {
"prompt": "一只柯基犬在夕阳下的沙滩上奔跑,海浪拍打岸边,镜头跟随小狗,画面温暖治愈",
"media": [
{"type": "first_frame", "url": "https://cdn.example.com/ref_img_1.png"},
{"type": "lastt_frame", "url": "https://cdn.example.com/ref_img_2.png"}
]
},
"parameters": {
"resolution": "720P",
"ratio": "16:9",
"duration": 5.0,
"seed": 100,
"prompt_extend": true,
}
}
| HTTP | code | message | 场景说明 |
|---|---|---|---|
| 200 | “” | “” | 成功 |
| 400 | InvalidParameter | 根据实际问题报错 | 请求格式错误、缺字段、模型不支持、图片下载异常、图片格式错误、服务入参错误、缺必要字段、字段类型错、不支持参数 |
| 401 | InvalidApiKey | The provided api-key is invalid or expired. | Token 无效、过期或缺失 |
| 404 | TaskNotFound | task_id not found or expired | 查无任务示例 |
| 429 | Throttling.RateQuota | Rate limit exceeded. Please reduce your request frequency. | 超出 QPS/并发限制、队列满 |
| 500 | InternalError | 根据实际问题报错 | 模型服务内部异常、算法推理异常、文件上传异常、服务执行失败 |
| 503 | ServiceUnavailable | The requested model is currently unavailable. Please try again later. | 模型未加载、维护中、资源不足、健康检查不健康 |
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONObject;
import java.util.HashMap;
import java.util.Map;
/**
* 为保证示例可以正常运行,请确认maven中是否存在以下依赖:
* <dependency>
* <groupId>cn.hutool</groupId>
* <artifactId>hutool-all</artifactId>
* <version>5.8.29</version>
* </dependency>
* <dependency>
* <groupId>com.alibaba</groupId>
* <artifactId>fastjson</artifactId>
* <version>1.2.83</version>
* </dependency>
*/
public class Example {
public static void example() {
try {
// 算法调用地址,请根据实际情况修改
String url = "算法调用地址";
// 设置请求头
Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json");
headers.put("Device-Uuid", "2018619061498245122");
headers.put("X-APP-ID", "你实际的AppId");
headers.put("Authorization", "你实际的Authorization");
// 设置请求参数,请根据实际情况修改
String requestString = "{\n" +
" \"callback_url\":\"\",\n" +
" \"input\":{\n" +
" \"media\":[\n" +
" {\n" +
" \"type\":\"\",\n" +
" \"url\":\"\\"https://cdn.example.com/ref_img_1.png\\"\"\n" +
" }\n" +
" ],\n" +
" \"prompt\":\"\"\n" +
" },\n" +
" \"model\":\"\\"Xing-Video2.1\\"\",\n" +
" \"parameters\":{\n" +
" \"duration\":5.0,\n" +
" \"seed\":0,\n" +
" \"prompt_extend\":true,\n" +
" \"resolution\":\"\\"720P\\"\",\n" +
" \"ratio\":\"\\"16:9\\"\"\n" +
" }\n" +
"}";
// 发起HTTP请求
HttpResponse response = HttpRequest.post(url)
.headerMap(headers, true)
.body(requestString)
.execute();
// 输出响应结果
System.out.println(response.body());
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
example();
}
}
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 = "算法调用地址"
# 请求数据
request_data = {
"callback_url":"",
"input":{
"media":[
{
"type":"",
"url":"\"https://cdn.example.com/ref_img_1.png\""
}
],
"prompt":""
},
"model":"\"Xing-Video2.1\"",
"parameters":{
"duration":5.0,
"seed":0,
"prompt_extend":True,
"resolution":"\"720P\"",
"ratio":"\"16:9\""
}
}
# 构建请求头
headers = {
"Content-Type": "application/json",
"Device-Uuid": "2018619061498245122",
"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}")