I am attempting to set up Google Cloud Text-to-Speech API following these instructions - https://cloud.google.com/text-to-speech/docs/quickstart I have successfully followed steps 1-6 for setting up Google SDK and authenticating with service account credentials. However, when I attempt to run the sample HTTP request for synthesising speech I receive the following error:
Cloud Text-to-Speech API has not been used in project usable-auth-library before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/texttospeech.googleapis.com/overview?project=usable-auth-library then retry.
When following the link in the error message it leads to the following page:
The API "texttospeech.googleapis.com" doesn't exist or you don't have permission to access it.
I am grateful for help.
Text-to-Speech is priced based on the number of characters sent to the service to be synthesized into audio each month. You must enable billing to use Text-to-Speech, and will be automatically charged if your usage exceeds the number of free characters allowed per month.
Google Cloud Text-to-Speech API (Beta) allows developers to include natural-sounding, synthetic human speech as playable audio in their applications.
I easier to integrate in most plarforms using the API key instead of the service account key that Google recomends on their docs.
These are all the steps you need to get to the the API key
You'll probably only need the last step (if you followed all the steps correctly like you said).
And then you can use the curl command like so
Curl -H "X-Goog-Api-Key: PUT_YOUR_API_KEY_HERE" \
-H "Content-Type: application/json; charset=utf-8" \
--data "{
'input':{
'text':'Android is a mobile operating system developed by Google,
based on the Linux kernel and designed primarily for
touchscreen mobile devices such as smartphones and tablets.'
},
'voice':{
'languageCode':'en-gb',
'name':'en-GB-Standard-A',
'ssmlGender':'FEMALE'
},
'audioConfig':{
'audioEncoding':'MP3'
}
}" "https://texttospeech.googleapis.com/v1beta1/text:synthesize" > synthesize-text.txt
In case this helps anyone, I ran into this error after adding the API through the Google console to an existing Google Service Account with JWT credentials.
I followed the link to the Quickstart Protocol and was able to get it working On the page below, I clicked on Enable the API
.
https://cloud.google.com/text-to-speech/docs/quickstart-protocol
On the next page, I clicked the Create a project
drop down and selected an existing project. There was no need to get new credentials.
I'm using Go and was then able to run my code using golang.org/x/oauth2/google
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With