Skip to main content

Groq Whisper 多 Key 并发语音转写 CLI 工具

Project description

groq-whisper-cli

Groq Whisper 多 Key 并发语音转写 CLI 工具。

功能

  • silero-vad 本地 VAD 智能切片
  • 多 API Key 配额感知负载均衡
  • 429 自动退避 + Key 切换
  • 异步并发协程池
  • 输出 SRT 字幕 + TXT 文本

安装

# 直接通过 uvx 运行(无需安装)
uvx run groq-whisper-cli -i audio.mp3

# 或安装到本地
uv tool install groq-whisper-cli
groq-whisper-cli -i audio.mp3

前置要求

  • Python 3.12+
  • ffmpeg(用于音频提取)

API Key 配置

按优先级查找:

  1. --key-file / -k 参数指定文件(每行一个 key)
  2. 当前目录下的 key.txt
  3. 环境变量 GROQ_API_KEY(多个 key 用逗号分隔)
# 方式一:环境变量
export GROQ_API_KEY="gsk_xxx,gsk_yyy"

# 方式二:key 文件
echo "gsk_xxx" > key.txt
echo "gsk_yyy" >> key.txt

# 方式三:命令行参数
groq-whisper-cli -i audio.mp3 -k /path/to/key.txt

用法

# 基本用法
groq-whisper-cli -i audio.mp3

# 指定语言和输出目录
groq-whisper-cli -i video.mp4 -l en -o ./output

# 多文件处理
groq-whisper-cli -i *.mp4 -w 8

# 完整参数
groq-whisper-cli -i audio.mp3 \
  -k key.txt \
  -o ./transcript \
  -w 4 \
  --chunk-sec 120 \
  -l zh \
  --retries 8

参数

参数 缩写 默认值 说明
input - 必填 输入文件路径,支持通配符
--key-file -k - API Key 文件路径
--out -o ./transcript 输出目录
--workers -w 4 并发 worker 数
--chunk-sec - 120 VAD 切片最大时长(秒)
--lang -l zh ISO-639-1 语言代码
--retries - 8 每个分片最大重试次数

作为库使用

from groq_whisper import GroqKeyManager, AudioSplitter, GroqTranscriber

key_manager = GroqKeyManager(["gsk_xxx", "gsk_yyy"])
splitter = AudioSplitter(max_chunk_sec=120)
chunks = splitter.split("audio.mp3")

transcriber = GroqTranscriber(key_manager=key_manager, language="zh")
results = asyncio.run(transcriber.transcribe_all(chunks))

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

groq_whisper_cli-0.1.1.tar.gz (35.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

groq_whisper_cli-0.1.1-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file groq_whisper_cli-0.1.1.tar.gz.

File metadata

  • Download URL: groq_whisper_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 35.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for groq_whisper_cli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 204d154791d43140a83db8da06c538c932d1cdeb6ce02a37e4d5609f7dbb3737
MD5 dbdc6d5bcd69824fc6f70e2072136a35
BLAKE2b-256 33e2467a20f3bed57b1004ef3e71adb3ac55bcd709c5da7fc09c6dc66170e489

See more details on using hashes here.

File details

Details for the file groq_whisper_cli-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: groq_whisper_cli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for groq_whisper_cli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d40e1177dbf0f835778395dea82d8b495c91c2450f9c5b24c4b4a167e54d75cd
MD5 eadcff74f6e958a9d3f114ef6e956cdc
BLAKE2b-256 0d457792d9dfa987065ba35d8f381a2bf285b7ffaa74b4b77eabc1db69daf0de

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page