A simple script that uses the Groq API to transcribe audio files using the Whisper model
Project description
Groq Whisper Transcribe
This script transcribes audio files using the Whisper model via the Groq API
Usage costs can be found at: https://console.groq.com/docs/model/whisper-large-v3
Usage
Install the Requirements
To install the necessary requirements, run the following command:
pip install groq-whisper-transcribe
FFmpeg
This tool requires FFmpeg for audio processing.
- macOS / Windows — FFmpeg is bundled automatically via the
static-ffmpegpackage. No extra installation needed. - Linux — Install FFmpeg using your system package manager:
# Debian / Ubuntu sudo apt install ffmpeg # Fedora sudo dnf install ffmpeg # Arch sudo pacman -S ffmpeg
On Linux, you can also
pip install static-ffmpegif you prefer not to use the system package.
Typical Usage
# Transcribe to SRT (English)
groq-whisper-transcribe audio.mp3
# Transcribe Spanish audio
groq-whisper-transcribe audio.aac -l es
# French audio to VTT
groq-whisper-transcribe audio.wav -f vtt -l fr
# Both SRT and VTT
groq-whisper-transcribe audio.wav -f srt vtt
# All three formats
groq-whisper-transcribe audio.wav -f srt vtt txt
# Plain text only
groq-whisper-transcribe audio.wav -f txt
# Custom output path
groq-whisper-transcribe audio.m4a -o result.srt
# Use turbo model
groq-whisper-transcribe audio.mp3 -m whisper-large-v3-turbo
# Set API key interactively
groq-whisper-transcribe --set-key
# Set API key via pipe
echo "gsk_..." | groq-whisper-transcribe --set-key
Arguments
| Argument | Description | |
|---|---|---|
| input | Input audio file path | |
| -o | --output | Output file path (default: input with new extension). Ignored when multiple formats are requested |
| -f | --format | Output format(s): srt, vtt, txt (default: srt). Multiple formats can be specified |
| -l | --language | Language code, e.g. en, es, fr, de, ja (default: en) |
| -m | --model | Whisper model name (default: whisper-large-v3) |
| --set-key | Set the GROQ_API_KEY in ~/.groq (accepts piped input or prompts interactively) |
API Key
An API Key is required to use this script, and usage incurs a cost. This tool utilizes Groq because of its high speed and low cost. However, if you have the necessary hardware, it is recommended to use the official Whisper version, which is free
The easiest way to set up your API key is using the built-in command:
# Interactive prompt (key input is hidden)
groq-whisper-transcribe --set-key
# Or pipe the key directly
echo "gsk_..." | groq-whisper-transcribe --set-key
This saves the key to ~/.groq. You can also set it manually by creating the file or using the GROQ_API_KEY environment variable.
The file path for ~/.groq varies by platform:
- Linux —
/home/<user>/.groq - macOS —
/Users/<user>/.groq - Windows —
C:\Users\<user>\.groq
The file content should look like:
GROQ_API_KEY=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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file groq_whisper_transcribe-1.0.tar.gz.
File metadata
- Download URL: groq_whisper_transcribe-1.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd9bb5e548224d672a3640e3c3011128d4c7ecd51792080cf853d0d0607fc472
|
|
| MD5 |
a180115dca9bb2f682c57a46edd1cd4a
|
|
| BLAKE2b-256 |
373dad11f8a45713fe205360a6375118c650aff6776c187a7dd216f2306c9163
|
File details
Details for the file groq_whisper_transcribe-1.0-py3-none-any.whl.
File metadata
- Download URL: groq_whisper_transcribe-1.0-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7674edc4216604a8e627daa20283cb245d0b04e4a089828080b344b82aa2a1f1
|
|
| MD5 |
d23f7139a6781cff314755667e31d7d1
|
|
| BLAKE2b-256 |
6a8eb1d7eae9b2e5df3f044ba3f3cd9266a1a6c6042ce69f0192bf8c8e25a17f
|