Black Friday: 50% off Ultra annual + Unlimited Seedance 2.5 for 7 days. · Terms apply
50% off Ultra annual + Unlimited Seedance 2.5 for 7 days · Terms applyBlack Friday: 50% off Ultra annual + Unlimited Seedance 2.5 for 7 days. · Terms apply
Describe the video you want to create...

How to run batch AI generations and script workflows with the CLI

Process hundreds of images, videos, or audio files in one command using manifests, concurrency control, and JSON output.

  • Category: SKILLS
  • Reading time: 7 min
  • Difficulty: Advanced

What you'll learn

  • Create JSON manifests for batch generation jobs
  • Control concurrency to balance speed and API limits
  • Pipe CLI output to jq, curl, or CI tools
  • Resume failed jobs and skip completed files
How to run batch AI generations and script workflows with the CLI

Run batch generations step by step

  1. STEP 1: Create a manifest file

    • On web: Go to picsart.com/cli → Download a sample manifest template
    • On mobile: Not applicable — batch jobs run in terminal only
    Get sample manifest
  2. STEP 2: Configure batch settings

    Set up your manifest and concurrency options:

    • Manifest format: JSON array with prompt, model, and output path for each job
    • Concurrency: Add --max-jobs 5 to run 5 generations in parallel (adjust based on your account limits)
    • Resume mode: The CLI skips files that already exist, so you can re-run after failures
    • Output directory: Use --output ./results to save all files to a specific folder
  3. STEP 3: Run the batch job

    Execute gen-ai batch --manifest prompts.json with your manifest file. The CLI processes all jobs in parallel based on your concurrency limit. Progress updates show how many jobs are complete, pending, or failed. Outputs save to your specified directory.

  4. STEP 4: Review and verify

    Check the output directory for completed files: Not perfect? Adjust prompts in your manifest and re-run. The CLI skips already-generated files and only processes new or failed jobs.

    • Verify all expected files were created
    • Check for failed jobs in the CLI output log
    • Inspect a sample of outputs to confirm quality meets your standards
    Start batch processing

Tips for best results

  • Start with low concurrency and scale up

    Begin with --max-jobs 3 to test your manifest structure and verify outputs. Once you confirm everything works, increase to --max-jobs 10 or higher. Too much concurrency can hit API rate limits or exhaust your credit balance faster than expected.

  • Use JSON output for piping to other tools

    Add --json to get structured output you can pipe to jq, curl, or CI scripts. Example: gen-ai batch --manifest prompts.json --json | jq -r '.results[].url' extracts just the file URLs. Perfect for posting results to Slack, uploading to S3, or triggering downstream automation.

  • Resume failed jobs without re-generating

    If a batch job fails midway, re-run the same command. The CLI checks your output directory and skips files that already exist. Only failed or pending jobs get processed. This saves time and credits when handling large batches.

  • Organize manifests by project or campaign

    Keep separate manifest files for different projects: product-catalog.json, social-campaign.json, blog-images.json. This makes it easier to re-run specific batches, track credit usage per project, and version-control your generation workflows.

Manifest structure reference

  • promptText description of what to generate
  • modelAI model to use (flux, recraft, sora, kling, etc.)
  • outputFile path where the result should be saved
  • typeGeneration type: image, video, or audio
  • aspectRatioCanvas shape: 16:9, 1:1, 9:16, etc. (image/video only)
  • countNumber of variations to generate per prompt
  • imageInput image path for I2V or editing workflows
  • videoInput video path for V2V or extend workflows

Frequently asked questions

  • Create a JSON file with an array of job objects. Each object needs at minimum a prompt, model, and output path. Example: [{"prompt": "sunset over ocean", "model": "flux", "output": "./images/sunset.png"}]. Save the file and run gen-ai batch --manifest jobs.json. The CLI validates the structure before starting. Download a sample template at picsart.com/cli.