PicX Studio

Python & JavaScript SDK for AI Video

Typed clients for JavaScript and Python. Submit a video, get a job handle back, and wait on it or take a webhook. Retries and errors are handled for you.

Get API key

API calls need credits. Packs from $5.

video.ts
import { randomUUID } from "node:crypto";
import {
  PicX,
  PicXGenerationFailedError,
  PicXInsufficientCreditsError,
  PicXPollingTimeoutError,
} from "picx-ai";

const picx = new PicX(process.env.PICX_API_KEY);

try {
  const job = await picx.video.create(
    {
      prompt: "a cinematic product shot of a smartwatch, slow orbit",
      model: "fal-ai/bytedance/seedance/v2",
      duration: 5,
      resolution: "720p",
      sound: true,
      aspect_ratio: "16:9",
      callback_url: "https://your-app.com/api/picx-hook",
    },
    // Keep this key with your job row. A retry with it charges once.
    { idempotencyKey: randomUUID() },
  );
  console.log("Queued:", job.id, job.status);

  // The webhook delivers the result. Polling is the fallback.
  const asset = await job.wait({ pollIntervalMs: 5_000, timeoutMs: 900_000 });
  console.log(asset.url, asset.credits_used);
} catch (err) {
  if (err instanceof PicXInsufficientCreditsError) {
    console.error("Top up your credits first.");
  } else if (err instanceof PicXGenerationFailedError) {
    // Credits for this generation are refunded automatically.
    console.error(err.generationId, err.generationStatus, err.message);
  } else if (err instanceof PicXPollingTimeoutError) {
    // Not failed, only still running. Resume with generations.get(id).
    console.error("Still running:", err.generationId, err.lastStatus);
  } else {
    throw err;
  }
}
  • Credits never expire
  • Failed generations refunded automatically
  • Commercial use on every plan
  • No auto-renew on crypto

An example result, and what it costs

Every response tells you the credits used, and agents can list each model’s price before spending anything.

Get API key
Still from a video of a steel chronograph watch on a reflective black surface
A cinematic product commercial featuring a luxury smartwatch on a reflective black surface. Dynamic orbit camera movement, fast push-in shot, dramatic lighting, ultra-realistic reflections, premium advertising style, smooth cinematic motion, 4K.Seedance 2.0 · 575 credits for 5s at 720p · prompt by Shan | Imagvio AI

Ways to integrate

One key and one balance across all four.

  • REST API

    Generate and edit images and video over HTTPS. Sync by default, webhooks when you want them.

    Quickstart
  • MCP server

    Let Claude, ChatGPT, Cursor, VS Code or Codex call PicX tools directly, signed in with your account.

    Connect a client
  • CLI

    picx-cli for the terminal and for agents that shell out. Every command speaks --json.

    Install the CLI
  • SDKs

    Typed clients for JavaScript/TypeScript (picx-ai on npm) and Python (picx-ai on PyPI).

    SDK examples

A full async video example

Video always runs as a job. Submit it, keep the id, then poll, take a webhook, or do both.

1. Install

terminal
npm install picx-ai   # JavaScript and TypeScript
pip install picx-ai   # Python (import picx)

2. Submit and wait

The submit answers at once with a job. wait() polls until the job finishes, and throws a typed error if it fails or runs out of time. In Python, AsyncPicX has the same methods for asyncio.

video.ts
import { randomUUID } from "node:crypto";
import {
  PicX,
  PicXGenerationFailedError,
  PicXInsufficientCreditsError,
  PicXPollingTimeoutError,
} from "picx-ai";

const picx = new PicX(process.env.PICX_API_KEY);

try {
  const job = await picx.video.create(
    {
      prompt: "a cinematic product shot of a smartwatch, slow orbit",
      model: "fal-ai/bytedance/seedance/v2",
      duration: 5,
      resolution: "720p",
      sound: true,
      aspect_ratio: "16:9",
      callback_url: "https://your-app.com/api/picx-hook",
    },
    // Keep this key with your job row. A retry with it charges once.
    { idempotencyKey: randomUUID() },
  );
  console.log("Queued:", job.id, job.status);

  // The webhook delivers the result. Polling is the fallback.
  const asset = await job.wait({ pollIntervalMs: 5_000, timeoutMs: 900_000 });
  console.log(asset.url, asset.credits_used);
} catch (err) {
  if (err instanceof PicXInsufficientCreditsError) {
    console.error("Top up your credits first.");
  } else if (err instanceof PicXGenerationFailedError) {
    // Credits for this generation are refunded automatically.
    console.error(err.generationId, err.generationStatus, err.message);
  } else if (err instanceof PicXPollingTimeoutError) {
    // Not failed, only still running. Resume with generations.get(id).
    console.error("Still running:", err.generationId, err.lastStatus);
  } else {
    throw err;
  }
}

202 from POST /v1/videos/generate, example

{
  "id": "d3bfa107-6475-4f5b-ad32-c65c3e1b0377",
  "status": "pending",
  "type": "video",
  "model": "fal-ai/bytedance/seedance/v2",
  "created_at": "2026-06-17T20:00:00Z",
  "poll_url": "https://api.picxstudio.com/v1/generations/d3bfa107-6475-4f5b-ad32-c65c3e1b0377",
  "events_url": "https://api.picxstudio.com/v1/generations/d3bfa107-6475-4f5b-ad32-c65c3e1b0377/events",
  "webhook": null
}

GET /v1/generations/{id} when done, example

{
  "id": "d3bfa107-6475-4f5b-ad32-c65c3e1b0377",
  "status": "completed",
  "type": "video",
  "model": "fal-ai/bytedance/seedance/v2",
  "output_url": "https://cdn.picxstudio.com/generated/d3bfa107.mp4",
  "error_message": null,
  "credits_used": 575,
  "created_at": "2026-06-17T20:00:00Z",
  "completed_at": "2026-06-17T20:02:10Z"
}

3. Receive the webhook

With callback_url set, PicX sends a POST when the job completes or fails. Reply 2xx within 10 seconds. A delivery is tried up to 3 times, so it can arrive more than once. This handler uses the id to read the result back with your key. To verify signatures instead, register an endpoint in the console and check X-PicX-Signature with its secret, as the webhooks docs show.

app/api/picx-hook/route.ts
import { PicX } from "picx-ai";

const picx = new PicX(process.env.PICX_API_KEY);

export async function POST(req: Request) {
  // Deliveries are at-least-once. Retries reuse this id, so dedupe on it.
  const deliveryId = req.headers.get("x-picx-delivery");
  if (deliveryId && (await alreadyHandled(deliveryId))) {
    return new Response(null, { status: 204 });
  }

  const event = await req.json();

  // Read the result from the API with your key. Do not trust the POST body.
  const generation = await picx.generations.get(event.data.generation_id);

  if (generation.status === "completed") {
    await saveVideo(generation.id, generation.output_url, generation.credits_used);
  } else if (generation.status === "failed") {
    await markFailed(generation.id, generation.error_message);
  }

  return new Response(null, { status: 204 });
}

Pick a model

Live from GET /v1/models. Credits are for one generation; video is priced per second.

Modelmodel idCredits
GPT Image 2openai/gpt-image-21K 53 · 2K 53 · 4K 105 per image
GPT Image 2.5 Flareopenai/gpt-image-2.5/flare1K 53 · 2K 53 · 4K 105 per image
GPT Image 2.5 Sunburstopenai/gpt-image-2.5/sunburst1K 53 · 2K 53 · 4K 105 per image
Nano Banana Progemini-3-pro-image-preview1K 53 · 2K 53 · 4K 105 per image
Nano Banana 2gemini-3.1-flash-image-preview0.5K 30 · 1K 35 · 2K 53 · 4K 105 per image
Nano Banana 2 Litegoogle/nano-banana-2-lite1K 20 · 2K 20 · 4K 20 per image
Seedream 4.5fal-ai/bytedance/seedream/v4.51K 19 · 2K 32 · 4K 35 per image
Seedream 5 Litefal-ai/bytedance/seedream/v5/lite1K 16 · 2K 16 · 4K 30 per image
Seedream 5 Profal-ai/bytedance/seedream/v5/pro1K 20 · 2K 40 per image
Ideogram V4ideogram/v4/image-to-image1K 35 · 2K 35 · 4K 35 per image
Recraft V4.1fal-ai/recraft/v4.1/text-to-image1K 18 · 2K 18 · 4K 18 per image
Imagen 4google-deepmind/imagen-41K 12 · 2K 24 · 4K 35 per image
Nano Bananagoogle/nano-banana1K 15 · 2K 15 · 4K 15 per image
Nano Banana 2.1google/nano-banana-2-11K 35 · 2K 53 · 4K 105 per image
Seedream 5.0 Flashbytedance/seedream-5-flash1K 10 · 2K 10 per image
Seedream 4.0bytedance/seedream-4-01K 15 · 2K 15 · 4K 15 per image
Seedream 3.0bytedance/seedream-3-01K 10 per image
GPT Image 2.6 Flareopenai/gpt-image-2-6-flare1K 120 · 2K 285 · 4K 1035 per image
GPT Image 2.6 Economyopenai/gpt-image-2-6-flare/economy1K 20 per image
GPT Image 2.6 Sunburstopenai/gpt-image-2-6-sunburst1K 120 · 2K 285 · 4K 1035 per image
GPT Image 1.5openai/gpt-image-1-51K 16 · 2K 88 per image
4o Imageopenai/4o-image1K 24 per image
Wan 2.7 Imagealibaba-tongyi-wan/wan-2-7-image1K 14 · 2K 14 · 4K 34 per image
Grok Imagine Imagexai/grok-imagine-image1K 16 per image
Grok Imagine Image 2.0xai/grok-imagine-image-21K 16 per image
Qwen Imagealibaba-qwen/qwen-image1K 16 per image
Qwen Image Editalibaba-qwen/qwen-image-edit1K 24 per image
Qwen Image 2.0alibaba-qwen/qwen-image-21K 24 per image
Qwen Image 2.1alibaba-qwen/qwen-image-2-11K 16 · 2K 32 per image
Qwen Image 3alibaba-qwen/qwen-image-31K 26 · 2K 26 per image
Qwen Image 3 Proalibaba-qwen/qwen-image-3/pro1K 32 · 2K 54 per image
Z-Image Turboalibaba-tongyi-mai/z-image-turbo1K 5 per image
Topaz Image Upscalertopaz-labs/topaz-image-upscaler1K 56 · 2K 56 · 4K 56 per image
Ideogram V3ideogram/v31K 20 · 2K 20 · 4K 20 per image
FLUX.2 Problack-forest-labs/flux-21K 20 · 2K 28 per image
FLUX.2 Flexblack-forest-labs/flux-2/flex1K 56 · 2K 96 per image
FLUX.3 Kleinblack-forest-labs/flux-3-klein1K 7 · 2K 10 · 4K 26 per image
FLUX.1 Kontext Problack-forest-labs/flux-kontext1K 20 per image
FLUX.1 Kontext Maxblack-forest-labs/flux-kontext/max1K 40 per image
Ideogram Characterideogram/ideogram-character1K 72 per image
Recraft Remove Backgroundrecraft/recraft-remove-background1K 5 per image
Seedance 2.0fal-ai/bytedance/seedance/v2480p 53 · 720p 115 · 1080p 285 · 4k 580 per second, with sound
Seedance 2.0 Fastfal-ai/bytedance/seedance/v2/fast480p 33 · 720p 69 per second, with sound
Seedance 2.0 Minifal-ai/bytedance/seedance/v2/mini480p 25 · 720p 50 per second, with sound
Seedance 2.5bytedance/seedance-2.5480p 78 · 720p 175 · 1080p 440 per second, with sound
Wan 3.0alibaba/wan-3.0480p 23 · 720p 45 · 1080p 89 per second, with sound
Wan 3.0 Primealibaba/wan-3.0-prime480p 34 · 720p 70 · 1080p 140 per second, with sound
Kling 3.0 Profal-ai/kling-video/v3/pro1080p 84 per second, with sound
Kling 3.0 Pro Motionfal-ai/kling-video/v3/pro/motion-control1080p 84 per second, with sound
Happy Horse 1.1alibaba/happy-horse720p 63 · 1080p 81 per second, with sound
MiniMax H3minimax/h3480p 30 · 768p 39 · 2K 55 · 4k 75 per second, with sound
MiniMax H3 Maxminimax/h3-max480p 30 · 768p 52 · 1080p 104 per second, with sound
MiniMax H3 Max Turbominimax/h3-max-turbo480p 15 · 768p 26 · 1080p 52 per second, with sound
MiniMax H3 Max Directorminimax/h3-max/director480p 52 · 768p 52 · 1080p 104 per second, with sound
FLUX.3blackforestlabs/flux-3720p 65 · 1080p 98 per second, with sound
FLUX.3 Extendblackforestlabs/flux-3/extend-video720p 157 · 1080p 179 per second, with sound
Kling 3.0 Standardfal-ai/kling-video/v3/standard720p 64 per second, with sound
Kling 3.0 Standard Motionfal-ai/kling-video/v3/standard/motion-control720p 64 per second, with sound
Grok Imaginexai/grok-imagine-video480p 32 · 720p 53 per second, with sound
Gemini Omni Flash 1.1google/gemini-omni-flash/v1.1/image-to-video720p 50 · 1080p 74 · 4k 147 per second, with sound
VEED Lip Syncveed/lipsync720p 8 per second, with sound
Veo 3.1 Fastgoogle-deepmind/veo-3-1720p 42 · 1080p 46 · 4k 125 per second, with sound
Seedance 1.0 Probytedance/seedance-1-0480p 8 · 720p 17 · 1080p 39 per second, with sound
Kling 4.0kuaishou-kling-ai/kling-4-0720p 80 · 1080p 120 per second, with sound
Kling 3.0 Turbokuaishou-kling-ai/kling-3-0-turbo720p 57 · 1080p 70 per second, with sound
Kling 3.0 Omnikuaishou-kling-ai/kling-3-0-omni720p 57 · 1080p 70 · 4k 210 per second, with sound
Kling 2.6kuaishou-kling-ai/kling-2-61080p 70 per second, with sound
Kling 2.5 Turbokuaishou-kling-ai/kling-2-5-turbo1080p 35 per second, with sound
Kling 2.1kuaishou-kling-ai/kling-2-1720p 30 · 1080p 49 per second, with sound
Wan 2.7alibaba-tongyi-wan/wan-2-7720p 45 · 1080p 67 per second, with sound
Wan 2.6alibaba-tongyi-wan/wan-2-6720p 39 · 1080p 59 per second, with sound
Wan 2.5alibaba-tongyi-wan/wan-2-5720p 34 · 1080p 56 per second, with sound
Wan 2.2 Turboalibaba-tongyi-wan/wan-2-2-turbo480p 6 · 720p 50 per second, with sound
Wan 2.2 Animatealibaba-tongyi-wan/wan-animate720p 35 per second, with sound
Grok Imagine 1.5xai/grok-imagine-1-5480p 32 · 720p 53 · 1080p 94 per second, with sound
Hailuo 2.3 Prominimax-hailuo-ai/hailuo-2-3768p 25 · 1080p 38 per second, with sound
Hailuo 2.3 Standardminimax-hailuo-ai/hailuo-2-3/standard768p 14 · 1080p 24 per second, with sound
Hailuo 02 Standardminimax-hailuo-ai/hailuo-02768p 14 · 512p 6 per second, with sound
Hailuo 02 Prominimax-hailuo-ai/hailuo-02/pro1080p 27 per second, with sound
PixVerse V6pixverse/pixverse-v6720p 27 · 360p 16 · 540p 20 · 1080p 52 per second, with sound
PixVerse V6 Maxpixverse/pixverse-v6/max720p 34 · 360p 20 · 540p 25 · 1080p 63 per second, with sound
Vidu Q4shengshu-vidu/vidu-q4720p 43 · 540p 20 · 1080p 54 · 2k 85 · 4k 175 per second, with sound
Topaz Video Upscalertopaz-labs/topaz-video-upscaler1080p 23 · 720p 23 · 4k 39 per second, with sound
Runwayrunway/runway720p 9 · 1080p 17 per second, with sound
AI Lip Syncvolcengine/lip-sync720p 23 per second, with sound
Seed Audio 1.0bytedance/seed-audio-1.0See docs
ElevenLabs TTS V3fal-ai/elevenlabs/tts/eleven-v3See docs
MiniMax Music 2.6fal-ai/minimax-music/v2.6See docs
ElevenLabs Musicfal-ai/elevenlabs/musicSee docs
Lyria2fal-ai/lyria2See docs
Sound Effects V2fal-ai/elevenlabs/sound-effects/v2See docs
Pulse STTsmallest/pulseSee docs
Talk to Agentsmallest/voice-agentSee docs
Gemini TTSgoogle/gemini-ttsSee docs
Suno V6suno/v6See docs
Suno Soundssuno/soundsSee docs

Built for production

  • Webhooks

    Register an endpoint, or bind one to a single job, and get a POST when it finishes.

    Webhooks docs
  • Async polling and SSE

    Video returns a job id at once. Poll GET /v1/generations/{id} or stream its events_url.

    Video reference
  • idempotency_key

    Retry a request safely. A replay returns the original generation and charges nothing.

    Quickstart
  • Refunds on failure

    When a generation fails, its credits go back to your balance automatically.

    Credit pricing

Rate limits

Limits apply per key. Read your exact values from GET /v1/account/tier, and honor Retry-After on a 429. Rate limit docs

What you can build

What the terms allow, in plain English.

UseStatus
Ads, listings and client work made with outputsAllowed
Selling prints or merchandise made with outputsAllowed
An AI feature inside a different product, through the APIAllowed
Reselling raw capacityAllowed
A substantially similar generator built on PicXAllowed
Sharing or reselling API keys, or transferring creditsNot allowed

Full wording in the Terms of Service.

Start at the price of a coffee

Credit packs from $5 with no plan needed, or plans from $11.99/month. Crypto only: no card, no KYC.

  • $5

    500 credits

  • $9

    1,000 credits

  • $29

    3,200 credits

  • $59

    6,500 credits

The API and MCP spend the same credits as the app. See all prices · How paying with crypto works

Developer FAQ

Do I need a subscription?

No. Credit packs start at $5 and need no plan. Credits never expire. Plans start at $11.99/month if you would rather have a monthly refill.

What happens to credits when a generation fails?

Credits are taken at submit. If the job fails they go back automatically, and the SDK raises a typed error with the generation id and status.

Can I use this inside my own app?

Yes. An AI feature inside a different product, through the API, is allowed. Use your own key on your own backend. Sharing or reselling API keys, or transferring credits, is not allowed.

Which models can I call, and how do I pick?

GET /v1/models lists every model id with its credit price, and it needs no key. Pass the id as model. Pick by the price at your size and by the output you want. The playground is a quick way to compare them once you have credits.

Can my agent see prices before spending?

Yes. GET /v1/models returns each model's credit price without a key, and the MCP server has the same list as the picx_list_models tool. An agent can read the price and your balance before it spends anything.

How do I pay without a card?

Pay with crypto: it is the only checkout. 18 coins are accepted, including BTC, USDT, ETH and SOL. There is no KYC and nothing renews by itself.

What are the package names?

picx-ai on both npm and PyPI. In JavaScript, import { PicX } from "picx-ai". In Python, from picx import PicX.

Do the SDKs retry for me?

Yes, on rate limits, server errors and dropped connections. A POST is only retried when it has an idempotency key, so a retry can never charge you twice.

Can I call the SDK from the browser?

No. A key in the browser can be read by anyone. Call PicX from your backend and send the result to your frontend.

What if my server restarts during a job?

Nothing is lost. Save job.id when you submit, then read the job later with generations.get(id).

System status · Security policy

Add video to your app

Install the SDK, get a key, and buy a pack from $5.

Get API key