# Google Vertex AI (/en/ai/models/llm/google-vertex-ai)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

Google Vertex AI provides enterprise-grade access to Google's generative AI models with enhanced security, scaling capabilities, and integration with Google Cloud services.

### Sample configuration [#sample-configuration]

The following examples show how to configure Google Vertex AI LLM when starting a conversational AI agent.

<Tabs defaultValue="python" groupId="ai-sdk-language">
  <TabsList>
    <TabsTrigger value="python">
      Python SDK
    </TabsTrigger>

    <TabsTrigger value="typescript">
      TypeScript SDK
    </TabsTrigger>

    <TabsTrigger value="go">
      Go SDK
    </TabsTrigger>

    <TabsTrigger value="rest-api">
      REST API
    </TabsTrigger>
  </TabsList>

  <TabsContent value="python">
    ```python
    from agora_agent import Agent, VertexAILLM

    # client is your configured Agora client
    agent = (
        Agent(client)
        .with_stt(...)  # configure your STT vendor
        .with_llm(VertexAILLM(
            api_key='your-gcp-access-token',
            project_id='your-gcp-project-id',
            location='us-central1',
            model='gemini-2.0-flash-001',
            system_messages=[{'parts': [{'text': 'You are a helpful chatbot.'}], 'role': 'user'}],
            greeting_message='Good to see you!',
            failure_message='Hold on a second.',
            max_history=32,
        ))
        .with_tts(...)  # configure your TTS vendor
    )
    ```
  </TabsContent>

  <TabsContent value="typescript">
    ```typescript
    import { Agent, VertexAILLM } from 'agora-agents';

    // client is your configured Agora client
    const agent = new Agent({ client })
      .withStt(/* configure your STT vendor */)
      .withLlm(new VertexAILLM({
        apiKey: 'your-gcp-access-token',
        projectId: 'your-gcp-project-id',
        location: 'us-central1',
        model: 'gemini-2.0-flash-001',
        systemMessages: [{ parts: [{ text: 'You are a helpful chatbot.' }], role: 'user' }],
        greetingMessage: 'Good to see you!',
        failureMessage: 'Hold on a second.',
        maxHistory: 32,
      }))
      .withTts(/* configure your TTS vendor */);
    ```
  </TabsContent>

  <TabsContent value="go">
    ```go
    import "github.com/AgoraIO/agora-agents-go/v2/agentkit/vendors"

    // client is your configured Agora client
    agent := agentkit.NewAgent(client).WithStt(/* configure your STT vendor */).
      WithLlm(
        vendors.NewVertexAILLM(vendors.VertexAILLMOptions{
            APIKey:    "your-gcp-access-token",
            ProjectID: "your-gcp-project-id",
            Location:  "us-central1",
            Model:     "gemini-2.0-flash-001",
            SystemMessages: []map[string]interface{}{
                {"parts": []map[string]interface{}{{"text": "You are a helpful chatbot."}}, "role": "user"},
            },
            GreetingMessage: "Good to see you!",
            FailureMessage:  "Hold on a second.",
            MaxHistory:      agora.Int(32),
        }),
    ).WithTts(/* configure your TTS vendor */)
    ```
  </TabsContent>

  <TabsContent value="rest-api">
    Use the following `llm` configuration in your request:

    ```json
    "llm": {
       "url": "https://{region}-aiplatform.googleapis.com/v1/projects/{project}/locations/{region}/publishers/google/models/{model}:streamGenerateContent?alt=sse",
       "api_key": "$(gcloud auth print-access-token)",
       "system_messages": [
           {
               "role": "user",
               "parts": [ {"text": "You are a helpful chatbot."} ]
           }
       ],
       "max_history": 32,
       "greeting_message": "Good to see you!",
       "failure_message": "Hold on a second.",
       "params": {
           "model": "gemini-2.0-flash-001"
       },
       "style": "gemini"
    }
    ```
  </TabsContent>
</Tabs>

### Key parameters [#key-parameters]

<ParameterList title="llm" required="true">
  <Parameter name="api_key" type="string" required="true">
    Refer to Google Cloud [REST authentication](https://cloud.google.com/docs/authentication/rest) to get your GCP credentials.
  </Parameter>

  <Parameter name="url" type="string" required="true">
    Use the Vertex AI endpoint with your Google Cloud project ID and region in the URL path. Refer to the [Google Vertex AI API documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/locations) for details.
  </Parameter>

  <Parameter name="system_messages" type="array[object]" required="false">
    Use a `parts` array with `text` objects instead of a simple `content` string.
  </Parameter>

  <Parameter name="style" type="string" required="true">
    Set to `gemini` to use Gemini's message format.
  </Parameter>

  <Parameter name="params" type="object" required="true">
    <Parameter name="model" type="string" required="true">
      Refer to [Vertex AI models](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models) for available models.
    </Parameter>
  </Parameter>
</ParameterList>

For advanced configuration options, model capabilities, and detailed parameter descriptions, see the [Google Vertex AI API documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/system-instructions).
