Skip to main content
Version: 3.19.0

Proxy Gemini Enterprise Agent Platform Requests

Gemini Enterprise Agent Platform is the current name for the Google Cloud model platform previously documented as Vertex AI. It provides access to Gemini and partner models, including an OpenAI-compatible Chat Completions API.

This guide configures the ai-proxy plugin for Agent Platform. The released APISIX provider identifier remains vertex-ai. This guide sets the documented global Chat Completions URL through override.endpoint because the released driver derives only regional host names from provider_conf.region.

Prerequisite(s)​

  • Install Docker.
  • Install cURL to send requests to the services for validation.
  • Install jq to encode the service-account key for the Admin API request.
  • Follow the Getting Started Tutorial to start a new APISIX instance in Docker or on Kubernetes.
  • Have a Google Cloud project with billing and the Agent Platform API enabled.
  • If you use the Admin API examples and authentication is enabled, export an admin-role key as ADMIN_API_KEY. Configure the key under deployment.admin.admin_key. The Docker quickstart disables authentication for local evaluation; keep it enabled in production.

Obtain an Agent Platform Service Account Key​

Create a service account, grant it the Agent Platform User (roles/aiplatform.user) role, and create a JSON service-account key. The plugin requires the downloaded key because it does not discover Application Default Credentials or Workload Identity Federation credentials.

Save the raw key for ADC and a JSON-encoded string for the Admin API request:

export GCP_SERVICE_ACCOUNT_JSON="$(cat /path/to/service-account.json)"
export GCP_SERVICE_ACCOUNT_JSON_STRING="$(jq -Rs . < /path/to/service-account.json)"

Create a Route to Agent Platform​

Create a route with the ai-proxy plugin as such:

curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \
-H "X-API-KEY: ${ADMIN_API_KEY}" \
--data-binary @- <<EOF
{
"id": "vertex-ai-chat",
"uri": "/anything",
"plugins": {
"ai-proxy": {
"provider": "vertex-ai",
"override": {
"endpoint": "https://aiplatform.googleapis.com/v1beta1/projects/<GCP_PROJECT_ID>/locations/global/endpoints/openapi/chat/completions"
},
"auth": {
"gcp": {
"service_account_json": $GCP_SERVICE_ACCOUNT_JSON_STRING
}
},
"options": {
"model": "google/gemini-3.5-flash"
}
}
}
}
EOF

❶ Set the provider to vertex-ai and override its endpoint with the documented global Chat Completions URL. Replace <GCP_PROJECT_ID> with your project ID.

❷ Replace with your service account JSON.

❸ Set an Agent Platform model that supports Chat Completions on the global endpoint. This example uses google/gemini-3.5-flash, which supports the default Standard PayGo consumption mode on global.

Verify​

Send a request with the following prompts to the route:

curl "http://127.0.0.1:9080/anything" -X POST \
-H "Content-Type: application/json" \
-d '{
"messages": [
{ "role": "system", "content": "You are a mathematician" },
{ "role": "user", "content": "What is 1+1?" }
]
}'

You should receive a response similar to the following:

{
"choices": [
{
"message": {
"role": "assistant",
"content": "1 + 1 = 2\n"
},
"index": 0,
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"completion_tokens": 8,
"extra_properties": {
"google": {
"traffic_type": "ON_DEMAND"
}
},
"total_tokens": 19,
"prompt_tokens": 11
},
"object": "chat.completion",
"model": "google/gemini-3.5-flash",
...
}

Next Steps​

You have connected APISIX to Gemini Enterprise Agent Platform. See the Agent Platform model catalog and OpenAI-compatible Chat Completions documentation for supported models and request fields.