AI Gateway Model providers Google Vertex AI

Google Vertex AI

Use Gemini, Claude and open models from your own Google Cloud project, with Forgebench's budgets, metering and tracing on every call. Google bills your project directly; Forgebench never serves Vertex AI on its own account.

How it works

You give Forgebench one way to authenticate to your project, and it calls Vertex AI for you. Your code holds only a Forgebench API key.

  • Vertex models are named vertex-<model>, for example vertex-gemini-2.5-flash.
  • Forgebench calls the global location. A model that isn't served at global returns 404.
  • Ask support for your deployment's current outbound IP addresses before configuring an allowlist.

Choose how to connect

MethodModelsWhat you give Forgebench
Service account keyAllA service-account JSON key
Express API keyGemini, and open models such as Llama. Not Claude.An API key, plus a project ID for open models
Workload Identity FederationAllA configuration file that contains no secret
  • Service account key is the usual choice: it covers every model and takes a few minutes.
  • Express API key is the quickest way to try Gemini, but Google doesn't accept API keys for Claude.
  • Workload Identity Federation avoids long-lived keys. Use it if your organization disallows them. Support must provision a dedicated AWS role for your workspace before this flow can work.

All three are added in the same place: API Keys → Credentials → Add credential (or Admin → Secrets), then Vertex AI. You need the admin role.

Service account key

  1. Enable Vertex AI and your models

    In your project, enable the Vertex AI API. Gemini works straight away. For partner models such as Claude, open each one in Model Garden and click Enable.

  2. Create a service account

    For example forgebench-vertex@<your-project>.iam.gserviceaccount.com. Grant it Vertex AI User (roles/aiplatform.user) and nothing else.

  3. Create a JSON key

    On the service account's Keys tab, add a JSON key and download it. If your organization blocks key creation (iam.disableServiceAccountKeyCreation), request an exception for this project or use Workload Identity Federation.

  4. Add it to Forgebench

    Choose Vertex AI, set Authentication to Service account JSON (all models), paste the whole file and choose Save provider key. The key is encrypted at rest and never shown again.

Authentication starts on Express API key. Switch it before you paste.
Authentication starts on Express API key. Switch it before you paste.

Express API key

  1. Create a key

    In the Google Cloud console, create an API key for Vertex AI in your project.

  2. Add it to Forgebench

    Choose Vertex AI, leave Authentication on Express API key, and paste the key. To use open models such as Llama, DeepSeek or Qwen, also enter your Project ID. Gemini doesn't need it.

Workload Identity Federation

Your project trusts one AWS IAM role that Forgebench uses for your workspace only. On each call Forgebench exchanges it for a Google token that expires within the hour, so there is no key to store or rotate. The role has no AWS permissions.

  1. Ask us for your role

    Contact Forgebench support. We'll create the role and send you its ARN, our AWS account ID, and a setup guide with your values filled in.

  2. Enable Vertex AI and your models

    The same as for a service account: enable the Vertex AI API, and enable partner models in Model Garden.

  3. Create a pool and an AWS provider

    Create a workload identity pool, then an AWS provider in it for our account ID. Set google.subject=assertion.arn, attribute.account=assertion.account, and attribute.aws_role=assertion.arn.extract('assumed-role/{role_name}/'). Restrict the provider with attribute.account == "<account id>" && attribute.aws_role == "<role name>".

  4. Grant Vertex AI User

    Grant roles/aiplatform.user on the project to principalSet://iam.googleapis.com/projects/<project number>/locations/global/workloadIdentityPools/<pool>/attribute.aws_role/<role name>.

  5. Create the configuration file

    Run gcloud iam workload-identity-pools create-cred-config with --aws for your provider. The file names your pool and provider and contains no secret.

  6. Add it to Forgebench

    Choose Vertex AI, set Authentication to Workload Identity Federation (all models, no key), paste the file, enter your project ID and choose Save provider key.

The role value in the condition and IAM member must match your attribute mapping. See Google's AWS federation guide.

To revoke access, remove the Vertex AI User grant in Google Cloud. IAM changes take time to propagate. Disabling the federation provider blocks new token exchanges but does not revoke access tokens already issued. Verify revocation with a request from the affected workspace.

Send a test request

Saving does not prove that model invocation works. Service-account discovery checks Model Garden access. Express and WIF credentials are not validated by that check. Send a request to confirm Google accepts the selected model:

from forgebench import Forgebench

client = Forgebench(api_key="sk_...", base_url="https://api.forgebench.ai")
resp = client.chat.completions.create(
  model="vertex-gemini-2.5-flash",
  messages=[{"role": "user", "content": "ping"}],
)

A 200 with a completion means you're connected. If not, see Troubleshooting.

The Gateway catalog lists every Vertex model. Until you add a credential they show as Needs key.

Vertex models in the Gateway catalog before a credential is added.
Vertex models in the Gateway catalog before a credential is added.

Restrict access with VPC Service Controls

Optional. A VPC Service Controls perimeter makes your project refuse Vertex AI calls unless they come from your deployment's egress addresses and from the identity you gave Forgebench. You'll need an organization-level Google Cloud admin.

SettingValue
Egress addressesThe current CIDRs supplied for your deployment
ProtocolHTTPS (TCP 443)

Confirm these addresses with support before enforcing the perimeter.

  1. Create an access level

    In Access Context Manager, create an access level using the outbound CIDRs supplied for your deployment.

  2. Create a perimeter in dry-run mode

    Put your project in a perimeter that restricts aiplatform.googleapis.com. Start it in dry-run mode, so it only logs what it would block.

  3. Add an ingress rule

    Allow Vertex AI calls from that access level by your Forgebench identity only: the service account for a key, or the principalSet://… member from the Workload Identity Federation steps.

  4. Test, then enforce

    Send a test request, check the audit logs show no violation for it, then enforce the perimeter. A new perimeter can take up to 30 minutes to start blocking.

An outbound IP can be shared. The ingress rule's identity limits access to your workspace. Configure both the address and identity conditions.

Troubleshooting

ErrorCauseFix
404 publisher model "was not found or your project does not have access to it"The model isn't enabled in your project, or isn't served at globalEnable it in Model Garden, or choose a model served at global
Claude fails with an express API keyGoogle doesn't accept API keys for ClaudeUse a service account key or Workload Identity Federation
403 VPC_SERVICE_CONTROLSThe access level doesn't include our IP, or the ingress rule names a different identityCheck both. The error's vpcServiceControlsUniqueIdentifier finds the matching audit log entry.
Calls from other IPs still succeedThe perimeter isn't enforced yetWait up to 30 minutes after enforcing, then test again
403 from sts.googleapis.com (Workload Identity Federation)The provider's account ID or attribute condition doesn't match your roleCheck the account ID and role name against the provider's attribute mapping and condition
403 "Permission 'aiplatform.endpoints.predict' denied" (Workload Identity Federation)Vertex AI User isn't granted to the principalSet://… member, or hasn't propagatedGrant it, then allow a few minutes
Saving says the key belongs to a different Forgebench organizationSomeone else has added the same key, so it may have leakedRotate it in Google Cloud and add the new key

Next

Cookie settings

Our Cookie Policy lists every cookie and what it does.