Repository navigation
OpenRouter support, chunking, cost tracking, and domain modes (curated from PR #3) - #4
Draft
UditAkhourii wants to merge 3 commits into
Draft
UditAkhourii wants to merge 3 commits into
UditAkhourii wants to merge 3 commits into
Conversation
…rated from PR #3) Curated version of PR #3 by @sagniKdas53: keeps the OpenRouter multi-model provider, temporal chunking with parallel workers, per-asset cost/token tracking, and screencast/meeting/demo/presentation domain modes. Removed from the original PR: - The undisclosed NSFW mode (--nsfw flag, Gemini BLOCK_NONE safety overrides, nsfw-* aliases, README/SPEC/SKILL adult-curation sections) - Nonexistent model IDs (gemini-3.7-flash, qwen/qwen3.8-flash, qwen/qwen3.5-flash-02-23) and their invented pricing entries - The import-time .env sweep of ~/.env and site-packages directories (now CWD-only, invoked by the CLI, existing env vars win) - The no-ffmpeg fallback that base64-encoded whole videos into an image_url part (replaced with a clear error and a 45 MB upload guard) - The unanchored tests/ .gitignore entry Fixed relative to the original PR: - offset_body_timestamps overwrote every timestamp on a line with the first match's values; each match is now offset individually - format_timestamp emitted invalid values like 00:60.0 at minute boundaries and never rolled into hours; chunked >1h videos now use HH:MM:SS.d consistently - requests network errors (timeouts, connection failures) now raise GenerationError instead of crashing the CLI mid-batch - ffmpeg chunk cutting uses portable -ss/-t instead of input-side -to; Gemini chunks keep original resolution instead of 640p/5fps - Sub-second trailing chunks fold into the previous chunk - cdaf --version and _iter_videos warnings restored (the PR deleted both; CI's smoke check runs cdaf --version) - test_local.py updated for the new provider tuple; test_sidecar.py restored to the repo's pytest style; CI installs the test extra so requests is available - Unknown models now omit the cost header instead of inventing a price; Gemini pricing corrected to published rates Co-authored-by: sagniKdas53 <40667155+sagniKdas53@users.noreply.github.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011jFGsfg58qPVdiSnwmWWXZ
tempfile.NamedTemporaryFile keeps the file handle exclusively locked on Windows, so _video_data_url's re-open failed with PermissionError in the six tests that pass a temp video to the OpenRouter path. Write the fixture into a TemporaryDirectory instead, via a shared temp_video() helper. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011jFGsfg58qPVdiSnwmWWXZ
The earlier review flagged gemini-3.7-flash, google/gemini-3.7-flash, qwen/qwen3.8-flash, and qwen/qwen3.5-flash-02-23 as nonexistent. That was wrong: all four shipped in August 2026 and are live on the Gemini API and OpenRouter (verified against both providers' listings). Restore the flash-3.7 / gemini-3.7 / or-flash-3.7 / qwen3 aliases, add the published pricing, and put Gemini 3.7 Flash back as the top recommendation in cdaf models. The only model-ID change kept from the curation pass is the Qwen 2.5 VL OpenRouter slug fix (qwen/qwen-2.5-vl-72b-instruct -> qwen/qwen2.5-vl-72b-instruct). Co-authored-by: sagniKdas53 <40667155+sagniKdas53@users.noreply.github.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011jFGsfg58qPVdiSnwmWWXZ
sagniKdas53
added a commit
to sagniKdas53/cdaf
that referenced
this pull request
Aug 28, 2026
- Remove all NSFW references (--nsfw flag, nsfw-* aliases, BLOCK_NONE, nsfw: header, SPEC §2.5, README/SKILL adult sections) per maintainer request; original author may re-propose separately - Port pricing autosync from sagniKdas53/manga-tl-worker (OpenRouter endpoints API, 7-day file cache ~/.cache/cdaf/pricing.json) via cli/cdaf/pricing.py; cdaf models --refresh - Add user-friendly searchable DB: cdaf index ./footage -> cdaf-index.json/.db (FTS5) and cdaf search <query> ./footage (offline, no API key) - Fix chunking, timestamp, dotenv, ffmpeg, cost honesty per PR UditAkhourii#4
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.
This is a curated version of #3 (by @sagniKdas53). It keeps the genuinely useful features, removes the problematic material, and fixes the confirmed bugs. All 74 tests pass locally on Python 3.10 install of
./cli[test], including the repo's original suites that #3 broke.✅ What was kept (the good parts, credited to the original author)
--provider openrouter/ auto-detection viaOPENROUTER_API_KEY, native video upload for Gemini models, frame-sampling fallback for image-vision models (Qwen VL, Pixtral, Llama 3.2 Vision, GPT-4o), stdliburllibfallback whenrequestsisn't installed. Endpoints verified clean: keys go only toopenrouter.ai(overridable viaOPENROUTER_BASE_URL) or the Google GenAI SDK.--chunk-duration N --parallel Mfor long videos, with per-chunk timestamp offsetting and section-aware merging.cost:,prompt_tokens:,output_tokens:sidecar headers.--mode screencast|meeting|demo|presentationprompt tuning,## Environment & Tools/## Meeting Details/## Action Items & Decisionssections, SPEC/SKILL updates.cdaf modelscommand — including the Gemini 3.7 Flash and Qwen 3.x flash aliases from the original PR (see correction below) — plusprobe_duration_seconds()and the new test suite.🗑️ What was stripped, and why
nsfw-*model aliases, annsfw:header key, and an--nsfwflag that setBLOCK_NONEon all four Gemini safety categories (dangerous content, hate speech, and harassment included). Routing "uncensored" traffic through Gemini with all filters off likely violates Google's Generative AI Prohibited Use Policy and risks the user's API account. Removed entirely; if wanted, it should be its own explicitly-scoped proposal.Nonexistent model IDs✏️ CORRECTION (retracted). The original review flaggedgemini-3.7-flash,google/gemini-3.7-flash,qwen/qwen3.8-flash, andqwen/qwen3.5-flash-02-23as nonexistent. That was wrong — the review was made against stale (pre-August-2026) model knowledge. All four are real: Gemini 3.7 Flash went GA on the Gemini API on 2026-08-13 and is live on OpenRouter, and both Qwen flash models are listed on OpenRouter. The original PR's aliases (flash-3.7,gemini-3.7,or-flash-3.7,qwen3) and pricing have been restored with published rates, andflash-3.7is back as the topcdaf modelsrecommendation. The one model-ID fix retained is the Qwen 2.5 VL OpenRouter slug (qwen/qwen-2.5-vl-72b-instruct→qwen/qwen2.5-vl-72b-instruct). Apologies to @sagniKdas53 for the wrong call here..envsweep. Merely importingcdaf.generateread and injected every key from.envfiles in the CWD, inside site-packages, and~/.env— so a forgotten key in an unrelated file could be silently picked up and spent. Now: CWD.envonly, loaded by the CLI (not at import), and existing env vars always win.image_url— an OOM/garbage-request path that existed only to make the PR's own mocked tests pass. Replaced with a clear error, plus a 45 MB guard on inline OpenRouter uploads..gitignoretests/entry — unanchored, it would have silently untracked any future test file (includingcli/tests/). Removed; the video-extension ignores were kept.🐛 Bugs in #3 that are fixed here
requests, which CI never installed, and two existingtest_local.pytests asserting the old provider tuple/error message were never updated. Fixed: CI installs./cli[test],test_local.pyupdated, and the pytest→unittest rewrite oftest_sidecar.pyreverted. A further Windows-only failure (tempfile.NamedTemporaryFilekeeps the file locked, breaking_video_data_url's re-open) is fixed with aTemporaryDirectory-based fixture.offset_body_timestampsreplaced every timestamp on a line with the first match's offset values ([00:10.0-00:20.0] A then [00:30.0-00:40.0] B→ both ranges became[01:50.0-02:00.0]). Each match is now offset individually; regression tests added.format_timestamp(59.96)produced00:60.0and never rolled into hours, so chunked videos over an hour mixedMM:SS.dandHH:MM:SS.dstyles. Fixed with tenths-first rounding and ause_hoursflag threaded through the chunk path; regression tests added.requeststimeouts/connection failures escaped as raw tracebacks, crashingcdaf generatemid-batch. Now wrapped inGenerationErrorso the batch loop printsFAILED <video>and continues.-to(ffmpeg ≥ 4.0 only) — now portable-ss/-t; Gemini chunks no longer get crushed to 640p/5fps (which destroyed the on-screen text that--mode screencastexists to capture); sub-second trailing chunks from probe rounding noise fold into the previous chunk instead of failing the whole video.cdaf --version(which CI's smoke check runs!) and the_iter_videoswarnings for skipped/invalid paths. Both restored.cost:header instead of inventing a$0.20/$0.80price; rates use published pricing, with the table documented as approximate.merge_chunk_bodiesconcatenates chunk summaries rather than synthesizing one (N chunks → N paragraphs under## Summary).candidates_token_countonly (thinking tokens excluded), socost:can underestimate.MODEL_PRICINGis a static table and will drift (e.g. Gemini 3.7 Flash's current rates are promotional through 2026-12-31).Test Plan
python -m pytest cli/tests -q→ 74 passed (includes the repo's originaltest_local.py/test_sidecar.pysuites This PR extends CDAF with multi-model OpenRouter support, parallelized temporal chunking for long/large video assets, automated generation cost tracking, and intelligent domain modes for screencasts, meetings, and product demos. #3 broke)use_hours, unknown-model cost, and the restored 3.7/qwen3 aliasescdaf --version,cdaf models, and the example-sidecar validation (CI's exact smoke checks) run cleanopenrouter.ai+ Google GenAI SDK; zero NSFW references in the final diffSupersedes #3.
🤖 Generated with Claude Code
https://claude.ai/code/session_011jFGsfg58qPVdiSnwmWWXZ