whisper.api

innovatorvedMIT活跃维护

基于微调 Whisper 模型提供语音转文字 API,支持用户级权限控制,方便把 ASR 能力接入自己的应用。

This project provides an API with user level access support to transcribe speech to text using a finetuned and processed Whisper ASR model.

暂无版本913star39fork同步于 2026-11-10 17:54 UTC

怎么上手

由 README 提炼,执行前请确认
pip install -r requirements.txt
cp .env.example .env
./setup_whisper.sh
python -m app.cli init
uvicorn app.main:app --host 0.0.0.0 --port 7860
硬件要求按 README 说明

README 未说明具体显存要求;支持 Apple macOS(Metal/Accelerate/CoreML)、Linux x86_64/ARM64(CUDA)和 Windows 的原生构建。

需要 CUDA
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

自托管的语音转文字 API,兼容 Deepgram 和 OpenAI 接口,可替代云端语音服务

基于微调 Whisper 模型提供语音转文字 API,支持用户级权限控制,方便把 ASR 能力接入自己的应用。

核心能力

  • 同时提供 Deepgram 与 OpenAI 兼容的 REST 和 WebSocket 接口
  • 基于 whisper.cpp 支持 Metal、CUDA、CoreML 等跨平台硬件加速
  • 支持 large-v3-turbo 等 GGML 量化模型与 Silero VAD 非语音过滤
  • 支持词级时间戳、说话人分离、自定义词表与 SRT/VTT 导出
  • 用离线 CLI 管理 API Key 与模型下载

容易踩的坑

需先运行 setup_whisper.sh 或 setup_whisper.ps1 编译 whisper.cpp 后端,否则无法转写;模型需用 python -m app.cli download 单独下载;测试用 token 接口默认关闭,需设 ENABLE_TEST_TOKEN_ENDPOINT=true 且不可用于生产。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    title: whisper.api emoji: 😶‍🌫️ colorFrom: purple colorTo: gray sdk: docker app_file: Dockerfile app_port: 7860

    Whisper API 🎙️

    An open-source, high-performance, self-hosted API for speech-to-text transcription and translation powered by whisper.cpp (fork with native video input).

    This project provides both Deepgram-compatible (/v1/listen REST & WebSocket) and OpenAI-compatible (/v1/audio/transcriptions & /v1/audio/translations) interfaces, making it a drop-in replacement for cloud speech APIs with full data ownership and cross-platform hardware acceleration (Apple macOS Metal/Accelerate/CoreML, Linux x86_64/ARM64/CUDA, and Windows).


    Key Features

    • Dual Industry-Standard APIs:
      • Deepgram-compatible: POST /v1/listen and WS /v1/listen with full word-level timestamps & confidence scores (-ojf).
      • OpenAI-compatible: POST /v1/audio/transcriptions and POST /v1/audio/translations (works out of the box with the official openai Python/JS SDKs and model="whisper-1").
    • Modern Whisper Models & VAD: Supports large-v3-turbo (q5_0, q8_0, full), large-v3, medium.en, small.en.q5, base.en.q5, tiny.en, and Silero VAD v6.2.0 (vad=true) for non-speech filtering.
    • Advanced Decoding Controls: Custom vocabulary (prompt), audio cropping (start/duration), speaker diarization (diarize), temperature, beam_size, split_on_word, and translation to English (translate=true).
    • Flexible Formats: Native support for JSON, Verbose JSON, Text, SRT, and VTT exports.
    • Cross-Platform Native Builds: Automated setup scripts for macOS & Linux (./setup_whisper.sh) and Windows PowerShell (.\setup_whisper.ps1).
    • Offline CLI Management: Manage API keys (init, create, list, revoke) and download/inspect GGML models (models, download) directly from python -m app.cli.

    Documentation

    Documentation lives in the docs/ folder (Astro 6 + Tailwind CSS v4). Run it locally with Bun:

    cd docs && bun install && bun run dev
    

    What you will find in the docs:

    • Getting started and local setup (macOS, Linux, Windows)
    • Authentication and API keys
    • Deepgram & OpenAI REST and WebSocket API reference
    • Code examples
    • Models (large-v3-turbo, Silero VAD, quantized GGML) and deployment guides
    • Contributing workflow

    Quick Start

    1. Installation

    macOS & Linux:

    pip install -r requirements.txt
    cp .env.example .env
    chmod +x setup_whisper.sh
    ./setup_whisper.sh
    

    Windows (PowerShell):

    pip install -r requirements.txt
    Copy-Item .env.example .env
    .\setup_whisper.ps1
    

    2. Setup Database, API Keys & Models

    # Initialize database and create an API key
    python -m app.cli init
    python -m app.cli create --name "MyAdminKey"
    
    # List registered models and download additional models on demand
    python -m app.cli models
    python -m app.cli download large-v3-turbo.q5
    

    Note: For local testing only, you can enable POST /v1/auth/test-token in Swagger by setting ENABLE_TEST_TOKEN_ENDPOINT=true. It defaults to off; never enable it in production.

    3. Start the Server

    uvicorn app.main:app --host 0.0.0.0 --port 7860
    

    4. Transcribe a File — Deepgram Format (/v1/listen)

    curl -X POST 'http://localhost:7860/v1/listen?model=tiny.en&vad=false' \
      -H "Authorization: Token <YOUR_KEY>" \
      -H "Content-Type: audio/wav" \
      --data-binary @audio/jfk.wav
    

    5. Transcribe or Translate — OpenAI Format (/v1/audio/transcriptions)

    curl -X POST 'http://localhost:7860/v1/audio/transcriptions' \
      -H "Authorization: Bearer <YOUR_KEY>" \
      -F "file=@audio/jfk.wav" \
      -F "model=whisper-1" \
      -F "response_format=verbose_json" \
      -F "timestamp_granularities[]=word"
    

    6. Transcribe from URL (/v1/listen)

    curl -X POST 'http://localhost:7860/v1/listen' \
      -H "Authorization: Token <YOUR_KEY>" \
      -H "Content-Type: application/json" \
      -d '{"url": "https://example.com/audio.mp3"}'
    

    The server fetches the URL for you with SSRF protections (public hosts only, size limits; redirects off by default). See docs/ or .env.example for MAX_AUDIO_DOWNLOAD_BYTES, AUDIO_URL_FOLLOW_REDIRECTS, and related settings.


    License & References

    MIT License

    Author: Ved Gupta