Skip to main content

Google Cloud Vertex AI provider for lmux

Project description

lmux-gcp-vertex

Google Cloud Vertex AI provider for lmux. Wraps the google-genai SDK.

Supports chat completions, streaming, and embeddings.

Part of the lmux ecosystem: standardized interface, cost tracking on every response, and registry-based routing across providers.

Auth

Three authentication methods:

Application Default Credentials (default)

Uses google.auth.default(), which works with GOOGLE_APPLICATION_CREDENTIALS, gcloud CLI, or instance metadata.

from lmux_gcp_vertex import GCPVertexProvider

provider = GCPVertexProvider(project="my-project", location="us-central1")

Service Account

from lmux_gcp_vertex import GCPVertexServiceAccountAuthProvider

provider = GCPVertexProvider(
    project="my-project",
    location="us-central1",
    auth=GCPVertexServiceAccountAuthProvider(service_account_file="/path/to/key.json"),
)

API Key

Set GOOGLE_API_KEY in your environment:

from lmux_gcp_vertex import GCPVertexAPIKeyAuthProvider

provider = GCPVertexProvider(auth=GCPVertexAPIKeyAuthProvider(), vertexai=False)

Usage

Chat

from lmux import UserMessage

response = provider.chat("gemini-2.5-pro", [UserMessage(content="Hello")])
print(response.content)
print(response.cost)

Streaming

for chunk in provider.chat_stream("gemini-2.5-pro", [UserMessage(content="Hello")]):
    if chunk.delta:
        print(chunk.delta, end="")

Embeddings

response = provider.embed("text-embedding-005", "Hello")
print(response.embeddings)

Async

All methods have async variants: achat, achat_stream, aembed.

Registry

Use with the lmux registry to route across multiple providers:

from lmux import Registry

registry = Registry()
registry.register("gcp", provider)
response = registry.chat("gcp/gemini-2.5-pro", messages)

Provider Params

from lmux_gcp_vertex import GCPVertexParams

response = provider.chat(
    "gemini-2.5-pro",
    messages,
    provider_params=GCPVertexParams(thinking_config={"thinking_budget": 1024}),
)
Parameter Type Description
safety_settings list[SafetySetting] Content safety thresholds
presence_penalty float Presence penalty
frequency_penalty float Frequency penalty
seed int Deterministic sampling seed
labels dict[str, str] Request labels
thinking_config dict Thinking/reasoning configuration

Constructor Options

GCPVertexProvider(
    auth=...,       # AuthProvider, default: GCPVertexADCAuthProvider()
    project=...,    # GCP project ID
    location=...,   # GCP region
    vertexai=...,   # Use Vertex AI (default: True) vs. AI Studio
)

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

lmux_gcp_vertex-0.6.4.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

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

lmux_gcp_vertex-0.6.4-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file lmux_gcp_vertex-0.6.4.tar.gz.

File metadata

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

File hashes

Hashes for lmux_gcp_vertex-0.6.4.tar.gz
Algorithm Hash digest
SHA256 17d14e8c51581d192bb885b21b1e640bd21884f1564a6c0aa3df456742e158b0
MD5 64dad65ad4d7bfca29a2b6b207bb9e02
BLAKE2b-256 c41d98275bdce04bc48f1633f701cad36a17fc084b8193347a7c6b54e589a3cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for lmux_gcp_vertex-0.6.4.tar.gz:

Publisher: publish.yml on cluebbehusen/lmux

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

File details

Details for the file lmux_gcp_vertex-0.6.4-py3-none-any.whl.

File metadata

File hashes

Hashes for lmux_gcp_vertex-0.6.4-py3-none-any.whl
Algorithm Hash digest
SHA256 91ac0f5a1c73d7d1f0c4015147bea3c8cc7b4e90bfe8dde4d1fa271d11c99948
MD5 780a1529804343fd2d5e351050700a24
BLAKE2b-256 dfbcf84b6ec530fcf8fe9ff977044e5f6ca5e464ba560819c64d86079bccc6d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for lmux_gcp_vertex-0.6.4-py3-none-any.whl:

Publisher: publish.yml on cluebbehusen/lmux

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