Skip to content
agentgateway has joined the Agentic AI Foundation — Learn more

For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.

Vertex AI

Verified : Code examples on this page have been automatically tested and verified.
Page as Markdown

Route agentgateway LLM traffic to models on Google Cloud Vertex AI.

Configure Google Cloud Vertex AI as an LLM provider in agentgateway.

Authentication

Before you can use Vertex AI as an LLM provider, you must authenticate by using Google Cloud’s Application Default Credentials. Choose from one of the three methods:

  • GOOGLE_APPLICATION_CREDENTIALS
  • application_default_credentials.json
  • metadata server

Configuration

You can add the model in the UI or in your configuration file.

To add the model in the UI, follow these steps. The steps create the same model as the Config file tab.

  1. Set up GCP Application Default Credentials (ADC) in the terminal where you run agentgateway.

  2. Create a configuration file with an empty llm section, and start agentgateway in the same terminal. Without an llm section, the UI does not show the LLM > Models page.

    cat > config.yaml <<'EOF'
    # yaml-language-server: $schema=https://agentgateway.dev/schema/config
    llm:
      models: []
    EOF
    agentgateway -f config.yaml
  3. Open LLM > Models, such as http://localhost:15000/ui/llm/models, and click Add model.

  4. From the Provider dropdown, select Gemini Enterprise (GCP Vertex).

  5. In the Incoming model match field, replace the default vertex/* with gemini-2.5-flash.

  6. Keep ADC for the Google credentials. To use a service account key file instead, select File, and enter the path to the file.

  7. Enter my-project-id for the Vertex project.

  8. For the Vertex region, enter or select us-west2. If you leave the field empty, Vertex uses global.

  9. For the Outgoing model, select Explicit, and enter google/gemini-2.5-flash-lite-preview-06-17.

    Add model drawer with Gemini Enterprise (GCP Vertex) selected as the provider, gemini-2.5-flash as the incoming model match, ADC as the Google credentials, my-project-id as the Vertex project, us-west2 as the Vertex region, and google/gemini-2.5-flash-lite-preview-06-17 as the explicit outgoing model
    Add model drawer with Gemini Enterprise (GCP Vertex) selected as the provider, gemini-2.5-flash as the incoming model match, ADC as the Google credentials, my-project-id as the Vertex project, us-west2 as the Vertex region, and google/gemini-2.5-flash-lite-preview-06-17 as the explicit outgoing model
  10. Click Save model.

Whether the UI can save depends on your storage mode. For more information, see Save changes from the UI.

Send file content by URI

In an OpenAI-compatible Chat Completions request, you can put a gs://, http://, or https:// URI in a file content part’s file_data or file_id. The request to Vertex AI uses fileData.

For HTTP(S) signed URLs, MIME type detection uses the extension before the query string or fragment. If the URI does not have a recognized extension, set filename, mime_type, or content_type on the file object.

{
  "model": "gemini-2.5-flash",
  "messages": [
    {
      "role": "user",
      "content": [
        { "type": "text", "text": "Compare these documents." },
        {
          "type": "file",
          "file": {
            "file_id": "https://storage.googleapis.com/my-bucket/report.pdf?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Signature=abc"
          }
        },
        {
          "type": "file",
          "file": {
            "filename": "summary.pdf",
            "file_data": "https://example.com/download/123"
          }
        }
      ]
    }
  ]
}
Was this page helpful?
Agentgateway assistant

Ask me anything about agentgateway configuration, features, or usage.

Note: AI-generated content might contain errors; please verify and test all returned information.

Tip: one topic per conversation gives the best results. Use the + button in the chat header to start a new conversation.

Switching topics? Starting a new conversation improves accuracy.
↑↓ navigate ↵ select esc dismiss

What could be improved?

Your feedback helps us improve assistant answers and identify docs gaps we should fix.

Need more help? Join us on Discord: https://discord.gg/y9efgEmppm

Want to use your own agent? Add the Solo MCP server to query our docs directly. Get started here: https://search.solo.io/.