Skip to content

API Reference parrot.voice.transcriber.openai_backend

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.voice.transcriber.openai_backend

View source

OpenAI Whisper Backend for Voice Transcription.

Cloud-based transcription backend using OpenAI's Whisper API. This provides an alternative to local GPU transcription for environments without GPU access or for simpler deployment.

Originally part of FEAT-008 (MS Teams Voice Note Support), refactored to shared location for FEAT-039.

Alias AbstractTranscriberBackend

Re-exported from parrot.voice.transcriber.backend.AbstractTranscriberBackend.

Class OpenAIWhisperBackend

Cloud-based transcription using OpenAI Whisper API.

Requires an OpenAI API key. Supports automatic retry with exponential backoff for rate limits.

Example::

backend = OpenAIWhisperBackend(api_key="sk-...")
try:
    result = await backend.transcribe(Path("/path/to/audio.ogg"))
    print(f"Transcription: {result.text}")
finally:
    await backend.close()  # Release HTTP session
Parameter Type Default Description
api_key str OpenAI API key (required).
model str 'gpt-transcribe' Whisper model to use. Default: "whisper-1".
max_retries int 3 Maximum number of retry attempts for rate limits. Default: 3.
timeout_seconds int 60 Request timeout in seconds. Default: 60.

Method OpenAIWhisperBackend.transcribe

Transcribe audio file to text using OpenAI Whisper API.

transcribe(audio_path: Path, language: Optional[str] = None) -> TranscriptionResult

Parameter Type Default Description
audio_path Path Path to the audio file to transcribe. Supported formats: WAV, MP3, OGG, M4A, WebM, FLAC.
language Optional[str] None Optional language hint (ISO 639-1 code, e.g., "en", "es"). If None, the language is auto-detected by OpenAI.

Returns: TranscriptionResult — TranscriptionResult containing the transcribed text, detected language, audio duration, and processing time.

Raises:

  • FileNotFoundError — If the audio file does not exist.
  • RuntimeError — If transcription fails after all retries.

Method OpenAIWhisperBackend.close

Close the aiohttp session.

This method should be called when the backend is no longer needed to properly release HTTP connection resources.

close() -> None

Alias TranscriptionResult

Re-exported from parrot.voice.transcriber.models.TranscriptionResult.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally