Skip to content

Video-import foundation: cache, async-job model, premium quota + kill switch#86

Merged
windoze95 merged 1 commit into
mainfrom
feat/video-import-foundation
Jun 30, 2026
Merged

Video-import foundation: cache, async-job model, premium quota + kill switch#86
windoze95 merged 1 commit into
mainfrom
feat/video-import-foundation

Conversation

@windoze95

Copy link
Copy Markdown
Owner

What

Foundation (PR 1 of ~2) for the premium "import a recipe from any video link" feature — TikTok / Instagram Reels / YouTube / Facebook / Pinterest. Lands the data model, premium gating, and all cost-control scaffolding with no external calls yet, so it's safe and fully testable. The acquisition + extraction pipeline lands in PR2 (needs the ScrapeCreators key).

Cost-control design (the stop-losses)

  • Process-once cacheVideoExtractionCache keyed by platform:video_id (mirrors the proven CanonicalRecipe cache). A viral video is extracted once; everyone else is served from cache → amortized cost ≈ $0.
  • Per-user monthly quotaVideoImportsUsed + CanUseVideoImport(): free 2/mo, premium 20/mo (capped even for premium to bound per-video AI cost). Reuses the existing Subscription counter machinery (CheckLimit / IncrementUsage / monthly reset).
  • Daily global budget kill switchVideoImport.CostUSD meters every import; SumImportCostSince + VIDEO_IMPORT_DAILY_BUDGET_USD (default $25/day) let PR2 refuse fresh extractions once the day's spend is exceeded (cache hits still serve).
  • Feature flagSCRAPECREATORS_API_KEY optional; feature stays dark until set in prod (same pattern as Firecrawl).

Pricing (locked)

Premium $4.99/mo · $39.99/yr → 20 video imports/month, free 2/month — market-center, ≥65% margin after the cache (per-fresh-extraction cost ≈ $0.08–0.20).

Files

VideoExtractionCache + VideoImport models, VideoImportRepository + VideoImportRepo interface, the subscription gating extension, config keys, and the AutoMigrate registration. Unit test covers the CanUseVideoImport free/premium caps.

Tests

go test ./... -count=1 → green (11 packages, 0 failures).

Next

PR2: ScrapeCreators client + ffmpeg frame sampling + transcript → the existing ExtractRecipesFromMedia engine, async job + polling endpoint, metering + kill-switch enforcement, Dockerfile → debian-slim (ffmpeg). Needs the ScrapeCreators API key.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BU4UWZutHd1AnK3XAf7H19

Foundation (PR1 of ~2) for the premium "import recipe from a video link"
feature (TikTok/Instagram/YouTube/Facebook/Pinterest). No external calls
yet -- this lands the data model, gating, and cost-control scaffolding.

- models: VideoExtractionCache (process-once cache keyed by
  platform+video ID, mirrors CanonicalRecipe) and VideoImport (async job
  with status + metered CostUSD for the daily-budget kill switch).
- subscription: VideoImportsUsed counter + CanUseVideoImport (free 2/mo,
  premium 20/mo -- capped even for premium to bound per-video AI cost);
  wired into CheckLimit / IncrementUsage / monthly reset.
- repository: VideoImportRepository (cache get/upsert/hit, job CRUD,
  SumImportCostSince for the kill switch) + VideoImportRepo interface.
- config: SCRAPECREATORS_API_KEY (feature off until set) +
  VIDEO_IMPORT_DAILY_BUDGET_USD (default $25/day kill switch).
- db: AutoMigrate the two new tables.

Pipeline (ScrapeCreators + ffmpeg + multimodal extraction) lands in PR2.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BU4UWZutHd1AnK3XAf7H19
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@windoze95 windoze95 merged commit f07843f into main Jun 30, 2026
1 check passed
@windoze95 windoze95 deleted the feat/video-import-foundation branch June 30, 2026 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant