Skip to content

feat(cli): add TwelveLabs Pegasus transcription backend - #6

Open
mohit-twelvelabs wants to merge 1 commit into
crafter-station:mainfrom
mohit-twelvelabs:feat/twelvelabs-integration
Open

feat(cli): add TwelveLabs Pegasus transcription backend#6
mohit-twelvelabs wants to merge 1 commit into
crafter-station:mainfrom
mohit-twelvelabs:feat/twelvelabs-integration

Conversation

@mohit-twelvelabs

Copy link
Copy Markdown

Hi! I'm Mohit, I work at TwelveLabs (@mohit-twelvelabs).

What this adds

A new opt-in pegasus transcription backend powered by TwelveLabs Pegasus video understanding. It sits alongside the existing local (whisper-cli) and openai backends:

export TWELVELABS_API_KEY="tlk_..."
trx "https://example.com/talk.mp4" -b pegasus

Unlike the other backends, Pegasus reads the video directly from its URL server-side — so it skips the yt-dlp download and ffmpeg cleaning steps entirely and transcribes using the full audiovisual context (on-screen text, speaker cues), which can help on noisy or multi-speaker footage. Output is the usual .txt plus a single-cue .srt (Pegasus returns prose, not timed segments).

Why it helps trx

trx is built around media-from-a-URL workflows, and that's exactly Pegasus' sweet spot: no local model download, no GPU, and the model sees the video, not just the audio. It's a natural third backend for the agent-first design — fully introspectable via trx schema transcribe.

Opt-in / non-breaking

  • Defaults are unchanged (local stays the default backend).
  • Existing local / openai paths are untouched.
  • The new backend only activates with -b pegasus; it requires TWELVELABS_API_KEY and a direct media URL (clear error otherwise).
  • No new runtime dependencies — uses the built-in fetch.

Wired in the same way as the OpenAI backend: Backend union + config block, validation (validatePegasusModel), pipeline dispatch, the transcribe command, and the JSON schema. Docs updated in getting-started / commands / configuration.

How it was tested

  • bun test — added no-network dry-run + validation tests (backend selection, model validation, URL-only guard); all pass. The 2 pre-existing "real WAV" failures are unrelated (they need a local whisper model installed).
  • biome check — clean on all changed/new files.
  • Live smoke test against POST /v1.3/analyze (stream:false) with a real public MP4: transcribePegasus returns text and writes .srt/.txt. A key-gated live test is included (TWELVELABS_API_KEY + TRX_TEST_VIDEO_URL), skipped when unset.

You can grab a free API key at https://twelvelabs.io — there's a generous free tier.

Add an opt-in 'pegasus' backend that transcribes a video directly from its
URL using TwelveLabs Pegasus video understanding. Unlike the local and openai
backends it reads the media server-side, so it skips the yt-dlp download and
ffmpeg cleaning steps and uses the full audiovisual context.

- New core/twelvelabs.ts wraps the v1.3 /analyze endpoint (stream:false)
- Wire 'pegasus' into Backend, config defaults, validation, pipeline, and the
  transcribe command + JSON schema
- URL input only; clear error for local files
- Docs (getting-started, commands, configuration) updated
- Tests: no-network dry-run/validation + key-gated live smoke test

Requires TWELVELABS_API_KEY. Non-breaking: defaults and existing backends
are untouched.
@vercel

vercel Bot commented Jun 25, 2026

Copy link
Copy Markdown

@mohit-twelvelabs is attempting to deploy a commit to the Crafter Station Team on Vercel.

A member of the Team first needs to authorize it.

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