Skip to main content

Google Vertex AI

Follow the steps below to use Google Vertex AI models in ConsoleX.

Get a service account key​

To use Vertex AI, create a service account in your Google Cloud project and download its JSON key:

  1. Sign in to Google Cloud Console.
  2. Select your project.
  3. Go to IAM & Admin > Service Accounts.
  4. Click Create Service Account and complete the required information.
  5. In the Keys tab, click Add Key and download a JSON key.

Encode the credentials as Base64​

Use the following script to encode the service account JSON. Make sure the file path is correct before running it.

import base64
import json


def encode_credentials(file_path):
try:
with open(file_path, 'r') as file:
vertex_credentials = json.load(file)
credentials_str = json.dumps(vertex_credentials)
encoded_credentials = base64.urlsafe_b64encode(
credentials_str.encode('utf-8')
).decode('utf-8')
return encoded_credentials
except FileNotFoundError:
print(f"Error: file not found at {file_path}")
return False
except json.JSONDecodeError:
print("Error: failed to decode JSON from the file")
return False


encoded_credentials = encode_credentials('path-to-your-service-account-key.json')
print(encoded_credentials)

Add the Vertex AI credentials in ConsoleX​

Open the private integration page in ConsoleX and fill in:

  • Project ID: your Google Cloud project ID
  • Location: the region that will handle the request
  • Encoded Key: the Base64-encoded credential generated by the script above

Security​

Credentials you provide to ConsoleX are stored securely and encrypted. If you have security concerns, you can remove or disable the key at any time.

References​