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

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

> Documentation: Conversational AI.
> Documentation version: Main.
> This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v1.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

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

**Python SDK**

```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
)
```

**TypeScript SDK**

```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 */);
```

**Go SDK**

```go
import (
    Agora "github.com/AgoraIO/agora-agents-go/v2"
    "github.com/AgoraIO/agora-agents-go/v2/agentkit"
    "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{
        ProjectID: "your-gcp-project-id",
        Location:  "us-central1",
        GeminiOptions: vendors.GeminiOptions{
            APIKey: "your-gcp-access-token",
            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 */)
```

**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"
}
```

### Key parameters

**llm required**

**`api_key` (string) required**

Refer to Google Cloud [REST authentication](https://cloud.google.com/docs/authentication/rest) to get your GCP credentials.

**`url` (string) required**

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.

**`system_messages` (array[object]) optional**

Use a `parts` array with `text` objects instead of a simple `content` string.

**`style` (string) required**

Set to `gemini` to use Gemini's message format.

**`params` (object) required**

**`model` (string) required**

Refer to [Vertex AI models](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models) for available models.

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).
