Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:0xsline OpenChatCut TranscriptionPlugin

From Leeroopedia
Knowledge Sources
Domains Transcription, HTTP, Editing
Last Updated 2026-10-22 14:00 GMT

Overview

Concrete Vite plugin that exposes `POST /api/transcribe` for cloud-based audio transcription, handling authentication, binary content-type validation, and returning normalized transcript JSON for transcript-driven editing.

Description

The transcriptionPlugin function registers an HTTP endpoint at `/api/transcribe`:

  • Authentication: Requires editor credential authorization (`editorCredentialAuthorized`).
  • Content-type: Must be `application/octet-stream` (raw audio bytes).
  • Size limit: Maximum 100 MiB (`MAX_TRANSCRIPTION_BYTES`).
  • Provider selection: Via URL query parameter (`?provider=openai`).
  • Language: Via URL query or server default.
  • Diarization: Via URL query or server default.
  • Provider validation: `assertTranscriptionProviderConfigured` checks the API key exists.
  • Transcription: Delegates to transcribeCloudAudio for the actual cloud transcription.
  • Response: Returns `NormalizedTranscriptResult` as JSON (text, words, utterances).
  • Error handling: 400 for request/config errors, 502 for provider failures.

The desktop app uses NativeAsrWorker for local transcription instead of this cloud endpoint.

Usage

  • Editor UI: The transcription panel calls this endpoint with extracted ASR audio.
  • Agent transcription: MCP agents call this endpoint for cloud transcription.

Code Reference

Source Location

  • Repository:*** OpenChatCut
  • File:*** server/plugins/transcription.ts

Signature

export function transcriptionPlugin(options: TranscriptionOptions): Plugin;

Import

import { transcriptionPlugin } from '../server/plugins/transcription.ts';

I/O Contract

Inputs

Name Type Required Description
Body Buffer (binary) Yes Raw audio bytes (application/octet-stream)
?provider string Yes Provider: openai, deepgram, groq, elevenlabs, cartesia, mistral
?language string No ISO code or 'auto' (default from options)
?diarize 1 No Enable speaker diarization (default from options)

Outputs (HTTP 200 JSON)

Name Type Description
text string Full transcript text
words array [{ text, start (ms), end (ms), speaker }]
utterances array [{ speaker, text, start, end, words }]

Usage Examples

Transcribe Audio

curl -X POST "http://localhost:5199/api/transcribe?provider=openai&language=en&diarize=0" \
  -H "Content-Type: application/octet-stream" \
  --data-binary @/media/uploads/interview.asr.ogg

# Response:
# {
#   "text": "Hello, welcome to the interview.",
#   "words": [
#     { "text": "Hello", "start": 0, "end": 320, "speaker": null },
#     { "text": "welcome", "start": 350, "end": 820, "speaker": null },
#     ...
#   ],
#   "utterances": []
# }

Register the Plugin

import { transcriptionPlugin } from '../server/plugins/transcription.ts';

const plugin = transcriptionPlugin({
  openaiApiKey: process.env.OPENAI_API_KEY,
  openaiModel: 'whisper-1',
  language: 'en',
  diarization: false,
});

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment