Video Generation
Seedance 2.5 parameters, video interfaces, and asynchronous results.
Generate videos with your Pofano API key. Both interfaces below are supported; choose the request and response shape that suits your application.
| Create | Query | Request and response shape |
|---|---|---|
POST /v1/videos | GET /v1/videos/{id} | A prompt or typed content; video objects with lowercase status values |
POST /v1/video/generations | GET /v1/video/generations/{task_id} | Top-level prompt with metadata controls; query results in a code/data envelope |
Both follow the same asynchronous workflow: create a task, save its public ID, poll, and download the result. Model access and current prices are shown in Model Square.
For credentials and account usage, see API keys, Authentication, Tokens, and Billing.
Start here#
For a first request, complete the minimal text-to-video workflow below before exploring media inputs or advanced features. If you already have a task ID, resume querying instead of creating another task.
| Goal | Read |
|---|---|
| Make a first request, save the task ID and download | Complete working example |
| Upload one image, use frames or references, edit or extend | Request parameters and the scenario examples below |
| Render a finished video from a preview | Draft to Final |
| Parse responses and recognize completion | Responses and states |
| Recover from errors, timeouts or failed downloads | Troubleshooting and recovery |
Choose a request shape#
Both interfaces are peers and share core generation capabilities. Their request and response shapes differ: changing only the URL without adjusting the body or parser is not sufficient.
| Item | /v1/videos | /v1/video/generations |
|---|---|---|
| Request type | JSON or single-image multipart | JSON |
| Text for ordinary tasks | Top-level prompt or a text item inside metadata.content | Nonempty top-level prompt; content contains media only |
| Single image | input_reference URL/Data URI or multipart file | input_reference URL/Data URI; no file upload |
| Full content form | Omit top-level prompt and input_reference | Put text in top-level prompt; do not repeat it in content |
| Automatic duration | Top-level duration or metadata.duration may be -1 | Use only metadata.duration: -1; omit top-level duration |
| Final | Omit prompt, input media and inherited fields; reference the Draft | Same |
| Query state | Top-level status | data.status; outer code does not indicate completion |
Before calling, confirm that you have a Pofano API key, sufficient available quota and model access. Use the linked credential and access guides above rather than repeating their setup here. Replace the sample model with an identifier you can currently access in Model Square; a sample name is not an availability promise.
Complete working example#
This script uses the standard library in Python 3.9 or newer; no SDK installation is required. Both interfaces share one script: change only VIDEO_API for this identical request. Do not run both variants together unless you intend to create two separately charged tasks.
Save it as video_quickstart.py. It submits creation once, saves the ID in video-task.json, polls, and downloads only after confirmed success. The final file appears only after download completes. Five-second polling and a 30-minute local deadline are example client policies, not published site limits, generation times or service timeout guarantees.
import json
import os
import time
from pathlib import Path
from urllib.error import HTTPError, URLError
from urllib.parse import quote
from urllib.request import Request, urlopen
def main():
base = os.environ.get("API_BASE", "https://ai.pofano.com").rstrip("/")
key = os.environ["API_KEY"]
endpoint = os.environ.get("VIDEO_API", "/v1/videos")
if endpoint not in ("/v1/videos", "/v1/video/generations"):
raise ValueError("VIDEO_API must be /v1/videos or /v1/video/generations")
headers = {"Authorization": "Bearer " + key}
task_id = os.environ.get("VIDEO_TASK_ID", "").strip()
if not task_id:
body = {
"model": os.environ["VIDEO_MODEL"],
"prompt": "A cinematic tracking shot through a miniature city at golden hour",
"duration": 5,
"metadata": {"resolution": "720p", "ratio": "16:9"},
}
request = Request(base + endpoint, data=json.dumps(body).encode(),
headers={**headers, "Content-Type": "application/json"}, method="POST")
with urlopen(request, timeout=60) as response:
receipt = json.load(response)
task_id = receipt.get("id") or receipt.get("task_id")
if not isinstance(task_id, str) or not task_id.startswith("task_"):
raise RuntimeError("No public task ID; check the console before submitting again")
Path("video-task.json").write_text(json.dumps({"task_id": task_id, "endpoint": endpoint}), encoding="utf-8")
print("task_id:", task_id, flush=True)
deadline = time.monotonic() + 1800
failures = 0
while time.monotonic() < deadline:
try:
request = Request(base + endpoint + "/" + quote(task_id, safe=""), headers=headers)
with urlopen(request, timeout=60) as response:
result = json.load(response)
except HTTPError as error:
if error.code not in (429, 500, 502, 503, 504):
raise
failures += 1
if failures > 8:
raise RuntimeError("Repeated query errors; resume with the saved task ID") from error
retry_after = error.headers.get("Retry-After", "")
delay = int(retry_after) if retry_after.isdigit() else min(30, 5 * failures)
time.sleep(min(60, max(1, delay)))
continue
except (URLError, TimeoutError) as error:
failures += 1
if failures > 8:
raise RuntimeError("Repeated query timeouts; resume with the saved task ID") from error
time.sleep(min(30, 5 * failures))
continue
failures = 0
if endpoint == "/v1/video/generations":
if result.get("code") != "success" or not isinstance(result.get("data"), dict):
raise RuntimeError("Unexpected query response; keep the saved task ID")
task = result["data"]
success, failed = "SUCCESS", "FAILURE"
waiting = {"NOT_START", "SUBMITTED", "QUEUED", "IN_PROGRESS"}
else:
task = result
success, failed = "completed", "failed"
waiting = {"queued", "in_progress"}
status = task.get("status")
print("status:", status, flush=True)
if status == success:
break
if status == failed:
detail = task.get("error") or task.get("fail_reason") or "Video generation failed"
raise RuntimeError(str(detail))
if status not in waiting:
raise RuntimeError("Unknown status; keep the task ID and do not download or resubmit")
time.sleep(5)
else:
raise TimeoutError("Local polling deadline reached; resume with the saved task ID")
output = Path(os.environ.get("VIDEO_OUTPUT", "generated-video.mp4"))
partial = output.with_name(output.name + ".part")
request = Request(base + "/v1/videos/" + quote(task_id, safe="") + "/content", headers=headers)
written = 0
with urlopen(request, timeout=60) as response:
content_type = response.headers.get("Content-Type", "").lower()
if "json" in content_type or "html" in content_type:
raise RuntimeError("Download returned JSON or HTML instead of video; keep the task ID")
with partial.open("wb") as file:
while chunk := response.read(64 * 1024):
file.write(chunk)
written += len(chunk)
if written == 0:
raise RuntimeError("Empty download; keep the task ID")
partial.replace(output)
print("saved:", output)
if __name__ == "__main__":
main()Set the environment and run in Bash:
export API_KEY='YOUR_POFANO_API_KEY'
export VIDEO_MODEL='MODEL_ID_FROM_MODEL_SQUARE'
export VIDEO_API='/v1/videos'
python3 video_quickstart.pySet the environment and run in PowerShell:
$env:API_KEY = 'YOUR_POFANO_API_KEY'
$env:VIDEO_MODEL = 'MODEL_ID_FROM_MODEL_SQUARE'
$env:VIDEO_API = '/v1/videos'
python video_quickstart.pyTo use the other interface, set VIDEO_API to /v1/video/generations; the rest stays the same. The script parses the selected interface’s response shape.
Resume an existing task: copy its public ID from video-task.json or the console, keep the originally selected query interface, and set VIDEO_TASK_ID. Resuming does not require VIDEO_MODEL and sends no POST. The following uses generations; if you originally selected videos, change the path back to /v1/videos. Keep API_KEY set.
export VIDEO_API='/v1/video/generations'
export VIDEO_TASK_ID='task_REPLACE_WITH_YOUR_TASK_ID'
python3 video_quickstart.py$env:VIDEO_API = '/v1/video/generations'
$env:VIDEO_TASK_ID = 'task_REPLACE_WITH_YOUR_TASK_ID'
python video_quickstart.pyThe output is generated-video.mp4. If you requested mov, set VIDEO_OUTPUT to a .mov filename; renaming a file does not convert its format. Resuming a download still requires a successful task and an accessible artifact. Save the public task ID on errors: a script exiting does not cancel the task.
Model selection#
Check Model Square for currently available models and access requirements, then set model explicitly on either interface. The examples use seedance-2.5; when the NSFW content variant is available, select its seedance-2.5-nsfw identifier. These examples are not a fixed or complete model catalog. The gateway does not infer or switch the model from your prompt.
A Final must use the same model identifier as its Draft. References between the two variants are rejected.
Capabilities#
| Capability | Usage |
|---|---|
| Text or image guidance | A prompt, a single image, or first/last frames |
| Multiple references | Typed image, video and audio inputs in metadata.content |
| Audio-only reference | Typed audio input, with an optional text item on /v1/videos |
| Video editing or extension | Use the task-type and duration constraints below |
| Duration | Integer 4–30 seconds, or -1 for automatic duration |
| Output | 480p / 720p / 1080p / 4K; mp4 or mov |
| Web search | Optional for text-to-video on either interface |
| Audio, watermark, last frame | Optional metadata controls |
| Draft preview | metadata.draft=true, fixed 480p |
| Draft to Final | Create a 1080p Final from a successful 480p Draft on either interface |
| Inline media and uploads | Image/audio Data URIs; a single image upload on /v1/videos |
| Request controls | Fixed seed, execution expiry, priority and safety identifier |
| Completion notification | Optional callback_url to notify your program after success or failure |
Asset-library references, cancellation and remix are not currently exposed. Task completion callbacks are described below.
Media input and asset-library management are separate capabilities. You can use the supported media URLs, image/audio Data URIs, or single-image upload described below. Asset ingestion, asset-library management, and asset:// references are not currently available.
Task completion callbacks#
To trigger your program when a task finishes, add top-level callback_url to JSON requests on either creation endpoint. For multipart requests on /v1/videos, use a text field with that name. Callbacks and polling can be used together; Draft and Final can each register a callback. Do not put it inside metadata.
{
"model": "seedance-2.5",
"prompt": "A paper boat floating along a quiet stream",
"duration": 5,
"callback_url": "https://hooks.example/video/PRIVATE_RANDOM_PATH?job_id=YOUR_JOB_ID",
"metadata": { "resolution": "720p", "ratio": "16:9" }
}Use a public HTTPS receiver on default port 443 or explicit :443, without user information or a # fragment. Private networks, loopback addresses and redirects are unsupported. Expose a local receiver through an HTTPS reverse proxy. Temporary DNS or network failures trigger delivery retries, not generation failure.
Once this site confirms success or failure, it sends a JSON POST. Both endpoints use the same callback format, with the same site task ID returned on creation:
{
"id": "evt_EXAMPLE",
"type": "video.completed",
"created_at": 1794000000,
"data": {
"id": "task_EXAMPLE",
"status": "completed",
"model": "seedance-2.5",
"query_path": "/v1/videos/task_EXAMPLE"
}
}For failure, type is video.failed and data.status is failed. Creation through the other endpoint yields /v1/video/generations/task_EXAMPLE as query_path. Retrieve failure details and download instructions through the site's task query API. Notifications contain no input media, internal result or API key, and do not promise that accounting has finished. created_at is the Unix timestamp in seconds when the event was first constructed.
Receive and acknowledge#
- Associate
data.idwith your own saved task/order records, or use your ownjob_idin the callback URL. Save the creation response; a callback can arrive before your application finishes processing that response. - This initial version has no callback signature. Use a private, unpredictable receiver path and treat events as hints. Query the task from your server using your own site API key to confirm ownership and final status. Never put that key in the callback URL or send it to the receiver.
- Deduplicate using event
idor the identicalX-New-Api-Event-IDheader. Persist the verified event and pending business work before returning2xx, then process downloads and other actions separately. - Allow only the two site task query path patterns and always use your own configured site base URL. Never follow an arbitrary URL from a notification. Return a non-
2xxresponse if verification or persistence temporarily fails so delivery can retry.
The following Python standard-library receiver verifies events and stores them in local SQLite. Place it behind an HTTPS reverse proxy, then set NEW_API_BASE_URL, NEW_API_KEY, and VIDEO_WEBHOOK_PATH (for example, /video/a-long-random-string). It does not download videos or run business actions; your worker can consume the events table. In production, also check your own task ownership records and integrate with your durable business queue.
import json
import os
import re
import sqlite3
from contextlib import closing
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from urllib.error import HTTPError, URLError
from urllib.parse import urlsplit
from urllib.request import Request, HTTPRedirectHandler, build_opener
BASE = os.environ["NEW_API_BASE_URL"].rstrip("/")
KEY = os.environ["NEW_API_KEY"]
HOOK_PATH = os.environ["VIDEO_WEBHOOK_PATH"]
DB = "video-events.sqlite3"
if not HOOK_PATH.startswith("/") or len(HOOK_PATH) < 24 or "?" in HOOK_PATH:
raise ValueError("Use a private, unpredictable webhook path of at least 24 characters")
class NoRedirect(HTTPRedirectHandler):
def redirect_request(self, req, fp, code, msg, headers, newurl):
return None
with closing(sqlite3.connect(DB)) as db, db:
db.execute("CREATE TABLE IF NOT EXISTS events (id TEXT PRIMARY KEY, task_id TEXT UNIQUE, payload TEXT)")
class Handler(BaseHTTPRequestHandler):
def log_message(self, *args):
pass
def do_POST(self):
if urlsplit(self.path).path != HOOK_PATH:
self.send_error(404)
return
try:
size = int(self.headers.get("Content-Length", "0"))
if not 0 < size <= 65536:
raise ValueError("Invalid body size")
event = json.loads(self.rfile.read(size))
data = event["data"]
task_id = data["id"]
event_id = event["id"]
if not re.fullmatch(r"task_[A-Za-z0-9_-]+", task_id):
raise ValueError("Invalid task ID")
if not re.fullmatch(r"evt_[A-Za-z0-9_-]+", event_id):
raise ValueError("Invalid event ID")
path = data["query_path"]
if path not in ("/v1/videos/" + task_id, "/v1/video/generations/" + task_id):
raise ValueError("Invalid query path")
expected = {"video.completed": "completed", "video.failed": "failed"}[event["type"]]
if data["status"] != expected:
raise ValueError("Conflicting event status")
request = Request(BASE + path, headers={"Authorization": "Bearer " + KEY})
with build_opener(NoRedirect).open(request, timeout=5) as response:
actual = json.load(response)
if path.startswith("/v1/video/generations/"):
actual = actual["data"]
actual_status = {"SUCCESS": "completed", "FAILURE": "failed"}.get(actual["status"])
actual_id = actual["task_id"]
else:
actual_status = actual["status"]
actual_id = actual["id"]
if actual_id != task_id or actual_status != expected:
raise ValueError("Task state not confirmed")
with closing(sqlite3.connect(DB)) as db, db:
db.execute("INSERT OR IGNORE INTO events VALUES (?, ?, ?)",
(event_id, task_id, json.dumps(event)))
self.send_response(204)
self.end_headers()
except (ValueError, TypeError, KeyError, HTTPError, URLError, TimeoutError, OSError):
self.send_error(503, "Unable to confirm and persist event")
ThreadingHTTPServer(("127.0.0.1", 8080), Handler).serve_forever()Delays, retries and recovery#
- Delivery depends on background polling discovering the final state and the subsequent delivery schedule. It is not real-time and has no fixed seconds-level arrival guarantee. Larger queues and slow networks increase delay.
- Each delivery waits at most 10 seconds. Any
2xxacknowledges it; timeouts, network errors and other HTTP statuses trigger retries.3xxredirects are not followed. Verify and persist promptly instead of downloading a large video inside the request. - There are at most 8 attempts. The planned delays after the first 7 failures are 30 seconds, 2 minutes, 10 minutes, 30 minutes, 2 hours, 6 hours and 24 hours, subject to scheduling. Persisted pending deliveries resume after a service restart.
- The same event can arrive more than once. Retries preserve its event ID and JSON body; do not rely on exactly-once delivery. Attempts stop at the limit, and there is no manual redelivery interface in this version.
- If no callback arrives, automatically query using the site task ID saved on creation. Do not create another video for that reason. Notification failure does not cancel generation, change task status or charge again.
- Failures declared by this site after repeated query errors or a timeout also produce notifications. They describe the site's final state and do not guarantee that the generation service has stopped. A creation request that fails before a site task is saved produces no completion notification.
Request parameters#
JSON requests accept public HTTPS media URLs, plus Base64 Data URIs for images and audio. /v1/videos also accepts a single image through multipart upload as shown below. Replace media.example with your own accessible media; these addresses are placeholders. URL validation cannot verify the file's actual dimensions, format, duration or size before generation.
| Parameter | Requirement |
|---|---|
model | An available model identifier from Model Square; examples use seedance-2.5 |
callback_url | Optional top-level string, up to 2048 bytes; public HTTPS port 443. Do not place it in metadata. See Task completion callbacks for receiving and retry rules |
duration or seconds | Integer 4–30 seconds. On /v1/videos, -1 also selects automatic duration; on /v1/video/generations, use metadata.duration: -1 instead. seconds also accepts a decimal integer string. Omit for Final |
metadata.duration | On either interface: integer 4–30 or -1 for automatic duration. All supplied duration aliases must agree; when using this field for automatic duration, omit top-level duration and seconds. Omit for Final |
metadata.resolution | Required. Values include 480p, 720p, 1080p, 4k; use the tiers listed for your selected model in Model Square. Not every model supports every value. Draft requires 480p; Final requires 1080p |
metadata.tools | Optional: [] or [{"type":"web_search"}]. Search is limited to text-to-video; no media input or Final override |
metadata.ratio | Required: 21:9, 16:9, 4:3, 1:1, 3:4, 9:16, adaptive. Omit for Final |
prompt | Nonempty text for the simple form |
input_reference | Optional single-image HTTPS URL or Data URI; on /v1/videos, also a multipart image file. Maps to first-frame guidance and requires adaptive |
metadata.content | Full typed input; do not combine with top-level prompt or input_reference on /v1/videos |
metadata.generate_audio, watermark, return_last_frame | Optional booleans, all inside metadata; explicit false is preserved |
metadata.output_format | mp4 (default) or mov |
metadata.seed | Optional integer: -1 selects a random seed; nonnegative safe integers select a fixed seed. The gateway precision limit is 9007199254740991; the generation service may impose a narrower range. A fixed seed does not guarantee identical output |
metadata.omni_reference_task_type | auto, reference, edit, extend |
metadata.draft | Boolean; a true preview requires 480p |
metadata.execution_expires_after | Optional integer 3600–259200 seconds; sets the generation task's queued/running expiry |
metadata.priority | Optional integer 0–9; 0 is preserved. Controls generation queue priority, subject to service availability |
metadata.safety_identifier | Optional stable, opaque identifier: 1–64 printable ASCII characters without spaces. Prefer a hash instead of personal information |
metadata.service_tier | Optional; only default is accepted |
The execution expiry and the gateway's task timeout are independent. Setting execution_expires_after does not extend the gateway's configured waiting period. Omitted controls retain the generation service's defaults.
Media types and limits:
- Text:
{"type":"text","text":"..."}. - Images:
image_urlwith rolereference_image,first_frame, orlast_frame; at most 30 images. - Videos:
video_url, rolereference_video; at most 10; each 2–30 seconds for non-editing tasks or 4–30 seconds for editing tasks, with total input video duration at most 30 seconds. - Audio:
audio_url, rolereference_audio; at most 10, each 2–30 seconds and total audio duration at most 30 seconds. - At most 50 media items in total. Text does not count toward that media total.
- First and last frames allow one image each; a last frame needs a first frame. Do not mix frame guidance with other reference modes. Frame guidance requires
adaptive. - Media objects contain a
urlfield. HTTPS URLs must not contain embedded credentials. Images also acceptdata:image/png;base64,...and the supported image MIME types; audio accepts WAV/MP3 Data URIs. Video Data URIs andasset://references are not accepted. - Images must be smaller than 30 MiB; audio must not exceed 15 MiB. The encoded JSON request, including uploaded image expansion, must not exceed 64 MiB. Gateway or proxy limits may be tighter. File-size, codec, pixel and content checks still apply.
Media file specifications#
Use these requirements to prepare inputs. The gateway does not download every network input to inspect its actual properties; the generation service performs the final validation.
| Media | Formats and codecs | Dimensions, duration and size |
|---|---|---|
| Image | JPEG, PNG, WebP, BMP, TIFF, GIF, HEIC, HEIF | Width and height each 300–6000 px; width/height 0.4–2.5; each smaller than 30 MiB |
| Video | MP4, MOV; H.264/AVC or H.265/HEVC video; AAC or MP3 audio, with PCM also supported in MOV | Prepare 480p or 720p inputs at 24–60 FPS; width and height each 300–6000 px; width/height 0.4–2.5; each at most 200 MiB. Duration limits above apply; editing inputs must be at least 4 seconds |
| Audio | WAV, MP3 | Each 2–30 seconds, at most 15 MiB; total duration at most 30 seconds |
Input video resolution and output metadata.resolution are separate constraints. Supporting an output tier does not imply that video inputs at that tier are accepted. A correct filename or container does not prove the internal codecs are supported.
Preparing media and combining parameters#
Before filling the parameter table, check your inputs:
- Use an HTTPS URL that directly downloads the media file, not a web page, login page,
file://URL or local path. Opening it in your browser does not prove the generation service can fetch it without cookies or extra headers. - If a URL has an expiring signature, keep it accessible through queuing and generation. Do not delete the original file before completion. Signed URLs may themselves contain access credentials; do not post them publicly.
- Check the file actually returned, not just its extension. Verify size, duration and media counts against the limits above. The gateway cannot pre-validate every media property for the generation service.
- For a local image, use the
/v1/videosmultipart example. Do not put./frame.pnginto JSON. Prepare accessible URLs for local video and audio; supported images and audio may also use Data URIs. - Do not include a media website’s username or password. If a source requires login or custom authentication headers, first prepare an address that can be fetched without those credentials.
| Goal | Required combination | Common conflict |
|---|---|---|
| Text to video | prompt or the interface’s text content, duration, resolution and ratio | Controls at the wrong JSON level |
| Single image / first and last frames | ratio=adaptive; a last frame requires a first frame | Combining input_reference with content, or mixing frame guidance with reference mode |
| Multiple references | Explicit media types and roles within media-count limits | Missing role or duplicated text |
| Web search | Text-to-video; tools declare only web_search | Supplying image, audio or video, or overriding tools on Final |
| Editing | Video input, edit, automatic duration and adaptive | Top-level -1 on generations; use metadata.duration |
| Extension | Video input, extend, adaptive and valid duration | Only images or text, without a video |
| Draft | draft=true, resolution=480p; ordinary input rules otherwise apply | A different preview resolution |
| Final | Successful Draft, same model and account, draft=false, 1080p and one draft_task reference | Resupplying prompt, media, duration, ratio or other inherited fields |
These are common combination rules, not a guarantee of content acceptance. Keep using the full scenario examples below; you do not need to fill every optional parameter. Choose one duration alias. Ordinary requests must explicitly specify duration and ratio; Final requests omit inherited fields.
Web search#
To enable web search, include metadata.tools: [{"type":"web_search"}] in a text-to-video request. The model decides whether to search; enabling it does not guarantee a search will run. Do not combine a nonempty tools list with image, video or audio inputs. Final requests cannot override tools. Unknown tools, extra tool fields and duplicate declarations are rejected.
The following JSON body works with either POST /v1/videos or POST /v1/video/generations; replace the model identifier if you need the other content variant:
{
"model": "seedance-2.5",
"prompt": "Create a travel video using today's weather in Tokyo",
"duration": 5,
"metadata": {
"resolution": "720p",
"ratio": "16:9",
"tools": [{"type": "web_search"}]
}
}For applicable pricing, consult Model Square.
/v1/videos#
Text or single-image generation#
curl https://ai.pofano.com/v1/videos \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedance-2.5",
"prompt": "A cinematic tracking shot through a miniature city at golden hour",
"duration": 5,
"metadata": {
"resolution": "720p",
"ratio": "16:9",
"generate_audio": true,
"watermark": false,
"return_last_frame": true,
"output_format": "mp4"
}
}'For a single opening image, add top-level input_reference and set metadata.ratio to adaptive.
Upload a single image#
Use /v1/videos with multipart/form-data; let your HTTP client set the content type and boundary. metadata is one JSON string. Upload at most one input_reference image; do not also supply an image URL or metadata.content. Its MIME type must match a supported image format. This upload form does not add arbitrary video/audio file fields.
curl https://ai.pofano.com/v1/videos \
-H "Authorization: Bearer $API_KEY" \
-F 'model=seedance-2.5' \
-F 'prompt=A cinematic camera move from this opening frame' \
-F 'duration=5' \
-F 'metadata={"resolution":"720p","ratio":"adaptive","seed":20,"priority":0}' \
-F 'input_reference=@./frame.png;type=image/png'For JSON image or audio input, put the complete Data URI in the usual url field of the typed media item, or in input_reference for a single image. Use standard Base64 without spaces or line breaks. Accepted image MIME types are image/jpeg, image/png, image/webp, image/bmp, image/tiff, image/gif, image/heic and image/heif; audio MIME types are audio/wav, audio/x-wav, audio/mpeg and audio/mp3. Base64 increases the request size, so prefer HTTPS URLs for large media.
A create receipt resembles the following illustration, not a recorded live generation:
{
"id": "task_example",
"object": "video",
"model": "seedance-2.5",
"status": "queued",
"progress": 0,
"created_at": 1700000000
}First and last frames#
Send the following JSON body to the same creation endpoint. Remove the last_frame item for first-frame-only generation:
{
"model": "seedance-2.5",
"duration": 5,
"metadata": {
"resolution": "720p",
"ratio": "adaptive",
"content": [
{
"type": "text",
"text": "Move smoothly from the opening frame to the closing frame"
},
{
"type": "image_url",
"image_url": {
"url": "https://media.example/first.png"
},
"role": "first_frame"
},
{
"type": "image_url",
"image_url": {
"url": "https://media.example/last.png"
},
"role": "last_frame"
}
]
}
}Multimodal reference and audio-only input#
{
"model": "seedance-2.5",
"duration": 5,
"metadata": {
"resolution": "720p",
"ratio": "16:9",
"omni_reference_task_type": "reference",
"content": [
{
"type": "text",
"text": "Use @image1 for appearance, @video1 for movement, and @audio1 for rhythm"
},
{
"type": "image_url",
"image_url": {
"url": "https://media.example/product.png"
},
"role": "reference_image"
},
{
"type": "video_url",
"video_url": {
"url": "https://media.example/motion.mp4"
},
"role": "reference_video"
},
{
"type": "audio_url",
"audio_url": {
"url": "https://media.example/music.mp3"
},
"role": "reference_audio"
}
]
}
}An audio-only reference keeps the audio_url item and may keep or omit the text item. With the full-content form, omit top-level prompt.
The task type is evaluated again during generation from the prompt and reference media. With reference, clearly describe the new scene to create and what each reference contributes, such as appearance, motion, or sound. For editing or extension, state that intent clearly and use the corresponding parameters. An accepted creation request does not guarantee successful generation: the task can fail later if the inferred type differs from the specified type. Query the original task to confirm its terminal status before reviewing the prompt and media; do not create another task merely because waiting or querying failed.
Editing and extension#
{
"model": "seedance-2.5",
"duration": -1,
"metadata": {
"resolution": "720p",
"ratio": "adaptive",
"omni_reference_task_type": "edit",
"content": [
{
"type": "text",
"text": "Change the room lighting to a warm sunset"
},
{
"type": "video_url",
"video_url": {
"url": "https://media.example/source.mp4"
},
"role": "reference_video"
}
]
}
}For extension, change omni_reference_task_type to extend, keep ratio=adaptive, and select a duration from 4–30 or -1. Editing requires duration=-1 and ratio=adaptive; both editing and extension require video input. The generation service validates the actual source duration; an explicit integer duration for extension must be longer than the source video.
For a preview, use metadata.draft=true with resolution=480p. A successful Draft can be used to create a Final, as described below.
/v1/video/generations#
Create with POST /v1/video/generations and query with GET /v1/video/generations/{task_id}. This interface uses a top-level prompt and a code/data query response.
curl https://ai.pofano.com/v1/video/generations \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedance-2.5",
"prompt": "A cinematic tracking shot through a miniature city",
"metadata": {
"duration": -1,
"resolution": "720p",
"ratio": "16:9",
"content": [
{
"type": "video_url",
"video_url": {
"url": "https://media.example/motion.mp4"
},
"role": "reference_video"
}
]
}
}'- This interface requires a nonempty top-level
prompt, except when creating a Final from a Draft. - Put extensions inside
metadata; unsupported parameters are rejected. - Its
metadata.contentcontains non-text media only; the gateway combines them withprompt. - For automatic duration, use only
metadata.duration=-1. Negative top-level duration/seconds is rejected by this interface. - Create returns
idandtask_id; query returns acode/dataenvelope with task status such asSUCCESSorFAILURE. Do not reuse a /v1/videos JSON parser unchanged. - A public task ID created here can be downloaded through
/v1/videos/{id}/contentusing the same key. - For first/last frames, multiple references, editing, extension and preview, use the same media roles and metadata controls described above, with the text in
promptand only non-text items inmetadata.content. - For other requests without a top-level text prompt, choose
/v1/videos.
Draft to Final on either interface#
- Create a preview using the normal request shape, with
metadata.draft=trueandmetadata.resolution="480p". - Poll until the Draft succeeds and save its public task ID. Use the same account to create the Final within seven days of Draft creation. Some older Drafts lack the required inherited state; create a new preview if the reference is rejected.
- Send the JSON below to either
POST /v1/videosorPOST /v1/video/generations. A Draft created through either interface can be referenced through either interface.
{
"model": "seedance-2.5",
"metadata": {
"draft": false,
"resolution": "1080p",
"output_format": "mp4",
"return_last_frame": true,
"content": [
{"type": "draft_task", "draft_task": {"id": "task_REPLACE_WITH_YOUR_DRAFT_ID"}}
]
}
}Use the public ID returned by this service. Do not provide a prompt, input media, duration, ratio, seed, generated-audio setting or task type: these are inherited from the Draft. The request may set output format, watermark, last frame, execution expiry, priority, safety identifier and the supported service tier. The original Draft generation task must remain accessible. If a reference fails, keep its public ID and check the Draft requirements.
The Final is a separate task with a new public ID and a separate charge. Poll and download it as usual. The reservation uses the inherited duration and reference-video condition at the Final resolution; valid actual usage settles the difference. A failed Final does not undo a successful Draft's charge. Current prices remain in Model Square.
Responses and states#
The JSON below shows minimal field excerpts and illustrative shapes, not paid generation records. Actual responses may contain additional fields. Parse by interface, without depending on field order or unlisted fields.
Creation receipt#
The /v1/videos creation receipt is shown above. /v1/video/generations returns the following receipt; id and task_id contain the same public task ID. A receipt with queued does not mean generation succeeded.
{
"id": "task_example",
"task_id": "task_example",
"status": "queued",
"model": "seedance-2.5",
"created_at": 1700000000
}Interpreting query states#
HTTP 200 means the query returned an HTTP response. code: "success" means the query API succeeded. Neither proves generation finished. Progress is advisory; do not download merely because it reaches 100.
For a missing or inaccessible task, either query endpoint may return HTTP 400 with code: "task_not_exist"; content and artifact endpoints may return HTTP 404. Do not rely only on 404 to determine whether a task exists, or automatically create another task for that reason.
| Stage | /v1/videos status | /v1/video/generations data.status | Client action |
|---|---|---|---|
| Waiting | queued | NOT_START, SUBMITTED, QUEUED | Keep polling |
| Running | in_progress | IN_PROGRESS | Keep polling; do not create again |
| Success | completed | SUCCESS | Stop polling and download |
| Failure | failed | FAILURE | Stop polling; inspect the error and logs |
| Unknown or missing | unknown, missing or another value | UNKNOWN, missing or another value | Keep the ID and inspect the response; do not assume success or recreate automatically |
Successful queries#
/v1/videos:
{
"id": "task_example",
"object": "video",
"model": "seedance-2.5",
"status": "completed",
"progress": 100,
"created_at": 1700000000,
"completed_at": 1700000030,
"content_url": "/v1/videos/task_example/content"
}/v1/video/generations:
{
"code": "success",
"data": {
"task_id": "task_example",
"status": "SUCCESS",
"progress": "100%",
"result_url": "/v1/videos/task_example/content",
"data": {
"status": "SUCCESS",
"content_url": "/v1/videos/task_example/content"
}
}
}In generations, outer data is the task object; data.data contains supplementary result information. Use data.status for lifecycle decisions; do not treat data.data.status or other supplementary fields as a fixed cross-version contract. content_url and result_url may be relative paths: resolve them against this site’s API base URL and authenticate with your Pofano key, or use the content-download path shown here.
Failed queries#
/v1/videos:
{
"id": "task_example",
"object": "video",
"status": "failed",
"error": "Video generation failed"
}/v1/video/generations:
{
"code": "success",
"data": {
"task_id": "task_example",
"status": "FAILURE",
"fail_reason": "Task failed",
"data": {
"status": "FAILURE",
"error": "Video generation failed"
}
}
}An error may be generic. Do not infer a balance, prompt or media problem from a generic message alone. Follow the checks below, then provide the public task ID if help is still needed. A terminal task failure is different from an HTTP query failure.
Poll and save the result#
Poll at a reasonable interval; generation may take time. A successful create response only means the job was accepted.
# /v1/videos
curl https://ai.pofano.com/v1/videos/task_example \
-H "Authorization: Bearer $API_KEY"
# /v1/video/generations
curl https://ai.pofano.com/v1/video/generations/task_example \
-H "Authorization: Bearer $API_KEY"The /v1/videos response states include queued, in_progress, completed, and failed. Unknown or inconsistent task responses do not become successful results.
After completed, save the video using the same Pofano key:
curl https://ai.pofano.com/v1/videos/task_example/content \
-H "Authorization: Bearer $API_KEY" \
-o generated-video.mp4
curl -I https://ai.pofano.com/v1/videos/task_example/content \
-H "Authorization: Bearer $API_KEY"Use a .mov filename when you requested mov. For a returned final frame, list GET /v1/tasks/task_example/artifacts and read the last_frame entry's content_url with your key. The artifact may be absent if no valid frame was returned.
Generated files have limited availability; download promptly. Pofano does not promise permanent storage, a fixed retention period or a fixed number of downloads. A later expired link or download failure does not undo a successfully generated task's charge. Do not blindly resubmit after a network timeout: the original job may already have been accepted.
Billing and errors#
For current prices, consult Model Square. Charges follow the configuration that applies to your request; this page does not maintain a separate price list.
An estimated amount is reserved before submission. Automatic duration is estimated using 30 seconds of output. The reservation is not a maximum-price guarantee: valid actual usage may produce an additional charge or a refund of the difference. Failed tasks follow the refund flow. When valid actual usage is unavailable, the existing reserved amount is retained. Check the request log for the resulting charge.
Troubleshooting and recovery#
First identify the stage that failed. HTTP errors, terminal generation failures and download errors need different recovery steps. Do not treat every error as a reason to submit again. See Errors for general status definitions and Troubleshooting for account issues.
| Stage or symptom | Check first | Create another task? |
|---|---|---|
| Creation rejects parameters | JSON nesting, types, duration aliases, prompt/content, media roles and scenario combinations | Correct an explicitly rejected request before submitting |
| Creation rejects authentication or access | Pofano key, validity, model access and current model availability | Fix access; do not retry in a loop |
| Insufficient quota at creation | Account and key quota; the model’s current billing information | Resolve quota first |
| Creation disconnects, times out or returns an unreadable response | Console tasks and usage records; whether you received a public ID | Do not resend automatically; check acceptance first |
| Query returns 429 or a temporary 5xx | Keep the ID; honor Retry-After or back off and retry the same query | No |
| Query times out or progress stays unchanged | Queuing or execution; poll less frequently and resume later | No; a local deadline does not cancel a task |
| Task cannot be found | Correct path and ID, ownership and continued task retrievability | Check first; this does not prove it was never accepted |
| failed / FAILURE | Public error, media accessibility and request logs; investigate generic errors | Only after investigating; another submission is another task |
| Download fails after success | Confirm terminal success, authentication, the site content path and continued artifact availability | Retry downloading first |
| Download is JSON, HTML or empty | HTTP status, Content-Type, proxy or network errors; do not save an error as video | Fix downloading; keep the ID |
Automatically retry only clearly transient query failures. This guide makes no creation idempotency or deduplication promise: repeating a POST with the same prompt or file can create another task and charge. Changing interfaces and creating again is not a way to resume. If acceptance is uncertain, check the console, then contact support if you still cannot determine it.
A script or client deadline does not cancel a queued task. Resume with the saved ID. To intentionally create a new task, clear VIDEO_TASK_ID first (unset VIDEO_TASK_ID in Bash; Remove-Item Env:VIDEO_TASK_ID in PowerShell). Save a separate ID for every batch task: the example’s video-task.json records only the latest run and is not a task queue.
Common integration questions#
Information to provide when seeking help#
Use Contact support and include the time and timezone, interface, model identifier, public task ID if available, HTTP status, redacted error, failing stage (create/query/download), and redacted request fields. Preserve metadata structure, media types and roles to help reproduce combination rules.
Do not share API keys, Authorization/Cookie headers, complete signed media URLs, private media or unredacted request logs. Without a task ID, say whether creation timed out and whether the console has a record. A generic “Video generation failed” message alone does not identify the cause; the public task ID helps support investigate.
Pofano