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.1.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.1.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llm_gcp_vertex-0.1.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.1.0.tar.gz
Algorithm Hash digest
SHA256 fadfff85ae83b6796ec70b8df20a0704395b10e4f3677161708f12d32d5d1124
MD5 e8cd4c828ab5ca808afc688551e2b701
BLAKE2b-256 96465ac28adf876f134d9b1f2c8c0f8b73fc76b27530a23e7d8728ece8c01326

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_gcp_vertex-0.1.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.1.0-py3-none-any.whl.

File metadata

  • Download URL: llm_gcp_vertex-0.1.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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1761a7dda60ab35799821c77cc6a7c65886925f4f62f0603f65ba01a00aeb14b
MD5 c136eabd5f0222d4f978baf5680816eb
BLAKE2b-256 b7bc703e81134ab6208bcf098c991a56106e7e8be90aea14ce02c7b6fd8b057a

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_gcp_vertex-0.1.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