ModelFold - Image Upscale
接口
POST /jobs/createTask
完整 URL: https://modelfold.ai/v1/jobs/createTask
鉴权:所有请求都需要
Authorization: Bearer <API_KEY>请求头。
Upscale an image by 1x, 2x, 4x, or 8x while keeping the original aspect ratio. Detail is restored generatively, and text regions are upscaled with a fidelity pass so the text is never rewritten.
upscale_factor multiplies both width and height. 1 enhances quality at the same size (denoise, sharpen, preserve text) without changing dimensions.
Input limits
- Publicly downloadable HTTP(S) image URL
- File size ≤ 20 MB
- Formats: JPG, PNG, WEBP, GIF (first frame only)
Output limits
- Output total pixels ≤ 67,108,864 (67 MP, about 8192×8192), and each side ≤ 16,384 px
| Input | upscale_factor | Output | Output MP |
|---|---|---|---|
| 1024×1024 | 1 | 1024×1024 | 1.05 |
| 1024×1024 | 2 (default) | 2048×2048 | 4.19 |
| 1024×1024 | 4 | 4096×4096 | 16.78 |
| 1024×1024 | 8 | 8192×8192 | 67.11 |
| 1646×1646 | 8 | — | 173 → 422 |
Output
- Output width and height = input width and height ×
upscale_factor(exact integers, nothing is cropped) - Format follows the input: JPG → JPG, WEBP → WEBP, everything else → PNG. Transparent backgrounds are filled with white
- Result URL expires after about 14 days — download and store it if you need it longer
Create Task
Submit with model=modelfold/image-upscale on the unified task endpoint.
- Get Task Details — After submission, use the unified query endpoint to check task progress and retrieve results
TIP
For production use, we recommend providing the callBackUrl parameter so your service can receive completion notifications instead of polling for task status. Callbacks may be delivered more than once — deduplicate by taskId.
Related Resources
- Market Overview — Explore all available models
请求参数
请求体 (application/json)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | The model name to use for generation. Required field. - Must be modelfold/image-upscale for this endpoint 默认值:"modelfold/image-upscale"。 可选值:modelfold/image-upscale。 示例:modelfold/image-upscale。 |
callBackUrl | string | 否 | The URL to receive generation task completion updates. Optional but recommended for production use. - System will POST task status and results to this URL when generation completes - Callback includes generated content URLs and task information - Your callback endpoint should accept POST requests with JSON payload containing results - Alternatively, use the Get Task Details endpoint to poll task status - Callbacks may be delivered more than once — deduplicate by taskId- To ensure callback security, see Webhook Verification Guide for signature verification implementation 示例: https://your-domain.com/api/callback。 |
input | object | 是 | Input parameters for the upscale task |
input.image_url | string | 是 | URL of the image to upscale. Required. - Must be a publicly downloadable HTTP(S) URL - Max file size: 20 MB - Supported formats: JPG, PNG, WEBP, GIF (only the first frame is used) - Use a file URL after upload, not the file content itself 示例: https://static.aiquickdraw.com/tools/example/1794381136822_zlQCnA1z.jpg。 |
请求示例
curl -X POST "https://modelfold.ai/v1/jobs/createTask" \
-H "Authorization: Bearer $MODELFOLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "modelfold/image-upscale",
"callBackUrl": "https://your-domain.com/api/callback",
"input": {
"image_url": "https://static.aiquickdraw.com/tools/example/1794381136822_zlQCnA1z.jpg",
"upscale_factor": "2"
}
}'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": "modelfold/image-upscale",
"callBackUrl": "https://your-domain.com/api/callback",
"input": {
"image_url": "https://static.aiquickdraw.com/tools/example/1794381136822_zlQCnA1z.jpg",
"upscale_factor": "2",
},
},
)
print(resp.json())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": "modelfold/image-upscale",
"callBackUrl": "https://your-domain.com/api/callback",
"input": {
"image_url": "https://static.aiquickdraw.com/tools/example/1794381136822_zlQCnA1z.jpg",
"upscale_factor": "2"
}
}),
});
console.log(await resp.json());package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{"model":"modelfold/image-upscale","callBackUrl":"https://your-domain.com/api/callback","input":{"image_url":"https://static.aiquickdraw.com/tools/example/1794381136822_zlQCnA1z.jpg","upscale_factor":"2"}}`)
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))
}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\":\"modelfold/image-upscale\",\"callBackUrl\":\"https://your-domain.com/api/callback\",\"input\":{\"image_url\":\"https://static.aiquickdraw.com/tools/example/1794381136822_zlQCnA1z.jpg\",\"upscale_factor\":\"2\"}}";
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
$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":"modelfold/image-upscale","callBackUrl":"https://your-domain.com/api/callback","input":{"image_url":"https://static.aiquickdraw.com/tools/example/1794381136822_zlQCnA1z.jpg","upscale_factor":"2"}}',
]);
echo curl_exec($ch);
curl_close($ch);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\":\"modelfold/image-upscale\",\"callBackUrl\":\"https://your-domain.com/api/callback\",\"input\":{\"image_url\":\"https://static.aiquickdraw.com/tools/example/1794381136822_zlQCnA1z.jpg\",\"upscale_factor\":\"2\"}}", Encoding.UTF8, "application/json");
var resp = await client.SendAsync(req);
Console.WriteLine(await resp.Content.ReadAsStringAsync());{
"model": "modelfold/image-upscale",
"callBackUrl": "https://your-domain.com/api/callback",
"input": {
"image_url": "https://static.aiquickdraw.com/tools/example/1794381136822_zlQCnA1z.jpg",
"upscale_factor": "2"
}
}响应
200 — Request successful
500 — Server error.
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
code | integer | 是 | 请读取响应字段,并根据返回状态处理后重试。 |
msg | string | 是 | Response message, error description when failed |
data | object | 是 | — |
{
"code": 500,
"msg": "Server Error - An unexpected error occurred while processing the request",
"data": null
}回调
imageTaskCompleted
回调地址:{request.body#/callBackUrl}(即请求体里的 callBackUrl)。
The system sends this callback when the modelfold/image-upscale task succeeds or fails.
回调体参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
code | integer | 是 | Unified callback code: 200 for success, 501 for failure. 可选值:200 / 501。 示例:200。 |
msg | string | 是 | Unified callback message. 可选值:Playground task completed successfully. / Playground task failed.。 示例:Playground task completed successfully.。 |
data | object | 是 | — |
data.taskId | string | 是 | The unique task identifier. |
data.model | string | 是 | The model used for the task. 可选值:modelfold/image-upscale。 示例:modelfold/image-upscale。 |
data.state | string | 是 | Terminal task state. 可选值:success / fail。 示例:success。 |
data.param | string | 是 | JSON string containing the submitted task parameters. |
data.resultJson | string | 否 | JSON string containing resultUrls when successful. Present only when state is success. Result URLs expire after about 14 days. |
data.failCode | string | 否 | Failure code, a numeric string such as "400" or "500". Present only when state is fail. |
data.failMsg | string | 否 | Failure reason. Present only when state is fail. |
data.costTime | integer | 否 | Processing time in seconds. Present on both success and failure callbacks. |
data.completeTime | integer | 否 | Task completion timestamp. |
data.createTime | integer | 否 | Task creation timestamp. |
data.updateTime | integer | 否 | Use completeTime as the completion time; updateTime may equal createTime. |
Task completed successfully
{
"code": 200,
"msg": "Playground task completed successfully.",
"data": {
"taskId": "task_example_image_webhook_001",
"model": "modelfold/image-upscale",
"state": "success",
"param": "{\"input\": \"{\\\"image_url\\\": \\\"https://example.com/input-image.png\\\", \\\"upscale_factor\\\": \\\"2\\\"}\", \"callBackUrl\": \"https://example.com/callback\", \"model\": \"modelfold/image-upscale\"}",
"resultJson": "{\"resultUrls\": [\"https://example.com/upscaled-image.png\"]}",
"costTime": 15,
"completeTime": 1234567890,
"createTime": 1234560000,
"updateTime": 1234567890
}
}Task failed
{
"code": 501,
"msg": "Playground task failed.",
"data": {
"taskId": "task_example_image_webhook_001",
"model": "modelfold/image-upscale",
"state": "fail",
"param": "{\"input\": \"{\\\"image_url\\\": \\\"https://example.com/input-image.png\\\", \\\"upscale_factor\\\": \\\"2\\\"}\", \"callBackUrl\": \"https://example.com/callback\", \"model\": \"modelfold/image-upscale\"}",
"failCode": "400",
"failMsg": "<error detail>",
"costTime": 3
}
}