- 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
Image 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
Allowed values:
Qubico/flux1-devQubico/flux1-schnellQubico/flux1-dev-advanced
task_type
enum<string>
required
Allowed values:
img2imgimg2img-loracontrolnet-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
image
string
required
batch_size
number
optional
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
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-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": ""
}
}
}'
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,
"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"
}
Modified at 2025-02-07 07:45:08