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/v4/content/image/createBySourcePrompt
Parameter Value Description x-api-key API Key Your 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. Authorization Bearer {token} Your API Key used for request authorization.Get Token
Body Attributes
Parameter Type Required Description prompt String true Text prompt describing the image to generate model_name String false Model name. Options: wavespeed-ai/flux-krea-dev-lora (text-to-image), wavespeed-ai/flux-kontext-dev (image-to-image). Auto-selected based on source_images if not provided source_images Array false Array of source image URLs for image-to-image transformation. When provided, automatically uses image-to-image model scale String false Aspect ratio. Options: “1:1”, “3:2”, “4:3”, “16:9”, “2:3”, “3:4”, “9:16”, “Original” (image-to-image only). Default: “1:1” resolution String false Output resolution. Options: “1080p”, “4k”. Default: “4k” batch_quantity Integer false Number of images to generate (1-4). Default: 1 similar Number false Similarity strength for image-to-image (0-1). Default: 0.5. Only applicable for image-to-image model negative_prompt String false Negative prompt to exclude certain elements from the generated image webhookurl String false Callback URL for receiving generation results
Response Attributes
Parameter Type Description code Integer Interface returns business status code (1000:success) msg String Interface returns status information data Object Response data object (single object when batch_quantity=1, array when batch_quantity>1) - _id String Document ID - uid Integer User ID - team_id String Team ID - create_time Long Creation timestamp - prompt String The prompt used for generation - origin_prompt String Original prompt text - source_image String Source image URL (for image-to-image) - image_status Integer Status: 1=queueing, 2=processing, 3=completed, 4=failed - image_sub_status Integer Sub-status for detailed tracking - deduction_credit Integer Credits deducted per image - model_name String Model used for generation - provider String Model provider (wavespeed-ai) - type Integer Type identifier (4 = image generation) - from Integer Source identifier (4 = v4 API) - sub_type Integer Sub-type: 40001=text-to-image, 40002=image-to-image - file_name String Generated file name
Supported Models
Model Name Type Description wavespeed-ai/flux-krea-dev-lora Text-to-Image Akool V2 text-to-image model. Generates images from text prompts wavespeed-ai/flux-kontext-dev Image-to-Image Akool V2 image-to-image model. Transforms existing images based on prompts
Example
Text-to-Image Request
{
"model_name" : "wavespeed-ai/flux-krea-dev-lora" ,
"negative_prompt" : "low quality, worst quality, blurry, out of focus" ,
"prompt" : "A majestic mountain landscape at sunset with golden light" ,
"scale" : "16:9" ,
"resolution" : "4k" ,
"batch_quantity" : 1
}
Image-to-Image Request
{
"model_name" : "wavespeed-ai/flux-kontext-dev" ,
"negative_prompt" : "low quality, worst quality, blurry, out of focus" ,
"prompt" : "Transform this into a watercolor painting style" ,
"source_images" : [ "https://example.com/source-image.jpg" ],
"scale" : "1:1" ,
"resolution" : "4k" ,
"similar" : 0.7 ,
"batch_quantity" : 1
}
Request
cURL
Java
Javascript
PHP
Python
curl --location 'https://openapi.akool.com/api/open/v4/content/image/createBySourcePrompt' \
--header 'x-api-key: {{API Key}}' \
--header 'Content-Type: application/json' \
--data '{
"prompt": "A majestic mountain landscape at sunset with golden light",
"scale": "16:9",
"resolution": "4k",
"batch_quantity": 1
}'
OkHttpClient client = new OkHttpClient (). newBuilder ()
. build ();
MediaType mediaType = MediaType . parse ( "application/json" );
RequestBody body = RequestBody . create (mediaType, "{ \n \" prompt \" : \" A majestic mountain landscape at sunset with golden light \" , \n \" scale \" : \" 16:9 \" , \n \" resolution \" : \" 4k \" , \n \" batch_quantity \" : 1 \n }" );
Request request = new Request. Builder ()
. url ( "https://openapi.akool.com/api/open/v4/content/image/createBySourcePrompt" )
. method ( "POST" , body)
. addHeader ( "x-api-key" , "{{API Key}}" )
. addHeader ( "Content-Type" , "application/json" )
. build ();
Response response = client . newCall (request). execute ();
const myHeaders = new Headers ();
myHeaders . append ( "x-api-key" , "{{API Key}}" );
myHeaders . append ( "Content-Type" , "application/json" );
const raw = JSON . stringify ({
"prompt" : "A majestic mountain landscape at sunset with golden light" ,
"scale" : "16:9" ,
"resolution" : "4k" ,
"batch_quantity" : 1
});
const requestOptions = {
method: "POST" ,
headers: myHeaders ,
body: raw ,
redirect: "follow"
};
fetch ( "https://openapi.akool.com/api/open/v4/content/image/createBySourcePrompt" , requestOptions )
. then (( response ) => response . text ())
. then (( result ) => console . log ( result ))
. catch (( error ) => console . error ( error ));
<? php
$client = new Client ();
$headers = [
'x-api-key' => '{{API Key}}' ,
'Content-Type' => 'application/json'
];
$body = '{
"prompt": "A majestic mountain landscape at sunset with golden light",
"scale": "16:9",
"resolution": "4k",
"batch_quantity": 1
}' ;
$request = new Request ( 'POST' , 'https://openapi.akool.com/api/open/v4/content/image/createBySourcePrompt' , $headers , $body );
$res = $client -> sendAsync ( $request ) -> wait ();
echo $res -> getBody ();
?>
import requests
import json
url = "https://openapi.akool.com/api/open/v4/content/image/createBySourcePrompt"
payload = json.dumps({
"prompt" : "A majestic mountain landscape at sunset with golden light" ,
"scale" : "16:9" ,
"resolution" : "4k" ,
"batch_quantity" : 1
})
headers = {
'x-api-key' : ' {{ API Key }} ' ,
'Content-Type' : 'application/json'
}
response = requests.request( "POST" , url, headers = headers, data = payload)
print (response.text)
Response
{
"code" : 1000 ,
"msg" : "OK" ,
"data" : {
"_id" : "6650a1b2c3d4e5f6a7b8c9d0" ,
"uid" : 378337 ,
"team_id" : "team_123456" ,
"create_time" : 1716859314633 ,
"prompt" : "A majestic mountain landscape at sunset with golden light" ,
"origin_prompt" : "A majestic mountain landscape at sunset with golden light" ,
"source_image" : "" ,
"image_status" : 1 ,
"image_sub_status" : 1 ,
"deduction_credit" : 1 ,
"model_name" : "wavespeed-ai/flux-krea-dev-lora" ,
"provider" : "wavespeed-ai" ,
"type" : 4 ,
"from" : 4 ,
"sub_type" : 40001 ,
"file_name" : "ImageGenerator_1716859314633.png"
}
}
Batch Generation Response (batch_quantity > 1)
{
"code" : 1000 ,
"msg" : "OK" ,
"data" : [
{
"_id" : "6650a1b2c3d4e5f6a7b8c9d0" ,
"uid" : 378337 ,
"team_id" : "team_123456" ,
"create_time" : 1716859314633 ,
"prompt" : "A majestic mountain landscape at sunset with golden light" ,
"image_status" : 1 ,
"deduction_credit" : 1 ,
"model_name" : "wavespeed-ai/flux-krea-dev-lora" ,
"type" : 4 ,
"from" : 4 ,
"sub_type" : 40001
},
{
"_id" : "6650a1b2c3d4e5f6a7b8c9d1" ,
"uid" : 378337 ,
"team_id" : "team_123456" ,
"create_time" : 1716859314634 ,
"prompt" : "A majestic mountain landscape at sunset with golden light" ,
"image_status" : 1 ,
"deduction_credit" : 1 ,
"model_name" : "wavespeed-ai/flux-krea-dev-lora" ,
"type" : 4 ,
"from" : 4 ,
"sub_type" : 40001
}
]
}
Important Notes
Model Auto-Selection : If model_name is not provided, the system automatically selects the appropriate model based on whether source_images is provided
Text-to-Image : Use wavespeed-ai/flux-krea-dev-lora or omit model_name and source_images
Image-to-Image : Use wavespeed-ai/flux-kontext-dev or provide source_images (first URL will be used as source)
Batch Generation : Set batch_quantity (1-4) to generate multiple images in one request. Each image deducts credits separately
Resolution : Default is “4k”. Both “1080p” and “4k” cost 1 credit per image
Similar Parameter : Only applicable for image-to-image model. Controls how closely the output matches the source image (0=more creative, 1=more similar)
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
Response Code Description
Please note that if the value of the response code is not equal to 1000, the request has failed or encountered an error.
Code Description 1000 Success 1003 Parameter error or parameter validate error 1101 Invalid authorization or the request token has expired 1102 Authorization cannot be empty 1108 Image generate error, please try again later 1200 The account has been banned