尽管您可以通过直接发出请求来使用 Speech-to-Text,但我们也提供了几种主流语言的客户端库。Speech-to-Text 客户端库是基于 Google Cloud 客户端库构建的。这种通用基础架构提供了可实现 API 专属库的功能,另外还提供了在使用任何 Cloud API 时可以直接使用的类型和方法。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-22。"],[],[],null,["# Client libraries\n\nWhile you can use Speech-to-Text by making direct requests,\nwe provide client libraries for several popular languages.\nSpeech-to-Text client libraries are built on\n[Google Cloud Client Libraries](https://cloud.google.com/apis/docs/cloud-client-libraries).\nThis common infrastructure provides functionality for API-specific library implementations,\nbut it also provides types and methods that you may use directly when using any Cloud API.\n\nAvailable client libraries\n--------------------------\n\n\nSpeech-to-Text provides client libraries and guides for the following languages: \n\n### Python\n\n\nTo learn how to install and use the client library for Speech-to-Text, see\n[Speech-to-Text client libraries](/speech-to-text/docs/client-libraries).\n\n\nFor more information, see the\n[Speech-to-Text Python API\nreference documentation](/python/docs/reference/speech/latest).\n\n\nTo authenticate to Speech-to-Text, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n\nThis page provides reference documentation and related resources for the\nSpeech-to-Text Python client library.\n\n### Installation\n\n\nTo install the client library: \n\n```\npip install --upgrade google-cloud-speech\n```\n\n### Java\n\n\nTo learn how to install and use the client library for Speech-to-Text, see\n[Speech-to-Text client libraries](/speech-to-text/docs/client-libraries).\n\n\nFor more information, see the\n[Speech-to-Text Java API\nreference documentation](/java/docs/reference/google-cloud-speech/latest/overview).\n\n\nTo authenticate to Speech-to-Text, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n| **Caution:**The Java client library does not support Android.\n\n\nThis page provides reference documentation and related resources for the\nSpeech-to-Text Java client library.\n\n### Installation\n\n\nTo install the client library:\n\nIf you are using [Maven](https://maven.apache.org/), add\nthe following to your `pom.xml` file. For more information about\nBOMs, see [The Google Cloud Platform Libraries BOM](https://cloud.google.com/java/docs/bom). \n\n \u003cdependencyManagement\u003e\n \u003cdependencies\u003e\n \u003cdependency\u003e\n \u003cgroupId\u003ecom.google.cloud\u003c/groupId\u003e\n \u003cartifactId\u003elibraries-bom\u003c/artifactId\u003e\n \u003cversion\u003e26.66.0\u003c/version\u003e\n \u003ctype\u003epom\u003c/type\u003e\n \u003cscope\u003eimport\u003c/scope\u003e\n \u003c/dependency\u003e\n \u003c/dependencies\u003e\n \u003c/dependencyManagement\u003e\n\n \u003cdependencies\u003e\n \u003cdependency\u003e\n \u003cgroupId\u003ecom.google.cloud\u003c/groupId\u003e\n \u003cartifactId\u003egoogle-cloud-speech\u003c/artifactId\u003e\n \u003c/dependency\u003e\n \u003c/dependencies\u003e\n\nIf you are using [Gradle](https://gradle.org/),\nadd the following to your dependencies: \n\n implementation 'com.google.cloud:google-cloud-speech:4.67.0'\n\nIf you are using [sbt](https://www.scala-sbt.org/), add\nthe following to your dependencies: \n\n libraryDependencies += \"com.google.cloud\" % \"google-cloud-speech\" % \"4.67.0\"\n\nIf you're using Visual Studio Code, IntelliJ, or Eclipse, you can add client libraries to your\nproject using the following IDE plugins:\n\n- [Cloud Code for VS Code](/code/docs/vscode/client-libraries)\n- [Cloud Code for IntelliJ](/code/docs/intellij/client-libraries)\n- [Cloud Tools for Eclipse](/eclipse/docs/libraries)\n\nThe plugins provide additional functionality, such as key management for service accounts. Refer\nto each plugin's documentation for details.\n| **Note:** Cloud Java client libraries do not currently support Android.\n\n### Node.js\n\n\nTo learn how to install and use the client library for Speech-to-Text, see\n[Speech-to-Text client libraries](/speech-to-text/docs/client-libraries).\n\n\nFor more information, see the\n[Speech-to-Text Node.js API\nreference documentation](/nodejs/docs/reference/speech/latest).\n\n\nTo authenticate to Speech-to-Text, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n\nThis page provides reference documentation and related resources for the\nSpeech-to-Text Node.js client library.\n\n### Installation\n\n\nTo install the client library: \n\n```\nnpm install @google-cloud/speech\n```\n\n### C#\n\n\nTo learn how to install and use the client library for Speech-to-Text, see\n[Speech-to-Text client libraries](/speech-to-text/docs/client-libraries).\n\n\nTo authenticate to Speech-to-Text, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n\nThis page provides reference documentation and related resources for the\nSpeech-to-Text C# client library.\n\n### Installation\n\n\nTo install the client library: \n\n```\nInstall-Package Google.Cloud.Speech.V1 -Pre\n```\n\n### C++\n\n\nTo learn how to install and use the client library for Speech-to-Text, see\n[Speech-to-Text client libraries](/speech-to-text/docs/client-libraries).\n\n\nTo authenticate to Speech-to-Text, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n\nThis page provides reference documentation and related resources for the\nSpeech-to-Text C++ client library.\n\n### Installation\n\n\nTo install the client library:\nSee [Setting Up a C++ Development Environment](/cpp/docs/setup).\n\n### Go\n\n\nTo learn how to install and use the client library for Speech-to-Text, see\n[Speech-to-Text client libraries](/speech-to-text/docs/client-libraries).\n\n\nFor more information, see the\n[Speech-to-Text Go API\nreference documentation](/go/docs/reference/cloud.google.com/go/speech/latest/apiv1).\n\n\nTo authenticate to Speech-to-Text, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n\nThis page provides reference documentation and related resources for the\nSpeech-to-Text Go client library.\n\n### Installation\n\n\nTo install the client library: \n\n```\ngo get cloud.google.com/go/speech/apiv1\n```\n\n### PHP\n\n\nTo learn how to install and use the client library for Speech-to-Text, see\n[Speech-to-Text client libraries](/speech-to-text/docs/client-libraries).\n\n\nTo authenticate to Speech-to-Text, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n\nThis page provides reference documentation and related resources for the\nSpeech-to-Text PHP client library.\n\n### Installation\n\n\nTo install the client library: \n\n```\ncomposer require google/cloud-speech\n```\n\n### Ruby\n\n\nTo learn how to install and use the client library for Speech-to-Text, see\n[Speech-to-Text client libraries](/speech-to-text/docs/client-libraries).\n\n\nTo authenticate to Speech-to-Text, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\nThe Ruby client libraries for Speech-to-Text are\ncurrently released as Beta.\n\n\nThis page provides reference documentation and related resources for the\nSpeech-to-Text Ruby client library.\n\n### Installation\n\n\nTo install the client library: \n\n```\ngem install google-cloud-speech\n```\n\nAuthentication and access control\n---------------------------------\n\n\nThe Speech-to-Text quickstart guides provide basic information\non authentication and access control.\nFor more detailed information, see the following:\n\n- [Authentication methods](/docs/authentication)\n- [Understanding roles](/iam/docs/understanding-roles)"]]