Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.akool.com/llms.txt

Use this file to discover all available pages before exploring further.

The resources (image, video, voice) generated by our API are valid for 7 days. Please save the relevant resources as soon as possible to prevent expiration.

Endpoint

POST https://openapi.akool.com/api/open/v3/content/image/createbyprompt

Request Headers

ParameterValueDescription
x-api-keyAPI KeyYour API Key used for request authorization. If both Authorization and x-api-key have values, Authorization will be used first and x-api-key will be discarded.
AuthorizationBearer {token}Your API Key used for request authorization.Get Token

Body Attributes

ParameterTypeRequiredDescription
promptStringtrueDescribe the information needed to generate the image
scaleStringfalseThe size of the generated image. Options: “1:1”, “4:3”, “3:4”, “16:9”, “9:16”, “3:2”, “2:3”. Default: “1:1”
source_imageStringfalseOriginal image URL for image-to-image transformation. Pass this parameter to perform image-to-image operation
webhookUrlStringfalseCallback URL address based on HTTP request

Response Attributes

ParameterTypeDescription
codeIntegerInterface returns business status code (1000:success)
msgStringInterface returns status information
dataObjectResponse data object
- _idStringDocument ID
- uidIntegerUser ID
- create_timeLongCreation timestamp
- promptStringProcessed prompt text
- origin_promptStringOriginal prompt text
- source_imageStringSource image URL (if provided)
- image_statusIntegerStatus: 1=queueing, 2=processing, 3=completed, 4=failed
- deduction_creditIntegerCredits deducted
- typeIntegerType identifier
- fromIntegerSource identifier
- buttonsArrayAvailable operation buttons
- used_buttonsArrayAlready used buttons
- upscaled_urlsArrayUpscaled image URLs

Example

Request Body

{
  "prompt": "Sun Wukong is surrounded by heavenly soldiers and generals",
  "scale": "1:1",
  "source_image": "https://drz0f01yeq1cx.cloudfront.net/1708333063911-9cbe39b7-3c5f-4a35-894c-359a6cbb76c3-3283.png",
  "webhookUrl": ""
}

Request

curl --location 'https://openapi.akool.com/api/open/v3/content/image/createbyprompt' \
--header 'x-api-key: {{API Key}}' \
--header 'Content-Type: application/json' \
--data '{
  "prompt": "Sun Wukong is surrounded by heavenly soldiers and generals",
  "scale": "1:1",
  "source_image": "https://drz0f01yeq1cx.cloudfront.net/1708333063911-9cbe39b7-3c5f-4a35-894c-359a6cbb76c3-3283.png",
  "webhookUrl": ""
}'

Response

{
  "code": 1000,
  "msg": "OK",
  "data": {
    "faceswap_quality": 2,
    "deduction_credit": 2,
    "buttons": [],
    "used_buttons": [],
    "upscaled_urls": [],
    "_id": "64dd82eef0b6684651e90131",
    "uid": 378337,
    "create_time": 1692238574633,
    "origin_prompt": "***",
    "source_image": "https://***.cloudfront.net/1702436829534-4a813e6c-303e-48c7-8a4e-b915ae408b78-5034.png",
    "prompt": "***** was a revolutionary leader who transformed *** into a powerful communist state.",
    "type": 4,
    "from": 1,
    "image_status": 1
  }
}

Important Notes

  • Text to Image: Simply provide a prompt without source_image to generate an image from scratch
  • Image to Image: Provide both prompt and source_image to transform an existing image based on the prompt
  • Aspect Ratio: Choose the appropriate scale for your use case (default is “1:1”)
  • Resource Expiration: Generated images are valid for 7 days, save them promptly
  • Webhook: Use webhookUrl to receive notifications when image generation is complete
  • Save the _id from the response to check image status using the Get Image Result API