Skip to content

Provider Gemini

Muhammet Şafak edited this page May 30, 2026 · 3 revisions

Home / Providers / Gemini

Provider: Google Gemini

Direct HTTPS API integration with generativelanguage.googleapis.com.

Configuration

provider: gemini
providers:
  gemini:
    api_key: AIza...
    model: gemini-3.5-flash

Equivalent CLI / env:

commitbrief config set provider gemini
commitbrief config set providers.gemini.api_key AIza...
commitbrief config set providers.gemini.model gemini-3.5-flash

export GEMINI_API_KEY=AIza...

Get an API key from https://aistudio.google.com/.

Supported models

Model ID Default? Context window
gemini-3.5-flash 1,000,000 tokens
gemini-3.1-pro-preview 1,000,000 tokens
gemini-3.1-flash-lite 1,000,000 tokens

gemini-3.1-pro-preview is a preview model — the public pricing page lists the Pro tier only under that ID. The model constant will be updated to the stable ID once Google promotes it. The 1M context window is the documented Gemini 3.x baseline; exact per-model limits for these preview models were not broken out in the model docs at integration time, so 1M is used as the safe floor for the over-context guard.

Pricing (per 1M tokens, paid "Standard" tier)

Model Input Output Cached input
gemini-3.5-flash $1.50 $9.00 $0.375
gemini-3.1-pro-preview $2.00 $12.00 $0.50
gemini-3.1-flash-lite $0.25 $1.50 $0.0625

gemini-3.1-pro-preview has tiered pricing — requests above 200K input tokens are billed at $4 input / $18 output for the whole session. The binary snapshots the ≤200K base tier, so the verbose cost footer may under-report on very large inputs.

Gemini's context-caching API is separate from inline prompt caching and is not currently wired into the CommitBrief integration; the cached-input rate (Gemini's implicit-cache read discount, ~0.25× input) is tracked for accurate reporting when it is.

Rates from https://ai.google.dev/gemini-api/docs/pricing; the binary's table is in internal/provider/gemini/pricing.go.

Max output tokens

The SDK takes int32 for max-output-tokens; CommitBrief bounds the request to [1, math.MaxInt32] with a default of 4096 so a malformed config never wraps to a negative number (UC-115 in v1.0.0-rc.1 security audit).

Structured findings

The Gemini client uses ResponseSchema to constrain the model to the v1 findings JSON shape. Same retry-once-then-degrade behavior as the other API providers.

See also

Clone this wiki locally