Activating Google Speech API in Firebase CLI?

2019-07-26 21:55发布

I get this error when I try to use Google Speech from either the cmd command line (Windows 10) using curl or from a local Firebase server.

"Cloud Speech API has not been used in project firebase-cli before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/speech.googleapis.com/overview?project=firebase-cli then retry"

Going to the suggested URL just gives the message:

The API "speech.googleapis.com" doesn't exist or you don't have permission to access it

The curl command has worked before. Login seems to work (using Bearer header). I have no idea why it does not work now. Did I do something before that made it work? Or is there some change to Firebase CLI/Google Speech?

EDIT: Here is the curl command that worked before. I do not think it matters here, but someone might be interested still:

@for /f %%i in ('gcloud auth application-default print-access-token') do @set bearer=%%i

curl -X POST ^
 -H "Authorization: Bearer %bearer%" ^
 -H "Content-Type: application/json; charset=utf-8" ^
 --data @request-flac.json ^
 "https://speech.googleapis.com/v1/speech:longrunningrecognize"

1条回答
趁早两清
2楼-- · 2019-07-26 22:45

Follow the Cloud Speech API quickstart. There is a button that will help you enable the API in your project. If you don't want to do it that way:

  1. Go to the GCP console
  2. Select the APIs and Services option in the left menu
  3. Select dashboard
  4. Click Enable APIs and Services
  5. Type "speech" in the search box
  6. Click the "Speech API" card
  7. Click Enable

This is the generalized way to enable APIs in your project.

查看更多
登录 后发表回答