How promptfoo tests models hosted on Vertex AI
A team that runs Gemini or partner models on Vertex AI and needs repeatable evals and red team scans against them should know one thing first: promptfoo calls the Vertex provider directly from the machine or CI runner where it runs, so the project, region and credentials stay inside your Google Cloud environment. Nothing in this setup routes test traffic through a DeployOpen or promptfoo service. This section explains where those settings live, how service account authentication fits into a test run, how Vertex differs from Google AI Studio when you set up a suite, and what Model Armor block reasons mean when a test prompt is refused. Before you publish or adopt any of this, confirm the exact provider identifier and option names in the promptfoo provider documentation, because the names used in examples can change between releases.
The decisions that matter most are about identity and scope. Decide which Google Cloud project will be billed for test traffic, which region hosts the model you are testing, and which service account the runner will use. Give that service account only the permissions needed to call the models in scope, and keep it separate from production workloads so test volume does not compete with live quotas or appear in production logs. Compare this with Google AI Studio, where a single API key typically stands in for the whole account. On Vertex AI, project, location and model availability are configured per environment, so a suite that works in one region may need a different location setting elsewhere. Confirm regional model availability for each model you plan to grade with, since a judge model that is unavailable in your chosen region will fail the run in a way that looks like a test failure.
If your Vertex deployment has Model Armor enabled, plan for refusals to appear in your results. Model Armor can block a prompt or response before the model answers, and the block reason becomes part of the output your assertions and red team grading see. Treat these as a separate category: a block can mean the guardrail worked on an attack prompt, or it can mean a legitimate test case was caught by an overly strict template. Record the block reason for each refusal, decide whether a blocked attack counts as a pass for your red team scan, and check that a benign eval case is not failing silently because of a filter. Ask your Google Cloud administrator which Model Armor templates apply to the project under test, and confirm with the promptfoo documentation how block responses are surfaced in results before you set pass-rate gates.
What a Vertex AI promptfoo setup needs before the first run
Most failed first runs against Vertex AI trace back to something missing before promptfoo was ever invoked. The cards below cover the runtime, the Google Cloud resources, the permissions and the network path, so the team can confirm each one before writing a config.
Node.js runtime version
The promptfoo 0.124.1 release requires Node.js 22.22.0 or newer. Check the version on the machine or CI image that will run the evals, not only on a developer laptop, because older runner images often pin an earlier release. Confirm the version with node --version before installing the package, and record it so later runs can be reproduced.
Google Cloud project with Vertex AI
Choose the Google Cloud project that will carry the test traffic and confirm that the Vertex AI API is enabled there. Keep the project used for evals separate from production so that test prompts, quota and logs do not mix with live traffic. Ask the platform team which project owns billing for test calls.
Model access for each model
Access is granted per model, so each Gemini model and each partner model in the suite must be available to the project and region you chose. A model that works in one region may be missing in another. Confirm model availability in the Vertex AI console for the exact model IDs in your config before writing test cases.
Region chosen up front
Pick the region that matches your data residency rules and the models you need, and set it explicitly in the config rather than relying on defaults. Model availability and quotas can differ by region, so a suite moved to another region may need its model names and limits rechecked.
Service account with prediction role
Create a dedicated service account for the test runner and grant it only the Vertex AI role needed for prediction calls. Avoid reusing a personal account or an owner-level key. Store the key or use workload identity according to your secrets policy, and confirm with your security team who may rotate it.
Model Armor template on the endpoint
If Model Armor is applied to the endpoint, obtain the template name and confirm the test service account can call it. Blocked responses from Model Armor will appear as test results, so the team should know in advance which template is in force and whether it differs between development and production.
Outbound network and red team permissions
The test runner must reach Google Cloud API endpoints over outbound HTTPS, which matters for CI runners behind proxies or restrictive egress rules. Red team plugins may need permissions beyond prediction calls, so confirm any additional roles against the promptfoo provider documentation before the first scan.
How a promptfoo run reaches Vertex AI and returns a result
A run starts in the promptfoo CLI on a workstation or CI runner, which authenticates to Google Cloud with a service account. The request then goes to the Vertex AI regional endpoint that serves the chosen model, with the project and region set in configuration. If a Model Armor template applies, the filter runs on the prompt or response before the output returns to promptfoo, where assertions or a judge model grade it. Check the project, region and template settings first, because a mismatch shows up as an error or a block rather than a clear failure.
Trust boundary between the client runner and Google Cloud, with configuration inputs marked.
Configuring the Vertex provider in six steps
This sequence takes you from a Google Cloud project with no promptfoo access to a passing eval suite that calls a Vertex AI model. Each step ends with a check you can confirm before moving on, so authentication, region and model access problems surface early rather than during a full run.
Enable the Vertex AI API and confirm model access
A project administrator enables the Vertex AI API in the Google Cloud project that will be billed for test traffic, then confirms that the Gemini or partner model you plan to test is available in the region you chose. Model availability differs by region, so check the model's regional availability in the Vertex AI console rather than assuming it matches another region. You know this step is done when the model appears as available in the console for that project and location.
Create a dedicated service account with one role
Create a service account used only for promptfoo test runs, and grant it the narrowest role that permits prediction calls to Vertex AI, after checking the current role names in Google Cloud's IAM documentation. Avoid reusing a broad owner or editor account from another workload. Your cloud team owns this step, and it is done when the service account exists, holds only that role, and can be seen in IAM for the project.
Supply credentials through the standard Google Cloud path
Make the service account credentials available to the machine or CI runner using Google Cloud's standard application authentication, such as an attached workload identity or a credentials file referenced by the environment variable that Google's client libraries read. Keep key files out of the repository and out of the promptfoo config. The check is that a plain Google Cloud command run on the same runner returns an access token or identifies the expected service account.
Set project and location in the provider config
In your promptfooconfig.yaml, add a Vertex provider entry that names the model and sets the Google Cloud project ID and the location (region) that you confirmed in step one. Keep these values in environment variables or a shared config file when several suites use them. Run the config through promptfoo's validation step so typos in keys are caught. You know this step is done when the config loads without a validation error.
Run one prompt against one model
Run a single prompt through the single provider with the CLI in one-off mode, using a short question with a predictable answer. This confirms that authentication, project, location and model ID all work together before any larger suite exists. If the call fails with a message about the location or model not being found, return to step one and confirm the model is offered in that region. The check is a complete response from the model with no authentication or region error.
Run a small eval suite with a known test case
Add three or four test cases with clear expected answers, including one case with an assertion that a known string appears, then run the suite and open the results view. This shows that grading, output parsing and result storage all work for Vertex responses. Pass the run only when the known test case passes its assertion and the failing case, if any, fails for a reason you can explain. Expand the suite once this passes, not before.
Mapping Vertex AI settings to promptfoo configuration
This table matches each Google Cloud and Vertex AI setting to what it controls during a promptfoo test run and where it is set in the configuration. Read it before writing your first Vertex provider entry, because a wrong project, location or identity usually fails before any test runs. Items marked confirm in provider docs need the exact key name checked against the current promptfoo Vertex provider documentation before you rely on them.
| Vertex AI concept | What it controls in the test run | Where it is set in promptfoo |
|---|---|---|
| Google Cloud project | Which project is billed for model calls, and which project's quotas, enabled APIs and logs record the test traffic | Project ID in the provider config (confirm in provider docs), or the project environment variable your runner reads |
| Region or location | Where the model endpoint is called, and which Gemini and partner models are available there | Location setting in the provider config (confirm in provider docs). Keep it the same region your data rules allow |
| Gemini model identifier | The exact model version that answers each test, so results are comparable across runs | Model ID in the provider string (confirm in provider docs). Pin a version rather than a floating alias for regression suites |
| Partner model identifier | Which publisher's model is called, such as a non-Google model offered on Vertex AI, and whether it is enabled in your project | Publisher and model ID in the provider string (confirm in provider docs). Check the model is enabled in the project and region first |
| Service account identity | Which principal authenticates each call, and therefore which IAM roles limit what the test runner can reach | Credentials path or environment setting (confirm in provider docs). Use a dedicated test identity with only the Vertex AI roles it needs |
| Model Armor template | Which Model Armor policy screens prompts and responses, and which block reasons appear in results when it intervenes | Template reference in the provider config (confirm in provider docs). Record the template name in each run report |
Why Vertex AI test setups differ from Google AI Studio
A suite written for Google AI Studio will not run unchanged against Vertex AI. Both surfaces can reach Gemini models, but they expose them through different access models, so a test team moving between them should expect to change the provider configuration, the credentials and sometimes the expected behavior of the target. The first difference is identity. AI Studio is typically driven by a single API key, while Vertex AI access is scoped to a Google Cloud project and governed by IAM roles granted to a user or a service account. In practice, this means the promptfoo configuration must name the project and location, and the account running the eval (on a laptop or in a CI runner) must hold a role that permits calling the models in that project. Before the first run, confirm which principal will call the API, which project it belongs to and which roles it holds, because a suite that passes under one identity can fail with permission errors under another.
The second difference is placement. Vertex AI works with regional endpoints, so the region chosen for a test affects which models are available and which endpoint answers the request. Test results can therefore differ between regions, and a red team run pinned to one region may not represent production traffic routed elsewhere. The third difference is enterprise controls. On Vertex AI, Model Armor can sit in the request path and block or modify prompts and responses before the model answers. A test suite that expects a model refusal may instead receive a block from a Model Armor template, and the block reason needs to be recorded separately from a model-generated refusal so that graders and reports do not confuse the two. Finally, partner models offered on Vertex AI are not all offered in AI Studio, so a comparison suite may include models that only one surface provides. Consult the promptfoo provider documentation for the current list of supported models and any model-specific limits, and confirm those limits in your own Google Cloud environment before planning the suite.
Authentication options for developer machines, CI and self-hosted runners
On a developer machine, promptfoo usually runs under the engineer's own Google Cloud identity or a user-managed sign-in that the cloud team has approved for exploration. The engineer authenticates once with the Google Cloud tooling on the workstation, and promptfoo picks up that session when it calls Vertex AI, so no key file has to be written into the project. This suits trying prompts, checking region and model availability and building the first eval suite.
- Credential path: the credential comes from the local Google Cloud session, not from a value stored in the promptfoo config.
- Scope: the identity should have only the Vertex AI permissions needed for test calls, and it should not carry production data access.
- Model access: confirm that the user can call the Gemini and partner models in the chosen region, since access is often granted per project.
- Avoid: exporting a service account key file to a laptop or copying one into a repository to make a run work.
- Hand-off: a workstation session is personal, so anything that must run on a schedule should move to CI or a runner.
Confirm with the cloud security team whether engineers may sign in with their own accounts to the test project, how long those sessions last and which project and region the team has approved for exploration.
In CI, the job needs a non-interactive identity, which is normally a dedicated service account for the test project. The credential should be stored in the CI system's secret store and injected into the job as an environment variable or a protected file at run time, so the pipeline definition contains only the reference to the secret. The job then runs promptfoo against Vertex AI with that identity and discards the file when the job finishes.
- Credential path: the CI secret is written to a file or variable only for the duration of the job, and the promptfoo config points at the project and region, not at the key.
- Dedicated identity: use a service account for evals and red team scans only, with the narrowest Vertex AI role that allows model calls.
- Protected scope: limit which branches and jobs can read the secret, especially for jobs triggered by forks or merge requests.
- Avoid: committing key files, printing the credential in job logs or reusing a production service account for test traffic.
- Rotation: plan how keys are rotated and who is notified when a secret changes, since failed rotations stop every pipeline at once.
Confirm with the client's cloud security team whether key creation is allowed for service accounts at all, how the organization rotates and audits those keys and whether keyless alternatives are available for the CI platform in use.
A self-hosted runner inside the client's network is a machine the organization controls, so it can often avoid long-lived key files altogether. Where the organization supports workload identity federation for its CI platform, or an attached service account on the runner's compute instance, promptfoo calls Vertex AI with short-lived credentials that Google Cloud issues to the workload. The runner's own identity then becomes the thing the cloud team reviews and grants access to.
- Credential path: the runner obtains tokens from its environment, so the promptfoo config does not reference a key file.
- Attached identity: if the runner is a virtual machine or container platform node, a service account attached to that compute resource can serve as the Vertex AI identity, with its scope set by the cloud team.
- Network placement: confirm that the runner can reach Vertex AI endpoints from its network segment, including any egress restrictions or private connectivity the organization requires.
- Avoid: placing a key file on the runner's disk, sharing one runner across unrelated projects with different data rules or granting the runner broad project roles.
- Patching: the runner host, its container image and Node.js version are part of the evidence chain, so they should be maintained like any other build infrastructure.
Confirm with the client's cloud security team whether workload identity or attached service accounts are supported for this runner type, which project and region the runner may call and how access logs for those calls are retained.
Securing the Vertex AI test path
A promptfoo run against Vertex AI sends prompts, attack payloads and model outputs through a cloud project that holds credentials and production quotas. The controls below keep that path narrow, keep secrets out of files, and make sure results reflect the filters production uses.
Least-privilege service account roles
Create a dedicated service account in the project used for testing and grant it only the roles needed to call the models you evaluate. Avoid broad editor or owner roles, since a leaked key with those roles can change infrastructure as well as call models. Review the granted roles against the models in your promptfoo config, and confirm the exact role names with Google Cloud's current Vertex AI IAM documentation before you grant them.
Credentials outside config and version control
Keep service account keys and project settings out of promptfooconfig.yaml and out of the repository. Supply them through environment variables or your CI secret store, and make sure local key files are excluded by .gitignore. Check the Vertex provider documentation for the authentication methods it accepts, and prefer short-lived credentials where your organization allows them.
Separate test and production projects
Run red team scans in a project that does not serve production traffic. Shared projects mix test volume with customer traffic, so a runaway scan can consume the quota your users depend on, and attack prompts can appear in production billing and logs. Ask your cloud team which projects and quotas are dedicated to testing, and confirm the per-project limits before you schedule large scans.
Logging and storage of test data
Red team prompts, model responses and grader output can contain sensitive examples and content your policies would block. Decide which Cloud Logging and audit logs capture these calls, who can read them, and how long they are kept. Because promptfoo runs locally, you choose where result files and the local database are written. Confirm retention and storage defaults in the promptfoo documentation for your version, and set the output path to an approved location.
Self-hosting docsModel Armor templates matched to production
If production calls Vertex AI with a Model Armor template, test with the same template. A test run against a model without that template can show attacks succeeding that production would block, or the reverse. Record the template name in your eval config, keep test and production templates on the same version, and treat any block reason as a result to report, not as an error to retry around.
Vertex AI errors in promptfoo runs and how to resolve them
This table pairs common Vertex AI failures seen during promptfoo runs with their likely causes and fixes. Read each row by matching the symptom in your run output to the cause, then confirm the fix against your Google Cloud project settings. The main takeaway is that many failures come from project, region or IAM configuration rather than from the model or the test suite.
| Symptom | Likely cause | Fix |
|---|---|---|
| Permission denied (403) from the service account | The service account lacks the Vertex AI role on the project, or the credentials promptfoo loads belong to a different project than the one in the config. | Confirm the project ID in the config matches the project that holds the service account. Grant the service account a Vertex AI user role on that project, then rerun a single test case to confirm. |
| Model not found or not enabled | The model ID is misspelled, the model is not enabled for the project, or the model is a preview model that your project cannot call. | Check the exact model ID in the Vertex AI model garden for your project. Enable the model in the console if required, and confirm the ID in the promptfoo provider config. |
| Model exists but the chosen region does not serve it | The configured location supports other models but not this one, so the request fails even though the model ID is valid. | Confirm regional availability for the model in the Google Cloud documentation. Change the location setting to a region that serves it, and keep the region consistent across runs so results are comparable. |
| Quota or rate limit errors (429) during large red team scans | Red team runs send many probes in parallel, exceeding the per-minute request or token quota for the model in that project and region. | Check the quota page for the model in your project. Lower the concurrency and add retry or backoff settings, and request a quota increase through Google Cloud if the scan size needs it. Scan size should match the quota you actually hold. |
| Empty outputs or refusal-like text from a Model Armor block | Model Armor filtered the prompt or response before or after the model ran, so the model never answered. The output looks like a refusal but was produced by a filter decision. | Record Model Armor blocks as a separate result category, not as model refusals. Confirm the block reason fields in the Google Cloud Model Armor documentation before mapping them in your grading logic, and do not rely on memorized field names. |
Questions teams ask before testing Vertex AI with promptfoo
How much effort does a promptfoo Vertex AI integration take?
The effort is driven by how much you need to configure, not by promptfoo itself. Most of the work is setting the project and region, choosing an authentication model, and deciding which Gemini and partner models you will test. The main drivers are:
- The number of models and whether they sit in one region or several, since model availability varies by region.
- The authentication model, such as a service account for CI or a developer's own credentials for local runs.
- Model Armor configuration, if your project filters prompts or responses and you want those block reasons to show up in test results.
A single project with one model and one region is a small job. Multiple projects, regions and a shared CI pipeline add review and access steps. Confirm the scope against your own environment before estimating.
Can our team set up the Vertex AI provider without outside help?
Yes, if you have a single Google Cloud project that is already set up, a team member comfortable with Google Cloud IAM, and a clear list of models to test. The promptfoo documentation on model providers is the main reference for the configuration keys. Outside help is more useful when you need several projects, a shared CI runner that authenticates with a service account, or a repeatable pattern across teams. It is also useful when your security team wants evidence of how credentials are scoped and stored. DeployOpen plans and implements these setups inside the client's own cloud accounts, so you can choose either path.
What do we need to provide before the work starts?
Plan on providing access and decisions before any configuration begins. The usual list includes:
- Access to the Google Cloud project, with enough IAM rights to create or review a service account and grant it the roles needed to call Vertex AI.
- Approval from whoever controls IAM, since service account keys and role grants often need a formal change request.
- A test environment, ideally a non-production project, so red teaming traffic does not reach production quotas or logs.
- Named owners for model access, who decide which models and regions are approved, and for security review, who decide what test results count as acceptable.
Having these owners named early prevents the common delay where a working configuration sits waiting for approval.
Does the promptfoo Community edition include the Vertex AI provider?
Yes. The promptfoo pricing page states that the Community edition is free and includes all model providers and integrations, so the Vertex AI provider is covered. The Community edition also includes LLM evaluation and red teaming, with a monthly probe allowance and community support. Team features such as shared results, role-based access control, SSO and continuous monitoring belong to the paid Enterprise and On-Premise editions. Read the pricing terms on the promptfoo pricing page for the current limits before you plan usage at scale.
How long does a first working Vertex AI setup take?
The time depends on four things: how quickly access and IAM approvals come through, whether the project already has the Vertex AI APIs enabled and the regions you need, how many models you test on day one, and whether Model Armor is in scope for the first run. A first run against one model in one region with existing access can be short. Adding approvals, a CI service account and guardrail checks lengthens the path, mostly because of waiting on people rather than on the tool. Ask your partner or internal team for a written plan that lists these dependencies before agreeing on a timeline.
Why do Vertex AI and Google AI Studio results differ in promptfoo?
The two platforms use different endpoints, authentication and project settings, so the same model name can behave differently across them. Vertex AI runs inside your Google Cloud project and region, uses IAM-based authentication, and can apply Model Armor filtering. Google AI Studio uses an API key tied to a developer account. For engineers, the practical check is to confirm which provider ID each suite points at, the model version it resolves to, and whether safety or guardrail settings are active. Compare results only when those settings match, and confirm the provider behavior against Google's current documentation for your models.
What do Model Armor block reasons mean in promptfoo results?
A Model Armor block reason is the explanation returned when Model Armor filters a prompt or response before the model answers. In a red team run, a block is often a good outcome, but it can also hide a weakness if the test counts every refusal as a pass. Engineers should record the block reason alongside the grade, check whether blocks cluster around specific plugins or strategies, and confirm that legitimate test inputs are not being blocked. Which block reasons appear, and how they are returned, depends on your Model Armor template, so confirm the exact fields with Google's documentation and your own configuration before writing assertions.
How DeployOpen scopes and delivers a Vertex AI promptfoo setup
DeployOpen plans and delivers the promptfoo side of Testing Google Vertex AI models with promptfoo inside your own Google Cloud environment. We start from the models, projects, regions and identities you use, then build and document a working provider configuration your security and platform teams can review.
How we scope
- Confirm which Gemini and partner models on Vertex AI your teams need to test, and the projects and regions they run in.
- Agree how service account authentication will work for local runs and CI, with the roles each identity holds.
- Record in writing whether Model Armor templates are in scope, and which block reasons must appear in test reports.
How we build
- Configure the promptfoo Vertex provider with project and region settings, checked against your target models before any suite is written.
- Set up test suites and red team runs against your own prompts and data, keeping Vertex and Google AI Studio results labeled separately.
- Test Model Armor block handling so refusals from the platform are recorded as results rather than treated as failed runs.
How we hand over
- Deliver the provider configuration, service account setup notes and suite files in your repository, with a short run guide.
- Document each setting, its owner and how to confirm it in your environment, so your team can change regions or models later.
- Walk your engineers through a full run, including how to read block reasons and where evidence files are stored.
How we support
- Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
- Ongoing support, upgrades of promptfoo and retesting after model or region changes are available as a retainer.
- Quotes follow from the written scope, so ask for each deliverable and any recurring support to be itemized.

