Uberi / speech_recognition

Speech recognition module for Python, supporting several engines and APIs, online and offline.
https://pypi.python.org/pypi/SpeechRecognition/
BSD 3-Clause "New" or "Revised" License
8.44k stars 2.4k forks source link

API Key for recognize_google() #766

Open theyash14 opened 2 months ago

theyash14 commented 2 months ago

This is not a issue, rather I want to share my findings

Since I can see a lot of issues getting created around recognize_google(), I thought I will share my findings.

First steps, how do you get an API key of your own for recognize_google()

  1. Follow steps in Chromium dev.
  2. First get yourself a google cloud console account and create a project.
  3. With the same email, join the Chromium dev group. You can select "No email" if you want.
  4. In the left menu, go to API & Services -> Library.
  5. Search "Speech API", you can see it is a private API. Meaning, you can access this only if you join Chromium dev group.

Screenshot from 2024-09-08 17-21-42

  1. Enable the API and go to credentials page in the same API & Services.
  2. Click on create credentials and select API Key, a key will be generated (restrict this API key to Speech API only if you want).

And there you have it, your own API key that you can use with recognize_google()

Few thoughts on Speech API

It doesn't look like the Speech API incurs cost, and is advisable to use only for development/testing purposes. So, please don't use this for production as it is in the control of Google. Although in my testing, accuracy of Speech API > Cloud Speech API (for Japanese languge).

Final Thoughts

I know, this is too much information. Please ask, if you are stuck anywhere. Also please don't forget to gitignore your .env file before pushing. If you didn't then no worries, Our API Key 🤝.

TomKranenburg commented 3 weeks ago

Do you think it's more accurate?

theyash14 commented 1 week ago

Do you think it's more accurate?

In my testing, STT in japanese language was more accurate in this API than cloud speech API. But can't say for sure, might require more testing.