- Get Started
- Endpoints
- Song(Udio)
- Kling
- Hailuo
- Flux
- AI Hug
- LLM
- Midjourney
- Faceswap
- TTS
- Trellis
- Luma Dream Machine
- WanX
- Skyreels
- Framepack
- Hunyuan Video
- Mmaudio
- DiffRhythm
- Ace Step
- Tools
- PiAPI Account Management
- Resources
- Legacy Documentation
Kontext
POST
https://api.piapi.ai/api/v1/task
FLUX
Available models:
Request
Header Params
X-API-Key
string
required
Body Params application/json
model
enum<string>
required
Allowed value:
Qubico/flux1-dev-advanced
task_type
enum<string>
required
Allowed value:
kontext
input
object
required
prompt
string
required
image
string
required
width
integer
optional
height
integer
optional
Default:
1024
seed
integer
optional
Default:
-1
steps
integer
optional
<= 40
Default:
28
config
object
optional
webhook_config
object
optional
Example
{
"model": "Qubico/flux1-dev-advanced",
"task_type": "kontext",
"input": {
"prompt": "change the word Piapi to Pineapple",
"image": "https://piapi.ai/dashboard/flux/input_example.png",
"width": 1024,
"height": 1024,
"steps": 10,
"seed": -1
},
"config": {
"webhook_config": {
"endpoint": "https://webhook.site/ffa17066-be55-4a1a-abf9-789286b8da44",
"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-dev-advanced",
"task_type": "kontext",
"input": {
"prompt": "change the word Piapi to Pineapple",
"image": "https://piapi.ai/dashboard/flux/input_example.png",
"width": 1024,
"height": 1024,
"steps": 10,
"seed": -1
},
"config": {
"webhook_config": {
"endpoint": "https://webhook.site/ffa17066-be55-4a1a-abf9-789286b8da44",
"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": "8718d5c1-aae9-4cd5-a243-84eeb1e01117",
"model": "Qubico/flux1-dev-advanced",
"task_type": "kontext",
"status": "completed",
"config": {
"service_mode": "",
"webhook_config": {
"endpoint": "https://webhook.site/ffa17066-be55-4a1a-abf9-789286b8da44",
"secret": ""
}
},
"input": {
"height": 1024,
"image": "https://piapi.ai/dashboard/flux/input_example.png",
"prompt": "change the word Piapi to Pineapple",
"seed": -1,
"steps": 10,
"width": 1024
},
"output": {
"image_base64": "",
"image_url": "https://img.theapi.app/temp/10f0a646-6155-4938-bf50-76934c953e9c.png"
},
"meta": {
"created_at": "2025-06-30T07:11:30.719851187Z",
"started_at": "2025-06-30T07:11:31.891665902Z",
"ended_at": "2025-06-30T07:12:03.388312371Z",
"usage": {
"type": "llm",
"frozen": 0,
"consume": 200000
},
"is_using_private_pool": false
},
"detail": null,
"logs": [],
"error": {
"code": 0,
"raw_message": "",
"message": "",
"detail": null
}
},
"message": "success"
}
Modified at 2025-06-30 08:00:25