HomePortfolioHow it worksFAQAbout
Submit an idea
Google Cloud

How to get a Google Translate API key

How to enable the Cloud Translation API and create your own key. It takes about ten minutes, even the first time.

Do I actually need an API key?

No — the app works without one. With no key it translates on your device, which needs no internet and costs nothing.

A key makes translations more accurate, because Google Cloud's models are better than the on-device ones. Follow the steps below only if you want that.

  • 500,000 characters free every month — normal use rarely costs anything.
  • The key is stored only on your device and goes nowhere except Google.
  • You set your own usage cap (step 6).
1

Sign in to Google Cloud Console

You need a Google Cloud Platform account first.

  1. Go to Google Cloud Console.
  2. Sign in with your Google account, or create one.
  3. First-time users may need to accept the terms and add billing details. New accounts get $300 in free credit valid for 90 days.
2

Create a project

Create a project before making the key.

  1. Click the project selector at the top of the page.
  2. Choose "New project".
  3. Give it a name (for example, Translate-Project) and click "Create".
  4. If the console does not switch automatically, pick the new project from the selector.
3

Enable the Cloud Translation API

Turn the API on for your project.

  1. Go to "APIs & Services" > "Library".
  2. Search for "Cloud Translation API" and open it.
  3. Click "Enable".
  4. If asked to link a billing account, link one — or create it if you have none.

Why v2?

Google offers two editions of the translation API.

  • Basic (v2) — authenticates with an API key. This is what the app uses.
  • Advanced (v3) — more features such as glossaries, but it does not accept API keys; it requires service-account credentials.

Only v2 fits an app where you paste your own key, so this app and guide use v2.

4

Create the API key

With the API enabled, create the key.

  1. Go to APIs & Services > Credentials.
  2. Click "+ Create credentials" > "API key".
  3. When the key appears, copy it somewhere safe. You can reopen it from the list later.
  4. Do not close the dialog yet — restrict the key in the next step.
5

Restrict the key (please do this)

An unrestricted key, if it leaks, can be used against your other Google services too. Google strongly recommends setting restrictions.

  1. In the credentials list, click the name of the key you just made.
  2. Under API restrictions, choose "Restrict key" and select Cloud Translation API only.
  3. Click "Save".

Note

Application restrictions (Android app, IP address, and so on) are optional. Restricting to an Android app needs the package name and signing fingerprint (SHA-1), which most people cannot easily find. An API restriction plus a usage cap (step 6) already limits the damage well.

6

Cap your usage (recommended)

This is the surest way to avoid a surprise bill.

  1. Go to "APIs & Services" > "Cloud Translation API" > "Quotas & system limits".
  2. Find the character quota and edit it.
  3. Keeping it under 500,000 characters a month stays inside the free allowance.

If you think the key leaked

Delete it in the credentials list and create a new one. Deleting takes effect immediately.

7

Check your billing setup

Cloud Translation is billed by usage.

  • Free: 500,000 characters per month (resets monthly)
  • Beyond that: about $20 per million characters
  • Check current rates on the Google pricing page.
  1. Open "Billing" in the left menu.
  2. Confirm a billing account is linked to the project.
  3. Set a budget and alerts so you get an email before costs climb.
8

Watch your usage

An occasional look keeps costs predictable.

  1. Go to "APIs & Services" > "Enabled APIs & services".
  2. Click "Cloud Translation API".
  3. See recent usage on the Metrics tab.
  4. Check what is left, and adjust, on the Quotas tab.

Ready to start?

Follow the steps above in the Google Cloud Console. Once you have the key, paste it into the app's settings screen and you are done.

Open Google Cloud Console