title: How set API KEY in Google Translate Node.js code
body: <p>I'm trying to create a Node.js code that uses google translate api.
  I got the code below from the google doc (<a href="https://cloud.google.com/translate/docs/translating-text" rel="noreferrer">https://cloud.google.com/translate/docs/translating-text</a>)</p>
  
  <p>But when I run it, it says "Error: The request is missing a valid API key."
  I have the key, but i don't know how and where to set it.</p>
  
  <pre><code>async function translate() { // Imports the Google Cloud client library
      const { Translate } = require('@google-cloud/translate');
  
      // Creates a client
      const translate = new Translate();
  
      /**
       * TODO(developer): Uncomment the following lines before running the sample.
       */
      const text = 'Hello, world!';
      const target = 'ru';
  
      // Translates the text into the target language. "text" can be a string for
      // translating a single piece of text, or an array of strings for translating
      // multiple texts.
      let [translations] = await translate.translate(text, target);
      translations = Array.isArray(translations) ? translations : [translations];
      console.log('Translations:');
      translations.forEach((translation, i) =&gt; {
          console.log(`${text[i]} =&gt; (${target}) ${translation}`);
      });
  }
  translate()
  </code></pre>