gpt4 book ai didi

google-cloud-platform - Google Cloud Text-to-Speech API - 权限错误

转载 作者:行者123 更新时间:2023-12-04 15:39:35 28 4
gpt4 key购买 nike

我正在尝试按照以下说明设置 Google Cloud Text-to-Speech API - https://cloud.google.com/text-to-speech/docs/quickstart
我已成功按照步骤 1-6 设置 Google SDK 并使用服务帐户凭据进行身份验证。
但是,当我尝试运行用于合成语音的示例 HTTP 请求时,我收到以下错误:

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.



当点击错误消息中的链接时,它会转到以下页面:

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



我很感激帮助。

最佳答案

我更容易使用 API key 而不是 Google 在其文档中推荐的服务帐户 key 集成到大多数平台中。

这些是获取 API key 所需的所有步骤

  • CloudConsole 中创建一个项目(或使用现有项目) .
  • 确保 billing已为您的项目启用。
  • 启用 Text-to-Speech API .
  • 创建 API key .

  • 您可能只需要最后一步(如果您像您说的那样正确地执行了所有步骤)。

    然后你可以像这样使用 curl 命令
    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

    关于google-cloud-platform - Google Cloud Text-to-Speech API - 权限错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49800921/

    28 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com