This custom component integrates OpenAI Speech-to-Text, also known as Whisper, into Home Assistant via the OpenAI API for use in the Assist pipeline.
This integration is part of the standard HACS repository. Just search for "OpenAI Whisper API" to install it, or use this link to go directly there:
- Inside your
configdirectory, create a new directory namedcustom_components - Create a new directory named
openai_sttinside thecustom_componentsdirectory - Place all the files from this repository in the
openai_sttdirectory - Restart Home Assistant
You need to create an account on the OpenAI website and get an API key.
Then add the following to your configuration.yaml and restart Home Assistant:
stt:
- platform: openai_stt
api_key: YOUR_API_KEY
# Optional parameters
realtime: false
api_url: https://api.openai.com/v1
model: gpt-4o-mini-transcribe
prompt: ""
temperature: 0
noise_reduction: nullapi_key(Required): Your OpenAI API keyrealtime(Optional): If set totrue, the integration will use the OpenAI Realtime API. This should generate faster results. If set tofalse, the integration will use the regular OpenAI Transcription API. The default isfalse. Keep in mind that the Realtime API is currently in beta and may not be as stable as the Transcription API. See the OpenAI documentation for more informationapi_url(Optional): The API URL to use. Specify this to use any compatible OpenAI API. The default ishttps://api.openai.com/v1.model(Optional): The model to use. Currently, the supported models aregpt-4o-mini-transcribe,gpt-4o-transcribeandwhisper-1. The default isgpt-4o-mini-transcribe. All available models are listed in the OpenAI model list under the Transcription sectionprompt(Optional): The prompt to use. The default is an empty string. See the OpenAI documentation for more informationtemperature(Optional): The temperature to use between0and1. A higher temperature will make the model more creative, but less accurate. The default is0. Only applicable whenrealtime: falsenoise_reduction(Optional): The noise reduction to use. The available options arenull,near_fieldandfar_field.near_fieldis for close-range audio,far_fieldis for distant audio,nullturns off noise reduction. The default isnull. Only applicable whenrealtime: true
See the accuracy comparison of the models here.
gpt-4o-mini-transcribe: model optimized for speed and cost. Cost: estimated$0.003per minute of audiogpt-4o-transcribe: model optimized for accuracy. Cost: estimated$0.006per minute of audiowhisper-1: originalwhisper-large-v2model. Superseded bygpt-4o-mini-transcribeandgpt-4o-transcribe. Cost:$0.006per minute of audio
If you get the following error in the Home Assistant system log:
The stt integration does not support any configuration parameters, got [{'platform': 'openai_stt', 'api_key': 'YOUR_API_KEY'}]. Please remove the configuration parameters from your configuration.
This issues is a known bug in Home Assistant >= 2023.7. The reported message does not affect the functionality of this integration, it should still work.