申请 Google Translation API 并获得 API Key 的完整步骤

第一步:注册 Google Cloud 账号

  1. 打开 Google Cloud 官网.
  2. 点击右上角的 “Get started for free”(免费开始)。
  3. 登录你的 Google 账号(如果没有的话,需要先注册一个)。
  4. 根据提示填写信息,Google Cloud 会提供一个免费试用额度(比如 $300 美金,具体以页面显示为准)。

第二步:创建一个新项目

  1. 登录后,进入 Google Cloud 控制台.
  2. 点击页面顶部的 项目选择器(通常显示为“选择项目”或你的当前项目名)。
  3. 点击 “新建项目”。
  4. 输入项目名称,比如 TranslationAPI-Project,然后点击 创建。

第三步:启用 Google Translation API

  1. 在控制台顶部的搜索框输入:Cloud Translation API。
  2. 在搜索结果中找到 Cloud Translation API,点击它。
  3. 点击 启用(Enable) 按钮。

第四步:创建 API Key

  1. 在控制台左上角,点击主菜单(像三条横线的按钮)。
  2. 依次点击:API 和服务 → 凭据(Credentials)。
  3. 点击页面上方的 创建凭据(Create Credentials) → 选择 API 密钥(API Key)。
  4. 系统会自动生成一个 API Key,比如:AIzaSyDxxxxx...

第五步:保护你的 API Key(推荐)

防止别人盗用你的 Key,可以设置限制:

  1. 在生成 API Key 后,点击它进入编辑页面。
  2. 应用限制(Application restrictions):选择合适的使用场景,比如:
    • HTTP referrers (网站):如果你要在网页上用。
    • IP addresses (服务器 IP 地址):如果你在服务器上用。
  3. API 限制(API restrictions):启用只允许这个 Key 访问 Cloud Translation API。

设置好后,点击 保存(Save)。


第六步:开始使用

拿着你的 API Key,就可以通过不同的方式来调用 Google 的翻译服务了。

Contact Us Today, Get Reply Tomorrow

Your information will be kept strictly confidential.

Ben Fang, the author behind benf138.sg-host.com.

I am Ben Fang, the CEO of handyrocky.com, me and my team would be happy to meet you and learn all about your business, requirements and expectations.