Download CLAUDE.md from new-arc/vector: direct link, hf CLI and curl.
- Browser
- Download file 27.8 kB
-
https://huggingface.co/spaces/new-arc/vector/resolve/main/CLAUDE.md
- Command line
-
hf download hf://spaces/new-arc/vector/CLAUDE.md
-
curl -L -o CLAUDE.md https://huggingface.co/spaces/new-arc/vector/resolve/main/CLAUDE.md
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
SupoClip is an open-source alternative to OpusClip β an AI-powered video clipping tool that transforms long-form content into viral short clips. AGPL-3.0 licensed.
Development Commands
Docker (recommended)
docker-compose up -d # Start all 6 services
docker-compose up -d --build # Rebuild after changes
docker-compose logs -f backend # Debug backend
docker-compose logs -f worker # Debug video processing
docker-compose logs -f ai-worker # Debug AI editing in the clip studio
docker-compose down # Stop all services
Services: Frontend (:3107), Backend API (:8000, docs at /docs), Worker (ARQ), AI worker (ARQ, supoclip_ai queue), PostgreSQL (:5432), Redis (:6379)
Backend (local)
Uses uv (not pip/poetry). Requires Python 3.11+, ffmpeg, running PostgreSQL and Redis.
cd backend
uv venv .venv && source .venv/bin/activate
uv sync
# API server (uses refactored entry point)
uvicorn src.main:app --reload --host 0.0.0.0 --port 8000
# Worker process (required for video processing)
arq src.workers.tasks.WorkerSettings
Frontend (local)
cd frontend
pnpm install
pnpm run dev # Dev server with Turbopack
pnpm run build # Prisma generate + Next.js build
pnpm run lint
Tests
cd backend && .venv/bin/pytest # unit + integration (needs Postgres/Redis; TEST_DATABASE_URL)
cd backend && .venv/bin/pytest --no-cov tests/unit/test_workflow_options.py # one file (coverage gate is in addopts)
cd frontend && pnpm run test # vitest; pnpm run lint && pnpm exec tsc --noEmit
cd mcp && uv run --with pytest pytest tests -q
Architecture
System Overview
User β Frontend (Next.js 15) β Backend API (FastAPI) β Redis Queue β ARQ Worker
β β
PostgreSQL βββββββββββββββββββββββββββββββββ
Task creation returns immediately (<100ms). Video processing happens asynchronously in the worker. Frontend connects via SSE for real-time progress updates.
Backend: Layered Architecture
The backend uses the layered application in main.py; main_refactored.py is a compatibility import:
api/routes/ β HTTP handlers (tasks.py, media.py)
services/ β Business logic (task_service.py, video_service.py)
repositories/ β Raw SQL via asyncpg (task_repository.py, clip_repository.py, source_repository.py)
workers/ β ARQ job queue (tasks.py, job_queue.py, progress.py)
utils/ β Thread pool helpers for blocking operations (async_helpers.py)
Key patterns:
- All DB access goes through repository classes using raw SQL (
text()queries), not SQLAlchemy ORM - Blocking operations (video processing, downloads, transcription) wrapped in
run_in_thread()to avoid blocking the async event loop - Progress tracking uses Redis pub/sub β SSE to frontend
- Task status flow:
queued β processing β completed/error/cancelled
Video Processing Pipeline
- Input β YouTube URL (yt-dlp) or uploaded file
- Transcription β AssemblyAI word-level timestamps (cached as
.transcript_cache.json) - AI Analysis β Pydantic AI selects viral segments (15-60s each) with virality scoring. Transcripts over 15 min are analysed in 12-min windows (2-min overlap, 3 concurrent), deduplicated, then reranked together in one comparative call (
RERANK_LLM, defaultLLM); final count scales ~1 clip per 5 min, capped byMAX_CLIPS(default 10) - Clip Generation β MoviePy creates 9:16 clips with:
- Face-centered cropping: MediaPipe β OpenCV DNN β Haar cascade (fallback chain)
- Word-synced subtitles from AssemblyAI
- Custom fonts (TTF files in
backend/fonts/) - Optional transition effects (
backend/transitions/) - Optional B-roll overlays (Pexels API)
- Caption templates with animation styles
- Storage β Clips to
{TEMP_DIR}/clips/, metadata to PostgreSQL
Frontend Architecture
- Next.js 15 with App Router, React 19, TailwindCSS v4
- ShadCN UI (New York style, stone base color, Radix primitives)
- Better Auth with Prisma adapter for email/password auth
- No global state library β React hooks only (
useState,useEffect,useSession) - All pages use
"use client"β SSR is minimal - Prisma client generated to
frontend/src/generated/prisma/(custom output path) - Build:
prisma generate && next build(Prisma generate runs on both build and postinstall)
Auth flow: Frontend calls Better Auth β session cookie β passes user_id header to backend API
Database
PostgreSQL 15. Schema in init.sql. Mixed naming conventions:
tasks,sources,generated_clipsβ snake_casesession,account,verification,usersβ camelCase (Better Auth)- UUIDs stored as VARCHAR(36)
- Auto-update triggers on
updated_at/updatedAtcolumns
Key Backend Files
| File | Purpose |
|---|---|
src/main_refactored.py |
Compatibility import for existing deployments |
src/main.py |
Canonical FastAPI application factory |
src/api/routes/tasks.py |
Task CRUD, SSE progress, clip editing endpoints (711 lines) |
src/api/routes/media.py |
Fonts, transitions, uploads, templates |
src/services/task_service.py |
Task orchestration, clip editing logic (574 lines) |
src/services/video_service.py |
Video download, transcription, AI analysis, clip generation |
src/workers/tasks.py |
ARQ worker task definitions |
src/workers/job_queue.py |
Job queue management |
src/workers/progress.py |
Real-time progress via Redis |
src/ai.py |
Pydantic AI agents, system prompt, segment validation |
src/video_utils.py |
Video processing, cropping, subtitles (~820 lines) |
src/clip_editor.py |
Clip trim, split, merge, export presets |
src/editor_document.py |
Clip studio draft model (segments, words, captions, framing, B-roll) and server render |
src/workflows/ |
Workflows (series, topic, recap, trailer): contracts, options/gate, units, outline, planners, solvers |
src/services/ai_edit_service.py |
Studio AI editing: Sonnet 5.5 plans typed operations, applied and validated here |
src/workers/ai_worker.py |
Light ARQ worker for AI edits (supoclip_ai queue, own container) |
src/broll.py |
Pexels API B-roll integration |
src/caption_templates.py |
Caption template system |
src/config.py |
Environment variable configuration |
src/social/ |
Social publishing providers (YouTube, TikTok, Instagram): OAuth, upload, metrics |
src/services/social_service.py |
Account connections, publish/schedule, metrics refresh, AI performance context |
src/repositories/social_repository.py |
social_accounts, social_posts, social_post_metrics SQL |
src/api/routes/social.py |
/social/* routes |
API Endpoints (routes in api/routes/)
Task lifecycle:
POST /tasks/β Create task, enqueue to worker (returns task_id); optionalworkflow,workflow_options,instructionsGET /tasks/workflowsβ What the user can make on this platform (workflows flag, env gate, limits)GET /feature-flagsβ Feature flags evaluated for the caller and platformGET /tasks/β List user tasksGET /tasks/{id}β Get task with clipsGET /tasks/{id}/progressβ SSE real-time progress streamPOST /tasks/{id}/cancelβ Cancel processingPOST /tasks/{id}/resumeβ Resume cancelled/errored taskDELETE /tasks/{id}β Delete task
Clip editing:
PATCH /tasks/{id}/clips/{clip_id}β Trim clipPOST /tasks/{id}/clips/{clip_id}/splitβ Split at timestampPOST /tasks/{id}/clips/mergeβ Merge selected clipsPATCH /tasks/{id}/clips/{clip_id}/captionsβ Update captionsGET /tasks/{id}/clips/{clip_id}/export?preset=tiktokβ Export with platform presetGET /tasks/{id}/clips/zipβ Stream every existing clip as one ZIP, built on the fly (clip_archive.py);GET .../clips/zip/preflightruns the same checks first. One ZIP download per user at a time (Redis slot, 429)
Media:
GET /fonts,GET /transitions,GET /caption-templates,GET /broll/statusPOST /uploadβ Upload video fileGET /clips/{filename}β Serve generated clips
Social publishing:
GET /social/providers,GET /social/connectionsβ configured platforms and connected accountsPOST /social/connections/{provider}/authorize+/callbackβ OAuth handshake (session auth only)POST /social/postsβ publish or schedule a clip;GET /social/posts?task_id=β list with metricsPOST /social/posts/{id}/cancel|retry|refresh-metrics,DELETE /social/posts/{id}GET /social/performanceβ metrics by hook type / platform / clip length (also fed into the AI prompt)GET /social/performance/timeseries?days=30β daily new views from metrics snapshots (Analytics chart)GET /social/media/{token}β public token-gated clip stream for Instagram
Worker crons (workers/tasks.py): every minute dispatch_scheduled_social_posts, hourly refresh_social_metrics.
Post status flow: scheduled β queued β publishing β published/failed/cancelled.
API keys (programmatic access):
GET /api-keys/β List the user's API keys (metadata only)POST /api-keys/β Create a key (plaintextsk_...returned exactly once)DELETE /api-keys/{key_id}β Revoke a key
API keys authenticate /tasks/*, /fonts and /upload directly via
Authorization: Bearer sk_... or x-api-key. Resolution lives in
auth_headers.resolve_authenticated_user_id (API key β DB lookup, else falls
back to the frontend's HMAC-signed session headers). Only the SHA-256 hash is
stored (api_keys table). The frontend manages keys at /settings/api-keys.
Plans & billing
Hosted plans are Pro ($9.99/mo, $99.90/yr) and Creator ($24.99/mo, $249.90/yr).
Creator's internal plan id is still scale (DB users.plan, Stripe metadata,
RevenueCat ...scale.monthly/annual product IDs); only the display name changed.
- Metered in minutes of source video per month (
PRO_/SCALE_PLAN_MINUTE_LIMIT, 600/1500).tasks.source_duration_secondsis recorded at task creation (YouTube preflight, ffprobe for uploads) andBillingServicesums started minutes. Yearly subscriptions still reset monthly (_usage_window). - Resolution: Pro gets 720p via a final
cap_video_short_sidepass on generated clips and editor renders; Creator gets 1080p. Pro subscribers from before the change haveusers.legacy_hd(backfilled once) and keep 1080p until they cancel. Admins can grant or remove it per user in the/adminUsers panel (searchable by email/name;PATCH /api/admin/users/{id}/legacy-hd). 720p plans also download YouTube at 720p (reduced_media_limitsβ Apify quality / yt-dlp height cap), and theirprocessing_cachekey gets a|q720suffix so a 1080p request never reuses a 720p source. Full-quality keys are unchanged. The durableyoutube-cache/<video_id>full file records its height (full_height, one file per height) and is reused only at or above the requested cap; sections always use the global cap. - Scheduling social posts requires Creator (
can_schedule_posts); publishing immediately works on Pro. - Annual checkout:
interval: "year"usesSTRIPE_PRO_/SCALE_ANNUAL_PRICE_ID. - Stripe prices (2026-10): new subscribers get new prices (lookup keys
pro_monthly_2026_10,pro_yearly_2026_10,creator_monthly_2026_10,creator_yearly_2026_10). The earlier Pro price stays for existing subscribers viaSTRIPE_PRO_LEGACY_PRICE_IDS; the webhook maps it to Pro and setslegacy_hd, so dropping it from that list would downgrade those subscribers on their next renewal.
Creator (affiliate) program
Creators apply at /settings/creator-program (public pitch page: /affiliate).
Admins approve/decline/revoke in the /admin "Creator Program" panel. Logic
lives in frontend/src/server/affiliates.ts; applications are the affiliates
table (one per user, slug cleared on decline).
- Approve creates Stripe promotion code
SLUGon the shared couponSTRIPE_CREATOR_COUPON_ID(defaultcreator-20-3mo, 20% off for 3 months) and grants Pro withsubscription_provider = "affiliate"(Stripe/Apple webhooks never clobber it with a non-paid state). - Checkout applies the coupon from a typed/remembered code (
body.code) or the signupuser_acquisition.ref. The browser remembers validated?ref=codes (lib/creator-code.ts). - Emails go through the backend
POST /account/affiliate-email(SES): new applications to everyis_adminuser, decisions to the applicant. - iOS: creators' free Pro reaches the app through the billing summary
(
subscription_provider: "affiliate"). The audience discount on iPhone is an App Store offer code: custom codes on the Pro subscription's "Creator offer" (20% off for 3 months), added by hand in App Store Connect; admins then mark "App Store code added" and the creator page showsappStoreRedeemUrl(code). The app's paywall opens Apple's redeem sheet ("Have a creator code?").
Feature tours
When a change gives existing users something new to find, add a tour: an entry in
frontend/src/lib/feature-tours.ts, data-tour on its target, and text in
frontend/messages/*/tours.json. Explain the feature, don't just point at it. Rules and steps: docs/feature-tours.md.
Environment Variables
Required in .env (root) or backend/.env:
ASSEMBLY_AI_API_KEY=... # Required: video transcription
TRANSCRIPTION_LANGUAGE= # Optional: empty = auto-detect; e.g. es, de, en_us forces it
LLM=google-gla:gemini-3-flash-preview # Format: provider:model-name
GOOGLE_API_KEY=... # Or OPENAI_API_KEY / ANTHROPIC_API_KEY
OLLAMA_BASE_URL=http://localhost:11434/v1 # Optional for ollama:* models
OLLAMA_API_KEY=... # Optional; required for Ollama Cloud
RERANK_LLM= # Optional; model for the long-video candidate rerank (default: LLM)
YOUTUBE_DOWNLOAD_PROVIDER=yt_dlp # yt_dlp | apify
YOUTUBE_PROXY_URL= # Optional residential proxy template; empty = off
YOUTUBE_POT_PROVIDER_URL= # Optional bgutil base URL (http://bgutil:4416)
YOUTUBE_DOWNLOAD_MAX_BYTES=2000000000
YOUTUBE_MAX_HEIGHT=1080 # Hard cap; lower values are honored
APIFY_EXPENSIVE_FALLBACKS=false # Skip high-cap Apify fallback actors
# Optional
PEXELS_API_KEY=... # B-roll stock footage
YOUTUBE_OAUTH_CLIENT_ID=... # Social publishing: Google OAuth client (+ _SECRET)
TIKTOK_CLIENT_KEY=... # Social publishing: TikTok app (+ TIKTOK_CLIENT_SECRET)
TIKTOK_APP_AUDITED=false # true only after TikTok's audit; unaudited = private posts from private accounts
INSTAGRAM_APP_ID=... # Social publishing: Meta app with Instagram Login (+ _SECRET)
SOCIAL_PERFORMANCE_MIN_POSTS=3 # Measured posts before AI selection is personalized
SOCIAL_PUBLISHING_ACCESS=off # Rollout gate: off (default) | admins (admins + allowlist) | all
SOCIAL_PUBLISHING_ALLOWED_EMAILS= # Comma-separated beta emails when access=admins
WORKFLOWS_ACCESS=admins # Series/topic/recap/trailer + instructions: off | admins | all (self-host: all)
WORKFLOWS_ALLOWED_EMAILS= # Comma-separated beta emails when access=admins
WORKFLOWS_PUBLIC= # Workflows open to everyone while access=admins, e.g. trailer,topic
WORKFLOW_TOPIC_MAX_CLIPS=15 # Most clips a topic run returns
WORKFLOW_PLAN_TIMEOUT_SECONDS=1800 # Planning wall clock; past it the task fails with plan_failed
WORKFLOW_FULL_CONTEXT_MAX_WORDS=0 # Words read in one outline call; 0 = provider default
REDIS_HOST=localhost # Default: localhost
REDIS_PORT=6379 # Default: 6379
QUEUED_TASK_TIMEOUT_SECONDS=180 # Fail-safe for stuck tasks
AI_EDIT_DAILY_LIMIT=150 # Studio AI edits per user per day (needs ANTHROPIC_API_KEY)
TEMP_DIR=/tmp # Temp file storage
DATABASE_URL=postgresql+asyncpg://...
BETTER_AUTH_SECRET=... # Frontend auth secret
Feature flags
feature_flags table (key, web_enabled, ios_enabled, admins_bypass, description, updated_by):
switch a feature per platform without a deploy, in the /admin "Feature Flags" panel
(/api/admin/feature-flags/[key], written with Prisma). backend/src/feature_flags.py reads them with a
15-second in-process cache; a missing row or unreadable table falls back to DEFAULT_FLAGS (off, admins bypass).
- Platform:
x-supoclip-client: iosfrom the iOS app (AuthInterceptor), forwarded by the web proxies (backendTraceHeadersinserver/backend-api.ts); anything else, API keys and MCP included, is web. - On = the platform column, or the caller is an admin and
admins_bypassis set. GET /feature-flags(proxied at/api/feature-flags) returns the evaluated booleans for the caller.workflows: seeded off on web and iOS (admins bypass) until the iOS build with workflows is approved. It sits on top ofWORKFLOWS_ACCESS: both must allow. Off hides workflows inGET /tasks/workflowsfor that platform and makes create/resume with a workflow 403WORKFLOW_NOT_AVAILABLEbefore any charge.tiktok_publishing: seeded off on web and iOS, no admin bypass, until TikTok audits the app's Direct Post access (unaudited, TikTok rejects posts from public accounts). Off,/social/providersreports TikTokconfigured: false, paused: true(the web shows a short notice; iOS hides it) and connect/options/publish/retry return 503. Self-hosters with their own audited TikTok app turn it on in /admin.- Adding a flag: seed it in a migration (and
init.sql), add its default toDEFAULT_FLAGS, check it withfeature_flags.is_enabled(db, key, platform=client_platform(request), user_id=...).
Common Workflows
Adding fonts/transitions
Drop .ttf files into backend/fonts/ or .mp4 files into backend/transitions/. They auto-appear via their respective GET endpoints.
Social publishing & the performance loop
Users connect accounts at /settings/social (OAuth via /api/social/connect/{provider} β
/api/social/callback/{provider} β backend /social/connections/{provider}/callback).
Publishing runs in the ARQ worker (publish_social_post). Metrics are pulled back hourly into
social_post_metrics and summarized by SocialService.build_performance_context(), which
TaskService.process_task injects into build_transcript_analysis_prompt(performance_context=...).
Personalized analyses skip the shared processing_cache analysis entry.
- Pages:
/settings/social(accounts + every scheduled post) and/analytics(totals, daily views chart, top clips, breakdowns), both in the sidebar. Clips publish from the task page. - Rollout gate:
SOCIAL_PUBLISHING_ACCESSdefaults tooff. Social and Analytics stay out of the nav, command palette, and settings until it isadminsorall. Outside the gate every/social/*route returns 403 exceptGET /social/providers, which reportsenabled: falsewith all platforms unconfigured (clients hide publishing unlessenabledis exactly true) and the disconnect routes (account deletion revokes tokens). - iOS app:
POST .../authorizewith{"client": "ios"}prefixes the OAuth state withm.; the web callback then redirects tosupoclip://social-callback?provider&code&stateand the app completes/callbackwith its own session (the state stays bound to the starting user). - Platform approvals gate real users: TikTok only allows sandbox target users until its audit,
Instagram only app testers until Meta review, and YouTube uploads from an unaudited project stay
private. Provider app IDs and setup notes are in
docs/configuration.md.
Clip studio (editor)
Full-screen, classic NLE layout at /tasks/{id}/edit (frontend/src/components/editor/): clip picker in the header, viewer and
inspector on top, a full-width sequence timeline (timeline.tsx: V1 segments, B-roll, captions and audio tracks, in
edit time) below. Drafts are EditDocuments on the clean.mp4 (source) timeline; sequence/locate map between
edit and source time. Preview and browser export draw through lib/editor/render.ts, the server export through
render_document. Generated clips' B-roll opens as editable items (broll-panel.tsx).
AI editing: the "AI edit" field under the viewer (ai-prompt.tsx, βJ) posts POST .../editor/ai β Redis β ai_edit_job on the
AI worker β Claude Sonnet 5.5 returns typed operations (keep_ranges, remove_words, set, add_broll, ...) β
apply_plan clamps and validates β the browser applies the result as one undoable change (never over edits made
meanwhile). Keep the output schema free of optional fields: the API rejects schemas whose grammar is too large.
Workflows (series, topic clips, recap, trailer)
tasks.workflow picks what a task makes: highlights (default, unchanged), series (Part 1..N of one
story, adjacent parts share one exact cut), topic (every strong moment about workflow_options.topic),
recap (one clip of the main points) or trailer (one teaser that never reveals the payoff). Free-text
instructions steer any workflow. Code lives in backend/src/workflows/; full design in docs/workflows.md.
- Units, not timestamps: the transcript becomes numbered sentence units (clauses for trailers); the model returns unit ids and code converts them to word-exact seconds. A cached source outline (chapters, points, arcs, payoffs) is shared by every planner. Each planner is draft β validate β one repair β deterministic solve β critique β re-solve; budgets, contiguity and spoilers never depend on the model.
- Locked render: planned segments (
source_ranges,planned: True) skip snapping, end extension and the cold-open teaser; multi-range clips use explicit output offsets everywhere. The plan is saved totasks.workflow_planbefore rendering; clips carryworkflow_role,part_number,workflow_meta. - Invariant: highlights without instructions is byte-identical (prompts, cache keys, job args, render path).
- Fail loud, refund: a workflow that can't deliver raises
WorkflowError(topic_not_foundwith suggested topics,no_story,trailer_unbuildable, β¦); its clips are deleted so the minutes are refunded, anderror_codedrives the task page's next-step screen. Series/recap/trailer are all-or-nothing. - Gate:
WORKFLOWS_ACCESS=off|admins|all(defaultadmins, plus verifiedWORKFLOWS_ALLOWED_EMAILS), checked on create and resume; self-hosters setall. Theworkflowsfeature flag (below) must also be on for the platform. AlsoWORKFLOW_TOPIC_MAX_CLIPS,WORKFLOW_PLAN_TIMEOUT_SECONDS,WORKFLOW_FULL_CONTEXT_MAX_WORDS. - Frontend: contract in
lib/workflows.ts; results incomponents/app/series-view.tsx,hero-clip-view.tsxandworkflow-failure.tsx. MCP:workflow/topic/part_count/instructionsonsupoclip_create_clip_task, plussupoclip_list_workflows.
Modifying AI clip selection
Edit backend/src/ai.py: simplified_system_prompt controls selection criteria, TranscriptSegment defines the output model, get_most_relevant_parts_by_transcript() runs analysis with validation.
Video processing constraints
- Output: 9:16 vertical format, H.264, even pixel dimensions (
round_to_even()) - Subtitles positioned at 75% down the frame
- Virality scoring:
hook_score,engagement_score,value_score,shareability_score(0-25 each, summed tovirality_score0-100) - Each segment gets an AI-written
hook_title(3-9 words) burned into the top safe area for the first ~4s (build_hook_title_assinvideo_utils.py), persisted ongenerated_clips.hook_title - Static talking-head crops get a slow ~5% Ken Burns punch-in (
kenburns_zoom_fragment); tracked pans and split screens keep their own motion
Observability
Errors and analytics go to PostHog (project "SupoClip", EU, id 314504); logs go to
Axiom (dataset supoclip-prod). Everything is off unless tokens are set. Details in
docs/observability.md.
- Backend/worker:
src/observability.pysends every log record with a traceback to PostHog (POSTHOG_PROJECT_TOKEN) and stamps logs withservice,trace_id,user_id. The auth helpers bind the user (bind_request_user). - Web:
posthog-jsininstrumentation-client.ts(analytics, replay, exceptions) via the/ingestrewrite;instrumentation.tsreports server errors.lib/trace-fetch.tstags every/api/*call withx-trace-id, which the proxies forward to the backend. - Correlation: an exception's
trace_idproperty matchestrace_idin Axiom logs (worker jobs:task-<id>); the PostHog distinct id is the Better Auth user id everywhere. - Logs: the
vectorservice (observability/vector.yaml, compose profileaxiom) shipssupoclip-*container logs and the host nginx's SupoClip logs.
iOS App
A native iOS app ships on the App Store
(https://apps.apple.com/us/app/supoclip/id6784760040, app id 6784760040). Its
source lives outside this repo. It talks to the hosted API and bills through
RevenueCat, which is what frontend/src/app/api/billing/revenuecat-webhook/
serves; App Store subscribers are blocked from Stripe checkout/portal by the
"managed through the App Store" guard in the billing routes. The www references
the app via APP_STORE_ID/APP_STORE_URL in frontend/src/lib/site.ts
(Smart App Banner meta, JSON-LD MobileApplication, hero badge, footer link).
YouTube Downloads
YOUTUBE_DOWNLOAD_PROVIDER accepts yt_dlp (free default) or apify.
Apify requires APIFY_API_TOKEN and explicit worker configuration. Each provider
falls back to the other when available. Paid worker identities belong in private
environment configuration. See backend/README.md for setup.
YOUTUBE_PROXY_URL (empty by default) puts yt-dlp through a residential proxy
first: sticky {session} per job, IPv4, optional bgutil PO tokens, audio first,
then only the padded clip ranges at or below 1080p. Cached audio and sections
are reused by later edits. APIFY_EXPENSIVE_FALLBACKS defaults to off so
high-cap fallback actors are not called. Runbook: docs/youtube-download.md.
MCP Server
mcp/ is a standalone MCP server
(supoclip-mcp, Python/FastMCP, stdio) that exposes SupoClip to MCP clients
(Claude Desktop/Code, Cursor, β¦). It is a thin client over the REST API.
- Default target: the hosted API
https://api.supoclip.com. Override withSUPOCLIP_API_URLfor self-hosting (e.g.http://localhost:8000). - Auth: a per-user API key in
SUPOCLIP_API_KEY(see API keys above). Self-hosters may instead useSUPOCLIP_USER_ID(+SUPOCLIP_AUTH_SECRETwhen signing is enforced). - Tools: create/list/get/wait/cancel/resume/delete tasks (any workflow), list workflows, list/download/export clips, and public discovery (templates, transitions, fonts, B-roll).
- Run with
cd mcp && uv run supoclip-mcp. Details inmcp/README.md.