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
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
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
Check Flux with LoRA and Controlnet
control_net_settings
array [object {2}]
optional
Check Flux with LoRA and Controlnet
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
code
integer
required
message
string
required
data
object
required
task_id
string
required
model
string
required
task_type
string
required
status
string
required
pending/processing/failed/completed
input
object
required
output
object
required
meta
object
required
logs
array[string]
required
error
object
required
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": ""
}
}
}
Modified at 9 days ago