This custom component integrates OpenAI Speech-to-Text, also known as Whisper, into Home Assistant via the OpenAI API.
You can install this integration via HACS.
- Go to HACS / Integrations / Three-dots menu / Custom repositories
- Add:
- Repository:
https://github.com/einToast/openai_stt_ha
- Category: Integration
- Repository:
- Install the "OpenAI Whisper API" integration.
- Restart Home Assistant.
- Inside your
config
directory, create a new directory namedcustom_components
. - Create a new directory named
openai_stt
inside thecustom_components
directory. - Place all the files from this repository in the
openai_stt
directory. - 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
:
stt:
- platform: openai_stt
api_key: YOUR_API_KEY
# Optional parameters
api_url: https://api.openai.com/v1
model: whisper-1
prompt: ""
temperature: 0
Parameters:
api_key
(Required): Your OpenAI API key.api_url
(Optional): The API URL to use. The default ishttps://api.openai.com/v1
. Specify this to use a different API than OpenAI's.model
(Optional): The model to use. The default iswhisper-1
. Currently, the only available model iswhisper-1
. The available models are listed here.prompt
(Optional): The prompt to use. The default is an empty string. See the OpenAI documentation for more information.temperature
(Optional): The temperature to use between 0 and 1. The default is 0. A higher temperature will make the model more creative, but less accurate.
The OpenAI API is a paid service. You can find the pricing here. Currently, Whisper costs $0.006 per 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.