You need to enable JavaScript to run this app.
Torch Object Storage

Torch Object Storage

Copy page
Download PDF
AIGC
TextToImage
Copy page
Download PDF
TextToImage
Feature description​
This interface combines object storage image processing features with Doubao's text-to-image model, storing the processed images in the specified bucket.​
tip​
HNS buckets do not support the TextToImage interface.​
Request syntax​
​
POST /?x-tos-process=aigc/text_to_image HTTP/1.1​
Host: bucketname.tos-cn-beijing.volces.com​
Date: Mon, 31 Oct 2016 12:00:00 GMT​
Authorization: authorization string​
Content-Length: length​
{​
"TaskType": "text_to_image",​
"InputDataSource": {​
"Prompt": "Thousands of troops"​
},​
"OutputProcessing": {​
"Bucket": "tostext",​
"Object": "newgen.jpg",​
"ForbiddenOverwrite": false,​
"ProcessStyle": "",​
"ProcessActions": "image/rotate,90"​
},​
"ModelConfig": {​
"ModelAction": "CVProcess",​
"ModelVersion": "2022-08-31",​
"ReqJson": {​
"req_key": "high_aes_general_v21_L"​
}​
}​
}​
​
Request parameters and headers​
This request uses common headers; see Common parameters.​
​
Name​
Location​
Type​
Required​
Sample value​
Description​
x-tos-process​
Query​
String​
Yes​
-​
Represents the special identifier for the TextToImage API request, value is aigc/text_to_image.​
​
Request body elements​
​
Name​
Type​
Required​
Sample value​
Description​
TaskType​
String​
Yes​
text_to_image​
Task type: in this scenario, the value is text_to_image, meaning the combined use of image processing features and text-to-image model.​
InputDataSource​
Arrary​
Yes​
-​
Prompt for text-to-image model.​
Prompt​
String​
Yes​
Myriad troops​
Prompt used to generate images when using the text-to-image model.​
Parent node: InputDataSource​
OutputProcessing​
Arrary​
Yes​
-​
After generating an image using the text-to-image model, use the object storage image processing feature to post-process the image.​
Bucket​
String​
Yes​
tostest​
The storage bucket for storing processed images.​
Parent node: OutputProcessing​
Object​
String​
Yes​
save_img​
Name of the processed image.​
Parent node: OutputProcessing​
ForbiddenOverwrite​
String​
Yes​
false​
When storing the processed image in the bucket, if a file with the same name exists in the bucket, whether to overwrite it is described as follows:​
  • true: do not overwrite the file with the same name, immediately report an error, and prohibit writing to the bucket.​
  • false: overwrite the file with the same name.​
Parent node: OutputProcessing​
ProcessStyle​
String​
Yes​
style01​
The image processing method for object storage is specified through the image style during image post-processing. For detailed information on image styles, see Creating Image Styles.​
Parent node: OutputProcessing​
ProcessActions​
String​
Yes​
image/resize,w_100​
The image processing method for object storage is specified through image processing parameters during image post-processing. For detailed information on image processing parameters, see Image Processing Overview.​
Parent node: OutputProcessing​
tip​
Only one of the parameters ProcessStyle or ProcessActions can be configured; configuring both simultaneously is not supported.​
ModelConfig​
String​
Yes​
-​
Configure the Doubao text-to-image model.​
ModelAction​
String​
Yes​
CVProcess​
Doubao text-to-image model interface name.​
Parent node: ModelConfig​
ModelVersion​
String​
Yes​
2022-08-31​
Doubao text-to-image model interface version number.​
Parent node: ModelConfig​
ReqJson​
String​
Yes​
"req_key": "high_aes_general_v21_L"​
The request body parameter for the Doubao text-to-image model interface, where you set the text-to-image model configuration parameters in ReqJson to define the desired style and content of the generated images. For detailed parameter information, please refer to the interface documentation of the text-to-image model.​
Parent node: ModelConfig​
tip​
If both InputDataSource.Prompt and ReqJson.Prompt are configured, the final effect follows the setting of InputDataSource.Prompt.​
​
Response headers​
The response contains only common headers. For more information, see Public Parameters.​
Response body elements​
This request response returns the response elements of the called Doubao WenShengTu model interface. For detailed parameter descriptions, see the WenShengTu model interface documentation.​
Sample request​
​
POST /?x-tos-process=aigc/text_to_imgage HTTP/1.1​
Host: examplebucket.tos-cn-beijing.volces.com​
Date: Mon, 31 Oct 2016 12:00:00 GMT​
Authorization: authorization string​
Content-Length: length​
{​
"TaskType": "text_to_image",​
"InputDataSource": {​
"Prompt": "Thousands of troops"​
},​
"OutputProcessing": {​
"Bucket": "tostext",​
"Object": "newgen.jpg",​
"ForbiddenOverwrite": false,​
"ProcessStyle": "",​
"ProcessActions": "image/rotate,90"​
},​
"ModelConfig": {​
"ModelAction": "CVProcess",​
"ModelVersion": "2022-08-31",​
"ReqJson": {​
"req_key": "high_aes_general_v21_L"​
}​
}​
}​
​
Sample response​
​
HTTP/1.1 200 OK​
x-tos-id-2: f91b0c03a01300c1-a444ed0​
x-tos-request-id: f91b0c03a01300c1-a444ed0​
Date: Fri, 30 Jul 2021 06:45:39 GMT​
server: TosServer​
Content-Length: 340​
{​
"resp_json": {​
"code": 10000,​
"data": {​
"algorithm_base_resp": {​
"status_code": 0,​
"status_message": "Success"​
},​
"binary_data_base64": null,​
"image_urls": null,​
"infer_ctx": {​
"algorithm_key": "high_aes_scheduler_general_v2.1_L",​
"app_key": "2100428692",​
"created_at": "2025-04-11T17:09:07.059326209+08:00",​
"generate_id": "",​
"log_id": "202504111708592790B4A5F2D6FB08****",​
"params": {​
"app_id": "",​
"aspect_ratio": "",​
"common_params": "",​
"ddim_steps": 25,​
"edit_session_id": "",​
"fps": 0,​
"frames": 0,​
"group_name": "",​
"height": 512,​
"input_image_url": "",​
"is_only_sr": false,​
"is_pe": true,​
"llm_result": "",​
"media_source": "",​
"n_samples": 0,​
"negative_prompt": "nsfw, nude, smooth skin, unblemished skin, mole, low resolution, blurry, worst quality, mutated hands and fingers, poorly drawn face, bad anatomy, distorted hands, limbless, 国旗, national flag.",​
"ori_prompt": "Thousands of troops",​
"origin_request_id": "",​
"output_height": 1024,​
"output_width": 1024,​
"pe_result": "This meticulous brushwork painting depicts a grand scene of thousands of soldiers and horses. In the painting, soldiers ride horses, wielding weapons, clad in armor, and with banners fluttering, preparing for battlec xThis meticulous brushwork painting depicts a grand scene of thousands of soldiers and horses. In the painting, soldiers ride horses, wielding weapons, clad in armor, and with banners fluttering, preparing for battle. They stand on the battlefield, surrounded by billowing smoke and the swirling dust of war, with enemy flags and warhorses faintly visible in the distance. The background is rendered with light ink to depict the somber sky. The entire work, through delicate lines and color transitions, presents a profound sense of history and the atmosphere of war. The painting is in the style of traditional Chinese ink painting, using the texture of rice paper, a bird's-eye view, a panoramic perspective, cool tones, low-saturation colors, and a side view.nting, using the texture of rice paper, a bird's-eye view, a panoramic perspective, cool tones, low-saturation colors, and a side view.",​
"predict_tags_result": "",​
"rephraser_result": "",​
"req_key": "high_aes_general_v21_L",​
"rescale": 0,​
"resolution": "",​
"scale": 3.5,​
"seed": -1,​
"shift": 0,​
"sr_img2img_fix_steps": 0,​
"sr_scale": 0,​
"sr_strength": 0.4,​
"sr_upscaler": "",​
"steps": 0,​
"strength": 0.4,​
"trace_id": "",​
"translate_negative_prompt": "nsfw, nude, smooth skin, unblemished skin, mole, low resolution, blurry, worst quality, mutated hands and fingers, poorly drawn face, bad anatomy, distorted hands, limbless, 国旗, national flag.",​
"translate_prompt": "千军万马",​
"use_pre_llm": false,​
"use_prompt_aug": false,​
"use_sr": true,​
"version_id": "",​
"video_url": "",​
"vlm_edit": "",​
"vlm_input": "",​
"vlm_output": "",​
"width": 512​
},​
"request_id": "05115c4406066dfb355b94239453c05bae110e6c57470c67999ad0c40c3e91c3",​
"session_id": "",​
"time_stamp": "1744362547"​
},​
"llm_result": "This meticulous brushwork painting depicts a grand scene of thousands of soldiers and horses. In the painting, soldiers ride horses, wielding weapons, clad in armor, and with banners fluttering, preparing for battle. They stand on the battlefield, surrounded by billowing smoke and the swirling haze of gunpowder, with enemy flags and warhorses faintly visible in the distance. The background is rendered with light ink to depict the somber sky. The entire work, through delicate lines and color transitions, presents a profound sense of history and the atmosphere of war. It is in the style of traditional Chinese ink painting, using the texture of rice paper, a bird's-eye view, a panoramic perspective, cool tones, low-saturation colors, and a side view.",​
"pe_result": "This meticulous brushwork painting depicts a grand scene of thousands of soldiers and horses. In the painting, soldiers ride horses, wielding weapons, clad in armor, and with banners fluttering, preparing for battle. They stand on the battlefield, surrounded by billowing smoke and the swirling haze of gunpowder, with enemy flags and warhorses faintly visible in the distance. The background is rendered with light ink to depict the somber sky. The entire work, through delicate lines and color transitions, presents a profound sense of history and the atmosphere of war. It is in the style of traditional Chinese ink painting, using the texture of rice paper, a bird's-eye view, a panoramic perspective, cool tones, low-saturation colors, and a side view.",​
"predict_tags_result": "",​
"rephraser_result": "",​
"request_id": "05115c4406066dfb355b94239453c05bae110e6c57470c67999ad0c40c3e91c3",​
"vlm_result": ""​
},​
"message": "Success",​
"request_id": "202504111708592790B4A5F2D6FB08CAAC",​
"status": 10000,​
"time_elapsed": "7.645061602s"​
}​
}​
​
​
Last updated: 2026.06.17 17:18:34