Skip to main content

benecaster_transcription_providers

Filter Premium transcription

Adds your own speech-to-text service to the Transcription Service add-on’s Provider list on Settings → Transcription. $providers holds the four built-ins in dropdown order, openai (OpenAI Whisper), assemblyai, deepgram and revai, each as slug => [ 'label' => string, 'factory' => callable ]. Add an entry and the podcaster can pick your provider; the add-on calls your factory with the stored key whenever it needs the provider.

You can add providers, never replace or remove a built-in: an entry that changes or drops one of the four is ignored. An entry is also ignored when its slug is not 1–32 characters of a-z, 0-9, _ or -, is custom or imported, or has an empty label or a factory that cannot be called. A custom provider’s transcripts are stored with provider custom.

Parameters

Name Type Default Description
$providers array — `[ slug => [ 'label' => string, 'factory' => callable( string $api_key, array $settings ): TranscriptionProviderInterface ] ]`

Returns: array

Example

add_filter( 'benecaster_transcription_providers', function ( array $providers ): array {
    $providers['speechco'] = [
        'label'   => __( 'SpeechCo', 'my-plugin' ),
        'factory' => fn( string $api_key, array $settings ) => new My_SpeechCo_Provider( $api_key ),
    ];
    return $providers;
} );

Notes

The list is built once, on first use, so add your callback on or before init. The provider class implements BenecasterTranscription\Provider\TranscriptionProviderInterface; the walkthrough covers the interface: Add your own transcription provider to Transcription Service.

Need this built rather than just documented? See our services →