Google api 错误400:消息:API密钥无效,请传递有效的API密钥。状态:无效参数

Google api 错误400:消息:API密钥无效,请传递有效的API密钥。状态:无效参数,google-api,raspberry-pi3,Google Api,Raspberry Pi3,所以当我尝试使用谷歌语音转换文本时,我卡住了。我基本上遵循这个准则。我正在使用raspberry pi将flac文件发送到谷歌云 #!/bin/bash # parameter 1 : file name, contains flac encoded voice recording echo Sending FLAC encoded Sound File to Google: key='' url='https://www.google.com/speech-api/v2/recognize?

所以当我尝试使用谷歌语音转换文本时,我卡住了。我基本上遵循这个准则。我正在使用raspberry pi将flac文件发送到谷歌云

#!/bin/bash
# parameter 1 : file name, contains flac encoded voice recording

echo Sending FLAC encoded Sound File to Google:
key=''
url='https://www.google.com/speech-api/v2/recognize?output=json&lang=en-us&key='$key
curl -i -X POST -H "Content-Type: audio/x-flac; rate=16000" --data-binary @$1 $url
echo '..all done'
但结果我一直得到这个

{
   "error": {
   "code": 400,
   "message": "API key not valid. Please pass a valid API key.",
   "status": "INVALID_ARGUMENT",
   "details": [
     {
        "@type": "type.googleapis.com/google.rpc.Help",
        "links": [
           {
        "description": "Google developers console",
        "url": "https://console.developers.google.com"
      }
    ]
  }
]
} } ……全部完成


任何人都可以帮助您找出问题所在?

您需要检查您在google帐户中创建的API密钥。可以是跳过任何单个步骤的更改,也可以是从项目中启用API密钥的其他方式。