ClipSDKDOCS
Quickstart (Python)

ClipSDK Python Quickstart

Automate short-form video clipping in Python 3 with zero third-party SDK dependencies. Create clips, long-poll job status, upload 5 GB local files, and download MP4 + SRT files.

Auth Header
Bearer csdk_live_...
Create keys at clipsdk.com/dashboard/keys
Default Wait
60 seconds
Tune ?wait=0..300 or Prefer: respond-async
Free First Video
$0 up to 60m
Test full output before adding prepaid credit

Get Your ClipSDK API Key

ClipSDK authenticates every /v1/* endpoint with Authorization: Bearer csdk_live_... and gives every new account a $0 free first video up to 60 minutes.

Generate a live key in the dashboard at clipsdk.com/dashboard/keys and export it as CLIPSDK_KEY. Never embed live keys in browser bundles; call https://api.clipsdk.com from your backend or connect AI agents through https://mcp.clipsdk.com/mcp.

Export your API keybash
export CLIPSDK_KEY="csdk_live_replace_with_your_key"

Create Ranked Clips in Python

Send one POST https://api.clipsdk.com/v1/clips request in Python with an Idempotency-Key header to transcribe, rank, reframe to 9:16, and burn karaoke captions automatically.

clip_video.py (Python 3 stdlib)python
import json
import os
import time
import urllib.error
import urllib.request
import uuid

API_KEY = os.environ["CLIPSDK_KEY"]
BASE = "https://api.clipsdk.com"

def api_call(method: str, path: str, body=None, idempotency_key: str | None = None):
    headers = {"Authorization": f"Bearer {API_KEY}", "Accept": "application/json"}
    data = None
    if body is not None:
        headers["Content-Type"] = "application/json"
        data = json.dumps(body).encode("utf-8")
    if idempotency_key:
        headers["Idempotency-Key"] = idempotency_key

    req = urllib.request.Request(f"{BASE}{path}", data=data, headers=headers, method=method)
    with urllib.request.urlopen(req, timeout=90) as resp:
        retry_after = int(resp.headers.get("Retry-After", "5"))
        return resp.status, retry_after, json.loads(resp.read().decode("utf-8"))

status, retry_after, payload = api_call(
    "POST",
    "/v1/clips?wait=60",
    {
        "video_url": "https://www.youtube.com/watch?v=VIDEO_ID",
        "clips": 5,
        "min_seconds": 20,
        "max_seconds": 60,
        "aspect": "9:16",
        "reframe": "auto",
        "captions": "karaoke",
        "hook": True,
    },
    idempotency_key=f"quickstart-{uuid.uuid4().hex}",
)

job = payload["job"]
while job["status"] in ("queued", "running"):
    time.sleep(retry_after)
    status, retry_after, payload = api_call("GET", f"/v1/jobs/{job['id']}?wait=60")
    job = payload["job"]

if job["status"] != "succeeded":
    raise RuntimeError(f"ClipSDK job failed: {job['error']}")

for clip in job["result"]["clips"]:
    print(f"#{clip['rank']} [{clip['score']}/100] {clip['title']} -> {clip['video']}")

Inspect Returned Clips & Scores

ClipSDK returns HTTP 200 once a job finishes, sorting clips best-first with 0-100 standalone scores, MP4 links, JPG posters, SRT/VTT captions, and billing metadata.

Finished JobEnvelope responsejson
{
  "job": {
    "id": "job_3k9x0c2m1q8w7e6r5t4y",
    "op": "clips",
    "status": "succeeded",
    "stage": null,
    "usage": { "source_minutes": 42.5, "clips": 5, "output_seconds": 214.8 },
    "pricing": { "basis": "source_minutes", "reason": null, "quality_multiplier": 1 },
    "result": {
      "source": { "duration_s": 2550, "language": "en", "speakers": null },
      "clips": [
        {
          "rank": 1,
          "score": 92,
          "title": "Why usage-based video APIs beat seat licenses",
          "reason": "Opens with a bold claim and lands a concrete math proof in 41 seconds.",
          "start_s": 412.4,
          "end_s": 453.6,
          "duration_s": 41.2,
          "post_caption": "Flat seat subscriptions punish irregular publishing schedules...",
          "video": "https://api.clipsdk.com/f/clip_1_1080x1920.mp4",
          "poster": "https://api.clipsdk.com/f/clip_1_poster.jpg",
          "srt": "https://api.clipsdk.com/f/clip_1.srt",
          "vtt": "https://api.clipsdk.com/f/clip_1.vtt"
        }
      ],
      "locked": null
    },
    "error": null,
    "poll_url": "https://api.clipsdk.com/v1/jobs/job_3k9x0c2m1q8w7e6r5t4y"
  }
}
Score BandMeaningRecommended Action
80-100Strong standalone hook and payoff for cold viewersAuto-publish or queue straight to Shorts, Reels, and TikTok
50-79Good insight that benefits from a sharper opening titleAdd or tune a hook headline or trim opening filler via /edit
0-49Context-dependent or housekeeping momentFilter out automatically or request extra cuts with from_job

Upload Local Video Files in Python

ClipSDK supports local MP4, MOV, WebM, and MKV files up to 5 GB through POST /v1/uploads, returning a 1-hour presigned PUT URL and 7-day video_url.

Do Not Send Authorization on the Presigned PUT

Include Authorization: Bearer csdk_live_... on POST /v1/uploads, then omit Authorization on the direct PUT to upload_url and send the exact Content-Length byte count.

upload_local.py (Presigned PUT up to 5 GB)python
import json, os, urllib.request

API_KEY = os.environ["CLIPSDK_KEY"]
path = "./episode-42.mp4"
size = os.path.getsize(path)

req = urllib.request.Request(
    "https://api.clipsdk.com/v1/uploads",
    data=json.dumps({"filename": os.path.basename(path), "size": size}).encode("utf-8"),
    headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"},
    method="POST",
)
with urllib.request.urlopen(req, timeout=30) as resp:
    ticket = json.loads(resp.read().decode("utf-8"))

# PUT raw bytes directly to storage without an Authorization header
with open(path, "rb") as fh:
    put_req = urllib.request.Request(
        ticket["upload_url"],
        data=fh,
        headers={"Content-Length": str(size)},
        method="PUT",
    )
    with urllib.request.urlopen(put_req, timeout=600) as put_resp:
        assert 200 <= put_resp.status < 300

print("Ready for POST /v1/clips:", ticket["video_url"])

Sync Wait vs Async Webhooks

Use ?wait=60 for CLI scripts and short videos, or send Prefer: respond-async with webhook_url in production SaaS backends to avoid tying up HTTP workers.

ModeRequest OptionBest Fit
Long-poll createPOST /v1/clips?wait=60 (max 300)CLI scripts, agent tools, and short 1-10 minute sources
Immediate async?wait=0 or Prefer: respond-asyncWeb apps queueing work and listening on webhook_url
Safe retriesIdempotency-Key: <unique-id> (24h TTL)Network retry loops without duplicating render spend

Next Steps After Your First Clip

Move from quickstart to production with full parameter schemas, custom caption presets, HMAC-SHA256 webhook verification, and AI agent skills.