Setup

To start using Cloud Translation, you need a project that has the Cloud Translation APIenabled and credentials to make authenticated calls. The following sectionsdetail how to get set up before you make your first call to the Cloud Translation API.

The setup process involves the Google Cloud console, which is a web interface thatyou can use to provision, configure, manage, and monitor systems inGoogle Cloud. If you haven't used the Google Cloud console before, see theCloud console page for more information.

Before you begin

Cloud Translation is available intwoeditions (Basic andAdvanced). Decide whichedition to use because each edition has its own set of client libraries.

Create or select a project

To use services provided by Google Cloud, you must create aproject. A project organizes all your Google Cloud resources. A project consists of a set of collaborators, enabled APIs (and other resources), monitoring tools, billing information, and authentication and access controls. You can create one project, or you can create multiple projects and use them to organize your Google Cloud resources in aresource hierarchy. When creating a project, take note of theproject ID. You will need this ID to make API calls. For more information on projects, see theResource Manager documentation.

We recommend that you create separate projects for experiments, testing, andproduction. After you create a project, record theproject number orID.You must provide the project number (or ID) when you make calls to theCloud Translation API.

In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

Roles required to select or create a project

  • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
  • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.create permission.Learn how to grant roles.

Go to project selector

Enable billing

You must enable billing to use Cloud Translation. For more information aboutCloud Translation pricing, see thepricing page.

Note: To help you manage your budget, you can set your usage limits on yourprojects. For more information, seeSet usage quotas.

A billing account is used to define who pays for a given set of resources, and it can be linked to one or more projects. Project usage is charged to the linked billing account. In most cases, you configure billing when you create a project. For more information, see theBilling documentation.

Verify that billing is enabled for your Google Cloud project.

Enabling the API

You must enable the Cloud Translation API for your project. For more information on enabling APIs, see theService Usage documentation.

Enable the Cloud Translation API.

Roles required to enable APIs

To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enable permission.Learn how to grant roles.

Enable the API

Set usage quotas

Cloud Translation has a quota management system to help you and Google manageusage of the service. By default, the number of characters that you can send perday is unlimited. If you have a set budget, we recommend monitoring your dailyusage and adjusting quotas according to your planned spend.

For more information about quotas, seeQuotas and limits.

Set up authentication

If you plan to use the Cloud Translation API, you need to set up authentication.Any client application that uses the API must be authenticated and grantedaccess to the requested resources. For more information, seeAuthenticate toCloud Translation.

Identity and Access Management roles

When a principal (user account, service account, and so on) calls an API,Google Cloud requires that the principal has the appropriate permissions.You can grant permissions by granting roles to a principal. For moreinformation, seeControl access withIAM.

Note:Role permissions only apply to Cloud Translation - Advanced. Although youcan use service accounts for both editions, you can only set specificpermissions for Cloud Translation - Advanced. For Cloud Translation - Basic, you canmake any request regardless of the service account's permissions.

Installing client libraries

Client libraries are available for several popular languages. We recommend thatyou use these client libraries to make calls to Cloud Translation because theymake it easier to access the APIs. If a client library doesn't meet yourneeds or isn't available for your language, build your own custom code. Formore information, seeUsing your own clientcode.

For example, when you use a client library, it can determine your credentialsimplicitly through theGOOGLE_APPLICATION_CREDENTIALS environment variable.You don't need to explicitly specify your credentials in code. For moreinformation, seeClient LibrariesExplained in the Cloud APIsdocumentation.

Cloud Translation - Basic client libraries

Select the programming language that you are using for development, and then runthe related command. For more information, see the Cloud Translation - Basicclient libraries overview.

C#

nuget install Google.Cloud.Translation.V2

Go

go get cloud.google.com/go/translate

Java

Caution: The Java client library does not support Android.

If you are usingMaven, addthe following to yourpom.xml file. For more information aboutBOMs, seeThe Google Cloud Platform Libraries BOM.

<dependencyManagement><dependencies><dependency><groupId>com.google.cloud</groupId><artifactId>libraries-bom</artifactId><version>26.72.0</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement><dependencies><dependency><groupId>com.google.cloud</groupId><artifactId>google-cloud-translate</artifactId></dependency></dependencies>

If you are usingGradle,add the following to your dependencies:

implementation'com.google.cloud:google-cloud-translate:2.80.0'

If you are usingsbt, addthe following to your dependencies:

libraryDependencies+="com.google.cloud"%"google-cloud-translate"%"2.80.0"

If you're using Visual Studio Code or IntelliJ, you can add client libraries to your project using the following IDE plugins:

The plugins provide additional functionality, such as key management for service accounts. Refer to each plugin's documentation for details.

Note: Cloud Java client libraries do not currently support Android.

Node.js

For more on setting up your Node.js development environment, refer to theNode.js Development Environment Setup Guide.

npm install @google-cloud/translate

PHP

composer require google/cloud-translate

Python

For more on setting up your Python development environment, refer to thePython Development Environment Setup Guide.

pip install google-cloud-translate==2.0.1

Ruby

For more on setting up your Ruby development environment, refer to theRuby Development Environment Setup Guide.

gem install google-cloud-translate-v2

Cloud Translation - Advanced client libraries

Select the programming language that you are using for development, and then runthe related command. For more information, see the Cloud Translation - Advancedclient libraries overview.

C#

nuget install Google.Cloud.Translate.V3 -Pre

Go

go get cloud.google.com/go/translate/apiv3

Java

Caution: The Java client library does not support Android.

If you are usingMaven, addthe following to yourpom.xml file. For more information aboutBOMs, seeThe Google Cloud Platform Libraries BOM.

<dependencyManagement><dependencies><dependency><groupId>com.google.cloud</groupId><artifactId>libraries-bom</artifactId><version>26.72.0</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement><dependencies><dependency><groupId>com.google.cloud</groupId><artifactId>google-cloud-translate</artifactId></dependency></dependencies>

If you are usingGradle,add the following to your dependencies:

implementation'com.google.cloud:google-cloud-translate:2.80.0'

If you are usingsbt, addthe following to your dependencies:

libraryDependencies+="com.google.cloud"%"google-cloud-translate"%"2.80.0"

If you're using Visual Studio Code or IntelliJ, you can add client libraries to your project using the following IDE plugins:

The plugins provide additional functionality, such as key management for service accounts. Refer to each plugin's documentation for details.

Note: Cloud Java client libraries do not currently support Android.

Node.js

For more on setting up your Node.js development environment, refer to theNode.js Development Environment Setup Guide.

npm install @google-cloud/translate

PHP

composer require google/cloud-translate

Python

For more on setting up your Python development environment, refer to thePython Development Environment Setup Guide.

pip install --upgrade google-cloud-translate

Ruby

For more on setting up your Ruby development environment, refer to theRuby Development Environment Setup Guide.

gem install google-cloud-translate

Install the Google Cloud CLI

Note: You can skip this step if you won't be using the command line to makeauthenticated API calls.

If you plan to send Cloud Translation requests through the command line (such asthrough curl commands), install and initialize thegcloud CLI, which is included in the Google Cloud CLI. The following linkprovides more information:

Install the Google Cloud CLI. After installation,initialize the Google Cloud CLI by running the following command:

gcloudinit

If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

Test the SDK and authentication

If you have set up theGOOGLE_APPLICATION_CREDENTIALS environment variable,you can usegcloud to test your authentication environment. Run the followingcommand and verify that no error occurs and that credentials are returned:

gcloud auth application-default print-access-token

The previous command is used by all Cloud Translation command line RESTsamples to authenticate API calls.

What's next

Try it for yourself

If you're new to Google Cloud, create an account to evaluate how Cloud Translation performs in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.

Try Cloud Translation free

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-15 UTC.