- 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
- Midjourney
- Face Swap
- Dream Machine
- Kling
Create Task
POST
https://api.piapi.ai/api/v1/task
Request
Header Params
x-api-key
string
required
Body Params application/json
model
enum<string>
required
Allowed value:
luma
task_type
enum<string>
required
Allowed values:
video_generationextend_video
input
object
required
prompt
string
required
key_frames
object
optional
type
of the frame can only be set to image
, you can choose to set to frame0 and/or frame1.model_name
enum<string>
optional
Allowed values:
ray-v1ray-v2
duration
enum<integer>
optional
Allowed values:
510
aspect_ratio
enum<string>
optional
Allowed values:
9:163:41:14:316:921:9
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": "luma",
"task_type": "video_generation",
"input": {
"prompt": "Fly fishing",
"key_frames": {
"frame0": {
"type": "laborum ad",
"url": "https://glaring-fishery.com/",
"id": "XFT5J9GBfGDm_iqe4z3oU"
},
"frame1": {
"type": "do ex dolor ea",
"url": "https://hungry-oil.org/"
}
},
"model_name": "ray-v1",
"duration": 5,
"aspect_ratio": "9:16"
},
"config": {
"webhook_config": {
"endpoint": "",
"secret": ""
},
"service_mode": ""
}
}
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": "luma",
"task_type": "video_generation",
"input": {
"prompt": "Fly fishing",
"key_frames": {
"frame0": {
"type": "laborum ad",
"url": "https://glaring-fishery.com/",
"id": "XFT5J9GBfGDm_iqe4z3oU"
},
"frame1": {
"type": "do ex dolor ea",
"url": "https://hungry-oil.org/"
}
},
"model_name": "ray-v1",
"duration": 5,
"aspect_ratio": "9:16"
},
"config": {
"webhook_config": {
"endpoint": "",
"secret": ""
},
"service_mode": ""
}
}'
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": "f7a6d8e5-249f-4a9e-a8f4-1e8af806ea15",
"model": "luma",
"task_type": "video_generation",
"status": "pending",
"config": {
"service_mode": "public",
"webhook_config": {
"endpoint": "",
"secret": ""
}
},
"input": {},
"output": {
"prompt": "",
"internal_state": "",
"created_at": "",
"video": null,
"video_raw": null,
"thumbnail": null,
"last_frame": null
},
"meta": {},
"detail": null,
"logs": null,
"error": {
"code": 0,
"raw_message": "",
"message": "",
"detail": null
}
},
"message": "success"
}
Modified at 2025-03-02 15:32:27