tencent cloud

LLM Service TokenHub

Image Super Resolution API Guide

ダウンロード
フォーカスモード
フォントサイズ
最終更新日: 2026-11-30 19:32:34
AI翻訳

Overview

Tencent Cloud WAND is Tencent Cloud's audio and video AI brand. Its model foundation integrates self-developed vertical AI models and mainstream SOTA models, with deep engineering optimization, and has accumulated over 100+ AI applications and industry solutions, covering capabilities such as multimodal generation, understanding, audio, codecs, image quality enhancement, and erasure. Image Super Resolution is built on WAND-Enhance+. It intelligently identifies image content and contours, reconstructs image details and textures in high definition, converts low-resolution images to high resolution, and makes blurry low-quality images clearer and sharper. It is suitable for scenarios such as old photo restoration, e-commerce product images, and design asset enhancement.
Note:
This API uses asynchronous calls: a task_id is returned immediately after a task is submitted, and you need to poll the query API to obtain the processing result.

Prerequisites

You have registered a Tencent Cloud account and activated the TokenHub service.
You have obtained the API Key in the TokenHub console.
Note:
In all examples below, YOUR_API_KEY must be replaced with your own API Key. The authentication method is the request header Authorization: Bearer YOUR_API_KEY.

Call Process

1. To submit a task: call the "Initiate Image Super-Resolution Task" API, which returns a task_id upon success.
2. To query the result: call the "Query Task Result" API with the task_id until the status is completed, and obtain the result image URL from output.file_url.

Initiating an Image Super Resolution Task

1. API Description

Select the super-resolution mode based on mode, and output with the scale factor or target width and height.
API: POST https://tokenhub-intl.tencentcloudmaas.com/v1/wand/tool/image-super-resolution

2. Input Parameters

Parameter Name
Required
Type
Description
image_url
Yes
string
Enter the image URL. http(s) public network URLs or data:image/...;base64,... format are supported. Example: https://example.com/a.png
mode
No
string
Super-resolution mode. aspect: Super-resolution to the larger rectangle of the specified width and height; fixed: Super-resolution to a fixed width and height with forced scaling; percent (default): Super-resolution by a ratio, which can be a decimal.
percent
No
float
Magnification factor. The value must be greater than or equal to 1.0. For example, 2.0 means 2x magnification. This parameter takes effect only when mode=percent.
width
No
integer
Target width (pixel)
height
No
integer
Target height (pixel)
long_side
No
integer
Target long side (pixel).
short_side
No
integer
Target short side (pixel).

3. Sample Request

3.1 Super-Resolution by Scale Factor

curl -X POST 'https://tokenhub-intl.tencentcloudmaas.com/v1/wand/tool/image-super-resolution' \\
-H 'Authorization: Bearer YOUR_API_KEY' \\
-H 'Content-Type: application/json' \\
-d '{
"image_url": "https://example.com/a.png",
"mode": "percent",
"percent": 2.0
}'

3.2 Super-Resolution to a Specified Resolution

curl -X POST 'https://tokenhub-intl.tencentcloudmaas.com/v1/wand/tool/image-super-resolution' \\
-H 'Authorization: Bearer YOUR_API_KEY' \\
-H 'Content-Type: application/json' \\
-d '{
"image_url": "https://example.com/a.png",
"mode": "fixed",
"width": 1920,
"height": 1080
}'

3.3 Super-Resolution to 1440 on the Short Side with Proportional Scaling on the Long Side

curl -X POST 'https://tokenhub-intl.tencentcloudmaas.com/v1/wand/tool/image-super-resolution' \\
-H 'Authorization: Bearer YOUR_API_KEY' \\
-H 'Content-Type: application/json' \\
-d '{
"image_url": "https://example.com/a.png",
"mode": "aspect",
"short_side": 1440
}'

4. Output Parameters

Parameter Name
Type
Description
task_id
string
Unique task identifier, used to poll the query API.
status
string
Task status.
request_id
string
Unique request identifier. Include it when troubleshooting issues.

5. Sample Response

{
"task_id": "1400000001-ProcessImageAsync-xxxxxxxx",
"status": "queued",
"request_id": "9f1c0b7e-e024-426a-bb00-839553cb58c9"
}

Querying the Task Result

1. API Description

Query the execution status and output of an image super-resolution task. After submission, poll this API until the status is completed or failed.
API: GET https://tokenhub.tencentmaas.com/v1/wand/tool/image-super-resolution/tasks/{task_id}

2. Input Parameters

Parameter Name
Required
Type
Description
task_id
Yes
string
Path parameter. Task ID returned by the submission API, which must be passed in as is.

3. Sample Request

curl -X GET 'https://tokenhub-intl.tencentcloudmaas.com/v1/wand/tool/image-super-resolution/tasks/1400000001-ProcessImageAsync-xxxxxxxx' \\
-H 'Authorization: Bearer YOUR_API_KEY'

4. Output Parameters

Parameter Name
Type
Description
task_id
string
Unique task identifier.
status
string
Task status: queued / in_progress / completed / failed.
progress
integer
Processing progress, ranging from 0 to 100.
output
object
Result product, returned only when completed.
output.file_url
string
URL of the result image, which can be directly downloaded or accessed.
error
object
Failure details, returned only when failed.
error.code
string
Error code. See "Unified error codes".
error.message
string
Error description, used for troubleshooting and not recommended for program logic judgment.
request_id
string
Unique request identifier. Include it when troubleshooting issues.

5. Sample Response

Success:
{
"task_id": "1400000001-ProcessImageAsync-xxxxxxxx",
"status": "completed",
"progress": 100,
"output": {
"file_url": "https://XXXXXXX.png"
},
"request_id": "5c93e410-e024-426a-bb00-839553cb58c9"
}
Failed:
{
"task_id": "1400000001-ProcessImageAsync-xxxxxxxx",
"status": "failed",
"progress": 100,
"error": {
"code": "InternalError",
"message": "internal error"
},
"request_id": "5c93e410-e024-426a-bb00-839553cb58c9"
}

Appendix

Unified Error Codes

The error body is unified as follows:
{"request_id": "9f1c0b7e-e024-426a-bb00-839553cb58c9", "error": {"message": "...", "type": "..."}}
HTTP
type
Meaning
400
invalid_request_error
Parameter error: image_url is missing or has an invalid format, mode is invalid, JSON decoding failed, task_id has an invalid format, or the task does not exist. Correct the request based on message and retry.
401
invalid_api_key
The API Key is missing or invalid. Check the Authorization request header.
404
not_found
The request path does not exist. Check the path spelling.
405
method_not_allowed
The request method is not allowed. Use POST for submission and GET for query.
429
rate_limit_exceeded
QPS rate limiting has been triggered (20 QPS by default for submission and 100 QPS by default for query). Reduce the request frequency and retry.
429
quota_exceeded
The quota has been exhausted. Retry later or apply for a quota increase.
500
server_error
An internal server error has occurred. You can retry. If the issue persists, submit a ticket with the Request ID for troubleshooting.
When a task fails, the query API returns status: failed, and the values of error.code are as follows:
Error Code
Meaning
InvalidParameterValue
The parameter is invalid. Check the input parameters.
InternalError
An internal server error has occurred. You can retry. If the issue persists, submit a ticket with the Request ID for troubleshooting.

FAQs

1. Why Is a 400 Error Returned Indicating That image_url Is Missing?

image_url is a required field. Make sure the field name is spelled image_url and the value is a non-empty string.

2. What Are the Differences Between the Three Modes?

aspect: upscale to a larger rectangle that can contain the specified width and height. fixed: force scaling to the specified width and height, which may change the aspect ratio. percent (default): upscale by a scale factor.

3. If Both percent and width/height Are Passed, Which One Takes Precedence?

Determined by mode:
mode=percent uses percent;
mode=fixed uses width / height;
mode=aspect uses long_side / short_side.

4. Do Generated Image URLs Expire?

The links will expire. The result links are temporary addresses valid for 24 hours. Make sure to download or transfer the files within 24 hours after the task succeeds, or the links will become invalid.

5. Can I Use the Same task_id for Repeated Queries?

Yes. The query API has no side effects.


ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック