ModelFold - 视频放大
接口
POST /jobs/createTask
完整 URL: https://modelfold.ai/v1/jobs/createTask
鉴权:所有请求都需要
Authorization: Bearer <API_KEY>请求头。
将源视频放大到 1080P、2K 或 4K,并保持原画面比例、原帧率、原帧数;原片有声音则带回声音。
resolution 是输出框。原片按原比例放进所选档位的框里,碰到框边为止,不裁画面。原片比该框大时等比缩小到框内并做画质增强;正好等于框时只做增强,所以选哪档就出哪档。
输入限制
- 公网可直接下载的 HTTP(S) 视频地址
- 文件大小 ≤ 50 MB
- 时长 ≤ 60 秒
- 支持的格式:MP4、MOV、MKV
- 时长和大小要下载解码后才知道,超过限制不会在提交时被拒,而是任务失败
输出
| resolution | 横屏框 | 竖屏框 |
|---|---|---|
1080P | 1920×1080 | 1080×1920 |
2K(默认) | 2560×1440 | 1440×2560 |
4K | 3840×2160 | 2160×3840 |
- 封装:MP4(H.264 + AAC);原片有音轨则转成 AAC 带回
- 宽高均为偶数
- 结果地址约 14 天后失效,需要长期保存请自行转存
- 处理耗时大致随帧数和输出像素增加(约 8 秒的 1080p 片子放大到 2K,处理大约 30–40 秒,不含排队)
创建任务
在统一任务接口上使用 model=video/upscale 提交。
- Get Task Details — 提交后,可通过统一查询接口查看任务进度并获取结果
TIP
生产环境中,建议使用 callBackUrl 参数接收处理完成的自动通知,而非轮询状态接口。同一任务的回调可能投递不止一次,请按 taskId 去重。
相关资源
- Market Overview — 浏览所有可用模型
请求参数
请求体 (application/json)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 用于处理任务的模型名称。必填字段。 - 该接口必须使用 video/upscale 模型 默认值:"video/upscale"。 可选值:video/upscale。 示例:video/upscale。 |
callBackUrl | string | 否 | 接收处理任务完成通知的回调 URL。可选配置,生产环境建议使用。 - 任务处理完成后,系统会向该 URL 以 POST 方式推送任务状态和结果 - 回调内容包含处理后内容的 URL 及任务相关信息 - 你的回调接口需支持接收 POST 请求及 JSON 格式的请求体 - 也可选择调用任务详情接口,主动轮询任务状态 - 回调可能投递不止一次,请按 taskId 去重- 为确保回调安全性,请参阅 Webhook 校验指南 了解签名验证实现方法 示例: https://your-domain.com/api/callback。 |
input | object | 是 | 处理任务的输入参数 |
input.video_url | string | 是 | 待放大的视频地址。必填。 - 必须是公网可直接下载的 HTTP(S) URL - 最大文件大小:50 MB;最长时长:60 秒 - 支持的格式:MP4、MOV、MKV - 请使用上传后的文件 URL,而不是文件内容本身 示例: https://file.aiquickdraw.com/custom-page/akr/section-images/1758166466095hvbwkrpw.mp4。 |
input.resolution | string | 否 | 目标输出框。可选。取值:1080P / 2K / 4K(须大写,按此写法传),默认 2K。- 这是输出框:原片按原比例放进框里,碰到框边为止,不裁画面 - 原片比框大时等比缩到框内并做画质增强;正好等于框时只做增强,选哪档出哪档 - 横屏框:1080P 1920×1080,2K 2560×1440,4K 3840×2160;竖屏框旋转 90° 默认值: "2K"。 可选值:1080P / 2K / 4K。 示例:2K。 |
请求示例
bash
curl -X POST "https://modelfold.ai/v1/jobs/createTask" \
-H "Authorization: Bearer $MODELFOLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "video/upscale",
"callBackUrl": "https://your-domain.com/api/callback",
"input": {
"video_url": "https://file.aiquickdraw.com/custom-page/akr/section-images/1758166466095hvbwkrpw.mp4",
"resolution": "2K"
}
}'python
import os
import requests
resp = requests.post(
"https://modelfold.ai/v1/jobs/createTask",
headers={
"Authorization": "Bearer " + os.environ["MODELFOLD_API_KEY"],
"Content-Type": "application/json",
},
json={
"model": "video/upscale",
"callBackUrl": "https://your-domain.com/api/callback",
"input": {
"video_url": "https://file.aiquickdraw.com/custom-page/akr/section-images/1758166466095hvbwkrpw.mp4",
"resolution": "2K",
},
},
)
print(resp.json())javascript
const resp = await fetch("https://modelfold.ai/v1/jobs/createTask", {
method: "POST",
headers: {
"Authorization": "Bearer " + process.env.MODELFOLD_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
"model": "video/upscale",
"callBackUrl": "https://your-domain.com/api/callback",
"input": {
"video_url": "https://file.aiquickdraw.com/custom-page/akr/section-images/1758166466095hvbwkrpw.mp4",
"resolution": "2K"
}
}),
});
console.log(await resp.json());go
package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{"model":"video/upscale","callBackUrl":"https://your-domain.com/api/callback","input":{"video_url":"https://file.aiquickdraw.com/custom-page/akr/section-images/1758166466095hvbwkrpw.mp4","resolution":"2K"}}`)
req, _ := http.NewRequest("POST", "https://modelfold.ai/v1/jobs/createTask", body)
req.Header.Set("Authorization", "Bearer " + os.Getenv("MODELFOLD_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(string(out))
}java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String body = "{\"model\":\"video/upscale\",\"callBackUrl\":\"https://your-domain.com/api/callback\",\"input\":{\"video_url\":\"https://file.aiquickdraw.com/custom-page/akr/section-images/1758166466095hvbwkrpw.mp4\",\"resolution\":\"2K\"}}";
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://modelfold.ai/v1/jobs/createTask"))
.header("Authorization", "Bearer " + System.getenv("MODELFOLD_API_KEY"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> resp = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.body());
}
}php
<?php
$ch = curl_init('https://modelfold.ai/v1/jobs/createTask');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv("MODELFOLD_API_KEY"),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => '{"model":"video/upscale","callBackUrl":"https://your-domain.com/api/callback","input":{"video_url":"https://file.aiquickdraw.com/custom-page/akr/section-images/1758166466095hvbwkrpw.mp4","resolution":"2K"}}',
]);
echo curl_exec($ch);
curl_close($ch);csharp
using System;
using System.Net.Http;
using System.Text;
var client = new HttpClient();
var req = new HttpRequestMessage(new HttpMethod("POST"), "https://modelfold.ai/v1/jobs/createTask");
req.Headers.TryAddWithoutValidation("Authorization", "Bearer " + Environment.GetEnvironmentVariable("MODELFOLD_API_KEY"));
req.Content = new StringContent("{\"model\":\"video/upscale\",\"callBackUrl\":\"https://your-domain.com/api/callback\",\"input\":{\"video_url\":\"https://file.aiquickdraw.com/custom-page/akr/section-images/1758166466095hvbwkrpw.mp4\",\"resolution\":\"2K\"}}", Encoding.UTF8, "application/json");
var resp = await client.SendAsync(req);
Console.WriteLine(await resp.Content.ReadAsStringAsync());json
{
"model": "video/upscale",
"callBackUrl": "https://your-domain.com/api/callback",
"input": {
"video_url": "https://file.aiquickdraw.com/custom-page/akr/section-images/1758166466095hvbwkrpw.mp4",
"resolution": "2K"
}
}响应
200 — 请求成功
json
{
"code": 200,
"msg": "success",
"data": {
"taskId": "task_MODELFOLD_video_upscale_example"
}
}500 — Server error.
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
code | integer | 是 | 请读取响应字段,并根据返回状态处理后重试。 |
msg | string | 是 | Response message, error description when failed |
data | object | 是 | — |
json
{
"code": 500,
"msg": "Server Error - An unexpected error occurred while processing the request",
"data": null
}回调
videoTaskCompleted
回调地址:{request.body#/callBackUrl}(即请求体里的 callBackUrl)。
当 video/upscale 任务成功或失败时,系统会发送此回调。
回调体参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
code | integer | 是 | 统一回调状态码:成功为 200,失败为 501。 可选值:200 / 501。 示例:200。 |
msg | string | 是 | 统一回调消息。 可选值:Playground task completed successfully. / Playground task failed.。 示例:Playground task completed successfully.。 |
data | object | 是 | — |
data.taskId | string | 是 | 任务唯一标识符。 |
data.model | string | 是 | 任务使用的模型。 可选值:video/upscale。 示例:video/upscale。 |
data.state | string | 是 | 任务最终状态。 可选值:success / fail。 示例:success。 |
data.param | string | 是 | 包含已提交任务参数的 JSON 字符串。 |
data.resultJson | string | 否 | 任务成功时,包含 resultUrls 的 JSON 字符串;仅在 state 为 success 时出现。结果地址约 14 天后失效。 |
data.failCode | string | 否 | 失败码,数字字符串,如 "400"、"500"。仅在 state 为 fail 时出现。 |
data.failMsg | string | 否 | 失败原因,仅在 state 为 fail 时出现。 |
data.costTime | integer | 否 | 处理耗时(秒),成功和失败回调都会返回。 |
data.completeTime | integer | 否 | 任务完成时间戳。 |
data.createTime | integer | 否 | 任务创建时间戳。 |
data.updateTime | integer | 否 | 完成时间请以 completeTime 为准;updateTime 可能与 createTime 相同。 |
任务成功完成
json
{
"code": 200,
"msg": "Playground task completed successfully.",
"data": {
"taskId": "task_example_video_webhook_001",
"model": "video/upscale",
"state": "success",
"param": "{\"input\": \"{\\\"video_url\\\": \\\"https://example.com/input-video.mp4\\\", \\\"resolution\\\": \\\"2K\\\"}\", \"callBackUrl\": \"https://example.com/callback\", \"model\": \"video/upscale\"}",
"resultJson": "{\"resultUrls\": [\"https://example.com/generated-video.mp4\"]}",
"costTime": 35,
"completeTime": 1234567890,
"createTime": 1234560000,
"updateTime": 1234567890
}
}任务失败
json
{
"code": 501,
"msg": "Playground task failed.",
"data": {
"taskId": "task_example_video_webhook_001",
"model": "video/upscale",
"state": "fail",
"param": "{\"input\": \"{\\\"video_url\\\": \\\"https://example.com/input-video.mp4\\\", \\\"resolution\\\": \\\"2K\\\"}\", \"callBackUrl\": \"https://example.com/callback\", \"model\": \"video/upscale\"}",
"failCode": "400",
"failMsg": "<error detail>",
"costTime": 12
}
}