gpt4 book ai didi

java - Google 语音 API 凭据

转载 作者:行者123 更新时间:2023-12-02 01:29:42 25 4
gpt4 key购买 nike

我正在尝试使用 Google Speech API 但从 Google Cloud 外部进行一些测试。在旧的测试版中,我能够指定凭据文件,但现在我无法在 SpeechClient 类中找到此选项。

如何使用 Google Speech API Java 库指定身份验证 key ?

最佳答案

Frank 答案中的一些类现已弃用。这是他的答案的更新。

CredentialsProvider credentialsProvider = FixedCredentialsProvider.create(ServiceAccountCredentials.fromStream(new FileInputStream("path/to/service-account.json")));

SpeechSettings settings = SpeechSettings.newBuilder().setCredentialsProvider(credentialsProvider).build();
SpeechClient speechClient = SpeechClient.create(settings);

关于java - Google 语音 API 凭据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44409570/

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