text, translation, },message:'成功', }) }else{ res.send({code:400,message:'失败:参数apiKey', }) } } https://console.cloud.google.com/apis/dashboard?hl=zh-cn&project=xutongbao https://stackoverflow.com/questions/55732639/how-set-api-key-in-google-translate-node-js-code/68293290#6829...
const translate = new Translate({ projectId, key: googleKey }) const chatGoogleTranslateOnAzure = async (req, res) => { let { text = '你好', target = 'en', apiKey = 'sk-xxx' } = req.body if (apiKey === 'xxx') { const [translation] = await translate.translate(text, target...
第一、v2 和 v3 的 API 接口完全不同。 第二、v2 只需要 API Keys 就可以使用了,v3 却一定要 OAuth 才能使用。 Setup 和Google Reviews、YouTube Data API 类似。 1. Google Cloud Account(要绑定信用卡哦) 2. Google Cloud Project 3. Enable Cloud Translation API 4. OAuth(App, Client id, Client ...
// 初始化OAuth2.0授权 const authenticate = () => { return gapi.auth2.getAuth...
https://console.cloud.google.com 1.创建项目 2.您需要为此项目提供一个计费帐户,然后才能激活该服务。 访问API控制台以配置结算帐户,然后返回此处继续操作。 3.下载秘钥 4.为项目开启API功能 5.搜索需要开启的API类型 6.创建API Key 服务器中先安装composer composer require google/cloud-translate 记得...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import time from googletrans ...
6.创建服务找好JSON Key ⽂件,⽤于服务账号调⽤API认证:gcloud iam service-accounts keys create ./ml-dev.json \ --iam-account ml-dev@$PROJECT_ID.iam.gserviceaccount.com #注:文件会下载在当前目录下 7.将您的服务帐户 JSON 密钥导出到 shell 环境变量,以便实⽤程序可以使⽤ Cloud AI ...
set GOOGLE_APPLICATION_CREDENTIALS=KEY_PATH #将 KEY_PATH 替换为包含您的服务帐号密钥的 JSON 文件的路径。 4.验证 您可以通过 REST 方法调用基本版 translate 方法来发出 Cloud Translation 基本版请求 HTTP 方法和网址: POST https://translation.googleapis.com/language/translate/v2 ...
Google Translate API settings In the API field, enter the API key from your Google Cloud Translation account. To do so, you’ll need to create an account in theGoogle Cloud Platformand get the API key in theCredentialssection. Google Translate languages ...
EnableGoogle Cloud Translation API. Enable Google Cloud Translation API… 3. Create a credentials key for your account.. Navigate to the API Manager section of your project dashboard, Create Credentials… In the drop down menu, selectAPI key: ...