Light Mode
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 (the only model that supports LoRA and controlnet in PiAPI's Flux API. Check Flux with LoRA and Controlnet to learn how to send Flux with LoRA and Controlnet task.
Below is an example of a text-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
string
required
the model name, can be Qubico/flux1-dev
or Qubico/flux1-schnell
or Qubico/flux1-dev-advanced
task_type
enum<string>
required
Allowed value:
txt2img
input
object
required
the input param of the flux task
prompt
string
required
negative_prompt
string
optional
guidance_scale
number
optional
Guidance scale for image generation. High guidance scales improve prompt adherence at the cost of reduced realism.
>= 1.5<= 5
width
integer
optional
can be used in txt2img ONLY, width*height cannot exceed 1048576
height
integer
optional
can be used in txt2img ONLY, width*height cannot exceed 1048576
lora_settings
array [object {1}]
optional
control_net_settings
array [object {2}]
optional
Example
{
"model": "Qubico/flux1-dev",
"task_type": "txt2img",
"input": {
"prompt": "a little cat",
"width": 1024,
"height": 1024
}
}
Request samples
Responses
Success(200)
HTTP Code: 200
Content Type : JSONapplication/json
Data Schema
object {0}
Example
{
"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": ""
}
}
}
Last modified: 18 days ago