Video API

Generate video clips from text or images. 104 models from $0.04/clip. Async with polling and webhooks.

Async API. Video generation is asynchronous. You submit a job and poll GET /v1/jobs/:id for the result, or use a webhook callback.

POST /v1/generations/video

Submit a video generation job. Returns a job ID for async polling.

Request body

FieldTypeRequiredDescription
modelstringYesModel key (e.g. "wan-2-1-t2v", "kling-2-1-std-i2v", "veo-3"). See Model Catalog.
promptstringYesText description of the video to generate.
imagestring (URL)NoSource image for image-to-video models (i2v).
durationnumberNoDuration in seconds. Model-dependent (typically 3-10s).
aspect_ratiostringNo"16:9", "9:16", "1:1". Default varies by model.
resolutionstringNo"720p" or "1080p". Default: "720p".
webhook_urlstring (URL)NoURL to POST the result to when complete.
confirmbooleanNoSet to false for cost estimate only. Default: true.

Response fields (on submit)

FieldTypeDescription
idstringJob ID (job_ prefix). Use with GET /v1/jobs/:id.
statusstring"queued" on submit.
estimated_costobjectEstimated cost (micro + display).

Response fields (on completion)

FieldTypeDescription
idstringJob ID.
statusstring"completed" or "failed".
urlstringCDN URL of the generated MP4.
cost.microintegerActual cost in microdollars.
cost.displaystringHuman-readable cost (e.g. "$0.048").
metadata.durationnumberVideo duration in seconds.
metadata.widthintegerVideo width in pixels.
metadata.heightintegerVideo height in pixels.
metadata.fpsintegerFrames per second.

Code examples

curl

curl -X POST https://api.fairstack.ai/v1/generations/video \
  -H "Authorization: Bearer $FAIRSTACK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan-2-1-t2v",
    "prompt": "A golden retriever running on a beach at sunset, slow motion"
  }'

Submit response:

{
  "id": "job_xyz789",
  "status": "queued",
  "estimated_cost": {
    "micro": 48000,
    "display": "$0.048"
  }
}

Python

from fairstack import FairStack

client = FairStack(api_key="fs_live_YOUR_KEY")

# Submit async video generation
job = client.generate.video(
    model="wan-2-1-t2v",
    prompt="A golden retriever running on a beach at sunset, slow motion"
)

# Poll for result
result = job.wait()  # blocks until complete
print(result.url)    # https://media.fairstack.ai/video/...
print(result.cost)   # $0.048

Node.js

import { FairStack } from "fairstack";

const client = new FairStack({ apiKey: "fs_live_YOUR_KEY" });

// Submit async video generation
const job = await client.generate.video({
  model: "wan-2-1-t2v",
  prompt: "A golden retriever running on a beach at sunset, slow motion",
});

// Poll for result
const result = await job.wait();
console.log(result.url);   // https://media.fairstack.ai/video/...
console.log(result.cost);  // { micro: 48000, display: "$0.048" }

Completed response

{
  "id": "job_xyz789",
  "status": "completed",
  "url": "https://media.fairstack.ai/video/.../output.mp4",
  "model": "wan-2-1-t2v",
  "modality": "video",
  "cost": {
    "micro": 48000,
    "display": "$0.048",
    "currency": "USD"
  },
  "metadata": {
    "width": 1280,
    "height": 720,
    "duration": 5,
    "fps": 24
  }
}

Cost estimation

Set confirm: false to get the exact cost without submitting the job.

curl -X POST https://api.fairstack.ai/v1/generations/video \
  -H "Authorization: Bearer $FAIRSTACK_API_KEY" \
  -d '{
    "model": "wan-2-1-t2v",
    "prompt": "test",
    "confirm": false
  }'

# Response (no video generated, no charge):
# { "estimated_cost": { "micro": 48000, "display": "$0.048" } }

Image-to-video

Many models support image-to-video generation. Include a source image URL:

{
  "model": "kling-2-1-std-i2v",
  "prompt": "Camera slowly zooms in, soft wind blowing hair",
  "image": "https://example.com/photo.jpg",
  "duration": 5,
  "aspect_ratio": "16:9"
}

Webhooks

Instead of polling, provide a webhook_url to receive a POST when the job completes:

{
  "model": "kling-2-1-std-i2v",
  "prompt": "Animate this portrait with gentle head movement",
  "image": "https://example.com/portrait.jpg",
  "webhook_url": "https://yourapp.com/hooks/fairstack"
}

The webhook payload is identical to the GET /v1/jobs/:id response.

Quality tiers

TierExample ModelPriceSpeedBest For
BudgetWan 2.1 T2V$0.04-0.06~30sPrototyping, social clips
StandardKling 2.1 Std$0.10-0.30~60sMarketing, product demos
PremiumVeo 3, Runway Gen-4$0.15-0.50~90sProfessional, cinematic

Next steps