OpenAPI Specification
openapi: 3.0.3
info:
title: P Content Delivery Predictions API
description: 'P-API provides access to multiple AI models for image generation,
video generation, and image-to-video transformation. The API supports both asynchronous
and synchronous workflows:
**Asynchronous Workflow (default):**
1. **POST /v1/predictions** - Submit a generation request
2. **GET /v1/predictions/status/{id}** - Check prediction status and get results
3. **GET /v1/predictions/delivery/{path}** - Download the generated content
**Synchronous Workflow (with Try-Sync header):**
1. **POST /v1/predictions** with `Try-Sync: true` header - Submit a generation
request and wait up to 60 seconds for completion.
The API exposes 20 AI models across different categories:
- **Text-to-Image**: p-image, p-image-lora, flux-dev, flux-2-klein-4b, wan-image-small, qwen-image, qwen-image-fast, z-image-turbo, z-image-turbo-lora
- **Image Editing**: p-image-edit, p-image-edit-lora, qwen-image-edit-plus, flux-dev-lora
- **Image Upscaling**: p-image-upscale
- **Virtual Try-On**: p-image-try-on
- **Text-to-Video**: wan-t2v
- **Image-to-Video**: wan-i2v
- **Text-to-Video/Image-to-Video**: p-video
- **Avatar Video Generation**: p-video-avatar
- **Video Animation**: p-video-animate
- **Video Replacement**: p-video-replace
- **Video Generation/Editing**: vace
**LoRA Trainers:**
- **p-image-trainer**: Train custom LoRA models for p-image
- **p-image-edit-trainer**: Train custom LoRA models for p-image-edit
Trainers have a lower rate limit (5 requests/minute) and return training job status.
For detailed model documentation, see: https://docs.api.pruna.ai/guides/models
All requests require API key authentication via the `apikey` header.
'
version: 0.5.3
contact:
name: Pruna AI Support
email: support@pruna.ai
servers:
- url: https://api.pruna.ai
description: Production server
security:
- ApiKeyAuth: []
tags:
- name: Predictions
description: Core prediction workflow operations
paths:
/v1/predictions:
post:
summary: Submit a content generation request
description: 'Submit a request to generate images or videos using one of the
available AI models. This is the first step in the workflow.
The request will be queued for processing and you''ll receive a prediction
ID to track its status.
The model to use is specified via the `Model` header. The request body structure
varies by model (see examples below).
If the `Try-Sync` header is set to true, the API will wait up to 60 seconds
for completion. If generation completes within this time, the response will
include the final result directly.
'
operationId: createPrediction
x-microcks-operation:
dispatcher: HEADER
dispatcherRules: Model
tags:
- Predictions
security:
- ApiKeyAuth: []
parameters:
- name: Model
in: header
required: true
description: The AI model to use for generation. Each model has specific capabilities and input requirements.
schema:
type: string
enum:
- flux-dev
- flux-dev-lora
- flux-2-klein-4b
- wan-i2v
- wan-t2v
- wan-image-small
- qwen-image
- qwen-image-fast
- qwen-image-edit-plus
- vace
- p-image
- p-image-edit
- p-image-lora
- p-image-edit-lora
- z-image-turbo
- z-image-turbo-lora
- p-video
- p-video-animate
- p-video-replace
- p-video-avatar
- p-image-upscale
- p-image-try-on
- p-image-trainer
- p-image-edit-trainer
- name: Try-Sync
in: header
required: false
description: If true, the API will wait up to 60 seconds for the generation to complete.
schema:
type: boolean
default: false
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PredictionRequest'
examples:
flux-dev:
summary: flux-dev
description: Advanced text-to-image generation using Flux.1-dev base model.
value:
input:
prompt: A beautiful landscape with mountains and a lake at sunset
speed_mode: Juiced 🔥 (default)
num_inference_steps: 28
guidance: 3.5
seed: 42
aspect_ratio: '16:9'
image_size: 1024
output_format: jpg
output_quality: 80
flux-dev-lora:
summary: flux-dev-lora
description: Text-to-image and image-to-image generation with Flux.1-dev supporting custom LoRA weights.
value:
input:
lora: prithivMLmods/Flux-Long-Toon-LoRA
seed: 42
prompt: Long toons, a close-up of a cartoon character with a red backdrop
guidance: 3
lora_scale: 1
megapixels: '1'
speed_mode: Extra Juiced 🔥
num_outputs: 1
aspect_ratio: '1:1'
output_format: jpg
output_quality: 80
prompt_strength: 0.8
extra_lora_scale: 1
num_inference_steps: 28
wan-i2v:
summary: wan-i2v
description: Transform static images into animated videos with text prompts.
value:
input:
image: https://api.pruna.ai/v1/files/abc123xyz789
prompt: Close-up shot of an elderly sailor wearing a yellow raincoat
num_frames: 81
resolution: 720p
sample_shift: 12
frames_per_second: 16
interpolate_output: true
lora_scale_transformer: 1
lora_scale_transformer_2: 1
wan-t2v:
summary: wan-t2v
description: Generate videos directly from text prompts.
value:
input:
prompt: A sports car is driving very fast along a beach at sunset
num_frames: 81
resolution: 480p
aspect_ratio: '16:9'
sample_shift: 12
optimize_prompt: false
frames_per_second: 16
interpolate_output: true
lora_scale_transformer: 1
lora_scale_transformer_2: 1
wan-image-small:
summary: wan-image-small
description: Fast image generation optimized for speed.
value:
input:
prompt: a cute cat sitting on a windowsill, soft lighting, cozy atmosphere
juiced: false
aspect_ratio: '16:9'
seed: 42
output_format: jpg
output_quality: 80
qwen-image:
summary: qwen-image
description: High-quality text-to-image generation with optional LoRA weights.
value:
input:
prompt: Beautiful mountain landscape with a crystal clear lake reflecting the peaks
enhance_prompt: false
aspect_ratio: '16:9'
image_size: optimize_for_quality
go_fast: true
num_inference_steps: 30
guidance: 3
seed: 42
output_format: webp
output_quality: 80
negative_prompt: ' '
disable_safety_checker: false
qwen-image-edit-plus:
summary: qwen-image-edit-plus
description: Edit images using text instructions.
value:
input:
prompt: Change the background to a beach sunset scene
image:
- https://api.pruna.ai/v1/files/abc123xyz789
aspect_ratio: '16:9'
go_fast: true
seed: 42
output_format: webp
output_quality: 95
disable_safety_checker: false
vace:
summary: vace
description: Advanced video generation and editing with character reference images.
value:
input:
seed: -1
size: 832*480
prompt: A yellow car driving down a scenic mountain road at sunset
frame_num: 81
speed_mode: Extra Juiced 🚀 (even more speed)
src_ref_images:
- https://api.pruna.ai/pbxt/N323t5X69JB1MPD4w4cDIxK4rm0BG0W2JOWBrDrR4O9HTcyp/src_ref_image_1.png
src_video: https://api.pruna.ai/pbxt/N323u1ljtNYyyaLrgw0ZLmXgepvWlBvxbJWi3sAa2VDPuNus/src_video.mp4
sample_shift: 16
sample_steps: 50
sample_solver: unipc
sample_guide_scale: 5
p-image:
summary: p-image
description: Ultra-fast text-to-image generation with automatic prompt enhancement.
value:
input:
prompt: A majestic lion standing on a rocky cliff at sunset
aspect_ratio: '16:9'
seed: 42
disable_safety_checker: false
p-image-edit:
summary: p-image-edit
description: Edit and compose multiple images with text instructions.
value:
input:
prompt: Transform the subject into a watercolor painting style
images:
- https://api.pruna.ai/v1/files/abc123xyz789
- https://api.pruna.ai/v1/files/def456uvw012
aspect_ratio: '1:1'
seed: 123
disable_safety_checker: false
flux-2-klein-4b:
summary: flux-2-klein-4b
description: Lightweight and fast text-to-image generation using Flux Klein 4B.
value:
input:
prompt: A serene mountain landscape at dawn with mist rolling through the valleys
aspect_ratio: '16:9'
seed: 42
output_format: jpg
output_quality: 80
p-image-lora:
summary: p-image-lora
description: Text-to-image generation with custom LoRA weights from HuggingFace.
value:
input:
prompt: A portrait in my custom artistic style
lora_weights: huggingface.co/your-username/your-lora-repo
lora_scale: 1
aspect_ratio: '1:1'
seed: 42
p-image-edit-lora:
summary: p-image-edit-lora
description: Image editing with custom LoRA weights from HuggingFace.
value:
input:
prompt: Apply my custom transformation to image 1
images:
- https://api.pruna.ai/v1/files/abc123xyz789
lora_weights: huggingface.co/your-username/your-edit-lora
lora_scale: 1
p-image-trainer:
summary: p-image-trainer
description: Train custom LoRA weights for text-to-image generation.
value:
input:
image_data: https://your-storage.com/training_data.zip
steps: 1000
training_type: balanced
p-image-edit-trainer:
summary: p-image-edit-trainer
description: Train custom LoRA weights for image editing transformations.
value:
input:
image_data: https://your-storage.com/edit_pairs.zip
steps: 1000
default_caption: apply the trained transformation
qwen-image-fast:
summary: qwen-image-fast
description: Fast text-to-image generation optimized for speed.
value:
input:
prompt: A serene Japanese garden with cherry blossoms and a traditional wooden bridge
aspect_ratio: '16:9'
creativity: 0.62
seed: 42
z-image-turbo:
summary: z-image-turbo
description: Ultra-fast text-to-image generation with Z-Image Turbo.
value:
input:
prompt: Sunset over mountain landscape, vibrant colors, dramatic clouds
width: 1024
height: 1024
num_inference_steps: 8
output_format: jpg
seed: 42
z-image-turbo-lora:
summary: z-image-turbo-lora
description: Ultra-fast text-to-image generation with LoRA support for custom styles.
value:
input:
prompt: Portrait of a warrior in epic fantasy armor
width: 1024
height: 1024
seed: 42
p-video:
summary: p-video
description: Text-to-video and image-to-video generation with audio support.
value:
input:
prompt: A cinematic drone shot flying over a misty forest at sunrise
duration: 5
resolution: 720p
aspect_ratio: '16:9'
seed: 42
p-video-animate:
summary: p-video-animate
description: Animate a reference subject using motion from a source video.
value:
input:
video: https://api.pruna.ai/v1/files/source-video-abc123
image: https://api.pruna.ai/v1/files/reference-image-def456
resolution: 720p
target_fps: original
instruction_prompt: Animate the reference subject using the motion from the source video.
p-video-replace:
summary: p-video-replace
description: Replace people in a source video using identity reference images.
value:
input:
video: https://api.pruna.ai/v1/files/source-video-abc123
images:
- https://api.pruna.ai/v1/files/reference-image-def456
resolution: 720p
target_fps: original
instruction_prompt: Place the reference person into the video while preserving the original motion.
p-video-avatar:
summary: p-video-avatar
description: Talking head video avatar from a portrait image with voice script or audio.
value:
input:
image: https://api.pruna.ai/v1/files/abc123xyz789
voice_script: Hello, welcome to our product demo!
voice: Zephyr (Female)
voice_language: English (US)
resolution: 720p
p-image-upscale:
summary: p-image-upscale
description: AI-powered image upscaling with detail and realism enhancement.
value:
input:
image: https://api.pruna.ai/v1/files/abc123xyz789
target: 4
output_format: jpg
output_quality: 80
enhance_realism: true
p-image-try-on:
summary: p-image-try-on
description: Virtual try-on that fits one or more garment images onto a person image.
value:
input:
person_image: https://api.pruna.ai/v1/files/person-abc123
garment_images:
- https://api.pruna.ai/v1/files/garment-def456
output_format: jpg
output_quality: 95
preserve_input_size: true
responses:
'201':
description: Prediction request created successfully. Returns either an async response with prediction ID (default) or a sync response with final results (if Try-Sync=true and generation completes within 60 seconds).
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/PredictionResponse'
- type: object
properties:
status:
type: string
enum:
- succeeded
description: Generation completed successfully
generation_url:
type: string
description: URL to download the generated content
examples:
flux-dev:
summary: flux-dev response
value:
id: pred_fluxdev_001
model: flux-dev
input:
prompt: A beautiful landscape with mountains and a lake at sunset
speed_mode: Juiced 🔥 (default)
num_inference_steps: 28
guidance: 3.5
seed: 42
get_url: https://api.pruna.ai/v1/predictions/status/pred_fluxdev_001
flux-dev-lora:
summary: flux-dev-lora response
value:
id: pred_fluxdevlora_001
model: flux-dev-lora
input:
prompt: Long toons, a close-up of a cartoon character
lora: prithivMLmods/Flux-Long-Toon-LoRA
num_inference_steps: 28
guidance: 3
seed: 42
get_url: https://api.pruna.ai/v1/predictions/status/pred_fluxdevlora_001
wan-i2v:
summary: wan-i2v response
value:
id: pred_wani2v_001
model: wan-i2v
input:
prompt: Close-up shot of an elderly sailor wearing a yellow raincoat
image: https://api.pruna.ai/v1/files/abc123xyz789
num_frames: 81
resolution: 480p
get_url: https://api.pruna.ai/v1/predictions/status/pred_wani2v_001
wan-t2v:
summary: wan-t2v response
value:
id: pred_want2v_001
model: wan-t2v
input:
prompt: A sports car driving along a beach at sunset
num_frames: 81
resolution: 480p
aspect_ratio: '16:9'
get_url: https://api.pruna.ai/v1/predictions/status/pred_want2v_001
wan-image-small:
summary: wan-image-small response
value:
id: pred_wanimagesmall_001
model: wan-image-small
input:
prompt: A cute cat sitting on a windowsill
aspect_ratio: '16:9'
seed: 42
get_url: https://api.pruna.ai/v1/predictions/status/pred_wanimagesmall_001
qwen-image:
summary: qwen-image response
value:
id: pred_qwenimage_001
model: qwen-image
input:
prompt: Beautiful mountain landscape with a crystal clear lake
num_inference_steps: 30
guidance: 3
seed: 42
get_url: https://api.pruna.ai/v1/predictions/status/pred_qwenimage_001
qwen-image-edit-plus:
summary: qwen-image-edit-plus response
value:
id: pred_qwenimageeditplus_001
model: qwen-image-edit-plus
input:
prompt: Change the background to a beach sunset scene
image:
- https://api.pruna.ai/v1/files/abc123xyz789
seed: 42
get_url: https://api.pruna.ai/v1/predictions/status/pred_qwenimageeditplus_001
vace:
summary: vace response
value:
id: pred_vace_001
model: vace
input:
prompt: A yellow car driving down a scenic mountain road
frame_num: 81
sample_guide_scale: 5
sample_shift: 16
sample_solver: unipc
sample_steps: 50
seed: -1
size: 832*480
speed_mode: Extra Juiced 🚀 (even more speed)
src_ref_images:
- https://api.pruna.ai/pbxt/N323t5X69JB1MPD4w4cDIxK4rm0BG0W2JOWBrDrR4O9HTcyp/src_ref_image_1.png
src_video: https://api.pruna.ai/pbxt/N323u1ljtNYyyaLrgw0ZLmXgepvWlBvxbJWi3sAa2VDPuNus/src_video.mp4
get_url: https://api.pruna.ai/v1/predictions/status/pred_vace_001
p-image:
summary: p-image response
value:
id: pred_pimage_001
model: p-image
input:
prompt: A majestic lion standing on a rocky cliff at sunset
aspect_ratio: '16:9'
seed: 42
get_url: https://api.pruna.ai/v1/predictions/status/pred_pimage_001
p-image-edit:
summary: p-image-edit response
value:
id: pred_pimageedit_001
model: p-image-edit
input:
prompt: Transform the subject into a watercolor painting style
images:
- https://api.pruna.ai/v1/files/abc123xyz789
aspect_ratio: '1:1'
seed: 123
get_url: https://api.pruna.ai/v1/predictions/status/pred_pimageedit_001
flux-2-klein-4b:
summary: flux-2-klein-4b response
value:
id: pred_flux2klein4b_001
model: flux-2-klein-4b
input:
prompt: A serene mountain landscape at dawn with mist rolling through the valleys
aspect_ratio: '16:9'
seed: 42
output_format: jpg
output_quality: 80
get_url: https://api.pruna.ai/v1/predictions/status/pred_flux2klein4b_001
p-image-lora:
summary: p-image-lora response
value:
id: pred_pimagelora_001
model: p-image-lora
input:
prompt: A portrait in my custom artistic style
lora_weights: huggingface.co/your-username/your-lora-repo
lora_scale: 1
aspect_ratio: '1:1'
seed: 42
get_url: https://api.pruna.ai/v1/predictions/status/pred_pimagelora_001
p-image-edit-lora:
summary: p-image-edit-lora response
value:
id: pred_pimageeditlora_001
model: p-image-edit-lora
input:
prompt: Apply my custom transformation to image 1
images:
- https://api.pruna.ai/v1/files/abc123xyz789
lora_weights: huggingface.co/your-username/your-edit-lora
lora_scale: 1
get_url: https://api.pruna.ai/v1/predictions/status/pred_pimageeditlora_001
p-image-trainer:
summary: p-image-trainer response
value:
id: pred_pimagetrainer_001
model: p-image-trainer
input:
image_data: https://your-storage.com/training_data.zip
steps: 1000
training_type: balanced
get_url: https://api.pruna.ai/v1/predictions/status/pred_pimagetrainer_001
p-image-edit-trainer:
summary: p-image-edit-trainer response
value:
id: pred_pimageedittrainer_001
model: p-image-edit-trainer
input:
image_data: https://your-storage.com/edit_pairs.zip
steps: 1000
default_caption: apply the trained transformation
get_url: https://api.pruna.ai/v1/predictions/status/pred_pimageedittrainer_001
qwen-image-fast:
summary: qwen-image-fast response
value:
id: pred_qwenimagefast_001
model: qwen-image-fast
input:
prompt: A serene Japanese garden with cherry blossoms and a traditional wooden bridge
aspect_ratio: '16:9'
creativity: 0.62
seed: 42
get_url: https://api.pruna.ai/v1/predictions/status/pred_qwenimagefast_001
z-image-turbo:
summary: z-image-turbo response
value:
id: pred_zimageturbo_001
model: z-image-turbo
input:
prompt: Sunset over mountain landscape, vibrant colors, dramatic clouds
width: 1024
height: 1024
num_inference_steps: 8
output_format: jpg
seed: 42
get_url: https://api.pruna.ai/v1/predictions/status/pred_zimageturbo_001
z-image-turbo-lora:
summary: z-image-turbo-lora response
value:
id: pred_zimageturbolora_001
model: z-image-turbo-lora
input:
prompt: Portrait of a warrior in epic fantasy armor
width: 1024
height: 1024
seed: 42
get_url: https://api.pruna.ai/v1/predictions/status/pred_zimageturbolora_001
p-video:
summary: p-video response
value:
id: 7xk3m29nw1rpv0dqq8tvbfrzc4
model: p-video
input:
prompt: A cinematic drone shot flying over a misty forest at sunrise
duration: 5
resolution: 720p
aspect_ratio: '16:9'
seed: 42
get_url: https://api.pruna.ai/v1/predictions/status/7xk3m29nw1rpv0dqq8tvbfrzc4
p-video-animate:
summary: p-video-animate response
value:
id: pred_pvideoanimate_001
model: p-video-animate
input:
video: https://api.pruna.ai/v1/files/source-video-abc123
image: https://api.pruna.ai/v1/files/reference-image-def456
resolution: 720p
target_fps: original
get_url: https://api.pruna.ai/v1/predictions/status/pred_pvideoanimate_001
p-video-replace:
summary: p-video-replace response
value:
id: pred_pvideoreplace_001
model: p-video-replace
input:
video: https://api.pruna.ai/v1/files/source-video-abc123
images:
- https://api.pruna.ai/v1/files/reference-image-def456
resolution: 720p
target_fps: original
get_url: https://api.pruna.ai/v1/predictions/status/pred_pvideoreplace_001
p-video-avatar:
summary: p-video-avatar response
value:
id: pred_pvideoavatar_001
model: p-video-avatar
input:
image: https://api.pruna.ai/v1/files/abc123xyz789
voice_script: Hello, welcome to our product demo!
voice: Zephyr (Female)
voice_language: English (US)
resolution: 720p
get_url: https://api.pruna.ai/v1/predictions/status/pred_pvideoavatar_001
p-image-upscale:
summary: p-image-upscale response
value:
id: pred_pimageupscale_001
model: p-image-upscale
input:
image: https://api.pruna.ai/v1/files/abc123xyz789
target: 4
output_format: jpg
enhance_realism: true
get_url: https://api.pruna.ai/v1/predictions/status/pred_pimageupscale_001
p-image-try-on:
summary: p-image-try-on response
value:
id: pred_pimagetryon_001
model: p-image-try-on
input:
person_image: https://api.pruna.ai/v1/files/person-abc123
garment_images:
- https://api.pruna.ai/v1/files/garment-def456
output_format: jpg
get_url: https://api.pruna.ai/v1/predictions/status/pred_pimagetryon_001
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'422':
$ref: '#/components/responses/ValidationError'
'500':
$ref: '#/components/responses/InternalServerError'
/v1/predictions/status/{id}:
get:
summary: Get prediction status
description: 'Check the status of a prediction request. This is the second step
in the asynchronous workflow.
When the prediction is completed successfully, the response will include download
URLs for the generated content (images or videos).
Rate limit: 30,000 requests per minute.
'
operationId: getPredictionStatus
tags:
- Predictions
security:
- ApiKeyAuth: []
parameters:
- name: id
in: path
required: true
description: The prediction ID returned from the initial request
schema:
type: string
example: 1knpbkf075rme0csjqr987hg4w
responses:
'200':
description: Prediction status retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/PredictionStatusResponse'
examples:
processing:
summary: Prediction in progress
valu
# --- truncated at 32 KB (40 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/pruna-ai/refs/heads/main/openapi/pruna-ai-predictions-api-openapi.yml