Skip to main content
RapidDev - Software Development Agency
retool-integrationsREST API Resource

How to Integrate Retool with Google Cloud AI Platform

Connect Retool to Google Cloud AI Platform (Vertex AI) by creating a REST API Resource with a Google service account for authentication. Once configured, your Retool app can submit prediction requests to deployed models, list training jobs, and monitor experiment metrics — giving data science and ML ops teams a centralized internal dashboard for managing their Vertex AI infrastructure without leaving the Retool environment.

What you'll learn

  • How to create a Google service account and configure it as a REST API Resource in Retool
  • How to obtain and refresh OAuth 2.0 access tokens for Vertex AI API authentication
  • How to submit online prediction requests to deployed Vertex AI endpoints from Retool
  • How to build an ML ops dashboard showing training jobs, deployed models, and performance metrics
  • How to use JavaScript transformers to reshape Vertex AI prediction responses for display in Retool tables
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Advanced16 min read30 minutesAI/MLLast updated April 2026RapidDev Engineering Team
TL;DR

Connect Retool to Google Cloud AI Platform (Vertex AI) by creating a REST API Resource with a Google service account for authentication. Once configured, your Retool app can submit prediction requests to deployed models, list training jobs, and monitor experiment metrics — giving data science and ML ops teams a centralized internal dashboard for managing their Vertex AI infrastructure without leaving the Retool environment.

Quick facts about this guide
FactValue
ToolGoogle Cloud AI Platform
CategoryAI/ML
MethodREST API Resource
DifficultyAdvanced
Time required30 minutes
Last updatedApril 2026

Why connect Retool to Google Cloud AI Platform?

Data science teams that deploy models on Vertex AI typically lack a centralized operational dashboard for day-to-day model management. The Google Cloud Console is comprehensive but not tailored for non-engineers, and building custom internal tooling from scratch is time-consuming. Retool bridges this gap by letting you query Vertex AI's REST API directly alongside your databases, CRMs, and other operational data sources — all in one internal tool.

The most valuable Retool-Vertex AI integrations involve ML operations workflows: a model performance monitoring dashboard that pulls prediction accuracy metrics alongside business KPIs from your data warehouse, an inference testing panel where product managers can submit test inputs and review model outputs without touching the Cloud Console, or a training job tracker that shows pipeline status with automated Slack notifications when jobs complete or fail. These are all straightforward to build once the REST API Resource is configured.

Vertex AI exposes a comprehensive REST API under https://us-central1-aiplatform.googleapis.com/v1/ (adjust the region to match your deployment). The API covers endpoints (deployed model serving), model management, training pipelines, datasets, and experiments. Each call requires a Bearer token obtained from Google's token endpoint using your service account credentials. The token exchange itself can be done via Retool's Custom Auth flow, or more simply by obtaining a token externally and storing it in a configuration variable that you refresh periodically.

Integration method

REST API Resource

Retool connects to Google Cloud AI Platform (Vertex AI) via a REST API Resource using a Google service account for authentication. The service account generates a short-lived OAuth 2.0 access token that is passed as a Bearer token header in each API request. Retool proxies all requests server-side, so your service account credentials are never exposed to the browser. Queries target Vertex AI REST endpoints for predictions, model management, and training job status.

Prerequisites

  • A Google Cloud project with Vertex AI API enabled (Cloud Console → APIs & Services → Enable APIs)
  • A Google Cloud service account with Vertex AI User role (or more specific roles like roles/aiplatform.user)
  • A service account JSON key file downloaded from Google Cloud IAM
  • At least one deployed model endpoint in Vertex AI, or training jobs to monitor
  • A Retool account with Resource creation permissions and familiarity with REST API Resources

Step-by-step guide

1

Create a Google Cloud service account and download credentials

Navigate to Google Cloud Console → IAM & Admin → Service Accounts and click Create Service Account. Give it a descriptive name like retool-vertex-ai-reader. On the permissions step, assign the role Vertex AI User (roles/aiplatform.user) for read and prediction access, or Vertex AI Admin if you need full management capability including model deployment. Click Done to create the account. Next, select the newly created service account from the list, go to the Keys tab, and click Add Key → Create new key → JSON. Google downloads a JSON credentials file to your computer. This file contains the service account email, private key ID, and a private key in RSA format. Keep this file secure — it grants programmatic access to your Vertex AI resources. You will extract the service account email and private key from this file to configure authentication in Retool. Note your Google Cloud project ID and the region where your Vertex AI resources are deployed (e.g., us-central1, europe-west4) as you will need both when constructing API endpoint URLs.

Pro tip: Follow the principle of least privilege: if this Retool integration only needs to submit predictions, assign roles/aiplatform.predictor instead of full Admin access. Google Cloud's predefined Vertex AI roles are granular enough to restrict access precisely.

Expected result: A service account JSON key file is downloaded to your computer containing the private_key, client_email, and project_id fields needed for Retool configuration.

2

Obtain an access token and configure the REST API Resource

Vertex AI requires a short-lived OAuth 2.0 Bearer token for every API request. The recommended approach for Retool is to use Google's token endpoint to exchange your service account credentials for an access token, then store that token in a Retool configuration variable. Navigate to Settings → Configuration Variables in Retool and add a variable named VERTEX_AI_TOKEN — mark it as a secret so it is restricted to resource configurations. To obtain the token, use the Google token endpoint: POST to https://oauth2.googleapis.com/token with your service account's private key signed JWT. You can generate this token using a script locally or via Google Cloud CLI (gcloud auth print-access-token), then paste the output into the configuration variable. Note that tokens expire after one hour; for production use, implement a Retool Workflow on a 50-minute schedule that refreshes the token automatically. Now navigate to the Resources tab, click Add Resource, and select REST API. Name the resource Vertex AI. Set the Base URL to https://REGION-aiplatform.googleapis.com/v1/projects/YOUR_PROJECT_ID (replace REGION with your deployment region like us-central1 and YOUR_PROJECT_ID with your actual project ID). Under Headers, add Authorization with the value Bearer {{ environment.variables.VERTEX_AI_TOKEN }}. Save the resource. Retool will proxy all queries through this base URL with the Bearer token injected automatically.

token_refresh.js
1// Retool Workflow: Auto-refresh Vertex AI access token
2// Run this on a 50-minute schedule to keep the token fresh
3// This is a JavaScript code block — calls gcloud token endpoint
4
5// Using a service account JWT exchange
6// In practice: call your own token-refresh endpoint or
7// use Google's token API with a pre-signed JWT
8
9// Example transformer to parse the token response
10const tokenResponse = fetchTokenQuery.data;
11const accessToken = tokenResponse.access_token;
12
13// Store in a config variable via Retool's REST API
14// Or simply return the token for use in subsequent blocks
15return { access_token: accessToken, expires_in: tokenResponse.expires_in };

Pro tip: Tokens from gcloud auth print-access-token are valid for exactly 3600 seconds (1 hour). Schedule your token refresh Workflow to run every 50 minutes to give a safe buffer before expiration.

Expected result: The Vertex AI REST API Resource is saved in Retool with the Base URL pointing to your project's regional endpoint and the Authorization header referencing the stored access token configuration variable.

3

List deployed endpoints and build the endpoint selector

Open or create a Retool app and click + to create a new query in the Code panel. Select the Vertex AI resource. Set the HTTP method to GET and the path to /locations/REGION/endpoints (replace REGION with your actual region, e.g., us-central1). Leave the body empty. Click Run to execute the query. Vertex AI returns a JSON response with an endpoints array, where each endpoint has a name field in the format projects/PROJECT_ID/locations/REGION/endpoints/ENDPOINT_ID, along with a displayName, createTime, and deployedModels array showing which models are currently serving traffic. Create a JavaScript transformer to extract the endpoint list into a clean format for a Select component. Drag a Select component onto the canvas and set its data source to {{ listEndpoints.data }}. Set the label field to displayName and the value field to the endpoint name string. This dropdown lets users switch between different deployed models in the testing panel. Add a Text component above the Select labeled Active Endpoint and a Stat component below showing the number of deployed models from the selected endpoint's deployedModels array. Name this query listEndpoints and set it to run on page load.

endpoint_transformer.js
1// Transformer to clean up Vertex AI endpoint list for Select component
2const endpoints = data.endpoints || [];
3return endpoints.map(ep => {
4 // Extract just the endpoint ID from the full resource name
5 const parts = ep.name.split('/');
6 const endpointId = parts[parts.length - 1];
7 const modelCount = (ep.deployedModels || []).length;
8 return {
9 label: ep.displayName || endpointId,
10 value: ep.name,
11 endpoint_id: endpointId,
12 deployed_models: modelCount,
13 create_time: new Date(ep.createTime).toLocaleDateString()
14 };
15});

Pro tip: If you have many endpoints across multiple regions, create a separate configuration variable VERTEX_AI_REGION and reference it in query paths: /locations/{{ retoolContext.configVars.VERTEX_AI_REGION }}/endpoints. This makes your app region-configurable without code changes.

Expected result: The listEndpoints query returns your deployed Vertex AI endpoints and a Select dropdown on the canvas shows their display names, allowing users to choose which endpoint to query.

4

Build the prediction request panel

Create a new query named submitPrediction. Set the HTTP method to POST and the path to {{ endpointSelector.value }}:predict — this constructs the full prediction endpoint URL dynamically based on the Select component's chosen value. The Vertex AI prediction request body requires an instances array where each element is one prediction input. Add a JSONEditorComponent or TextArea to the canvas labeled Prediction Input (JSON) where users can enter their model's expected input format. Set the query body type to JSON and enter the body as { "instances": {{ JSON.parse(predictionInput.value) }} }. Add error handling for invalid JSON by wrapping the parse in a try/catch in a JavaScript query that validates before submission. Create a Submit Prediction button and set its onClick event to trigger submitPrediction. After the query succeeds, display the results: the Vertex AI response contains a predictions array with one result per input instance. Drag a Table component and bind it to {{ submitPrediction.data.predictions }}. For classification models, each prediction is typically an array of confidence scores — use a JavaScript transformer to pair confidence values with class labels from a separate configuration array. Add a JSON Viewer component as an alternative raw response display, binding it to {{ submitPrediction.data }} for users who need to inspect the full API response.

prediction_transformer.js
1// Transformer to format classification predictions with class labels
2// Assumes predictions are arrays of confidence scores
3const predictions = data.predictions || [];
4const classLabels = ['class_0', 'class_1', 'class_2']; // Update to match your model
5
6return predictions.map((predScores, instanceIdx) => {
7 const formatted = { instance: instanceIdx + 1 };
8 const scores = Array.isArray(predScores) ? predScores : [predScores];
9 scores.forEach((score, i) => {
10 formatted[classLabels[i] || `class_${i}`] =
11 typeof score === 'number' ? (score * 100).toFixed(2) + '%' : score;
12 });
13 // Find the top predicted class
14 if (Array.isArray(scores)) {
15 const maxIdx = scores.indexOf(Math.max(...scores));
16 formatted.predicted_class = classLabels[maxIdx] || `class_${maxIdx}`;
17 formatted.confidence = (Math.max(...scores) * 100).toFixed(2) + '%';
18 }
19 return formatted;
20});

Pro tip: Different Vertex AI model types (tabular, image, text) return very different prediction schemas. Consult your model's documentation in Vertex AI Model Registry to understand the exact response structure before writing your transformer.

Expected result: A prediction panel shows a JSON input textarea, a Submit button, and a Table displaying formatted prediction results. Submitting a valid instances payload returns predictions from the deployed model and renders them in the table.

5

Add training job monitoring and finalize the dashboard

Create a third query named listTrainingPipelines. Set the HTTP method to GET and the path to /locations/REGION/trainingPipelines. Add a query parameter filter with value state=PIPELINE_STATE_RUNNING to optionally filter by status — remove the filter to see all pipelines. The response returns a trainingPipelines array with fields including displayName, state, createTime, startTime, endTime, and error. Write a JavaScript transformer to calculate duration for each pipeline and format state values into human-readable labels. Drag a Table onto the canvas and bind it to {{ listTrainingPipelines.data }}. Configure conditional row formatting: highlight rows where state === 'PIPELINE_STATE_FAILED' in red and PIPELINE_STATE_RUNNING in yellow. Add a Select component above the table to filter by pipeline state. For the pipeline state values, use Vertex AI's enum strings: PIPELINE_STATE_QUEUED, PIPELINE_STATE_PENDING, PIPELINE_STATE_RUNNING, PIPELINE_STATE_SUCCEEDED, PIPELINE_STATE_FAILED, PIPELINE_STATE_CANCELLING, PIPELINE_STATE_CANCELLED, PIPELINE_STATE_PAUSED. Add a Refresh button at the top of the dashboard that triggers all three queries simultaneously using event handlers. Set listTrainingPipelines to auto-run on page load and configure a 5-minute auto-refresh interval. For complex ML ops workflows involving multiple Resources, custom transformers, and Retool Workflows for automated alerting, RapidDev's team can help architect and build your Retool solution.

pipeline_transformer.js
1// Transformer for training pipeline list
2const pipelines = data.trainingPipelines || [];
3const stateLabels = {
4 PIPELINE_STATE_QUEUED: 'Queued',
5 PIPELINE_STATE_PENDING: 'Pending',
6 PIPELINE_STATE_RUNNING: 'Running',
7 PIPELINE_STATE_SUCCEEDED: 'Succeeded',
8 PIPELINE_STATE_FAILED: 'Failed',
9 PIPELINE_STATE_CANCELLING: 'Cancelling',
10 PIPELINE_STATE_CANCELLED: 'Cancelled',
11 PIPELINE_STATE_PAUSED: 'Paused'
12};
13
14return pipelines.map(p => {
15 const start = p.startTime ? new Date(p.startTime) : null;
16 const end = p.endTime ? new Date(p.endTime) : new Date();
17 const durationMs = start ? end - start : 0;
18 const durationHrs = (durationMs / 3600000).toFixed(1);
19 return {
20 name: p.displayName,
21 state: stateLabels[p.state] || p.state,
22 raw_state: p.state,
23 created: new Date(p.createTime).toLocaleString(),
24 duration_hours: start ? durationHrs + 'h' : 'N/A',
25 error: p.error?.message || ''
26 };
27});

Pro tip: Set up a Retool Workflow with a 10-minute schedule that checks for PIPELINE_STATE_FAILED pipelines and sends a Slack message to your ML team channel when failures are detected — this is much faster than watching the Cloud Console.

Expected result: A complete ML ops dashboard shows an endpoint selector for predictions at the top, a prediction testing panel in the middle, and a training pipeline monitoring table at the bottom — all pulling live data from Vertex AI through the REST API Resource.

Common use cases

ML model inference testing panel

Build a Retool panel where data scientists and product managers can submit test inputs to any deployed Vertex AI endpoint and review the prediction response side by side with the input. A Select component lets users pick the deployed endpoint, a JSON input field accepts the instances payload, and the response prediction values are displayed in a Table with confidence scores. This replaces ad-hoc curl commands and makes model testing accessible to non-technical stakeholders.

Retool Prompt

Build a Retool app with a Select dropdown listing deployed Vertex AI endpoint IDs, a JSON textarea for entering prediction instances, a Submit button that sends a POST request to the selected endpoint's predict method, and a Table component displaying the prediction values and confidence scores from the response.

Copy this prompt to try it in Retool

Training job monitoring dashboard

Create a real-time training pipeline tracker that lists all running and completed Vertex AI training jobs with their status, start time, elapsed duration, and error messages. A Chart component shows training loss curves pulled from experiment metrics. When a job transitions to FAILED state, a Retool Workflow sends a Slack notification to the ML team. This gives the team visibility into long-running jobs without constantly checking the Cloud Console.

Retool Prompt

Build a Retool dashboard that queries Vertex AI for all training pipelines in the last 7 days, displays them in a Table with columns for name, status, create time, and end time, uses conditional row coloring to highlight FAILED jobs in red, and shows a Chart of training metrics for the selected job.

Copy this prompt to try it in Retool

Model version comparison panel

Build a side-by-side model comparison tool that retrieves evaluation metrics for multiple deployed model versions from Vertex AI Model Registry. The dashboard shows accuracy, precision, recall, and F1 scores in a Table for each version, along with a Bar Chart comparing key metrics visually. A Deploy button triggers the appropriate Vertex AI endpoint update operation to swap the production model version after comparison.

Retool Prompt

Build a Retool app that lists all model versions in a selected Vertex AI Model Registry entry, displays evaluation metrics for each version in a Table, renders a Bar Chart comparing accuracy and F1 score across versions, and includes a Deploy button that calls the endpoint update API to set a chosen version as the active deployed model.

Copy this prompt to try it in Retool

Troubleshooting

API returns 401 Unauthorized on all requests

Cause: The access token stored in the configuration variable has expired (tokens are valid for 1 hour) or the Bearer token header is not correctly formatted in the Resource configuration.

Solution: Refresh the access token by running gcloud auth print-access-token in Google Cloud Shell or using your token refresh Workflow, then update the VERTEX_AI_TOKEN configuration variable in Settings → Configuration Variables. Verify the Authorization header in the REST API Resource is set to Bearer {{ environment.variables.VERTEX_AI_TOKEN }} with a space between Bearer and the token variable reference.

Prediction request returns 'Endpoint not found' or 404 error

Cause: The endpoint resource name path is incorrect. Vertex AI endpoint names follow the format projects/PROJECT_ID/locations/REGION/endpoints/ENDPOINT_ID and must be exact — including the correct project ID, region, and numeric endpoint ID.

Solution: In the listEndpoints query, confirm the name field returned matches the format above. Verify the Base URL in the REST API Resource contains the correct project ID and region. In the submitPrediction query, ensure the path appends :predict to the full endpoint name (not just the endpoint ID). Check that the endpoint is in DEPLOYED state in the Vertex AI Console — endpoints with no deployed models return 404.

Prediction request returns 400 Bad Request with 'instances field is required'

Cause: The request body is not structured correctly. Vertex AI's online prediction API requires the body to have an instances key containing an array, even for single predictions.

Solution: Verify the query body is set to JSON type and contains { "instances": [ your_input_here ] } with the input wrapped in an array. If the user is pasting raw JSON objects without the array wrapper, add validation logic: parse the input and if it is an object (not an array), wrap it automatically before sending.

typescript
1// Validate and wrap prediction input before sending
2const rawInput = JSON.parse(predictionInput.value);
3const instances = Array.isArray(rawInput) ? rawInput : [rawInput];
4return { instances: instances };

Service account lacks permission to access the endpoint

Cause: The service account was created but not assigned the correct IAM role on the Google Cloud project, or the role was applied at the wrong resource level (folder vs. project vs. resource).

Solution: Go to Google Cloud Console → IAM & Admin → IAM, find the service account email, and confirm it has the Vertex AI User role (roles/aiplatform.user) or Vertex AI Predictor role (roles/aiplatform.predictor) on the project. If roles appear correct, check that the project ID in the Retool Resource Base URL matches the project where the service account role was assigned.

Best practices

  • Implement an automated token refresh Retool Workflow on a 50-minute schedule to keep the Vertex AI access token current — expired tokens cause silent 401 failures during business hours.
  • Store the Google Cloud project ID and region in Retool configuration variables rather than hardcoding them in query paths, so you can switch between staging and production Vertex AI projects by changing a single configuration value.
  • Use separate REST API Resources for different Vertex AI regions if your models are deployed across multiple regions — this keeps base URLs clean and avoids dynamic region switching in query paths.
  • Apply JavaScript transformers to normalize Vertex AI's nested prediction response format before binding to Table components — raw prediction arrays with positional values are difficult to read without named keys.
  • Set query caching (30-60 seconds) on listing queries like listEndpoints and listTrainingPipelines, which change infrequently — this reduces API calls when multiple users are viewing the dashboard simultaneously.
  • Use Retool's configuration variables marked as secrets for the access token — this prevents the token from being visible in browser DevTools or Retool's query logs.
  • For inference testing panels, add input validation logic in a JavaScript query before the prediction POST to catch malformed JSON early and return a helpful error message rather than a cryptic 400 response from Vertex AI.

Alternatives

Frequently asked questions

Does Retool have a native connector for Google Cloud AI Platform?

No. Retool does not have a dedicated native connector for Vertex AI or Google Cloud AI Platform. You connect via a REST API Resource using Google service account Bearer token authentication. This is the standard approach for all Google Cloud APIs in Retool. The Retool server-side proxy handles the API requests, so credentials are not exposed to the browser.

How do I handle the 1-hour access token expiration for Vertex AI?

Create a Retool Workflow with a scheduled trigger set to run every 50 minutes. The workflow makes a POST request to Google's OAuth token endpoint (https://oauth2.googleapis.com/token) using your service account's credentials to obtain a fresh access token, then updates the VERTEX_AI_TOKEN configuration variable. Alternatively, use a server-side token refresh endpoint in your own infrastructure and have Retool call it. Tokens expire exactly at 3600 seconds, so a 50-minute refresh schedule provides a safe buffer.

Can I call both Vertex AI endpoints and other Google Cloud services from the same Retool resource?

Yes, but it requires careful Base URL design. The Vertex AI regional endpoint (https://REGION-aiplatform.googleapis.com/v1/) is specific to Vertex AI. For other Google Cloud services like BigQuery or Cloud Storage, you would create separate REST API Resources with their respective base URLs. All can share the same service account access token stored in a configuration variable, as long as the service account has appropriate IAM roles for each service.

What is the difference between online prediction and batch prediction in Vertex AI, and which does Retool support?

Online prediction (real-time) calls a deployed endpoint synchronously and returns results immediately — this is what the Retool REST API Resource supports via the :predict method. Batch prediction submits large datasets to a job that runs asynchronously and writes results to Cloud Storage or BigQuery. Retool can trigger batch prediction jobs via the batchPredictionJobs API and monitor their status, but cannot display results until they are written to an accessible storage location like BigQuery (which Retool has a native connector for).

Can I deploy or undeploy models from Retool?

Yes, Vertex AI's REST API supports deployModel and undeployModel operations on endpoints. You can create Retool buttons that trigger these management operations via POST requests to the appropriate API paths. However, model deployment is a sensitive operation — consider adding a confirmation modal in Retool before executing deployment changes, and restrict access to these buttons using Retool's permission groups so only authorized team members can modify production endpoints.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Integrations are where projects stall

We wire Retool integrations like this one every week — auth, webhooks, edge cases included. Fixed-price builds from $13K, delivered in 6–10 weeks.

Talk to an integration engineer

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.