Installation
Usage
Vertex AI
To use Gemini via Vertex AI instead of Google AI Studio, passuse_vertex=True:
Vertex AI uses Application Default Credentials. Run
gcloud auth application-default login or set GOOGLE_APPLICATION_CREDENTIALS to your service account key file.Configuration options
| Parameter | Type | Default | Description |
|---|---|---|---|
google_api_key | str | — | Google AI Studio API key (not needed when use_vertex=True) |
rail_api_key | str | — | Your RAIL API key |
rail_threshold | float | None | Block or regenerate below this score |
rail_policy | str | "log_only" | "log_only" | "block" | "regenerate" |
rail_mode | str | "basic" | "basic" | "deep" |
use_vertex | bool | False | Route through Vertex AI instead of Google AI Studio |
gcp_project | str | — | GCP project ID (required when use_vertex=True) |
gcp_region | str | "us-central1" | Vertex AI region |
What’s next
OpenAI Integration
RAILOpenAI wrapper for chat completions.
Anthropic Integration
RAILAnthropic wrapper for Claude.
Concepts: Middleware
How provider wrappers work under the hood.
Python SDK Overview
Full Python SDK installation and reference.