Light Mode
Image to Image
POST
/api/v1/taskThis is provided as part of the Flux API from PiAPI. available models:
- Qubico/flux1-dev
- Qubico/flux1-schnell
- Qubico/flux1-dev-advanced
Check Flux with LoRA and Controlnet to learn how to send Flux with LoRA and Controlnet task.
Check Flux with Redux and Fill to learn how to send Flux with variation, inpaint and out paint task.
Below is an example of image-to-image request and response.
Request
Header Params
X-API-Key
string
required
Your API KEY used for request authorization
Body Params application/json
model
enum<string>
required
the model name
Allowed values:
Qubico/flux1-devQubico/flux1-schnellQubico/flux1-dev-advanced
task_type
enum<string>
required
Allowed values:
img2imgimg2img-loracontrolnet-lora
input
object
required
the input param of the flux task
prompt
string
required
negative_prompt
string
optional
denoise
number
optional
<= 1> 0
Default:
0.7
guidance_scale
number
optional
Guidance scale for image generation. High guidance scales improve prompt adherence at the cost of reduced realism.
>= 1.5<= 5
image
string
required
batch_size
number
optional
number of images, only works for schnell at the moment. Price will be
batch_size * (price for one generation)
>= 1<= 4
Default:
1
lora_settings
array [object {3}]
optional
control_net_settings
array[object (control_net_setting) {2}]
required
config
object
optional
webhook_config
object
optional
Example
{
"model": "Qubico/flux1-schnell",
"task_type": "img2img",
"input": {
"prompt": "a bear",
"image": "https://i.ibb.co/J7ZNgSG/01.jpg"
},
"config": {
"webhook_config": {
"endpoint": "https://webhook.site/xxxx",
"secret": ""
}
}
}
Request samples
Responses
Success(200)
HTTP Code: 200
Content Type : JSONapplication/json
Data Schema
code
integer
required
data
object
required
task_id
string
required
model
string
required
task_type
string
required
status
enum<string>
required
Hover on the "Completed" option and you coult see the explaintion of all status: completed/processing/pending/failed/staged
Allowed values:
CompletedProcessingPendingFailedStaged
input
object
required
output
object
required
meta
object
required
detail
null
required
logs
array [object]
required
error
object
required
message
string
required
If you get non-null error message, here are some steps you chould follow:
- Check our common error message
- Retry for several times
- If you have retried for more than 3 times and still not work, file a ticket on Discord and our support will be with you soon.
Example
{
"code": 200,
"data": {
"task_id": "1631d053-2352-4add-95cc-360fc52d5f89",
"model": "Qubico/flux1-schnell",
"task_type": "img2img",
"status": "pending",
"config": {
"webhook_config": {
"endpoint": "https://webhook.site/xxxx",
"secret": ""
}
},
"input": {
"prompt": "a bear",
"negative_prompt": "",
"image": "https://i.ibb.co/J7ZNgSG/01.jpg",
"width": 0,
"height": 0,
"steps": 0
},
"output": null,
"meta": {
"created_at": "2024-09-25T07:40:08.333962391Z",
"started_at": "0001-01-01T00:00:00Z",
"ended_at": "0001-01-01T00:00:00Z",
"usage": {
"type": "quota",
"frozen": 0,
"consume": 20000
},
"is_using_private_pool": false
},
"detail": null,
"logs": [],
"error": {
"code": 0,
"raw_message": "",
"message": "",
"detail": null
}
},
"message": "success"
}
Last modified: 8 hours ago