Models API

P-API

0.2.0OAS 3.0

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 16 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
  • Text-to-Video: wan-t2v
  • Image-to-Video: wan-i2v
  • 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.

API Base URL
  • Server 1:https://api.pruna.ai

    Production server

Security
ApiKeyAuth (apiKey)

API key for authentication. You can obtain your API key from the
Pruna AI dashboard.

Include it in the apikey header for all requests.

Additional Information

Predictions

Core prediction workflow operations

Submit a content generation request

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.

post
https://api.pruna.ai/v1/predictions

Headers

Modelstringrequired

The AI model to use for generation. Each model has specific capabilities and input requirements.

Allowed values:flux-devflux-dev-loraflux-2-klein-4bwan-i2vwan-t2vwan-image-smallqwen-imageqwen-image-fastqwen-image-edit-plusvacep-imagep-image-editp-image-lorap-image-edit-loraz-image-turboz-image-turbo-lorap-image-trainerp-image-edit-trainer

Try-Syncboolean

If true, the API will wait up to 60 seconds for the generation to complete.

Default:false

Body

application/json

PredictionRequest

inputobjectrequired

Model-specific input parameters

* Additional properties are allowed.

Response

application/json

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).

One Of
idstringrequired

Unique identifier for the prediction

Example:1zww7deyssrme0csqwr90phzzr

modelstringrequired

Model identifier used for this prediction

Example:vace

inputobjectrequired

The input parameters provided for this prediction

* Additional properties are allowed.
get_urlstring(uri)required

URL to check prediction status

Example:https://api.pruna.ai/v1/predictions/status/1zww7deyssrme0csqwr90phzzr

post/v1/predictions

Body

{ "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 } }
 
application/json