Skip to main content

LLM plugin for Google Cloud Vertex AI models including Gemini and Model Garden

Project description

llm-gcp-vertex

llm plugin for Google Cloud Vertex AI, providing access to Gemini and Claude models through their official SDKs. If you are looking for support for Google AI Studio, see the llm-gemini plugin.

Features

  • Gemini models via the official google-genai SDK
  • Claude models via the official anthropic[vertex] SDK
  • Full streaming support for both model families
  • Async support for high-throughput applications

Installation

llm install llm-gcp-vertex

Prerequisites

1. Google Cloud Authentication

This plugin uses Application Default Credentials (ADC):

gcloud auth application-default login

2. Configure Project and Location

Using environment variables:

# Falls back to GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION if not set
export LLM_VERTEX_CLOUD_PROJECT="your-project-id"
export LLM_VERTEX_CLOUD_LOCATION="us-central1"  # optional, defaults to us-central1

Or using LLM keys:

llm keys set vertex-project
llm keys set vertex-location  # optional

Available Models

Gemini

Model ID Description
gemini-3-pro-preview Latest flagship, complex reasoning (preview)
gemini-3-flash-preview Latest fast model (preview)
gemini-2.5-pro Strong reasoning and coding
gemini-2.5-flash Fast and cost-effective
gemini-2.0-flash Balanced speed and quality

Claude (via Vertex AI)

Model ID Description
claude-opus-4.5 Most capable, complex analysis
claude-sonnet-4.5 Best for coding and agents
claude-haiku-4.5 Fast and affordable
claude-opus-4.1 Extended thinking, agentic tasks
claude-sonnet-4 Balanced speed and capability
claude-opus-4 Strong reasoning

Usage

Command Line

# Gemini
llm -m gemini-2.5-flash "Explain quantum computing"
llm -m gemini-2.5-pro "Write a poem" -o temperature 0.9

# Claude
llm -m claude-sonnet-4.5 "Review this code"
llm -m claude-haiku-4.5 "Summarize this" -o max_tokens 500

# With system prompt
llm -m gemini-2.0-flash "Explain recursion" -s "You are a patient teacher"

Options

Gemini Options

Option Type Description
temperature float (0.0-2.0) Controls randomness
max_output_tokens int Maximum tokens to generate
top_p float (0.0-1.0) Nucleus sampling threshold
top_k int Top-k sampling parameter

Claude Options

Option Type Description
temperature float (0.0-1.0) Controls randomness
max_tokens int Maximum tokens to generate (default: 4096)
top_p float (0.0-1.0) Nucleus sampling threshold
top_k int Top-k sampling parameter
stop_sequences list[str] Custom stop sequences

Development

git clone https://github.com/ASRagab/llm-gcp-vertex.git
cd llm-gcp-vertex

# Install with dev dependencies
uv sync --group dev

# Run tests
uv run pytest

# Type check (strict)
uv run basedpyright llm_gcp_vertex.py

Troubleshooting

"Vertex AI project ID required"

export LLM_VERTEX_CLOUD_PROJECT="your-project-id"
# or
llm keys set vertex-project

"Could not automatically determine credentials"

gcloud auth application-default login

Claude models not working

Claude on Vertex AI requires:

  1. Enable the Claude API in your GCP project
  2. Accept the usage agreement in Model Garden
  3. Use a supported region (e.g., us-east5, europe-west1)
export LLM_VERTEX_CLOUD_LOCATION="us-east5"

License

Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_gcp_vertex-0.2.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_gcp_vertex-0.2.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file llm_gcp_vertex-0.2.0.tar.gz.

File metadata

  • Download URL: llm_gcp_vertex-0.2.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for llm_gcp_vertex-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d8c19e792e320a037bf4e14c90fdd8d782048af2545113ac8e8c7367dbd98fd2
MD5 062d145cfe4fa37dbf314e78c938aec9
BLAKE2b-256 4027cd8baaf5ef67940087134ccc9d13697a3afeb83cb0a227d286e81e71fb3b

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_gcp_vertex-0.2.0.tar.gz:

Publisher: ci.yml on ASRagab/llm-gcp-vertex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llm_gcp_vertex-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: llm_gcp_vertex-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for llm_gcp_vertex-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee229e4476cc5f7620c170625c211322a76a62fed2efa09515bbf2c30fc5da32
MD5 d2bafcd90f64cacf3da941788c172867
BLAKE2b-256 afd29e766a61f1764be34b4cbe470607c07a12b69f965c68f656fbc599228050

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_gcp_vertex-0.2.0-py3-none-any.whl:

Publisher: ci.yml on ASRagab/llm-gcp-vertex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page