Video-import foundation: cache, async-job model, premium quota + kill switch#86
Merged
Merged
Conversation
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
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This was referenced Jun 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)
VideoExtractionCachekeyed byplatform:video_id(mirrors the provenCanonicalRecipecache). A viral video is extracted once; everyone else is served from cache → amortized cost ≈ $0.VideoImportsUsed+CanUseVideoImport(): free 2/mo, premium 20/mo (capped even for premium to bound per-video AI cost). Reuses the existingSubscriptioncounter machinery (CheckLimit / IncrementUsage / monthly reset).VideoImport.CostUSDmeters 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).SCRAPECREATORS_API_KEYoptional; 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+VideoImportmodels,VideoImportRepository+VideoImportRepointerface, the subscription gating extension, config keys, and the AutoMigrate registration. Unit test covers theCanUseVideoImportfree/premium caps.Tests
go test ./... -count=1→ green (11 packages, 0 failures).Next
PR2: ScrapeCreators client + ffmpeg frame sampling + transcript → the existing
ExtractRecipesFromMediaengine, 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