Skip to content

Gemini

Clanker supports two Gemini provider modes: gemini-api (Google AI Studio with an API key) and gemini (Vertex AI with Application Default Credentials). Both use the Google GenAI SDK.


gemini-api (Google AI Studio)

This is the recommended mode for most users. It requires an API key from Google AI Studio.

Provider Details

PropertyValue
Config keygemini-api
Default modelgemini-2.5-flash
Auth methodAPI key from Google AI Studio

Configuration

yaml
ai:
  default_provider: gemini-api
  providers:
    gemini-api:
      model: gemini-2.5-flash
      api_key_env: GEMINI_API_KEY

Environment Variable

VariableDescription
GEMINI_API_KEYGoogle AI Studio API key

CLI Flag Overrides

FlagDescription
--ai-profile gemini-apiSelect this provider
--gemini-key <key>Override the API key for this query
--gemini-model <model>Override the model for this query

Usage Example

bash
export GEMINI_API_KEY="AIzaSy..."

clanker ask "What EC2 instances are running in us-east-1?"

# Override model
clanker ask --gemini-model gemini-2.5-pro "Generate a compliance report"

gemini (Vertex AI / Application Default Credentials)

This mode uses GCP Application Default Credentials and does not require an API key. It is intended for users who already have a GCP project configured.

Provider Details

PropertyValue
Config keygemini
Default modelgemini-2.0-flash
Auth methodGCP Application Default Credentials (gcloud auth application-default login)

Configuration

yaml
ai:
  default_provider: gemini
  providers:
    gemini:
      model: gemini-2.0-flash

Setup

Before using this provider, authenticate with GCP:

bash
gcloud auth application-default login

CLI Flag Overrides

FlagDescription
--ai-profile geminiSelect this provider
--gemini-model <model>Override the model for this query

Usage Example

bash
clanker ask --ai-profile gemini "List all Cloud Run services"

Fallback Behavior

If the Gemini provider fails to initialize (for example, due to missing credentials), Clanker automatically falls back to OpenAI if an OpenAI API key is available. This fallback is logged when debug mode is enabled.