Skip to content

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
Inputupscale_factorOutputOutput MP
1024×102411024×10241.05
1024×10242 (default)2048×20484.19
1024×102444096×409616.78
1024×102488192×819267.11
1646×16468—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.

请求参数 ​

请求体 (application/json) ​

参数类型必填说明
modelstring是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。
callBackUrlstring否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。
inputobject是Input parameters for the upscale task
  input.image_urlstring是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。

请求示例 ​

bash
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"
  }
}'
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": "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())
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": "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());
go
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))
}
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\":\"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
<?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);
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\":\"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());
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"
  }
}

响应 ​

200 — Request successful ​

500 — Server error. ​

参数类型必填说明
codeinteger是请读取响应字段,并根据返回状态处理后重试。
msgstring是Response message, error description when failed
dataobject是—
json
{
  "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.

回调体参数

参数类型必填说明
codeinteger是Unified callback code: 200 for success, 501 for failure. 可选值:200 / 501。 示例:200。
msgstring是Unified callback message. 可选值:Playground task completed successfully. / Playground task failed.。 示例:Playground task completed successfully.。
dataobject是—
  data.taskIdstring是The unique task identifier.
  data.modelstring是The model used for the task. 可选值:modelfold/image-upscale。 示例:modelfold/image-upscale。
  data.statestring是Terminal task state. 可选值:success / fail。 示例:success。
  data.paramstring是JSON string containing the submitted task parameters.
  data.resultJsonstring否JSON string containing resultUrls when successful. Present only when state is success. Result URLs expire after about 14 days.
  data.failCodestring否Failure code, a numeric string such as "400" or "500". Present only when state is fail.
  data.failMsgstring否Failure reason. Present only when state is fail.
  data.costTimeinteger否Processing time in seconds. Present on both success and failure callbacks.
  data.completeTimeinteger否Task completion timestamp.
  data.createTimeinteger否Task creation timestamp.
  data.updateTimeinteger否Use completeTime as the completion time; updateTime may equal createTime.

Task completed successfully

json
{
  "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

json
{
  "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
  }
}

ModelFold — 一个 API,接入所有主流 AI 模型。