- Get Started
- Endpoints
- Flux
- AI Hug
- LLM
- Midjourney
- Faceswap
- TTS
- Song(Suno+Udio)
- Trellis
- Luma Dream Machine
- Kling
- Hailuo
- Skyreels
- WanX
- Hunyuan Video
- PiAPI Account Management
- Mmaudio
- DiffRhythm
- Tools
- Resources
- Legacy Documentation
Text to Image
POST
https://api.piapi.ai/api/v1/task
FLUX
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.
Request
Header Params
X-API-Key
string
required
Body Params application/json
model
enum<string>
required
Qubico/flux1-dev
or Qubico/flux1-schnell
or Qubico/flux1-dev-advanced
Allowed values:
Qubico/flux1-schnellQubico/flux1-devQubico/flux1-dev-advanced
task_type
enum<string>
required
Allowed values:
txt2imgimg2imgtxt2img-loraimg2img-lorafill-inpaintfill-outpaintredux-variationcontrolnet-lora
input
object
required
prompt
string
required
negative_prompt
string
optional
denoise
number
optional
<= 1> 0
Default:
0.7
guidance_scale
number
optional
>= 1.5<= 5
width
integer
optional
height
integer
optional
batch_size
number
optional
batch_size * (price for one generation)
>= 1<= 4
Default:
1
lora_settings
array [object {2}]
optional
control_net_settings
array [object {2}]
optional
config
object
optional
webhook_config
object
optional
service_mode
enum<string>
optional
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.Allowed values:
publicprivate
Example
{
"model": "Qubico/flux1-dev",
"task_type": "txt2img",
"input": {
"prompt": "a little cat",
"width": 1024,
"height": 1024
}
}
Request samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.piapi.ai/api/v1/task' \
--header 'X-API-Key;' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "Qubico/flux1-dev",
"task_type": "txt2img",
"input": {
"prompt": "a little cat",
"width": 1024,
"height": 1024
}
}'
Responses
🟢200Success
application/json
Body
code
integer
required
data
object
required
task_id
string
required
model
string
required
task_type
string
required
status
enum<string>
required
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
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 2025-02-07 07:44:40