Google Cloud语音转文本API产生429错误:RESOURCE_EXHAUSTED

时间:2019-07-14 15:18:45

标签: google-cloud-platform google-cloud-storage google-speech-api

我正在使用以下命令向Google云语音文本API发送请求:

{
  "config": {
    "languageCode": "en-US",
    "enableSpeakerDiarization": true,
    "model": "phone_call",
    "useEnhanced": true,
    "profanityFilter": false,
    "enableAutomaticPunctuation": true,
    "metadata": {
      "interactionType": "PHONE_CALL"
    }
  },
  "audio": {
    "uri": "gs://SOME_BUCKET/d44766a1-a83c-44ae-93d8-a606e126e4cb.flac"
  }
}

但是,我得到了答复:

{
  "error": {
    "code": 429,
    "message": "Quota exceeded for quota metric 'speech.googleapis.com/default_requests' and limit 'DefaultRequestsPerMinutePerProject' of service 'speech.googleapis.com' for consumer 'project_number:292824132082'.",
    "status": "RESOURCE_EXHAUSTED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.Help",
        "links": [
          {
            "description": "Google developer console API key",
            "url": "https://console.developers.google.com/project/myID/apiui/credential"
          }
        ]
      }
    ]
  }
}

现在这对我来说并没有太大意义,因为我的配额甚至还没有接近达到目标: enter image description here

此外,我怀疑这是一个长度问题,因为我的FLAC文件只有5MB(不到3分钟)。还有什么呢?

更新 多亏Christopher,我们到了!当我curl时,我得到:

{
  "error": {
    "code": 403,
    "message": "Anonymous caller does not have storage.objects.get access to SOME_BUCKET/d44766a1-a83c-44ae-93d8-a606e126e4cb.flac.",
    "status": "PERMISSION_DENIED"
  }
}

那么,如何确保我的API调用可以访问该存储桶,而不必将其显式公开给全世界?

0 个答案:

没有答案