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

Environment:0xsline OpenChatCut WhisperCpp

From Leeroopedia
Knowledge Sources
Domains Infrastructure, Speech_To_Text
Last Updated 2026-10-22 14:00 GMT

Overview

whisper.cpp (ggml) binary required for desktop native speech-to-text ASR, providing on-device transcription with Metal/CPU acceleration.

Description

whisper.cpp is the native inference engine for desktop ASR. It replaces the browser-path transformers.js ONNX pipeline with a ggml-based implementation. The worker uses a persistent `whisper-server` process (model loaded once, reused across transcriptions) with `whisper-cli` spawn as fallback. On macOS, Metal GPU acceleration is used by default with CPU fallback. The binary is provisioned by `scripts/sync-whisper-cli.mjs` and shipped via electron-builder `extraResources`. GGML model files are resolved from the ASR model cache directory.

Usage

Use this environment for desktop native ASR transcription when cloud transcription is not available or desired. It is the mandatory prerequisite for the `NativeAsrWorker` implementation and requires the Electron desktop runtime.

System Requirements

Category Requirement Notes
OS macOS, Windows, Linux Metal on macOS, CPU elsewhere
Hardware Any modern CPU (GPU optional) Metal acceleration on Apple Silicon
Disk 1-3GB per GGML model Models downloaded on demand

Dependencies

System Packages

  • `whisper-cli` binary (provisioned by `npm run sync:whisper-cli`)
  • `whisper-server` binary (companion to whisper-cli, same directory)
  • GGML model files (downloaded via model management UI)

Environment Variables

  • `OPENCHATCUT_WHISPER_CLI` — Override whisper-cli binary path

Quick Install

# Sync whisper.cpp binaries for your platform:
npm run sync:whisper-cli

# Override path to a locally compiled binary:
export OPENCHATCUT_WHISPER_CLI=/usr/local/bin/whisper-cli

Code Evidence

Binary resolution from `server/media-binaries.ts:53-68`:

export function whisperCliBin(): string {
  const override = process.env.OPENCHATCUT_WHISPER_CLI;
  if (override) return override;
  const platformKey = `${process.platform}-${process.arch}`;
  const suffix = process.platform === 'win32' ? '.exe' : '';
  const relative = join('whisper-cli', platformKey, `whisper-cli${suffix}`);
  const candidates = [
    join(import.meta.dirname, '..', 'public', relative),
    join(process.resourcesPath ?? '', 'dist', relative),
    join(process.resourcesPath ?? '', relative),
  ];
  for (const candidate of candidates) {
    if (existsSync(candidate)) return candidate;
  }
  return join(candidates[0]!);
}

Persistent server with CLI fallback from `desktop/native-asr-worker.ts:249-289`:

// 1. Persistent whisper-server: model loaded once, Metal by default.
try {
  const { text, chunks } = await transcribeViaServer(
    engine.ggmlPath, wavPath, whisperLanguage(request.language), signal,
  );
  return { requestId: request.requestId, backend: engine.backend, text, chunks };
} catch {
  // 2. whisper-cli spawn fallback (Metal, then CPU).
  try {
    const { jsonPath } = await runWhisperCli(
      engine.ggmlPath, wavPath, whisperLanguage(request.language), true, signal,
    );
    json = JSON.parse(await readFile(jsonPath, 'utf8')) as WhisperJson;
  } catch (gpuError) {
    if (engine.backend === 'native-cpu') throw gpuError;
    const { jsonPath } = await runWhisperCli(
      engine.ggmlPath, wavPath, whisperLanguage(request.language), false, signal,
    );
    json = JSON.parse(await readFile(jsonPath, 'utf8')) as WhisperJson;
    backend = 'native-cpu';
  }
}

Common Errors

Error Message Cause Solution
`whisper-cli is unavailable` Binary not synced or not found Run `npm run sync:whisper-cli`
`whisper-server is unavailable; falling back to whisper-cli` whisper-server binary missing Acceptable; CLI fallback works but slower for multiple transcriptions
`whisper-server failed to become ready` Server startup timeout (20s) Check model file integrity and system resources
`whisper-cli timed out` Transcription exceeded 45-minute timeout Use a smaller model or shorter audio
`Desktop ASR requires the GGML model` Model not downloaded Download the model via settings UI

Compatibility Notes

  • macOS: Metal GPU acceleration by default (`native-metal` backend). Falls back to CPU (`native-cpu`) if Metal fails.
  • Windows/Linux: CPU-only (`native-cpu` backend). `-ng` flag passed to whisper-cli to disable GPU.
  • Persistent server: The `whisper-server` process loads the model once and serves multiple transcriptions via HTTP on localhost. If unavailable, falls back to per-request `whisper-cli` spawns (slower).
  • Audio format: Input audio is extracted as 16kHz mono PCM WAV via FFmpeg before passing to whisper.cpp.
  • Thread count: Both server and CLI use 8 threads (`-t 8`).

Related Pages

Page Connections

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