Text 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 a text-to-image request and response.
Request
Your API KEY used for request authorization
the model name, can be Qubico/flux1-dev
or Qubico/flux1-schnell
or Qubico/flux1-dev-advanced
the input param of the flux task
Guidance scale for image generation. High guidance scales improve prompt adherence at the cost of reduced realism.
can be used in txt2img ONLY, width*height cannot exceed 1048576
can be used in txt2img ONLY, width*height cannot exceed 1048576
number of images, only works for schnell at the moment. Price will be
batch_size * (price for one generation)
Webhook provides timely task notifications. Check PiAPI webhook for detail.
This allows users to choose whether this specific task will get processed under PAYG or HYA mode. If unspecified, then this task will get processed under whatever mode (PAYG or HYA)
the user chose on the workspace setting of your account.
public
means this task will be processed under PAYG mode.private
means this task will be processed under HYA mode.
{
"model": "Qubico/flux1-dev",
"task_type": "txt2img",
"input": {
"prompt": "a little cat",
"width": 1024,
"height": 1024
}
}
Request samples
Responses
Hover on the "Completed" option and you coult see the explaintion of all status: completed/processing/pending/failed/staged
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.
{
"code": 200,
"message": "success",
"data": {
"task_id": "0f647527-12bd-48b1-b813-111111111",
"model": "Qubico/flux1-dev",
"task_type": "txt2img",
"status": "", // pending/processing/failed/completed
"input": {},
"output": {},
"meta": {
},
"logs": [],
"error": {
"code": 1100,
"message": ""
}
}
}