Skip to main content

GenerateImageTask

Asynchronously generates an image from text.

Try it now

You can run this API directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After the call succeeds, OpenAPI Explorer can automatically generate SDK code examples. Try it now

Authorization information

The following table describes the authorization information of the API. You can use it in the Action element of a RAM permission policy statement to grant RAM users or RAM roles the permission to call this API. For more information, see the following:
  • Action: the specific permission point.
  • Access level: the access level of each operation. Valid values: Write, Read, or List.
  • Resource type: the resource types that support authorization in the operation. For more information, see the following:
    • Required resource types are marked with a leading *.
    • For operations that do not support resource-level authorization, All resources is used.
  • Condition key: the condition keys defined by the cloud service itself.
  • Dependent action: the other permissions required to successfully perform the operation. The caller must have the permissions of the dependent actions at the same time for the operation to succeed.
ActionAccess levelResource typeCondition keyDependent action
aimiaobi:GenerateImageTaskcreate
*All resources
*
    None
None

Request parameters

NameTypeRequiredDescriptionExample value
AgentKeystringYes

Unique identifier of the workspace: AgentKey

e1be065b-adc3-435e-bd01-1c18c5ed75d3
ParagraphListarray<object>Yes

The content of the paragraphs.

ParagraphListobjectYes
ContentstringYes

The content of the paragraph.

A perpetually sad cat
IdlongYes

The paragraph ID.

1
TaskIdstringNo

The unique ID of the task.

Note You do not need to specify TaskId by default. The system generates it automatically. When the TaskId of subsequent tasks is the same, these tasks belong to the same conversation group.
e1be065b-adc3-435e-bd01-1c18c5ed75d3
TaskStatusstringNo

The current status of the task.

  • PENDING: The task is in the queue.
  • RUNNING: The task is in progress.
  • SUSPENDED: The task is suspended.
  • SUCCEEDED: The task was executed successfully.
  • FAILED: The task failed to be executed.
  • UNKNOWN: The task does not exist or the status is unknown.
SUCCEEDED
StylestringYes

The style.

Valid values:
  • <portrait>: Portrait photography.
  • <auto>: Default style.
  • <3d cartoon>: 3D cartoon.
  • watercolor: Watercolor.
  • <photography>: Photography.
  • <flat illustration>: Flat illustration.
  • <sketch>: Sketch.
  • <oil painting>: Oil painting.
  • <chinese painting>: Chinese painting.
  • <anime>: Animation.
'<auto>'
SizestringYes

The size of the image to generate.

Valid values:
  • 1024*1024: 1024*1024.
  • 720*1280: 720*1280.
  • 1280*720: 1280*720.
1024*1024
ArticleTaskIdstringYes

The task ID of the article. If you do not have one, you can assign a universally unique identifier (UUID).

e1be065b-adc3-435e-bd01-1c18c5ed75d3

Response elements

NameTypeDescriptionExample value
object

PlainResult

Codestring

The status code.

successful
Dataobject

The business data.

TaskListarray<object>

The information about the paragraph tasks, which are associated based on the input paragraph IDs.

TaskListobject

The paragraph object.

Contentstring

The content of the paragraph.

A perpetually sad cat
Idlong

The paragraph ID.

1
TaskIdstring

The task ID, the unique identifier of the task.

e1be065b-adc3-435e-bd01-1c18c5ed75d3
TaskStatusstring

The current status of the task. SUCCESSED: The task was executed successfully. FAILED: The task failed to be executed. CANCELED: The task was canceled. PENDING: The task is in the queue. SUSPENDED: The task is suspended. RUNNING: The task is in progress.

SUCCEEDED
HttpStatusCodeinteger

The HTTP status code.

200
Messagestring

The error description.

successful
RequestIdstring

The unique ID of the request.

F2F366D6-E9FE-1006-BB70-2C650896AAB5
Successboolean

Indicates whether the request is successful. true indicates success and false indicates failure.

true

Examples

Success response JSON format
{
  "Code": "successful",
  "Data": {
    "TaskList": [
      {
        "Content": "一直忧伤的猫",
        "Id": 1,
        "TaskId": "e1be065b-adc3-435e-bd01-1c18c5ed75d3",
        "TaskStatus": "SUCCESDED"
      }
    ]
  },
  "HttpStatusCode": 200,
  "Message": "successful",
  "RequestId": "F2F366D6-E9FE-1006-BB70-2C650896AAB5",
  "Success": true
}

Error codes

See Error Codes for a complete list.