Pruna P Video 2 Pro Reference API
Keep characters and products consistent in reference-to-video, with audio.
POST /v2/p-video-2-pro-reference · submit + poll 1# pip install "segmind>=1.1.0"
2# export SEGMIND_API_KEY="YOUR_API_KEY"
3from segmind import SegmindClient, InferenceFailed, InferenceTimeout
4
5# Async (v2) — recommended for long-running / video models.
6# run() blocks up to 600s; submit_async + job.wait(timeout=...) sets a longer
7# deadline and keeps the request_id so you can re-poll later.
8client = SegmindClient() # reads SEGMIND_API_KEY
9payload = {
10 "prompt": "The cellist from the reference image draws his bow across the strings, swaying into the phrase with his eyes closed, then opens them to the camera. Sound: a resonant cello and the faint creak of the chair.",
11 "image": ["https://segmind-resources.s3.amazonaws.com/input/p-video-2-pro-reference-cellist-ref.jpg"],
12 "resolution": "768p",
13 "mode": "speed",
14 "duration": 5,
15 "aspect_ratio": "16:9",
16 "prompt_upsampler": "turbo",
17 "seed": -1,
18}
19job = client.submit_async("p-video-2-pro-reference", **payload)
20print(job.request_id) # available immediately
21try:
22 result = job.wait(timeout=900, interval=2.0)
23 print(result["status"]) # COMPLETED
24 print(result.get("output")) # model output (e.g. video URL)
25except InferenceTimeout as e:
26 print("still running:", e.request_id) # re-poll later with this id
27except InferenceFailed as e:
28 print("failed:", e.detail)
29
30# Fast models (<=600s) can use the one-liner instead:
31# result = segmind.run("p-video-2-pro-reference", **payload) 1# pip install "segmind>=1.1.0"
2# export SEGMIND_API_KEY="YOUR_API_KEY"
3from segmind import SegmindClient, InferenceFailed, InferenceTimeout
4
5# Async (v2) — recommended for long-running / video models.
6# run() blocks up to 600s; submit_async + job.wait(timeout=...) sets a longer
7# deadline and keeps the request_id so you can re-poll later.
8client = SegmindClient() # reads SEGMIND_API_KEY
9payload = {
10 "prompt": "The cellist from the reference image draws his bow across the strings, swaying into the phrase with his eyes closed, then opens them to the camera. Sound: a resonant cello and the faint creak of the chair.",
11 "image": ["https://segmind-resources.s3.amazonaws.com/input/p-video-2-pro-reference-cellist-ref.jpg"],
12 "resolution": "768p",
13 "mode": "speed",
14 "duration": 5,
15 "aspect_ratio": "16:9",
16 "prompt_upsampler": "turbo",
17 "seed": -1,
18}
19job = client.submit_async("p-video-2-pro-reference", **payload)
20print(job.request_id) # available immediately
21try:
22 result = job.wait(timeout=900, interval=2.0)
23 print(result["status"]) # COMPLETED
24 print(result.get("output")) # model output (e.g. video URL)
25except InferenceTimeout as e:
26 print("still running:", e.request_id) # re-poll later with this id
27except InferenceFailed as e:
28 print("failed:", e.detail)
29
30# Fast models (<=600s) can use the one-liner instead:
31# result = segmind.run("p-video-2-pro-reference", **payload)API Endpoint
https://api.segmind.com/v1/p-video-2-pro-referenceParameters
promptrequiredstringDescribe the scene, action and camera, and name what each reference should contribute; audio is generated, so write ambience, effects and dialogue into the prompt.
aspect_ratiooptionalstringOutput frame shape: adaptive, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3 or 1:1 (default 16:9). Use adaptive to let the references set the shape, 9:16 for social.
"16:9""adaptive""16:9""9:16""4:3""3:4""3:2""2:3""1:1"audiooptionalstring[]Up to 3 reference audio files (15 s combined, 50 MiB each) to drive dialogue, music or pacing. Audio alone is not enough — send at least one image or video reference too.
durationoptionalintegerTarget length in whole seconds, 5 to 15 (default 5); the clip returned may run slightly shorter or longer and billing follows it. Use 5 to 6 s for tests.
5Range: 5 - 15first_frame_imageoptionalstring (uri)Soft keyframe for a frame-exact opening (20 MiB, 4096 px; counts toward the 9 reference images). Set it when the clip must start on a specific still; it forces the turbo prompt upsampler.
imageoptionalstring[]Up to 9 reference images (20 MiB, 4096 px each; first and last frames count toward the 9) for characters, products, locations or style. Soft guidance — the prompt decides the shot; use first_frame_image for a frame-exact start.
last_frame_imageoptionalstring (uri)Soft keyframe for a frame-exact ending (20 MiB, 4096 px; counts toward the 9 reference images). Pair with first_frame_image to lock both ends of a transition; it forces the turbo prompt upsampler.
modeoptionalstringGeneration recipe, speed (default) or cost; there is no quality mode. Use speed for the fastest pass, cost for a lower per-second rate.
"speed""speed""cost"prompt_upsampleroptionalstringHow far a short prompt is expanded before generating: off, turbo (default) or max; independent of mode and price. A first or last frame image forces turbo.
"turbo""off""turbo""max"resolutionoptionalstringOutput resolution, 480p or 768p (default 768p). Use 768p for the quality tier; 480p to lower the per-second rate on high-volume runs.
"768p""480p""768p"seedoptionalintegerFixed seed from -1 to 2147483647 (default -1 for a new result each run). Set a fixed value to reproduce an output.
-1Range: -1 - 2147483647videooptionalstring[]Up to 3 reference clips (2 to 15 s each, 15 s combined, up to 1080p 60 fps, 100 MiB each) for motion, framing or style. Use one to carry a camera move or action into a new scene.
Response Type
Returns: Video
Asynchronous requests (v2)
Use Async for video, long-running (>~60s), or high-concurrency workloads; Sync is simplest for fast image & LLM calls. Async submits a request and you poll it to completion.
- 1
POST /v2/p-video-2-pro-referenceSubmit — returns request_id, status_url, response_url
- 2
GET /v2/requests/{id}/statusPoll — until COMPLETED or FAILED
- 3
GET /v2/requests/{id}Result — final response body
Status states
- A FAILED request is served as HTTP 422 — the body still carries the error detail.
- An unknown or expired request_id returns HTTP 404.
- Results are retained for 1 hour, then expire.
- Content / RAI blocks surface as FAILED, not a separate state.
- Track completion by polling the status endpoint.
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out