Configuration for the Gemini model provider.
A provider block with kind = "gemini" configures the Google Gemini
provider, which serves the Gemini family of models via the GenerateContent API.
| Field | Type | Required | runtime() | Default | Description |
|---|---|---|---|---|---|
kind | gemini | yes | no | … | Provider kind. |
models | array<string | ModelEntry> | no | no | unset | Models permitted for this provider, with optional model-specific inference settings. |
config | ProviderConfig | no | unset | API key used to connect to this provider. | |
params | InferenceParams | no | unset | Default inference settings for requests to this provider. |
When config.api_key is unset, the key is read from the GEMINI_API_KEY environment variable. The
agent fails to start when neither is set.
| Field | Type | Required | runtime() | Default | Description |
|---|---|---|---|---|---|
name | string | yes | no | … | Model identifier. |
params | InferenceParams | no | unset | Model-specific inference parameter overrides. |
| Field | Type | Required | runtime() | Default | Description |
|---|---|---|---|---|---|
api_key | string | no | yes | unset | Gemini API key. Wrap in secret(runtime(...)) to keep it out of build artifacts. |
headers | map<string, HeaderValue> | no | yes | {} | HTTP headers sent with every model request, keyed by header name. Header names are case insensitive. |
A header value is one of:
| Form | Header value |
|---|---|
| a string | The string, unchanged. |
expression("source") | The result of the CEL expression source, evaluated for each model request. |
config {
headers = {
"X-Team" = "platform"
"X-Tenant-Id" = expression("ctx.tenant_id")
}
}For the values an expression can read and how evaluation fails, see Send custom headers.
The params block sets inference parameter defaults for all models under this provider. All fields
are optional and support runtime().
| Field | Type | Required | runtime() | Default | Description |
|---|---|---|---|---|---|
max_tokens | integer | no | yes | unset | Maximum number of tokens to generate. |
temperature | number | no | yes | unset | Controls randomness when selecting the next token; higher values produce more varied output. |
top_p | number | no | yes | unset | Selects tokens from the smallest group whose combined probability reaches this value. |
top_k | integer | no | yes | unset | Limits the next-token choices to the K most likely tokens. |
stop_sequences | array<string> | no | yes | unset | Sequences that stop generation. |
seed | integer | no | yes | unset | Seed for deterministic sampling. |
provider_params | object | no | yes | unset | Provider-specific parameters passed directly to the API. |
frequency_penalty and presence_penalty are not part of the Gemini API. Setting them has no
effect and they will be ignored.
| Model | Identifier |
|---|---|
| Gemini 2.5 Flash | gemini-2.5-flash |
| Gemini 2.5 Pro | gemini-2.5-pro |
| Gemini 2.0 Flash | gemini-2.0-flash |
| Gemini 1.5 Flash | gemini-1.5-flash |
| Gemini 1.5 Pro | gemini-1.5-pro |
provider "gemini" {
kind = "gemini"
models = [
"gemini-2.5-flash",
{
name = "gemini-2.5-pro"
params {
max_tokens = 16384
temperature = 0.4
}
}
]
config {
api_key = secret(runtime("GEMINI_API_KEY"))
}
params {
max_tokens = 4096
temperature = 0.5
}
}
agent "assistant" {
graph {
type = "react"
}
model {
provider = "gemini"
name = "gemini-2.5-flash"
}
}Always wrap API keys in secret(runtime(...)). This prevents the key from appearing in build
artifacts and the output of agentc inspect.
© 2026 pogue.dev. All rights reserved.
CC BY 4.0