API Reference · v1.0

Pixnovia API

The Pixnovia API lets you generate AI videos programmatically using the Minimax H3 model. Integrate video generation directly into your products with a simple REST API.

Base URL https://pixnovia.com
API Key Auth
Use your sk_ key as a Bearer token. Create keys from your dashboard.
Async Tasks
Submit a task, then poll /api/video/task/{id} until success.
Pay-as-you-go
Charged per second of video generated. Balance deducted on task completion only.
New accounts receive a $1.00 free credit on registration — enough to test a few generations before topping up.

Pricing

Video generation is billed per second of output at the chosen resolution. Your account balance is only deducted after the task completes successfully — failed tasks are not charged.

Resolution Rate Example — 6 sec Example — 15 sec
480p $0.04 / sec $0.24 $0.60
768p $0.06 / sec $0.36 $0.90
1080p $0.08 / sec $0.48 $1.20
1440p $0.10 / sec $0.60 $1.50

The minimum top-up amount is $1.00. Top up from Dashboard → Top Up.

Authentication

All API endpoints require an API key passed as a Bearer token in the Authorization header. API keys start with sk_ and can be created from your dashboard.

Log in to your account, then go to Dashboard → API Keys to create a key. Each key is shown only once at creation time — store it securely.
Never embed your API key in client-side code or commit it to a repository. Treat it like a password — revoke and regenerate from the dashboard if it is ever exposed.
HTTP Header
Authorization: Bearer sk_your_api_key_here

Create Video Task

Create a video generation task. The task runs asynchronously — this endpoint returns immediately with a task_id Poll Get Task Status to check progress and retrieve the result URL.

POST /api/video/generate Submit a video generation job

Request Body

Parameter Type Description
prompt string required Text description of the video to generate.
resolution string required 480p 768p 1080p 1440p
aspect_ratio string required landscape portrait
duration integer required Duration in seconds. Range: 3–15
ref_files object optional Reference files as base64 data URLs. Keys: ref_image_0 ref_audio_0
200 OK 400 Bad Request 401 Unauthorized 402 Insufficient Balance 500 Server Error

Example Request — text only

Python
import requests

headers = {
    "Authorization": "Bearer sk_your_api_key",
    "Content-Type": "application/json",
}

payload = {
    "prompt": "A cinematic drone shot over snow-capped mountains at golden hour",
    "resolution": "1080p",
    "aspect_ratio": "landscape",
    "duration": 6,
}

res = requests.post(
    "https://pixnovia.com/api/video/generate",
    json=payload,
    headers=headers
)
data = res.json()
print("task_id:", data["task_id"])
cURL
curl -X POST https://pixnovia.com/api/video/generate \
  -H "Authorization: Bearer sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A cinematic drone shot over snow-capped mountains",
    "resolution": "1080p",
    "aspect_ratio": "landscape",
    "duration": 6
  }'

Example Request — with reference files

You can pass a reference image and/or audio to guide the visual style and rhythm of the generated video. Files must be encoded as base64 data URLs and included in the ref_files object.

Notes on ref_files:
• Reference filea are optional.
• Reference images, maximum 6, use key: ref_image_0 to ref_image_5 — supported formats: image/jpeg, image/png, image/webp
• Reference audios, maximum 3, use key: ref_audio_0 to ref_audio_2 — supported format: audio/wav
• Value must be a full data URL: data:<mime>;base64,<data>
• Keep images and audio under 10 MB
Python — with reference image + audio
import requests, base64

def to_data_url(path, mime):
    with open(path, "rb") as f:
        b64 = base64.b64encode(f.read()).decode()
    return f"data:{mime};base64,{b64}"

headers = {
    "Authorization": "Bearer sk_your_api_key",
    "Content-Type": "application/json",
}

payload = {
    "prompt": "Ocean waves at sunset with a gentle rhythm",
    "resolution": "1080p",
    "aspect_ratio": "landscape",
    "duration": 10,
    "ref_files": {
        "ref_image_0": to_data_url("scene.jpg",   "image/jpeg"),
        "ref_image_1": to_data_url("scene-1.jpg",   "image/jpeg"),
        "ref_image_2": to_data_url("scene-2.jpg",   "image/jpeg"),
        "ref_audio_0": to_data_url("rhythm.wav",  "audio/wav"),
        "ref_audio_1": to_data_url("rhythm-1.wav",  "audio/wav"),
        "ref_audio_2": to_data_url("rhythm-2.wav",  "audio/wav"),
    }
}

res = requests.post(
    "https://pixnovia.com/api/video/generate",
    json=payload,
    headers=headers
)
data = res.json()
print("task_id:", data["task_id"])

Response

200 OK — Success
{
  "task_id": 42,
  "status": "success",
  "est_cost_cents": 48,
  "error_message": null
}
200 OK — Failed (Insufficient Balance)
{
  "task_id": null,
  "status": "failed",
  "est_cost_cents": 48,
  "error_message": "Insufficient balance. Required: $0.48, Current: $0.20"
}
200 OK — Failed (Invalid Parameters)
{
  "task_id": null,
  "status": "failed",
  "est_cost_cents": 0,
  "error_message": "Invalid resolution: 2160p"
}

Get Task Results

Poll this endpoint to check task progress. When status is success, the video_url field contains the generated video download URL. Your account balance is deducted at this point.

GET /api/video/task/{task_id} Poll task status
Parameter Type Description
task_id integer path Task ID returned by the Generate Video endpoint.
200 OK 401 Unauthorized 404 Not Found

Status Values

status Meaning
pending Task is queued, not yet picked up.
processing Task is actively being generated.
success Generation complete. video_url is available. Balance deducted.
failed Generation failed. No charge. error_message has details.

Polling Example

Python
import time

task_id = data["task_id"]  # from generate response

while True:
    r = requests.get(
        f"https://pixnovia.com/api/video/task/{task_id}",
        headers=headers
    ).json()

    status = r["status"]
    if status == "success":
        print("Video URL:", r["video_url"])
        break
    elif status == "failed":
        print("Failed:", r["error_message"])
        break

    time.sleep(5)  # poll every 5 seconds

Response — success

200 OK
{
  "task_id": 42,
  "status": "success",
  "video_url": "/api/video/download/42",
  "error_message": null,
  "cost_cents": 48,
  "transaction_id": 187,
  "new_balance_cents": 952,
  "created_at": "2026-11-10T08:23:11Z",
  "completed_at": "2026-11-10T08:25:44Z"
}

Save Video

Once the task status is success, use the video_url to download the generated video. The URL is a relative path — prepend your base URL (https://pixnovia.com) to form the complete download link.

Python
import requests

# After polling returns status="success"
video_url = task_response["video_url"]  # e.g., "/api/video/download/42"
full_url = f"https://pixnovia.com{video_url}"

# Download the video
response = requests.get(full_url, headers=headers)

if response.status_code == 200:
    with open("output.mp4", "wb") as f:
        f.write(response.content)
    print("Video saved to output.mp4")
else:
    print(f"Download failed: {response.status_code}")
cURL
curl -X GET "https://pixnovia.com/api/video/download/42" \
  -H "Authorization: Bearer sk_your_api_key" \
  -o output.mp4
JavaScript (Node.js)
const fs = require('fs');
const https = require('https');

const videoUrl = taskResponse.video_url;
const fullUrl = `https://pixnovia.com${videoUrl}`;

const file = fs.createWriteStream('output.mp4');

https.get(fullUrl, {
  headers: { 'Authorization': 'Bearer sk_your_api_key' }
}, (response) => {
  response.pipe(file);
  file.on('finish', () => {
    file.close();
    console.log('Video saved to output.mp4');
  });
});

Optimize Prompt

Submit a rough prompt and receive an AI-enhanced version optimized for video generation quality. This is the same enhancement applied when you click "Optimize" in the Studio UI.

POST /api/video/optimize-prompt AI-enhance a text prompt
Parameter Type Description
prompt string required The raw prompt to enhance.
200 OK 401 Unauthorized 500 Server Error
200 OK
{
  "optimized_prompt": "Cinematic aerial drone footage sweeping over..."
}

Errors

All error responses use standard HTTP status codes and return a JSON body with a detail field.

Status Meaning
400 Bad request — missing or invalid parameter.
401 Unauthorized — API key missing, invalid, or revoked.
402 Insufficient balance — top up your account to continue.
403 Forbidden — you don't own this resource.
404 Not found — task or key does not exist.
500 Server error — contact [email protected] if it persists.
Error Response Shape
{
  "detail": "Human-readable error message"
}