---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://framesfield.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
title: "Python API and Headless Media Batch Automation Skills"
description: "Production rulebooks, validated ComfyUI HTTP/WebSocket API JSON graphs, and media MCP bridges for automating Gemini Omni 1.2 Flash, Kling 4.0, Runway Gen-4 / Gen-4.5, Nano Banana 2.1, fal.ai Seedance/Seedream, Deepgram Aura-2 / ElevenLabs TTS, Whisper transcription, Sharp WebP/AVIF, Satori OG cards, 300 DPI print exports, and local GPU render queues without runaway API spend."
canonical: "https://framesfield.com/skills/for/python-api"
---

# Python API and Headless Media Batch Automation Skills

> Production rulebooks, validated ComfyUI HTTP/WebSocket API JSON graphs, and media MCP bridges for automating Gemini Omni 1.2 Flash, Kling 4.0, Runway Gen-4 / Gen-4.5, Nano Banana 2.1, fal.ai Seedance/Seedream, Deepgram Aura-2 / ElevenLabs TTS, Whisper transcription, Sharp WebP/AVIF, Satori OG cards, 300 DPI print exports, and local GPU render queues without runaway API spend.

- **Canonical URL:** https://framesfield.com/skills/for/python-api
- **Target Install Path:** `.claude/skills/<name>/SKILL.md  |  .agents/skills/<name>/SKILL.md  |  ComfyUI http://127.0.0.1:8188/prompt`
- **Verified Modules:** 31
- **Last Verified:** 2026-12-01

## Host Architecture

Creative media APIs behave nothing like standard synchronous REST CRUD endpoints. A single Google Gemini Omni 1.2 Flash, Kling 4.0, Runway Gen-4.5, or fal.ai Seedance 1.0 Pro call takes 40 to 180 seconds, bills `$0.25–$1.18+` per render, returns ephemeral signed URLs that expire within hours, and silently double-bills your account if a naive retry loop re-submits completed jobs after a network hiccup. Likewise, local ComfyUI servers expose an asynchronous HTTP (`POST /prompt`, `GET /history/<id>`) and WebSocket execution model that rejects raw UI JSON with `"Prompt has no outputs"` unless properly wrapped in `{"prompt": graph}`. This directory unifies every FramesField Python, Node.js Sharp/Satori, ComfyUI API JSON, and media MCP skill around deterministic studio batch engineering: two-stage keyframe-then-motion manifests, content-hashed disk caches for idempotent restarts, bounded concurrency semaphores, immediate local persistence with `ffprobe` / Sharp verification, and hard `MAX_BATCH_USD` dry-run guards.

## Quickstart (install-python-media-batch-stack.sh)

```bash
# 1. Install verified async cloud & local batch SKILL.md contracts from /raw/skills/
mkdir -p .agents/skills/video-api-batch-runner   .agents/skills/seedance-seedream-batch   .agents/skills/tts-foley-batch   .agents/skills/comfyui-batch-runner

curl -fsSL https://framesfield.com/raw/skills/veo-kling-api-batch-runner   -o .agents/skills/video-api-batch-runner/SKILL.md
curl -fsSL https://framesfield.com/raw/skills/seedance-seedream-fal-batch-skill   -o .agents/skills/seedance-seedream-batch/SKILL.md
curl -fsSL https://framesfield.com/raw/skills/openai-elevenlabs-narration-batch-skill   -o .agents/skills/tts-foley-batch/SKILL.md
curl -fsSL https://framesfield.com/raw/skills/comfyui-headless-batch-runner-skill   -o .agents/skills/comfyui-batch-runner/SKILL.md

# 2. Download a validated Apache 2.0 ComfyUI API JSON graph for local HTTP queuing
curl -fsSL https://framesfield.com/raw/skills/comfyui-flux-schnell-apache-4step-graph   -o flux_schnell.api.json

# 3. Verify YAML frontmatter and strict JSON integrity before writing batch scripts
head -n 3 .agents/skills/video-api-batch-runner/SKILL.md
python3 -m json.tool flux_schnell.api.json > /dev/null && echo "ComfyUI API JSON valid"
```

## All 31 Verified Python & Batch APIs Modules

| # | Name | Type | Target Tool | Docs URL | Raw Payload URL |
| --- | --- | --- | --- | --- | --- |
| 04 | ComfyUI Wan 2.2 Dual-Expert I2V Graph | ComfyUI JSON | ComfyUI | https://framesfield.com/skills/comfyui-character-turnaround | https://framesfield.com/raw/skills/comfyui-character-turnaround |
| 09 | ElevenLabs Official MCP Voice and SFX Setup | MCP Server | ElevenLabs | https://framesfield.com/skills/elevenlabs-mcp-voice-sfx-setup | https://framesfield.com/raw/skills/elevenlabs-mcp-voice-sfx-setup |
| 10 | ComfyUI FLUX.1 Kontext / Dev Keyframe Batch Graph | ComfyUI JSON | ComfyUI / FLUX FP8 | https://framesfield.com/skills/comfyui-flux-kontext-keyframe-graph | https://framesfield.com/raw/skills/comfyui-flux-kontext-keyframe-graph |
| 14 | Video API Async Polling and Batch Render Skill | SKILL.md | Gemini Omni Flash / Kling 4.0 / Runway APIs | https://framesfield.com/skills/veo-kling-api-batch-runner | https://framesfield.com/raw/skills/veo-kling-api-batch-runner |
| 21 | Whisper Transcription and ASS Caption Skill | SKILL.md | OpenAI Audio API / whisper.cpp | https://framesfield.com/skills/whisper-srt-and-ass-caption-pipeline-skill | https://framesfield.com/raw/skills/whisper-srt-and-ass-caption-pipeline-skill |
| 23 | ComfyUI Headless API Batch Runner Skill | SKILL.md | ComfyUI HTTP / WebSocket API | https://framesfield.com/skills/comfyui-headless-batch-runner-skill | https://framesfield.com/raw/skills/comfyui-headless-batch-runner-skill |
| 24 | TTS Voiceover and Foley Stem Batch Skill | SKILL.md | Deepgram Aura-2 / Cartesia Sonic / ElevenLabs | https://framesfield.com/skills/openai-elevenlabs-narration-batch-skill | https://framesfield.com/raw/skills/openai-elevenlabs-narration-batch-skill |
| 28 | Replicate Official Media Model MCP Server | MCP Server | Replicate (Multi-Model Media API) | https://framesfield.com/skills/replicate-media-mcp-setup | https://framesfield.com/raw/skills/replicate-media-mcp-setup |
| 29 | ComfyUI Lightricks LTX-2 I2V Video Graph | ComfyUI JSON | ComfyUI / Lightricks LTX-2 | https://framesfield.com/skills/comfyui-ltx2-audio-video-graph | https://framesfield.com/raw/skills/comfyui-ltx2-audio-video-graph |
| 31 | Sharp WebP, AVIF and Responsive Image Skill | SKILL.md | Node.js Sharp / WebP & AVIF | https://framesfield.com/skills/sharp-responsive-webp-image-pipeline-skill | https://framesfield.com/raw/skills/sharp-responsive-webp-image-pipeline-skill |
| 33 | Satori OG Image and SVG Data Chart Skill | SKILL.md | Satori / Sharp / SVG-to-WebP | https://framesfield.com/skills/satori-og-card-and-chart-generator-skill | https://framesfield.com/raw/skills/satori-og-card-and-chart-generator-skill |
| 37 | ComfyUI FLUX High-Res 4x Upscale Graph | ComfyUI JSON | ComfyUI / 4x-UltraSharp / Print 300 DPI | https://framesfield.com/skills/comfyui-flux-upscale-and-inpaint-graph | https://framesfield.com/raw/skills/comfyui-flux-upscale-and-inpaint-graph |
| 38 | FFmpeg Motion Titles and Safe End-Card Skill | SKILL.md | FFmpeg / PNG Overlay / Satori | https://framesfield.com/skills/motion-graphics-lower-thirds-ffmpeg-skill | https://framesfield.com/raw/skills/motion-graphics-lower-thirds-ffmpeg-skill |
| 39 | Seedance 2.5 Video and Seedream 5.5 API Batch Skill | SKILL.md | Seedream 5.5 / Seedance 2.5 / fal.ai | https://framesfield.com/skills/seedance-seedream-fal-batch-skill | https://framesfield.com/raw/skills/seedance-seedream-fal-batch-skill |
| 40 | Print 300 DPI Bleed and Sharp Export Skill | SKILL.md | Sharp / 300 DPI Print / ComfyUI 4x | https://framesfield.com/skills/print-300dpi-cmyk-bleed-export-skill | https://framesfield.com/raw/skills/print-300dpi-cmyk-bleed-export-skill |
| 45 | ComfyUI FLUX.1 Schnell 4-Step Commercial Graph | ComfyUI JSON | ComfyUI / FLUX.1 Schnell (Apache 2.0) | https://framesfield.com/skills/comfyui-flux-schnell-apache-4step-graph | https://framesfield.com/raw/skills/comfyui-flux-schnell-apache-4step-graph |
| 46 | Multilingual Ad Localization Script Builder | Prompt Framework | ElevenLabs TTS / Deepgram Aura-2 / Cartesia Sonic / Gemini Omni Flash | https://framesfield.com/skills/multilingual-ad-localization-script-prompt | https://framesfield.com/raw/skills/multilingual-ad-localization-script-prompt |
| 49 | ComfyUI Wan 2.2 I2V 121-Frame Apache 2.0 Graph | ComfyUI JSON | ComfyUI / Alibaba Wan 2.2 I2V (Apache 2.0) | https://framesfield.com/skills/comfyui-wan-2-2-i2v-apache-graph | https://framesfield.com/raw/skills/comfyui-wan-2-2-i2v-apache-graph |
| 52 | 30-Second Voiceover Script Builder (75 Words, Written to Be Spoken) | Prompt Framework | ElevenLabs / Deepgram Aura-2 / Cartesia Sonic / any text-to-speech tool | https://framesfield.com/skills/thirty-second-voiceover-script-builder | https://framesfield.com/raw/skills/thirty-second-voiceover-script-builder |
| 58 | Topaz 4K Upscale & Sync Lipsync 2.0 fal.ai Batch Skill | SKILL.md | fal.ai Queue API / Topaz Video API / Sync Lipsync 2.0 / FFmpeg | https://framesfield.com/skills/topaz-upscale-and-sync-lipsync-fal-skill | https://framesfield.com/raw/skills/topaz-upscale-and-sync-lipsync-fal-skill |
| 59 | Kokoro-82M Local Apache 2.0 TTS Batch Skill | SKILL.md | Kokoro-82M (Apache 2.0) / Python / FFmpeg | https://framesfield.com/skills/kokoro-local-apache-tts-batch-skill | https://framesfield.com/raw/skills/kokoro-local-apache-tts-batch-skill |
| 61 | Commercial Music Brief & Stem Prompt Builder | Prompt Framework | ElevenLabs Music API / Suno v6 Pro / Stable Audio Open | https://framesfield.com/skills/commercial-music-brief-and-stem-prompt-builder | https://framesfield.com/raw/skills/commercial-music-brief-and-stem-prompt-builder |
| 62 | ElevenLabs Music & Topaz Print Upscale fal.ai Skill | SKILL.md | fal.ai API / ElevenLabs Music / Topaz Image Upscale / FFmpeg | https://framesfield.com/skills/elevenlabs-music-and-topaz-print-upscale-fal-skill | https://framesfield.com/raw/skills/elevenlabs-music-and-topaz-print-upscale-fal-skill |
| 66 | FASHN Virtual Try-On & SeedVR2 Video Upscale fal.ai Skill | SKILL.md | fal.ai API / FASHN Try-On v1.6 / ByteDance SeedVR2 / FFmpeg | https://framesfield.com/skills/fashn-virtual-tryon-and-seedvr2-upscale-fal-skill | https://framesfield.com/raw/skills/fashn-virtual-tryon-and-seedvr2-upscale-fal-skill |
| 67 | ElevenLabs Scribe v2 STT to Synced SRT & 9:16 ASS Captions Skill | SKILL.md | fal.ai API / ElevenLabs Scribe v2 / Python / FFmpeg | https://framesfield.com/skills/elevenlabs-scribe-stt-to-srt-and-ass-captions-skill | https://framesfield.com/raw/skills/elevenlabs-scribe-stt-to-srt-and-ass-captions-skill |
| 69 | Podcast & Audiobook Script Pacing Prompt Builder | Prompt Framework | Claude / ChatGPT / Gemini -> Kokoro 82M / Chatterbox TTS / ElevenLabs | https://framesfield.com/skills/podcast-and-audiobook-script-pacing-prompt-builder | https://framesfield.com/raw/skills/podcast-and-audiobook-script-pacing-prompt-builder |
| 70 | Bria RMBG 2.0, BiRefNet v2 & IC-Light V2 fal.ai Skill | SKILL.md | fal.ai API / Bria RMBG 2.0 / BiRefNet v2 / IC-Light V2 | https://framesfield.com/skills/bria-rmbg-birefnet-and-iclight-relight-fal-skill | https://framesfield.com/raw/skills/bria-rmbg-birefnet-and-iclight-relight-fal-skill |
| 71 | ElevenLabs Audio Isolation & ACX / Podcast RSS Master Skill | SKILL.md | fal.ai API / ElevenLabs Audio Isolation / FFmpeg / ffprobe | https://framesfield.com/skills/elevenlabs-audio-isolation-and-acx-master-skill | https://framesfield.com/raw/skills/elevenlabs-audio-isolation-and-acx-master-skill |
| 72 | FLUX LoRA Dataset Captioning & Training Prompt Builder | Prompt Framework | FLUX LoRA Fast Trainer / fal-ai/flux-lora / Local ComfyUI | https://framesfield.com/skills/flux-lora-dataset-captioning-and-training-prompt-builder | https://framesfield.com/raw/skills/flux-lora-dataset-captioning-and-training-prompt-builder |
| 74 | FLUX LoRA Training & Wan VACE 14B fal.ai Skill | SKILL.md | fal.ai Queue API / FLUX LoRA / Wan VACE 14B / FFmpeg | https://framesfield.com/skills/flux-lora-training-and-wan-vace-fal-skill | https://framesfield.com/raw/skills/flux-lora-training-and-wan-vace-fal-skill |
| 75 | Meta SAM 2 Video Masking & Kling O1 V2V fal.ai Skill | SKILL.md | fal.ai Queue API / Meta SAM 2 / Kling O1 V2V Edit / FFmpeg | https://framesfield.com/skills/sam2-video-masking-and-kling-o1-v2v-fal-skill | https://framesfield.com/raw/skills/sam2-video-masking-and-kling-o1-v2v-fal-skill |

## Recommended Starter Bundles

1. **Cloud Async Video & Multilingual Audio Batch Engine:** `Video API Async Batch Runner (Skill 14) + Seedance/Seedream fal.ai Batch (Skill 39) + TTS & Foley Batch (Skill 24) + Whisper ASS Captions (Skill 21)` — Process 50+ SKU rows from CSV into locked 4K keyframes, Gemini Omni 1.2 Flash / Kling 4.0 / Runway Gen-4.5 clips, timed Deepgram Aura-2 or ElevenLabs narration stems, and word-accurate ASS subtitles with resumable spend caps.
2. **Offline Apache 2.0 Local ComfyUI Render Farm:** `ComfyUI Headless Batch Runner (Skill 23) + FLUX.1 Schnell Apache Graph (Skill 45) + Wan 2.2 Apache I2V Graph (Skill 49) + 4x-UltraSharp Print Upscaler (Skill 37)` — Queue zero-API-cost commercial stills, 300 DPI print upscales, and 121-frame local video clips overnight over `127.0.0.1:8188` with full Apache 2.0 commercial clearance.
3. **Programmatic Web Graphics, OG Cards & Print Packaging Pipeline:** `Satori OG & SVG Chart Generator (Skill 33) + Sharp Responsive WebP/AVIF (Skill 31) + Print 300 DPI CMYK Export (Skill 40)` — Automate build-time social cards, multi-width responsive WebP/AVIF asset sets, and print-ready bleed-expanded packaging artwork inside Node.js or Python CI pipelines.

## Best Practices

1. **Require deterministic manifest keys and --dry-run budget ceilings on every script:** Hash `{model, prompt, seed, resolution, duration}` into a deterministic output filename and record job status inside a local `manifest.jsonl` file. Running `--dry-run` first prints total estimated dollar spend against `MAX_BATCH_USD`, and resuming after a crash skips already-verified renders with zero duplicate billing.
2. **Separate cheap still keyframes ($0.03–$0.04) from video motion ($0.25–$1.18+):** Never batch-render 50 raw text-to-video takes blindly. Run Stage 1 image generation first (Nano Banana 2.1, Seedream 4.5, FLUX.1 Kontext Pro, or local Apache 2.0 FLUX.1 Schnell at `$0`), inspect a contact sheet for label accuracy and framing, and only enqueue Stage 2 Image-to-Video jobs for human-approved keyframes.
3. **Use bounded concurrency, jittered polling, and immediate local downloads:** Cap concurrent API submissions to 3–5 in-flight workers, honor `Retry-After` on HTTP 429, poll status endpoints with capped exponential backoff (3s -> 20s), and immediately stream completed MP4/PNG/WAV files from expiring vendor CDN links to durable storage followed by `ffprobe` or Sharp integrity validation.
4. **Wrap every ComfyUI API graph in {"prompt": graph} and purge VRAM between model swaps:** When automating local GPUs via `http://127.0.0.1:8188/prompt`, load clean API-format JSON, inject per-SKU prompt text and integer seeds into target node IDs, listen for execution completion via WebSocket or `/history/<prompt_id>`, and call `POST /free` between heavy checkpoint switches on 12GB–16GB cards.

## Troubleshooting

- **Video API batch script stalls on polling, triggers HTTP 429 errors, or double-bills retries:** Implement idempotent job-ID caching in `manifest.jsonl`, separate submission from status polling with bounded semaphores (`asyncio.Semaphore(4)`), and compare exact per-second API unit pricing before scaling beyond 10 takes. (https://framesfield.com/best/cheapest-ai-video-apis)
- **Python POST to ComfyUI http://127.0.0.1:8188/prompt fails with HTTP 400 "Prompt has no outputs":** Ensure your script sends `{"prompt": graph}` (not the raw flat node dictionary) and uses verified API-format graphs containing a real terminal `SaveImage` or `SaveVideo` node. (https://framesfield.com/fixes/comfyui-prompt-has-no-outputs-api-error)
- **Overnight local GPU batch renders crash halfway through with torch.OutOfMemoryError:** Keep `batch_size=1` inside all local graphs, launch ComfyUI with `PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True` and `--lowvram`, switch `VAEDecode` to `VAEDecodeTiled`, and validate card headroom in our VRAM Calculator. (https://framesfield.com/fixes/comfyui-cuda-out-of-memory-16gb-gpu)
- **Automated packaging print exports fail prepress checks for dull CMYK color or missing bleed:** Run Skill 40 (`print-300dpi-cmyk-bleed-export-skill`) with exact 300 DPI pixel dimensions plus 0.125-inch (3mm) bleed expansion and ICC profile conversion rather than sending raw RGB PNGs to print vendors. (https://framesfield.com/fixes/cmyk-print-colors-muddy-and-bleed-rejected-fix)

## FAQs

### How do I prevent a Python video batch script from burning hundreds of dollars in an accidental retry loop?

Enforce three safeguards taught across Skill 14 and Skill 39: require an explicit `--dry-run` flag that calculates worst-case unit cost before sending any live request, abort if projected spend exceeds `MAX_BATCH_USD`, and persist every submitted provider `job_id` and completed file hash to a local `manifest.jsonl` so restarts poll or skip existing work instead of re-submitting.

### When should a headless batch pipeline call cloud APIs versus a local ComfyUI HTTP queue?

Route to cloud APIs (Gemini Omni 1.2 Flash, Kling 4.0, Runway Gen-4 / Gen-4.5, Seedance 1.0 Pro, Deepgram Aura-2, ElevenLabs) when you need native audio-video lip-sync, sub-minute parallel burst throughput, or zero local GPU maintenance. Route to local ComfyUI HTTP queues (FLUX.1 Schnell, Wan 2.2, LTX-2.5, 4x-UltraSharp) when running high-volume overnight SKU batches, strict NDA client assets that cannot leave your network, or $0-per-render commercial Apache 2.0 loops.

### Why do FramesField batch skills split keyframe generation and video animation into two separate stages?

Still keyframes cost `$0.03–$0.04` (or `$0` locally on FLUX.1 Schnell), whereas 5–8 second video takes cost `$0.25–$1.18+` and frequently require 2–3 retries when prompted blind. Generating and approving keyframes first cuts total campaign API spend by 40%–65% while guaranteeing product labels and character faces stay locked.

### Can the Node.js Sharp, Satori, and FFmpeg skills run inside headless CI runners like GitHub Actions?

Yes. Sharp WebP/AVIF compression (Skill 31), Satori SVG/PNG OG card rendering (Skill 33), print bleed sizing (Skill 40), and FFmpeg finishing run deterministically on standard Linux CI runners with zero GPU requirements—making them ideal for automated e-commerce catalog builds and programmatic marketing pipelines.

### How do I keep programmatically generated Deepgram or ElevenLabs narration synced with Whisper captions?

Generate dry 48 kHz WAV narration stems per beat (using Deepgram Aura-2, Cartesia Sonic-3.6, or ElevenLabs via Skill 24 `openai-elevenlabs-narration-batch-skill`—avoiding OpenAI `/v1/audio/speech` TTS, which shuts down January 6, 2027), probe exact stem durations with `ffprobe`, transcribe the finalized audio through Skill 21 (`whisper-srt-and-ass-caption-pipeline-skill`) with `timestamp_granularities=["word"]`, and burn or mux captions only after final edit timing is locked.
